akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define min(a, b) (a > b ? b : a)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll nck(int n, int k) { ll ret = 1; rep(i, k) {ret *= n - i; ret /= i + 1; } return ret; } // n <= 60
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


int n, k;



int easy() {
    int m = pow(2, n) - 1;
    if (k == 0) {
        rep(i, m + 1) {
            if (i) cout << " ";
            cout << i;
            cout << " ";
            cout << i;
        }
        cout << endl;
        return 2;
    }
    
    if (n == 0) {
        if (k >= 1) return 1;
        cout << "0 0" << endl;
        return 2;
    }
    
    
    
    return 0;
}

int hard() {
    int m = pow(2, n) - 1;
    
    if (m < k) return 1;
    
    int tmp = 0;
    rep(i, m + 1) { if (i == k) continue; tmp ^= i; }
    if (tmp != k) return 1;
    return 0;
}
void solve() {
    
    
    int ea = easy();
    if (ea) {
        if (ea == 1) out(-1);
        return;
    }
    if (hard()) { out(-1); return; } // easyの後 sample1
    
    int m = pow(2, n) - 1;
    
    
    vector<int> ans;
    rep(i, m + 1) { if (i == k) continue; ans.eb(i); }
    ans.eb(k);
    for (int i = m; i >= 0; --i) {
        if (i == k) continue;
        ans.eb(i);
    }
    ans.eb(k);
    
    outa(ans, SZ(ans));
    
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n >> k;
    
    solve();
}




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

using ll = long long;
#define repi(n) for (int i = 0; i < n; i++)
#define repj(n) for (int j = 0; j < n; j++)
#define repk(n) for (int k = 0; j < n; k++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (auto i = a; i < b; i++)
#define repv(itr) for (auto&& v : itr)
#define swap(x, y)    \
  {                   \
    auto ___temp = x; \
    x = y;            \
    y = ___temp;      \
  }

const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}

int uft[100000], tsize[100000];
int top(int n) {
  if (uft[n] == n) return n;
  return uft[n] = top(uft[n]);
}
bool uni(int a, int b) {
  int at = top(a), bt = top(b);
  if (at == bt) return false;
  uft[max(at, bt)] = min(at, bt);
  tsize[at] = tsize[bt] = tsize[at] + tsize[bt];
  return true;
}
int gsize(int n) {
  return tsize[top(n)];
}
int a[100000], b[100000];
int main() {
  ll n, m;
  cin >> n >> m;
  repi(n) {
    uft[i] = i;
    tsize[i] = 1;
  }
  repi(m) {
    cin >> a[m - 1 - i] >> b[m - 1 - i];
    a[m - 1 - i]--;
    b[m - 1 - i]--;
  }
  vector<ll> re(m);
  ll ss = n * (n - 1) / 2;
  repi(m) {
    re[m - 1 - i] = ss;
    ll g1 = gsize(a[i]), g2 = gsize(b[i]);
    if (uni(a[i], b[i])) ss -= g1 * g2;
  }
  repv(re) cout << v << endl;
}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> path(n);
    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        if (a != 1)
        {

            path[a - 1]++;
        }
        if (b != 1)
        {
            path[b - 1]++;
        }
    }
    bool ans = true;
    rep(i, n)
    {
      //  cout << path[i] << endl;
        if (path[i] % 2 != 0)
        {
        //    cout << i + 1 << endl;
            ans = false;
        }
    }
    if (ans)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

    int A[200010];
    int cnt[200010];
    int B[200010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;

    rep(i, N) {
        cin >> A[i];
        B[i] = A[i];
    }
    sort(B, B + N);
    rep(i, N) {
        if (A[i] != B[N - 1]) {
            cout << B[N - 1] << endl;
        } else {
            cout << B[N - 2] << endl;
        }
    }




    return 0;
}


Measured memory_bytes: 3200
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int c[9][9];
map<ll, int> prime_factor(ll num) {
	map<ll, int> mp;
	ll k = (ll)sqrt(num);
	mp[1]++;
	rep(i, 2, k + 1) {
		while (num % i == 0) {
			num /= i;
			mp[i]++;
		}
	}
	if (num != 1)mp[num]++;
	return mp;
}
//mpの各要素は(first:素因数, second:指数)
//mp.size()にすれば素因数が何種類かを取得できる
//1が含まれることに注意
const ll mod = 1000000007;
int main() {
	ll N, r = 1, num, k;
	cin >> N;
	map<ll, ll> mp;
	rep(i, 1, N + 1) {
		num = i;
		k = (ll)sqrt(i);
		rep(i2, 2, k + 1) {
			while (num % i2 == 0) {
				num /= i2;
				mp[i2]++;
			}
		}
		if (num != 1)mp[num]++;
	}
	for (auto m : mp) {
		r *= (m.second + 1);
		r %= mod;
	}
	printf("%lld\n", r);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
using namespace std;

signed main(){
    multimap<string,int> map;
    int q;
    cin>>q;
    while(q--){
        int y;
        string k;
        cin>>y>>k;
        if(y==0){
            int x;
            cin>>x;
            map.insert(pair<string,int>(k,x));
        }
        else if(y==1){
            for(auto it=map.find(k);it!=map.end()&&it->first==k;it++){            
                cout<<it->second<<endl;
            }
        }
        else if(y==2){
            map.erase(k);
        }
        else{
            string z;
            cin>>z;
            for(auto it=map.lower_bound(k);it!=map.upper_bound(z);it++){
                cout<<it->first<<" "<<it->second<<endl;
            }
        }
    }
    return 0;
}


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		2000000007
#define MINF		-2000000007
#define MAX 		100005

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//



//
int main(){
	int N;
	ll K;cin>>N>>K;
	vector<P> a(N);
	REP(i,N)cin>>a[i].first>>a[i].second;

	sort(ALL(a));

	ll suml=0;
	int ans=-1;
	REP(i,N){
		suml+=a[i].second;
		if(suml>=K){
			ans = a[i].first;
			break;
		}
	}
	cout << (ans != -1 ? ans : a[a.size()-1].first) << endl;

	return 0;
}




Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		long x = scn.nextLong();
		long ans = 0;
		ans += (x/11)*2;
		x%=11;
		if(x!=0) {
			ans += x>6?2:1;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 25300
#include<iostream>  
#include<cstdlib>  
#include<string>  
#include<ctime>  
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	long long a, b, c, x, y,ans;
	cin >> a >> b >> c >> x >> y;
	ans = a*x + b*y;
	if (ans > max(x, y)*c* 2)
	{
		ans = max(x, y)*c * 2;
	}
	if (x > y)
	{
		if (ans > (x - y) * a + y * 2 * c)
		{
			ans = (x - y) * a + y * 2 * c;
		}
	}
	else
	{
		if (ans > (y - x)* b + x * 2 * c)
		{
			ans = ans = (y-x) * b + x* 2 * c;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n, k;
string s;

vector<int> block;
int num[MAX_N];

int ans;

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &k);

  cin >> s;

  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      if (i == 0 || s[i - 1] == '1') {
        num[i] = 1;
      }
    }
  }

  for (int i = 1; i < n; ++i) {
    num[i] += num[i - 1];
  }

  num[n] = num[n - 1] + 1;

  int cnt = num[n - 1];

  if (k >= cnt) {
    printf("%d\n", n);
    return 0;
  }

  ans = -1;

  for (int i = 0; i < n; ++i) {
    int add = (s[i] == '0') ? k - 1 : k; // already using 0 part

    auto itr = upper_bound(num + i, num + n + 1, num[i] + add);

    int ind = (itr - num) - 1;

    int tmp = num[ind];
    if (tmp - num[i] != add) break;

    int score = ind - i + 1;

    ans = max(ans, score);
  }
  
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint A, B; cin >> A >> B;
    cout << A * B / __gcd(A, B) << "\n";
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
A.sort()
m=A[0]
if m>=0:
    M=sum(A)-2*m
    print(M)
    s=A[0]
    for i in range(0,N-1):
        if i!=N-2:
            print(s,A[i+1])
            s-=A[i+1]
        else:
            print(A[N-1],s)
else:
    if A[N-1]>0:
        start=0
        end=N-1
        while end-start>1:
            test=(end+start)//2
            if 0>A[test]:
                start=test
            else:
                end=test
        if 0>A[end]:
            mid=end
        else:
            mid=start
        M=sum(abs(A[i]) for i in range(0,N))
        print(M)
        s=A[0]
        for i in range(mid+1,N):
            if i!=N-1:
                print(s,A[i])
                s-=A[i]
            else:
                print(A[N-1],s)
                s=A[N-1]-s
        for i in range(1,mid+1):
            print(s,A[i])
            s-=A[i]
    else:
        M=-sum(A)+2*A[N-1]
        print(M)
        s=A[N-1]
        for i in range(0,N-1):
            print(s,A[i])
            s-=A[i]


Measured memory_bytes: 60940
#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std;
int main (){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    sort(a.begin(),a.end(),greater<int>());
    int alice = 0,bob = 0;
    rep(i,n){
        if(i %2)bob+=a[i];
        else alice += a[i];
    }
    cout << alice-bob <<endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
Fm = [0]*M
KA = [list(map(int, input().split())) for _ in range(N)]
for n in range(N):
  #KA = list(map(int, input().split()))
  for i in range(KA[n][0]):
    Fm[KA[n][i+1]-1] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>

using namespace std;

typedef long long ll;

int main() {
    int N;
    vector<int> C, S, F;
    cin >> N;
    for (int i = 0; i < N - 1; ++i) {
        int c, s, f;
        cin >> c >> s >> f;
        C.push_back(c);
        S.push_back(s);
        F.push_back(f);
    }
    
    for (int i = 0; i < N - 1; ++i) {
        int x = 0;
        for (int j = i; j < N - 1; ++j) {
            if (x <= S[j])
                x = S[j] + C[j];
            else {
                if (x % F[j] == 0)
                    x = x + C[j];
                else
                    x = (x / F[j] + 1) * F[j] + C[j];
            }
        }
        printf("%d\n", x);
    }
    
    printf("0\n");
    
    return 0;
}


Measured memory_bytes: 256
s = input()
K = int(input())

t = []

for i in range(len(s)):
    c=ord(s[i])-97
    if i!=len(s)-1:
        if c!=0:
            if K>=26-c:
                K-=26-c
                t.append("a")
            else:
                t.append(chr(97+c))
        else:
            t.append("a")
    else:
        t.append(chr(97+(c+K)%26))

print("".join(t))

Measured memory_bytes: 46576
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
string s,w;

int main(){
	cin >> s >> w;
	if(s.size()==w.size()){
		REP(i,0,s.size()){
			if(s[i]<w[i]){cout << "LESS" << endl; return 0;}
			else if(s[i]>w[i]){cout << "GREATER" << endl; return 0;}
			else continue;
		}
		cout << "EQUAL" << endl;
	}else if(s.size()<w.size()){
		cout << "LESS" << endl;
	}else{
		cout << "GREATER" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	long a,b,k;
	C3(a,b,k);
	
	int num = a;
	while( num < a+k && num < b+1){
		P(num++);
	}
	
	if(b-k+1 > a+k){
		num = b-k+1;
		rep(i,num,b+1)
			P(i);
	}
	else{
		if(a+k < b+1){
			num = a+k;
			rep(i,num,b+1)
				P(i);
		}
	}

	
	ret 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int w,h,x,y,r;
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
    if(x-r >= 0 && x+r <= w && y-r >= 0 && y+r <= h)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
} 

Measured memory_bytes: 584
s = input()
t = input()
mx = 0
for i in range(0, len(s)-len(t)+1):
    # print(i)
    k = 0
    cnt = 0
    for j in t:
        # print(s[i], j)
        if s[i+k]==j:
            cnt+=1
            mx = max(cnt, mx)
        k+=1
print(len(t)-mx)

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

int main(){
    int a,b;
    cin >> a >> b;
    
    int x = 0;
    while(true){
        if (a*x - x + 1 >= b){
            cout << x << endl;
            return 0;
        }else{
            x++;
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <memory>
#include <numeric>

#include <array>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <ostream>
#include <type_traits>
#include <utility>
#include <chrono>

#ifdef ONLINE_JUDGE
#pragma GCC optimize ("O3")
#pragma GCC target ("avx,avx2")
#endif

using namespace std;

using u64 = uint64_t;
using i64 = int64_t;
using u32 = uint32_t;
using vi = vector<int>;
using vi64 = vector<i64>;

#define seq(i,a,b) for (int i = (a); i < (b); ++i)
#define rev(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define sz(x) (x.size())
#define all(x) x.begin(), x.end()
#define dbg(x) {cerr << #x << ": " << x << endl;}

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

    int n,maxw; cin >> n >> maxw;
    vi64 dp(maxw + 1);
    dp[0] = 0;

    seq(_,0,n) {
        int w,v; cin >> w >> v;
        rev(i,0,maxw-w+1) {
            dp[i+w] = max(dp[i] + v, dp[i+w]);
        }
    }
    cout << dp[maxw] << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
    
int n, a, b, c, d;
string s;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> n >> a >> b >> c >> d;
    cin >> s;
    
    if (c < d)
    {
        while (b != d)
        {
            if (s[b] == '.')
                ++b;
            else if (s[b + 1] == '.')
                b += 2;
            else
            {
                cout << "No" << '\n';
                return 0;
            }
        }
        
        while (a != c)
        {
            if (s[a] == '.')
                ++a;
            else if (s[a + 1] == '.')
                a += 2;
            else
            {
                cout << "No" << '\n';
                return 0;
            }
        }
    }
    else
    {
        while (a != c)
        {
            if (s[a] == '.' && a + 1 != b)
                ++a;
            else if (s[a + 1] == '.' && a + 2 != b)
                a += 2;
            else if (s[a] == '#' && s[a + 1] == '#')
            {
                cout << "No" << '\n';
                return 0;
            }
            else if (b < n && s[b] == '.')
                ++b;
            else if (b + 1 < n && s[b + 1] == '.')
                b += 2;
            else
            {
                cout << "No" << '\n';
                return 0;
            }
        }
        
        if (b > d)
        {
            cout << "No" << '\n';
            return 0;
        }
    }
    
    cout << "Yes" << '\n';
    return 0;
}

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

void trace(int A[], int N){
  for(int i = 0; i<N; i++){
    if(i>0) cout << " ";
    cout << A[i];
  }
  cout << endl;
}

void insertionSort(int A[], int N){
  int j, v;
  for(int i = 1; i<N; i++){
    v = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > v){
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = v;
    trace(A , N);
  }
}

int main(){
  int N, i, j;
  int A[100];
  cin >> N;
  for(i = 0; i<N; i++) cin >> A[i];
  
  trace(A, N);
  insertionSort(A, N);
}


Measured memory_bytes: 3084
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
#define MM " "
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}




main(){
    int n=in(),k=in();
    vec a;
    rep(i,n){
        a.pb(in());
    }
    sort(all(a));
    ll ans=0;
    rep(i,n-k)ans+=a[i];
    cout<<ans;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<int> v(n);
	for(int i = 0; i< n;i++){
		cin >> v[i];
	}
	int count = 0;
	for(int i = 0;i < n;i++){
		int other = v[i];
		if (v[other-1]-1 == i) count ++ ;
	}
	cout << count/2;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    rep(i, 0, s.size()){
        s[i] = 'A' + (s[i] - 'A' + n) % 26;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c,d;
    cin >> a >> b >> c;
    cout << min(a * b,c) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
 
  String a = sc.next();
  String b = sc.next();
   if(a.equals("H") && b.equals("H")|| a.equals("D") && b.equals("D")) {
	   System.out.print("H");
   }
   else {
	   System.out.print("D");
   }
   }
}
			

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

using namespace std;

long long N, A, B, arr[100010], sum = 0;

int main()
{
	scanf("%lld%lld%lld", &N, &A, &B);
	for (int i = 1; i <= N; i++)
	{
		scanf("%lld", &arr[i]);
		if (i > 1) sum += min((arr[i] - arr[i - 1]) * A, B);
	}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

using namespace std;

int main() {
	int a, b, c;
	std::cin >> a >> b >> c;

	if (a + b >= c) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    }
    cout << s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string S;
  cin >> S;
  if(S=="Sunny"){cout << "Cloudy" << endl;}
  if(S=="Cloudy"){cout << "Rainy" << endl;}
  if(S=="Rainy"){cout << "Sunny" << endl;}
}


Measured memory_bytes: 256
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

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

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                 \
  sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(    \
            c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }
  eni(!=) cerr << boolalpha << i;
  ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
  sim dor(const c &) { ris; }
#endif
}
;
#define deb(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define memo(dp, val) memset(dp, val, sizeof(dp))
#define NINJA                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define all(a) a.begin(), a.end()
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define dloop(i, n) for (int i = n - 1; i >= 0; i--)
#define iii tuple<int, int, int>
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int, int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 998244353
#define inf (int)1e18

const int mxn = 2e5 + 10;
int cache[mxn];
int prefix[mxn];

int32_t main() {
  NINJA;

  int n, k;
  cin >> n >> k;

  vector<pair<int, int>> p(k);

  fo(i, k) { cin >> p[i].first >> p[i].second; }

  sort(all(p));

  cache[1] = 1;
  prefix[1] = 1;

  for (int i = 2; i <= n; i++) {
    for (int j = 0; j < k; j++) {
      if (i <= p[j].first)
        continue;

      int l = p[j].first;
      int r = min(p[j].second, i - 1);

      int val = (prefix[i - l] - prefix[i - r - 1] + mod) % mod;

      cache[i] = (cache[i] + val) % mod;
    }
    prefix[i] = (prefix[i - 1] + cache[i]) % mod;
  }

  cout << cache[n] % mod << endl;

  return 0;
}

Measured memory_bytes: 6736
import itertools

inf = 10 ** 9
n, m, r = map(int, input().split())
r_list = [int(i) - 1 for i in input().split()]
a_list = [[inf for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    a_list[a][b] = a_list[b][a] = c
for k in range(n):
    for i in range(n):
        for j in range(i + 1, n):
            x = a_list[i][k] + a_list[k][j]
            if x < a_list[i][j]:
                a_list[i][j] = a_list[j][i] = x
k = list(itertools.permutations(r_list))
ans = inf
for kk in k:
    temp = 0
    for k1, k2 in zip(kk[:-1], kk[1:]):
        temp += a_list[k1][k2]
    if ans > temp:
        ans = temp
print(ans)

Measured memory_bytes: 8948
//config = { input: 'tmp', newline: '\r\n' }; // win
config = { input: '/dev/stdin', newline: '\n' }; // linux

A = require('fs').readFileSync(config.input, 'ascii')
  .split(config.newline, 2);
A = A[1].split(' ');
A.unshift(null);

template = new Array(14);
template[0] = 'node ';
template[1] = '[node number]';
template[2] = ': key = ';
template[3] = '[key number]';
template[4] = ', ';
template[5] = 'parent key = ';
template[6] = '[parent key number]';
template[7] = ', ';
template[8] = 'left key = ';
template[9] = '[left key number]';
template[10] = ', ';
template[11] = 'right key = ';
template[12] = '[right key number]';
template[13] = ', ';
res = [].concat(template);
for (i = 1; i < A.length; i++) {
  res[1] = i;
  res[3] = A[i];
  parent = Math.floor(i / 2);
  if (parent !== 0) {
    res[5] = template[5];
    res[6] = A[parent];
    res[7] = template[7];
  } else {
    res[5] = '', res[6] = ''; res[7] = '';
  }
  left = 2 * i;
  if (left < A.length) {
    res[8] = template[8];
    res[9] = A[left];
    res[10] = template[10];
  } else {
    res[8] = '', res[9] = '', res[10] = '';
  }
  right = 2 * i + 1;
  if (right < A.length) {
    res[11] = template[11];
    res[12] = A[right];
    res[13] = template[13];
  } else {
    res[11] = '';
    res[12] = '';
    res[13] = '';
  }
  console.log(res.join(''));
}

Measured memory_bytes: 16868
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define int long long

constexpr ll mod = 1000000007LL;

signed main(void){
    int N, K; cin >> N >> K;
    vector<int> A(N);
    for (auto& ai : A){
        cin >> ai;
    } 
    ll res = 1;
    
    if (N == K){
        for (auto ai : A)
            res = (res * ai % mod + mod) % mod;
        cout << res << endl;
        return 0;
    }

    bool all_neg = true;
    for (auto ai : A)
        all_neg &= ai < 0;
    if (all_neg && K % 2){
        // 大きい方からK個
        sort(A.begin(), A.end());
        reverse(A.begin(), A.end());
        for (int i = 0; i < K; ++i)
            res = (res * A[i] % mod + mod) % mod;
        cout << res << endl;
        return 0;
    }
    else if (all_neg && K % 2 == 1){
        sort(A.begin(), A.end());
        for (int i = 0; i < K; ++i)
            res = (res * A[i] % mod + mod) % mod;
        cout << res << endl;
        return 0;
    }

    // 答えは0以上

    vector<int> pos, neg;
    for (auto ai : A){
        if (ai >= 0) pos.push_back(ai);
        else neg.push_back(ai);
    }

    sort(pos.begin(), pos.end());
    reverse(pos.begin(), pos.end());

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

    int idx1, idx2;
    if (K <= pos.size()){
        idx1 = K - 1;
        idx2 = 0;
    }
    else{
        if (K % 2 == pos.size() % 2){
            idx1 = pos.size() - 1;
            idx2 = K - pos.size();
        }
        else{
            idx1 = pos.size() - 2;
            idx2 = K - pos.size() + 1;
        }
    }

    while (idx1 >= 1 && idx2 < neg.size()){
        if (pos[idx1] * pos[idx1 - 1] > neg[idx2] * neg[idx2 + 1]){
            break;
        }
        idx1 -= 2;
        idx2 += 2;
    }

    for (int i = 0; i <= idx1; ++i)
        res = res * pos[i] % mod;
    for (int i = 0; i < idx2; ++i)
        res = (res * neg[i] % mod + mod) % mod;
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 6928
#include<iostream>
#include<vector>
using namespace std;
int main(){

  int N;
  cin>>N;
  vector<int>a(N);
  vector<int>visit(N+1);
  for(int i=0;i<=N-1;i++){
  
    cin>>a[i];
  }
  int next=1;
  int ans=0;
  while(1){
    
    if(visit[next]==1){
    
      cout<<-1;
      return 0;
    }
    visit[next]=1;
    next=a[next-1];
    if(next==2)break;
    else ans++;
  }
  cout<<ans+1;
}

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

using namespace std;

int main(){
    long long int n,seki=1;
    cin>>n;
    long long int a[n];

    for(long long int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }

    for(long long int i=0;i<n;i++){
        if(a[i]<=1000000000000000000/seki){
            seki*=a[i];
        }else{
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<seki<<endl;
    
}

Measured memory_bytes: 4296
n=int(input())
abc=list("abcdefghijklmnopqrstuvwxyz")

D={}
for a in abc:
    D[a]=0

for i in range(n):
    s=input()
    for a in abc:
        now=D[a]
        num=s.count(a)
        if i==0:
            D[a]=num
        else:
            D[a]=min(now,num)
ans=""

for s,v in D.items():
    ans+=s*v
ans="".join(sorted(ans))
print(ans)

        


Measured memory_bytes: 3064
#include <string>
#include <iostream>
using namespace std;
int main(){
	int a, b, c;
	string judge;
	cin >> a >> b >> c;
	if(a + b == c){
		judge = "Yes";
	}else if(b + c == a){
		judge = "Yes";
	}else if(c + a == b){
		judge = "Yes";
	}else{
		judge = "No";
	}
	cout << judge << 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)

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int main(){
    string S;
    cin >> S;

    rep(i, S.size()) cout << "x";
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>

using namespace std;

int main(){
    cin.tie(0);
    int N; cin >> N;
    bool cek;
    while(1){
        cek = true;
        float temp = sqrt(N);
        for(int i = 2; i <= temp; i++)
            if(N % i == 0){
                cek = false;
                break;
            }
        if(!cek){
            N++;
        }
        else{
            cout << N << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a + b == 15){
            System.out.println("+");
        }else if(a * b == 15){
            System.out.println("*");
        }else{
            System.out.println("x");
        }
    }
}


Measured memory_bytes: 23764
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()
A=many_int()

A=sorted(A,reverse=True)

Alice=A[::2]
Bob=A[1:][::2]

print(sum(Alice)-sum(Bob))

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
class Program
{
    public static Scanner cin;
    static void Main()
    {
        
        cin = new Scanner();
        int n = cin.inputInt();
        string[][] xu = new string[n][];
        for(int a = 0; a < n; a++)
        {
            xu[a] = ReadLine().Split();
        }
        double total = 0;
        for(int a = 0; a < n; a++)
        {
            if (xu[a][1]=="BTC")
            {
                total += double.Parse(xu[a][0]) * 380000.0;
            }
            else
            {
                total += double.Parse(xu[a][0]);
            }
        }
        WriteLine(total);

    }
    static int CountChar(string s,string key)
    {
        return s.Length - s.Replace(key, "").Length;
    }
}





class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string input()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return input();
        i = 0;
        return s[i++];
    }

    public int inputInt()
    {
        return int.Parse(input());
    }
    public int[] arrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = inputInt() + add;
        }
        return Array;
    }

    public long inputLong()
    {
        return long.Parse(input());
    }

    public long[] arrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = inputLong() + add;
        }
        return Array;
    }

    public double inputDouble()
    {
        return double.Parse(input());
    }


    public double[] arrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = inputDouble() + add;
        }
        return Array;
    }
}

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

int main(){
    int X;
    cin >> X;
    X = abs(X);
    int i = 0, sum = 0;
    while(sum < X){
        i++;
        sum += i;
        if(i*(i+1)/2 >= X)
            break;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
first = sorted(list(input('')))
second = sorted(list(input('')), reverse=True)
result = False
check_equal = False
for (f, s) in zip(first, second):
  check_equal = (s == f)
  if not check_equal:
    result = (f < s)
    break
if (len(first) < len(second) and check_equal) or result:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
	const double B[]={165.0,170.0,175.0,180.0,185.0};
	int n;
	int count[6]={0};
	cin>>n;
	for(int i=0;i<n;++i){
		double height;
		cin>>height;
		if(height>=B[4])count[5]++;
		else for(int j=0;j<5;++j){
			if(height<B[j]){
				count[j]++;
				break;
			}
		}
	}
	for(int i=0;i<6;++i){
		cout<<i+1<<":";
		for(int j=0;j<count[i];++j)cout<<"*";
		cout<<"\n";
	}
}

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

int main(void){
    int n; cin >> n;
    vector<int>num(int(pow(10,6)),0);
    for(int i=0;i<n;i++){
        int tmp; cin >> tmp;
        num[tmp]++,num[tmp+1]++;
        if(0<=tmp-1) num[tmp-1]++;
    }

    cout << *max_element(num.begin(),num.end()) << endl;
    return 0;
}

Measured memory_bytes: 4224
from io import StringIO
from collections import *
from functools import *
import sys


def main(inputs):
    #n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    n, k = map(int, next(inputs).split())
    return n - k + 1


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass


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

int main() {
  ll N,M;
  cin >> N >> M;
  string S,T;
  cin >> S >> T;
  ll L = (N / __gcd(N,M)) * M;
  map<ll,int> mp;
  
  for (int i = 0; i < N; i++) {
    int c = S[i];
    mp[(L/N) * (i)] = c;
  }
  for (int j = 0; j < M; j++) {
    if (mp[(L/M) * (j)] == 0 || mp[(L/M) * j] == T[j]) {
      
    } else {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << L << endl;
  return 0;
}

Measured memory_bytes: 10880
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;
const double pi=acos(-1.0);

signed main(){
    int m,N;cin>>m>>N;
    int ans=0;
    int pen=0;
    map<int,int> penc;
    map<int,int> check;
    REP(i,N){
        int p;string S;cin>>p>>S;
        if(S=="WA")penc[p]++;
        else{
            if(check[p]==0){
                ans++;
                pen+=penc[p];
                check[p]++;
            }
        }
    }
    cout<<ans<<" "<<pen<<endl;
}

Measured memory_bytes: 12800
N = int(input())
S = input()
ans = 0

R_count = S.count('R')
G_count = S.count('G')
B_count = S.count('B')
ans = R_count * G_count * B_count



for i in range(N-2):
    for j in range(i+1, N-1):
        k = 2*j - i
        if k < N:
            if (S[i] != S[j]) & (S[j] != S[k]) & (S[k] != S[i]):
                ans -= 1

print(ans)

Measured memory_bytes: 73820
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int a,b;
int main()
{
  cin >> a >> b;
  int c = 1;
  int res = 0;
  while(c<b){
    c += a-1;
    res++;
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var B = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var C = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int ans = 0;

        for(int i = 0; i < N; i++)
        {
            ans = ans + B[A[i]-1];

            if(i != 0 && A[i-1] + 1 == A[i])
            {
                ans = ans + C[A[i-1] -1];
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using pi = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

int main() {
  stack<int> S1;
  stack<pi> S2;
  char ch;
  int sum = 0;
  for (int i = 0; cin >> ch; ++i) {
    if (ch == '\\') S1.push(i);
    else if (ch == '/' && !S1.empty()) {
      auto j = S1.top(); S1.pop();
      sum += i - j;
      int a = i - j;
      while (!S2.empty() && S2.top().first > j) {
        a+=S2.top().second; S2.pop();
      }
      S2.push(make_pair(j, a));
    } 
  }
  
  vector<int> ans;
  while (!S2.empty()) {
    ans.push_back(S2.top().second);
    S2.pop();
  }
  reverse(ALL(ans));
  cout << sum << endl;
  cout << ans.size();
  REP(i, ans.size()) {
    cout << " " << ans[i];
  }
  cout << endl;
}



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

cost1 = 0
cost2 = 0
cost = [0]
cost.append(abs(h[0]-h[1]))
    
for flog in range(2,len(h)):
    cost1 = cost[flog-2] + abs(h[flog] - h[flog-2])
    cost2 = cost[flog-1] + abs(h[flog] - h[flog-1])
    cost.append(min(cost1,cost2))
    #print(cost)
    
print(cost[-1])

Measured memory_bytes: 13980