akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
#include <map>
#include <math.h>

using ll = long long;
using namespace std;

int main(){
    double a, b, c, d, f;
    double x, y, e;
    vector<float> waters;
    vector<float> sugars;
    cin >> a >> b >> c >> d >> e >> f;

    reps(i, 0, f+1){
        reps(j, 0, f+1){
            x = 100*(a*i+b*j);
            if(x<=f) waters.push_back(x);

            y = c*j+d*i;
            if(y<=f) sugars.push_back(y);
        }
    }


    double sugar, water, sugar_water, max_sugar=0, max_sugar_water=1;
    for(int i=0; i<sugars.size(); i++){
        for(int j=0; j<waters.size(); j++){
            sugar = sugars[i];
            water = waters[j];
            sugar_water = sugar+water;

            if(sugar_water>f)continue;
            else if(sugar_water==0) continue;
            else if(sugar/sugar_water<=e/(100+e)){
                if((sugar/sugar_water)>= (max_sugar/max_sugar_water)){
                    max_sugar = sugar;
                    max_sugar_water = sugar_water;
                }
            }
        }
    }
    cout << max_sugar_water << " " << max_sugar << endl;
}

Measured memory_bytes: 1400
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll ans;
    if (N % 2 == 0) {
        ans = N / 2 - 1;
    } else {
        ans = N / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#include <stdio.h>
using namespace std;
int segmant_tree[1<<20];

void lazy_propagation(int node , int start , int en);
void war(int node, int start , int en);
int a ,b,x;
int main(){
      ios::sync_with_stdio(false);
      int x;
      cin>>x;
      int arr[x];
      for(int i=0;i<x;i++)cin>>arr[i];
      sort(arr,arr+x);
      double ans=(arr[0]+arr[1])/2.0;
      for(int i=2;i<x;i++ ){
        ans=(ans+arr[i])/2;
      }
      printf("%.12f",ans);

}


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

using namespace std;

// LazyAddSegmentTree
template<typename T>
class LazyAddSegTree{
public:
    int n;
    T defaultValue;
    vector<T> dat;
    vector<T> lazy;

    LazyAddSegTree(vector<T>& v, T defaultValue){
        n = 1;
        int vSize = (int)v.size();
        while(n < vSize){
            n *= 2;
        }
        dat.assign(2 * n - 1, defaultValue);
        lazy.assign(2 * n - 1, 0);
        this->defaultValue = defaultValue;

        for(int i = 0; i < vSize; i++){
            dat[i + n - 1] = v[i];
        }
        for(int i = n - 2; i >= 0; i--){
            dat[i] = ope(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }

    T add(int a, int b, T value, int k = 0, int l = 0, int r = -1){
        if(r < 0){
            r = n;
        }
        propagate(k);

        if(r <= a || b <= l){
            return dat[k];
        }

        if(a <= l && r <= b){
            lazy[k] += lazyPlus(value, l, r);
            propagate(k);
            return dat[k];
        }
        else{
            T vl = add(a, b, value, 2 * k + 1, l, (l + r) / 2);
            T vr = add(a, b, value, 2 * k + 2, (l + r) / 2, r);
            dat[k] = ope(vl, vr);
            return dat[k];
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = -1){
        if(r < 0){
            r = n;
        }

        if(r <= a || b <= l){
            return defaultValue;
        }
        propagate(k);

        if(a <= l && r <= b){
            return dat[k];
        }
        else{
            T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return ope(vl, vr);
        }
    }

private:

    void propagate(int k){
        if(lazy[k] != 0){
            dat[k] += lazy[k];
            if(k <= n - 2){
                T value = lazyPropPlus(lazy[k]);
                lazy[2 * k + 1] += value;
                lazy[2 * k + 2] += value;
            }

            lazy[k] = 0;
        }
    }

    T ope(T a, T b){
        return min(a, b);
    }

    T lazyPlus(T value, int l, int r){
        return value;
    }

    T lazyPropPlus(T value){
        return value;
    }
};

int main(){

    int n, q;
    cin >> n >> q;

    vector<long long> v(n, 0);
    const long long INF = (1LL << 60);
    LazyAddSegTree<long long> lazySegTree(v, INF);

    for(int loop = 0; loop < q; loop++){
        int com;
        cin >> com;
        if(com == 0){
            int s, t, x;
            cin >> s >> t >> x;
            lazySegTree.add(s, t + 1, x);
        }
        else{
            int s, t;
            cin >> s >> t;
            cout << lazySegTree.query(s, t + 1) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 7852
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}


struct BIT{
    // [1,n]
    int n; vector<ll> bit;
    // 初期化
    BIT(int _n){
        n = _n;
        bit = vector<ll>(n+1,0);
    }
    // sum of [1,i]
    ll sum(int i){
        ++i;
        ll s = 0;
        while(i>0){
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }
    // add x in i-th element
    void add(int i, ll x){
        ++i;
        while(i<=n){
            bit[i] += x;
            i += i & -i;
        }
    }
};

int main(){
    int n,K;
    ll L;
    cin >>n >>K >>L;
    vector<int> a(n);
    rep(i,n) cin >>a[i];

    // k番目の数がx以下である区間がいくつあるかを数える
    auto check = [&](int x){
        vector<bool> s(n);
        rep(i,n) s[i] = (a[i]<=x);

        int ct = 0;
        rep(i,K-1) ct += s[i];

        const int N = 200020;
        BIT b(N+10);
        vector<int> t(n);
        for(int i=K-1; i<n;++i){
            ct += s[i];
            t[i] = ct;
            b.add(t[i],1);
        }

        ct = 0;
        ll num = 0;
        rep(i,n-K+1){
            num += b.sum(N)-b.sum(K-1+ct);
            ct += s[i];
            b.add(t[i],-1);
        }

        // printf(" %d: %lld\n", x,num);
        return num >= L;
    };

    int l=0, r=n;
    while(r-l>1){
        int m = (l+r)/2;
        if(check(m)) r=m;
        else l=m;
    }
    cout << r << endl;
    return 0;
}



Measured memory_bytes: 5964
#include <iostream>
#include <map>
#define ll long long
#define mod 1000000007
using namespace std;
map<int,int>m;
int an[100010];
int main(){
  int n,a;
  ll ans=1;
  cin>>n;
  if(n%2!=0){
    for(int i=1;i<=n;i++){
      cin>>a;
      m[a]++;
      if(m[a]==3||m[0]==2||a%2!=0){
        cout<<0<<endl;
        return 0;
      }
    }
    for(int i=1;i<=n/2;i++){
      ans=ans*2%mod;
    }
  }
  else {
    for(int i=0;i<n;i++){
      cin>>a;
      m[a]++;
      if(m[a]==3||a%2==0){
        cout<<0<<endl;
        return 0;
      }
    }
    for(int i=1;i<=n/2;i++){
      ans=ans*2%mod;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
/*starting with the name of almighty ALLAH*/
/*solved by RAKIB JOY*/
// Practice is the only shortcut to improve
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define vc vector
#define vi vc<int>
#define vl vc<ll>
#define dbg(x) cout<<x<<endl;
#define mp(x,y) make_pair(x,y)
#define yes dbg("YES")
#define no dbg("NO")
#define tst int t;cin>>t;while(t--)
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.begin(),v.end(),greater<int>());
#define rj ios::sync_with_stdio(false);cin.tie(0);
#define rvs(v) reverse(v.begin(),v.end());
#define F first
#define S second
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define PI 2*acos(0.0)
#define pii pair<int,int>
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define coutv(v) for(auto it:v)cout<<it<<' ';cout<<endl;
#define cinv(v) for(auto &it:v)cin>>it;
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using ordered_set =tree<T, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;
*/
//sieve bool b[1000005];void primenire(){int i, j;b[0]=true;b[1]=true;for(i=4; i<=1000000; i+=2){b[i]=true;}for(i=3; i<=1001; i+=2){if(!b[i]){for(j=i*i; j<=1000001; j+=2*i){b[j]=true;}}}}
//power ll power(ll a,ll b){if(b==0) return 1LL;if(b&1) return a*power(a,b-1);else return power(a,b/2)*power(a,b/2);}
//bigmod long long int m(long long int a,long long int b,long long int c){if(b==0)return 1;if(b%2==0){long long int  tmp=m(a,b/2,c);return ((tmp%c)*(tmp%c))%c;}elsereturn ((a%c)*(m(a,b-1,c)%c))%c;}
//MaxSubarraySum ll mss(vector<ll>v){ll mx=v[0];ll sz=v.size();for(int i=1;i<=sz;i++){ll t=v[i]+v[i-1];if(t>=v[i]) v[i]=t;mx=max(mx,v[i]*1LL);}return mx;}
//combination ll com[1001][1001];void combination(){com[1][1]=1;com[1][0]=1;for(ll i=2; i<=1000; i++){com[i][0]=1;for(ll j=1; j<=i; j++){com[i][j]=com[i-1][j]+com[i-1][j-1];}}}
///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

void solve()
{
   ll a;
   cin>>a;
   vl v(a);
   fr(i,0,a-1) cin>>v[i];
   ll mx=0,cnt=0;
   fr(i,0,a-1)
   {
      mx=max(mx,v[i]);
      if(mx>=v[i]) cnt+=(mx-v[i]);
   }
   cout<<cnt<<endl;
}
int main()
{
    rj
    solve();



    return 0;
}



Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
string s, t, kq = "";
int f[3009][3009], l1, l2;
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    cin >> s;
    cin >> t;
    l1 = s.size();
    l2 = t.size();
    s = ' ' + s;
    t = ' ' + t;
    for(int i = 0; i <= max(l1, l2); ++ i)
    {
        f[0][i] = 0;
        f[i][0] = 0;
    }
    for(int i = 1; i <= l1; ++ i)
    {
        for(int j = 1; j <= l2; ++ j)
        {
            if(s[i] == t[j]) f[i][j] = f[i - 1][j - 1] + 1;
            else f[i][j] = max(f[i - 1][j], f[i][j - 1]);
        }
    }
    while(l1 > 0 && l2 > 0)
    {
        if(s[l1] == t[l2])
        {
            kq += s[l1];
            -- l1;
            -- l2;
        }
        else if(f[l1][l2] == f[l1 - 1][l2]) -- l1;
        else -- l2;
    }
    reverse(kq.begin(), kq.end());
    cout << kq;
    return 0;
}


Measured memory_bytes: 35584
S = input()

T = S[:2]
U = S[2:]

if (int(T) > 12 or int(T) == 0) and 12 >= int(U) >= 1:
  print('YYMM')
elif (int(U) > 12 or int(U) == 0) and 12 >= int(T) >= 1:
  print('MMYY')
elif (12 >= int(T) >= 1) and (12 >= int(U) >= 1):
  print('AMBIGUOUS')
else:
  print('NA')

Measured memory_bytes: 3064
import java.util.Scanner;

class A {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final int A = sc.nextInt();
        final int B = sc.nextInt();
        System.out.println(Math.min(A, B) + " " + Math.max(A + B - N, 0));
    }
}
public class Main {
    public static void main(String... args) {
        A.main();
    }
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vll a(n+1),b(n);
    rep(i,n+1) cin>>a[i];
    rep(i,n) cin>>b[i];
    ll ans=0;
    rep(i,n){
        if (b[i]<=a[i]){
            ans+=b[i];
        }else{
            b[i]-=a[i];
            ans+=a[i];
            if (b[i]<=a[i+1]){
                ans+=b[i];
                a[i+1]-=b[i];
            }else{
                ans+=a[i+1];
                a[i+1] = 0;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
a,b,c=map(int,input().split())
d=0
if c>=a:
    d+=a
    c-=a
    if c>=b:
        d+=2*b
        c-=b
        if c>=1:
            print(d+1)
        else:
            print(d)
    else:
        print(d+c+b)
else:
    print(c+b)

Measured memory_bytes: 3060
def main():
    n = int(input())
    a = list(map(int, input().split(' ')))
    a = [a[i]-i-1 for i in range(n)]
    a.sort()
    if n%2 == 0:
        num = int(n/2)
        b = int((a[num-1]+a[num])/2)
        a = [abs(a[i]-b) for i in range(n)]
    else:
        num = int(n/2)
        b = int(a[num])
        a = [abs(a[i]-b) for i in range(n)]
    print(sum(a))
    
main()

Measured memory_bytes: 26184
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long
constexpr int N = 4;

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

    array<int, N> x, y;
    cin >> x[0] >> y[0] >> x[1] >> y[1];

    const int ax = x[1] - x[0];
    const int ay = y[1] - y[0];

    x[2] = x[1] - ay;
    y[2] = y[1] + ax;

    x[3] = x[2] - ax;
    y[3] = y[2] - ay;

    cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include<string>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a>=13){
    cout<<b<<endl;
  }
  else if(a<6){
    cout<<"0"<<endl;
  }
  else if(6<=a<=12){
    cout<<b/2<<endl;
  }

}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

ll n;
vector<ll> A;
vector<bool> B;

bool cul(ll x){
    for(int i=0;i<2*n+1;i++){B[i]=A[i]>=x;}
    ll l=0;
    for(int i=1;i<=n;i++){
        if(B[i]==B[i-1]){l=i;}
    }
    ll r=2*n;
    for(ll i=2*n-1;i>=n;i--){
        if(B[i]==B[i+1]){r=i;}
    }
    if(l==0 && r==2*n){
        return ((bool)(n&1))^B[n];
    }
    if(n-l>=r-n){return B[r];}
    return B[l];
}



int main(){
    cin>>n;
    n--;
    A.resize(2*n+1);
    B.resize(2*n+1);
    for(auto &I:A){cin>>I;}
    ll l=1;
    ll r=2*n+1;
    while(r-l>3){
        ll m=l+(r-l)/2;
        if(cul(m)){l=m;}
        else{r=m;}
    }
    for(ll i=r;i>=l;i--){
        if(cul(i)){cout<<i<<endl; return 0;}
    }
    assert(false);
    
    
    return 0;
}


Measured memory_bytes: 1792
def main():
    N = int(input())
    lo = 1
    hi = 10000
    while lo < hi:
        mid = (lo + hi) // 2
        if mid * (1 + mid) // 2 < N:
            lo = mid + 1
        else:
            hi = mid
    total = lo * (1 + lo) // 2
    skip = total - N
    for i in range(1, lo+1):
        if i != skip:
            print(i)


if __name__ == "__main__":
    main()


Measured memory_bytes: 42476
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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 int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int h, w;
string s[55];
int dist[55][55];

int main() {
    cin >> h >> w;
    rep(i, h) cin >> s[i];

    rep(i, h) rep(j, w) dist[i][j] = INF;
    dist[0][0] = 0;
    queue<pii> q;
    q.emplace(0, 0);

    while (!q.empty()) {
        pii now = q.front();
        q.pop();
        int y = now.first, x = now.second;
        rep(i, 4) {
            int ny = y + dy[i];
            int nx = x + dx[i];
            if (nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
            if (s[ny][nx] == '#') continue;
            if (chmin(dist[ny][nx], dist[y][x] + 1)) {
                q.emplace(ny, nx);
            }
        }
    }

    if (dist[h-1][w-1] == INF) {
        cout << -1 << endl;
        return 0;
    }

    int black = 0;
    rep(i, h) rep(j, w) {
        if (s[i][j] == '#') black++;
    }

    cout << h*w - black - dist[h-1][w-1] - 1 << endl;
}


Measured memory_bytes: 3632
l,r = [int(i) for i in input().split()]
d = r-l
if d > 2019: d = 2019
l = l % 2019
r = l + d

ans = 2019
for i in range(l, r):
  for j in range(i+1, r+1):
    ans = min(ans, (i*j)%2019)

print(ans)

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

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

		for (i=0; i<n; i++) { 
				cin >> b >> f >> r >> v;
				m[b-1][f-1][r-1] += v;
				//cout << m[b-1][f-1][r-1] << " ";
		}

		for (i=0; i<4; i++) {
				for (j=0; j<3; j++) {
						for (k=0; k<10; k++) cout << " " << m[i][j][k];
						if (j==2 && i!=3) cout << "\n####################\n";
						else cout << "\n";
				}
		}
}

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

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

	int a = 0;
	while (s[a] != 'A') a++;

	int z = s.length() - 1;
	while (s[z] != 'Z') z--;

	cout << z - a + 1 << endl;

	return 0;
}


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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

bool corner(vvi& grid,int i,int j)
{
	return i>0 && j>0 && grid[i-1][j-1]!=grid[i-1][j] && grid[i-1][j-1]!=grid[i][j-1];
}

int check(vvi& grid,int i,int j)
{
	int h=grid.size(),w=grid[0].size(),res=0;
	if(0<=i && i<h && 0<=j && j+1<w && grid[i][j]==-1 && grid[i][j+1]==-1 && !corner(grid,i,j))
		res|=1;
	if(0<=i && i+1<h && 0<=j && j<w && grid[i][j]==-1 && grid[i+1][j]==-1 && !corner(grid,i,j))
		res|=2;
	return res;
}

int dfs(vvi& grid,int i,int j,int cnt)
{
	int h=grid.size(),w=grid[0].size();
	if(cnt*2==h*w) return 1;
	if(j==w) i++,j=0;
	if(i==h) return 0;
	if(grid[i][j]!=-1) return dfs(grid,i,j+1,cnt);
	
	int flg=check(grid,i,j),res=0;
	// 横
	if(flg&1){
		grid[i][j]=grid[i][j+1]=cnt;
		res+=dfs(grid,i,j+1,cnt+1);
		grid[i][j]=grid[i][j+1]=-1;
	}
	// 縦
	if(flg&2){
		grid[i][j]=grid[i+1][j]=cnt;
		res+=dfs(grid,i,j+1,cnt+1);
		grid[i][j]=grid[i+1][j]=-1;
	}
	return res;
}

int main()
{
	for(int h,w;cin>>h>>w && h|w;){
		vvi grid(h,vi(w,-1));
		cout<<dfs(grid,0,0,0)<<endl;
	}
}

Measured memory_bytes: 1232
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc145/tasks/abc145_b

n = int(input())
s = input()
if len(s) % 2 == 0:
    m = len(s) // 2
    if s[:m] == s[m:]:
        print("Yes")
        exit()
print("No")


Measured memory_bytes: 2940
from itertools import accumulate
from math import*
from collections import deque
from collections import defaultdict
from itertools import permutations
from heapq import*
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
from functools import reduce

n,a,b = map(int,input().split())
x = list(map(int,input().split()))
edge = []
class UnionFind():
    def __init__(self, N):
        self.rank = [0] * N
        self.par = [i for i in range(N)]
        self.counter = [1] * N

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            z = self.counter[x] + self.counter[y]
            self.counter[x], self.counter[y] = z, z
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def size(self, x):
        x = self.find(x)
        return self.counter[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)
for i in range(1,n):
    c = (x[i]-x[i-1])*a
    edge.append((c,i-1,i))
#クラスカル法
uf = UnionFind(n)
edge.sort()
ans = 0
edge_cnt = 0
i = 0
while edge_cnt < n-1:
    cost,i1,i2 = edge[i]
    if not uf.same(i1,i2):
        ans += min(b,cost)
        uf.unite(i1,i2)
        edge_cnt += 1
    i += 1
print(ans)

Measured memory_bytes: 120612
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
using namespace std;

#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 REP(i, n) for (int i = 0; i < n; ++i)

const int kMaxS = 100000;

string s;
int ans = 0;

int t;

int main() {
  cin >> s;

  t = s.length();
  REP(i, s.length()-1) {
    if (s[i] != s[i+1]) {
      t = min(t, max(i+1, (int)(s.length())-i-1));
    }
  }
  ans = t;

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


Measured memory_bytes: 512
def dfs(pos):
    global N,M,X,a,CA,ans
    if pos==N:
        res = 0
        comp = [0] * M
        for i in range(N):
            if a[i]:
                res += CA[i][0]
                for j in range(1,M+1):
                    comp[j-1] += CA[i][j]
        for i in range(M):
            if comp[i]<X:
                return
        ans = min(ans,res)
        return
    a[pos] = 0
    dfs(pos+1)
    a[pos] = 1
    dfs(pos+1)

N,M,X = map(int,input().split())
CA = []
for i in range(N):
    CA.append(list(map(int,input().split())))
ans = int(1e9)
a = [0] * N
dfs(0)
if ans==int(1e9):
    print(-1)
else:
    print(ans)


Measured memory_bytes: 9112
# encoding: utf-8
N = int(input())
abc = [list(map(int, input().split())) for i in range(N)]


score = [[0] * N for i in range(3)] # N - 1 is used as -1
for i in range(N):
    for dst in range(3):
        tmp = abc[i][dst]
        for src in range(3):
            if dst == src: continue
            elif score[src][i - 1] + tmp > score[dst][i]:
                score[dst][i] = score[src][i - 1] + tmp

# print('#', score)
if N == 1: print(max(abc[-1]))
else: print(max((score[0][-1], score[1][-1], score[2][-1])))

Measured memory_bytes: 42444
#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
// #define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(int N, int W,vector<int>& w, vector<int>& v) {
    vector<vector<ll>> dp(N+1, vector<ll>(1e3 * 100+1, 1e11+1)); // dp[product 1..i][value <= j] = min of weight

    REP(j,1,dp[0].size()) dp[0][j] = 1e11+1;
    REP(i,0,N+1) dp[i][0] = 0;

    REP(i,1,N+1) {
        REP(j,1,dp[i].size()) {
            if (j >= v[i-1]) {
                dp[i][j] = min(dp[i-1][j-v[i-1]] + w[i-1], dp[i-1][j]);
            } else {
                dp[i][j] = dp[i-1][j];
            }
//            cout << i << " " << j << " " << dp[i][j] << '\n';
        }
    }

	stringstream ss;
    ll answer = 0;
    REP(j,0,dp[N].size()) if (dp[N][j] <= W) answer = j;
    ss << answer;
	cout << ss.str() << '\n';

    return;
}

signed main() {
    int N, W;
    cin >> N >> W;
    
    vector<int> w(N);
    vector<int> v(N);
    REP(i,0,N) {
        cin >> w[i];
        cin >> v[i];
    }

    solve(N, W, w, v);
    
    return 0;
}



Measured memory_bytes: 80256
N = int(input())
S = []
count = 0

dic = {}
for i in range(N):
    S.append(input())
    S[i] = sorted(S[i])
    S[i] = ''.join(S[i])
    if dic.setdefault(S[i], 0) > 0:
        count += dic[S[i]]
        dic[S[i]] += 1
    else:
        dic[S[i]] = 1
print(count)


Measured memory_bytes: 75480
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n,m,p,q,r,x,y;
	vector<int>::iterator itx,ity,it;
	for(;cin>>n>>m>>p>>q>>r;cout<<x<<endl){
		vector<int> v1(1),v2;
		
		for(v1.push_back(r);m--;v2.clear()){
			cin>>x>>y;
			itx=upper_bound(v1.begin(),v1.end(),x);
			ity=upper_bound(v1.begin(),v1.end(),y);
			
			if( ity-v1.begin()+1 & 1 )v2.push_back(0);
			v2.push_back(0);
//			v2.insert(v2.end(),ity-v1.begin()&1?1:2,0);
			for(it=ity;it!=v1.end();++it)
				v2.push_back(*it - y);
			
			if(v1.end()-itx & 1)v2.push_back(n-y);
			for(it=itx;it!=ity;++it)
				v2.push_back(*it-x+n-y);
			
			it = v1.begin();
			if(ity-v1.begin() & 1)++it;
			if(!it[1])it+=2;
			if(*it+n-x==v2.back()){++it;v2.pop_back();}
			for(;it!=itx;++it)
				v2.push_back(*it+n-x);
			
			v1.swap(v2);
		}
		v1.insert( upper_bound(v1.begin(),v1.end(),p-1), 2, p-1);
		v1.insert( lower_bound(v1.begin(),v1.end(),q), q );
		v1.push_back(n);
		it = upper_bound(v1.begin(),v1.end(),p-1);
		if(it-v1.begin() & 1) --it;
		for(x=0;*it<q;++it){
			m=*it;++it;
			x+=*it-m;
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <bits/stdc++.h>
#include<algorithm>
#include<cmath>
using namespace std;

int main()
{
    long long n,s,x;
    cin>>n>>s;
    vector<long long > v;
    for(long long i=0;i<n;i++){
    cin>>x;
    v.push_back(x);
    }sort(v.begin(),v.end());
    long long k=v.size(),sum=0;
    if(s>=n){
       cout<<0;
    }else if(s<n){
    if(s>0){
    for(long long i=(k-1);i>0;i--){
    v[i]=0;
    s--;
    if(s==0)
        break;
    }}
    for(long long i=0;i<n;i++){
     sum+=v[i];
    }
    cout<<sum;
    }
        return 0;
    }


Measured memory_bytes: 2420
N, Q = gets.split.map &:to_i
$nodes = *0...N
def root(a)
  a == $nodes[a] ? a : root($nodes[a] = $nodes[$nodes[a]])
end
def unite(a, b)
  $nodes[root(a)] = b
end
def same?(a, b)
  $nodes[root(a)] == $nodes[root(b)]
end

$<.map{|s|
  com, x, y = s.split.map &:to_i
  if com == 0
    unite(x, y)
  else
    p same?(x, y) ? 1 : 0
  end
}

Measured memory_bytes: 10020
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n;i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		
		bubblesort_swap_num(arr);
	}
	public static void bubblesort_swap_num(int[] arr){
		int n = arr.length;
		int ans = 0;
		for(int i=0; i<n; i++){
			for(int j=1; j<n-i; j++){
				if(arr[j-1] > arr[j]){
					int tmp = arr[j-1];
					arr[j-1] = arr[j];
					arr[j] = tmp;
					ans++;
				}
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}
}



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

int main()
{
  int n, m, l;
  cin >> n >> m >> l;
  int a[100][100], b[100][100];
  for (int i=0; i<n; i++)
    for (int j=0; j<m; j++)
      cin >> a[i][j];
  for (int i=0; i<m; i++)
    for (int j=0; j<l; j++)
      cin >> b[i][j];
  long long c[100][100];
  for (int i=0; i<n; i++) {
    for (int j=0; j<l; j++) {
      c[i][j] = 0;
      for (int k=0; k<m; k++)
        c[i][j] += a[i][k] * b[k][j];
      if (j) cout << ' ';
      cout << c[i][j];
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;

int main(){
	int n, l;
	cin >> n >> l;
	string s[100];
	for (int i = 0; i < n; i++) cin >> s[i];
	sort(s, s + n);
	for (int i = 0; i < n; i++) cout << s[i];
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math
import datetime
import itertools
import sys
import copy

# 入力
#N = int(input())
#S = str(input())
#N, A, B = map(int, input().split())
#N = int(input())
A, B = map(int, input().split())

x = A*B

if A < B :
  tmp = A
  A = B
  B = tmp

r = A % B

while r != 0 :
  A = B
  B = r
  r = A%B

print (int(x/B))




Measured memory_bytes: 46444
import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int[] A = new int[N];
	for(int i = 0; i < N; i++){
		A[i] = s.nextInt();
	}

    long wallet = 1000;
	for(int i = 1; i < N; i++){
		if(A[i-1] < A[i]){
			wallet = wallet%A[i-1] + A[i]*(wallet/A[i-1]);
		}
	}
	System.out.println(wallet);
    
  }
}

Measured memory_bytes: 36140
function main(arg) {
  const lines = arg.trim().split('\n');
  const INF = Math.pow(10, 100);
  const times = lines.map(Number);
  const ceilTimes = times.map((v) => parseInt(Math.ceil(v / 10) * 10));
  const sum = (acc, v) => acc + v;
  let ans = INF;
  for (let i = 0; i < 5; i++) {
    let sumTimes = 0;
    sumTimes += ceilTimes.reduce(sum) - ceilTimes[i];
    sumTimes += times[i];
    ans = Math.min(ans, sumTimes);
  }
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29508
s = int(input())
max_m = 1000000
f = []
f.append(s)
set_f = set(f)

for i in range(1,max_m):
  n = f[i-1]
  if n % 2 == 0:
    f.append(n/2)
  else:
    f.append(3 * n + 1)
  set_f.add(f[i])
  if (len(f) != len(set_f)):
      print(len(f))
      break

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
 
int main()
{
    int debt = 100000;
    int n;
    cin >> n;
    for(int i=0; i<n; ++i)
    {
        int x = debt * 1.05 + 999;
        debt = x - x%1000;
    }
 
    cout << debt << endl;
return 0;
}

Measured memory_bytes: 1160
//containing t test cases
#include<bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define mkp make_pair
#define fi first
#define se second
#define ll long long
#define scan(n) ll a[n]; for(ll i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define rep(i,x,y) for(ll i=x;i<y;i++)
//#define int long long
using namespace std;
typedef vector<int>vi ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ; 
typedef pair<ll,ll> pll ;
typedef vector<pair<ll,ll> > vpll;
/*vi adj[200005];
ll vis[200005];
ll parent[200005];
ll level[200005];
ll arr[200005];
ll size[200005];*/
//endl mut bhool!!
long long power(long long a,long long b){
    long long ans=1;
    while(b>0)
    {
        if(b&1)
        {	
        	ans=(ans*a);
        }
        a=(a*a);
        b>>=1;
    }
    return ans;
        
}
int main()
{
	fast;
	int test=1;
	//cin>>test;
	while(test--)
	{
		ll x;
		cin>>x;
		ll a[1001];
		ll b[1001];
		a[0]=0;
		b[0]=0;
		for(ll i=1;i<=1000;i++)
		{
			a[i]=power(i,5);
			b[i]=a[i];
			//cout<<a[i]<<endl;
		}
		for(ll i=-1000;i<=1000;i++)
		{
		
			for(ll j=-1000;j<=1000;j++)
			{
				ll c,d;
				ll n,m;
				
				if(i<0)
				{
					n=-a[-i];
				}
				else
				{
					n=a[i];
				}
				if(j<0)
				{
					m=-a[-j];
				}
				else
				{
					m=a[j];
				}
				if(n-m==x)
				{
					cout<<i<<" "<<j;
					return 0;
				}
			}
		}
	}
	return 0;
}
/*
cout<<"YES"<<endl;
cout<<"NO"<<endl;
*/

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 105;
int a[maxn];

int main(){
    int n;
    scanf("%d", &n);
    int mx = -1000, mi = 1000;
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
        mx = max(mx, a[i]);
        mi = min(mi, a[i]);
    }
    int ans = 1e9;
    for(int x = mi; x <= mx; x++){
        int cost = 0;
        for(int i = 1; i <= n; i++){
            cost += (a[i] - x) * (a[i] - x);
        }
        ans = min(ans, cost);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int arr[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int n;
  cin >> n;
  cout << arr[n-1] << endl;
}

Measured memory_bytes: 256
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
int main(void){

    int n;
    while(cin>>n,n){
        int x[1002],p[1002],q[1002],r[1002],c[1002];
        for(int i = 0;i < n;i++)cin>>x[i]>>p[i]>>q[i]>>r[i],c[i] = p[i] * 4 + q[i] * 9  + r[i] * 4;
        int P,Q,R,C;
        cin>>P>>Q>>R>>C;
        bool NAflg = true;
        for(int i = 0;i < n;i++){
            if(!(p[i]>P || q[i]>Q || r[i]>R || c[i]>C)){
                NAflg = false;
                cout<<x[i]<<endl;
            }
        }
        if(NAflg)cout<<"NA"<<endl;
    }


    return 0;
}

Measured memory_bytes: 1180
n,m=map(int,input().split())
k=[]
s=[]
for i in range(m):
    l=list(map(int,input().split()))
    k.append(l[0])
    s.append(l[1:])
p=list(map(int,input().split()))
ans=0
for i in range(1<<n):
    cnt=0
    for j in range(m):
        sum=0
        for x in s[j]:
            sum+= i >> x-1
        if sum%2==p[j]:
            cnt+=1
        if cnt==m:
            ans+=1
print(ans)

Measured memory_bytes: 3064
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < n; i++)

int main() {
	int x;
	cin >> x;
	int w = x;
	int ans = 1;
	while (w % 360 != 0) {
		w += x;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

	/* ----- 変数宣言 ----- */
	int n;
	cin >> n;
	vector<vector<int>> a(2, vector<int>(n, 0));

	int shift;

	int i;

	vector<int> ans(n, 0);

	/* ----- 入力 ----- */
	for (i = 0; i < n; i++)		cin >> a[0][i];
	for (i = 0; i < n; i++)		cin >> a[1][i];

	/* ----- 計算 ----- */
	for (shift = 0; shift < n; shift++) {
		for (i = 0; i <= shift; i++)	ans[shift] += a[0][i];
		for (i = shift; i < n; i++)		ans[shift] += a[1][i];
	}

	sort(ans.begin(), ans.end());

	cout << ans.back() << endl;
}


Measured memory_bytes: 256
#include	<stdio.h>

int main()
{
	int a, b, c, d;

	scanf("%d %d %d %d", &a, &b, &c, &d);

	if (abs(a - b) <= d && abs(c - b) <= d || abs(a - c) <= d ){
		printf("Yes\n");
		goto fin;
	}
	printf("No\n");

	fin:
//	system("PAUSE");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    if (n > m) swap(n, m);
    cout << (k + m - 1) / m << '\n';
}


Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ld, ld> pdd;

void solve();

const int N = 2e5 + 10;

int main() {
    fast_cin();

    int t=1;
    // cin >> t;
    while(t--) {
        solve();
    }
}

void solve() {
    ll h;
    cin >> h;
    // int a[N];
    // for (int i=1; i <= n; i++) { 
    //     cin >> a[i];
    // }
    
    ll ans = 0;
    ll one = 1;
    int count = -1;
    while (h) {
        count++;
        ans += (one<<count);
        h /= 2;
    }
    
    cout << ans << '\n';
}


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

n = n%26
abc="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
dic={}
for i in range(26):
  dic[abc[i]]=abc[i+n]


tmp = [dic[si] for si in s]
ret="".join(tmp)

print(ret)

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

signed main() {
	int N;
	cin >> N;
	int last = -1, ans = 0;
	for (int i = 0; i < N; ++i) {
		int cur;
		cin >> cur;
		if (cur == last) {
			++ans;
			cur = -1;
		}
		last = cur;
	}
	cout << ans << endl;
}

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

int main() {

	string input;
	int longest = 0;
	int counter = 0;

	//===input

	cin >> input;
	input += 'Z';
	//===A,G,C,Tをカウントして、一番長いやつを出力する。

	for (int number = 0; number < input.length(); number++) {
		if (input[number] == 'A' || input[number] == 'G' || input[number] == 'C' || input[number] == 'T') {
			counter++;
			//cout << "1";
		}
		else {
			//cout << "0";
			if (counter > longest) {
				longest = counter;
			}
			counter = 0;
		}
	}

	cout << longest;

	return 0;
}
//*/

Measured memory_bytes: 256
x = int(input())
if 400<=x<=599:
    print(8)
elif 600<=x<=799:
    print(7)
elif 800<=x<=999:
    print(6)
elif 1000<=x<=1199:
    print(5)
elif 1200<=x<=1399:
    print(4)
elif 1400<=x<=1599:
    print(3)
elif 1600<=x<=1799:
    print(2)
elif 1800<=x<=1999:
    print(1)

Measured memory_bytes: 9196
import java.util.*;

class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
int[]a =new int[3];
int ans,q;
	q =sc.nextInt();
for(; q>0; q--){
	ans =0;
	for(int i=0; i<3; i++){
		 a[i]=sc.nextInt();
		}
	for(;;){
		if(a[0]>=1 && a[1]>=1 && a[2]>=1){
			ans++; a[0]--; a[1]--; a[2]--;
			}
		else if(a[0]>=2 && a[1]>=1){
			ans++; a[0]-=2; a[1]--;
			}
		else if(a[0]>=3){
			ans++; a[0]-=3;
		}
		else break;
	}
	System.out.println(ans);
}
}
}

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

#define pq priority_queue
#define mp make_pair
#define cauto const auto &

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define clr(ar, val) memset(ar, val, sizeof(ar))

typedef long long int64;
typedef long long lint;
typedef long long lli;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;

typedef pair<int, int> pint;
typedef pair<long, long> plong;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T = int> T in() {
    T x;
    cin >> x;
    return (x);
}
template <class T> void print(T &x) {
    cout << x << '\n';
    return;
}

template <class T> ll sized_subset(T &comb) {
    T x = comb & -comb, y = x + comb;
    return ((comb & ~y) / x) >> 1 | y;
}

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

int main() {
    int n=in();
    int prex=0,prey=0,pret=0;
    bool flag=1;
    REP(i,n){
        int t=in();
        int x=in();
        int y=in();
        if((y-prey+x-prex+t-pret)%2==1 || abs(y-prey)+abs(x-prex)-abs(t-pret)>0){if(flag)printf("No");flag=0;}
    }
    if(flag)printf("Yes");
    return 0;
}


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

int main(){
 int N,K;
  string S;
  cin >> N >> K ;
  cin >> S;
 
  if(S.at(K-1) == 'A'){
    S.at(K-1) = 'a';
  }
    if(S.at(K-1) == 'B'){
    S.at(K-1) = 'b';
  }
    if(S.at(K-1) == 'C'){
    S.at(K-1) = 'c';
  }
  
  cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

int main(){
    int N,M;
    cin >> N >> M;
    vector<ll> x(N),y(M);
    rep(i,N){
        cin >> x[i];
    }
    rep(i,M){
        cin >> y[i];
    }
    ll sumx=0,sumy=0;
    rep(i,N){
        sumx+=(x[i]*(-N+1+2*i))%MOD;
        sumx%=MOD;
    }
    rep(i,M){
        sumy+=(y[i]*(-M+1+2*i))%MOD;
        sumy%=MOD;
    }
    cout << sumx*sumy%MOD << endl;
}

Measured memory_bytes: 1792