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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}


// end of Template
str abb(str s){
    str res = "";
    res += s[s.size()-1];
    int d = s.size()-2;
    while(d>0){
        char c = char ((d%10)+48);
        d/=10;
        res = c + res;
    }
    res = s[0] + res;
    return res;
}

int main(){

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

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    str s;cin>>s;
    cout<<abb(s)<<newl;

}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();

            if (n < 10) {
                out.println(n);
                return;
            }

            long x = 1;
            while (x * 10 <= n) x *= 10;

            out.println(digitSum((n + 1) / x * x - 1));
        }

        private long digitSum(long x) {
            return x == 0 ? 0 : x % 10 + digitSum(x / 10);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

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

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 21460
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

void test(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int cnt = 0,cnt2=0;
	f(i,n)if(s[i]=='R')cnt++;
	f(i,cnt){
		if(s[i]=='R')cnt2++;
	}
	cout<<cnt-cnt2<<"\n";
	
}

int main(){
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}


Measured memory_bytes: 3756
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
typedef long long LL;

const int N = 100050;
int A[N], m, n;
char s[N];
bool check(int k) {
  for (int i = m - 1; i >= 0 && A[i] > n - k; --i)
    if (A[i] < k) return false;
  return true;
}
int main() {
  scanf("%s", s);
  m = 0;
  for (n = 0; s[n]; ++n)
    if ((s[n] != (n ? s[n - 1] : '0'))) 
      A[m++] = n;
  int l = 1, r = n;
  while (l < r) {
    int mid = r + (l - r) / 2;
    if (check(mid)) l = mid;
    else r = mid - 1;
  }
  printf("%d\n", l);
  return 0;
}


Measured memory_bytes: 512
//[l, r]?????????????????????n * (n - 1) / 2??????, n * (n - 1) / 2 + 1????????°???????????????????????????????????????????????????
//??????????????????n * (n - 1) / 2 + 1??\???. n <= 1000??????????????°???????????¨6?????\??? (7?????\????????°?????????????????????)
//?????£??????6?????\????????¨???????????¨??¨???????????????????????¨????????°?????´??°????????????????????¨????????°??????????????°?????????
//??????????????¨[l, r]?????????????????????6n???????????????????????????????§??????¨????????????????????????6n??\?????????????????¨???????????????
//??¨?????£???????????§???????????¨????????????0????????¨??????, 1????????¨??????, ?????¨???????????£??????O(n^2)??§?????????????????¨???????????????
//??????????????????????§£?????????O(n)?????????????????????O(n)???????£??????????

#include <iostream>
using namespace std;

int n;
int d[1000];
bool exist[1000000] = {false};

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> d[i];
	
	for (i = 0; i < n; i++) {
		int value = 0;	//[i, j]??????
		for (j = i; j < n && j - i < 6; j++) {
			value *= 10;
			value += d[j];
			exist[value] = true;
		}
	}
	
	for (i = 0; i < 1000000; i++) {
		if (!exist[i]) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 2096
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve(ll H, ll W, vector<string> a) {
  vector<int> cnt(26);
  for (string &s: a) {
    for (char c: s) cnt[c - 'a']++;
  }
  int four = (H / 2) * (W / 2);
  int two = (H / 2) * (W % 2) + (H % 2) * (W / 2);
  // int one = (H % 2) * (W % 2);
  REP(i,26) {
    int d = min(cnt[i] / 4, four);
    four -= d;
    cnt[i] -= d * 4;
  }
  REP(i,26) {
    int d = min(cnt[i] / 2, two);
    two -= d;
    cnt[i] -= d * 2;
  }
  cout << (four == 0 && two == 0) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll H;
	ll W;
	scanf("%lld", &H);
	vector<string> a(H-1+1);
	scanf("%lld", &W);
	for (int i = 0 ; i <= H-1 ; i++) {
	  cin >> a[i];
	}
	solve(H, W, a);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

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

    ll n , c=0 , mx=1e9;
    cin >> n;
    for(int i=1; i<=n; i++)
    {
        ll x;
        cin >> x;
        c=0;
        while(x%2==0 )
        {
            x /= 2;
            c++;
        }
        mx = min(mx , c);
    }
    cout << mx;
    


    return 0;
}

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

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define bs(v,val) binary_search(v.begin(),v.end(),val)
#define mod 1e9+7
#define ff first
#define ss second
#define fi(n) for(int i=0;i<n;i++)
#define fj(n) for(int j=0;j<n;j++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define m_p make_pair
#define endl '\n'



// ********** CODE STARTS HERE ****************//

int main()
{
	fastio;
    int N;
    cin >> N;
    vi A(N);
    fi(N)
        cin >> A[i];
    int Q;
    cin>>Q;
    ll sum = 0;
    umii um;
    for(int i:A)
    {
        sum+=i;
        um[i]++;
    }
    while(Q--){
        int B,C;
        cin >> B >> C;
        sum = sum + (C-B)*um[B];
        int cnt = um[B];
        um.erase(B);
        um[C] += cnt;
        cout << sum << endl;
    }
	return 0;
}

Measured memory_bytes: 7052
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int main()
{
    int x;
    cin>>x;
    int i=2;
    while(true){
        if((i*x)%360==0){
            cout<<i<<endl;
            break;
        }
        i++;
    }
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

int main()
{
    int N;
    cin >> N;
    vector<int> yaku(202);
    FOR(i, 1, 201) {
        int j = i;
        while (j <= 200)
        {
            yaku[j]++;
            j += i;
        }
    }
    int ans = 0;
    for (int i = 1; i <= N; i += 2)
        if (yaku[i] == 8) ans++;

    cout << ans << endl;
}

Measured memory_bytes: 256
A = []
B = []
for i in range(3):
    A.append(list(map(int, input().split())))
N = int(input())
for i in range(N):
    B.append(int(input()))

marked = []
for b in B:
    for i in range(3):
        if b not in A[i]:
            continue
        j = A[i].index(b)
        marked.append([i, j])

answer = 'No'
if (([0, 0] in marked and [1, 1] in marked and [2, 2] in marked) or
    ([0, 0] in marked and [0, 1] in marked and [0, 2] in marked) or
    ([1, 0] in marked and [1, 1] in marked and [1, 2] in marked) or
    ([2, 0] in marked and [2, 1] in marked and [2, 2] in marked) or
    ([0, 0] in marked and [1, 0] in marked and [2, 0] in marked) or
    ([0, 1] in marked and [1, 1] in marked and [2, 1] in marked) or
    ([0, 2] in marked and [1, 2] in marked and [2, 2] in marked) or
        ([2, 0] in marked and [1, 1] in marked and [0, 2] in marked)):
    answer = 'Yes'

print(answer)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) ((int)(a).size())
typedef long long int64;
int main() {
#ifdef LOCAL
  freopen(".a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false), cout.tie(0), cin.tie(0);
  int64 n;
  cin >> n;
  int64 res = 0;
  for (int64 i = 1; i < n; ++i) {
    if (n % i == 0) {
      res += n / i - 1;
    } else {
      res += n / i;
    }
  }
  cout << res;

  return 0;
}
//2020.09.19 20:04:40


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>

#define rep(i,x) for(int i = 0; i < x; i++)
#define rrep(i,x) for(int i = 1; i <= x; i++)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using ll = long long;
using namespace std;
const int INF = 1001001001;
const ll LINF = 1002003004005006007;
const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

int main(){
    int n, s; cin >> n >> s;
    vector<int> a_list(n);
    rep(i, n) cin >> a_list[i];
    mint ans = 0;
    vector<mint> dp(s + 1, 0);
    rep(index, n){
        dp[0] += 1;
        int a = a_list[index];
        for (int i = s; i >= a; --i){
            dp[i] = dp[i] + dp[i - a];
        }
        ans += dp[s];
    }
    cout << ans.x << endl;
}


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

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

    bool win = false;

    while (1){
        c = c - b;
        if (c <= 0) {
            win = true;
            break;
        }
        a = a - d;
        if (a <= 0) {
            break;
        }
    }

    if (win) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i)
static const ll INFTY = 1L << 62L;
ll solver(ll *a, ll *b, ll N)
{
    ll cnt = 0;
    for (ll i = N - 1; i >= 0; --i)
    {
        if ((a[i] + cnt) % b[i])
        {
            cnt += b[i] - (a[i] + cnt) % b[i];
        }
    }
    return cnt;
}
int main()
{
    ll N;
    cin >> N;
    ll a[N], b[N];
    rep(i, 0, N) cin >> a[i] >> b[i];
    cout << solver(a, b, N) << endl;
}

Measured memory_bytes: 5164
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
const double EPS = 1e-5;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef long long ll;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
 
typedef complex<double> P;
 
double triangleArea(P a, P b, P c)
{
    b -= a;
    c -= a;
    
    return (0.5 * abs(b.imag() * c.real() - c.imag() * b.real()));
}
 
// _ªOp`ÌÉ é©
bool isInTriangle(P p[3], P x)
{
    int i;
    double S = triangleArea(p[0], p[1], p[2]);
    
    rep(i, 3) S -= triangleArea(x, p[i], p[(i + 1) % 3]);
    
    return abs(S) < EPS;
}
 
int main()
{
    int n;
        cin >> n;
        
        
        while(n--)
        {
                P p[3];
                P k, s;
                
                rep(i, 3) cin >> p[i].real() >> p[i].imag();
                cin >> k.real() >> k.imag() >> s.real() >> s.imag();
        
                if(isInTriangle(p, k) ^ isInTriangle(p, s))
                {
                        cout << "OK" << endl;
                }
                else
                {
                        cout << "NG" << endl;
                }
        }
}
 

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


int main(){
  long long n;
  cin>>n;
  set<string> t;
  string s;
  for(long long i=0;i<n;i++){
      cin>>s;
      t.insert(s);
  }
  cout<<t.size()<<endl;
    return 0;
}


Measured memory_bytes: 19256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279

#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define REPR(i, n) for(ll i = n; i >= 1; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
const ld INF = 1e9+123;
#define VEC(type,A,N) vector<type> A(N+10)
#define VECi(type,A,N,i) vector<type> A(N+10,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N+10,vector<type>(M+10))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N+10,vector<type>(M+10,i))
#define ALL(v) v.begin()+1, v.end()-9
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll N,A,B;
    cin>>N>>A>>B;
    cout<<N/(A+B)*A+min(A,(N%(A+B)));
    //cout<<fixed<<setprecision(15)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


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

namespace C_sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            for (var i = 1; i <= n; i++)
            {
                if (i % 3 == 0)
                {
                    Console.Write($" {i}");
                }
                else
                {
                    var x = i;
                    while (x > 0)
                    {
                        if (x % 10 == 3)
                        {
                            Console.Write($" {i}");
                            break;
                        }
                        x /= 10;
                    }
                }
            }
            Console.WriteLine();
        }
    }
}



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

vector<int>a;
string solve(vector<int> a,int m,int n){
    ll sum=0;
    rep(i,n)sum+=a[i];
    int max=(sum-1)/(4*m)+1;
    ll count=0;
    rep(i,n){
        if(a[i]>=max)count++;
        if(count>=m)return "Yes";
    }
     return "No";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);

int n,m;

cin>>n>>m;
a.resize(n);
rep(i,n)cin>>a[i];
cout<<solve(a,m,n)<<endl;

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(i=0;i<n;i++)
#define test(a) cout << "*" << a << endl;
#define ll long long
int main(){
  int i;
  ll A,B,C,K;
  ll sum = 0;
  
  cin  >> A >> B >> C >> K;
  if(K<=A){
    sum = K;
  }
  else if(K<=A+B){
    sum = A;
  }
  else{
    sum = A + (-1) * (K-A-B);
  }
      
  cout << sum << endl;
    
  
  
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>

int main(){
  char seq[10001];
  int n;
  scanf("%d", &n);
  scanf("%s", seq);

  int y = strlen(seq);


  for(int i = 0; i < y; ++i){
    if((seq[i]+n) <= 90){
      printf("%c", (seq[i]+n));
    }
    else{
      printf("%c", (seq[i]+n)-90+64);
    }
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 128
N,K=map(int,input().split())
List=list(map(int,input().split()))

arr = [1]
cnt = 1
b = 10 ** 7
ans = [0 for i in range(N+1)]

for i in range(N):
  if i == 0:
    ans[1] += 1
    s = List[i]
    arr.append(s)    
  else:
    if ans[s] == 1:
      b = arr.index(List[s-1])
      break
    else:
      ans[s] += 1
      s = List[s-1]
      arr.append(s)
            
l = len(arr)
c = int( (K-b) % (l-b) )

if K-b > 0:
  print(arr[b+c])
elif K-b == 0:
  print(arr[b])
else:
  print(arr[K])

Measured memory_bytes: 32336
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

int main() {
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << fixed << setprecision(7);
	cout << sqrt(pow((x1 - x2),2) + pow((y1 - y2),2)) << endl;
	return 0;
}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

const int MOD = 998244353;

int n, bitL[200005], bitR[200005];
long long power[200005];
pair<int, int> pts[200005];

int query(int i, int *bit) {
    int ret = 0;
    for (; i>0; i-=i&-i)
        ret += bit[i];
    return ret;
}

void update(int i, int val, int *bit) {
    for (; i<=n; i+=i&-i)
        bit[i] += val;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin >> n;
    for (int i=0; i<n; i++)
        cin >> pts[i].first >> pts[i].second;

    power[0] = 1;
    for (int i=1; i<=n; i++)
        power[i] = power[i-1] * 2 % MOD;

    sort(pts, pts + n, [] (const pair<int, int> &a, const pair<int, int> &b) {
        return a.second < b.second;
    });
    for (int i=0; i<n; i++) {
        pts[i].second = i + 1;
        update(i + 1, 1, bitR);
    }
    sort(pts, pts + n);

    long long ret = 0;
    for (int i=0; i<n; i++) {
        update(pts[i].second, -1, bitR);
        int bottomL = query(pts[i].second, bitL), bottomR = query(pts[i].second, bitR);
        ret += ((power[n] - power[i] - power[n - i - 1] - power[bottomL + bottomR] - power[n - bottomL - bottomR - 1]
            + power[bottomL] + power[bottomR] + power[i - bottomL] + power[n - i - bottomR - 1] - 1) % MOD + MOD) % MOD;
        if (ret >= MOD)
            ret -= MOD;
        update(pts[i].second, 1, bitL);
    }
    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 8312
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);
ll arr[] = {100, 101, 102, 103, 104, 105}; 
ll dp[200000][10];
ll todo;
ll can(ll x, ll idx) {
  if(x == todo and idx < 6) return 1;
  if(x > todo or idx >= 6) return 0;
  ll &ans = dp[x][idx];
  if(ans != -1) return ans;
  ans = 0;
  ans = ans|can(x + arr[idx], idx); 
  ans = ans|can(x, idx + 1);
  return ans;
}
int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  memset(dp, -1, sizeof(dp));
  cin >> todo;
  cout << can(0, 0);

  return 0;
} //good night.

Measured memory_bytes: 15872
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{
		long N = nextLong();
		long A =nextLong();
		long B =nextLong();

		long ans =(N/(A+B))*A+Math.min(N%(A+B), A);
		System.out.println(ans);

	}





	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 21332
a, b, c = map(int, input().split())
abc = []
R, B = 0, 0
abc.append(a)
abc.append(b)
abc.append(c)
abc.sort()
R = abc[0] * abc[1] * (abc[2]//2)
B = a*b*c-R
print(B - R)

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

using namespace std;

int main(){
	int n, a;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i){
			scanf("%d", &a);
			if(a%2==0 && !(a%5==0||a%3==0)){
				printf("DENIED");
				return 0;
			}
		}
	printf("APPROVED");
	return 0;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vi v(4);
	REP(i, 4)cin >> v[i];
	sort(ALL(v));
	vi t = { 1,4,7,9 };
	bool ok = true;
	REP(i, 4)if (t[i] != v[i])ok = false;
	if (ok)cout << "YES" << endl;
	else cout << "NO" << endl;

}

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

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

    vector<int> a_n;
    a_n.push_back(s);

    while (true) {
        int cur = a_n.back(), next;
        if (cur % 2 == 0)
            next = cur / 2;
        else
            next = 3 * cur + 1;
        
        for (int i = 0, n = a_n.size(); i < n; i++)
            if (a_n.at(i) == next) {
                cout << n + 1 << endl;
                return 0;
            }

        a_n.push_back(next);
    }
}

Measured memory_bytes: 3548
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int a, b;
	cin >> a >> b;
	if (b % a == 0) cout << a + b << "\n";
	else cout << b - a << "\n";

	return 0;
}

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

using namespace std;

typedef long long ll;

ll f[1<<5][305];
int num[7],p[7];

ll dp(int n,int m) {
  memset(f,0,sizeof(f));
  f[0][num[n]*n]=1;
  int r=m*n;
  for(int i=0;i<m;i++)
    for(int j=1;j<n;j++) {
    	int x=i*n+j,u=p[j]-1,nr=min(r,num[p[j]]*n+x);
    	for(int k=0;k<(1<<(n-1));k++)
    	  if (!((k>>u)&1)) {
    	  	for(int l=x;l<=r;l++)
    	  	  if (f[k][l]) f[k^(1<<u)][max(nr,l)]+=f[k][l];
		  }
	}
  return f[(1<<(n-1))-1][r];
}

int main() {
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=1;i<=n;i++) scanf("%d",&num[i]);
  sort(num+1,num+n+1);
  for(int i=1;i<n;i++) p[i]=i;
  ll s=0;
  do {
  	s+=dp(n,m);
  } while (next_permutation(p+1,p+n));
  ll v=1;
  for(int i=1;i<n;i++) v*=i*m;
  printf("%.15f\n",(double)s/v);
  return 0;
}

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

int main(void) {
  string S;
  cin >> S;
  smatch match;
  bool isYYMM = false;
  bool isMMYY = false;
  if (regex_match(S, match,
                  regex("(01|02|03|04|05|06|07|08|09|10|11|12)+[0-9]{2}"))) {
    isMMYY = true;
  }
  if (regex_match(S, match,
                  regex("[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)+"))) {
    isYYMM = true;
  }

  if (isYYMM && isMMYY) {
    cout << "AMBIGUOUS" << endl;
    return 0;
  }

  if (isYYMM) {
    cout << "YYMM" << endl;
    return 0;
  }

  if (isMMYY) {
    cout << "MMYY" << endl;
    return 0;
  }

  cout << "NA" << endl;

  return 0;
}

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = (ll) 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 1000005;

int main() {
    FAST
    int d,t,s;
    cin>>d>>t>>s;
    if(d<=t*s){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>

int main(void){
  int sec;
  scanf("%d", &sec);
  if(sec == 0){
    printf("0:0:0\n");
  } else {
    int hour = (sec - sec % 3600) / 3600;
    sec = sec - 3600 * hour;
    int min = (sec - sec % 60) / 60;
    sec = sec - 60 * min;
    printf("%d:%d:%d\n", hour, min, sec);
  }
  return 0;
}



Measured memory_bytes: 2724
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map(String::toInt)

    var counter = 0
    aList.forEachIndexed { index, i ->
        if ((index + 1) % 2 == 1) {
            if (i % 2 == 1) {
                counter++
            }
        }
    }

    println(counter)
}


Measured memory_bytes: 36448
from collections import Counter
N = int(input())

a= list(map(int,input().split()))


X = Counter(a)

min_val = min(a)
max_val = max(a)
if not min_val == max_val-1 and not min_val==max_val:
    print("No")
    exit()
if max_val==min_val and max_val == N-1:
    #all unique
    print("Yes")
    exit()

#only 1 color cat
unique_cat = X[min_val] if min_val!=max_val else 0

# 2 or more cat color  : max_val - unique_cat
last_cat =  N- unique_cat
last_colors = max_val - unique_cat


#print(last_cat,last_colors,unique_cat)
if last_cat>0 and last_colors <=0:
    print("No")
elif  0< 2*last_colors <= last_cat:
    print("Yes")

else:
    print("No")


Measured memory_bytes: 18656
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

long long func(long long a, long long b){
  long long res;
  if(a > b){
    swap(a,b);
  }
  if(b%a == 0){
    res = 2*(b/a)*a - a;
  }else{
    res = 2*(b/a)*a + func(a, b%a);
  }
  return res;
}
int main(){
  
  long long n,x;
  cin>>n>>x;
  long long ans = n + func(n-x, x);
  cout<<ans<<endl;
  return 0; 
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var X = sc.nextInt();
        var t = sc.nextInt();

        WriteLine(Math.Max(0, X - t));
    }
}


class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}

class Scanner {
    string[] s;
    int i;

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

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

    public string next() {
        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 next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {

        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

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

    public double nextDouble() {
        return double.Parse(next());
    }

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

Measured memory_bytes: 11092
#include <iostream>
#define int long long
signed main(){
  int K,X;
  std::cin>>K>>X;
  for (int i=X-K+1;i<X+K;i++){
    if(i==K+X){
      std::cout<<i<<std::endl;
    } else{
      std::cout<<i<<" ";
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision
int n;
vector<vector<pair<int, int>>> G;

void dijkstra(){
    priority_queue<pair<int, int>> PQ;
    int color[10000];
    int d[10000];
    rep(i,n){
        d[i]=INF;
        color[i]=0;
    }
    d[0]=0;
    PQ.push(make_pair(0,0));
    color[0]=1;

    while(!PQ.empty()){
        pair<int, int> f=PQ.top(); PQ.pop();
        int u=f.S;
        color[u]=2;
        if(d[u]<f.F*(-1)) continue;
        rep(j,G[u].size()){
            int v=G[u][j].F;
            if(color[v]==2) continue;
            if(d[v]>d[u]+G[u][j].S){
                d[v]=d[u]+G[u][j].S;
                PQ.push(make_pair(d[v]*-1,v));
                color[v]=1;
            }
        }
    }
    rep(i,n){
        cout << i << " " << (d[i]==INF ? -1 : d[i]) << endl;
    }
}

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    cin >> n;
    G.resize(n);
    rep(i,n){
        int u,k;
        cin >> u >> k;
        rep(j,k){
            int v,c;
            cin >> v >> c;
            G[u].PB(make_pair(v,c));
        }
    }
    dijkstra();
}


Measured memory_bytes: 7932
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int stepNum = sc.nextInt();
        long k = sc.nextLong();
        
        long[] ownNum = new long[100000];
        
        for(int i=0 ; i< stepNum; i++){
            int intA = sc.nextInt();
            int insertNum = sc.nextInt();
            ownNum[intA-1] += insertNum;
        }
        
        long sum=0;
        for(int i=0 ; i< ownNum.length; i++){
            sum += ownNum[i];
            if(sum >= k){
                System.out.println((i+1));
                break;
            }
        }
    }
}


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

int main()
{
    int n; cin >> n;
    long long y; cin >> y;
    long long sum = 0;
    bool ans = true;

    rep(i,n) {
        rep(j,n) {
            sum = 10000*i + 5000*j + 1000*(n-i-j);
            if(sum==y && n>=i+j) {
                ans = false;
                cout << i << ' ' << j << ' ' << n-i-j << endl;
                break;
            }
        }
        if(ans == false) break;
    }

    if(ans) cout <<"-1 -1 -1" << endl;
}

Measured memory_bytes: 3564
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		for(int i = S.length()-T.length(); i >= 0; i--) {
			boolean ok = true;
			for(int j = i; j < i+T.length(); j++) {
				if(S.charAt(j) != T.charAt(j-i) && S.charAt(j) != '?'){
					ok = false;
					break;
				}
			}
			if(ok) {
				S = S.substring(0, i) + T + S.substring(i+T.length()); 
				S = S.replace('?', 'a');
				System.out.println(S);
				return;
			}
		}
		System.out.println("UNRESTORABLE");

	}

}


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

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> l(N);
  rep(i, N) cin >> l[i];
  sort(l.begin(), l.end(), greater<int>());

  int ans = 0;
  rep(i, K) ans += l[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const double pi = acos(-1.0);

int main() {
	VI a(5); rep(i, 5)cin >> a[i];
	int k; cin >> k;

	puts(a[4] - a[0] <= k ? "Yay!" : ":(");
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

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

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<ll> enum_div(ll n) {
    std::vector<ll> ret;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

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

    int H, W, A, B;
    cin >> H >> W >> A >> B;
    if (A * 2 <= W && B * 2 <= H) {
        REP(h, H) {
            REP(w, W) {
                if (w < A && h < B)
                    cout << 1;
                else if (w >= A && h >= B)
                    cout << 1;
                else
                    cout << 0;
            }
            cout << endl;
        }

    } else {
        cout << -1 << endl;
    }
    return 0;
}

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

int mark[30], n, a;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++){
		char c;
		cin >> c;
		mark[(c - 'A')]++;
	}	
	for (int i = 0; i < 30; i++)
		a += (mark[i] > 0);
	
	if(a == 3)
		cout << "Three";
	else
		cout << "Four";
	
}


Measured memory_bytes: 384
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
#define IOS ios::sync_with_stdio(0)
template <typename T>
inline T read(){T sum=0,fl=1;int ch=getchar();
for(;!isdigit(ch);ch=getchar())if(ch=='-')fl=-1;
for(;isdigit(ch);ch=getchar())sum=sum*10+ch-'0';
return sum*fl;}
template <typename T>
inline void write(T x) {static int sta[35];int top=0;
do{sta[top++]= x % 10, x /= 10;}while(x);
while (top) putchar(sta[--top] + 48);}
template<typename T>T gcd(T a, T b) {return b==0?a:gcd(b, a%b);}
template<typename T>T exgcd(T a,T b,T &g,T &x,T &y){if(!b){g = a,x = 1,y = 0;}
else {exgcd(b,a%b,g,y,x);y -= x*(a/b);}}
#ifndef ONLINE_JUDGE
#define debug(fmt, ...) {printf("debug ");printf(fmt,##__VA_ARGS__);puts("");}
#else
#define debug(fmt, ...)
#endif
typedef long long ll;
const ll mod = 1e9+7;

int main() {
	#ifndef ONLINE_JUDGE
		//freopen("in.txt", "r", stdin);
		//freopen("out.txt","w",stdout);
	#endif
	int a,b,c;
	cin >> a >> b >>c;
	swap(a,b);
	swap(a,c);
	cout << a << " " << b << " " << c << endl;	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;cin>>s;
  for(int i=0;i<s.length();i+=2)
  {
    if(s[i]!='h' || s[i+1]!='i')
    { cout<<"No"<<endl;return 0;}
  }
  cout<<"Yes";
}
      


Measured memory_bytes: 256