akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;



//defines...
#define ll unsigned long long
#define tata return;
#define pb push_back
#define mp make_pair
#define in insert
#define run ios_base::sync_with_stdio(false);cin.tie(NULL);
#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
#define vec vector<ll>
#define setl set<ll>
#define mapl map<ll,ll>
#define shunno cout<<0<<endl;
#define ek cout<<1<<endl;
#define pi 2*acos(0.0)1
#define hobena cout<<-1<<endl;




//typedefs...
typedef pair<ll,ll>pll;

//const..
//const ll fx[]={0,1,0,-1};
//const ll fy[]={1,0,-1,0};
const ll mod=1e9+7;

/*ll ncr(ll n, ll k)
{
    ll res = 1;


    if (k > n - k)
        k = n - k;

    for (int i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
*/
//to remove suffix of a number from a set of string
/*
for(int k=1; k<j.size(); k++)
                if(temp.count(string(j.begin()+k,j.end())))
					temp.erase(string(j.begin()+k,j.end()));
 */

void oka()
{
    string s;
    ll ans=0,cnt=0;
    ll i;
    cin>>s;
    for(i=0;i<3;i++)
    {
        if(s[i]=='R')
            cnt++;
        else
        {
            ans=max(ans,cnt);
            cnt=0;
        }
    }
    if(cnt>0)
        ans=max(ans,cnt);
    cout<<ans<<endl;
}



/*I'll paint it on the walls
     cause I'm the one at fault
    I'll never fight again and
         this is how it ends .*/






int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    run
    ll t;
    t=1;
  //cin>>t;
    while(t--){

    oka();
    }



}


Measured memory_bytes: 3652
#include<stdio.h>

int main() {
	
	int cnt, i, j, n, m, c, a[20][20], b[20], ans[20] = {0};
	cnt = 0;
	scanf("%d%d%d", &n, &m,&c);
	for (i = 0; i < m; i++) scanf("%d",&b[i]);
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			scanf("%d", &a[i][j]);
			ans[i]=ans[i]+ a[i][j]*b[j];
		}
		if (ans[i] + c > 0)cnt++;
	}
	printf("%d", cnt);


	
	
	
	return 0;
	
}

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

#define len(s) int(s.size())
#define res(x) cout<<((x)?"No\n":"Yes\n")
#define all(v) v.begin(),v.end()

typedef long long ll;
typedef long double ld;

ll mod = 1e9+7;

void solution() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;

	int ans = 0;
	if(k > 0) {
		ans = min(k, a);
		k -= min(k, a);
	}

	if(k > 0) {
		k -= min(k, b);
	}

	if(k > 0) {
		ans -= min(k, c);
	}

	cout << ans << endl;
	
}

int main(){
	
	int t = 1;
	//cin >> t;
	
	while(t--)
		solution();
	
	return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
int main(){
	int a,b;
	double d,r,f;
	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=1.0*a/b;
	printf("%.0f %.0f %.5f\n",d,r,f);
}


Measured memory_bytes: 2108
using System;

namespace ABC133A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, n;
            string[] ss = Console.ReadLine().Split(' ');
            n = int.Parse(ss[0]);
            a = int.Parse(ss[1]);
            b = int.Parse(ss[2]);

            if (a * n > b)
                Console.WriteLine(b);
            else
                Console.WriteLine(a * n);

            Console.ReadKey();


        }
    }
}


Measured memory_bytes: 11092
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"

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

	int n,m;
	cin>>n>>m;
	vvi in(n,vi(2));
	rep(i,n)rep(j,2)cin>>in[i][j];

	vi dp(100010,inf);
	dp[0]=0;
	
	rep(i,n)for(int j=100009;j>=0;j--)if(j+in[i][1]<=100009)
		cmin(dp[j+in[i][1]],dp[j]+in[i][0]);

	int out=0;
	rep(i,100009)if(dp[i]<=m)out=i;
	cout<<out<<endl;
}






Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,ww;
    cin >> n >> ww;
    long w[n];
    long v[n];
    for(int i=0;i<n;i++)cin >> w[i] >> v[i];

    vector<long>dp(ww+1,-999999999);
    dp[0] = 0;
    for(int i=0;i<n;i++){
        for(int j=ww;j>=0;j--){
            if(j + w[i] <= ww){
                dp[j + w[i]] = max(dp[j+w[i]],dp[j] + v[i]);
            }
        }
    }

    long ans = 0;
    for(int i=0;i<=ww;i++){
        ans = max(ans,dp[i]);
    }
    cout << ans << endl;

    
}

Measured memory_bytes: 4040
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define re register
#define pb push_back
#define fi first
#define se second
#define mp make_pair
const int N=2e6+10;
const int mod1=998244353;
const int mod2=19260811;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
char s[N];
int b[N],sum;
bool vis[N];
int main()
{
    int n,k,c;
    read(n),read(k),read(c);
    scanf("%s",s+1);
    for(re int i=1;i<=n;i++)
    {
        if(s[i]=='x') continue;
        b[++sum]=i;
        i+=c;
        if(sum==k) break;
    }
    b[sum+1]=0x3fffffff;
    for(re int i=n;i>=1;i--)
    {
        if(s[i]=='x') continue;
        if(b[sum]==i) vis[i]=1,sum--,i-=c;
        else if(b[sum+1]-i>=c) b[sum]=i,sum--,i-=c;
    }
    for(re int i=1;i<=k;i++) if(vis[b[i]]) printf("%d\n",b[i]);
    return 0;
}

Measured memory_bytes: 5888
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
struct edge{ll to,cost;};
vector<vector<edge>> graph;
vector<ll> d1;
int n;
void dijkstra(ll s){
    d1.resize(n);
    for(int i=0;i<n;i++)d1[i]=inf;//訪れていない頂点をinfで初期化
    d1[s]=0;
    priority_queue<P,vector<P>,greater<P>> q;
    q.push(P(0,s));//始点を０で置く
    while(!q.empty()){
        P a=q.top();
        q.pop();
        if(d1[a.se]<a.fi)continue;
        for(int i=0;i<graph[a.se].size();i++){
            edge e=graph[a.se][i];
            if(d1[e.to]>d1[a.se]+e.cost){
                d1[e.to]=d1[a.se]+e.cost;//訪れていないorより低いコストの経路を発見した時、値を更新
                q.push(P(d1[e.to],e.to));//コストの低いところ優先のbfs
            }
        }
    }
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
graph.resize(n);
for(int i=0;i<n-1;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    graph[a].push_back(edge{b,c});
    graph[b].push_back(edge{a,c});
}
int q,k;
cin>>q>>k;
k--;
dijkstra(k);
while(q--){
    int x,y;
    cin>>x>>y;
    x--;y--;
    cout<<d1[x]+d1[y]<<endl;
}
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

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

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

template <typename T> struct LiChaoTree {
    struct Line {
        T a, b;
        Line(T _a, T _b) : a(_a), b(_b) {}
        inline T f(T x) const { return (a * x + b); }
    };
    vector<T> X;
    vector<Line> lines;
    int n;
    LiChaoTree() {}
    LiChaoTree(const vector<T> &_X, T _INF) : X(_X) {
        n = 1;
        while(n < X.size()) {
            n <<= 1;
        }
        while(X.size() < n) {
            X.emplace_back(X.back() + 1);
        }
        lines.assign((n << 1) - 1, Line(0, INF));
    }
    void update(Line &line, int k, int l, int r) {
        int mid = (l + r) >> 1;
        bool flg_l = (line.f(X[l]) < lines[k].f(X[l]));
        bool flg_r = (line.f(X[mid]) < lines[k].f(X[mid]));
        if(flg_r) {
            swap(lines[k], line);
        }
        if(l + 1 >= r) {
            return;
        }
        if(flg_l != flg_r) {
            update(line, 2 * k + 1, l, mid);
        } else {
            update(line, 2 * k + 2, mid, r);
        }
    }
    void add(T a, T b) {
        Line l(a, b);
        update(l, 0, 0, n);
    }
    T query(int k) {
        const T x = X[k];
        k += n - 1;
        T ans = lines[k].f(x);
        while(k > 0) {
            k = (k - 1) >> 1;
            chmin(ans, lines[k].f(x));
        }
        return ans;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    ll C;
    cin >> N >> C;
    vector<ll> h(N);
    for(auto &it : h) {
        cin >> it;
    }
    vector<ll> dp(N + 1, LLINF);
    LiChaoTree<ll> lichao(h, LLINF);
    dp[1] = 0;
    lichao.add(-2 * h[0], dp[1] + h[0] * h[0]);
    for(int i = 1; i < N; i++) {
        chmin(dp[i + 1], h[i] * h[i] + C + lichao.query(i));
        lichao.add(-2 * h[i], dp[i + 1] + h[i] * h[i]);
    }
    cout << dp[N] << endl;
}

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

int main()
{
  int R, G, B, N;
  cin >> R >> G >> B >> N;
  int cnt = 0;
  for (int r = 0; r <= N; r++)
  {
    for (int g = 0; g <= N; g++)
    {
      int b = (N - R * r - G * g) / B;
      if ((N - R * r - G * g) % B == 0 && b >= 0)
      {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
n,m = map(int,input().split())

a = [list(input()) for i in range(n)]

h = []
l = []
co = 0
for i in range(n):
    co = 0
    for j in range(m):
        if a[i][j] == "#":
            co = 1
    if co == 0:
        l.append(i)
for i in range(m):
    co = 0
    for j in range(n):
        if a[j][i] == "#":
            co = 1
    if co == 0:
        h.append(i)

for i in range(len(l)):
    a.pop(l.pop())

for i in range(len(h)):
    p = h.pop()
    for j in range(len(a)):
        a[j].pop(p)

for i in range(len(a)):
    print("".join(a[i]))

Measured memory_bytes: 3188
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
#pragma warning(disable:4996)
long long N, T, Q, a[1 << 17], b[1 << 17], c[1 << 17];
int main() {
	cin >> N >> T >> Q;
	for (int i = 0; i < N; i++)scanf("%lld%lld", &a[i], &b[i]);
	long long H = -1LL << 62;
	for (int i = 0; i < N; i++) {
		if (b[i] == 2) {
			if (i >= 1) {
				if (b[i - 1] == 1) {
					long long C = (a[i - 1] + a[i]) / 2;
					if (abs(C - a[i]) <= T) { H = C; c[i] = C; }
					else { c[i] = a[i] - T; }
				}
				else {
					if (abs(H - a[i]) <= T)c[i] = H;
					else { c[i] = a[i] - T; }
				}
			}
			if (i == 0)c[i] = a[i] - T;
		}
	}
	H = 1LL << 62;
	for (int i = N - 1; i >= 0; i--) {
		if (b[i] == 1) {
			if (i < N - 1) {
				if (b[i + 1] == 2) {
					long long C = (a[i + 1] + a[i]) / 2;
					if (abs(C - a[i]) <= T) { H = C; c[i] = C; }
					else { c[i] = a[i] + T; }
				}
				else {
					if (abs(H - a[i]) <= T)c[i] = H;
					else { c[i] = a[i] + T; }
				}
			}
			if (i == N - 1)c[i] = a[i] + T;
		}
	}
	for (int i = 0; i < Q; i++) {
		int p; scanf("%d", &p); p--; cout << c[p] << endl;
	}
	return 0;
}

Measured memory_bytes: 3592
s,k=input(),int(input())
c = 0
r = 0
ss = 0
l = 1
for c1, c2 in zip(s, s[1:]):
    if c1 == c2:
        c += 1
    else:
        r += (c+1)//2
        if ss == 0:
            ss = c+1
        l = c+1
        c = 0
if c:
    r += (c+1)//2
    l = c+1
    if ss == 0:
        ss = c+1
r *= k
if len(s) == 1:
    r = k//2
elif ss == len(s):
    r = (k*ss)//2
elif s[0] == s[-1] and (ss*l) % 2:
    r+=(k-1)
print(r)



Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define LLD long long

LLD n,x;
LLD *a,*p;

LLD burger(LLD n,LLD x){
	if(!n)	return (x <= 0 ? 0 : 1);
	else if(x <= 1 + a[n - 1])	return burger(n - 1,x - 1);
	else return p[n - 1] + 1 + burger(n - 1,x - 2 - a[n - 1]);
}

int main(int argc, char const *argv[])
{	
	scanf("%lld%lld",&n,&x);
	a = (LLD *)malloc(sizeof(LLD) * n);
	p = (LLD *)malloc(sizeof(LLD) * n);
	a[0] = 1;	p[0] = 1;

	for (LLD i = 1; i < n; ++i){
		a[i] = a[i - 1] * 2 + 3;
		p[i] = p[i - 1] * 2 + 1;
	}
	printf("%lld\n", burger(n,x));
	return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

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

    var(i64, N, M, V, P);
    vector<i64> a(N);
    read(a);
    sort(all(a), greater<>());

    const auto isOK = [&](int targetIdx) {
        if (targetIdx < P) return true;
        if (a[targetIdx] + M < a[P - 1]) return false;

        i64 voteSum = 0;
        voteSum += M * (P - 1);
        voteSum += M * (N - targetIdx);
        rep(i, P - 1, targetIdx) {
            voteSum += min(M, max(i64(0), a[targetIdx] + M - a[i]));
        }
        return voteSum >= M * V;
    };

    int ok = 0;
    int ng = N;
    while (ng - ok > 1) {
        const int mid = (ok + ng) / 2;
        if (isOK(mid))
            ok = mid;
        else
            ng = mid;
    }

    print(ok + 1);

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	
	while (1)
	{int a=1;
	int b;
	int c=0;
	int cz=0;

		cin >> a;
		if (a == 0)
		{
			break;
		}
		b = 1000-a;

		if (b >= 500)
		{
			cz = b / 500;
			c = c +cz ;
			b = b % 500;
		}
		 if (b >= 100)
		{
			cz = b /100;
			c = c + cz;
			b = b % 100;
			
		}
		 if (b >= 50)
		{
			cz = b / 50;
			c = c + cz;
			b = b % 50;
		 }
		 if (b >= 10)
		{
			cz = b / 10;
			c = c + cz;
			b = b % 10;
		}
		 if (b >= 5)
		{
			cz = b / 5;
			c = c + cz;
			b = b % 5;
		 }
		 if (b >= 1)
		{
			cz = b /1;
			c = c + cz;
			b = b % 1;
		}

		cout << c << endl;
	}
	return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long

int n, k;
int a[100001];

int main(void)
{
    cin >> n >> k;
    int mi = 0;
    rep(i, n)
    {
        cin >> a[i];
        if(a[i] == 1)
            mi = i;
    }

    int res = (n - 1) / (k - 1);
    if((n - 1) % (k - 1) > 0)
        res++;
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int count = 0;
		for (int i = 0; i <= k; i++) {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 35644
#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;

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

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

int main(){
    int n; cin>>n;
    int a[3];
    int cnt=0;
    while(n>0){
        a[cnt++]=(n%10);
        n/=10;
    }
    for(int i=2; i>=0; i--){
        if(a[i]==1) cout << 9;
        else cout << 1;
    }
    cout << endl;
}

Measured memory_bytes: 256
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    aa, bb = map(int,input().split())
    a[n-i-1] = aa
    b[n-i-1] = bb
ans = 0

for i,aa in enumerate(a):
    cnt = (aa + ans) % b[i]
    if cnt != 0:
        cnt = b[i] - cnt
    
    ans += cnt
print(ans)


Measured memory_bytes: 10932
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <numeric>
#define ll long long 
#define rep(i,a,n) for(int i=a; i<n; i++)
#define per(i,a,n) for(int i=a; i>n; i--)
#define wolfe ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
int main () { 
    wolfe;
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c>=22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 3648
import math

n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]

x = l[0]
for i in range(1,n):
    #y = math.ceil(x[0] / l[i][0]) # 'ceil'は、商がfloatで桁が大きい場合、高次桁で結果に狂いが生じる.
    #z = math.ceil(x[1] / l[i][1]) # 同上
    y = -(-x[0] // l[i][0])
    z = -(-x[1] // l[i][1])
    x = [max(y, z) * j for j in l[i]]

print(sum(x))


Measured memory_bytes: 3188
a,b,c=input().split()
if a<b<c:
    print(str(a)+" "+str(b)+" "+str(c))
elif a<c<b:
    print(str(a)+" "+str(c)+" "+str(b))
elif b<a<c:
    print(str(b)+" "+str(a)+" "+str(c))
elif b<c<a:
    print(str(b)+" "+str(c)+" "+str(a))
elif c<a<b:
    print(str(c)+" "+str(a)+" "+str(b))
elif c<b<a:
    print(str(c)+" "+str(b)+" "+str(a))
elif a==b and a<c:
    print(str(a)+" "+str(b)+" "+str(c)) 
elif a==b and a>c:
    print(str(c)+" "+str(b)+" "+str(a)) 
elif b==c and a<c:
    print(str(a)+" "+str(b)+" "+str(c)) 
elif b==c and a>c:
    print(str(c)+" "+str(b)+" "+str(a))
elif a==c and a<b:
    print(str(a)+" "+str(c)+" "+str(b))
elif a==c and a>b:
    print(str(b)+" "+str(c)+" "+str(a))
else:
    print(str(a)+" "+str(b)+" "+str(c))


Measured memory_bytes: 5576
<?php

fscanf(STDIN, '%s', $S);

function judge(string $s):bool
{
    return $s === strrev($s);
}

if (judge($S) && judge(substr($S, 0, (strlen($S) - 1) / 2)) && judge(substr($S, (strlen($S) + 3) /2 - 1))) {
    echo "Yes";
} else {
    echo "No";
}

echo PHP_EOL;


Measured memory_bytes: 4604
#include<iostream>
using namespace std;
int main() {
	//a<b<c
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int idex=0;
	while(b<=a) {
		b*=2;
		idex++;
	}
	while(c<=b) {
		c*=2;
		idex++;
	}
	if(idex<=k) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>


typedef long long ll;
#define fi first
#define se second
const ll mod = 1000000007;
//              123456789

using namespace std;

///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N;
int a;
int c[9];
int ans = 0;

int main(){
  
  cin>>N;
  
  int i;
  
  fill( c, c+9, 0 );
  
  for( i = 0; i < N; i++ ){
    scanf("%d", &a);
    if( a < 400 )      {c[0]++;}
    else if( a < 800 ) {c[1]++;}
    else if( a < 1200 ){c[2]++;}
    else if( a < 1600 ){c[3]++;}
    else if( a < 2000 ){c[4]++;}
    else if( a < 2400 ){c[5]++;}
    else if( a < 2800 ){c[6]++;}
    else if( a < 3200 ){c[7]++;}
    else               {c[8]++;}
  }
  
  for( i = 0; i < 8; i++ ){
    if( c[i] ) ans++;
    //cout<<c[i]<<endl;
  }
  
  cout<<max( 1, ans)<<" "<<ans+c[8]<<endl;
  
  return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;
using LL = long long;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(a - x) < abs(b - x))cout << "A" << endl;
	else cout << "B" << endl;
}

Measured memory_bytes: 256
//2011情報オリンピック予選問題4「パスタ」
#include<stdio.h>
//初期化関数
void format(int [][2]);
//組み合わせ関数
void dynamic(int [][2], int [][2], int);

int main(void)
{
	int cnt[3][2], out[3][2], *List, day = 0, N, K, A, B, f1, f2, sum = 0;

	scanf("%d %d",&N,&K);

	List = new int [N];

	//初期化
	for(f1 = 0; f1 < N; f1++)
		List[f1] = -1;
	//予定を埋める
	for(f1 = 1; f1 <= K; f1++){
		scanf("%d %d",&A,&B);
		A--; B--;
		List[A] = B;
	}

	format(cnt);

	//実行
	while(day < N){

		format(out);

		//初日の設定
		if(day == 0){

			if(List[day] >= 0)
				out[List[day]][0] = 1;

			else{
				for(f1 = 0; f1 < 3; f1++)
					out[f1][0] = 1;
			}
		}
		else{
			//食べるソースが決まっている
			if(List[day] >= 0)
				dynamic(out, cnt, List[day]);
			//未定の場合
			else{
				for(f1 = 0; f1 < 3; f1++)
					dynamic(out, cnt, f1);
			}
		}

		for(f1 = 0; f1 < 3; f1++){
			for(f2 = 0; f2 < 2; f2++){
				if(out[f1][f2] >= 10000)
					out[f1][f2] %= 10000;
				cnt[f1][f2] = out[f1][f2];
			}
		}
		day++;
	}

	for(f1 = 0; f1 < 3; f1++){
		for(f2 = 0; f2 < 2; f2++){
			sum += out[f1][f2];
		}
	}

	if(sum >= 10000)
		sum %= 10000;

	printf("%d\n",sum);

	return 0;
}
void format(int v[][2])
{
	int f1, f2;

	for(f1 = 0; f1 < 3; f1++){
		for(f2 = 0; f2 < 2; f2++){
			v[f1][f2] = 0;
		}
	}

}
void dynamic(int out[][2], int cnt[][2], int sn)
{
	int f1, f2;

	for(f1 = 0; f1 < 3; f1++){
		for(f2 = 0; f2 < 2; f2++){
			if(sn != f1)
				out[sn][0] += cnt[f1][f2];
		}
	}
	out[sn][1] = cnt[sn][0];
}

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

using namespace std;

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

vector<pair<long long, long long>> factor(long long n) {
  vector<pair<long long, long long>> res;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      long long ex = 0;
      while (n % i == 0) {
        ex++;
        n /= i;
      }
      res.push_back({i, ex});
    }
  }
  if (n != 1) res.push_back({n, 1});
  return res;
}

long long power(long long a, long long r) {
  long long res = 1;
  while (r > 0) {
    if (r & 1) res *= a;
    a *= a;
    r >>= 1;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, p;
  cin >> n >> p;
  auto f = factor(p);
  long long ans = 1;
  for (auto&& [m, ex] : f) {
    ans *= power(m, ex / n);
    debug(ans);
  }
  debug(f);
  cout << ans;
  return 0;
}

Measured memory_bytes: 3604
a,b = [int(x) for x in input().split()]
for i in range(999):
    j = i+1
    h1 = int(((i*(i+1))/2))-a
    h2 = int(((j*(j+1))/2))-b
    if h1 == h2:
        print(h1)
        break

Measured memory_bytes: 3060
#include <stdio.h>
 
int main(void)
{
    int n;
     
    scanf("%d",&n);
     
    int a[100],i,j;
     
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(j=0;j<n;j++){
        if(!(j==0))printf(" ");
        printf("%d",a[n-1-j]);
    }
     
    printf("\n");
     
    return 0;
}


Measured memory_bytes: 2032
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int K, X;
    cin >> K >> X;
    for(int i = X - K + 1; i <= X + K - 1; i++){
        cout << i;
        if(i != X + K - 1){
            cout << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import math
import collections
import sys

#input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

s=input()
ans=0
for i in range(4):
    if s[i]=="+":
        ans+=1
    else:
        ans-=1
print(ans)

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = String.valueOf(sc.nextInt());
        String res = "";
        for (int i = 0; i < 3; i++) {
            if (s.charAt(i) == '1') {
                res += "9";
            } else {
                res += "1";
            }
        }
        System.out.println(Integer.parseInt(res));
        sc.close();
    }
}

Measured memory_bytes: 21716
#include<stdio.h>
#include<math.h>

int main(void){
    int a,b,C;
    double h,S,L,rad;

    scanf("%d%d%d",&a,&b,&C);
    rad=(double)C*M_PI/180;
    h=(double)b*sin(rad);
    S=(double)a*h/2;
    L=(double)a+b+sqrt(a*a+b*b-2*a*b*cos(rad));

    printf("%.8f\n%.8f\n%.8f\n",S,L,h);
    return 0;
}


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

int main(void) {
	int a, b;
	char op;
	cin >> a >> op >> b;
	if (op == '+') {
		cout << a + b << endl;
	}
	else {
		cout << a - b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define ARRAY_LENGTH (100010)

// Infinity value
const long long INF = 1LL << 60;

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

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

int main(void)
{
  int N;
  long long A[ARRAY_LENGTH][3];
  long long dp[ARRAY_LENGTH][3];

  std::cin >> N;

  // Input costs
  for(int i = 0;i < N;i++){
    std::cin >> A[i][0] >> A[i][1] >> A[i][2];
  }

  // Initialize DP
  for(int i = 0;i < ARRAY_LENGTH;i++){
    dp[i][0] = -INF;
    dp[i][1] = -INF;
    dp[i][2] = -INF;
  }

  // Initial condition
  dp[0][0] = A[0][0];
  dp[0][1] = A[0][1];
  dp[0][2] = A[0][2];

  // Loop
  for(int i = 1;i < N;i++){
    for(int j = 0;j < 3;j++){
      for(int k = 0;k < 3;k++){
        if(j != k){
          chmax(dp[i][j], dp[i-1][k] + A[i][j]);
        }
      }
    }
  }

  long long max = 0;
  chmax(max, dp[N-1][0]);
  chmax(max, dp[N-1][1]);
  chmax(max, dp[N-1][2]);

  std::cout << max << std::endl;

  return 0;
}


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

int main(void) {
  ll A, B;
  cin >> A >> B;

  if(A == 1 && B == 1) {
    cout << 1 << " " << 2 << endl;
    cout << ".#" << endl;
    return 0;
  }

  bool rev = false;
  if(A > B) {
    swap(A, B);
    rev = true;
  }

  const ll H = 100, W = 100;
  char S[H][W];
  REP(i, 0, H) REP(j, 0, W) S[i][j] = '#';

  ll w = 0, b = 1;
  ll y = 0, x = 1;
  while(w + 1 < A) {
    S[y][x] = '.';
    w++;
    if(y > 0) b++;
    if(x == 0) {
      x = y + 2;
      y = 0;
    } else {
      y += 1;
      x -= 1;
    }
  }
  ll py = 99, px = 99;
  while(b < B) {
    S[py - 1][px - 1] = '.';
    S[py - 1][px] = '.';
    S[py][px - 1] = '.';
    b++;
    py -= 2;
    if(py < 0) {
      py = 99;
      px -= 2;
    }
  }

  if(rev) {
    REP(i, 0, H) REP(j, 0, W) {
      if(S[i][j] == '.') S[i][j] = '#';
      else if(S[i][j] == '#') S[i][j] = '.';
    }
  }

  // cerr << w << " " << b << endl;
  cout << H << " " << W << endl;
  REP(i, 0, H) {
    REP(j, 0, W) cout << S[i][j];
    cout << endl;
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int ndata = Integer.parseInt(br.readLine());
		List<String> results = new ArrayList<String>();
		
		while (ndata > 0) {
			String line = br.readLine();
			StringTokenizer st = new StringTokenizer(line);

			int a = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());
			int c = Integer.parseInt(st.nextToken());
			
			if (a*a + b*b == c*c || b*b + c*c == a*a || a*a + c*c == b*b) {
				results.add("YES");
			} else {
				results.add("NO");
			}
			
			ndata--;
		}
		
		for (String r : results) {
			System.out.println(r);
		}
	}
}

Measured memory_bytes: 18456
#include <iostream>

int main(int argc, char* argv[]) {
	int n;
	int t;
	
	std::cin >> n >> t;
	
	int c;
	int s_t;
	int choice_c = 0;
	
	for (int i = 0; i < n; i++) {
		std::cin >> c >> s_t;
		if (s_t <= t) {
			if (choice_c == 0) {
				choice_c = c;
			}
			else if (choice_c > c) {
				choice_c = c;
			}
		}
	}
	
	if (choice_c != 0) {
		std::cout << choice_c << std::endl;
	}
	else {
		std::cout << "TLE" << std::endl;
	}
	

	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
cards = {}
for i in range(n):
  card = input()
  cards[card] = 1
 
for c in ['S', 'H', 'C', 'D']:
  for n in range(1,14):
    key = c + ' ' + str(n)
    if not key in cards:
      print(key)


Measured memory_bytes: 5596
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	if (n == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int a, b; cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll=long long;  
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
struct union_find{
	vector<int> par, sizes;
	union_find(int n): par(n), sizes(n, 1) {
		for (int i = 0; i < n; ++i) {
			par[i] = i;
		}
	}
	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	void unite(int x,int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
 
		if (sizes[x] > sizes[y]) std::swap(x, y);
		par[x] = y;
		sizes[y] += sizes[x];
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return sizes[find(x)];
	}
};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,m;
	cin >> n >> m;
	vector<int> p(n),x(m),y(m);
	union_find uf(n);
	for(int i=0;i<n;++i){
		cin >> p[i];
		--p[i];
	}
	for(int i=0;i<m;++i){
		cin >> x[i] >> y[i];
		--x[i];
		--y[i];
	}
	for(int i=0;i<m;++i){
		uf.unite(x[i],y[i]);
	}
	int ans=0;
	for(int i=0;i<n;++i){
		if(uf.same(i,p[i]))ans++;
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2176
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;

ll N,cnt;
map<ll,ll> a;
vint A;

int main() {
	cin >> N;
	FOR(i, 0, N) {
		ll b; cin >> b;
		A.push_back(b);
	}
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());

	ll mae = 0,ans1=0,ans2=0;
	FOR(i, 0, A.size()) {
		if (mae == A[i]) {
			if (ans1 == 0)ans1 = A[i];
			else { ans2 = A[i]; break; }
			mae = 0;
		}
		else mae = A[i];
	}
	cout << ans1 * ans2 << endl;


	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
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; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

ll p[110];
int main(){
    ll x,n,t;
    cin>>x>>n;
    rep(i,0,n){cin>>t;p[t]++;}
    ll ans=0,m=x;
    rep(i,0,102){
        if(!p[i]&&m>labs(x-i)){m=labs(x-i);ans=i;}
    }
    cout<<ans;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i,a,b) for(int i=(a);i<=(b);++i)
#define FD(i,b,a) for(int i=(b);i>=(a);--i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;
LL inv(LL x, LL m) { return x > m ? inv(x % m, m) : x > 1 ? inv(m % x, m) * (m - m / x) % m : x; }
LL mpow(LL a, LL k, LL m) { LL r(1); for (a %= m; k; k >>= 1, a = a * a % m) if (k & 1)r = r * a % m; return r; }

int main() {
    int n;
    string a, b, c;
    cin >> n >> a >> b >> c;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == b[i] && b[i] == c[i]) continue;
        else if (a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) ans++;
        else ans += 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def fib(n):
    nums = []
    for i in range(n+1):
        if i <= 1:
            nums.append(1)
        else:
            nums.append(nums[i-1]+nums[i-2])
    return nums[n]


def main():
    n = int(input())
    print(fib(n))


if __name__ == "__main__":
    main()



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

using namespace std;

typedef long long int ll;


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

int main(){
    int N;
    cin >> N;
    ll T, ans = 1LL;
    for (int i = 0; i < N;i++){
        cin >> T;
        ans = lcm(ans, T);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n;
  cin>>n;
  long long int x=1000000000000000000,ans=1;
  long long int a[1000000];
  for(int i=0;i<n;i++) {
      cin>>a[i];
      if(a[i]==0){cout<<"0"; return 0;}
  }      
  for(int i=0;i<n;i++){
    if(x<a[i]){ cout<<"-1"; return 0;}
    else {
      ans*=a[i];
      x/=a[i];
    }
  }
  cout<<ans;
}


Measured memory_bytes: 4404
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}
		int k = Integer.parseInt(sc.next());

		String ans = "Yay!";
		if (a[4] - a[0] > k)
			ans = ":(";
		System.out.println(ans);

	}

}


Measured memory_bytes: 20820
#include <stdio.h>
int main(void)
{
  int n,m,i,p,ans;
  while(1){
  scanf("%d %d",&n,&m);
  if(!(n+m)) break;
  int masu[n+1];
  int me[m+1];
  for(i=1;i<=n;i++)
    scanf("%d",&masu[i]);
  for(i=1;i<=m;i++)
    scanf("%d",&me[i]);
  p=1;
  for(i=1;i<=m;i++){
    p+=me[i];
    p+=masu[p];
    if(p>=n){
      ans=i;
      break;
    }
  }
  printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 608
def main():
    n = int(input())
    csf = [tuple(map(int, input().split())) for _ in range(n - 1)]
    r = [0] * n
    for i1 in range(n - 1):
        t = 0
        for i2 in range(i1, n - 1):
            if t <= csf[i2][1]:
                t = csf[i2][1]
            else:
                if t % csf[i2][2] != 0:
                    t = ((t // csf[i2][2]) + 1) * csf[i2][2]
            t += csf[i2][0]
        r[i1] = t

    p2d = lambda x: print(*x, sep="\n")
    p2d(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#include <algorithm>
#include <complex>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(7)<<(x)
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace  std;

using ll = long long;
const ll mod = 1e9 + 7;
typedef pair<int , int > pairs;
typedef complex<ll> G;
const int N=2e5+5;

const ll INF = 1e18;

void done() {
    string a, b;
    cin >> a;
    int n = a.size();
    string ans(n, 'x');
    cout << ans;

}
void solve() {

    int n;
    cin >>n;
    vector<int>a(n);
    vector<int>b(n);
    vector<long double>c;
    for(int i=0;i < n;i++) {
        cin >> a[i];
    }
    int r = 0;
    for(int i=0;i < n;i++) {
        cin >> b[i];
        if(a[i]!=0) {
            c.push_back(b[i]/a[i]*1.0);
        }else if(b[i]=='0') {
            r++;
            c.push_back(-999999999);
        }
        else {
            c.push_back(-999999999);
        }
    }
    int sum = 1;
    int best = 0;
    sort(c.begin(), c.end());
    for(int i=1;i < n;i++) {
        if(c[i]==c[i-1] && c[i-1]!=-999999999) {
                sum++;
        }
        else {
            if(sum > best && c[i-1]!=-999999999) {
                best = sum;
                sum = 1;
            }
        }
    }
    if(sum > best && c[n-1]!=-999999999) {
        best = sum;
    }
    cout << best+r << '\n';
}
void another() {
    int n;cin >> n;

    string s;
    cin >> s;
    int left= 0, right = 0;
    int d = (s[0]=='<') ?1 : 0;
    int c = (s[n-1]=='>')?1 : 0;

    for(int i=0;i < n;i++) {
        if(i!=0 && s[i]=='<')left++;
        else if(i!=n-1 && s[i]=='>')right++;
    }
    if(left <= right) {
        swap(left, right);
        swap(d, c);
    }
    if(d) {
        cout << max(1, right-1) << '\n';
    }
    else cout << max(0, right-1) << '\n';



}
void test_case() {
    int t;
    cin >> t;
    while(t--)solve();
}
int main() {

    fast;
    done();

}



Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> data(4);
  int i,right,left;
  for(i=0;i<=3;i++){
    cin>>data.at(i);
  }

  left=data.at(0)+data.at(1);
  right=data.at(2)+data.at(3);

  if(right>left){
    cout<<"Right"<<endl;
  }else if(right<left){
    cout<<"Left"<<endl;
  }else if(right==left){
    cout<<"Balanced"<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
import math

A, B, H, M = list(map(int, input().split()))

x = A*math.cos(M/60* 2* math.pi) - B*math.cos( (H*60 + M)/720* 2*math.pi)
y = A*math.sin(M/60* 2* math.pi) - B*math.sin( (H*60 + M)/720* 2*math.pi)

print((x**2 + y ** 2)**0.5)

Measured memory_bytes: 9520
#include <iostream>
#include <vector>

using namespace std;

int N;
vector<int> G[100000];
bool used[100000];
bool second = true;

int dfs(int v){
    int ret = 0;
    int cnt = 0;
    used[v] = true;
    for(int i = 0; i < G[v].size(); i++){
        if(!used[G[v][i]]){
            cnt++;
            ret += dfs(G[v][i]);
        }
    }
    //cout << v << ' ' << cnt << endl;
    if(ret == 0) return 1;
    if(ret >= 2) {
        //cout << v << endl;
        second = false;
        return 0;
    }
    return 0;
}

int main(){
    cin >> N;
    for(int i = 0; i < N-1; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    if(N%2 == 1){
        cout << "First" << endl;
        return 0;
    }
    dfs(0);
    if(second){
        cout << "Second" << endl;
    }else{
        cout << "First" << endl;
    }
}

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

int main(){
 int sx,sy,tx,ty;
 cin>>sx>>sy>>tx>>ty;
 int sax,say;
 sax=tx-sx;
 say=ty-sy;

 for(int i=0;i<say;i++){
        cout<<"U";
}
 for(int i=0;i<sax;i++){
        cout<<"R";
}

 for(int i=0;i<say;i++){
        cout<<"D";
}
 for(int i=0;i<sax;i++){
        cout<<"L";
}

 cout<<"L";
 for(int i=0;i<say+1;i++){
        cout<<"U";
}
 for(int i=0;i<sax+1;i++){
        cout<<"R";
}
cout<<"D";
cout<<"R";
for(int i=0;i<say+1;i++){
        cout<<"D";
}
for(int i=0;i<sax+1;i++){
        cout<<"L";
}
cout<<"U"<<endl;

return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n;cin >> n;
	vector<ll> rist;
	int isprime[60000];
	rep(i,60000)isprime[i]=1;
	isprime[0]=0;isprime[1]=0;
	for(int i=2;i<=60000;i++)
	{
		for(int j = i+i;j<60000;j+=i)isprime[j]=0;
	}

	rep(i,60000)if(isprime[i]&&i%5==2)rist.push_back(i);
	rep(i,n)cout<<rist[i]<<endl;
	return 0;
}

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

using int64 = long long;

int main() {
  int64 n;
  cin >> n;
  vector<int64> a(n);
  for (int64 i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<int64> length;
  for (int64 i = a.size() - 2; i >= 0; --i) {
    if (a[i] != a[i + 1])
      continue;
    length.push_back(a[i]);
    if (length.size() == 2)
      break;
    --i;
  }

  length.resize(2, 0);
  cout << length[0] * length[1] << "\n";

  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[200000];
signed main(){
	int n;scanf("%d",&n);
	rep(i,n)scanf("%d",&a[i]);
	ll ans=0;
	{
		multiset<int>se;
		rep(i,n)se.insert(a[i]);
		deque<int>que;
		que.push_back(*se.begin());se.erase(se.begin());
		int i=1;
		while(!se.empty()){
			if(se.size()==1){
				if(abs(que.front()-*se.begin())>abs(que.back()-*se.begin())){
					ans+=abs(que.front()-*se.begin());
					que.push_front(*se.begin());
					se.erase(se.begin());
				}
				else{
					ans+=abs(que.back()-*se.begin());
					que.push_back(*se.begin());
					se.erase(se.begin());
				}
			}
			else{
				if(i%2==0){
					ans+=abs(que.front()-*se.begin());
					que.push_front(*se.begin());
					se.erase(se.begin());
					ans+=abs(que.back()-*se.begin());
					que.push_back(*se.begin());
					se.erase(se.begin());
				}
				else{
					ans+=abs(que.front()-*se.rbegin());
					que.push_front(*se.rbegin());
					se.erase(--se.end());
					ans+=abs(que.back()-*se.rbegin());
					que.push_back(*se.rbegin());
					se.erase(--se.end());
				}
			}
			i++;
		}
	}

	ll ans2=0;
	{
		multiset<int>se;
		rep(i,n)se.insert(a[i]);
		deque<int>que;
		que.push_back(*se.rbegin());se.erase(--se.end());
		int i=1;
		while(!se.empty()){
			if(se.size()==1){
				if(abs(que.front()-*se.begin())>abs(que.back()-*se.begin())){
					ans2+=abs(que.front()-*se.begin());
					que.push_front(*se.begin());
					se.erase(se.begin());
				}
				else{
					ans2+=abs(que.back()-*se.begin());
					que.push_back(*se.begin());
					se.erase(se.begin());
				}
			}
			else{
				if(i%2==1){
					ans2+=abs(que.front()-*se.begin());
					que.push_front(*se.begin());
					se.erase(se.begin());
					ans2+=abs(que.back()-*se.begin());
					que.push_back(*se.begin());
					se.erase(se.begin());
				}
				else{
					ans2+=abs(que.front()-*se.rbegin());
					que.push_front(*se.rbegin());
					se.erase(--se.end());
					ans2+=abs(que.back()-*se.rbegin());
					que.push_back(*se.rbegin());
					se.erase(--se.end());
				}
			}
			i++;
		}
	}
	cout<<max(ans,ans2)<<endl;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a) memset(a,0,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vi;
int main()
{
    ll n;
    cin>>n;
    string str;
    ll res=0;
    cin>>str;
    ll r=0,b=0,g=0;
    rep(i,0,n)
    {
        if(str[i]=='R')
            r++;
        else if(str[i]=='G')
            g++;
        else
            b++;
    }
    res=r*g*b;
    rep(i,0,n)
    {
        rep(j,i+1,n)
        {
            if(str[i]==str[j])
                continue;
            int k=j+j-i;
            if(k>=n)
                continue;
            if(str[i]!=str[j] && str[j]!=str[k] && str[i]!=str[k])
                res--;
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3628