akhauriyash/Code-Regression huggingface dataset:
diagram = gets.chomp.chars

upper_skip = ->{
  loop do
    a = diagram[0]
    return false if a == "\\"
    return true unless a
    diagram.shift
  end
}

downer_skip = ->(target_height) {
  height = index = 0
  until height == target_height
    height -= 1 if diagram.shift == "\\"
    index += 1
  end
  index
}

highest = ->{
  max_index = height = 0
  max_height = -Float::INFINITY 
  diagram.size.times do |j|
    case diagram[j]
    when "\\"
      height -= 1
    when "/"
      height += 1
      max_height, max_index = height, j if max_height < height
      return [0, j] if height.zero?
    end
  end
  [max_height, max_index]
}

calc = ->(from, to) {
  depth = area = 0
  from.upto(to) do
    case diagram.shift
    when "\\"
      area += depth + 1/2r
      depth += 1
    when "_"
      area += depth
    when "/"
      depth -= 1
      area += depth + 1/2r
    end
  end
  area.to_i
}

pools = []
loop do
  break if upper_skip.()
  height, index = highest.()
  if height == -Float::INFINITY
    break
  else
    first_index = downer_skip.(height)
    pools << calc.(first_index, index)
  end
end

if pools.empty?
  puts 0
  puts 0
else
  puts pools.inject(&:+)
  puts pools.size.to_s + " " + pools.join(" ")
end


Measured memory_bytes: 8028
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

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

	ll T = 0;
	repe(i, 1, N) {
		ll sum = 0;
		ll K = i;
		while (K != 0) {
			sum += K % 10;
			K /= 10;
		}
		if (sum >= A && sum <= B) {
			T += i;
		}
	}
	cout << T << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <math.h>
#include <time.h>

typedef int32_t i32;
typedef int64_t i64;
typedef double f64;

void *const null=(void *)0;
i64 const llinf=4611686018427387903LL;
i64 const mod=1000000009LL;
f64 const pi=3.141592653589793;
f64 const rad=57.295779513082323;

#define CODE_

static inline void init(i64 *const f){
    f[0LL]=1LL;
    f[1LL]=2LL;
    f[2LL]=3LL;
    f[3LL]=5LL;
    f[4LL]=4LL;
    f[5LL]=6LL;
    return;
}

static inline void north(i64 *const f){
    i64 const t=f[0LL];
    f[0LL]=f[1LL];
    f[1LL]=f[5LL];
    f[5LL]=f[3LL];
    f[3LL]=t;
    return;
}

static inline void east(i64 *const f){
    i64 const t=f[0LL];
    f[0LL]=f[4LL];
    f[4LL]=f[5LL];
    f[5LL]=f[2LL];
    f[2LL]=t;
    return;
}

static inline void west(i64 *const f){
    i64 const t=f[0LL];
    f[0LL]=f[2LL];
    f[2LL]=f[5LL];
    f[5LL]=f[4LL];
    f[4LL]=t;
    return;
}

static inline void south(i64 *const f){
    i64 const t=f[0LL];
    f[0LL]=f[3LL];
    f[3LL]=f[5LL];
    f[5LL]=f[1LL];
    f[1LL]=t;
    return;
    
}

static inline void right(i64 *const f){
    i64 const t=f[1LL];
    f[1LL]=f[2LL];
    f[2LL]=f[3LL];
    f[3LL]=f[4LL];
    f[4LL]=t;
    return;
}

static inline void left(i64 *const f){
    i64 const t=f[1LL];
    f[1LL]=f[4LL];
    f[4LL]=f[3LL];
    f[3LL]=f[2LL];
    f[2LL]=t;
    return;
}

i32 main(void){
    i64 n;
    char *s=(char *)calloc(6LL,sizeof(char));
    i64 *f=(i64 *)calloc(6LL,sizeof(i64));
    char c;
    i64 ans;
    while(1){
        scanf("%lli",&n);
        if(n==0LL) break;
        init(f);
        ans=1LL;
        for(i64 i=0LL;i<n;++i){
            scanf("%s",s);
            c=s[0LL];
            if(c=='N') north(f);
            else if(c=='E') east(f);
            else if(c=='W') west(f);
            else if(c=='S') south(f);
            else if(c=='R') right(f);
            else if(c=='L') left(f);
            ans+=f[0LL];
        }
        printf("%lli\n",ans);
    }
    return 0;
}



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

int main() {
  int64_t N;
  cin>>N;
  int64_t sum=0;
	for(int64_t i=1;i<=N;i++){
      if(i%3!=0){
      	if(i%5!=0){
          sum+=i;
        }
      }
    }
  cout<<sum<<endl;
}


Measured memory_bytes: 3624
/*
ABC151-D AC
幅優先探索 : 最短距離を求める
参考　: https://qiita.com/drken/items/6a95b57d2e374a3d3292#4-2-%E3%82%B0%E3%83%A9%E3%83%95%E4%B8%8A%E3%81%AE%E6%8E%A2%E7%B4%A2
*/

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;

//4方向の移動を示す
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
  int H, W;
  cin>>H>>W;
  vector<string> S(H);
  for(int i=0; i<H; i++){
    cin>>S[i];
  }

  int ans = 0;

  for(int sx=0; sx<H; sx++)for(int sy=0; sy<W; sy++){
    for(int gx=0; gx<H; gx++)for(int gy=0; gy<W; gy++){
      //スタートとゴールを探すループ
      if(S[sx][sy]=='.' && S[gx][gy]=='.'){
        //スタートとゴールにできるとき
        //ここから一般的な最短距離探索
        vector<vector<int>> dist(H, vector<int>(W, -1)); //dist=-1のマスは未発見
        queue<pii> unvisited; //発見したけど訪問していないマスの情報
        /*
        pushは後ろから入れる
        popは先頭から出す
        */

        dist[sx][sy] = 0; //スタートを発見
        unvisited.push(pii(sx, sy)); //訪問はしてないのでスタートを入れる

        //探索開始
        while(!unvisited.empty()){
          //unvisitedが空になるまで
          pair<int, int> current = unvisited.front(); //先頭を読む
          unvisited.pop(); //先頭を捨てる
          int x = current.first;
          int y = current.second;

          for(int i=0; i<4; i++){
            //4方向にnextを探索
            int next_x = x + dx[i];
            int next_y = y + dy[i];
            if(next_x<0 || next_x>=H || next_y<0 || next_y>=W) continue;
            //外に出たらダメ
            if(S[next_x][next_y]=='#') continue;
            //壁はダメ

            if(dist[next_x][next_y] == -1){
              //未発見だったらこれで発見なので未訪問キューに入れる
              unvisited.push(pii(next_x, next_y));
              dist[next_x][next_y] = dist[x][y] + 1; //nextのdistは現在地+1
            }
          }
        }//while(!unvisited.empty())
        
        //printf("(%d,%d)->(%d,%d) : %d\n", sx, sy, gx, gy, dist[gx][gy]);

        ans = max(ans, dist[gx][gy]);

      }//if(S[sx][sy]=='.' && S[gx][gy]=='.')
    }
  }

  cout<<ans<<endl;
}

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

using namespace std;
int a[300];
int main(){
	int n,L;
	cin>>n>>L;
	long long sum=0;
	for(int i=1;i<=n;i++){
		a[i]=L+i-1;
		sum+=a[i];
	}
	int ans;int minn=9999999;
	for(int i=1;i<=n;i++){
		if(abs(sum-(sum-a[i]))<minn){
			ans=sum-a[i];
			minn=abs(sum-(sum-a[i]));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000009
const long long INF = 1LL<<60;

struct edge
{
    int to;
    int cost;
};

using P=pair<int,int>;

int V;
vector<edge> G[100010];
ll d[100010];

void dijkstra(int s){
    priority_queue<P,vector<P>,greater<P>> que;
    fill(d,d+V,INF);
    d[s]=0;
    que.push(P(0,s));

    while(!que.empty()){
        P p=que.top();
        que.pop();
        int v=p.second;
        if(d[v]<p.first) continue;

        for(int i=0;i<G[v].size();i++){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

int main() {
    cin>>V;
    rep(i,V-1){
        int a,b,c;
        cin>>a>>b>>c;
        a--,b--;
        edge e={b,c};
        G[a].push_back(e);
        e={a,c};
        G[b].push_back(e);
    }
    int q,k;
    cin>>q>>k;
    k--;
    dijkstra(k);
    rep(i,q){
        int x,y;
        cin>>x>>y;
        x--,y--;
        cout<<d[x]+d[y]<<endl;
    }
}

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

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int ans = 0;
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != t[i])
			ans++;
	}
	cout << ans;
}



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

int main()
{
    int A,B,C;
    cin >> A >> B >> C;

    if(A == B && A != C)
    {
        cout << "Yes";
        return 0; 
    }
    
    if(A == C && A != B)
    {
        cout << "Yes";
        return 0; 
    }

    if(C == B && A != C)
    {
        cout << "Yes";
        return 0; 
    }

    else
    {
        cout << "No";
    }
    

    return 0;
}


Measured memory_bytes: 256
// Problem : C - Dubious Document 2
// Contest : AtCoder - AtCoder Beginner Contest 076
// URL : https://atcoder.jp/contests/abc076/tasks/abc076_c
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
string s,t;cin>>s>>t;
int n=size(s);
string ans="";
for(int i=0;i<n;i++)
{
	int cnt=0;
	for(int j=i;j<i+size(t);j++)
	if(t[j-i]==s[j] or s[j]=='?')
	cnt++;
	if(cnt==size(t))
	{
		string st=s;
		for(int j=i;j<i+size(t);j++)
		st[j]=t[j-i];
		for(int i=0;st[i];i++)
		if(st[i]=='?')
		st[i]='a';
		if(size(ans)==0)
		ans=st;
		else
		ans=min2(ans,st);
	}
}
if(size(ans))
cout<<ans;
else
cout<<"UNRESTORABLE";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 3600
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
(500*A)+(100*B)+(50*C)
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if (500*i)+(100*j)+(50*k) == X:
        count += 1
print(count)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

int under(int v,int m){
	int ret=0;
	while(ret+v<=m)ret+=v;
	return ret;
}

int main(){
	int n,m;
	while(cin>>n>>m&&(n||m)){
		vector<int> v(n);
		rep(i,n)cin>>v[i];
		vector<pair<pii,int>> vec;
		
		int time=under(v[0],m),dif=v[0],pos=1;
		vec.pb(make_pair(pii(time,dif),pos));
		for(int i=1;i<n;i++){
			int ntime=under(v[i],m),ndif=v[i],npos=i+1;
			vec.pb(make_pair(pii(ntime,ndif),npos));
		}
		sort(all(vec));
		if(vec[0].first==vec[1].first)cout<<n<<endl;
		else cout<<vec[0].second<<endl;
	}
}

Measured memory_bytes: 3096
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

//geometric library
//#include <complex>
typedef std::complex<double> Com;

//内積
double dot_product(const Com a, const Com b){
	return (conj(a)*b).real();
}
//外積
double cross_product(const Com a, const Com b){
	return (conj(a)*b).imag();
}
//点と直線の距離
double dist_dot_line(const Com st, const Com en, const Com dt){
    return std::abs(cross_product(dt-st, en-st) / std::abs(en-st));
}
//点と線分の距離
double dist_dot_seg(const Com st, const Com en, const Com dt){
	if(dot_product(en-st, dt-st) <= 0){
		return std::abs(dt-st);
	}else if(dot_product(st-en, dt-en) <= 0){
		return std::abs(dt-en);
	}else{
		return dist_dot_line(st, en, dt);
	}
}
//線分の交差判定
bool seg_crossing(const Com st1, const Com en1, const Com st2, const Com en2){
	double cross1 = cross_product(en1-st1, st2-st1) * cross_product(en1-st1, en2-st1);
	double cross2 = cross_product(en2-st2, st1-st2) * cross_product(en2-st2, en1-st2);
	return (cross1 <= 0) && (cross2 <= 0);
}
//線分と線分の距離
double dist_seg(const Com st1, const Com en1, const Com st2, const Com en2){
	if(seg_crossing(st1, en1, st2, en2)){
		return 0;
	}
	return std::min(std::min(dist_dot_seg(st1, en1, st2), dist_dot_seg(st1, en1, en2)), std::min(dist_dot_seg(st2, en2, st1), dist_dot_seg(st2, en2, en1)));
}

//線分と線分の垂直判定
bool is_vertical(const Com st1, const Com en1, const Com st2, const Com en2){
    if(dot_product(en1-st1, en2-st2) == 0){
        return true;
    }else{
        return false;
    }
}

//平行判定
bool is_parallel(const Com st1, const Com en1, const Com st2, const Com en2){
    if(cross_product(en1-st1, en2-st2) == 0){
        return true;
    }else{
        return false;
    }
}

//直線・線分の交点
Com cross_point(const Com st1, const Com en1, const Com st2, const Com en2){
    /* 線分の時はコメントを外した方が良さそう
    if(dist_seg(st1, en1, st2, en2) > 0 || is_parallel(st1, en1, st2, en2)){
        printf("Error! cross_point invalid input\n");
        std::exit(EXIT_FAILURE);
    }
    //*/
    double den = (real(st1)-real(en1)) * (imag(en2)-imag(st2)) - (real(en2)-real(st2)) * (imag(st1)-imag(en1));
    double mol = (real(en2)-real(en1)) * (imag(en2)-imag(st2)) - (real(en2)-real(st2)) * (imag(en2)-imag(en1));
    double s = mol/den;
    return st1 * s + en1 * (1-s);
}

void solve(){
    double x[4], y[4];
    Com p[4];
    for(int i = 0; i < 4; i++){
        scanf("%lf%lf", &x[i], &y[i]);
        p[i] = Com(x[i], y[i]);
    }
    Com ans = cross_point(p[0], p[1], p[2], p[3]);
    printf("%.10lf %.10lf\n", real(ans), imag(ans));
}

long q;
int main(){
    scanf("%ld", &q);
    for(int i = 0; i < q; i++){
        solve();
    }
}



Measured memory_bytes: 3236
N = int(input())
ans = []
res = N
while res != 1 and res != 0:
    res, tmp = res//(-2), res % (-2)
    if tmp==-1:
        tmp = 1
        res +=1
    ans.append(tmp)
ans.append(res)
print(''.join(map(str, reversed(ans))))


Measured memory_bytes: 2940
n = int(input())
h = list(map(int,input().split()))

c = 0
i = 0

while sum(h) > 0 :
    if h[i]> 0 :
        j = i
        c = c + 1 
        while j < n and h[j] > 0 :
            h[j] = h[j] - 1
            j = j + 1
    else:
        i = i + 1

print(c) 

Measured memory_bytes: 3060
//ΔATCODER QUALC D
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
const int N = 222222;
const int M = 26;
map<int,int> S;
char ch[N];
int a[N],dp[N];
int main()
{
	int n,i,j,x,y;
	cin>>ch;
	n=strlen(ch);
	x=0;
	S[0]=0;
	for(i=1;i<=n;i=i+1){
		a[i]=ch[i-1]-'a';
		x^=(1<<a[i]);
		if(S.find(x)==S.end())
			S[x]=N;
		dp[i]=S[x]+1;
		for(j=0;j<M;j=j+1){
			y=x^(1<<j);
			if(S.find(y)!=S.end())
				dp[i]=min(dp[i],S[y]+1);
		}
		if(S[x]>dp[i])
			S[x]=dp[i];
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 11392
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>

int main(){
    int a, b, N;
    cin >> N;
    int P[N], Q[N];
    for(int i=0; i<N; i++) cin >> P[i];
    for(int i=0; i<N; i++) cin >> Q[i];
    vector<int> perm(N);
    int judge[N];
    int pcount=0;
    int qcount=0;
    int j=0;
    iota(perm.begin(), perm.end(), 1); // perm に 1, 2, ... N を設定
    do {
        int i = 0;
        j++;
        for(auto x : perm) {
            if(x==P[i]){
                pcount++;
            }
            if(x==Q[i]){
                qcount++;
            }
            i++;
        }
        if(pcount == N){
            a=j;
        }
        if(qcount == N){
            b=j;
        }
        pcount = 0;
        qcount = 0;
    } while(next_permutation(perm.begin(), perm.end()) );
    cout << abs(a-b) << endl;
}

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

int main(){
    int x[5];
    rep(i,5){
        cin >> x[i];
        if(x[i] == 0) cout << i+1 << endl;
    }
}

Measured memory_bytes: 3600
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Long> l = new ArrayList<>();
    for (int i = 0; i < n; i++) {
      l.add(sc.nextLong());
    }
    long count = 0;
    for (int i = 0; i < n; i++) {
      long li = l.get(i);
      for (int j = i + 1; j < n; j++) {
        long lj = l.get(j);
        for (int k = j + 1; k < n; k++) {
          long lk = l.get(k);
          if (li != lj && li != lk && lj != lk && li < lj + lk && lj < li + lk && lk < lj + li) {
            count++;
          }
        }
      }
    }
    System.out.println(count);
  }
}


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

int main() {
  int N,L;
  cin >> N >> L;
  vector<string> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  
  for(int i=0;i<N;i++){
    cout << vec.at(i);
  }
  cout << endl;
}

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

int main()
{
int N,ans=1,a=0;scanf("%d",&N);
vector<int> num(N+1,0);
for(int i=1;i<N+1;i++)
{
  int n=i;
  while(n%2==0){n/=2;num[i]++;}
}
for(int i=0;i<N+1;i++){if(num[i]>a){a=num[i];ans=i;}}
printf("%d\n",ans);
}

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

int main() 
{
	int n,k;
	cin>>n>>k;
	int curr=1;
	for(int i=0;i<n;i++)
	{
	    if(curr*2<curr+k)
	    {
	        curr=curr*2;
	    }
	    else
	    {
	        curr=curr+k;
	    }
	}
	cout<<curr<<endl;
	return 0;
}

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

bool is_bit_set(uint32_t x, uint8_t n)
{
    bool ret;
    ret = (x >> n) & 1U;

    return ret;
}

int main()
{
    uint32_t H;
    uint32_t W;
    uint32_t K;
    cin >> H >> W >> K;

    string S[6];
    for (size_t i = 0; i < H; i++)
    {
        cin >> S[i];
    }

    uint32_t ans;
    ans = 0;
    for (uint32_t h = 0; h < (uint32_t)(1 << H); h++) for (uint32_t w = 0; w < (uint32_t)(1 << W); w++)
    {
        uint32_t k;
        k = 0;
        for (uint32_t i = 0; i < H; i++) for(uint32_t j = 0; j < W; j++)
        {
            if (is_bit_set(h, i) && is_bit_set(w, j))
            {
                if (S[i][j] == '#')
                {
                    k = k + 1;
                }
            }
            
        }

        if (k == K)
        {
            ans = ans + 1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main()
{
	long long a,b,k;
//	scanf("%d%d%d",&a,&b,&k);
	cin>>a>>b>>k;
	int flag=1;
	while(k--)
	{
		if(flag==1)
		{
			if(a%2)
			{
				a--;
			}
				b+=a/2;
				a/=2;
			
		}
		else
		{
			if(b%2)
			{
				b--;
			}
				a+=b/2;
				b/=2;
			
		}
		flag*=-1;
	}
	cout<<a<<" "<<b<<endl;
	return 0;
 } 

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int a; string s; cin >> a >> s;
    if(a < 3200) cout << "red" << endl;
    else cout << s << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7748
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back

/* add vars here */

vector<ll> a,b,c;

/* add your algorithm here */

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

  rep(i,n) {
    ll t;
    cin >> t;
    a.pb(t);
  }

  rep(i,n) {
    ll t;
    cin >> t;
    b.pb(t);
  }

  rep(i,n) {
    ll t;
    cin >> t;
    c.pb(t);
  }

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  ll ans = 0;

  rep(i,n) {
    ll tar = b[i];
    ll ta, tc;
    tc = c.end() - upper_bound(c.begin(), c.end(), tar);
    ta = lower_bound(a.begin(), a.end(), tar) - a.begin();

    ans += ta * tc;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3316
// Created by ...Lusifer
#include<bits/stdc++.h>
using namespace std;
 
#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void solveTest(){
	string s;
	cin>>s;
	if(s[0]!='A'){
		cout<<"WA"<<endl;
		return;
	}
	int flag=0;
	for(int i=2;i<=s.size()-2;i++){
		if(s[i]=='C'){
			flag++;
		}
	}
	if(flag!=1){
		cout<<"WA"<<endl;
		return;
	}
	flag=0;
	for(int i=0;i<s.size();i++){
		if(islower(s[i])){
			flag++;
		}
	}
	if(flag==s.size()-2){
		cout<<"AC"<<endl;
	}
	else{
		cout<<"WA"<<endl;
	}

	
	return ;
}
 
int main(){
	fastio();

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int card[255][14]={{0}};

int main(void){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        char c;
        int num;
        cin>>c>>num;
        card[(int)c][num]=1;
    }
    
    for(int i=1;i<=13;i++){
        if(card[(int)'S'][i]==0){
            cout<<"S "<<i<<endl;
        }
    }
    for(int i=1;i<=13;i++){
        if(card[(int)'H'][i]==0){
            cout<<"H "<<i<<endl;
        }
    }
    for(int i=1;i<=13;i++){
        if(card[(int)'C'][i]==0){
            cout<<"C "<<i<<endl;
        }
    }
    for(int i=1;i<=13;i++){
        if(card[(int)'D'][i]==0){
            cout<<"D "<<i<<endl;
        }
    }
    
    // Your code here!
    
}


Measured memory_bytes: 3116
n, k = map(int, input().split(' '))
s = input()

happy_count = 0
for i, c in enumerate(s):
    if c == "R":
        if i == len(s) - 1:
            pass
        elif s[i + 1] == "R":
            happy_count += 1
    else:
        if i == 0:
            pass
        elif s[i - 1] == "L":
            happy_count += 1

ret = min(happy_count + 2 * k, len(s) - 1)
print(ret)


Measured memory_bytes: 3316
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, m, l, r, L, R;
string str;

int main(){
	cin >> n >> m;
	L = 1;
	R = n;
	for(ll i = 1; i <= m; i++){
		cin >> l >> r;
		L = max(l, L);
		R = min(r, R);
	}
	cout << max(R-L+1, 0LL) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
    ll q,h,s,d;
    cin >> q >> h >> s >> d;
    ll n;
    cin >> n;
    ll ans=0,min1,min2;
    min1 = min(q*4,min(h*2,s));
    min2 = min(min1*2,d);
    ll r2,r1;
    r2 = n/2;
    r1 = n%2;
    cout<<r2*min2+r1*min1<<endl;
    return 0;
}

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

int main(){
    int h,w,a,b; cin >> h >> w >> a >> b;
    vector<vector<int>> ans(h,vector<int>(w));
    vector<int> cnth(w,0);
    vector<int> cntw(h,0);
    rep(i,h){
        rep(j,w){
            if(i < b && j < a){
                ans[i][j] = 0;
            }else if(i < b){
                ans[i][j] = 1;
            }else if(j < a){
                ans[i][j] = 1;
            }else{
                ans[i][j] = 0;
            }
        }
    }
    rep(i,h){
        rep(j,w) cout << ans[i][j];
        cout << "\n";
    }
}

Measured memory_bytes: 6784
#include<iostream>
using namespace std;
int main(){
long n,i,pm,pe,pj;
while(cin>>n,n){
for(i=0;i<n;i++){
cin>>pm>>pe>>pj;
if(pm==100||pe==100||pj==100){cout<<"A"<<endl;continue;}
if(pm+pe>=180){cout<<"A"<<endl;continue;}
if(pm+pe+pj>=240){cout<<"A"<<endl;continue;}
if(pm+pe+pj>=210){cout<<"B"<<endl;continue;}
if(pm+pe+pj>=150&&(pm>=80||pe>=80)){cout<<"B"<<endl;continue;}
cout<<"C"<<endl;
}
}
return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int l, r, d; cin >> l >> r >> d;
	l = !(l % d) ? l : (l/d + 1) * d;
	r = r/d * d;
	cout << (r - l)/d + 1;

	return 0;
}

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

int main(){
  int a=0,b=0,c=0,x=0,n=0;
  bool flag = false;
  string s;
  char ch;
  
//  cin >> n;
//  cin >> a;
//  cin >> b;
//  cin >> c;
//  cin >> x;
  cin >> ch;


  
 ch++;
 cout << ch << endl;  

  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N,K;cin>>N>>K;
    int score=0;
    double ans=0;
    int counter=0;
    for(int i=1;i<=N;i++){
        counter=0;
        score=i;
        if(score>=K){
            ans+=1;
            continue;
        }
        while(1){
            counter++;
            score*=2;
            if(score>=K){
                ans+=1.0/pow(2,counter);
                break;
            }
        }
    }
    printf("%1.12f\n",ans/N);
}

Measured memory_bytes: 4188
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
  int stu[30];

  for (int i = 0; i < 28; i++) scanf("%d", &stu[i]);
  for (int i = 1; i <= 30; i++){
    if (count(stu, stu + 30, i) == 0){
      printf("%d\n", i);
    }
  }

}

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

int main(void){
    int n;
    std::cin >> n;

    std::vector<int> a(100003);
    for(int i = 1; i < n+1; i++){
        std::cin >> a[i];
    }
    
    long long count_pair = 0;

    for(int i = 1; i < n+1; i++){
        if(a[a[i]] == i){
            count_pair++;
        }
    }

  	count_pair /= 2;
    std:: cout << count_pair << std::endl;
    return 0;
}

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

map <int, int> primes;

void decomp(int x);
long long get_nr();

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

    for (int i(1); i <= n; i++)
        decomp(i);

    cout << get_nr();
    return 0;
}

long long get_nr()
{
    long long ans(1);
    for (auto i : primes)
        ans = (ans * (i.second + 1)) % 1000000007;
    return ans;
}

void decomp(int x)
{
    for (int i(2); i * i <= x; i++) {
        while (x % i == 0) {
            primes[i]++;
            x /= i;
        }
    }
    if (x != 1)
        primes[x]++;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
ll mx=1e9+7;
void solve()
{
    ll n;
    cin >> n;
    ll a,sum=0,p=0;
    for(ll i=0;i<n;i++)
    {
        cin >> a;
        sum+=a*p;
        p+=a;
        p=p%mx;
        sum=sum%mx;
    }
    
    cout << sum << endl;
}

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

Measured memory_bytes: 3592
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

const int mod=1e9+7;
int power(int x,int y,int p)
{ 
    int res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if((y & 1)==1) 
            res = (res * x) % p; 
        y = y >> 1;  
        x = (x * x) % p;  
    } 
    return res; 
} 
int32_t main()
{
    IOS
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    if(n==1)
        return cout<<(2*arr[0])%mod,0;

    sort(arr,arr+n);
    int pow=power(2,(n-1)*2-1,mod);
    int mul=2;
    int ans=0;
    for(int i=n-1;i>=0;i--)
    {
        int get=(pow*mul)%mod;
        get*=arr[i];
        get%=mod;
        ans+=get;
        ans%=mod;
        mul++;
    }
    cout<<(ans*2)%mod;
}


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

int main() {
  ll N; cin >> N;
  ll total = 0;
  vector<ll> A(N+2, 0);
  for (ll i=1; i<N+1; i++) {
    cin >> A.at(i);
    total += abs(A.at(i)-A.at(i-1));
  }
  total += abs(A.at(A.size()-1)-A.at(A.size()-2));
  for (ll i=1; i<N+1; i++)
    cout << total - abs(A.at(i)-A.at(i-1)) - abs(A.at(i)-A.at(i+1)) + abs(A.at(i-1)-A.at(i+1)) << endl;
}

Measured memory_bytes: 2048
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define INF 10000000

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

typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

void solve(void){
    int n;
    cin >> n;
    ll as[3*n];
    rep (3*n, i) cin >> as[i];

    IntReversePrioQueue heads;
    IntPrioQueue lasts;
    ll headsum = 0, lastsum = 0;
    rep (n, i){
        heads.push(as[i]);
        lasts.push(as[2*n+i]);
        headsum += as[i];
        lastsum += as[i+2*n];
    }

    ll headsums[n+1], lastsums[n+1];
    headsums[0] = headsum; lastsums[n] = lastsum;

    rep(n, i){
        heads.push(as[i+n]);
        headsum += as[i+n] - heads.top();
        heads.pop();
        headsums[i+1] = headsum;
    }
    for(int i = 2*n-1; i >= n; i--){
        lasts.push(as[i]);
        lastsum += as[i] - lasts.top();
        lasts.pop();
        lastsums[i-n] = lastsum;
    }
    ll ans = headsums[0] - lastsums[0];
    rep(n, i) ans = max(ans, headsums[i+1] - lastsums[i+1]);
    cout << ans << endl;
}

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


Measured memory_bytes: 5108
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_D&lang=jp

#include<iostream>
 using namespace std;

int main(){

    int a , b, c ;
    int yakusuunokosuu = 0 ;

    cin >> a >> b >> c ;

    for (int i = 0; i <= 10000; i=i+1 )
 	{
 	    if ( ( a + i ) > b )
 	    {
        break;
 	    }else{
	        if ( c % ( a + i ) == 0 ) //cがa+iで割り切れる場合
            {
             yakusuunokosuu = yakusuunokosuu + 1 ; //約数の個数を1個増やす
            }else{
            // 何もしない
            }
        }

 	}

    cout<< yakusuunokosuu << endl ;  
    return 0;

}


Measured memory_bytes: 3104
import java.util.*;
import static java.lang.System.*;
import java.io.*;
import java.math.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		long n = sc.nextLong();
		long t = sc.nextLong();
		long score = 0;
		long start = sc.nextLong(); long end = t;
		for(int i = 1; i < n; i++) {
			long nextStart = sc.nextLong();
			if(end > nextStart) {
				score += (nextStart - start);
			} else {
				score += t;
			}
			start = nextStart;
			end = nextStart + t;
		}
		score += t;
		
		out.println(score);

		out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}

Measured memory_bytes: 21204
s = input()
N = len(s)

# AABC->ABCA->BCAA
# ABCの前にAがn個->ABCの後にAがn個

# ABCABC->BCABCA->BCBCAA

# AかBCでない並びがあったら切断

# Aを右に BCを左に移動させる操作
# BCがあったら、それより左にあるAの数だけansが増える


i = 0
a = 0
ans = 0

while i < len(s):
    if s[i] == 'A':
        a += 1
        i += 1
        continue
    if s[i] == 'B' and i + 1 < N:
        if s[i + 1] == 'C':
            ans += a
            i += 2
            continue
    a = 0
    i += 1

print(ans)


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

int main() {
  int N,M;
  cin >> N >> M;
  long fi,se;
  long sumx = 0;
  cin >> fi;
  for (int i=0; i<N-1; i++) {
    cin >> se;
    sumx += (se-fi) * (i+1) * (N-1-i);
    sumx %= 1000000007;
    fi = se;
  }
  long sumy = 0;
  cin >> fi;
  for (int i=0; i<M-1; i++) {
    cin >> se;
    sumy += (se-fi) * (i+1) * (M-1-i);
    sumy %= 1000000007;
    fi = se;
  }
  long total = sumx * sumy % 1000000007;
  cout << total << endl;
}

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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  ll s;
  cin >> s;
  ll b = 1e9;
  ll x = (s+b-1)/b, y = x*b-s;
  cout << 0 << ' ' << 0 << ' ' << 1 << ' ' << x << ' ' << b << ' ' << y << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef priority_queue<ll> pqll;
ll ans=0;
int N,K;
ll V[55];
vector<pqll> lpq[55];
vector<pqll> rpq[55];
int main(int argc,char const* argv[])
{
  cin >> N >> K;
  for(int i=1;i<=N;i++)
    {
      cin >> V[i];
    }
  int mxget=min(N,K);
  for(int i=0;i<=mxget;i++)
    {
      for(int getsum=0;getsum<=i;getsum++)
	{
	  if(getsum==0) continue;
	  for(int lget=0;lget<=getsum;lget++)
	    {
	      int restope=K-getsum;
	      int rget=max(getsum-lget,0);
	      ll tmp=0;
	      priority_queue<ll,vector<ll>,greater<ll> > jewel;
	      priority_queue<ll,vector<ll>,greater<ll> > emp;
	      jewel=emp;
	      for(int l=1;l<=lget;l++)
		{
		  jewel.push(V[l]);
		  tmp+=V[l];
		}
	      for(int r=1;r<=rget;r++)
		{
		  jewel.push(V[N-r+1]);
		  tmp+=V[N-r+1];
		}
	      //cout << "getsum restope lget rget tmpans " << getsum << ' ' <<restope << ' ' << lget << ' ' << rget << ' ' << tmp << endl;
	      while(restope>0 && jewel.size()!=0)
		{
		  //cout << jewel.top() << endl;
		  if(jewel.top()<0)
		    {
		      tmp-=jewel.top();
		      jewel.pop();
		    }
		  else break;
		  restope--;
		}
	      //cout << "final tmp" << tmp << endl;
	      ans=max(ans,tmp);

	    }
	}
    }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
const int mod = 998244353;

int main(){
	int n,m;
	cin >> n >> m;
	int ans = 0;
	f1(n){
		fr(j,10,m+1){
			int a = j/10;
			int b = j%10;
			if(i==a*b&&min(a,b)>=2)ans++;
		}
	}
	cout << ans << endl;
}

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

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


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

int main(){
    int n;
    cin >> n;
    vector<pair<int,int>> a(n),b(n),c(n),d(n);

    for (int i = 0;i < n;i++){
        int A,B;
        cin >> A >> B;
        a[i] = make_pair(A,B);
    }

    for (int i = 0;i < n;i++){
        int C,D;
        cin >> C >> D;
        c[i] = make_pair(C,D);
    }

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


    int ans = 0;
    int use[n];
    memset(use,-1,sizeof(use));
    for (int k = 0;k < n;k++){
        int point = -1;
        int y = -1;
        for (int i = 0;i < n;i++){
            if (use[i] != -1) continue;

            if (a[i].first < c[k].first and a[i].second < c[k].second and a[i].second > y){
                point = i;
                y = a[i].second;
            }
        }

        if (point != -1){
            use[point] = 1;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#pragma warning (disable:4996)
int arr[4] = { 0 };
int main()
{
	int n;
	while (~scanf("%d", &n))
	{
		for (int i = 0; i < 4; i++)
		{
			arr[i] = n % 10; n /= 10;
		}
		if (arr[3] + arr[2] + arr[1] + arr[0] == 7) {
			printf("%d+%d+%d+%d=7\n", arr[3], arr[2], arr[1], arr[0]); return 0;
		}
		if (arr[3] - arr[2] + arr[1] + arr[0] == 7) { printf("%d-%d+%d+%d=7\n", arr[3], arr[2], arr[1], arr[0]); break; }
		if (arr[3] + arr[2] - arr[1] + arr[0] == 7) { printf("%d+%d-%d+%d=7\n", arr[3], arr[2], arr[1], arr[0]); break; }
		if (arr[3] + arr[2] + arr[1] - arr[0] == 7) { printf("%d+%d+%d-%d=7\n", arr[3], arr[2], arr[1], arr[0]); break; }
		if (arr[3] - arr[2] - arr[1] - arr[0] == 7) { printf("%d-%d-%d-%d=7\n", arr[3], arr[2], arr[1], arr[0]); break; }
		if (arr[3] - arr[2] - arr[1] + arr[0] == 7) { printf("%d-%d-%d+%d=7\n", arr[3], arr[2], arr[1], arr[0]); break; }
		if (arr[3] + arr[2] - arr[1] - arr[0] == 7) { printf("%d+%d-%d-%d=7\n", arr[3], arr[2], arr[1], arr[0]); break; }
		if (arr[3] - arr[2] + arr[1] - arr[0] == 7) { printf("%d-%d+%d-%d=7\n", arr[3], arr[2], arr[1], arr[0]); break; }
	}
}

Measured memory_bytes: 128
size = int(input())
nums = list(map(int, input().split()))
# 
# size = 6
# nums = [0, 2, 2, 0, 2, 2]

numu = list(set(nums))
if len(numu) == 1 and numu[0] == 0:
  print("Yes")
  quit()


if len(numu) == 2 \
    and nums.count(0) != 0 \
    and nums.count(0) * 3 == size:
  print("Yes")
  quit()

if len(numu) == 3:
  if nums.count(0) == 1:
    print("No")
    quit()

  if not nums.count(numu[0]) == nums.count(numu[1]) == nums.count(numu[2]):
    print("No")
    quit()

  if numu[0] ^ numu[2] == numu[1] \
      and numu[1] ^ numu[0] == numu[2] \
      and numu[2] ^ numu[1] == numu[0]:
    print("Yes")
    quit()

print("No")


Measured memory_bytes: 14116
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007


template <class T>
void print(vector<T> arr)
{
	cout << "start printing the vector\n";
	for (auto u : arr)
		cout << u << " ";
	cout << "\n";
}

template <class T>
void print_mat(vector<vector<T>> a)
{
	cout << "start printing the matrix\n";
	for (auto v : a)
	{
		for (auto e : v)
		{
			cout << e << " ";
		}
		cout << "\n";
	}
}

/******************************************
* NUMBER THEORY ;) *
******************************************/



ll powermod(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	res %= mod;
	return res;
}
ll factmod(ll n)
{
	ll res = 1;
	while (n > 1)
	{
		res = (res * ((n / mod) % 2 ?  mod - 1 : 1)) % mod;
		for (ll i = 2; i <= n % mod; ++i)
			res = (res * i) % mod;
		n /= mod;
	}
	res %= mod;
	return res;
}



void solve()
{
	string s1;
	cin >> s1;
	for (auto u : s1)
		cout << 'x';
	cout << "\n";
}

int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	// ll t;
	// cin>>t;
	// while(t--)
	// {
	solve();
	// }

	return 0;
}

Measured memory_bytes: 3632
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
#include <iterator>
#include <list>
#include <unordered_map>
#include <deque>
#include <math.h>
#include <tgmath.h>
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << "\n";}
#define INF (1e18)

const ll MAX = 1000000000;
const ll MOD = 1e9 + 7;

ull a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;

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

ll aabs(ll a) {
    if (a < 0) return -a;
    return a;
}

//fast power
ll calc(ll a, ll b) {
    if (b == 0) return 1;
    else if (b % 2 == 0) {
        ll d = calc(a, b / 2);
        return (d * d) % MOD;
    }
    else return (a * calc(a, b - 1)) % MOD;
}

//fast combination
ll comb(ll n, ll a) {
    ll b = 1, c = 1;
    for (ll i = 1; i <= a; ++i) {
        b = b * i % MOD;
        c = c * (n - i + 1) % MOD;
    }

    return c * calc(b, MOD - 2) % MOD;
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    long double aa, bb, cc;
    cin >> aa >> bb >> cc;
 
    if (cc - aa - bb > 2 * (long double)sqrt(aa * bb)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}
/*
string sss(char ch, int aa) {
    string ss = "";
    for (int i = 0; i < aa; ++i) ss += ch;
    return ss;
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> n;
    string tmp;
    rep (i, 0, n) tmp += 'a' + i;
    rep (i, 0, n) {
        rep (j, 0, n) {
            //case 0
            cout << sss(tmp[i], n) << endl;

            //case 1
            rep (k, 0, n + 1) cout << sss(tmp[i], n - k - KK) + sss(tmp[i + 1], KK) + sss(tmp[i], k);
            //          ~~~~~~~

            //case 2
            rep
    }

    

    return 0;
}*/


Measured memory_bytes: 256