akhauriyash/Code-Regression huggingface dataset:
import bisect
S = input()
dp = [0]*len(S)
L = []
for i in range(len(S)-1):
  if S[i] == 'R' and S[i+1] == 'L':
    L.append(i)
for i in range(len(S)):
  k = bisect.bisect_left(L,i)
  if S[i] == 'R':
    if (L[k]-i)%2 != 0:
      dp[L[k]+1] += 1
    else:
      dp[L[k]] += 1
  else:
    if (i-L[k-1])%2 != 0:
      dp[L[k-1]+1] += 1
    else:
      dp[L[k-1]] += 1
print(' '.join(map(str,dp)))

Measured memory_bytes: 12540
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n; cin >> n;
	vi ans(n * n);
	vector<vector<tuple<int,int,int>>> v(n * n + 1); //(num, lim, count);
	rep(i, n){
		int x; cin >> x;
		ans[x - 1] = i + 1;
		v[0].emplace_back(i + 1, x - 1, i);
		v[x].emplace_back(i + 1, n * n, n - i - 1);
	}
	dbg(ans);
	
	priority_queue<pi> q;
	rep(i, n * n){
		for(auto j : v[i]){
			int a, b, c; tie(a, b, c) = j;
			rep(it, c) q.emplace(-b, a);
		}
		if(ans[i]) continue;
		//dbg(i, ans, q.size());
		
		if(q.empty() || -q.top().first <= i){
			cout << "No" << endl;
			return 0;
		}
		ans[i] = q.top().second;
		q.pop();
	}
	cout << "Yes" << endl;
	rep(i, n * n) cout << ans[i] << (i==n*n-1?"\n":" ");
	
	return 0;
}

Measured memory_bytes: 9588
#include<bits/stdc++.h>
using namespace std;
#define INFTY 10000000000
typedef long long int ll;
const int MOD=1000000007;
using Graph = vector<vector<int>>;
using ipair = pair<ll,ll>;
bool operator< (const ipair a, const ipair b){return a.first < b.first;};
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  ll n,m;cin>>n>>m;
  for (int i = m/n; i >=1; i--)
  {
    if(m%i==0) {cout<<i<<endl;break;}
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <unordered_map>

#define INF 10000000
#define MAX_N 3000000

using namespace std;
using P = pair<int, int>;


long d[MAX_N];       //頂点kから各点への距離
vector<P> G[MAX_N];  //隣接行列
int n, m;
void dijkstra(int k) { 
    fill(d, d + MAX_N, INF);
    d[k] = 0;
    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0, k));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int now = p.second;
        if (d[now] < p.first) continue;
        for (auto g : G[now]) {
            int to = g.second;
            long newd = g.first + d[now];
            if (d[to] > newd) {
                d[to] = newd;
                que.push(P(d[to], to));
            }
        }
    }
}

long key(P p) { return (long) p.first * (long)1e9 + p.second; }

int main() {
    cin >> n >> m;
    unordered_map<long, int> um;
    for (int i=1; i<=n; i++) um[key({i, -1})] = i;
    int msize = n;
    for (int i=0; i<m; i++) {
        int p, q, c;
        cin >> p >> q >> c;
        long pk = key({p, c}), qk = key({q, c});
        if (um[pk] == 0) {
            msize++;
            um[pk] = msize;
            G[p].push_back({1, um[pk]});
            G[um[pk]].push_back({0, p});
        }
        if (um[qk] == 0) {
            msize++;
            um[qk] = msize;
            G[q].push_back({1, um[qk]});
            G[um[qk]].push_back({0, q});
        }
        G[um[pk]].push_back({0, um[qk]});
        G[um[qk]].push_back({0, um[pk]});
    }
    dijkstra(1);
    cout << (d[n] < INF ? d[n] : -1) << '\n';
    return 0;
}

Measured memory_bytes: 134900
import sys

X, Y = map(int, input().split())

if X > 50:
    print("No")
    sys.exit()

for i in range(1, X + 1):
    if i * 2 + (X - i) * 4 == Y:
        print("Yes")
        sys.exit()

    if i * 4 + (X - i) * 2 == Y:
        print("Yes")
        sys.exit()

print("No")


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

typedef long long ll;
typedef pair<int, int> P;

int MOD = 1e9 + 7;
ll INF = 1e18;

int main() {
    int a, b, c; cin>>a>>b>>c;

    int cnt=0;
    while(1){

        if(a == b && b == c){
            cout << cnt << endl;
            return 0;
        }

        cnt++;

        if((a-1 == b && a-1 == c) || (b-1 == a && b-1 == c) || (c-1 == a && c-1 == b)){
            cout << cnt << endl;
            return 0;
        }

        if(a < b){
            if(a < c) a += 2;
            else c += 2;
        }
        else{
            if(b < c) b += 2;
            else c += 2;
        }
    }
}

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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, n, m) for(int i = n; i < (int)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18

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

ll MOD = 1000000007;

// union by size + path having
class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main()
{
    ll N;
    cin >> N;
    vector<P> red(N);
    REP(i, N) {
        ll a, b;
        cin >> a >> b;
        red[i] = P(a,b);
    }
    vector<P> blue(N);
    REP(i, N) {
        ll a, b;
        cin >> a >> b;
        blue[i] = P(a,b);
    }
    sort(ALL(red), [](const P& lh, const P& rh) {
        return rh.second < lh.second; });
    sort(ALL(blue), [](const P& lh, const P& rh) {
        return rh.first > lh.first; });

    vector<bool> selected(N, false);
    ll ans = 0;
    REP(i, N) {
        REP(j, N) {
            if (!selected[j] && red[j].first < blue[i].first && red[j].second < blue[i].second) {
                ans++;
                selected[j] = true;
                break;
            }
        }
    }
    PRINT(ans);
    return 0;
}


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

using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define sz(s) (int)s.size()

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 9; i > 0; --i) {
        int t = i * 111;
        if (t >= n) ans = t;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
#include<functional>
#include<set>
using namespace std ;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;

int main(){
    string s ;
    cin >> s ;
    if(s == "ABC" ) cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 1;
int main() {
	int T = 1;
	// scanf("%d", &T);
	for(int Case = 1; Case <= T; ++Case) {
		int n, m;
		static vector<int> e[maxn];
		static int que[maxn], par[maxn];
		scanf("%d%d", &n, &m);
		for(int i = 1; i <= n; ++i) {
			vector<int>().swap(e[i]);
			par[i] = 0;
		}
		par[1] = 1;
		for(int i = 1; i <= m; ++i) {
			int u, v;
			scanf("%d%d", &u, &v);
			e[u].push_back(v);
			e[v].push_back(u);
		}
		int tot = 1;
		que[1] = 1;
		for(int i = 1; i <= tot; ++i) {
			int u = que[i];
			for(int v : e[u])
				if(!par[v]) {
					par[v] = u;
					que[++tot] = v;
				}
		}
		if(tot < n) {
			puts("No");
		} else {
			puts("Yes");
			for(int i = 2; i <= n; ++i)
				printf("%d\n", par[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 10868
//jinhaonan
#include<set>
#include<map>
#include<list>
#include<ctime>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
#define For(i,x,y) for(int i=x,_y=y;i<=_y;++i)
#define Rep(i,x,y) for(int i=x,_y=y;i>=_y;--i)
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
inline int read()
{
	int x=0;char c=getchar();bool f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	return f?-x:x;
}
inline void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
const int N=1e5+10;
int n,b[N],a[N];
ll lim,t[2*N];
ll query(int x)
{
	x+=1e5+2;
	ll res=0;
	for(;x;x-=x&-x)res+=t[x];
	return res;
}
void modify(int x)
{
	x+=1e5+2;
	for(;x<=2e5+5;x+=x&-x)++t[x];
}
bool check(int x)
{
	memset(t,0,sizeof t);
	ll res=0;int cur=0;
	modify(cur);
	For(i,1,n)
	{
		if(a[i]<x)++cur;else --cur;
		res+=query(cur-1);
		modify(cur);
	}
	return res<lim;
}
int main()
{
	n=read();
	For(i,1,n)
	{
		b[i]=a[i]=read();
		lim+=i;
	}
	lim=lim/2+1;
	sort(b+1,b+n+1);
	*b=unique(b+1,b+n+1)-b-1;
	int ans,l=1,r=*b;
	for(;l<=r;)
	{
		int mid=(l+r)>>1;
		if(check(b[mid]))ans=b[mid],l=mid+1;else r=mid-1;
	}
	write(ans);puts("");
}

Measured memory_bytes: 2560
import math

a, b = input().split()

a = int(a)
b = int(b)

xas = math.ceil(a / 0.08)
xab = math.floor((a + 1) / 0.08)
xbs = math.ceil(b / 0.10)
xbb = math.floor((b + 1) / 0.10)

ra = list(range(xas, xab))
rb = list(range(xbs, xbb))

c = set(ra) & set(rb)

if c:
    print(min(c))
else:
    print('-1')

Measured memory_bytes: 3188
#include <iostream>


using namespace std;


int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	int countE = 0;
	for (char c : S) {
		countE += (c == 'E');
	}
	int countW = N - countE;
	int max = countE;
	int e = countE;
	int w = 0;
	int count;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'W') {
			count = e + w;
			w++;
		} else if (S[i] == 'E') {
			count = e + w - 1;
			e--;
		}
		// cout << count << endl;
		if (count < max) max = count;
	}
	cout << max << endl;
}

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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

struct rest
{
    int number;
    string s;
    int p;

    bool operator<(const rest &another) const
    {
        return s == another.s ? p > another.p : s < another.s;
    }
};


int main()
{
    int N;
    cin >> N;
    vector<struct rest> v(N);
    for (int i = 0; i < N; i++)
    {
        v[i].number = i;
        cin >> v[i].s >> v[i].p;
    }

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

    for (int i = 0; i < N; i++)
    {
        cout << v[i].number + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
lst = list(map(int, input().split()))
dp = [[]for i in range(N)]

dp[0] = 0
dp[1] = abs(lst[0] - lst[1])
for i in range(2, N):
    x = abs(lst[i-2] - lst[i])
    y = abs(lst[i-1] - lst[i])
    dp[i] = min(dp[i-2]+x, dp[i-1]+y)

print(dp[-1])

Measured memory_bytes: 14592
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){

  ll n=0,d=0;
  cin>>n>>d;
  ll ans=0;
  for(ll i=0;i<n;i++){
   
    ll x=0,y=0;
    cin>>x>>y;
    if(d*d>=((x*x)+(y*y))) ans++;
  }
 
  cout<<ans;
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<stw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;
using ll = long long int;

int main(void){
    ll N,A,B;cin>>N>>A>>B;
    ll ans = N / (A + B) * A;
    ll ret = N % (A + B);
    if(ret>A){
        ans += A;
    }else{
        ans += ret;
    }
    cout << ans << endl;
    return 0;
}

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

long long gcd(long long a, long long b){
  if(b== 0){
    return a;
  }
  return gcd(b, a%b);
}

int main(){
    long long n;
    cin >> n;
    long long a[n];

    for(long long i = 0; i < n; i++) cin >> a[i];

    long long g;
    for(long long i = 0; i < n; i++){
        if(i == 0){
            g = gcd(a[i], a[i+1]);
        }
        else{
            g = gcd(g, a[i]);
        }
    }

    cout << g << endl;
    return 0;
}

Measured memory_bytes: 4392
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
} 

int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(a%b,b);
}

//FUNCTION
void solve(void)
{
  int A,B,K;
  cin>>A>>B>>K;
  int X = gcd(A,B);
  vector<int> D = divisor(X);
  D.push_back(1);
  sort(ALL(D));reverse(ALL(D));
  cout<<D[K-1]<<endl;

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(15);
  solve();

  return 0;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int h, w, k, ans = 0;
	scanf("%d%d%d", &h, &w, &k);
	vector<string> s(h), tmp;
	rep(i, h)scans(s[i]);
	tmp = s;
	rep(i, (1 << h)) {
		rep(j, (1 << w)) {
			s = tmp;
			rep(j, h) {
				if (i & (1 << j)) {
					rep(k, w)s[j][k] = 'R';
				}
			}
			rep(k, w) {
				if (j & (1 << k)) {
					rep(l, h)s[l][k] = 'R';
				}
			}
			int cnt = 0;
			rep(j, h) {
				rep(k, w) {
					if (s[j][k] == '#')++cnt;
				}
			}
			if (cnt == k)++ans;
		}
	}
	printf("%d\n", ans);

	Please AC;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int digSum(string s)
{
	int res = 0;
	for(int i = 0;i<s.length();i++)
	{
		res = res + (s[i] - '0');
	}
	return res;
}
int main()
{
	string s;
	cin>>s;
	if(s[0] == '1')
	{
		int temp = (s.length()-1)*9;
		cout<<max(digSum(s) , temp);
	}
	else
	{
		int temp = ((s[0] - '0') - 1 + (s.length() - 1)*9);
		cout << max(digSum(s) , temp);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cstring>
#include <bits/stdc++.h>
#include <search.h>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include<stack>
#include <utility>
using namespace std;
int main()
{
int a1,a2,a3;
cin>>a1>>a2>>a3;
if(a1+a2+a3 >= 22) cout<<"bust";
else cout<<"win";
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int e[] = new int[5] ;
        for(int i = 1;i<=4;i++){
            e[i] = scan.nextInt();
        }
        if(e[1]==e[2]&&e[3]==e[4]||e[1]==e[4]&&e[2]==e[3]||e[1]==e[3]&&e[2]==e[4]){
            System.out.println("yes");
    } else {
    System.out.println("no");
    }
}
}



Measured memory_bytes: 26212
#include <bits/stdc++.h>
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)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define v(T) vector<T>
#define imposs {cout<<"-1\n";return 0;}
#define LL_MAX LLONG_MAX
#define LL_MIN LLONG_MIN

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;
typedef multiset<int> msi;
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

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

  int N, K;
  cin >> N >> K;
  vi A(N);
  rep(i,N) cin >> A[i];
  K = min(K, 100);
  rep(k, K) {
    vi s(N+1);
    rep(i,N) {
      s[max(0, i-A[i])]++;
      s[min(N, i+A[i]+1)]--;
    }
    int a = 0;
    rep(i, N) {
      a += s[i];
      A[i] = a;
    }
  }
  rep(i, N) {
    cout << A[i] << ((i != N-1) ? ' ' : '\n');
  }
  return 0;
}


Measured memory_bytes: 4960
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#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 <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

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

    int N;cin >> N;
    string S,R;cin >> S >> R;
    long long ans;
    //before == true:一個前が横並び falseなら縦並び
    bool before = false;
    for(int i = 0;i<N;i++){
        //縦向き
        if(S.at(i) == R.at(i)){
            if(i == 0){
                ans = 3;
                before = false;
                continue;
            }
            //前が横向きなら1通りしかない
            if(before){
                ans *= 1;
            }
            else{
                ans *= 2;
            }
            before = false;
        }
        else{
            //横向き
            if(i == 0){
                ans = 6;
                before = true;
                i++;
                continue;
            }
            i++;
            if(before){
                ans *= 3;
            }
            else{
                ans *= 2;
            }
            before = true;
        }
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
n = int(input())
A = [int(i) for i in input().split()]

if A[0]>0:
    s = A[0]
    ans1 = 0
else:
    s = 1
    ans1 = -A[0]+1

for i in range(1,n):
    if s*(s+A[i])>=0:
        ans1 += abs(s+A[i])+1
        if s>0:     
            s=-1
        else:
            s=1
    else:   
        s += A[i]
                  
if A[0]<0:        
    s = A[0]
    ans2 = 0
else:
    s = -1
    ans2 = A[0]+1
                    
for i in range(1,n):
    if s*(s+A[i])>=0:
        ans2 += abs(s+A[i])+1
        if s>0:
            s=-1
        else:
            s=1
    else:   
        s += A[i]
print(min(ans1,ans2))  


Measured memory_bytes: 14468
import sys
import math

def input():
    return sys.stdin.readline().rstrip()

def combination(n, r):
    return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

if __name__ == "__main__":
    n, k = map(int, input().split())

    for i in range(1, k+1):
        if n-k+1 >= i and k-1 >= i-1:
            print((combination(n-k+1, i) * combination(k-1, i-1)) % (10**9+7))
        else:
            print(0)


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

namespace ABC155_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Trim().Split(' ').Select(a => int.Parse(a)).ToArray();
            for(int i= 0; i < N; i++)
            {
                if (A[i]%2 == 0 && !(A[i]%3 == 0||A[i] % 5 == 0))
                {
                    Console.WriteLine("DENIED");
                    Environment.Exit(0);
                }
            }
            Console.WriteLine("APPROVED");
        }
    }
}

Measured memory_bytes: 13396
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<iostream>
#include<tuple>
#include<utility>
#include<set>
#include<queue>
using namespace std;
typedef long long int llint;
const llint big=((llint)1<<(llint)30);
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pub push_back
#define res resize
int main(void){
	vector<llint> ba;
	llint N,C,K,i,minz=big,nin=0,ans=0,gen=0;
	cin>>N;
	ba.res(N);
	for(i=0;i<N;i++){cin>>ba[i];}
	sort(ba.begin(),ba.end());
	for(i=0;i<N;i++){
		if(gen*2<ba[i]){ans=1;}
		else{ans++;}
		gen+=ba[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1152
n = int(input())

a = []
for i in range(n):
    ai = int(input())
    a.append(ai)

a = sorted(a)

ans = 0

if n % 2 == 0:
    r = a[n//2-1]
    for i in range(n//2 - 1):
        q = a[-i-1]
        p = a[i]
        ans += abs(q-r) + abs(p-q)
        r = p
    ans += abs(r - a[n//2])

else:
    r = a[n//2]
    if r - a[n//2-1] < a[n//2+1] - r:
        for i in range(n//2):
            q = a[-i-1]
            p = a[i]
            ans += abs(q-r) + abs(p-q)
            r = p
    else:
        for i in range(n//2):
            q = a[i]
            p = a[-i-1]
            ans += abs(q-r) + abs(p-q)
            r = p

print(ans)



Measured memory_bytes: 8292
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>

const int MaxN = 1000 + 5;

struct bign {
  int len;
  int a[MaxN];
};

inline std::istream& operator >> (std::istream& in, bign &x) {
  std::string str;
  std::cin >> str;
  x.len = str.length();
  for (int i = 0; i < x.len; ++i)
    x.a[i] = str[x.len - i - 1] - '0';
  return in;
}

inline std::ostream& operator << (std::ostream& out, bign x) {
  if (x.len == 0) {
    printf("%d", 0);
    return out;
  }
  for (int i = x.len - 1; i >= 0; --i)
    printf("%d", x.a[i]);
  return out;
}

inline bign operator + (bign x, bign y) {
  if (x.len < y.len) std::swap(x, y);
  for (int i = 0; i < y.len; ++i)
    x.a[i] += y.a[i];
  for (int i = 0; i < x.len; ++i) {
    x.a[i + 1] += x.a[i] / 10;
    x.a[i] %= 10;
  }
  if (x.a[x.len] != 0) x.len++;
  return x;
}

inline bign operator - (bign x, bign y) {
  for (int i = 0; i < y.len; ++i)
    x.a[i] -= y.a[i];
  for (int i = 0; i < x.len; ++i) {
    if (x.a[i] < 0) {
      x.a[i] += 10;
      x.a[i + 1]--;
    }
  }
  while (x.len > 0 && x.a[x.len - 1] == 0) x.len--;
  return x;
}

inline bign operator * (bign x, int y) {
  for (int i = 0; i < x.len; ++i)
    x.a[i] *= y;
  for (int i = 0; i < x.len; ++i) {
    x.a[i + 1] += x.a[i] / 10;
    x.a[i] %= 10;
  }
  while (x.a[x.len] != 0) {
    x.a[x.len + 1] += x.a[x.len] / 10;
    x.a[x.len] %= 10;
    x.len++;
  }
  return x;
}

inline bool operator == (bign x, bign y) {
  if (x.len != y.len) return false;
  for (int i = 0; i < x.len; ++i)
    if (x.a[i] != y.a[i]) return false;
  return true;
}

inline bool operator > (bign x, bign y) {
  if (x.len < y.len) return false;
  if (x.len > y.len) return true;
  for (int i = x.len - 1; i >= 0; --i) {
    if (x.a[i] > y.a[i]) return true;
    if (x.a[i] < y.a[i]) return false;
  }
  return false;
}

int N;
bign X;
bign _0, _1, _2, _3;
bign F[MaxN], G[MaxN];

void init() {
  scanf("%d", &N);
  std::cin >> X;

  _0.len = 0;
  _1.len = 1, _1.a[0] = 1;
  _2.len = 1, _2.a[0] = 2;
  _3.len = 1, _3.a[0] = 3;
}

bign dfs(int n, bign x) {
  if (x == _0) return _0;
  if (n == 0) return _1;
  if (x > F[n - 1] + _1) {
    return G[n - 1] + _1 + dfs(n - 1, x - F[n - 1] - _2);
  } else {
    return dfs(n - 1, x - _1);
  }
}

void solve() {
  F[0] = G[0] = _1;
  for (int i = 1; i <= N; ++i) {
    F[i] = (F[i - 1] * 2) + _3;
    G[i] = (G[i - 1] * 2) + _1;
  }

  std::cout << dfs(N, X) << std::endl;
}

int main() {
  init();
  solve();
  return 0;
}

Measured memory_bytes: 8960
import std.stdio;
import std.string;

void main()
{
  bool flg = false;
  bool[char] num;
  foreach(char a;readln.chomp())
    if(a in num) num[a] = !num[a];
    else num[a] = true;
    foreach(bool a;num)
    flg |= a;
  writeln(flg? "No" : "Yes");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}



int main() {

	int K, A, B;
	cin >> K >> A >> B;

	int i = 0;
	while (true) {
		i++;
		int val = K * i;
		if (val < A) continue;
		else if (val <= B) {
			cout << "OK" << endl;
			return 0;
		}
		else {
			cout << "NG" << endl;
			return 0;
		}
	}

	return 0;

}


Measured memory_bytes: 3588
import java.util.*;

public class Main {
    static String S;
    static long K;
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        S=scanner.next();
        K=scanner.nextLong();
        solve();
    }
    public static void solve(){
        int first1Lnegth=0;
        char nextChar=0;
        for(int i=0;i<S.length();i++){
            if(S.charAt(i)=='1'){
                first1Lnegth++;
            }else{
                nextChar=S.charAt(i);
                break;
            }
        }
        if(K<=first1Lnegth){
            put(1);
        }else{
            put(nextChar);
        }
    }

    public static void put(Object object){
        System.out.println(object);
    }
    public static String format(String string,Object... args){
        return String.format(string,args);
    }

    public static class Pair{
        final public int x,y;
        Pair(int x,int y){
            this.x=x;
            this.y=y;
        }
    }
}


Measured memory_bytes: 23764
numbers = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(numbers[k-1])

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,Q;
  cin >> N >> Q;
  string str; cin >> str;

  vector<int> s(N+1,0);
  for(int i=0; i<N; i++){
    if(i+1<N && str.at(i)=='A' && str.at(i+1)=='C') s[i+1]=s[i]+1;
    else s[i+1]=s[i]; 
  }
  vector<int> ans;
  for(int q=0; q<Q; q++){
    int l,r; cin >> l >> r;
    l--;r--;
    ans.push_back(s[r]-s[l]);
  }
  for(int i=0; i<ans.size(); i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 1912
s = int(input())
a_list = [s]
while True:
    # 偶数
    if a_list[-1] % 2 == 0:
        a = a_list[-1] / 2
    # 奇数
    else:
        a = 3 * a_list[-1] + 1
    
    if a in a_list:
        ans = len(a_list) + 1
        break
    
    a_list.append(a)

print(ans)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
	char input[20];
	int str;
	int i;
	for(i = 0 ; i < 20 ; i++)
		input[i] = '\0';

	scanf("%s", input);

	for(i = 20 ; i > 0 ; i--){
		if(input[i-1] != '\0') printf("%c", input[i-1]);
	}
	puts("");


	return 0;
}

Measured memory_bytes: 524
"""
Created on Wed Jan  1 14:22:42 2020
"""

n, m, x = map(int, input().split())
has = [0] * (n + 1)
v = list(map(int, input().split()))
for i in range(m):
    has[v[i]] = 1
res1 = 0
res2 = 0
for i in range(n + 1):
    if has[i] == 1:
        if i <= x:
            res1 += 1
        else:
            res2 += 1
print(min(res1, res2))

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  
  vector<int> c(n);
  REP(i, n)
    c.at(i) = s[i];
  sort(c.begin(), c.end());
  
  string ans = "yes";
  REP(i, n - 1) {
    if (c.at(i) == c.at(i + 1)) {
      ans = "no";
      break;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

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


int main()
{
  int a, b;
  cin >> a >> b;
  if (a >= 1 && a <= 9 && b >= 1 && b <= 9)
    cout << a * b << endl;
  else
    puts("-1");
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int c[3][2];
    int coin;
    coin=0;
    int t,n;
    int x,y;
    for(t=0;t<3;t++){
        for(n=0;n<2;n++){
            scanf("%d",&c[t][n]);
        }
    }
    for(t=0;t<3;t++){
        for(n=0;n<2;n++){
            for(x=0;x<t;x++){
                c[t][n]=c[t][n]*10;
            }
            for(y=0;y<n;y++){
                c[t][n]=c[t][n]*5;
            }
        }
    }
    for(t=0;t<3;t++){
        for(n=0;n<2;n++){
            coin=coin+c[t][n];
        }
    }
    if(1000<=coin){
        printf("1\n");
    }
    else{
        printf("0\n");
    }
    return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
long long int mod=1e9+7;
long long int dp[100001][2];
vector<vector<int> > ve;
long long int functions(int start,int color,int parent){
    long long int ans=1;
    int len=ve[start].size();
    if(len==0)
    return 2;
    if(dp[start][color]!=-1)
    return dp[start][color];
    for(int i=0;i<len;i++){
        if(ve[start][i]!=parent){
            ans=(ans*functions(ve[start][i],0,start))%mod;
        }
    }
    if(color==1)
    //return ans;
    {
        dp[start][color]=ans;
        return ans;
    }
    long long int again=1;
    for(int i=0;i<len;i++){
        if(ve[start][i]!=parent){
            again=(again*functions(ve[start][i],1,start))%mod;
        }
    }
    ans=(ans+again)%mod;
    //cout<<ans<<endl;
    dp[start][color]=ans;
    return ans;
}
int main(void){
    memset(dp,-1,sizeof(dp));
    int n;
    cin>>n;
    ve.resize(n+1);
    int start,end;
    for(int i=1;i<n;i++){
        cin>>start>>end;
        ve[start].push_back(end);
        ve[end].push_back(start);
    }
    long long int ans=functions(1,0,0);
    cout<<ans<<endl;
}

Measured memory_bytes: 15616
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#define itn int
#define retrun return
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
using namespace std;
typedef long long llong;
typedef pair<int, int> pii;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通
int N, R;
int main() {
	cin >> N >> R;
	if (N >= 10) cout << R;
	else {
		cout << R + 100 * (10 - N);
	}
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
    int n;
    cin >> n;
    cout << "ABC" << n << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
 
int main(){
int i,j;
string a;
cin>>a;int ans=0;
for (char c:a) c=='-'?ans--:ans++;
cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

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; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9 + 5;
constexpr long long INFLL = 1LL << 62;
constexpr double eps = (1e-9);

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

  ll k;
  cin >> k;

  int n = 50;
  vector<ll> a(50, 49);

  rep(i, n) {
    a[i] += k / n;
  }

  rep(i, k % n) {
    a[i] += n + 1;
    rep(j, n) a[j]--;
  }

  printf("%d\n", n);
  for (int i = 0; i < n; i++) {
    printf("%lld%c", a[i], i == n - 1 ? '\n' : ' ');
  }

  return 0;
}


Measured memory_bytes: 3716
#include <iostream>

using namespace std;

int generate(int a, int b, int t) {
    if (t - a < 0) {
        return 0;
    }

    return generate(a, b, t - a) + b;
}

int main() {

    int a, b, t;
    cin >> a >> b >> t;

    cout << generate(a, b, t) << endl;

    return 0;
}


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

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    COMinit();
    long long int S, T;
    cin >> S;
    T = S / 3;
    long long int s, t, ans = 0;
    for(int i = 1; i <= T; i++){
        s = S - 2 * i - 1;
        t = i - 1;
        ans += COM(s, t);
    }
    ans = ans % MOD;
    cout << ans;
}

Measured memory_bytes: 15580
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B&&A!=C){
    cout<<"Yes"<<endl;
  }
  else if(A==C&&A!=B){
    cout<<"Yes"<<endl;
  }
  else if(B==C&&A!=B){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
  

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h.at(i);
    sort(h.begin(),h.end());
    reverse(h.begin(),h.end());
    ll ans = 0;
    for(auto x : h){
        if(k-- > 0)continue;
        ans += x;
    } 
    cout << ans << endl;
}

Measured memory_bytes: 4008
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;

int main() {
  int a,b;
  cin >> a>> b;
  int tmp;
  int q;
  vector<int> d(a+1);
  for (int i = 0; i < b; i++) {
    cin >> tmp;
    for (int j = 0; j < tmp; j++) {
      cin >> q;
      d[q] = 1;
    }
  }
  int ans = 0;
  for (int i = 0; i < a+1; i++) {
    if (d[i] == 0) {
      ans++;
    }
  }
  cout << ans-1;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
//配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
  
int main(){
    int N;
    vector<string> S(200000);
    map<string,int> P;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >>S.at(i);
        if(P.count(S.at(i))){
          P.at(S.at(i))++;
        }
        else{
          P[S.at(i)]=1;
        }
    } 
    int max_cnt=0;

    for(auto x : P){
        auto k=x.first;
        auto v=x.second;
        if(max_cnt<v){
          max_cnt=v;
        }
    }
    for(auto x : P){
        auto k=x.first;
        auto v=x.second;
        if(v==max_cnt){
          cout <<k<<endl;
        }
    }
}


Measured memory_bytes: 26752
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
        int[] C = new int[n];
        int[][] A = new int[n][m];
        int[] M = new int[m];
        int res = Integer.MAX_VALUE;
        for(int i = 0; i < n; i++) {
            C[i] = sc.nextInt();
            for(int j = 0; j < m; j++) {
                A[i][j] = sc.nextInt();
            }
        }
        for(int bit = 0; bit < (1 << n); bit++) {
            int c = 0;
            for(int i = 0; i < n; i++) {
                if((1&bit>>i) == 1) {
                    for(int j = 0; j < m; j++) {
                        M[j] += A[i][j];
                    }
                    c += C[i];
                }
            }
            boolean flag = true;
            for(int mp : M) if(mp < x) flag = false;
            if(flag) res = Math.min(res, c);
            Arrays.fill(M, 0);
        }
        System.out.println(res == Integer.MAX_VALUE ? -1 : res);
    }
}


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

int main() {
    ll n, k, ans = 0;
    cin >> n >> k;
    REP(i,n-1){
        ans += (ans)/(k-1)+1;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3064
import math

#n, a, b= map(int, input().split())
#n, x  = map(int, input().split())
#s = list(str(input()))
n = int(input())
#a = list(map(int, input().split()))

a = [""]*n
for i in range(n):
  a[i] = int(input())

#for i in range(n):
a.sort(reverse=True)
count = 0
for i in range(n-1):
  if(a[i] == a[i+1]):
    a[i] = 0

for i in range(n):
  if(a[i] != 0):
    count = count + 1
  
print(count)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	int N,f;
	int n[4];
	scanf("%d", &N);
	int i;
	for (i = 0; i < 4; i++){
		n[i] = N % 10; ;
		N = N / 10;
	}
	f = 1;
	for (i = 0; i < 3; i++){
		if (n[i] == n[i + 1]){
			f = f + 1; 
			if (f >= 3) break;
		}
		else f = 0;
	}
	if (n[3] == n[2]) f = f + 1;
	else f = f; 
	if (f >= 3) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
'use strict'
function main(input) {
  input = input
    .trim()
    .split(' ')
    .map(v => Number(v))
  const W = input[0]
  const H = input[1]
  const X = input[2]
  const Y = input[3]
 
  const boo = X + X == W && Y + Y == H ? 1 : 0
  console.log((W * H) / 2 + ' ' + boo)


}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7628
N = int(input())
ABC = list(list(map(int, input().split())) for _ in range(N))

dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]
for i in range(1, N):
    dp[i][0] = max(dp[i - 1][1] + ABC[i][0], dp[i - 1][2] + ABC[i][0])
    dp[i][1] = max(dp[i - 1][2] + ABC[i][1], dp[i - 1][0] + ABC[i][1])
    dp[i][2] = max(dp[i - 1][0] + ABC[i][2], dp[i - 1][1] + ABC[i][2])

print(max(dp[N-1]))

Measured memory_bytes: 76632
#include<stdio.h>
#include<string.h>
int main(){
  int n;
  int i;
  char temp[4];
  
  
  
  
  double money = 0;
  double sum = 0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf %s",&money,temp);
    if(strcmp(temp,"JPY") ==0){
      sum+=money;
    }else{
      sum+=money*380000;
    }
  }
  printf("%lf",sum);
}


Measured memory_bytes: 128