akhauriyash/Code-Regression huggingface dataset:
#pragma gcc optimize("Ofast")

#include "bits/stdc++.h"
using namespace std;
typedef int64_t lld;
typedef pair<int,int> pii;
typedef pair<lld,lld> pll;
typedef pair<int,pll> pip;
typedef pair<pll,int> ppi;
typedef pair<lld,pll> plp;
typedef pair<pll,lld> ppl;
typedef pair<pll,pll> ppp;
template<typename T>
using maxHeap = priority_queue<T,vector<T>,less<T>>;
template<typename T>
using minHeap = priority_queue<T,vector<T>,greater<T>>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define endl '\n'
#define jizz cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
inline void input(int &_x) {
    _x = 0;
    int _tmp = 1; char _tc = getchar();
    while((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
    if(_tc == '-') _tc = getchar(), _tmp = -1;
    while(_tc >= '0' && _tc <= '9') _x = _x*10+(_tc-48), _tc = getchar();
    _x *= _tmp;
}
inline void output(int _x) {
    char _buff[20]; int _f = 0;
    if(_x == 0)putchar('0');
    while(_x > 0)
    {
        _buff[_f++] = _x%10+'0';
        _x /= 10;
    }
    for(_f-=1; _f >= 0; _f--)
        putchar(_buff[_f]);
    putchar('\n');
}
template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}
template<class T1,class T2>
ostream& operator<<(ostream& out, pair<T1,T2> p) {
    return out << '(' << p.first << ", " << p.second << ')';
}
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) {
     return _out(s,c.begin(),c.end());
 }
#ifdef erd1
    #define pprint(x) cerr<<__PRETTY_FUNCTION__<<":"<<__LINE__<<" - "<<(#x)<<"="<<(x)<<endl
#else
    #define pprint(x)
#endif

// code starts here
vector<int> v, t, fail, anss, poss;
signed main(){
    int n;
    cin >> n;
    int N = n+n-1;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        v.pb(a);
    }
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        t.pb(a);
    }
    fail.resize(n); anss.resize(n); poss.resize(n, (1<<30)-1);
    for(int k = 0; k < 30; k++){
        fill(all(fail), 0); fail[0] = -1;
        for(int i = 1; i < n; i++){
            int p = fail[i-1];
            while(p>=0 && (v[i]&1<<k) != (v[p+1]&1<<k))
                p = fail[p];
            if((v[i]&1<<k) == (v[p+1]&1<<k))p++;
            fail[i] = p;
        }
        for(int i = 0, j = -1; i < 2*n-1; i++){
            while(j >= 0 && (t[i%n]&1<<k) != (v[j+1]&1<<k))
                j = fail[j];
            if((t[i%n]&1<<k) == (v[j+1]&1<<k))
                j++;
            if(j == n-1){
                poss[(N-i)%n]^=1<<k;
                j = fail[j];
            }
        }
        for(int i = 0, j = -1; i < 2*n-1; i++){
            while(j >= 0 && (t[i%n]&1<<k) == (v[j+1]&1<<k))
                j = fail[j];
            if((t[i%n]&1<<k) != (v[j+1]&1<<k))
                j++;
            if(j == n-1){
                poss[(N-i)%n]^=1<<k;
                anss[(N-i)%n]|=1<<k;
                j = fail[j];
            }
        }
    }
    for(int i = 0; i < n; i++)
        if(!poss[i])cout << i << " " << anss[i] << endl;
}


Measured memory_bytes: 7540
//fifer a tak luboin
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define mp make_pair
#define pb push_back
#define s second
#define f first
#define endl "\n"

// using namespace __gnu_pbds;
using namespace std;
// template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 

const double eps = 1e-10;                                     
const double pi = acos(-1.0);

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    // freopen("input.in.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    char c;
    cin >> c;
    if (islower(c)) {
        cout << "a" << endl;
    } else {
        cout << "A" << endl;
    }
    return 0;  
}


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

int main(){
    long long N, x;
    cin >> N >> x;
    long long all = 2 * N - 1;
    long long mid = (all + 1) / 2;
    set<long long> use;
    for(long long i = 1; i <= all; i++)use.insert(i);
    if(N == 2){
        if(x == 2){
            cout << "Yes" << '\n';
            for(long long i = 1; i <= all; i++){
                cout << i << '\n';
            }
        }else{
            cout << "No" << '\n';
        }
    }else if(x == 1 || x == all){//3 <= N
        cout << "No" << '\n';
    }else{
        cout << "Yes" << '\n';
        vector<long long> ans(all, -1);
        if(x == 2){
            ans[mid - 2] = x + 1;
            ans[mid - 1] = x;
            ans[mid] = x - 1;
            ans[mid + 1] = x + 2;
            use.erase(x + 1);
            use.erase(x);
            use.erase(x - 1);
            use.erase(x + 2);
            for(long long i = 0; i < all; i++){
                if(ans[i] != -1)continue;
                ans[i] = *rbegin(use);
                use.erase(ans[i]);
            }
            for(auto a : ans){
                cout << a << '\n';
            }
        }else{
            ans[mid - 2] = x - 1;
            ans[mid - 1] = x;
            ans[mid] = x + 1;
            ans[mid + 1] = x - 2;
            use.erase(x - 1);
            use.erase(x);
            use.erase(x + 1);
            use.erase(x - 2);
            for(long long i = 0; i < all; i++){
                if(ans[i] != -1)continue;
                ans[i] = *rbegin(use);
                use.erase(ans[i]);
            }
            for(auto a : ans){
                cout << a << '\n';
            }
        }
    }
    return 0;
}

Measured memory_bytes: 12544
#include <iostream>
#include <string>

using namespace std;

int main(void){
  
  int n;
  cin >> n;
  string ans;
  if(n == 22) ans = "Christmas Eve Eve Eve";
  else if(n == 23) ans =  "Christmas Eve Eve";
  else if(n == 24) ans =  "Christmas Eve";
  else if(n == 25) ans =  "Christmas";
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
class Dice:
    def __init__(self, arr):
        self.arr = [0] + arr
        
    def rotate(self, string):
        if string == "S":
            self.arr[1], self.arr[2], self.arr[6], self.arr[5] = self.arr[5], self.arr[1], self.arr[2], self.arr[6]
        if string == "N":
            self.arr[5], self.arr[1], self.arr[2], self.arr[6] = self.arr[1], self.arr[2], self.arr[6], self.arr[5]
        if string == "E":
            self.arr[1], self.arr[3], self.arr[6], self.arr[4] = self.arr[4], self.arr[1], self.arr[3], self.arr[6]
        if string == "W":
            self.arr[4], self.arr[1], self.arr[3], self.arr[6] = self.arr[1], self.arr[3], self.arr[6], self.arr[4]

    def top(self):
        return self.arr[1]


arr = list(map(int, input().split()))
dice = Dice(arr)
rotate = input()
for s in rotate:
    dice.rotate(s)
print(dice.top())



Measured memory_bytes: 5612
#define _USE_MATH_DEFINES
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <nmmintrin.h>
#include <immintrin.h>
#include <mmintrin.h>

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,P) scanf("%d %d %d %d",&n,&m,&o,&P)
#define SINT5(n,m,o,P,q) scanf("%d %d %d %d %d",&n,&m,&o,&P,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


const int INF = 1'010'000'000; // 0x3C33'6080
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first
#define sc  second


int main() {
	int a, b;
	cin >> a >> b;
	cout << (a*b % 2 == 1 ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++) cin >> h[i];
  int maxN = h[0], ans = 1;
  for (int i = 1; i < n; i++) {
    if (maxN <= h[i]) ans++;
    maxN = max(maxN, h[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split(' ')))
plus=[A[i] for i in range(N) if A[i]>=0]
minus=[abs(A[i]) for i in range(N) if A[i]<0]

if len(minus)%2 == 0:
	print(sum(plus)+sum(minus))
else:
	newl = sorted(plus + minus)[::-1]
	print(sum(newl[:-1]) - newl[-1])


Measured memory_bytes: 14212
ATGC=['A', 'T', 'G', 'C']
S=input()
N=len(S)
maxlen=0
count=0

for i in range(N):
    if S[i] in ATGC:
        count+=1
    else:
        count=0
    if count>maxlen:
        maxlen=count
print(maxlen)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

template <typename T>
T gcd(T a, T b) {
    if (a > b) swap(a, b);
    return a == 0 ? b : gcd(b % a, a);
}

template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

int main() {
    int n;
    ll m;
    cin >> n >> m;
    ll al = 1, prev;
    for (int i=0; i<n; i++) {
        ll ai; cin >> ai;
        al = lcm(al, ai / 2);
        ll log = 0;
        while (ai % 2 == 0) { ai >>= 1; log++; }
        if (al > m || (i > 0 && log != prev)) {
            cout << 0 << '\n';
            return 0;
        }
        prev = log;
    }
    cout << (m / al) - (m / (2 * al)) << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,x=0,i;
    cin>>n;
    long long int arr[n+5];
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    for(i=0;i<n;i++)
    {
        if(arr[i]==arr[i+1])
        {
           break;
        }
        else
        {
            x++;
        }
    }
    if(x==n)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

const ll MOD = 1e9 + 7;

string L;

vector<ll> pw3;

vector<ll> dp;
ll solve(int at) {
  if (at >= L.size()) return 1;
  ll& res = dp[at];
  if (res != -1) return res;
  int cur = L[at] - '0';
  if (cur == 0) {
    res = solve(at + 1);
  } else {
    res = solve(at + 1) * 2 % MOD;
    res += pw3[L.size() - at - 1];
    res %= MOD;
  }
  return res;
}

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  while (cin >> L) {
    dp = make_v(L.size() + 10, -1ll);
    pw3 = make_v(L.size() + 10, 0ll);
    pw3[0] = 1;
    for (int i = 1; i < pw3.size(); i++) pw3[i] = pw3[i - 1] * 3 % MOD;
    cout << solve(0) << endl;
  }
  return 0;
}


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

#define pb push_back
#define ff first
#define ss second

const long long MAXN = 1e5 + 21, inf = 1e18 + 21, LG = 20;

int n;
int num;
string s, t;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> s >> t;
	for (int i = 0; i < n; i++)
		if (s.substr(n - 1 - i, i + 1) == t.substr(0, i + 1))
			num = i + 1;

	cout << n * 2 - num << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;

class Solution {
 public:
  void solve() {
    int n, m;
    cin >> n >> m;
    vector<bool> ac(n + 1);
    vector<int> pen(n + 1);
    for (int i = 0; i < m; ++i) {
      int p;
      string s;
      cin >> p >> s;
      if (s == "AC")
        ac[p] = true;
      else {
        if (!ac[p]) pen[p]++;
      }
    }

    int s = 0, p = 0;
    for (int i = 1; i <= n; ++i) {
      s += ac[i];
      p += ac[i] * pen[i];
    }
    cout << s << " " << p;
  }
};

int main() {
  Solution solution = Solution();
  solution.solve();
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

const int MAXN = 2*100000;
vector<int> bit(MAXN+1);

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

  string s;
  cin >> s;
  int n = s.size();
  n--;
  int ans = 0;
  rep(i, n) {
    if (s.at(i) != s.at(i+1)) {
      ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

// 2?¬????BIT
template <typename T>
struct twodimBIT{
private:
    vector< vector<T> > array;
    const int n;
    const int m;

public:
    // ?????????
    twodimBIT(int _n, int _m) : array(_n+1, vector<T>(_m+1, 0)), n(_n), m(_m) {}

    // (1, 1) ?????? (x, y) ?????§????´???????????±???????
    T sum(int x, int y) {
        T s = 0;
        for(int i=x; i>0; i-=i&(-i))
            for(int j=y; j>0; j-=j&(-j))
                s += array[i][j];
        return s;
    }

    // [(x1, y1), (x2, y2)]???????´??????????
    T sum(int x1, int y1, int x2, int y2) {
        return sum(x2, y2) - sum(x1-1, y2) - sum(x2, y1-1) + sum(x1-1, y1-1);
    }

    // (x, y) ??? ????´? k ?????????
    void add(int x, int y, T k) {
        for(int i=x; i<=n; i+=i&(-i))
            for(int j=y; j<=m; j+=j&(-j))
                array[i][j] += k;
    }
};

signed main() {
    int m, n, k; cin >> m >> n >> k;
    twodimBIT<int> cntJ(m, n), cntO(m, n), cntI(m, n);
    rep(i,0,m) {
        string s; cin >> s;
        rep(j,0,n) {
            if(s[j] == 'J') cntJ.add(i+1, j+1, 1);
            if(s[j] == 'O') cntO.add(i+1, j+1, 1);
            if(s[j] == 'I') cntI.add(i+1, j+1, 1);
        }
    }
    rep(i,0,k) {
        int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
        int ansJ = cntJ.sum(x1, y1, x2, y2);
        int ansO = cntO.sum(x1, y1, x2, y2);
        int ansI = cntI.sum(x1, y1, x2, y2);
        printf("%lld %lld %lld\n", ansJ, ansO, ansI);
    }
    return 0;
}

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

int main(void){
  int N,K;
  long long S;
  cin >> N >> K >> S;
  vector<long long> a(N);
  if(S < 1e+9){
    for(int i = 0; i < N; i++){
      if(i < K){
	a.at(i) = S;
      }else{
	a.at(i) = S+1;
      }
    }
  }else if(K == 0){
    for(int i = 0; i < N; i++){
      a.at(i) = S - i - 1;
    }
  }else if(K == 1){
    a.at(0) = S;
    for(int i = 1; i < N; i++){
      a.at(i) = S - i;
    }
  }else if(K == N){
    for(int i = 0; i < N; i++){
      a.at(i) = S;
    }
  }else{
    for(int i = 0; i < N; i++){
      if(i < K + 1){
	a.at(i) = S / 2;
      }else{
	a.at(i) = S - i - 1;
      }
    }
  }

  for(int i = 0; i < N; i++){
    cout << a.at(i) << endl;
  }
}

Measured memory_bytes: 2048
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int l;
    cin >> l;
    printf("%.06lf\n", 1.0 * l * l * l / 27);
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 764
N = int(input())
b = list(map(int, input().split()))

ans = []
for i in range(N, 0, -1):
    for j in range(i, 0, -1):
        if b[j - 1] == j:
            ans.append(b.pop(j - 1))
            break
    else:
        break
    continue

if len(ans) < N:
    print(-1)
else:
    for i in range(N):
        print(ans[N - 1 - i])


Measured memory_bytes: 3060
K, X = map(int, input().split())
# print(X, K)
l = X - K + 1
r = X + K - 1
ans = ''
for i in range(2 * K - 1):
    ans += str(l + i)
    if i != 2 * K - 1:
        ans += ' '
print(ans)


Measured memory_bytes: 38448
// D - Maximum Average Sets
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using DBL = double;
#define allr(x) (x).rbegin(),(x).rend()
#define rp(i,s,e) for(ll i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)
#define MAX 50

vvl nCr_table(MAX+1, vl(MAX+1, 1));

void nCr_table_create(ll N){
	rp(n,1,N+1) rp(r,1,N+1-n)
		nCr_table[n][r] = nCr_table[n-1][r] + nCr_table[n][r-1];
}

ll nCr(int n, int r){
	if(n < r) return 0;
	int i = n - r;
	int j = r;
	return nCr_table[i][j];
}

int main(){
	int N,A,B; cin>>N>>A>>B;
	vl V(N); rpz(i, N) cin>>V[i];
	sort(allr(V));
	nCr_table_create(N);

	DBL maxave = 0.0;
	rpz(i, A) maxave += V[i];
	maxave /= A;

	int n = 0, r = 0;
	ll v = V[A-1];
	rpz(i, N){
		if(v == V[i]){
			n++;
			if(i < A) r++;
		}
	}

	ll maxcnt = 0;
	if(r == A) rp(r, A, B+1) maxcnt += nCr(n, r);
	else maxcnt = nCr(n, r);

	printf("%.6f\n", maxave);
	cout<< maxcnt <<endl;
}

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

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

ll mod = 1e9+7;

ll fact[200005];
ll ifact[200005];

ll N;
vector<ll> G[200005];

ll dp[2][200005];
ll size[2][200005];

ll ans[200005];

ll modpow(ll a, ll p){
    if(p == 0) return 1;
    if(p%2 == 0){
        ll mid = modpow(a, p/2);
        return mid*mid%mod;
    }
    else return a*modpow(a,p-1)%mod;
}

void dfs1(ll now, ll p){
    if(now != 1 && G[now].size() == 1){
        size[0][now] = 1;
        dp[0][now] = 1;
        return;
    }
    ll tp = 1;
    ll ts = 0;
    ll tif = 1;
    for(ll nex: G[now]){
        if(nex == p) continue;
        dfs1(nex,now);
        tp *= dp[0][nex];
        ts += size[0][nex];
        tif *= ifact[size[0][nex]];
        tp %= mod;
        ts %= mod;
        tif %= mod;
    }
    size[0][now] = ts+1;
    dp[0][now] = (fact[ts]*tif%mod)*tp%mod;
    //cout << now << " " << size[0][now] << " " << dp[0][now] << endl;
    return;
}

void dfs2(ll now, ll p, ll pv){
    if(now == 1){
        for(ll nex: G[now]){
            dfs2(nex,now,dp[0][1]);
        }
        return;
    }
    //cout << pv*modpow(dp[0][now],mod-2) << endl;
    ll tmp = ((pv*modpow(dp[0][now],mod-2)%mod)*fact[size[0][now]]%mod);
    tmp *= ifact[N-1];
    tmp %= mod;
    tmp *= fact[N-1-size[0][now]];
    tmp %= mod;
    ans[now] = dp[0][now];
    ans[now] = ans[now]*tmp%mod;
    ans[now] = ans[now]*ifact[N-size[0][now]]%mod;
    ans[now] = ans[now]*ifact[size[0][now]-1]%mod;
    ans[now] = ans[now]*fact[N-1]%mod;
    //cout << now << " " << ans[now] << endl;
    for (ll nex: G[now]){
        if(nex != p)dfs2(nex,now,ans[now]);
    }
    return;

}

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

    cin >> N;
    for (int i = 0;i < N-1;i++){
        ll a,b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    fact[0] = 1;
    ifact[0] = modpow(fact[0],mod-2);
    for (int i = 1;i <= N;i++){
        fact[i] = fact[i-1]*i%mod;
        ifact[i] = modpow(fact[i],mod-2);
    }

    dfs1(1,-1);

    //cout << dp[0][1] << endl;

    ans[1] = dp[0][1];
    dfs2(1,0,0);

    for (int i = 1;i <= N;i++){
        cout << ans[i] << endl;
    }

    return 0;

}

Measured memory_bytes: 25712
import itertools
import bisect

n = int(input())
m = len(str(n))
li = []

for i in range(3,m+1):
    li_tmp = list(itertools.product([3,5,7], repeat = i))
    for j in li_tmp:
        if 3 in j and 5 in j and 7 in j:
            a = 0
            for k in range(i):
                a += j[k] * 10**(i-k-1)
            li.append(a)

print(bisect.bisect(li, n))


Measured memory_bytes: 45552
#include<stdio.h>

int main(void){
	int a,b,c;
	int time;
	int sum;
	int suma,sumb,sumc;
	
	scanf("%d %d %d",&a,&b,&c);
	scanf("%d", &time);
	
	int a2,b2,c2;
	
	
	int max;
	
	
	for(int i = 0; i < time; i++){
		max = a;
		if(b > max) max = b;
		if(c > max) max = c;
		if(max == a){
			a = a * 2;
		} else if(max == b){
			b = b * 2;
		} else if(max == c){
			c = c * 2;
		}
	}
	
	sum = a + b + c;
	
	printf("%d\n",sum);
	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define pb push_back
 
#define limit (int) (1005)
#define mod (int) 1000000007

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
using ld = long double;


int main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    
    int n;
    cin >> n;

    if (n%1000 == 0)
    {
        cout << 0;
    } else {
        cout << 1000 - n%1000;
    }

    
    return 0;
}
















Measured memory_bytes: 3620
from collections import Counter
def line_input(f, type):
    return f(map(type, input().split(" ")))

n = input()
a = line_input(list, int)

c = Counter(a)
so = sorted(c)

cnt = [0] * (max(so) + 1)
for idx in range(0, max(so)+1):
    cnt[idx] = cnt[idx-1] + c[idx]

m = 0
for j in range(1, 4):
    for idx in range(len(cnt)-j):
        m = max(m, cnt[idx + j] - cnt[idx])

for i in c.values():
    m = max(m, i)

print(m)

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

using namespace std;

int n;

int p[560000];
int k;
int pr[100001];

void ciur()
{
    p[0] = p[1] = 1;

    int n = 555555;

    int i, j;
    for(i = 4; i <= n; i += 2)
        p[i] = 1;

    for(i = 3; i * i <= n; i += 2)
    {
        for(j = i * i; j <= n; j += i * 2)
            p[j] = 1;
    }

    int c = 0;
    pr[++ k] = 2;
    for(i = 3; i <= 55555; i += 2)
    {
        if(p[i] == 0)
        {
            if(i % 5 == 2)
                pr[++ k] = i;

                //c ++;
        }
    }
}

int main()
{
    cin >> n;

    ciur();

    int i;
    for(i = 1; i <= n; i++)
        cout << pr[i] << " ";
    cout << "\n";

    return 0;
}


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

using namespace std;
 
void solve() {
    int n;
    cin >> n;

    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }

    vector<int> dp(n, -1);
    function<int(int)> calc_dp = [&] (int i) {
        if (dp[i] != -1) {
            return dp[i];
        }
        if (i <= 0) {
            return 0;
        } else if (i == 1) {
            dp[i] = abs(v[i] - v[i-1]);
            return dp[i];
        }

        int cost1 = abs(v[i] - v[i-1]) + calc_dp(i-1);
        int cost2 = abs(v[i] - v[i-2]) + calc_dp(i-2);

        if (cost1 < cost2) {
            dp[i] = cost1;
        } else {
            dp[i] = cost2;
        }
        return dp[i];
    };

    cout << calc_dp(n-1) << endl;
}

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

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    // cin >> t;

    for (int i = 0; i < t; ++i) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 11868
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
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); }
using P = pair <int, int>;
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; }
 
ll MOD = 1000000007;
ll INF =1<<30;
ll dp[110][100100];
 
int main(){
   int n;
   cin >>n;
   vector<int>d(n);
   rep(i,n){
        d[i]=i+1;
   }
vector<int> e = d;
   vector<int>p(n),q(n);
   rep(i,n)cin >> p[i];
   rep(i,n)cin >> q[i];
   int a= 0,b=0;
   do{
        bool ok = true;
        rep(i,n){
             if(d[i]!=p[i]) ok =false;
        }
        if(!ok) a++;
        if(ok){
             a++;
             break;
        }
         
   }while(next_permutation(d.begin(),d.end()));
   do{
        bool ok = true;
        rep(i,n){
             if(e[i]!=q[i]) ok =false;
        }
        if(!ok) b++;
        if(ok){
             b++;
             break;
        }
         
   }while(next_permutation(e.begin(),e.end()));
   cout << abs(a-b) <<endl;
}

Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

typedef double D;
const D EPS = 1e-8;
const D INF = 1e10;
const D PI = M_PI;

struct P {
    D x, y;
    P(D xs, D ys) : x(xs), y(ys) { }
    P() { }
};

P operator +(P a, P b) { return P(a.x + b.x, a.y + b.y); }
P operator -(P a, P b) { return P(a.x - b.x, a.y - b.y); }
P operator *(P p, D s) { return P(p.x * s, p.y * s); }

D inp(P a, P b) { return a.x*b.x + a.y*b.y; }
D outp(P a, P b) { return a.x*b.y - a.y*b.x; }

D norm(P p) { return inp(p, p); }
D abs(P p) { return sqrt(norm(p)); }

bool eq(P a, P b) { return abs(a - b) < EPS; }

D arg(P p) { return atan2(p.y, p.x); }

P rot90(P p) {
    return P(-p.y, p.x);
}

P rot(P p, D radian) {
    P q;
    q.x = cos(radian)*p.x - sin(radian)*p.y;
    q.y = sin(radian)*p.x + cos(radian)*p.y;
    return q;
}

struct L : vector<P> {
    L(P a, P b) { push_back(a); push_back(b); }
    L() { this->resize(2); }
};

struct C {
    P p; D r;
    C(P ps, D rs) : p(ps), r(rs) { }
    C() { }
};

// ??卒???l???????????????p?????????
// (l??????p??????????????????????????即????????????????賊???????)
// norm??則?????贈?????????(abs??則??????????????????)
P projection(L l, P p) {
    P a = l[1] - l[0];
    P b = p - l[0];
    D t = inp(b, a) / norm(a);
    return l[0] + a * t;
}

// ??卒???l???????????????p???????属?
// (l????????????????則属???p??????)
P reflection(L l, P p) {
    return p + (projection(l, p) - p) * 2;
}

int ccw(P a, P b, P c) {
    b = b - a; c = c - a;

    // a - b - c ????????????????????即???
    if(outp(b, c) > EPS)  return +1; // ???????即???????
    if(outp(b, c) < -EPS) return -1; // ????即???????

    // a - b - c ??卒??????????????其??即???
    if(inp(b, c) < 0)     return +2; // c - a - b
    if(norm(b) < norm(c)) return -2; // a - b - c
    return 0;                        // a - c - b
}

bool iSS(L s, L t) {
    return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
        ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}

int main() {
    int Q; cin >> Q;
    while(Q--) {
        D x[4], y[4];
        for(int i = 0; i < 4; i++) {
            cin >> x[i] >> y[i];
        }

        L s(P(x[0], y[0]), P(x[1], y[1])), t(P(x[2], y[2]), P(x[3], y[3]));

        int result;
        if(iSS(s, t)) {
            result = 1;
        }
        else {
            result = 0;
        }
        cout << result << endl;
    }
}

Measured memory_bytes: 1240
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy

route1 = 'U' * y + 'R' * x
route2 = 'D' * y + 'L' * x
route3 = 'L' + 'U' * (y + 1) + 'R' * (x + 1) + 'D'
route4 = 'R' + 'D' * (y + 1) + 'L' * (x + 1) + 'U'

print(route1 + route2 + route3 + route4)

Measured memory_bytes: 3060
#define aaaa 1
#ifdef aaaa
    #include <bits/stdc++.h>
    #ifdef LOCAL
        #include "cxx-prettyprint-master/prettyprint.hpp"
        #define print(x) cout << x << endl
    #else
        #define print(...) 42
    #endif
    using namespace std;
    using ll = long long;
    #define INF 1'010'000'000'000'000'017LL
    #define mod 1000000007LL
    #define eps 0.0001
    #define all(x) (x).begin(), (x).end()
    #define FOR(i,a,b) for(ll i=(a);i<(b);++i)
    #define rep(i,n)  FOR(i,0,n)
    #define reverse(x) (x).rbegin(), (x).rend()
    #define SZ(x) ((ll)(x).size())
    #define sum(x) accumulate(ALL(x), 0LL)//?
    #define pb(x) push_back(x)
    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; }
    class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
    public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};
#endif
int main() { 
    ll N;
    map<ll, ll>m;
    vector<ll> hen(2);
    cin >> N;
    rep(_, N){
        ll a;
        cin >> a;
        m[a]+=1;
        if(m[a]==2){
            hen.push_back(a);
            m[a] = 0;
        }
    }
    sort(hen.rbegin(), hen.rend());
    ll a = hen.at(0);
    ll b = hen.at(1);
    cout << a*b << endl;
}

Measured memory_bytes: 6528
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 土  2/23 16:47:57 2019

# Usage
#
"""
from fractions import gcd
from functools import reduce

def solve(nums):
    return reduce(gcd,nums)

def i():
    _ = input()
    return [int(i) for i in input().split()]


if __name__ == '__main__':
	print(solve(i()))

Measured memory_bytes: 16268
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF=1e18;


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

    string N;
    cin >> N;

    string result = "No";
    for (int i=0; i<3; i++) {
        if (N[i] == '7') {
            result = "Yes";
            break;
        }
    }

    cout << result << '\n';

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define LL long long

#define lowbit(x) ((x) & -(x))

const int maxn = 1e5 + 20;
const int MOD = (int) 1e9 + 7;

void work()
{
    int a, b;
    cin >>a >>b;
    cout <<(a * 3 + b) / 2 <<endl;
}

int main()
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
    int tc = 1;
//    cin >>tc;
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


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

int unres[10001][100] = {};
int res[10001][100] = {};

int main(){

    string k;
    int d;
    cin >> k;
    cin >> d;

    unres[0][0] = 1;
    res[0][0] = 1;

    for(int i = 1; i <= k.size(); i++){
        for(int j = 0; j < d; j++){
            for(int dig = 0; dig < 10; dig++) unres[i][j] = (unres[i][j] + unres[i-1][(20*d+j-dig)%d])%1000000007;
        }
    }

    for(int i = 1; i <= k.size(); i++){
        for(int j = 0; j < d; j++){
            for(int dig = 0; dig < (k[k.size()-i] - '0'); dig++) res[i][j] = (res[i][j] + unres[i-1][(20*d+j-dig)%d])%1000000007;
            res[i][j] = (res[i][j] + res[i-1][(20*d+j-(k[k.size()-i]-'0'))%d])%1000000007;
        }
    }

    cout << (res[k.size()][0] + 1000000006)%1000000007;

    return 0;
}


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

fn main() {
    let numbers: Vec<i32> = read_vec();
    let mut tmp: i32;
    let mut index: usize;
    let mut result: i32 = 0;

 //   println!("{}, {}, {}", numbers[0], numbers[1], numbers[2]);

    tmp = numbers[0];
    index = 0;

    for i in 1..3 {
        if numbers[i] > tmp {
            tmp = numbers[i];
            index = i;
        }
    }

    for i in 0..3 {
       //     println!("jiji");
        if i == index {
         //   println!("hu");
            result = result + numbers[i] * 10;
        } else {
           // println!("ji");
            result = result + numbers[i];
        }
    }

    println!("{}", result);

}

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

using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<ll> H(N);
  for (ll i = 0; i < N; ++i) {
    cin >> H[i];
  }
  for (ll i = 1; i < N; ++i) {
    if(H[i]<H[i-1]){
      cout << "No" << endl;
      return 0;
    }
    if(H[i]>H[i-1])
      H[i]--;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(void) {
    int m,f,r,score;
    while (1) {
        scanf("%d %d %d",&m,&f,&r);
        score=m+f;
        if (m==-1&&f==-1&&r==-1) break;
        if (m==-1||f==-1) {
            printf("F\n");
        } else if (score>=80) {
            printf("A\n");
        } else if (score>=65) {
            printf("B\n");
        } else if (score>=50||(score>=30&&r>=50)) {
            printf("C\n");
        } else if (score>=30) {
            printf("D\n");
        } else {
            printf("F\n");
        }
    }
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, s, e) for (ll i = s; i < e; i++)
#define Forr(i, s, e) for (ll i = s; i > e; i--)
#define pb push_back
#define ll long long
#define mp make_pair
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(8);
    ll n, k;
    cin >> n >> k;
    ll h[n];
    ll cost[n];
    For(i, 0, n)
    {
        cin >> h[i];
        cost[i] = LONG_LONG_MAX;
    }
    cost[0] = 0;
    For(i, 1, n)
    {
        For(j, 1, k + 1)
        {
            if (i - j >= 0)
                cost[i] = min(cost[i], abs(h[i] - h[i - j]) + cost[i - j]);
        }
    }
    cout << cost[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 5104
S = input()
T = input()

alpha = [chr(i) for i in range(97, 97+26)]
dictalpha = {}
dictans = {}
for i in alpha:
    dictalpha[i] = []
    dictans[i] = []
for i in range(len(S)):
    dictalpha[S[i]].append(i)
    dictans[T[i]].append(i)

for i in dictans.values():
    if i not in dictalpha.values():
        print("No")
        exit()

print("Yes")


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

template<class c> auto try_out(c a) -> decltype(cerr << a, 0);
char try_out(...);

struct debug {
#ifdef LOCAL
template<class c, class d> debug& operator << (pair<c, d> e) {
	return *this << "(" << e.first << ", " << e.second << ")";
}
template<class c> typename enable_if<sizeof(try_out(declval<c>())) != 1, debug&>::type operator << (c a) {
	cerr << boolalpha << a;
	return *this;
}
template<class c> typename enable_if<sizeof(try_out(declval<c>())) == 1, debug&>::type operator << (c a) {
	*this << "[";
	for (auto it = a.begin(); it != a.end(); ++it)
		*this << ","[1 - (it != a.begin())] << *it;
	return *this << "]";
}
#else
template<class c> debug& operator << (c) {
	return *this;
}
#endif
};

#define aty(x) " [" << #x ": " << x << "] "

using ll = long long;




int main() {
	
    int a[5];
    int  k;
    for (int i = 0; i < 5; ++i) cin >> a[i];
    cin >> k;
    
    if (a[4] - a[0] <= k) 
    {
        cout << "Yay!" << endl;
        return 0;
    }
    
    cout << ":(" << endl;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
int main(void){
    int k,x;
    cin >> k >> x;
    for(int i = x-k+1;i <= x+k-1;i++){
        cout << i << " ";
    }
    cout << endl;
    return 0;
}


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

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  int A[q];
  rep (i, q) cin >> A[i];

  int score[n] = {};

  rep (i, q) {
    score[A[i]-1]++;
  }

  rep (i, n) {
    score[i] = k - (q - score[i]);
  }

  rep (i, n) {
    if (score[i] <= 0) cout << "No" << endl;
    else cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 1408
import java.util.*;

class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long ans = 0;
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= n;j++){
                int t = (int)gcd(i,j);
                for(int k = 1;k <= n;k++){
                    ans += gcd(t,k);
                }
            }
        }

        System.out.println(ans);
    }

    static long gcd(int a,int b){
        return b==0? a:gcd(b,a%b);
    }
}

Measured memory_bytes: 35768
#include <stdio.h>

int data[10000][2];

void flip(int *a, int *b)
{
    int c;
    if(*a > *b) {
        c = *a;
        *a = *b;
        *b = c;
    }
}

int read(int *d)
{
    scanf("%d %d", &d[0], &d[1]);

    if(d[0] == 0 && d[1] == 0)
        return 0;
    else {
        flip(&d[0], &d[1]);
        return 1;
    }
}

int main(void)
{
    int idx = 0;
    int i;

    while(read(&data[idx++][0]) != 0);

    for(i=0;i<idx-1;i++) {
        printf("%d %d\n", data[i][0], data[i][1]);
    }

    return 0;
}

Measured memory_bytes: 616
"""解説から
1. Bi(1<=i<=N)のボールの中の左端B1のボールに塗る色を決める(K通り)
2. 2<=i<=Nのボールの塗る色を順に決めていく
    この時、B(i-1)のボールと異なる色であれば何色で塗ってもよい(K-1通り)
3. 1と2の前提からK*(K-1)**(N-1)通りの塗り方ができる
"""
N, K = map(int, input().split())
print(K * (K - 1)**(N - 1))


Measured memory_bytes: 2940
#include<iostream>//入出力
#include<vector>//可変長配列
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<deque>//両端アクセスのキュー
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REPS(i,a,b) for(ll i=(a);i<(b);i++)
#define RREPS(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000

int main(){
    string s;
    cin >> s;
    if( s[2]==s[3] && s[4]==s[5] ) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<n;i++)
#define REP1(i,n) for(long long i=1;i<=n;i++)
#define REPB(i,n) for(long long i=((n)-1);i>=0;i--)
#define REPB1(i,n) for(long long i=(n);i>0;i--)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();ite++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define REV(arr) reverse(ALL(arr))
typedef long long ll;
typedef pair<int,int> pii;
//---------------------
#define MAXN 100
//---------------------

ll n,w[MAXN];

int main(){
	cin>>n;
	REP(i,n) cin>>w[i];
	ll minn=100000000;
	REP1(i,n-1) {
		ll suma=0,sumb=0;
		REP(j,i){
			suma+=w[j];
		}
		REP(j,n-i){
			sumb+=w[j+i];
		}
		minn=min(minn,abs(suma-sumb));
	}
	cout<<minn<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

using P = pair<int, int>;

int N;
vector<int> v, w;

vector<P> makeMergeList(vector<int> &ww, vector<int> &vv) {
    vector<P> res;
    res.emplace_back(0, 0);
    vector<P> now1, now2;
    int n = ww.size();
    for(int i = 0; i < n; i++) {
        now1.clear(), now2.clear();
        for(const auto &j : res) {
            now1.emplace_back(j);
            now2.emplace_back(j.first + ww[i], j.second + vv[i]);
        }
        res.clear();
        res.resize(now1.size() + now2.size());
        merge(ALL(now1), ALL(now2), res.begin());
    }
    return res;
}

void solve() {
    int u, L;
    cin >> u >> L;
    vector<int> now_w, now_v;
    {
        int tmp = u;
        while(tmp > 1) {
            now_w.emplace_back(w[tmp - 1]);
            now_v.emplace_back(v[tmp - 1]);
            tmp >>= 1;
        }
        now_w.emplace_back(w[0]);
        now_v.emplace_back(v[0]);
    }
    int n = now_w.size();
    int n1 = n / 2;
    int n2 = n - n1;
    vector<P> p1, p2;
    // 前半
    {
        vector<int> ww(n1), vv(n1);
        for(int i = 0; i < n1; i++) {
            ww[i] = now_w[i];
            vv[i] = now_v[i];
        }
        p1 = makeMergeList(ww, vv);
    }
    // 後半
    {
        vector<int> ww(n2), vv(n2);
        for(int i = 0; i < n2; i++) {
            ww[i] = now_w[i + n1];
            vv[i] = now_v[i + n1];
        }
        p2 = makeMergeList(ww, vv);
    }
    reverse(ALL(p1));
    int id = 0;
    int ans = -INF, max_v = -INF;
    for(int i = 0; i < p1.size(); i++) {
        if(p1[i].first > L) {
            continue;
        }
        while(id < p2.size() && p1[i].first + p2[id].first <= L) {
            chmax(max_v, p2[id].second);
            id++;
        }
        chmax(ans, p1[i].second + max_v);
    }
    cout << ans << "\n";
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    v.resize(N), w.resize(N);
    for(int i = 0; i < N; i++) {
        cin >> v[i] >> w[i];
    }
    int q;
    cin >> q;
    while(q--) {
        solve();
    }
}

Measured memory_bytes: 5308
N, M, X = map(int, input().split())
A = [int(i) for i in input().split()]
score1 = 0
score2 = 0
for i in range(X, N):
    if i in A:
        score1 += 1
for i in range(0, X):
    if i in A:
        score2 += 1
print(min(score1, score2))

Measured memory_bytes: 3064