akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int N, K;
   cin >> N >> K;
   string S;
   cin >> S;
   int LR = 0, RL = 0;
   int ans = 0;
   for (int i =  1; i < N; i++) {
      if (S[i] == 'L') {
         if (S[i - 1] == 'L') ans++;
         else RL++;
      } else {
         if (S[i - 1] == 'L') LR++;
         else ans++;
      }
   }
   int minus = min(K, min(LR, RL));
   ans += 2 * minus;
   K -= minus;
   LR -= minus;
   RL -= minus;
   if (K > 0) {
      if (LR + RL > 0) ans += LR + RL;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 512
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int n, min, max;
  string str, minstr, maxstr;
  char c;

  cin >> n;

  REP(i, n) {
    cin >> str;
    minstr = str;
    maxstr = str;
    REP(j, str.length()-1) {
      for(int k = str.length()-1; k > j; k--) {
	if(maxstr[j] < maxstr[k]) {
	  c = maxstr[j];
	  maxstr[j] = maxstr[k];
	  maxstr[k] = c;
	}
	if(minstr[j] > minstr[k]) {
	  c = minstr[j];
	  minstr[j] = minstr[k];
	  minstr[k] = c;
	}
      }
    }
    max = atoi(maxstr.c_str());
    min = atoi(minstr.c_str());
    cout << max-min << endl;
  }
}

Measured memory_bytes: 1216
#include<stdio.h>
#include<limits.h>

int main() {
	int n,i,t;
	int min, sa = INT_MIN;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &t);
		if (i == 0) min = t;
		else {
			if (sa < (t - min)) sa = (t - min);
			if (t < min) min = t;
		}
}
	printf("%d\n", sa);
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define x first
#define y second
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define endl '\n'


int main()
{
	ll a,b,c,d;
	cin>>b>>a>>d>>c;
	ll x=(d+a-1)/a;
	ll y=(b+c-1)/c;
	if(x<=y)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3572
#include <iostream>

using namespace std;

const int kMaxN = 50;

int main() {
    int n, m;
    string A[kMaxN], B[kMaxN];

    cin >> n >> m;

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

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

    for (int i = 0; i < (n - m + 1); i++) {
        for (int j = 0; j < (n - m + 1); j++) {
            bool flag = true;
            for (int k = i; k < (i + m); k++) {
                for (int l = j; l < (j + m); l++) {
                    if (A[k][l] != B[k - i][l - j]) {
                        flag = false;
                        break;
                    }
                }
                if (!flag) {
                    break;
                }
            }
            if (flag) {
                cout << "Yes" << endl;
              	return 0;
            }
        }
    }

    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <string>
#include <algorithm>
#include <limits.h>
#include <iostream>

using namespace std;

int main()
{
	int i, j, k;
	string S;
	cin >> S;

	k = S.length();
	cout << S[0] << k - 2 << S[k-1] << endl;

	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int max_n = 1e6;

ll n;

ll a[max_n];
ll s[max_n];

// 左端が0、 右端がrとr+1の間、真ん中がxとx+1の間のとき
// xを進めてもP, Qの差が大きくならないならtrue
bool condl(ll x, ll r){
	ll p1 = s[x] - s[0];
	ll q1 = s[r] - s[x];
	ll p2 = s[x+1] - s[0];
	ll q2 = s[r] - s[x+1];
	return abs(p2 - q2) <= abs(p1 - q1);
}

// 左端がlと1+1の間、 右端がn+1、真ん中がxとx+1の間のとき
// xを小さくしてもR(変数はp), S(変数はq)の差が大きくならないならtrue
bool condr(ll x, ll l){
	ll p1 = s[x] - s[l];
	ll q1 = s[n] - s[x];
	ll p2 = s[x-1] - s[l];
	ll q2 = s[n] - s[x-1];
	return abs(p2 - q2) <= abs(p1 - q1);
}

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

	cin >> n;

	rep(i, n) cin >> a[i+1];
	s[0] = 0;
	rep(i, n) s[i+1] = s[i] + a[i+1];

	// P, Qについて確認
	ll fl[n+1];
	// 真ん中をi,i+1の間のしたとき,
	// 左側はfl[i]とfl[i]+1の間で切るのが最適

	ll left = 1;
	for (ll right = 1; right <= n; ++right) {
	    while (left < right && condl(left, right)) {
	        ++left;
	    }
	    fl[right] = left;
	}

	// R, Sについて確認
	ll fr[n];
	// 真ん中をi,i+1の間のしたとき,
	// 右側はfr[i]とfr[i]+1の間で切るのが最適

	ll right = n;
	for (ll left = n; left >= 1; --left) {
	    while (right > left && condr(right, left)) {
	        --right;
	    }
	    fr[left] = right;
	}

	// 各真ん中でP, Q, R, S(変数はt)の最大値と最小値の差の絶対値を比較してゆく
	ll ans = 1e15;
	for(ll i = 1; i <= n; i++){
		ll p = s[fl[i]] - s[0];
		ll q = s[i] - s[fl[i]];
		ll r = s[fr[i]] - s[i];
		ll t = s[n] - s[fr[i]];

		ans = min(ans, max({p, q, r, t}) - min({p, q, r, t}));
	}

	cout << ans << endl;
}


Measured memory_bytes: 9088
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;

int N;
vector<vector<ll>> F(10, vector<ll>(10)), P(10, vector<ll>(11));
ll ans = -INF;

void rec(vector<ll> &A, int depth) {
    if (depth == 10) {
        ll tmp = 0;
        bool judge = 0;
        rep(i, N) {
            ll cnt = 0;
            rep(j, 10) {
                if (A[j] == 1)
                    judge = 1;
                if (F[i][j] == A[j] && A[j] == 1)
                    cnt++;
            }
            tmp += P[i][cnt];
        }

        if (judge)
            ans = max(ans, tmp);
        return;
    }

    vector<ll> AA = A;
    A.push_back(0);
    rec(A, depth + 1);
    A.pop_back();
    A.push_back(1);
    rec(A, depth + 1);
    A.pop_back();
}

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

    cin >> N;

    F.resize(N, vector<ll>(10));
    P.resize(N, vector<ll>(11));
    rep(i, N) {
        rep(j, 10) { cin >> F[i][j]; }
    }

    rep(i, N) {
        rep(j, 11) { cin >> P[i][j]; }
    }

    vector<ll> A;
    ll count = 0;
    rec(A, 0);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3648
h, w, n = map(int, input().split())
sr, sc = map(int, input().split())
s = input()
t = input()
ll = rr = sc
uu = dd = sr
for ss, tt in zip(s, t):
    if ss == "L":
        ll -= 1
        if ll == 0:
            print("NO")
            exit()
    elif ss == "R":
        rr += 1
        if rr == w + 1:
            print("NO")
            exit()
    elif ss == "U":
        uu -= 1
        if uu == 0:
            print("NO")
            exit()
    else:
        dd += 1
        if dd == h + 1:
            print("NO")
            exit()
            
    if tt == "L":
        rr -= 1
        rr = max(rr, 1)
    elif tt == "R":
        ll += 1
        ll = min(ll, w)
    elif tt == "U":
        dd -= 1
        dd = max(dd, 1)
    else:
        uu += 1
        uu = min(uu, h)
print("YES")
        

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

int main() {
  char a, b, c;
  cin >> a >> b >> c;
  int _a, _b, _c;
  _a = a - '0';
  _b = b - '0';
  _c = c - '0';
  cout << _a + _b + _c << endl;
}


Measured memory_bytes: 256
//package AtCoder.C114;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;


public class Main {
    static InputStream inputStream = System.in;
    static OutputStream outputStream = System.out;
    static InputReader in = new InputReader(inputStream);
    static PrintWriter out = new PrintWriter(outputStream);

    static List<List<Integer>> digitIndex = new ArrayList<>();

    static int binsearchnext (int digit, int minind) {
        int ll = 0; int ul = digitIndex.get(digit).size()-1;
        int ans = -1;
        while(ll<=ul) {
            int mid = (ll+ul)/2;
            if (digitIndex.get(digit).get(mid) >= minind) {
                ans = digitIndex.get(digit).get(mid); ul=mid-1;
            } else {
                ll=mid+1;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        int n = in.NI();
        for (int i=0;i<10;i++) digitIndex.add(new ArrayList<>());

        String q = in.next();
        for (int i=0;i<q.length();i++) {
            digitIndex.get(q.charAt(i)-'0').add(i);
        }

        int ans = 0;
        for (int i=0;i<1000;i++) {
            int ti = i;
            int d3 = ti%10;
            ti/=10;
            int d2 = ti%10;
            ti/=10;
            int d1 = ti%10;
            int startind = 0;
            int i1 = binsearchnext(d1, startind);
            if (i1==-1) continue;
            startind = i1+1;
            int i2 = binsearchnext(d2, startind);
            if(i2==-1) continue;
            startind = i2+1;
            int i3 = binsearchnext(d3, startind);
            if (i3==-1) continue;

            //out.printf("%d %d %d\n", d1,d2,d3);
            ans++;
        }

        out.println(ans);
        out.close();
    }


    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 NI() {
            return Integer.parseInt(next());
        }

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

    }


}


Measured memory_bytes: 23380
# -*- coding: utf-8 -*-
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

H,W,K=map(int,input().split())
sy,sx,gy,gx=map(int,input().split())
st=sx+sy*(W+2)
gl=gx+gy*(W+2)
c=['@']*(W+2)
for i in range(H):
    c.extend(['@']+list(input())+['@'])
c.extend(['@']*(W+2))
que=deque()
dist=[INF]*(W+2)*(H+2)
que.append(st)
dist[st]=0
d=(-1,1,W+2,-(W+2))
while que:
    v=que.popleft()
    for k in range(4):
        nv=v
        for _ in range(K):
            nv+=+d[k]
            if c[nv]=='.' and dist[nv]>dist[v]:
                if dist[nv]==INF:
                    dist[nv]=dist[v]+1
                    que.append(nv)
            else:
                break
print(dist[gl] if dist[gl]!=INF else -1)

Measured memory_bytes: 214024
#include <algorithm>
#include <cassert>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

bool visited[200000];
long long cnt[200000];
vector<long long> tree[200000];

void dfs(long v) {
  visited[v] = true;
  for (long i = 0; i < tree[v].size(); i++) {
    long nv = tree[v][i];
    if (visited[nv]) {
      continue;
    }
    cnt[nv] += cnt[v];
    dfs(nv);
  }
}

int main() {
  long long n, q, a, b, p, x;
  cin >> n >> q;
  for (long i = 0; i < n; i++) {
    visited[i] = false;
    cnt[i] = 0;
  }

  for (long i = 0; i < n - 1; i++) {
    cin >> a >> b;
    tree[a - 1].push_back(b - 1);
    tree[b - 1].push_back(a - 1);
  }
  for (long i = 0; i < q; i++) {
    cin >> p >> x;
    cnt[p - 1] += x;
  }
  dfs(0);
  for (long i = 0; i < n - 1; i++) {
    cout << cnt[i] << " ";
  }
  cout << cnt[n - 1] << endl;

  return 0;
}


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

int main(){
    int a,b,c,x; cin >> a >> b >> c >> x;
    int ans = 0;
    for(int i=0;i<=a;i++){
        for(int j=0; j<=b;j++){
            for(int k=0;k<=c;k++){
                if(i*500+j*100+k*50 == x){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>

using namespace std;

int f(int n, int d, int acc){
    if(d>n) return 0;
    int ans=0;
    int ds[]={3, 5, 7};
    for(int i=0; i<3; ++i){
        int next_acc=d*ds[i]+acc;
        if(next_acc>n) break;
        unordered_map<int, int> found;
        int tmp=next_acc;
        while(tmp){
            ++found[tmp%10];
            tmp/=10;
        }
        bool ok=true;
        for(int j=0; j<3; ++j){
            if(found.find(ds[j])==found.end()){
                ok=false;
                break;
            }
        }
        if(ok) ++ans;
        ans+=f(n, d*10, next_acc);
    }
    return ans;
}


int main(){
    int n; cin >> n;
    int ans=f(n, 1, 0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define int long long
#define endl "\n"
#define Endl "\n"
#define tests int t1234;cin>>t1234;for(int i1234=1;i1234<=t1234;i1234++)
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);std::cout << std::fixed;std::cout << setprecision(0);
#define takearr(a,n) ll a[n];for(ll i=0;i<n;i++)cin>>a[i]
#define pii pair<int,int>
#define F first
#define S second
#define rep(i,n) for( int i=0;i<(int)n;i++)
#define f(i,a,b) for( int i=(int)a;i<=(int)b;i++)
#define mods ((1000000007))
#define init1d(arr,n,val) for(int i=0;i<n;i++)arr[i]=val;
#define init2d(arr,x,y,val) for(int i=0;i<x;i++)for(int j=0;j<y;j++)arr[i][j]=val;
#define pb push_back
#define mass(vec) (int)vec.size()
#define lb(vec,n,val) ((int)(lower_bound(vec,vec+n,val)-vec))
#define ub(arr,n,val) ((int)(upper_bound(arr,arr+n,val)-arr))


typedef tree<int,null_type, less<>, rb_tree_tag,tree_order_statistics_node_update> oset;
//order_of_key   *find_by_order
typedef tree<int,int, less<>, rb_tree_tag,tree_order_statistics_node_update> omap;
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: ", cerr << to_string(__VA_ARGS__) << endl<<endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); }string to_string(string &s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; }string to_string(const char* s) { string tmp(s); return to_string(tmp); } string to_string(bool b) { return (b ? "true" : "false"); } string to_string(char c){ return string({c}); }template<size_t N> string to_string(bitset<N> &b, int x1=0, int x2=1e9){ string t = ((x1 < b.size()) ? (b.to_string()).substr(x1, x2-x1+1) : "");reverse(begin(t), end(t)); return '"' + t + '"'; }template <typename A, typename... C> string to_string(A (&v), int x1=0, int x2=1e9, C... coords);int l_v_l_v_l = 0, t_a_b_s = 0;template <typename A, typename B> string to_string(pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")";l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' ');string res = ""; bool first = true; if(l_v_l_v_l == 0) res += endl; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1);auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++;if(e != l){ if(rnk > 1) { res += endl; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]";if(l_v_l_v_l == 0) res += endl; return res; }

int c2(int x)
{
  int y=x*(x-1);return y/2;

}

/**
 * a e i o u
 * e i o u a
 * i o u a e
 * o u a e i
 * u a e i o
 * @return
 */

int32_t main(){
  fastio;
  int n,k;cin>>n>>k;
  string s;cin>>s;
  s[k-1]=s[k-1]-('A'-'a');
  cout<<s<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
long long counter=0;
long long n;
cin>>n;
long long b[n]={};
long long a[n]={};
for(long long i=0; i<n; i++){
cin>>a[i]>>b[i];}
for(long long i=n-1; i>=0; i--){
if((a[i]+counter)%b[i]==0){
continue;}
else{
counter+=b[i]-(a[i]+counter)%b[i];}}
cout<<counter<<endl;}



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

int main(int argc, char const *argv[]) {
    int A, B, num=0;
    cin >> A >> B;

    while(1) {
        if (A*num-(num-1) >= B) {
            break;
        } else {
            num++;
        }
    }

    cout << num << endl;

    return 0;
}


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

signed main(){
  int A,B,K;
  cin>>A>>B>>K;
  for(int i=A;i<=min(B,A+K-1);i++)cout<<i<<endl;
  for(int i=max(B-K+1,A+K);i<=B;i++)cout<<i<<endl;
}

Measured memory_bytes: 256
import os
import sys

import numpy as np

# from libs.debug import debug

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N = int(sys.stdin.buffer.readline())
C = list(map(int, sys.stdin.buffer.readline().split()))
C.sort()

#
# @debug
# def f(S, T, C):
#     S = np.array(S, dtype=bool)
#     T = np.array(T, dtype=bool)
#     C = np.array(C, dtype=int)
#     costs = np.msort(C[S != T])
#     return int(np.dot(costs[::-1], np.arange(1, len(costs) + 1)))
#
#
# def test(N, C):
#     ans = 0
#     for s in itertools.product([True, False], repeat=N):
#         for t in itertools.product([True, False], repeat=N):
#             ans += f(s, t, C)
#             ans %= MOD
#     print(ans)
#
#
# test(N, C)

# R = np.zeros((N + 1, N), dtype=int)
# R[0] = 0
# R[1] = 1
# for r in range(2, N + 1):
#     for c in range(N):
#         R[r, c] = R[r - 1][:c].sum()
# print(R)
# print(R * np.arange(N + 1)[:, None])
# print(R * np.arange(N + 1)[:, None] * (2 ** np.arange(N)[::-1]))
# print(R * np.arange(N + 1)[:, None] * (2 ** np.arange(N)[::-1]) * np.msort(C)[::-1])
# print((R * np.arange(N + 1)[:, None] * (2 ** np.arange(N)[::-1]) * np.msort(C)[::-1]).sum())
# print((R * np.arange(N + 1)[:, None] * (2 ** np.arange(N)[::-1]) * np.msort(C)[::-1]).sum() * (2 ** N) % MOD)
#
# print()
# print(R * np.arange(N + 1)[:, None] * (2 ** np.arange(N)[::-1]))
# print((R * np.arange(N + 1)[:, None] * (2 ** np.arange(N)[::-1])).sum(axis=0))
# print(np.diff((R * np.arange(N + 1)[:, None] * (2 ** np.arange(N)[::-1])).sum(axis=0)))

if N == 1:
    arr = np.ones(1, dtype=int)
else:
    arr = np.full(N + 1, pow(2, N - 2, MOD), dtype=int)
    arr = arr.cumsum()[1:]
    arr %= MOD
# print(arr)
ans = arr * np.msort(C)[::-1] % MOD
print(sum(ans) % MOD * pow(2, N, MOD) % MOD)
# print(ans.sum() * pow(2, N, MOD) % MOD)


Measured memory_bytes: 31020
n, t = map(int, input().split())
a = list(map(int, input().split()))

profit = 0
prof_n = 0

mn = 0
for i in range(n):
    if i == 0:
        mn = a[i]
        continue
    if a[i] < mn:
        mn = a[i]
    else:
        if a[i] - mn > profit:
            profit = a[i] - mn
            prof_n = 1
        elif a[i] - mn == profit:
            prof_n += 1

ans = prof_n
print(ans)


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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;

    vi a(n);
    rep(i, n) cin >> a[i];

    vpii v(n);
    rep(i, n) {
        v[i].first = a[i];
        v[i].second = i;
    }

    sort(all(v));

    rep(i, n) cout << v[i].second + 1 <<  " ";
    cout << endl;

    return 0;
}


Measured memory_bytes: 2048
n=int(input())
A=sorted(list(map(int,input().split())))
cnt=0

B=[0]*n
B[0]=A[0]

for i in range(1,n):
  B[i]=B[i-1]+A[i]

for i in range(n-1,0,-1):
  if B[i-1]*2>=A[i]:
    cnt+=1
  else:
    break

print(cnt+1)

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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  for(int i=0;i<3;i++){
    string s;cin>>s;
    cout<<s[i];
  }
  cout<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <map>
#include<queue>

const int INF = 1 << 28;
const long long MOD = 1000000007;
using namespace std;
using Graph = vector<vector<int>>;

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

vector<int> seen(50,-1);
int counter_for_dfs = 0;
void dfs(Graph &G, int v) {
	seen[v] = counter_for_dfs;
	counter_for_dfs++;
	for (auto v_next : G[v]) {
		if (seen[v_next]>=0)continue;

		dfs(G, v_next);
	}
}

void bfs(Graph &G) {
	vector<int> dist(G.size(), -1);
	queue<int> que;
	
	dist[0] = 0;
	que.push(0);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
		}
	}
	for (auto i : dist) {
		cout << i << " ";
	}
}

int counter[200005] = {};
void bfs2(Graph &G,int p,int x) {
	vector<int> dist(G.size() , -1);
	queue<int> que;
	
	dist[p] = 0;
	que.push(p);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
			counter[g] += x;
		}
	}
}
int main()
{
	std::string s, t;
	std::cin >> s >> t;
	int reslt = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i])reslt++;
	}
	std::cout << reslt;
	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll x;cin>>x;
  ll i,j,k=1;
  string s;
  while(k*(k+1)/2<x) k++;
  for(j=0;j<2;j++) for(i=0;i<k;i++) s+=')'-j;
  for(i=0;i<k*(k+1)/2-x;i++){
    swap(s[k-i-1],s[k-i]);
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3340
import std.stdio, std.conv, std.string, std.algorithm;
import std.array, std.conv, std.c.string;
 
long[102][1001][10] table;

// 再帰で解く
long solve_rec(int comb, int limit, int start) {
  long counter = 0;
  if (comb <  0 || limit <  0)  return 0;
  if (comb == 0 && limit == 0) return 1;
  if (table[comb][limit][start] >= 0) return table[comb][limit][start];
  for(int i = start; i <= 100; i++) {
    counter += solve_rec(comb - 1, limit - i, i + 1);
  }
  return table[comb][limit][start] = counter;
}
 
void main() {
  memset(cast(void *)table, -1, table.sizeof);
  while(true) {
    int[] line = readln.chomp.split(" ").map!(to!(int)).array;
    if (line[0] == 0 && line[1] == 0) break;
    int comb = line[0];
    int limit = line[1];
    solve_rec(comb, limit, 0).writeln;
    // writeln(table[comb][limit][100]);
  }
}

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

double distan(double a,double b){
	return sqrt(4*a*b);
}

int main(){
	int n;
	cin>>n;
	vector<double> r(n),m(n,0),right(n),left(n);
	for(int i=0;i<n;i++){
	cin>>r[i];
	}
	double ans = 0;
	left[0] = 0;
	right[0] = 2*r[0];
	m[0] = r[0];
	for(int i=1;i<n;i++){
		bool flag = false;
		for(int j = i-1;j>=0;j--){
			double d = distan(r[i],r[j]);
			m[i] = max(d+m[j],m[i]);
		}		
		m[i] = max(m[i],r[i]);
		right[i] =  m[i] + r[i];
	//ans += max(r[i],max(distan(r[i],r[i+1]),r[i+1]));
	}
	sort(right.begin(),right.end());
	printf("%0.10lf\n",right[n-1]);
	
	
	return 0;
}



Measured memory_bytes: 3356
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a) memset(a,0,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main()
{
    int n,m;
    cin>>n>>m;
    int a[n];
    int sum=0;
    rep(i,0,n)
    {
        cin>>a[i];
        sum+=a[i];
    }
    int p=sum/(4*m);
    if(sum%(4*m)!=0)
        p++;
    int cnt=0;
    rep(i,0,n)
    {
        if(a[i]>=p)
            cnt++;
    }
    if(cnt>=m)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int main() {
    int a[3];
    int ret_a = 0;
    int ret_b = 0;
    while(~scanf("%d,%d,%d",&a[0], &a[1], &a[2])) {
        if(a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) ret_a++;
        if(a[0] == a[1]) ret_b++;
    }
    cout << ret_a << endl;
    cout << ret_b << endl;
    return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MX=4*1e5+100;
const long long INF = 1e18;
int N, M;
int main()
{
    string s;
    cin>>s;
    vector<char> ans;
    for(int i=0;i<s.size() - 8;i++) ans.pb(s[i]);
    for(int i=0;i<ans.size();i++)
        cout<<ans[i];
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 
    LL D;
    cin>>D;
    LL c[26];
    LL mem[26];
    for(int i=0;i<26;i++){
        mem[i]=0;
    }
    for(int i=0;i<26;i++){
        cin>>c[i];
    }
    LL ans[D];
    for(int i=0;i<D;i++){
        LL rem=D-i;
        vector<P> v;
        for(int j=0;j<26;j++){
            LL x;
            cin>>x;
            P p;
            p.first=x+(i-mem[j]+1)*rem*c[j];
            p.second=j;
            v.push_back(p);
        }
        sort(v.begin(),v.end());
        P p=v.back();
        ans[i]=p.second;
        mem[p.second]=i+1;

        /*for(int j=0;j<v.size();j++){
            cout<<v[j].first<<' '<<v[j].second<<endl;
        }
        cout<<endl;*/

    }

    for(int i=0;i<D;i++){
        cout<<ans[i]+1<<endl;
    }
    return 0;
}

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

int main(){
    int n,k,ans = 0;
    cin >> n;         
    vector<int> d(n);

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

    sort(d.begin(),d.end());  
    ans = d[n/2] - d[n/2-1];  
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MAX int(2 * 1e5 +5)


int main(){
    int n;
    cin >> n;
    int A[MAX];
    REP(i,n) scanf("%d",&A[i]);
    A[n] = -1;
    llong ans = 0;
    REPR(i,n-1){
        if(A[i] == A[i + 1] -1) continue;
        if( A[i] > i or A[i] < A[i+1] -1){
            cout << -1 << endl;
            return 0;
        }
        ans += A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	string s;
	while(cin>>s,s!="#"){
		int n=s.size();
		rep(i,n){
			int t=s[i]-'0';
			t--;t%=3;
			s[i]=t+'0';
		}
		int out=inf;
		rep(q,2){
			bool h=q;
			int co=0;
			loop(i,1,n){
				if(h&&s[i-1]<=s[i]||!h&&s[i-1]>=s[i])
					h^=true;
				else{
					co++;
				}
			}
			out=min(out,co);
		}
		cout<<out<<endl;
	}
}
 
 

Measured memory_bytes: 1312
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define ll long long

int main(void){
    ll n, k, s;
    cin >> n >> k >> s;
    vector<ll> ans(n);
    for(ll i = 0;i < n;++i){
        if(i < k){
            ans[i] = s;
        }else{
            if(s == 1000000000){
                ans[i] = s-1;
            }else{
                ans[i] = s+1;
            }
        }
    }

    for(ll i = 0;i < n;++i){
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2048
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if((a==5&&b==5&&c==7)||
	   (a==5&&b==7&&c==5)||
	   (a==7&&b==5&&c==5))
	   {
	   		printf("YES\n");
	   }
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 3680
#include <set>
#include <map>
#include <ctime>
#include <cmath>
#include <queue>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define PII pair<int,int>
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,b,a) for (int i=(b);i>=(a);--i)
typedef long long LL;
inline int read(){
	int x=0,g=1; char ch=getchar();
	while (ch<'0'||ch>'9') { if (ch=='-') g=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*g;
}

const int MAXN=300005,Mo=1000000007;
struct list{
	int l,lt[MAXN],nt[MAXN],x[MAXN],y[MAXN];
	void clear(){ l=0; memset(lt,0,sizeof(lt)); }
	void addedge(int a,int b){ l++; nt[l]=lt[a]; lt[a]=l; x[l]=b; }
}E;
int a,b,c,d,e,f,x[MAXN],y[MAXN];
int main(){
	a=read(); b=read(); c=read();
	d=read(); e=read(); f=read();
	memset(x,0,sizeof(x));
	memset(y,0,sizeof(y));
	FOR(i,0,30)
		FOR(j,0,30) x[a*100*i+b*100*j]=1;
	FOR(i,0,100)
		FOR(j,0,100) y[c*i+d*j]=1;
	int ans1=0,ans2=0;
	FOR(i,0,3000)
		FOR(j,0,3000)
		if (i+j<=f&&y[i]&&x[j]&&e*(i+j)>=i*(100+e)) {
			if (ans1*(i+j)<=ans2*i) {
				ans1=i; ans2=i+j;
			}
		}
	cout<<ans2<<' '<<ans1<<endl;
	return 0;
}

/*
*/


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

int main() {
	string s, ans;
	cin >> s;
	int n;
	n = s.length();
	int judge = 0;
	ans = "Yes";
	for (int i = 0; i < n; i++) {
		if ((judge == 0 && s[i] == 'L') || (judge == 1 && s[i] == 'R')) {
			ans = "No";
		}
		judge = 1 - judge;
	}
	cout << ans << endl;
	cin >> s;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm> // to use min_element

using namespace std;


int main(){
	int n;
	vector<int> numlst;

	cin >> n;
	int m, i, j;
	for (i=0;i<n;i++){
		cin >> m;
		numlst.push_back(m);	
	} 
	sort(numlst.begin(), numlst.end(),  [](int x, int y) -> int {return ( x > y );});
	int scoreA=0, scoreB=0;
	// for (i=0; i<n;i++) cout <<numlst[i]<<" ";
	for (j=0;j<n;j++){
		if (j%2==0){
		scoreA+=numlst[j];	
		}else{
		scoreB+=numlst[j];	
		}


	}


	
	cout << (scoreA-scoreB)<<endl;

return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int insertion_sort(long *A, int N, int g)
{
    int i, cnt = 0;
    for (i = g; i < N; i++) {
        long v = A[i];
        int j = i - g;
        while (j >= 0 && A[j] > v) {
           A[j + g] = A[j];
           j = j - g;
           cnt++;
        }
        A[j + g] = v;
    }
    return cnt;
}
 
int shell_sort(long *A, int N, int *G, int m)
{
    int i, cnt = 0;
    for (i = m - 1; i >= 0; i--) {
       cnt += insertion_sort(A, N, G[i]);
    }
    return cnt;
}
 
int main(int argc, char** argv)
{
    int i, num, g[100], m = 0; 
    long arr[1000000];
  
    scanf("%d", &num);
    for (i = 0; i < num; i++) {
        scanf("%ld", &arr[i]);
    }
 
    g[0] = 1;
    for (i = 1; i < 100; i++) {
        g[i] = 3 * g[i - 1] + 1;
        if (num < g[i]) {
            m = i;
            break;
        }
    }
     
    int cnt = shell_sort(arr, num, g, m);
 
    printf("%d\n", m);
    for (i = m - 1; i >= 0; i--) {
        if (i == 0) {
            printf("%d\n", g[i]);
        }
        else {
            printf("%d ", g[i]);
        }
    }
    printf("%d\n", cnt);
 
    for (i = 0; i < num; i++) {
        printf("%ld\n", arr[i]);
    }
    return 0;
}

Measured memory_bytes: 8412
#include <stdio.h>
#include <math.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int data[n],max,min,ave;
	long sum = 0;
	for(i = 0;i < n;i++){
		scanf("%d",&data[i]);
	}
	max = data[0];
	min = data[0];
	for(i = 0;i < n;i++){
		if(data[i]>max){
			max=data[i];
		}
		if (data[i]<min)
		{
			min = data[i];
		}
		sum = sum + data[i];
	}
	printf("%d %d %ld\n",min,max,sum);
	return 0;
}

Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))
dp = [[0] * n for _ in range(n)]
for i in range(n):
    dp[i][i] = a[i]

for i in range(n - 2, -1, -1):
    for j in range(i + 1, n):
        dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1])

print(dp[0][n - 1])


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef pair<pair<int,int>,bool> piib;

const ll N=2e5+10;
const int MOD=1e9+7;


ll n,m,k;
ll arr1[N],arr2[N];

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

    //freopen("mosalah.in","r",stdin);

    #ifndef ONLINE_JUDGE
        //freopen("input.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #endif // ONLINE_JUDGE

    cin >> n >> m >> k;
    for(int i = 0; i < n; i++)
    {
        cin>>arr1[i];
        if(i)
            arr1[i]+=arr1[i-1];
    }
    for(int i = 0; i < m; i++)
    {
        cin>>arr2[i];
        if(i)
            arr2[i]+=arr2[i-1];
    }
    ll mx = upper_bound(arr2,arr2+m,k)-arr2;
    /*for(int i = 0; i < n; i++)
        cout << arr1[i] << " ";
    cout << endl;
    for(int i = 0; i < m; i++)
        cout << arr2[i] << " ";
    cout << endl;*/
    for(int i = 0; i < n; i++)
    {
        if(arr1[i]<=k)
        {
            if(arr2[m-1]<=k-arr1[i])
                mx=max(mx,m+(i+1));
            else if(arr2[0]<=k-arr1[i])
                mx = max(mx, (ll)(i+1)+(upper_bound(arr2,arr2+m,k-arr1[i])-arr2));
            else
                mx=max(mx,(ll)i+1);
            
        }
    }
    //cout << k-arr1[1] << endl;
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 6764
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val a, b = sc.nextInt
    var ans = ""
    if (a < b) {
      ans = "a < b"
    }
    else if (a > b) {
      ans = "a > b"
    }
    else {
      ans = "a == b"
    }
    println(ans)

  }
}

Measured memory_bytes: 44840
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;
const int RED=1000000;

int main(){
    int n; cin>>n;
    int a[3*n]; rep(i,3*n) cin>>a[i];
    sort(a,a+3*n);
    long long ans=0;
    for(int i=n;i<3*n;i+=2){
        ans+=a[i];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1408
# INF = 400000000

# import sys
# L, R = list(map(lambda x: int(x), input().split()))
# # この場合は0,1,2,~~2018の数字がmodで出てくる。ので最小値は決まっている。
# if R - L >= 2019:
#   print(0)
#   sys.exit()

# m = INF

# for l in range(R - L):
#   for r in range(1, R - L - l + 1):
#     a = (L+l) % 2019
#     b = (L+l+r) % 2019
#     m = min(m, a*b)

# print(m)
L, R = map(int, input().split())
 
ans = 400000000
for i in range(L, R+1):
    for j in range(L, i):
        ans = min(ans, (i*j)%2019)
    if ans == 0:
        print(ans)
        exit()
print(ans)

Measured memory_bytes: 2940
str=input().split()
stack=[]
for i in range(len(str)):
	if str[i].isdigit():
		stack.append(int(str[i]))
	else:
		y=stack.pop()
		x=stack.pop()
		if str[i]=='+':
			stack.append(x+y)
		elif str[i]=='-':
			stack.append(x-y)
		elif str[i]=='*':
			stack.append(x*y)
print(stack.pop())


Measured memory_bytes: 5604
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        if (scanner.hasNextLine()) {
            String line = scanner.nextLine();

            if (line.length() == 3 && line.indexOf('a') >= 0 && line.indexOf('b') >= 0  && line.indexOf('c') >= 0 ) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}

Measured memory_bytes: 25044
#include<bits/stdc++.h>
#define FAST_IO   ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define Relocate freopen("./in.txt","r",stdin),freopen("./out.txt","w",stdout)
#define up(mi,a,b) for(mi=a;mi<=b;++mi)
#define down(mi,b,a) for(mi=b;mi>=a;--mi)
#define mfill(a,v) memset(a,v,sizeof(a))
#define INF 0x3f3f3f3f
#define MAX 1005
#define v_n 5005
#define LL long long
#define ULL unsigned long long 
#define e_n 50005
#define eps 0.000000001
#define Blen 32
const LL MOD = 998244353;
using namespace std;
char g[MAX][MAX];

int H, W;
int cnt = 0;
bool inR(int x, int y)
{
	return x >= 1 && x <= H && y >= 1 && y <= W;
}
int dir[4][2] = { {0,1},{0,-1},{1,0},{-1,0} };
struct p {
	int x, y;
	bool f;
};
queue<p> que;
bool flag;
void bfs()
{
	while (que.size())
	{
		auto one = que.front();
		if (one.f != flag) break;
		que.pop();
		for (int i = 0; i < 4; i++)
		{
			int cx = one.x + dir[i][0];
			int cy = one.y + dir[i][1];
			if (inR(cx, cy) && g[cx][cy] == '.')
			{
				g[cx][cy] = '#';
				cnt++;
				que.push(p{ cx,cy,!flag });
			}
		}
	}
}
int main(void)
{
	int i, j, k;
	//Relocate;
	FAST_IO;
	scanf("%d%d", &H, &W);
	up(i, 1, H)
	{
		scanf("%s", g[i] + 1);
	}
	flag = 0;
	up(i, 1, H)
	{
		up(j, 1, W)
		{
			if (g[i][j] == '#')
			{
				que.push(p{ i,j,0 });
				cnt++;
			}
		}
	}
	int ans = 0;
	while (cnt < H*W)
	{
		bfs();
		ans++;
		flag = !flag;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 13328
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main(){
	int a = 0, b = 0, c=0, d[100000], e[100000],f=0, count = 0;
	char uc[100000];
	cin >> a >> b >> c;
	if (a*b > c) {
		cout << c << endl;
	}
	else { cout << a * b << endl; }

		return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>

using namespace std;

#define typec long long
#define V 111
typec g[V][V], w[V];
typec a[V], v[V], na[V];

typec Stoer_Wagner(int n)
{
    typec i, j, pv, zj,I=1;
    typec best = I<<32;
    for (i = 0; i < n; i++) v[i] = i; // vertex: 0 ~ n-1
    while (n > 1)
    {
        for (a[v[0]] = 1, i = 1; i < n; i++)
        {
            a[v[i]] = 0;
            na[i - 1] = i;
            w[i] = g[v[0]][v[i]];

        }
        for (pv = v[0], i = 1; i < n; i++ )
        {
            for (zj = -1, j = 1; j < n; j++ )
                if (!a[v[j]] && (zj < 0 || w[j] > w[zj]))

                    zj = j;
            a[v[zj]] = 1;
            if (i == n - 1)
            {
                if (best > w[zj]) best = w[zj];
                for (i = 0; i < n; i++)
                    g[v[i]][pv] = g[pv][v[i]] += g[v[zj]][v[i]];
                v[zj] = v[--n];
                break;
            }
            pv = v[zj];
            for (j = 1; j < n; j++)
                if(!a[v[j]])
                    w[j] += g[v[zj]][v[j]];
        }
    }
    return best;
}
bool vis[111];
void dfs(int u,int n)
{
    for(int v=0;v<n;++v)
        if(g[u][v]!=0&&vis[v]==0)
    {
        vis[v]=1;
        dfs(v,n);
    }
}
bool ok(int n)
{
    for(int i=0;i<n;++i)
        if(vis[i]==0)return 1;
    return 0;
}
int main()
{
    //freopen("G:\\in.txt","r",stdin);
    int n, m, u, v, w;
    while(scanf("%d%d", &n, &m),n+m)
    {
        memset(g, 0, sizeof(g));
        typec ans=0;
        while(m --)
        {
            scanf("%d%d%d", &u, &v, &w);
            if(w<=0)ans+=w;
            else  g[v][u]= g[u][v] = w;

        }
       // memset(vis,0,sizeof(vis));
        //dfs(0,n);
        //if(ok(n))puts("0");
         printf("%lld\n", ans+Stoer_Wagner(n));
    }
    return 0;
}

Measured memory_bytes: 1296
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long

int main(){
  int n,k,ans=0;
  scanf("%d %d",&n,&k);
  do{
    n=n-k+1;
    ans+=1;
    if(n-1<=0){
      goto skip;
    }
  }while(1);
  
  skip: printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin); i < (end); i++)
#define _irep3(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  ll A, B, K;
  cin >> A >> B >> K;
  if (K < A) {
    A -= K;
  } else if (K < A + B) {
    B -= K - A;
    A = 0;
  } else {
    A = 0;
    B = 0;
  }
  cout << A << " " << B << "\n";
}


Measured memory_bytes: 256