akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define BeatMeScanf ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define sz 150010
const int mod=1000000007;

int main(){
    BeatMeScanf;
    int a,b,c;
    cin>>a>>b>>c;
    int sum=a+b+c;
    if(sum>=22) cout<<"bust"<<endl;
    else cout<<"win"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b;
	while(cin>>a>>b)
	{
		ll ans=__gcd(a,b);
		cout<<ans<<" ";
		cout<<a/ans*b<<endl;;
	}
	return 0;
 } 


Measured memory_bytes: 3080
def resolve():
    S = list(input())

    front = int(''.join(S[:2]))
    back = int(''.join(S[2:]))

    if (1 <= front <= 12 and 1 <= back <= 12):
        print('AMBIGUOUS')
        return

    if (1 <= back <= 12):
        print('YYMM')
        return

    if (1 <= front <= 12):
        print('MMYY')
        return

    print('NA')


resolve()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

class SquareDivision{
    private:
        const int BUCKET_SIZE=256;
        ll N, B;
        vector<ll> data, bucket_add;

    public:
        void prepare(int n){
            B=(n+BUCKET_SIZE-1)/BUCKET_SIZE;
            N=B*BUCKET_SIZE;
            data.assign(N, 0);
            bucket_add.assign(B, 0);
        }

        void add(int s, int t, int x){
            for(int i=0; i<B; i++){
                int l=i*BUCKET_SIZE, r=(i+1)*BUCKET_SIZE;

                if(r<=s || t<=l) continue;

                if(s<=l && r<=t){
                    bucket_add[i]+=x;
                }
                else{
                    for(int j=max(s, l); j<min(t, r); j++){
                        data[j]+=x;
                    }
                }
            }
        }

        int get(int i){
            int k=i/BUCKET_SIZE;
            return data[i]+bucket_add[k];
        }
};

signed main(){
    int n, q; cin>>n>>q;
    SquareDivision ans;
    ans.prepare(n);

    while(q--){
        int c; cin>>c;
        if(c==0){
            int s, t, x; cin>>s>>t>>x;
            ans.add(s, t+1, x);
        }
        else{
            int x; cin>>x;
            cout << ans.get(x) << endl;
        }
    }
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}


signed main()
{
    showoff;
    int n,ans = 0;
    cin >> n;
    vector<int>b(n+5),a(n+5);
    FOR(i,1,n)cin >> b[i];
    a[1] = b[1];
    ans = a[1];
    FOR(i,2,n+1){
        a[i] = b[i-1];
        if(i < n && b[i] < a[i])a[i] = b[i];
        ans += a[i];
    }
    cout << ans;
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin>>S;
    int N=S.size()+1;
    int dp[N+1][13]{};
    dp[0][0]=1;
    for(int i=0;i<S.size();i++){
        if(S[i]=='?'){
            rep(j,10){
                rep(k,13){
                    int r=j+k*10;
                    r%=13;
                    dp[i+1][r]+=dp[i][k];
                    dp[i+1][r]%=MOD;
                }
            }
        }else{
            int x=S[i]-'0';
            rep(j,13){
                int z=j*10+x;
                z%=13;
                dp[i+1][z]+=dp[i][j];
                dp[i+1][z]%=MOD;
            }

        }
    }
    cout << dp[N-1][5]<<endl;





    



}


Measured memory_bytes: 13944
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
from functools import partial, reduce
from operator import mul
prod = partial(reduce, mul)
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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

fibo = [1, 1]
for i in range(2, 9):
    fibo.append(fibo[i - 1] + fibo[i - 2])

def main():
    H, W, K = LI()
    K -= 1
    dp = [0] * W
    dp[0] = 1
    for _ in range(H):
        pre = dp
        dp = [0] * W
        for w in range(W):
            # down
            cnt = fibo[max(0, w - 0)] * fibo[max(0, W - w - 1)]
            dp[w] += pre[w] * cnt
            dp[w] %= MOD
            # to L
            cnt = fibo[max(0, w - 1)] * fibo[max(0, W - w - 1)]
            if w - 1 >= 0:
                dp[w - 1] += pre[w] * cnt
                dp[w - 1] %= MOD
            # to R
            cnt = fibo[max(0, w - 0)] * fibo[max(0, W - w - 2)]
            if w + 1 < W:
                dp[w + 1] += pre[w] * cnt
                dp[w + 1] %= MOD
    ans = dp[K]
    return ans

print(main())

Measured memory_bytes: 3700
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<set>

using namespace std;

int main(void){
    int N;
    string S;
    const long long mod = 1E9+7;
    cin >> N >> S;
    vector<long long> cn(26, 0);
    for(int i = 0; i < S.length(); i++) cn[S[i] - 'a']++;

    long long all = 1;
    for(int i = 0; i < S.length(); i++){
        all *= 2;
        all %= mod;
    }
    long long ng = 1;
    for(int i = 0; i < 26; i++){
        long long sub = 1;
        for(int j = 0; j < i; j++){
            sub *= 1 + cn[j];
            sub %= mod;
        }
        long long subsub = 1;
        for(int j = 0; j < cn[i]; j++){
            subsub *= 2;
            subsub %= mod;
        }
        subsub += mod - 1 - cn[i];
        subsub %= mod;
        sub *= subsub;
        sub %= mod;
        for(int j = i + 1; j < 26; j++){
            for(int k = 0; k < cn[j]; k++){
                sub *= 2;
                sub %= mod;
            }
        }
        ng += sub;
        ng %= mod;
    }

    all += mod - ng;
    all %= mod;

    cout << all << endl;
    return 0;
}


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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

vector<ll> factors;
vector<ll> factors1;


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int n;
    cin >> n;
    vector<ll> A(n);
    sort(all(A));
    REP(i, n) cin >> A[i];
    factors.pb(1);
    factors.pb(A[0]);
    factors1.pb(1);
    factors1.pb(A[1]);
    for (int i = 2; i < sqrt(A[0]) + 2; i++) {
        if (A[0] % i == 0) {
            factors.pb(i);
            factors.pb(A[0] / i);
        }
    }
    for (int i = 2; i < sqrt(A[1]) + 2; i++) {
        if (A[1] % i == 0) {
            factors1.pb(i);
            factors1.pb(A[1] / i);
        }
    }
    int ans = 1;
    REP(i, SZ(factors)) {
        int ccc = 0;
        FOR(j, 1, n-1) {
            if (A[j] % factors[i]) {
                ccc++;
                if (ccc > 1) {
                    break;
                }
            }
        }
        if (ccc < 2 && factors[i] > ans) ans = factors[i];
    }
    REP(i, SZ(factors1)) {
        int ccc = 0;
        FOR(j, 0, n-1) {
            if (j == 1) continue;
            if (A[j] % factors1[i]) {
                ccc++;
                if (ccc > 1) {
                    break;
                }
            }
        }
        if (ccc < 2 && factors1[i] > ans) ans = factors1[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iostream>
#define ll long long

using namespace std;

bool doneNode[100001];

int ans[100001];
pair<int, int> hen[100001];
unordered_set<int> used_color[100001];
vector<int> node_line[100001];

int colorNumber;

void search(int nodeIndex) {
  if (doneNode[nodeIndex]) {
    return;
  }
  doneNode[nodeIndex] = true;

  // vector<int> queue;
  int next_color = 1;
  for (int lineIndex : node_line[nodeIndex]) {
    if (ans[lineIndex]) {
      continue;
    }

    int f = hen[lineIndex].first;
    int s = hen[lineIndex].second;

    while (true) {
      if ((used_color[f].find(next_color) != used_color[f].end())) {
        next_color++;
      } else if ((used_color[s].find(next_color) != used_color[s].end())) {
        next_color++;
      } else {
        break;
      }
    }
    ans[lineIndex] = next_color;
    colorNumber = max(colorNumber, next_color);

    used_color[f].insert(next_color);
    used_color[s].insert(next_color);
    next_color++;

    if (!doneNode[f]) {
      search(f);
      // queue.emplace_back(f);
    }
    if (!doneNode[s]) {
      search(s);
      // queue.emplace_back(s);
    }
  }

  // for (int i = 0; i < queue.size(); i++) {
  //   search(queue[i]);
  // }
}

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

  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);

    hen[i] = make_pair(a - 1, b - 1);

    node_line[a - 1].emplace_back(i);
    node_line[b - 1].emplace_back(i);
  }

  search(0);

  cout << colorNumber << endl;
  for (int i = 0; i < n - 1; i++) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 23552
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

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

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

    int cnt = 0;
    for(int i = 1; i < n - 1; i++){
        if(p[i-1] < p[i] && p[i] < p[i+1]) cnt++;
        if(p[i-1] > p[i] && p[i] > p[i+1]) cnt++;
    }

    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=3e5+10;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

struct line {
	int k;ll b;
	line(int k=0,ll b=0):k(k),b(b) {}
	ll cal(int x) {
		return 1ll*k*x+b;
	}
} q[N];

long double sec(const line &x,const line &y) {
	return 1.0*(y.b-x.b)/(x.k-y.k);
}

int n,a[N],h,t;
ll f[N],g[N],s[N],v[N],tmp[N];

void push(line l) {
	while(h<t&&sec(q[t],l)>=sec(q[t],q[t-1])) --t;
	q[++t]=l;
}

ll query(int x) {
	while(h<t&&q[t].cal(x)<=q[t-1].cal(x)) --t;
	return q[t].cal(x);
}

ll cal1(int x) {
	return (1ll*x*x+x)/2-s[x];
}

ll cal2(int x) {
	return (1ll*x*x-x)/2+s[x];
}

void dp(ll *f) {
	for(int i=1;i<=n;i++) s[i]=s[i-1]+a[i];
	h=1,t=0;
	for(int i=1;i<=n;i++) {
		push((line){-i+1,f[i-1]+cal2(i-1)});
		f[i]=max(f[i-1],query(i)+cal1(i));
	}
}

void solve(int l,int r) {
	if(l==r) {
		v[l]=max(v[l],f[l-1]+g[l+1]+1-a[l]);
		return;
	}
	int mid=(l+r)>>1;
	h=1,t=0;
	for(int i=l-1;i<mid;i++) push((line){-i,f[i]+cal2(i)});
	for(int i=mid+1;i<=r;i++) tmp[i]=query(i)+g[i+1]+cal1(i);
	for(int i=r-1;i>mid;i--) tmp[i]=max(tmp[i],tmp[i+1]);
	for(int i=mid+1;i<=r;i++) v[i]=max(v[i],tmp[i]);
	h=1,t=0;
	for(int i=mid+1;i<=r;i++) push((line){-i,g[i+1]+cal1(i)});
	for(int i=l-1;i<mid;i++) tmp[i+1]=query(i)+f[i]+cal2(i);
	for(int i=l+1;i<=mid;i++) tmp[i]=max(tmp[i],tmp[i-1]);
	for(int i=l;i<=mid;i++) v[i]=max(v[i],tmp[i]);
	solve(l,mid),solve(mid+1,r);
}

int main() {
	cin>>n;
	for(int i=1;i<=n;i++) a[i]=gi();
	reverse(a+1,a+n+1);dp(g);reverse(g+1,g+n+1);
	reverse(a+1,a+n+1);dp(f);
	memset(v,0xc0,sizeof(v));solve(1,n);
	int m=gi();
	while(m--) {
		int p=gi(),x=gi();
		cout<<max(f[p-1]+g[p+1],v[p]-x+a[p])<<'\n';
	}
	return 0;
}


Measured memory_bytes: 20224
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <iomanip> 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb;
typedef vector<ull> vul;
typedef vector<pair<ll, ll>> vpl;
typedef pair<ll, ll> pl;
#define For(i, n) for(ll i = 0; i < n; i++)
#define len(n) (ll)(n).size()
#define Sort(a) sort(a.begin(), a.end())
ll dp[100010][3];
ll a[100010][3];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	For(i, n) {
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	for (ll i = 1; i <= n; i++) {
		For(j, 3) {
			For(j1, 3) {
				if (j != j1) {
					dp[i][j] = max(dp[i][j], dp[i - 1][j1] + a[i - 1][j1]);
				}
			}
		}
	}
	cout << max({ dp[n][0], dp[n][1], dp[n][2] });
	return 0;
}

Measured memory_bytes: 8328
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
using namespace std;
const int MAXN=3e3+10;
const int MOD=998244353;
int a[MAXN];
ll dp[MAXN];
int main(void)
{
    sync;
    int n,s;
    cin>>n>>s;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    int res=0;
    for(int i=1;i<=n;++i)
    {
        for(int j=s;j>a[i];--j)
            dp[j]=(dp[j]+dp[j-a[i]])%MOD;
        dp[a[i]]=(dp[a[i]]+i)%MOD;
        res=(res+(n-i+1)*dp[s]%MOD)%MOD;
        dp[s]=0;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
N, K = list(map(int, input().split()))
d = []
A = []
B = set()
for i in range(K):
    _d = int(input())
    _A = list(map(int, input().split()))
    d.append(_d)
    A.append(_A)
    _B = set(_A)
    B = B | _B
print(N - len(B))

Measured memory_bytes: 9076
n = input().split()
vs = list(map(int, input().split()))

eve = {}
odd = {}

for i in range(len(vs)):
    if i % 2 == 0:
        if vs[i] in eve:
            eve[vs[i]] += 1
        else:
            eve[vs[i]] = 1
    else:
        if vs[i] in odd:
            odd[vs[i]] += 1
        else:
            odd[vs[i]] = 1

es = sorted(eve.items(), key=lambda x: -x[1])
os = sorted(odd.items(), key=lambda x: -x[1])

if es[0][0] == os[0][0]:
    if es[0][1] > os[0][1]:
        del es[0]
        if len(os) > 1 :
            del os[1]
    elif es[0][1] < os[0][1]:
        del os[0]
        if len(es) > 1 :
            del es[1]
    else:
        if len(es) == 1 and len(os) == 1:
            del os[0]
        elif len(es) == 1 and len(os) != 1:
            del es[0]
            del os[1]
        elif len(es) != 1 and len(os) == 1:
            del es[1]
            del os[0]
        else:
            if es[1][1] < os[1][1]:
                del es[0]
                del os[1]
            else:
                del es[1]
                del os[0]
else:
    del os[0]
    del es[0]

trans = 0

for i in range(len(es)):
    trans += es[i][1]
for i in range(len(os)):
    trans += os[i][1]

print(trans)

Measured memory_bytes: 20892
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
vector<vector<int>>edge;
vector<int>wei;
int n,k;
int mod=1e9+7;
void dfs(int par,int node)
{
  int tk=k-1;
  if(par!=-1)tk--;
  for(int nn:edge[node])
  {
    if(nn==par)continue;
    //cout<<"dfs"<<nn<<" "<<node<<" "<<tk<<endl;;
    wei[nn]=tk--;
    dfs(node,nn);
  }
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n>>k;
  edge.resize(n);
  wei.resize(n);
  rep(i,n-1)
  {
    int x,y;
    cin>>x>>y;
    x--;
    y--;
    edge[x].push_back(y);
    edge[y].push_back(x);
  }
  int res=1;
  wei[0]=k;
  dfs(-1,0);
  rep(i,n)
  {
    res=(ll)res*wei[i]%mod;
    //cout<<wei[i]<<" "<<i<<endl;
  }
  cout<<res<<endl;

}


Measured memory_bytes: 9600
from collections import defaultdict

def main():
    N, X, Y = [int(x) for x in input().split()]
    shortcut_len = Y - X - 1
    count = defaultdict(int)
    for start in range(1, N+1):
        for end in range(start + 1, N+1):
            length = end - start
            if start <= X and end >= Y:
                length -= shortcut_len
            elif start < Y:
                temp = 1 + abs(X - start) + abs(Y - end)
                length = temp if temp < length else length

            # print(start, end, length)
            count[length] += 1
    
    for i in range(1, N):
        print(count[i])

if __name__ == "__main__":
    main()


Measured memory_bytes: 3956
#include <algorithm>
#include <iostream>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <map>

using namespace std;

#define ll long long
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define pb(x) push_back(x)

ll power(int x, unsigned int y){
    ll res = 1;
    while(y > 0){
        if(y & 1) res = res * x;
        y >>= 1;
        x *= x;
    }
    return res;
}

void solve(){

    ll n, k;
    cin >> n >> k;
    ll arr[n+1], vis[n+1] = {0};
    
    for(int i = 1; i <= n; i++){
        cin >> arr[i];
    }

    ll start = 1;
    ll end = 0, ref, counter = 0;
    while(true){

        vis[start] = ++counter;
        ref = start;
        start = arr[start];

        if(vis[start] != 0){
            end = ref;
            break;
        }   
    }   

    ll cycle_length = 1;
    ll startRef = start, x = startRef;
    while(arr[x] != startRef){
        x = arr[x];
        cycle_length++;
    }

    ll rem = counter - cycle_length;
    // cout << "rem: " << rem << " cycle: " << cycle_length << '\n';
    if(k  <= rem){
        ll ans = 1;
        for(int i = 1; i <= k; i++)
            ans = arr[ans];
        cout << ans;
        return;
    }

    k -= rem;

    k %= cycle_length;
    ll ans = start;
    for(int i = 1; i <= k; i++)
        ans = arr[ans];
    cout << ans;
}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("/ATOMCODES/input.txt", "r", stdin);
    freopen("/ATOMCODES/output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    solve();

}

Measured memory_bytes: 6744
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;
bool aaa[11111111];
int main() {
  int k,x;
  cin>>k>>x;
  if(500*k>=x)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;



  //vector<vector<bool>> sinsetsu(15,vector<bool>(14)),usotsuki(15,vector<bool>(14));
  //vector<vector<int>> sss(15,vector<int>(14))
  //vector<vector<int>> sss(h,vector<int>(w));
  //vector<int> a(k),b(k);
  //char x;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	string t; cin >> t;

	int64_t on[2] = { 0, 0 };
	FOR_LT(i, 0, t.size()) {
		if (t[i] == '1') on[i & 1]++;
	}

	int64_t ans = on[0];
	int64_t n = 0;
	int64_t m = 0;

	FOR_LT(i, 0, t.size()) {
		if (t[i] == '1') on[(i - m) & 1]--;

		if (((i - m) & 1) == 0 && t[i] == '0') {
			swap(on[0], on[1]);
			ans += on[0] + (n + 1) / 2;
			m++;
		}
		else {
			n++;
		}
	}

	while (n != 0) {
		n--;
		ans += ((n + 1) / 2);
	}
	cout << ans << endl;

	return 0;
}

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

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

int main() {
    string s;
    cin >> s;
    int k;
    cin >> k;
    int i = 0;
    while(1) {
        if ( i == s.length() || i == k ) break;
        if ( s[i] != '1' ) {
            cout << s[i] << endl;
            return 0;
        }
        i++;
    }

    cout << '1' << endl;

    return 0;
}


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

int main()
{
    ll h, n, tmp;
    cin >> h >> n;

    ll sum = 0;
    for(int i = 0; i < n; ++i)
    {
        cin >> tmp;
        sum += tmp;
    }

    if(h - sum > 0) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3636
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll h,w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i,0,h) cin >> s[i];

	for(ll i=0; i<h; i++){
		cout << s[i] << "\n";
		cout << s[i] << "\n";
	}
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,s=0,z=0,a[10],aa[10];
	for(i=0;i<10;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+10,greater<int>());
	for(i=0;i<10;i++){
		scanf("%d",&aa[i]);
	}
	sort(aa,aa+10,greater<int>());
	s=a[0]+a[1]+a[2];
	z=aa[0]+aa[1]+aa[2];
	printf("%d %d\n",s,z);
	return 0;
}

Measured memory_bytes: 1040
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int A, B, C, D, E, F;

int main() {
	cin >> A >> B >> C >> D >> E >> F;
	
	double ma = 0.0;
	pii ans(100 * A, 0);
	
	REP(i, 40) REP(j, 40) {
		if (i + j == 0) continue;
		
		int g = 100 * A * i + 100 * B * j;
		if (g > F) break;
		
		int to = g / 100 * E;
		chmin(to, F - g);
		
		REP(k, 10000) {
			int dif = to - C * k;
			if (dif < 0) break;
			
			int l = dif / D;
			
			int sa = C * k + D * l;
			
			if (chmax(ma, 100.0 * sa / (g + sa))) {
				ans = pii(g + sa, sa);
			}
		}
	}
	
	printf("%d %d\n", ans.fi, ans.se);
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <stack>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i ++)
using ll = long long;
int N;
int A[3001];
ll dp[3001][3001];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> N;
    rep(i, N) cin >> A[i];
    rep(i, N + 1) {
        dp[0][i] = 0;
    }
    for (int l = 1; l <= N; l ++) {
        int player = (N - l) % 2;
        rep(i, N + 1 - l) {
            int x = A[i], y = A[i+l-1];
            if (player == 1) {
                dp[l][i] = min(-x + dp[l - 1][i + 1], -y + dp[l - 1][i]);
            } else {
                dp[l][i] = max(x + dp[l - 1][i + 1], y + dp[l - 1][i]);
            }
        }
    }
    cout << dp[N][0] << endl;
    return 0;
}

Measured memory_bytes: 49792
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
if n==1:
    print(max(x)-min(x))
elif m==1 or n>=m:
    print(0)
else:
    x.sort()
    goukei=0
    l=[0]
    for i in range(m-1):
        goukei+=x[i+1]-x[i]
        l.append(x[i+1]-x[i])
    i=0
    l.sort()
    for i in range(n-1):
        goukei-=l[-1-i]
    print(goukei)


Measured memory_bytes: 13960
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    lines = ["".join(sorted(line.rstrip())) for line in sys.stdin.readlines()]

    ret = 0
    sortedlines = {}
    for n in range(N):
        item = lines[n]
        if item in sortedlines:
            sortedlines[item] += 1
            ret += sortedlines[item] - 1
        else:
            sortedlines[item] = 1

    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21032
from itertools import combinations

N, D = [int(n) for n in input().split()]
X = []
for i in range(N):
    X.append([int(n) for n in input().split()])
ans = 0
for i, j in combinations(X, 2):
    if (sum([(j[d]-i[d])**2 for d in range(D)])**0.5).is_integer():
        ans += 1
print(ans)


Measured memory_bytes: 3188
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

//std::cout << std::fixed << std::setprecision(10)
constexpr long long MOD = 1000000007;

int main()
{
  int N;
  std::cin >> N;
  std::vector<int> p(N);
  for(auto& val: p)
    std::cin >> val;
  auto q = p;
  std::sort(q.begin(), q.end());
  int cnt = 0;
  for (int i = 0; i < q.size(); ++i)
  {
    if (q[i] != p[i])
      ++cnt;
  }
  std::cout << (cnt <= 2 ? "YES" : "NO") << std::endl; 
  return 0;
}



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

int main()
{
    long long int s = 1;
    int i,x;
    scanf("%d",&x);
    for(i = 1;i <=x;i++)
    {
        s *=i;
        if(s>=1000000007)
        s %= 1000000007;
    }
    printf("%lld\n",s);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int maxarray(int* a,int s){
    int b = 0;
    rep(i,s)if(a[i]>b)b=a[i];
    return b;
}
int main(void){
    int n,mw;
    cin >> n >> mw;
    int dp[mw+1];
    rep(i,mw+1)dp[i]=0;
    rep(i,n){
        int v,w;
        cin >> v >> w;
        rep(j,mw)if((j == 0||dp[j]!=0)&&w+j<=mw&&dp[w+j]<dp[j]+v)dp[w+j]=dp[j]+v;
    }
    cout << maxarray(dp,mw+1) << endl;
    return 0;
}


Measured memory_bytes: 3148
using System;
class Program
{
	static void Main(string[] args)
	{
      // 整数の入力
      int len = int.Parse(Console.ReadLine());
      if (len % 2 != 0) {
      	Console.WriteLine("No");
        return;
      }
      int cen = len / 2;
      string str = Console.ReadLine();
      string a = str.Substring(0,cen);
      string b = str.Substring(cen,cen);
      if (a == b) {
    	//出力
		Console.WriteLine("Yes");
        
      }else {
    	//出力
		Console.WriteLine("No");
      }
	}
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int color[] = new int[9];
		int min=0;
		for(int i=0; i<n; i++) {
			int r = sc.nextInt();
			int c=-1;
			if(r<=399) {
				c=0;
			} else if(r<=799) {
				c=1;
			} else if(r<=1199) {
				c=2;
			} else if(r<=1599) {
				c=3;
			} else if(r<=1999) {
				c=4;
			} else if(r<=2399) {
				c=5;
			} else if(r<=2799) {
				c=6;
			} else if(r<=3199) {
				c=7;
			} else {
				c=8;
			}
			if(c != 8 && color[c]==0) {
				min++;
			}
			color[c]++;
		}
		int max=min;
		if(min==0) {
			min=1;
			max=color[8];
		} else {
			max = min + color[8];
		}
		System.out.println(min + " " + max);
		sc.close();
	}
}




Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
using namespace std;
char a[4],b[4];
int ans;
int main() {
    cin >> a >> b;
    for(int i = 0; i < 3; i++)
        if(a[i] == b[i])
            ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//Lion's Sin Escanor 

#include<bits/stdc++.h>
using namespace std;
     
     
//#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)
#define moder 1000000007
#define forn(i,n) for(int i = 0; i < n ; i++)

ll moding( ll x , ll y ){
   
    ll ans = x % y;

    if(ans < 0)ans = ans + y ;

    return ans ;

}


bool isprime(ll n){
    if(n==2) return true;
    if(n==3) return true;
    if(n%2 == 0) return false;
    if(n%3 == 0) return false;

    ll i = 5,w=2;

    while(i*i <= n){
        if(n%i == 0)return false;

        i += w;
        w = 6 - w;
    }

    return true;
}

ll cmp(string s1 , string s2){
    // 1 for diff
    // 0 for same 

    int n = s1.size();
    int m = s2.size();

    if(n!=m)return 1;

    forn(i,n)
        if(s1[i] != s2[i])return 1;


    return 0; // SAME
}




int main(){

    int n; cin >> n;

    string s , t; 
    cin >> s >> t;

    forn(i,n){
        cout<< s[i] << t[i];
    }

    cout << endl;


           
     
     
        
    return 0;
}
      
       

Measured memory_bytes: 256
import java.util.*;

@SuppressWarnings("unchecked")
public class Main {
	// public static void printArray(int[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static<T> void printArrayT(T[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	public static String joinInt(int[] a, String separator) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < a.length; i++) {
			if (i > 0) {
				sb.append(separator);
			}
			sb.append(a[i]);
		}
		return sb.toString();		
	}

	static int[] nextIntArray(Scanner sc, int N) {
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		System.out.println(N * (N-1) / 2);
	}
}


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

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t 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);
}
const ll MOD = 1e9+7;
long long modpow(long long a, long long n) {
      long long res = 1;
      while (n > 0) {
          if (n & 1) res = res * a % MOD;
          a = a * a % MOD;
          n >>= 1;
      }
      return res;
  }
int main() {
    ll n,k;
    std::cin >> n>>k;

                                ll ans = 0;
                                map<ll,ll> memo;
                                for (ll i =k; i >= 1; i--) {
                                    ll tmp = modpow(k/i,n);
                                    
                                    ll bai = 2;
                                    while(i*bai<=k){
                                        tmp -= memo[i*bai];
                                        bai++;
                                        tmp += MOD;
                                        tmp %= MOD;
                                    }
                                    memo[i] = tmp;
                                    
                                    ans += tmp*i%MOD;
                                    ans %= MOD;
                                    // std::cout << ans << std::endl;
                                }
    // ll ans = 0;
    // map<ll,ll> memo;
    // for (int i =1; i<=k;i++) {
    //     ll tmp =0;
    //     // ans += i*modpow(k/i,n);
    //     tmp += modpow(k/i,n);

    //     for (auto e : divisor(i)) {
    //         if(e==i)continue;
    //         tmp -= memo[e];
    //     }
    //     std::cout << tmp << std::endl;
    //     memo[i] = tmp;
    //     ans += i*tmp;
    //     ans %= MOD;
    //     // std::cout << ans << std::endl;
    // }
    std::cout << ans << std::endl;
}



Measured memory_bytes: 9888
#include<bits/stdc++.h>
#define LL long long
#define P 1000000007
#define M 1000005
using namespace std; 
int A[M];
	string s;
bool check(){
	for(int i=0;i<=2;i++)
		if(s[i]==s[i+1])return true;
	return false;
}
int main(){ 
	cin>>s;
	puts(check()?"Bad":"Good");
	return 0;
}

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

int main(void){
    ll n,k;
    cin >> n >> k;
    vector<ll> p(n);
    rep(i,n){
        cin >> p[i];
        p[i]++;
    }
    ll sum = accumulate(p.begin(),p.begin()+k,0LL);
    ll m = sum;
    for(int i=0;i<n-k;i++){
        sum = sum - p[i] + p[i+k];
        m = max(m,sum);
    }
    cout << setprecision(100) << m/2. << endl;
}


Measured memory_bytes: 1792
l = input()
m = []
mx = []
for x in range(len(l)):
    m.append(str(int(x % 2)))
    mx.append(str(abs(int(x % 2) - 1)))
l = list(l)
mng = 0
mxng = 0
for i in range(len(l)):
    if m[i] != l[i]:
        mng += 1
    if mx[i] != l[i]:
        mxng += 1
print(mng if mng <= mxng else mxng)


Measured memory_bytes: 16696
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
def main():
	n,a,b = inputMap()
	#print(pow(2, n))

	total = pow(2, n, mod)
	total -= 1
	tmp = combination(n, a, mod)
	if total < tmp:
		total = total + 1000000007 - tmp
	else:
		total -= tmp

	tmp = combination(n, b, mod)
	if total < tmp:
		total = total + 1000000007 - tmp
	else:
		total -= tmp

	print(total)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

if __name__ == "__main__":
	main()


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
#define MAX 999999999

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

typedef long long ll;

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

    int n;
    cin >> n;

    cout << "ABC" << n << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Contest20191017
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string[] weather = { "Sunny", "Cloudy", "Rainy" };

            int i = 0;
            if (S == "Sunny") 
            {
                i = 1;
            }

            else if (S == "Cloudy")
            {
                i = 2;
            }

            else if (S == "Rainy") 
            {
                i = 0;
            }

            Console.WriteLine(weather[i]);
        }
    }
}


Measured memory_bytes: 13140
import java.util.*;

public class Main{
  
  public static void main(String[] args){
    
 	Scanner scanner = new Scanner(System.in);
    ArrayList <Integer> list = new ArrayList <Integer> ();
    
  	int N = scanner.nextInt();
    int count = 0;
    
  	for (int i=0; i<N; i++){
    	int temp = scanner.nextInt();
     	list.add(temp);
  	}
    
    boolean flag = true;
    boolean loopflag = true;
    
    while (loopflag) {
    for (int j=0; j<N; j++){
      int temp = list.get(j);
      
      if (temp%2!=0){
        flag = false;
      }
    }
    
       if (flag == true) {
    	   for (int k=0; k<N; k++){
       
      	  list.set(k, (list.get(k))/2);
       }
       count++;
       } else {
    	   loopflag = false;
       }
    }
    System.out.println(count);
  }
}

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

int main(){
    int N, K, sum;
    cin >> N >> K;
    vector<int> box(N);
    for(int i = 0; i < N; i++){
        cin >> box.at(i);
    }

    sort(box.begin(), box.end(), greater<int>());
    sum = 0;
    for(int i = 0; i < K; i++){
        sum += box.at(i);
    }

    cout << sum << endl;

}

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

using namespace std;

int main()
{
    int min1, max1, min2, max2;
    cin >> min1 >> max1 >> min2 >> max2;
    int max_of_mins = max(min1, min2);
    int min_of_max = min(max1, max2);
    if (max_of_mins > min_of_max){
        cout << 0;
    }else{
        cout << min_of_max - max_of_mins;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define RREP(i, a, n) for(int i=n-1; i>=a; i--)
#define INF 1000000000
#define ll long long

int n, a[11];
int cnt = 0;
void check(int num) {
	if (num >= n) return;

	if (a[num] % 2 == 0) {
		cnt += pow(3.0, n - num - 1);
		check(num + 1);
		check(num + 1);
	}
	else {
		cnt += (2 * pow(3.0, n - num - 1));
		check(num + 1);
	}
}
int main()
{
	cin >> n;
	REP(i, 0, n) cin >> a[i];

	check(0);
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 512
from collections import defaultdict
from sys import stdin
input = stdin.readline
d = defaultdict(int)
n,k = map(int,input().split())
for _ in range(n):
    a,b = map(int,input().split())
    d[a]+=b
for key in sorted(d.keys()):
    v = d[key]
    k-=v
    if k <= 0:
        break
print(key)

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

using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop0(i,n) for(int i=0; i<(n); i++)
#define loop1(i,n) for(int i=1; i<=(n); i++)
#define fori(a,b,i) for(int i=(a); i<=(b); i++)
#define ford(a,b,i) for(int i=(a); i>=(b); i--)
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL);


#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"
#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
typedef long long int llint;

int main() {
    fast_io
	string s;
	int k;
	cin >> k >> s;
	if((int)s.size() <= k) cout << s;
	else cout << s.substr(0,k)+"...";

}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef pair<int, int> P;
typedef long long ll;

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

  int n; cin >> n;
  vector<P> p(n);
  int a, b;
  rep(i, n) {
    cin >> a >> b;
    p[i] = {a, b};
  }

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

  cout << p[n-1].second + p[n-1].first << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int k,x;
    cin>>k>>x;
    rep(i,2*k-1){
        cout<<x-k+1+i<<" ";
    }
    cout<<endl;

    return 0;
}

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

int main() {
    vector<int> v(5);
    for (int i = 0; i < 5; i++) {
        cin >> v[i];
    }
    int minv = v[0] % 10;
    int p = 0;
    for (int i = 0; i < 5; i++) {
        int x = v[i] % 10;
        if (x != 0 && x < minv) {
            minv = x;
            p = i;
        }
    }
    int sum = v[p];
    for (int i = 0; i < 5; i++) {
        if (p == i) continue;
        sum += v[i];
        if (v[i] % 10 != 0) {
            sum += 10 - v[i] % 10;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC115A
{
    class Program
    {
        static long[] p;
        static long[] M;
        static void Main(string[] args)
        {
            long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long N = a[0];
            long X = a[1];

            p = new long[N + 1];
            M = new long[N + 1];
            p[0] = 1;
            M[0] = 1;
            for(int i = 1; i < N + 1; i++)
            {
                p[i] = 2 * p[i - 1] + 1;
                M[i] = 2 * M[i - 1] + 3;
            }

            long ans = Solve(N, X);

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

        static long Solve(long l, long x)
        {
            if (l == 0) return 1;
            long mid = M[l] / 2 + 1;
            if (x == 1) return 0;
            if (x == mid) return p[l - 1] + 1;
            if (x == M[l]) return 2 * p[l - 1] + 1;
            if (x > mid) return p[l - 1] + Solve(l - 1, x - mid) + 1;
            if (x < mid) return Solve(l - 1, x - 1);

            return 0;
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, sum=0, ans=0;
	cin >> n;
	for(int i=1;i<=n;i+=2)
	{
		for(int j=1;j<=i;j++)
		{
			if(i%j==0)sum++;
		}
		if(sum==8&&i<=n)ans++;
		sum=0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256