akhauriyash/Code-Regression huggingface dataset:
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
int main(){
    long long w, h, n, i, x[1010], y[1010], a[1010], lef, rig, up, down, ans, high, width;
    cin >> w >> h >> n;
    lef=0;rig=w;up=h;down=0;
    for(i=0;i<n;i++){
        cin >> x[i] >> y[i] >> a[i];
    }

    for(i=0;i<n;i++){
        if(a[i]==1 && x[i]>lef) lef=x[i];
        if(a[i]==2 && x[i]<rig) rig=x[i];
        if(a[i]==3 && y[i]>down) down=y[i];
        if(a[i]==4 && y[i]<up) up=y[i]; 
    }
    
    width=rig-lef;
    high=up-down;
    ans=high*width;
    if(width<=0 || high<=0) ans=0;
    cout << ans <<endl;
    return 0; 
}

Measured memory_bytes: 3624
// Problem : C - Vacation
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define mod 1000000007
#define inf 1e18
#define setbits(x) __builtin_popcount(x)
#define zrbits(x) __builtin_ctzll(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define fi(i,n) for(int i = 0;i < n;i++)
#define fd(i,n) for(int i = n;i >= 0;i--)
int dif(int a,int b){if(a > b)return a - b;else return b - a;}
int gcd(int a, int b){if(b == 0)return a;return gcd(b, a%b);}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    int n;
    cin>>n;
    int arr[n][3];
    fi(i,n)
    {
    	fi(j,3)cin>>arr[i][j];
    }
    int ans[n][3];
    ans[0][0] = arr[0][0],ans[0][1] = arr[0][1],ans[0][2] = arr[0][2];
    for(int i = 1;i < n;i++)
    {
    	ans[i][0] =  max(ans[i - 1][2],ans[i - 1][1]) + arr[i][0];
    	ans[i][1] =  max(ans[i - 1][2],ans[i - 1][0]) + arr[i][1];
    	ans[i][2] =  max(ans[i - 1][0],ans[i - 1][1]) + arr[i][2];
    }
    cout<<max(ans[n - 1][0],max(ans[n - 1][1],ans[n - 1][2]));
	return 0;
}


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

int main() {
	long long a, b, n = 0;
	char op;
	long long cal[20010];

	while (1) {
		cin >> a >> op >> b;
		if (op == '?') break;
		else if (op == '+') cal[n] = a + b;
		else if (op == '-') cal[n] = a - b;
		else if (op == '*') cal[n] = a * b;
		else if (op == '/') cal[n] = a / b;
		++n;
	}

	for (int i = 0; i < n; ++i) cout << cal[i] << endl;
}


Measured memory_bytes: 3088
import java.util.Scanner;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] d = new int[K];
        int[][] A = new int[K][101];
        Set<Integer> a = new HashSet<Integer>();

        for (int i = 0; i < K; i++) {
            d[i] = sc.nextInt();
            for (int j = 0; j < d[i]; j++) {
                // A[i][j] = sc.nextInt();
                a.add(sc.nextInt());
            }
        }
        System.out.println(N - a.size());
        sc.close();
    }
}


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

int main(void) {
    int a, b, c, k;
    cin >> a >> b >> c;
    cin >> k;
    for (int i = 1 ; i <= k ; i++) {
        if (b >= c) c *= 2;
        else if (a >= b) b *= 2;
        if (a < b && b < c) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

struct node{
    int d, flag;
    node(){
        d = 0;
        flag = 0;
    }
};

int main(void){
    int n;
    int ind, num, a;
    int time, ndi;

    std::cin >> n;
    std::vector<node> nd(n);
    std::vector<std::vector<int>> b(n, std::vector<int>(n));
    std::queue<int> st;

    for(int i = 0; i < n; i++){
        std::cin >> ind >> num;
        ind--;
        for(int i = 0; i < num; i++){
            std::cin >> a;
            a--;
            b[ind][a] = 1;
        }
    }

    time = 0;
    int x = 0;
    //for(int x = 0; x < n; x++){
        if(nd[x].flag == 0){
            ndi = x;
            time++;
            nd[x].flag = 1;
        
            st.push(x);
        }
    
        

        while(st.empty() != 1){
            //std::cout << ndi+1 << " " << time << std::endl;
            //time++;
            int tmp = -1;
            int tmp2;
            for(int i = 0; i < n; i++){
                if(b[ndi][i] == 1 && nd[i].flag == 0){
                    tmp = i;
                    tmp2 = x;
                    break;
                }
            }
            if(tmp == -1){
                //std::cout << ndi+1 << " " << time << std::endl;

                nd[ndi].flag = 1;
                st.pop();
                if(st.empty() != 1){
                    ndi = st.front();
                }

                continue;
            }

            nd[tmp].flag = 1;
            nd[tmp].d = nd[ndi].d + 1;
            st.push(tmp);
            
        }
    //}
    for(int i = 0; i < n; i++){
        if(nd[i].flag == 0 && i != 0){
            nd[i].d = -1;
        }
    }
    for(int i = 0; i < n; i++){
        std::cout << i+1 << " " << nd[i].d << std::endl;
    }

    return 0;
}


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

int main() {
	int n,c;
	double h,pm,pe,pj;
	while(cin >> n && n!=0) {
	for (;n>0;n--) {
		c=2;
		cin >> pm >> pe >> pj;
		h=(pm+pe+pj)/3;
		if ((h>=50 && (pm>=80 || pe>=80)) || h>=70) c=1;
		if (h>=80 || ((pm+pe)/2>=90) || pm==100 || pe==100 || pj==100) c=0;
		cout << (char)('A'+c) << endl;
	}
}
	return 0;
}

Measured memory_bytes: 1220
//8-C
import java.util.Scanner;

class Main {
    public static void main(String [] args){
    	
    	Scanner sc = new Scanner(System.in);
    	
    	int[] count = new int[26];
    	
    	while(sc.hasNext()){
    		
    		 String moji = sc.next();
    	
	    	 for(int i = 0; i < moji.length(); ++i){
	    		 
	             if(Character.isLowerCase(moji.charAt(i))){
	                 
	            	 int num = moji.charAt(i) - 'a';
	            	 count[num]++;
	            	 
	             }else if(Character.isUpperCase(moji.charAt(i))){
	            	 
	            	 int num = moji.charAt(i) - 'A';
	            	 count[num]++;
	            	 
	             }
	         }
    	}
            
    	 for(int i = 0 ; i < count.length ; i++ ){
    		 
    		 //0-25 a-z が対応しているの。0=a 1=b 2=c
    		 //('a' + i)この部分が書き方
    		 //'a'は小文字のアルファベットに対応
    		 //もし'A'なら大文字のアルファベットがでてくる。
    		 char alpha = (char)('a' + i);
    		 
    		 System.out.println(alpha + " " + ":" + " " + count[i]);
    		
    	 }
    	
            

    }

	
}

Measured memory_bytes: 26272
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
using ll = long long;

#define INF 1000000007
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int)(x).size())
#define MSG(a) cout << #a << " " << a << endl;

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    vector<int> perm;
    int tmp;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }

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

    for (int i = 1; i <= n; i++) {
        perm.push_back(i);
    }

    int cnt = 0;
    int p_cnt = 0;
    int q_cnt = 0;
    do {
        cnt++;
        if (p == perm) p_cnt = cnt;
        if (q == perm) q_cnt = cnt;
    } while (next_permutation(ALL(perm)));
    cout << max(p_cnt, q_cnt) - min (p_cnt, q_cnt) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll N,M,b,c,tp;
int main(){
    cin >> N >> M;
    map<int,ll> res;
    rep(i,N) cin >> tp, res[tp]++;
    rep(i,M){
        cin >> b >> c;
        res[c] += b;
    }
    ll ct = 0, ans = 0;
    
    for(auto itr = res.rbegin(); itr != res.rend(); ++itr) {
        ll num = itr->first, cnt = itr->second; 
        ll k;
        if(cnt + ct <= N) k = cnt; 
        else k = N - ct;
        
        ans += num*k;
        ct  += k;
        
        if(ct == N) break;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll a,b,c,k;cin>>a>>b>>c>>k;
    while(a>=b){
        b*=2;k--;
    }
    while(b>=c){
        c*=2;k--;
    }
    YesNo(k>=0);
}

Measured memory_bytes: 3592
N, M = map(int, input().split())
box = [1] * N
red = [False] * N
red[0] = True

for i in range(M):
    x, y = map(int, input().split())
    if red[x-1] == True:
        red[y-1] = True
        box[x-1] -= 1
        box[y-1] += 1
    else:
        box[x-1] -= 1
        box[y-1] += 1
    if box[x-1] == 0:
        red[x-1] = False

ans = red.count(True)
print(ans)

Measured memory_bytes: 4596
#include<iostream>
#include<complex>
#include<cmath>
using namespace std;
typedef complex<double> xy_t;

xy_t P[4];

double cross(xy_t p,xy_t q){
    return (conj(p)*q).imag();
}

int main(){
    int n;
    double eps=pow(10,-11);
    cin>>n;
    for(int i=0;i<n;++i){
        for(int j=0;j<4;++j){
            double x,y;
            cin>>x>>y;
            P[j]=xy_t(x,y);
        }
        
        xy_t a[2]={
            P[0]-P[1],
            P[2]-P[3]
        };

        bool flag=(abs(cross(a[0],a[1]))<eps);

        cout<<(flag?"YES":"NO")<<"\n";

    }
}

Measured memory_bytes: 3020
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x=max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<P>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
#define dame {puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
//----------------------------------------------------------------
void Main(){
  int n;
  ll x;
  cin>>n>>x;
  vl a(n);
  cin>>a;
  ll ans = 0;
  rep(i,n-1){
    if(x<(a[i]+a[i+1])){
      ll d = (a[i]+a[i+1])-x;
      ans += d;
    if(a[i+1] < d){
      a[i] -= d - a[i+1];
      a[i+1] = 0;
    }else a[i+1]-=d;
    }
  }
  cout<<ans<<endl;
} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

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

int main() {
	
	int Q;
	cin >> Q;
	
	for(int i = 0; i < Q; i++){
		
		long long int A, B;
		cin >> A >> B;
		if(A > B){
			swap(A, B);
		}
		if(B - A == 0 || B - A == 1){
			cout << (A - 1) * 2 << endl;
			continue;
		}
		long long int qq = sqrt(A * B);
		if(qq * qq == A * B){
			qq--;
		}
		long long int ans = qq * 2 - 1;
		if(qq * (qq + 1) >= A * B){
			ans--;
		}
		cout << ans << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define readint ({int t;cin >> t;t;})
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;

void _mod(ll &x) { x = mod(x, MOD); }

//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll
bool isPerfectSquare(long double x) {

    long double sr = sqrt(x);
    return ((sr - floor(sr)) == 0);
}

int Dis[11][11];

class BGoodDistance {
public:

    void solve(std::istream &cin, std::ostream &cout) {
        int N, D;
        cin >> N >> D;
        Fill(Dis, 0);
        _for(i, N)_for(d, D)cin >> Dis[i][d];
        int count = 0;
        rep(i, 0, N)rep(j, i + 1, N) {
                int sum = 0;
                _for(d, D)sum += (Dis[i][d] - Dis[j][d]) * (Dis[i][d] - Dis[j][d]);
                count += isPerfectSquare(sum);
            }
        cout << count << endl;
    }




};


#undef int
int main() {
	BGoodDistance solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N,L;
  cin>>N>>L;
  
  vector<string> S(N);
  for(int i=0;i<N;i++){
    cin>>S[i];
  }
  
  
  sort(S.begin(),S.end());
  
  for(int i=0;i<N;i++){
    cout<<S[i];
  }
}


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

bool isPrime(int n) {
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;

    double sqrtN = sqrt(n);
    for (int i = 3; i <= sqrtN; i += 2) {
        if (n % i == 0)
            return false;
    }
    return true;
}

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

    int x; cin >> x;

    bool ok = false;
    int ans = 0;
    while (!ok) {
        ok = isPrime(x);
        if (ok) ans = x;
        x++;
    }

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


Measured memory_bytes: 256
#include<stdio.h>
#define ck 26

int d;
int c[32];
int s[512][32];
int res[512];

int eval(int brk){
  int i,j,lc[32],r=0;
  for(i=1;i<=ck;i++){lc[i]=-1;}
  for(i=0;i<d;i++){
    r+=s[i][res[i]];
    lc[res[i]]=i;
    for(j=1;j<=ck;j++){
      r-=c[j]*(i-lc[j]);
    }
    if(i==brk){break;}
  }
  return r;
}

int main(){
  int i,j;
  scanf("%d",&d);
  for(i=1;i<=ck;i++){scanf("%d",&c[i]);}
  for(i=0;i<d;i++){
    for(j=1;j<=ck;j++){
      scanf("%d",&s[i][j]);
    }
  }
  for(i=0;i<d;i++){
    scanf("%d",&res[i]);
    printf("%d\n",eval(i));
  }
}

Measured memory_bytes: 1760
#include <iostream>

using namespace std;

int main()
{
    int a,b,x;
    cin>>a>>b>>x;
 if(a<x && (a+b)>=x ||a==x){
    cout<<"YES";
}if(a<x && (a+b)<x){
cout<<"NO";
}if(a>x){
cout<<"NO";
}

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] Z = new int[N];
        double A = 0;
        int n = 0;
        int m = 0;
        for(n = 0; n < N; n++) {
            Z[n] = sc.nextInt();
        }

        while(m < N) {
            double i = (double)1/(double)Z[m];
            A = A + i;
            m++;
        }
        System.out.println((double)(1/A));
    }
}

Measured memory_bytes: 23764
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m, sum int
	fmt.Scan(&n, &m)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
		sum += as[i]
	}

	sort.Ints(as)

	var a int
	for i := 0; i < m; i++ {
		a = as[n-1-i]
	}

	if float64(a) < float64(sum)/float64(4*m) {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 512
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
// #pragma warning(disable : 4996)
#include<bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
using ull = unsigned long long;
 
#define int long long
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define len(s) (int)(s).size()
// #define endl '\n'
// #define uint uint32_t
 
inline void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}

void say(string s) {
	cout << s << endl;
	return;
}

 
template<class T> ostream& operator<< (ostream& out, const pair<int, int>&X) {
    out << X.first << ' ' << X.second << endl;
    return out;
}
 
template<class T> ostream& operator<< (ostream& out, const vector<T> &X) {
    for (const auto& it : X)
        out << it << ' ';
    return out;
}
template<class T> ostream& operator<< (ostream& out, const set<T> &X) {
    for (const auto& it : X)
        out << it << ' ';
    return out;
}
template<class T> void dbg(const T &X) {
    cerr << "DEBUG: " << ": ";
    cerr << X << endl;
}
 
const int MOD1 = 1e9 + 7;
const int N = 1e6 + 1;
const int MOD2 = 998244353;
const int inf = 3e18;
const int mx = (1 << 19) - 1;
const int mod = 1e9 + 7;
const ull K = 147;
const int mod2 = mod * mod;


int cnt[N][26];

map<pair<ull, pair<int, int>>, int>mp;

signed main() {
    accell();
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int n;
	cin >> n;
	vector<string>a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(all(a), [&](string &a, string &b) {
		return len(a) < len(b);
	});
	vector<ull>mult(N);
	mult[0] = 1;
	int ans = 0;
	for (int i = 1; i < N; ++i) mult[i] = mult[i - 1] * K;
	for (int i = 0; i < len(a); ++i) {
		reverse(all(a[i]));
		ull hsh = 0;
		for (int j = len(a[i]); j >= 0; --j) {
			for (int k = 0; k <= 25; ++k) {
				cnt[j][k] = 0;
			}
		}
		for (int j = len(a[i]) - 1; j >= 0; --j) {
			for (int k = 0; k <= 25; ++k) {
				cnt[j][k] += cnt[j + 1][k] + ((int)(a[i][j] - 'a') == k);
			}
		}
		for (int j = 0; j + 1 < len(a[i]); ++j) {
			hsh += (ull)(a[i][j] - 'a' + 1) * mult[j];
			for (int k = 0; k < 26; ++k) {
				if (cnt[j + 1][k]) {
					if (mp.count({hsh, {j + 1, k}})) {
						ans += mp[{hsh, {j + 1, k}}];
					}
				}
			}
		}
		for (int j = 0; j < 26; ++j) {
			if (cnt[0][j] && mp.count({0, {0, j}}))
				ans += mp[{0, {0, j}}];
		}
		mp[{hsh, {len(a[i]) - 1, (int)(a[i].back() - 'a')}}]++;
	}
	cout << ans;
    return 0;
}


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

int main(){
  char a, b, c;
  cin >> a >> b >> c;
  
  if(a == '7' && b == '5' && c == '5'){
    cout << "YES" << endl;
  }
  
   else if(a == '5' && b == '7' && c == '5'){
    cout << "YES" << endl;
  }
  
  else if(a == '5' && b == '5' && c == '7'){
    cout << "YES" << endl;
  }
  
  else{
    cout << "NO" << endl;
  }
  
  
}

Measured memory_bytes: 256
hw = list(map(int, input().split()))
s = list()
v = list()

for i in range(hw[0]):
    s.append(input())

for j in range(hw[0]):
    for k in range(hw[1]):
        if(s[j][k] != '#'):
            count = 0
            if(j > 0 and k > 0 and s[j-1][k-1] == '#'):
                count += 1
            if(j > 0 and s[j-1][k] == '#'):
                count += 1
            if(j > 0 and k < hw[1]-1 and s[j-1][k+1] == '#'):
                count += 1
            if(k > 0 and s[j][k-1] == '#'):
                count += 1
            if(k < hw[1]-1 and s[j][k+1] == '#'):
                count += 1
            if(j < hw[0]-1 and k > 0 and s[j+1][k-1] == '#'):
                count += 1
            if(j < hw[0]-1 and s[j+1][k] == '#'):
                count += 1
            if(j < hw[0]-1 and k < hw[1]-1 and s[j+1][k+1] == '#'):
                count += 1

            v.append(count)
            
        else:
            v.append(-1)

for l in range(len(v)):
    if(v[l] == -1):
        print("#", end = "")
    else:
        print(v[l], end = "")
        
    if((l+1) % hw[1] == 0):
        print()
    


Measured memory_bytes: 3572
import sys
#sys.exit()
#sorted( ,reverse=True)

a,b,c,d = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
#print(a,b,c,d)
#cnt = 0
#cnt += 1

print(max(a*c,a*d,b*c,b*d))

#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
#print(cnt)

Measured memory_bytes: 9156
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var abc = ReadSplitInt();
            YesOrNo(abc[0] + abc[1] == abc[2] || abc[0] + abc[2] == abc[1] || abc[1] + abc[2] == abc[0]);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


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

void A()
{
  string S;
  cin >> S;
  
  if( S[2] == S[3] && S[4] == S[5] )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

void B()
{
  int X;
  cin >> X;
  
  int five_hundred = X / 500;
  int five = (X - five_hundred * 500) / 5;
  
  cout << five_hundred * 1000 + five * 5 << endl;
}

int main()
{
  //A();
  B();
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main(void){
    long long int A, B, C, D;
    scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
    long long GCM, r, a=C, b=D;
    while(1) {
        r=a%b;
        if(r==0){
            GCM=b; break;
        }
        a=b;
        b=r;
    }
    //cout << GCM << endl;
    long long DiviByC, DiviByD, DiviByBoth, LCM=C*D/GCM;
    //cout << LCM << endl;
    DiviByC=(long long)B/C - (long long)(A-1)/C;
    DiviByD=(long long)B/D - (long long)(A-1)/D;
    DiviByBoth=(long long)B/LCM - (long long)(A-1)/LCM;
    //cout << DiviByBoth << endl;
    printf("%lld\n", (B-A+1)-DiviByC-DiviByD+DiviByBoth);
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
        using namespace std;
        int main(){
          int n;
          cin>>n;
          int k;
          cin>>k;
          bool arr[k];
         // memset(arr,false,sizeof(arr));
          int temp;
          for(int i=0;i<10;i++)
            arr[i] = false;
          for(int i=0;i<k;i++){
            cin>>temp;
            arr[temp] = true;
          }

          while(true){
            bool flag=true;
            int l = n;

            while(l!=0){
              int rem = l%10;
              if(arr[rem]==true){
                flag = false;
                break;
              }
              l = l/10;
            }
            if(flag == true){
              cout<<n;
              break;
            }
            n++;
          }
        }


Measured memory_bytes: 3548
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DPowerfulDiscountTickets solver = new DPowerfulDiscountTickets();
        solver.solve(1, in, out);
        out.close();
    }

    static class DPowerfulDiscountTickets {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            long[] a = in.readLongArray(n);

            PriorityQueue<Long> prices = new PriorityQueue<>(Comparator.reverseOrder());
            for (long x : a) {
                prices.add(x);
            }

            for (int i = 0; i < m; i++) {
                prices.add(prices.poll() / 2);
            }

            long answer = 0;
            for (long x : prices) {
                answer += x;
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long[] readLongArray(int n) {
            long[] x = new long[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextLong();
            }
            return x;
        }

    }
}



Measured memory_bytes: 45768
#include<stdio.h>
int main(void){
  long int i,j,f,m,s,n,k,a2[31],a10[30];
  scanf("%ld %ld",&n,&k);
  a2[0]=1;
  a10[0]=1;
  for(i=1;i<=30;i++){
    a2[i]=a2[i-1]*k;
    a10[i]=a10[i-1]*10;
  }
  a2[0]=1;
  a10[0]=1;
  /*printf("%ld %ld\n",a2[0],a10[10]);*/
  for(i=0;i<=30;i++){
    if(a2[i]>n){
      /*printf("%ld %ld\n",a2[i],n);*/
      m=i-1;
      break;
    }
  }
  /*printf("%ld\n",m);*/
  s=0;
  for(i=m;i>=0;i--){
    f=0;
    for(j=1;j<=k;j++){
      if(n-a2[i]>=0){
	n=n-a2[i];
	f++;
      }
    }
    s=s+f*a10[i];
  }
  printf("%ld\n",m+1);
  return 0;
}




Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


int col[105][105];

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

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int a,b;
    cin>>a>>b;
        a--;
        b--;
        for(int i=1;i<=50;i++)
            for(int j=1;j<=100;j++)
                    col[i][j]=0;
        for(int i=51;i<=100;i++)
            for(int j=1;j<=100;j++)
                    col[i][j]=1;

        for(int i=1;i<=50&&a;i++)
            for(int j=1;j<=100&&a;j++)
            {
                if(((i+j)&1)&&(i&1))                
                {
                    a--;
                    col[i][j]=1;
                }
            }

        for(int i=100;i>=51&&b;i--)
            for(int j=1;j<=100&&b;j++)
            {
                if(((i+j)&1)&&(i&1))                
                {
                    b--;
                    col[i][j]=0;
                }
            }
    cout<<100<<" "<<100<<'\n';
    for(int i=1;i<=100;i++)
    {
        for(int j=1;j<=100;j++)
        {
            if(col[i][j])
                    cout<<'.';
            else
                    cout<<'#';
        }
        cout<<'\n';
    }
}


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

#define all(a)  (a).begin(),(a).end()

#define mkp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;



int main(){
    bool flag=true;
    int sad=0,sad2=0;
    ll ans=0,sum=0;
    int n,k;
    string s;
    cin >>n>>k>>s;

    if(s[0]=='L')sad2++;
    for (int i = 0; i < n-1; i++){
        if(s[i]=='R' && s[i+1]=='L'){
            sad+=2;
            i++;
        }
    }
    if(s[n-1]=='R')sad2++;

    if(sad/2 >= k){
        ans = n - sad -sad2 + 2*k;
    }else {
        ans = n - 1;
    }



    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

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


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

int ope(int a,char op,int b){
  if(op=='+'){
    return a+b;
  }else{
    return a-b;
  }
}

int main(){
  string S;
  cin>>S;
  int a=S.at(0)-'0',b=S.at(1)-'0',c=S.at(2)-'0',d=S.at(3)-'0';
  bool flag=true;
  char op[2]={'+','-'};
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
        if(ope(ope(ope(a,op[i],b),op[j],c),op[k],d)==7&&flag){
          flag=false;
          cout<<a<<op[i]<<b<<op[j]<<c<<op[k]<<d<<"=7"<<endl;
        }
      }
    }
  }
}


Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
//	long i, r;
//	if (a % 2 == 0) {
//		pf[pc] = 2; pc++;
//		return(_pfact(a / 2));
//	}
//	r = sqrt(a);
//	for (i = 3; i <= r; i += 2) {
//		if (a % i == 0) {
//			pf[pc] = i; pc++;
//			return(_pfact(a / i));
//		}
//	}
//	if (a != 1) {
//		pf[pc] = a; pc++;
//	}
//	return 0;
//
//}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
	int bit;

	for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
		if (0 != (uc & 1))++bit;

	return bit;
}//bitco

#define _rnd(a,b)    ((a+b-1)/b) //　A/Bの余りを繰り上げる
#define _abs(x) ((x)<0 ? -(x) : (x))
#define _MAX 100000
#pragma endregion

// ABC113 B -  
int main(void) {
	int i,l;
	char c[100001];

	scanf("%s", c);
	l = strlen(c);

	for (i = 0; i < l; i+=2) 
		 printf("%c", c[i]);

	
	return 0;
}

Measured memory_bytes: 1668
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}
	var count int
	for {
		for i, a := range as {
			if a%2 != 0 {
				fmt.Println(count)
				return
			}
			as[i] = a / 2
		}
		count++
	}
}


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

int main(){
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll ans = 0;
    ll ac = a * c;
    ll bd = b * d;
    ll ad = a * d;
    ll bc = b * c;
    ans = max(max(ac, bd), max(ad, bc));

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
import heapq
from collections import defaultdict

# 3種類のケーキを美味しい順にソートする
x, y, z, k = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)


# heapqで管理
que = []
heapq.heapify(que)
# 最も美味しい組み合わせは、
heapq.heappush(que, ((A[0] + B[0] + C[0])*-1, (0, 0, 0)))

# 使用した組み合わせ
used = defaultdict(int)
used[(0, 0, 0)] = 1

ans = []
while len(ans) < k:
    total, comb = heapq.heappop(que)
    ans.append(total*-1)
    a, b, c = comb
    # その次に美味しい組み合わせは、以下のいずれか
    for p, q, r in [[a+1, b, c], [a, b+1, c], [a, b, c+1]]:
        if used[(p, q, r)] == 0 and p < x and q < y and r < z:
            heapq.heappush(que, ((A[p] + B[q] + C[r])*-1, (p, q, r)))
            used[(p, q, r)] = 1

for i in range(k):
    print(ans[i])

Measured memory_bytes: 5384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using Vi = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    string s;
    cin>>s;
    int n=s.size();
    vector<int> a(n,1);
    for(int i=0;i<n-1;i++){
        if(s[i]=='R'&&s[i+1]=='R'){
            a[i+1]=a[i]+1;
            a[i]=0;
        }
    }
    /*
    rep(i,n){
        cout<<a[i]<<" ";
    }
    */
    // cout<<endl;
    for(int i=n-1;i>=1;i--){
        if(s[i]=='L'&&s[i-1]=='L'){
            a[i-1]=a[i]+1;
            a[i]=0;
        }
    }
    
    rep(i,n-1){
        if(a[i]!=0&&a[i+1]!=0){
            if((a[i]+a[i+1])%2==0){
                int memo=a[i];
                a[i]=(a[i]+a[i+1])/2;
                a[i+1]=(memo+a[i+1])/2;
            }
            else{
                int memo=a[i];
                a[i]=(a[i]+a[i+1])/2+a[i]%2;
                a[i+1]=(memo+a[i+1])/2+a[i+1]%2;
            }
            i++;
        }
    }
    rep(i,n){
        cout<<a[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 1488
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Nmax 100008
ll n,m,x,y ,k,e,t,r,a,b,nb,q,c,test;
ll tab[Nmax], bi[Nmax]  ;
long double h,l;
string s , s1 ;

int main()
{
    string tt [3] = {"Sunny", "Cloudy","Rainy"} ;
    cin>> s ;
    for(int i =0 ; i<3 ; i++) {
        if (s==tt[i] )return cout << tt[(i+1)%3] , 0 ;
    }
}


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

int main()
{
    long long N;
    string ans = "";
    cin >> N;
    while (N)
    {
        N--;
        ans = char('a' + N % 26) + ans;
        N = N / 26;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{template<class U>static auto c(U v)->decltype(v.begin(),v.end(),std::true_type());static std::false_type c(...);public:const static bool value=decltype(c(std::declval<T>()))::value;};
template<class T,typename enable_if<iterable<T>::value, nullptr_t>::type=nullptr>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>>n;
    cout<<n*n*n<<endl;
}


Measured memory_bytes: 256
#include <iostream>
    #include <algorithm>
    using namespace std;
    using ll = long long;
    int main() {
        ll h, w;
        cin >> h >> w;

        if (h == 1 || w == 1) {
            cout << 1 << endl;
        } else {
            cout << (h*w+1) / 2 << endl;
        }
    }

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

const reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

reader.on('line', s => {
  let h = BigInt(s);
  let n = 0n;

  while (h !== 1n) {
    h /= 2n;
    n += 1n;
  }

  console.log(`${2n ** (n + 1n) - 1n}`.replace('n', ''));

  process.exit(0);
});

Measured memory_bytes: 30552
from math import gcd
k = int(input())
res = [0]*201
for i in range(1,k+1):
    for j in range(1,k+1):
        res[gcd(i,j)]+=1
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        ans += gcd(i,j)*res[i]

print(ans)

Measured memory_bytes: 64996
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
	
	int x,y; cin>>x>>y;
	int sum{};
	if(x==1&&y==1) sum += 400000;
	sum += max(0, 400000-x*100000);
	sum += max(0, 400000-y*100000);
	cout << sum << endl;
	
}


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

int main(){
  int N,M,C;
  int tmpRes;
  int res=0;
  vector<int> A;
  vector<int> B;
  scanf("%d %d %d\n",&N,&M,&C);
//  printf("%d %d %d\n",N,M,C);
  B.resize(M);
  A.resize(M);
  for(int i=0;i<M;i++){
    scanf("%d",&B[i]);
//    printf("%d ",B[i]);
  }
  printf("\n");
  for(int i=0;i<N;i++){
    tmpRes=0;
    for(int j=0;j<M;j++){
      scanf("%d",&A[j]);
//      printf("%d ",A[j]);
      tmpRes+=B[j]*A[j];
    }
    tmpRes+=C;
//    printf("tmp=%d\n",tmpRes);
    if(tmpRes>0){
      res++;
    }
  }
  
  printf("%d\n",res);
  return 0;
}

Measured memory_bytes: 256