akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

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

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

// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c)                                                             \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                                               \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"                       \
       << " " << __FILE__ << endl;

const string YES = "Yes";
const string NO = "No";

void solve(std::string S) {
  bool flag = false;
  for(int i=0; i<S.length();i++){
    if(i%2==0){
      if(S[i]=='L')flag=true;
    }else{
      if(S[i]=='R')flag=true;
    }
  }
  if(flag)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return;
}

int main() {
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef long double ldouble;

typedef vector<llong> vecllong;
typedef vector<vecllong> vvecllong;

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

struct edge {
    llong to;
    llong cost;
};

int main(void) {
    llong N, M;
    cin >> N >> M;

    vector<edge> graph[N];

    FOR(i, M) {
        llong l,r,d;
        cin >> l >> r >> d;
        l--;
        r--;
        graph[l].push_back({r, d});
        graph[r].push_back({l, -d});
    }

    llong dist[N];
    FOR(i, N) {
        dist[i] = INF;
    }

    queue<llong> que;
    FOR(vertex, N) {
        if(graph[vertex].size() == 0 or dist[vertex] != INF) {
            continue;
        }
        que.push(vertex);
        dist[vertex] = 0;
        while (!que.empty()) {
            llong now = que.front();
            que.pop();

            FOR(i, graph[now].size()) {
                edge e = graph[now][i];
                if (dist[e.to] != INF) {
                    if(dist[now] + e.cost != dist[e.to]) {
                        cout << "No" << endl;
                        return 0;
                    }
                } else {
                    dist[e.to] = dist[now] + e.cost;
                    que.push(e.to);
                }
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 14080
#include<stdio.h>


#define MAX 2000000000
#define INFTY (1<<30)

void MaxHeapify(int);
void insert(int);
void increaseKey(int, int);
int HeapExtractMax(void);

int H, A[MAX];

int main(){
  int key;
  A[H] = -INFTY;
  char com[10];

  while(1){
    scanf("%s", com);
    if(com[0] == 'e' && com[1] == 'n' ){
      break;
    }
    if(com[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }
    else{
      printf("%d\n", HeapExtractMax());
    }
  }

  return 0;
}


void MaxHeapify(int i){
  int l, r, largest,keep;
  l = 2*i;
  r = 2*i+1;
  if( l <= H && A[l] > A[i] ){
    largest = l;
  }
  else {
    largest = i;
  }
  if( r <= H && A[r] > A[largest] ){
    largest = r;
  }
  if( largest != i){
    keep = A[i];
    A[i] = A[largest];
    A[largest] = keep;
    MaxHeapify(largest);
  }
}

void insert(int key){
  H++;
  A[H] = -INFTY;
  increaseKey(H, key);
}

void increaseKey(int i, int key){
  int c;
  if(key < A[i]) return;
  A[i] = key;
  while (i > 1 && A[i/2] < A[i]) {
    c = A[i/2];
    A[i/2] = A[i];
    A[i] = c;
    i = i/2;
  }
}

int HeapExtractMax(){
  int m;
  if( H < 1 ) return -INFTY;
  m = A[1];
  A[1] = A[H];
  H--;
  MaxHeapify(1);
  return m;
}



Measured memory_bytes: 5592
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
char s[100]; 
int main(){
	bool c=false;
    for(int i=0;scanf("%c",&s[i])!=EOF;i++){
    	if(s[i]=='C'){
    		c=true;
		}
		if((s[i]=='F')&&(c)){
			cout<<"Yes";
			return 0;
		}
	}
 	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using boost::multiprecision::cpp_dec_float_100;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x / GCD(x, y) * y;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    int N, M, X;
    cin >> N >> M >> X;

    vector<vector<int> > A(N, vector<int>(M));
    vector <int> C(N);

    rep(i, N) {
        cin >> C[i];
        rep(j, M) cin >> A[i][j];
    }

    vector<int> S(M);

    rep(j, M) S[j] = 0;
    rep(j, M) {
        rep(i, N) S[j] += A[i][j];
    }

    vector<vector<int> > T(round(pow(2, N)), vector<int>(M));

    deque<int> deq;

    rep(i, round(pow(2, N))) {
        rep(j, M) {
            T[i][j] = 0;
        }

    }

    rep(i,round(pow(2, N))) {
        bitset<12> b(i);
        int kakaku = 0;
        for (int k = 11; k >= 0; --k) {
            if(b[k]==1){
                rep(j, M) T[i][j] += A[k][j];
                kakaku += C[k];
            }
        }
        rep(j, M) if ( T[i][j] < X ) {goto pqr; }

        deq.push_back(kakaku);

    pqr:;
    }

    int e = deq.size();

    int ans = 1200000;

        rep(i, e) ans = min(deq[i], ans);

        rep(j, M) if (S[j] < X) { cout << -1 << endl; goto xyz; }

        cout << ans << endl;

xyz:;
}

Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int s, w;
int main() {
    cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 210000;
int N;
int A[Max];
vector<pair<int, int>> as;

int main(int argc, const char * argv[]) {
    cin >> N;
    inputArray(A, N);
    as.reserve(N);
    rep(i, N) {
        as.push_back(make_pair(-A[i], i));
    }
    sort(as.begin(), as.end());

    int maxidx = as[0].second;
    rep(i, N) {
        if (i == maxidx) {
            output(-as[1].first);
        } else {
            output(-as[0].first);
        }
    }

    return 0;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
#include <cctype>
#include <cstdio>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int> ;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI 3.141592653
#define rep(i, k, n) for(ll i = k; i < n; i++)

int main(){
  ll n; cin >> n;

  ll sum = 0;
  vll v(n);
  rep(i, 0, n){
    cin >> v[i];
  }

  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());

  rep(i, 0, n-1){
    if(i == 0){sum += v[0];}
    else{sum += v[(i+1)/2];}
  }

  cout << sum << endl;
  
}


Measured memory_bytes: 4820
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;
const int N=200010;
ll a[N],f[N];

ll n,k;
ll ans=0;

bool check(ll x)
{
    ll count1=0;
    for(int i=1; i<=n; i++)
    {
        if(a[i]*f[i]<=x)
            continue;
        else
        {
            count1+=a[i]-x/f[i];
        }
    }
    if(count1>k)
        return false;
    else return true;
}

int main()
{
    ll tot=0;
    cin>>n>>k;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
        tot+=a[i];
    }
    for(int i=1; i<=n; i++)
        cin>>f[i];
    if(tot<=k)
    {
        ans=0;
    }
    else
    {
        sort(a+1,a+n+1);
        sort(f+1,f+1+n);
        reverse(f+1,f+1+n);
        ll l=0,r=1e12;
        while(l<=r)
        {
            ll mid=(r-l)/2+l;
            if(check(mid))
            {
                ans=mid,r=mid-1;
            }
            else
                l=mid+1;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3328
import sys
readline = sys.stdin.readline

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

def lcm(a, b):
    return a*b//gcd(a, b)

N = int(readline())
ans = 1
for _ in range(N):
    ans = lcm(ans, int(readline()))
print(ans)
    

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

#include <algorithm>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

struct LCA {
    vector<vector<int>> par;
    vector<int> d;
    int n;
    LCA(vector<vector<int>> graph, int root) {
        n = graph.size();
        par.resize(n, vector<int>(30));
        d.resize(n, 0);
        function<void(int, int, int)> dfs = [&](int c, int p, int depth) {
            d[c] = depth;
            par[c][0] = p;
            for (auto ch : graph[c]) {
                if (ch != p) dfs(ch, c, depth + 1);
            }
        };
        dfs(0, 0, 0);
        for (int j = 1; j < 30; j++) {
            REP(i, n) { par[i][j] = par[par[i][j - 1]][j - 1]; }
        }
    }
    int getdistance(int u, int v) { return (d[u] + d[v]) - 2 * (d[query(u, v)]); }
    int query(int u, int v) {
        if (d[u] > d[v]) {
            swap(u, v);
        }
        for (int i = 29; 0 <= i; i--) {
            if (d[u] <= d[par[v][i]]) {
                v = par[v][i];
            }
        }
        /* LCA */
        for (int i = 29; 0 <= i; i--) {
            if (par[v][i] != par[u][i]) {
                v = par[v][i];
                u = par[u][i];
            }
        }
        if (u == v) {
            return u;
        } else {
            return par[v][0];
        }
    }
};

struct UnionFind {
    vector<int> parent, size;
    UnionFind(int n) {
        parent.resize(n, -1);
        size.resize(n, 1);
    }
    void unite(int x, int y) {
        if (same(x, y)) {
            return;
        }
        x = root(x);
        y = root(y);
        if (size[x] <= size[y]) {
            swap(x, y);
        }
        parent[y] = x;
        size[x] += size[y];
    }
    bool same(int x, int y) { return (root(x) == root(y)); }
    int root(int x) {
        while (parent[x] != -1) {
            x = parent[x];
        }
        return x;
    }
    int getsize(int x) { return size[root(x)]; }
};
int n, m;
vector<vector<int>> graph;

signed main() {
    int a, b, c, d, k;
    cin >> a >> b >> c >> d >> k;
    cout << (c - a) * 60 + (d - b) - k << endl;
}

Measured memory_bytes: 3668
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
#define REP(i, n)           REPEAT(i, 0, n)
#define REPEAT(i, k, n)     for(int i = (k); i < ((k)+(n)); ++i)
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;} 

int m[256][256];

void solve(int n){
    int t1[256], t2[256];
    int mx = 0;

    memset(t1,0,sizeof(t1));
    memset(t2,0,sizeof(t2));
    REP(y,n) REP(x,n){
        if(m[y][x]){
            mx = MAX(mx, ++t1[x]);
            mx = MAX(mx, ++t2[y]);
        } else {
            t1[x] = 0;
            t2[y] = 0;
        }
    }
    memset(t1,0,sizeof(t1));
    memset(t2,0,sizeof(t2));
    REP(y,n) REP(x,n){
        if(x == 0)   t1[(x-y+n)%n] = 0;
        if(x == n-1) t2[(x+y+n)%n] = 0;
        if(m[y][x]){
            mx = MAX(mx, ++t1[(x-y+n)%n]);
            mx = MAX(mx, ++t2[(x+y+n)%n]);
        } else {
            t1[(x-y+n)%n] = 0;
            t2[(x+y+n)%n] = 0;
        }
    }

    cout << mx << endl;
}

int main(){
    int n;
    while(cin >> n && n){
        for(int y = 0; y < n; y++){
            string s; cin >> s;
            for(int x = 0; x < n; x++) m[y][x] = s[x] - '0';
        }
        solve(n);
    }
    return 0;
}

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

using namespace std;

#define all(x) begin(x), end(x)

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

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

    int n, m;
    cin >> n >> m;
    vi masks(n, 0);
    for (int i = 0; i < m; ++i) {
        int k;
        cin >> k;
        for (int j = 0; j < k; ++j) {
            int x;
            cin >> x;
            --x;
            masks[x] |= (1 << i);
        }
    }

    int state = 0;
    for (int i = 0; i < m; ++i) {
        int p;
        cin >> p;
        state |= (1 << i) * p;
    }

    int ans = 0;
    for (int mask = 0; mask < (1 << n); ++mask) {
        int cur = state;
        for (int i = 0; i < n; ++i) {
            if (mask & (1 << i)) {
                cur ^= masks[i];
            }
        }

        // cout << mask << " " << cur << '\n';

        if (cur == 0) {
            ++ans;
        }
    }

    cout << ans << '\n';
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

#define ll long long

ll n = 0;
string s;

int main(){
	cin >> s;
	ll m = 0;
	int len = s.size();
	for(int i = 0; i < len; i++){
		int now = s[i] - '0';
		m += now;
		n = n * 10 + s[i] - '0';
	}
	if(n % m == 0) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int N;
vector<long long> A;

void solve() {
    vector<long long> plus, minus;
    for (int i = 0; i < N; ++i) {
        if (A[i] >= 0) plus.push_back(A[i]);
        else minus.push_back(A[i]);
    }
    sort(plus.begin(), plus.end(), greater<long long>());
    sort(minus.begin(), minus.end());
    if (minus.empty()) minus.push_back(plus.back()), plus.pop_back();
    if (plus.empty()) plus.push_back(minus.back()), minus.pop_back();

    vector<pair<long long, long long> > res;
    long long cur = minus[0];
    for (int i = 0; i + 1 < plus.size(); ++i) {
        res.push_back({ cur, plus[i] });
        cur -= plus[i];
    }
    res.push_back({ plus.back(), cur });
    cur = plus.back() - cur;

    for (int i = 1; i < minus.size(); ++i) {
        res.push_back({ cur, minus[i] });
        cur -= minus[i];
    }

    cout << cur << endl;
    for (auto p : res) cout << p.first << " " << p.second << endl;
}

int main() {
    cin >> N;
    A.resize(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    solve();
}

Measured memory_bytes: 7912
using System;

namespace ABC165_b
{
    class Program
    {
        static void Main(string[] args)
        {
            long x = long.Parse(Console.ReadLine());
            long deposit = 100;
            long year = 0;

            while(deposit < x) {
                deposit += deposit / 100; //deposit = (long)(deposit * 1.01)とするとオーバーフローした 
                year++;
            }
            Console.WriteLine(year);
        }
    }
}


Measured memory_bytes: 27448
#include <iostream>
#include <string>
using namespace std;
int main(void){
    
    string game;
    
    while(cin >> game, game != "0"){
        int A = 0, B = 0;
        for(int i = 1; i <= game.size(); i++){
            if(game[i] == 'A') A++;
            else if(game[i] == 'B') B++;
        }
        
        if(A>B)A++;
        else B++;
        
        cout << A << " " << B << endl;
    }
}


Measured memory_bytes: 3076
N=int(input())
h={}
for i in range(N):
  S=input()
  if S in h:
    h[S] += 1
  else:
    h[S]=0
result=sorted(h.items(), key=lambda x:x[1], reverse=True)
max_val=result[0][1]
keys = [k for k, v in h.items() if v == max_val]
for i in sorted(keys):
  print(i)


Measured memory_bytes: 47324
N,K,Q,*A = map(int, open(0).read().split())

deduc = [0]*N
for i in range(Q):
    deduc[A[i]-1] += 1

#print(deduc)
for i in range(N):
    if(K + ( deduc[i]  -Q ) > 0):
        print('Yes')
    else:
        print('No')




Measured memory_bytes: 13940
h, w , kkk = gets.chomp.split(" ").map(&:to_i)
arr = []
h.times do 
    a = gets.chomp.split("")
    arr << a
end
max = []
["o","x"].repeated_permutation (h) do |i|
    hairetsu = []
    i.each_with_index do |ii,bangou|
        if ii == "o"
             arr_size = arr[bangou].size
             ar = []
             arr_size.times do
                ar << "%"
             end
        hairetsu  << ar
            
        end
        if ii == "x"
            hairetsu << arr[bangou]
        end
    end
    max << hairetsu
end

count = 0
# max.each do |k|
#     ["o","x"].repeated_permutation (w) do |i|
#         i.each_with_index do |ii,bangou|
#             if ii == "o"
#                 h.times do |l|
#                      k[l][bangou].fill("%")
#                 end
#            end
#         end
#         p k
#         kk = k.count(".")
#         if kk == kkk
#             count += 1
#         end
#     end
# end

max.each do |k|
   
    max = []
    k = k.transpose
    ["o","x"].repeated_permutation (w) do |i|
        ookisa = 0
        hairetsu = []
        i.each_with_index do |ii,bangou|
            if ii == "o"
                arr_size = k[bangou].size
                ar = []
                arr_size.times do
                    ar << "%"
                end
            hairetsu  << ar
                
            end
            if ii == "x"
                hairetsu << k[bangou]
            end
        end
        max << hairetsu
        max = max.flatten
        #p max
        ookisa = max.count("#")
        max = []
        if ookisa == kkk
            count += 1
        end
    end
end
puts count

Measured memory_bytes: 14448
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func StrStdin(num int) [][]string {
	var stringInput [][]string
	scanner := bufio.NewScanner(os.Stdin)

	for i := 0; i < num; i++ {
		scanner.Scan()
		if s := scanner.Text(); s != "" {
			stringInput = append(stringInput, strings.Split(strings.TrimSpace((scanner.Text())), " "))
		} else {
			break
		}
	}

	return stringInput
}

//readLine Read standard input data
func readLine(line int) [][]string {
	var rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	var buf = make([]byte, 0, 1000000)

	var stringInput [][]string

	for i := 0; i < line; {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			stringInput = append(stringInput, strings.Split(strings.TrimSpace((string(buf))), " "))
			buf = []byte{}
			i++
		}
	}
	return stringInput
}

func main() {
	slic := readLine(2)
	var k, n int
	k, _ = strconv.Atoi(slic[0][0])
	n, _ = strconv.Atoi(slic[0][1])
	var a []string = slic[1]
	var alist = make([]int, n)
	var i int
	var x int
	for i = 0; i < n; i++ {
		x, _ = strconv.Atoi(a[i])
		alist[i] = x
	}
	var sabun int = k - alist[n-1] + alist[0]
	var ii int
	for ii = 0; ii < n-1; ii++ {
		if sabun < alist[ii+1]-alist[ii] {
			sabun = alist[ii+1] - alist[ii]
		}
	}
	fmt.Println(k - sabun)
}


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

typedef long long ll;
#define loop(i,n) for(int i=0;i<n;++i)
#define mem(x,y) memset(x,y,sizeof(x))
#define PI   3.1415926
#define INF  0x3f3f3f3f//(1061109567)
int main()
{
	int n,k,s;
	cin>>n>>k>>s;
	int q;
	if(s!=1e9) q=s+1;
	else q=s-1;
	if(n>k)
	{
		loop(j,k)
			cout<<s<<" "; 
		loop(j,n-k)
		{
			if(j!=n-k-1) cout<<q<<" ";
			else cout<<q;
		}
	}
	else
	{
		loop(j,k)
		{
			if(j==k-1) cout<<s;
			else cout<<s<<" "; 
		}
	}
	return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>
#include <math.h>
 
using namespace std;
 
 
int main(){
    double a,b,c,d,e,f,x,y;
 
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
        x=(c*e-b*f)/(a*e-d*b);
        y=(a*f-c*d)/(a*e-b*d);
        if(x == 0)x=0;
        if(y == 0)y=0;
        printf("%.3lf %.3lf\n",x,y);
    }
 
    return 0;
}


Measured memory_bytes: 2636
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=2e5+10;
int main()
{
	int n,m,q,k;
	int a,d,A,D;
	cin>>d>>a>>D>>A;
	int f=0;
	while(1){
		D-=a;
		if(D<=0){
			f=1;
			break;
		}
		d-=A;
		if(d<=0){
			break;
		}
	}
	if(f)cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll, ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define reQv(a) reverse(all(a)
#define ld long double
const ll mod=1e9+7;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
int main() {
    IOS;
    int n;
    cin >> n;
    ll a[n];
    map<ll,ll> m;
    for(int i=0; i<n; i++){
        cin >> a[i];
        m[a[i]]++;
    }
    for(int i=1; i<=n; i++){
        cout << m[i] << endl;
    }
	return 0;
}

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

int main() {
  int n, c, d[30][30], m[3][30] = {};
  scanf("%d %d", &n, &c);
  for(int i = 0; i < c; i++)
    for(int j = 0; j < c; j++) scanf("%d", &d[i][j]);
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      int a;
      scanf("%d", &a);
      m[(i + j) % 3][a - 1]++;
    }
  }
  int o = 1001001001;
  for(int i = 0; i < c; i++) {
    for(int j = 0; j < c; j++) {
      for(int k = 0; k < c; k++) {
        if(i == j || j == k || k == i) continue;
        int t = 0;
        for(int l = 0; l < c; l++) {
          t += d[l][i] * m[0][l];
          t += d[l][j] * m[1][l];
          t += d[l][k] * m[2][l];
        }
        o = min(o, t);
      }
    }
  }
  printf("%d\n", o);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int i,n;
double xa,ya,ra,xb,yb,rb,d2;
cin>>n;
for(i=0;i<n;i++){
cin>>xa>>ya>>ra>>xb>>yb>>rb;
d2=(xb-xa)*(xb-xa)+(yb-ya)*(yb-ya);
if(d2>(ra+rb)*(ra+rb))cout<<"0"<<endl;
else if(d2>=(ra-rb)*(ra-rb))cout<<"1"<<endl;
else if(ra>rb)cout<<"2"<<endl;
else cout<<"-2"<<endl;
}
return 0;
}

Measured memory_bytes: 1224
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  ans=inf

  s=S()

  ans=min(ans,len(s)-s.count('.'))
  ans=min(ans,len(s)-s.count('#'))

  a=s.count('.')
  b=s.count('#')

  _a=0
  for i in range(n):
    if s[i]=='.':
      a-=1
    else:
      _a+=1
    ans=min(ans,_a+a)
    # print(ans)
  return ans

# main()
print(main())


Measured memory_bytes: 5816
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

count = 0

for i in range(N):
    if A[i] >= B[i]:
        count += B[i]
    else:
        B[i] -= A[i]
        count += A[i]
        if A[i+1] >= B[i]:
            A[i+1] -= B[i]
            count += B[i]
        else:
            count += A[i+1]
            A[i+1] = 0

print(count)

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    int N; cin >> N;
    map<string, bool> mp;
    rep(_, N) {
      string s; cin >> s;
      mp[s] = true;
    }
    int cnt = 0;
    for (auto it = mp.begin(); it != mp.end(); it++) if (it->se) cnt++;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 19188
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

struct Sieve {
    int n;
    vector<int> f, primes;
    
    Sieve(int n=1) : n(n), f(n+1) {
        f[0] = f[1] = -1;
        for (long long i = 2; i <= n; ++i) {
            if (f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for (long long j = i*i; j <= n; j += i) {
                if (!f[j]) f[j] = i;
            }
        }
    }

    bool isPrime(int x) { return f[x] == x;}

    vector<int> factorList(int x) {
        vector<int> res;
        while (x != 1) {
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }

    vector<pair<int, int>> factor(int x) {
        vector<int> fl = factorList(x);
        if (fl.size() == 0) return {};
        vector<pair<int, int>> res(1, pair<int, int>(fl[0], 0));
        for (int p : fl) {
            if (res.back().first == p) {
                res.back().second++;
            } else {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};

const int MAXN = 100005;

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

    vector<bool> like(MAXN, false);
    for (int i = 1; i <= MAXN; i += 2) {
        if (sieve.isPrime(i) && sieve.isPrime((i+1)/2)) {
            like[i] = true;
        }
    }
    vector<int> sum(MAXN+1, 0);

    rep(i, MAXN+1) {
        sum[i+1] = sum[i] + like[i];
    }
    
    int q;
    cin >> q;
    while (q--) {
        int l, r;
        cin >> l >> r;
        cout << sum[r+1] - sum[l] << endl;
    }
}

Measured memory_bytes: 1536
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, char) => {
        read_value!($next, String).chars().collect::<Vec<char>>()[0]
     };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
    };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! printvec {
    ( $item:expr ) => {
        for &i in &$item {
            print!("{} ", i);
        }
        println!("");
    }
}
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);
impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}
#[derive(PartialEq, PartialOrd, Clone, Debug)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}
#[allow(dead_code)]
const MOD: usize = 1000000007;


fn main() {
    input!{
        r: usize, g: usize, b:usize,
    }
    let N = r * 100 + g * 10 + b;

    println!("{}", if N % 4 == 0 {"YES"} else {"NO"});
}

Measured memory_bytes: 4352
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func pow64(x, y int64) int64 {
	return int64(math.Pow(float64(x), float64(y)))
}

func pow(x, y int) int {
	return int(pow64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

func solve() {
	K, S := nextInt(), nextInt()
	ans := 0
	for x := 0; x <= min(K, S); x++ {
		for y := 0; y <= min(K, S-x); y++ {
			if S-x-y <= K {
				ans++
			}
		}
	}
	out(ans)
}


Measured memory_bytes: 640
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    right = 0
    left = 0
    cnt = 0
    
    total = 0
    for left in range(0, N):
        
        while (right < N and total ^ A[right] == total+A[right]):
            total += A[right]
            right += 1
        
        cnt += right - left
        if right == left:
            right += 1
        else:
            total -= A[left]
    print(cnt)


if '__main__' == __name__:
    resolve()

Measured memory_bytes: 77772
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll h,w;

int main(void){
	scanf("%lld%lld",&h,&w);
	if(h==1 || w==1){
		printf("%lld\n",1);
		return 0;
	}
	ll c0=0;
	ll c1=0;
	if(w%2==0){
		c0=h*w/2LL;
	}else{
		c0=(w+1)/2LL*((h+1)/2LL);
		c0+=w/2LL*(h/2LL);
		c1=h*w-c0;
	}
	printf("%lld\n",c0);
	return 0;
}


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

int height[100001] = { 0 };
int degree[100001] = { 0 };
int higher[100001] = { 0 };

int main() {
	int n, m, ans = 0;
	vector<pair<int, int>> edge;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> height[i];
	}
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		degree[a]++;
		degree[b]++;
		edge.push_back(make_pair(a, b));
	}

	for (int i = 0; i < m; i++) {
		if (height[edge[i].first] > height[edge[i].second]) {
			higher[edge[i].first]++;
		}
		else if (height[edge[i].first] < height[edge[i].second]) {
			higher[edge[i].second]++;
		}
	}

	for (int i = 1; i <= n; i++) {
		if (higher[i] == degree[i]) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main(void){
    int n, h, w, a, b, ans = 0;
    cin >> n >> h >> w;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        if (a >= h && b >= w) ans++;
    }
    
    cout << ans << endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
int main()
{
//    cout << cos(0) << endl;
//    cout << cos(pi/4) << endl;
//    cout << cos(pi/2) << endl;
//    cout << cos(pi) << endl;
    double x,y;
    double h,m;
    cin >>x>>y>>h>>m;
    double tri = h*60+m-m*12;
    cout << fixed << setprecision(13);
    cout << (long double)sqrt(x*x+y*y-2*x*y*cos(pi*tri/360.0)) << endl;
    return 0;
}


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

int main()
{
    int N, L;
    cin >> N >> L;
    string S[N];
    for (int i = 0; i < N; i++) cin >> S[i];

    sort(S, S+N);

    string all_s = "";

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

    cout << all_s << endl;

    return 0;
}

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

string s, t;

int main()
{
    while(cin >> s >> t)
    {
        bool y = 0;
        for(int i = s.size() - 1; i >= 0; i--)
        {
            if(s.substr(i) + s.substr(0, i) == t)
                y = 1;
        }

        if(y)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int x,y,ans;
int main(){
	cin>>x>>y;
	if (x==3) ans+=100000;
	if (x==2) ans+=200000;
	if (x==1) ans+=300000;
	swap(x,y);
	if (x==3) ans+=100000;
	if (x==2) ans+=200000;
	if (x==1) ans+=300000;
	if (x==1 && y==1) ans+=400000;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
#define N 5005
using namespace std;

inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}

long long ss,u,s,tp,st[N],po,n,fl,a[N],ma,s1,s2;

int main()
{
	n=read();fl=0;
	for(int i=1; i<=n; ++i)
	{
	    scanf("%lld",a+i);
	    if(a[i]>0)fl=1;
	}
	if(!fl){
		ma=a[1]; po=1;
		for(int i=2; i<=n; ++i)if(a[i]>ma){
			po=i;
			ma=a[i];
		} 
		printf("%lld\n",ma);
		printf("%lld\n",n-1);
		for(int i=1; i<po; ++i)printf("1\n");
		for(int i=po+1; i<=n; ++i)printf("%d\n",n-i+2);
		return 0;
	}
	s1=0; s2=0;
	for(int i=1; i<=n; ++i)if(a[i]>=0){
		if(i&1)s1+=a[i];
		else s2+=a[i];
	}
	
	printf("%lld\n",max(s1,s2));
	u=1;
	if(s1>s2){
		if(n%2==0){
			st[++tp]=n;
			--n;
		}
	}
	else{
		if(n&1){
			st[++tp]=n;
			--n;
		}
		u=2;
		st[++tp]=1;
		--n;
	}
	
	ss=n;
	while(ss>1){
		if(a[u]>=0 && a[u+2]>=0){
			st[++tp]=2;
			u+=2;
			ss-=2;
			continue;
		}
		if(a[u+2]<0){
			if(ss==3){
				st[++tp]=3;
				st[++tp]=2;
			}else{
				st[++tp]=3;
			}
			ss-=2;
			a[u+2]=a[u];
			u+=2;
			continue; //
		}
		ss-=2;
		st[++tp]=1;
		st[++tp]=1;
		u+=2;
	} 
	
	printf("%lld\n",tp);
	
	for(int i=1; i<=tp; ++i)printf("%lld\n",st[i]);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    Set<Integer> set = new HashSet<Integer>();
    for (int i = 0; i < k; i++) {
      int d = sc.nextInt();
      for (int j = 0; j < d; j++) {
        set.add(sc.nextInt());
      }
    }
    int res = n - set.size();
    System.out.println(res);
    sc.close();
  }
}

Measured memory_bytes: 46316
n=int(input())
A=list(map(int,input().split()))
A=[0]+A+[0]
ans=0
for i in range(1,n+2):
    ans+=abs(A[i-1]-A[i])
for i in range(1,n+1):
    print(ans-(abs(A[i]-A[i-1])+abs(A[i+1]-A[i])-abs(A[i+1]-A[i-1])))




Measured memory_bytes: 64876
//おまじない
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
//#include <math.h>
#include<iomanip>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define space ' '
#define pll pair<ll,ll>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 1000000;

int main(){
    
    int n;
    string s;cin >>n>> s;
    
    rep(i,s.size()){
        int N = (int)s[i]-65;
        cout << char(65+(N+n)%26);
    }
    
    cout << endl;
return 0;
}


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

const int maxn = 5e5 + 5;

int n;
char s[maxn];
int L[maxn], R[maxn];

int main() {
	scanf(" %s",s+1);
	n = strlen(s+1);

	for(int i=1,cnt=0;i<=n;i++) {
		if(s[i] == '<') cnt++;
		else cnt = 0;
		L[i] = cnt;
	}
	for(int i=n,cnt=0;i>=1;i--) {
		if(s[i] == '>') cnt++;
		else cnt = 0;
		R[i] = cnt;
	}
	long long ans = 0;
	for(int i=1;i<=n+1;i++) {
		//printf("%c: %d %d : %d\n",s[i],L[i],R[i],max(L[i-1],R[i]));
		ans += max(L[i-1], R[i]);
	}
	printf("%lld",ans);
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var p = new int[n];
            var ss = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                p[i] = int.Parse(ss[i]);
            }

            var count = 0;
            for (int i = 1; i < n - 1; i++)
            {
                var small = p[i - 1] < p[i + 1] ? p[i - 1] : p[i + 1];
                var large = p[i - 1] > p[i + 1] ? p[i - 1] : p[i + 1];

                if (small < p[i] && p[i] < large)
                {
                    count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

#define pi 3.141592653589793
#define mod 1000000007

int main() {
	int n, k;
	cin >> n >> k;
	priority_queue<int>l;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		l.push(a);
	}
	int res = 0;
	for (int i = 0; i < k; i++) {
		res += l.top(); l.pop();
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 1e3 + 5;
const double eps = 1e9;
typedef long long LL;
#define ls o<<1
#define rs o<<1|1
#define m(o) (q[o].l+((q[o].r-q[o].l)>>1))
 
LL n, a, b;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> a >> b;
	if (a*b<n || a + b - 1>n) {
		cout << -1 << endl;
	}
	else {
		cout << n - a + 1;
		for (int i = n - a + 2; i <= n; i++) {
			cout << " " << i;
		}
		if (b != 1) {
			int t = (n - a) / (b - 1);
			int r = (n - a) % (b - 1);
			int cur = n - a;
			for (int i = 1; i < b; i++) {
				if (r) {
					for (int i = t; i >= 0; i--) {
						cout << " " << cur - i;
					}
					cur = cur - t - 1;
					r--;
				}
				else {
					for (int i = t - 1; i >= 0; i--) {
						cout << " " << cur - i;
					}
					cur = cur - t;
				}
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 2176
// ConsoleApplication98.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<set>
#include<map>
#include<vector>
#include<cmath>
using namespace std; typedef long long ll;

int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	ll cha = c - a - b;
	if (cha <= 0)
	{
		cout << "No" << endl;
		return 0;
	}
	cha *= cha;
	ll la = 4 * a * b;
	if (cha > la)
		cout << "Yes" << endl;
	else
	{
		cout << "No" << endl;
	}


}


Measured memory_bytes: 256