akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    ll a;
    cin >> a;
    string s;
    cin >> s;

    cout << ((a < 3200) ? "red" : s) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
 using namespace std;
 char in[110];
 int main(){
   int a,b;scanf("%d%d",&a,&b);
   for(int i=0;i<b;i++)in[i]='0'+a;
   string L=in;
   for(int i=0;i<a;i++)in[i]='0'+b;
   in[a]=0;
   string R=in;
   printf("%s\n",min(L,R).c_str());
 }

Measured memory_bytes: 3192
/* 
   *********************************************************
    Code_Blooded Human == @{{ samrat_12   [  0_0  ^_^  ] }}
   *********************************************************
*/
#include <bits/stdc++.h>
#include<algorithm>
#include<queue>
#include<list>
#include<map>
#include <math.h>
#include<numeric>
using namespace std;
using i1=int;
#define E "\n"
#define FAST        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  ipfile     ifstream cin ("input.txt");std::cin.rdbuf(std::cin.rdbuf())
#define ll          long long int
#define ull         unsigned long long int
#define db          long double
#define vll         vector<ll>
#define all(v)      v.begin(),v.end()
#define GCD(m,n)    __gcd(m,n)
#define LCM(m,n)    m*(n/GCD(m,n))
#define REVVEC(v)   reverse(v.begin(),v.end())
#define REVARR(a)   reverse(a,a+n)
#define maxc(v)     max_element(all(v))
#define minc(v)     min_element(all(v))
#define inputarr(a,n)   for(int xxx=0;xxx<n;++xxx) cin>>a[xxx]
#define outputarr(a,n)  for(int xxx=0;xxx<n;xxx++) cout<<a[xxx]<<" "
#define rep(i,m, n)     for(int i = m; i < (n); ++i)
#define sp              setprecison(10)
const ll MAX=1e4+5;
const ll mod=1e9+7;
vector<int>v;


signed main()
{
    FAST
    string s;
    cin>>s;
    if(s=="Sunny")
    cout<<"Cloudy\n";
    else if(s=="Cloudy")
    cout<<"Rainy\n";
    else cout<<"Sunny\n";
    return 0;
}


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

using ll = long long;

void solve(long long L, long long R, long long d){
    int cnt = 0;
    for(int i = L;i <= R;i++)if(i % d == 0)cnt++;
    cout<<cnt<<endl;
}

int main(){
    long long L;
    scanf("%lld",&L);
    long long R;
    scanf("%lld",&R);
    long long d;
    scanf("%lld",&d);
    solve(L, R, d);
    return 0;
}


Measured memory_bytes: 3680
#include <stdio.h>
int main(void){
    // Your code here!
    int rs,h,m,s;
    scanf("%d",&rs);

    h = rs / 3600;
    m = rs % 3600 / 60;
    s = rs % 3600 % 60;
    
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 2104
#include <stdio.h>
int main(void){
    int i, j, k, a[3][3], n, b[100];
    
    for( i = 0; i < 3; i++ ){
        for( j = 0; j < 3; j++ ){
            scanf("%d", &a[i][j]);
        }
    }
    
    scanf("%d", &n);
    
    for( i = 0; i < n; i++ ){
        scanf("%d", &b[i]);
    }
    
    for( i = 0; i < 3; i++ ){
        for( j = 0; j < 3; j++ ){
            for( k = 0; k < n; k++ ){
                if( a[i][j] == b[k] ){
                    a[i][j] = 0;
                }
            }
        }
    }

    if( a[0][0] == a[0][1] && a[0][1] == a[0][2] && a[0][0] == 0 ){
        printf("Yes\n");
        return 0;
    }
    if( a[1][0] == a[1][1] && a[1][1] == a[1][2] && a[1][0] == 0 ){
        printf("Yes\n");
        return 0;
    }
    if( a[2][0] == a[2][1] && a[2][1] == a[2][2] && a[2][0] == 0 ){
        printf("Yes\n");
        return 0;
    }
    if( a[0][0] == a[1][0] && a[1][0] == a[2][0] && a[0][0] == 0 ){
        printf("Yes\n");
        return 0;
    }
    if( a[0][1] == a[1][1] && a[1][1] == a[2][1] && a[0][1] == 0 ){
        printf("Yes\n");
        return 0;
    }
    if( a[0][2] == a[1][2] && a[1][2] == a[2][2] && a[0][2] == 0 ){
        printf("Yes\n");
        return 0;
    }
    if( a[0][0] == a[1][1] && a[1][1] == a[2][2] && a[0][0] == 0 ){
        printf("Yes\n");
        return 0;
    }
    if( a[0][2] == a[1][1] && a[1][1] == a[2][0] && a[0][2] == 0 ){
        printf("Yes\n");
        return 0;
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int arr[100];
    int i,n,j,k,temp,t;
            scanf("%d",&n);
    for(j=0;j<n;j++)
        scanf("%d",&arr[j]);
    for(j=0;j<n-1;j++){
    for(i=0;i<n-1;i++){
        if(arr[i]>arr[i+1]){
            temp=arr[i];
            arr[i]=arr[i+1];
            arr[i+1]=temp;
        }
    }
    }
    printf("%d\n",arr[n-1]-arr[0]);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, m, q; scanf("%d%d%d", &n, &m, &q);
	std::vector<int> a(n), b(m);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	for(int i = 0; i < m; i++) scanf("%d", &b[i]);

	int ans = *min_element(begin(a), end(a)) + *min_element(begin(b), end(b));
	while(q--) {
		int x, y, z; scanf("%d%d%d", &x, &y, &z);

		ans = std::min(ans, a[x - 1] + b[y - 1] - z);
	}
	
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
  ll h,a;
  cin>>h>>a;
  cout<<ceil(h/(a*1.0));
	
	return 0;
}

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

int main()
{
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    if (a * n > b)
    {
        printf("%d\n", b);
    }
    else
    {
        printf("%d\n", a * n);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
lint M = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    
    lint N, K;
    cin >> N >> K;
    lint res  = 0;
    for (lint k = K; k <= N+1; ++k) {
        lint L = k*(k-1)/2;
        lint R = N*k - L;
        res = (res + R - L + 1)%M;
    }
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define ll long long
#define llu unsigned long long

int take() {
    int n;
    scanf("%d",&n);
    return n;

}
double ttake() {
    double n;
    scanf("%lf",&n);
    return n;
}
ll takes() {
    ll n;
    scanf("%lld",&n);
    return n;

}

#define Int take()
#define Dnt ttake()
#define LL takes()
#define done {return 0;}
#define fr(n) for(int i=1;i<=n;i++)
#define FR(a,b,x) for(int i=(a);i<=(b);i+=(x))
#define rfr(n) for(int i=n;i>=1;i--)
int cas;
#define print printf("Case %d:",++cas)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pii pair<int,int>
#define vii vector<pii>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mk  make_pair
#define fill(x,v) memset(x,v,sizeof x)

using namespace std;

bool approximatelyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool essentiallyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool definitelyGreaterThan(float a, float b, float epsilon) {
    return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool definitelyLessThan(float a, float b, float epsilon) {
    return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
#define STR {struct info}
#define debug(x) {cout<<"ekhane"<<x<<endl;}
#define  SS second
#define  FF first
#define PQ priority_queue
#define great greatest
#define less lesser
#define mii map<int,int>
#define mil map<int,ll>
#define mll map<ll,ll>
#define msb map<string,bool>
#define M 100005
//////////////////////////////////////////
ll ans[M+1];
bool nw[M+1];

void seive(){
    nw[0]=nw[1]=1;
    for(int i=4;i<=M;i+=2) nw[i]=1;
    for(int i=3;i*i<=M;i+=2){
        if(!nw[i]){
            for(int k=2*i;k<=M;k+=i) nw[k]=1;
        }
    }
}


int main(){
    seive();

    for(int i=1;i<=100000;i++){
        bool a=nw[i],b=nw[(i+1)/2];
        if(a==b && !a && i%2) ans[i]=1;
        ans[i]=ans[i-1]+ans[i];
    }
    int q=Int,l,r;
    while(q--){
        l=Int,r=Int;
        if(l==0) l=1;
        printf("%d\n",ans[r]-ans[l-1]);
    }
    done;
}




Measured memory_bytes: 1536
#include <iostream>
#include <string>
using namespace std;
 
int main (void) {
  string strH, strB;
  int hNum, bNum;
   
  while(1) { 
    cin >> strH >> strB;
    if(strH == "0" && strB == "0") break;
     
    hNum = bNum = 0;
     
     
    for(int i = 0; i < 4; i++) {
      for(int j = 0; j < 4; j++) {
    if(strH[i] == strB[j]) {
      if(i == j) hNum++;
      else bNum++;
    }
      }
    }
     
    cout << hNum << " " << bNum << endl;
  }
 
  return 0;
}

Measured memory_bytes: 1184
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 文字列の入力
		List<String> n = Arrays.asList(sc.next().split(""));
    
		// 出力
		System.out.println(n.contains("9") ? "Yes" : "No");
	}
}


Measured memory_bytes: 21844
n,m = map(int,input().split())
import heapq
a = list(map(int,input().split()))
heapq.heapify(a)
p = []
q = 1
for i in range(m):
    b,c = map(int,input().split())
    p.append([c,b])
p.sort(reverse = True)
for i in range(m):
    for j in range(p[i][1]):
        v = heapq.heappop(a)
        if p[i][0] > v:
            heapq.heappush(a, p[i][0])
        else:
            heapq.heappush(a, v)
            q = 0
            break
    if q == 0:
        break
ans = 0
for i in range(n):
    ans += a[i]
print(ans)

Measured memory_bytes: 92568
#include <iostream>
#include <string>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

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

	if (S.length() > K) {
		cout << S.substr(0, K) + "...";
	}
	else {
		cout << S;
	}

	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
    long int N, K, A, B;

    scanf("%ld", &N);
    scanf("%ld", &K);
    A = N % K;
    B = K - A;

    if(B < 0)
        B = B * (-1);

    if (A <= B)
        printf("%ld\n", A);
    else
        printf("%ld\n", B);
    
    return 0;
     
}

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

					using namespace std;
					typedef long long ll;
					int n, m, k, t, s;
					int main()
					{
						cin >> n >> m >> k >> t;
						if(t > n)
							s += n, t -= n;
						else return cout << t, 0;
						if(t > m)
							t -= m;
						else return cout << s, 0;
						if(t > k)
							s -= k, t -= n;
						else return cout << s-t, 0;
					}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 3005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int64 s,n;
void Solve() {
    read(s);
    n = (s / 11) * 2;
    s %= 11;
    if(s > 0 && s <= 6) n += 1;
    if(s > 6) n += 2;
    out(n);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


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

int main(){
  int N;
  string s;
  cin>>N>>s;
  vector<int> animal={1,-1};
  vector<int> ss(N);
  bool flag=false;
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      ss.at(0)=animal.at(i);
      ss.at(1)=animal.at(j);
      for(int k=1;k<N-1;k++){
        int x;
        if(s.at(k)=='o'){
          x=1;
        }else{
          x=-1;
        }
        ss.at(k+1)=x*ss.at(k-1)*ss.at(k);
      }
      int x;
      if(s.at(N-1)=='o'){
        x=1;
      }else{
        x=-1;
      }
      int y;
      if(s.at(0)=='o'){
        y=1;
      }else{
        y=-1;
      }
      if(ss.at(N-2)*ss.at(N-1)*x==ss.at(0)&&ss.at(N-1)*ss.at(0)*y==ss.at(1)){
        flag=true;
        break;
      }
    }
    if(flag){
      break;
    }
  }
  
  if(flag){
    for(int i=0;i<N;i++){
      if(ss.at(i)==1){
        cout<<'S';
      }else{
        cout<<'W';
      }
    }
    cout<<endl;
  }else{
    cout<<-1<<endl;
  }
}
  
      

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))

int main()
{
    int s, w;
    cin >> s >> w;
    if(w>=s){
        cout << "unsafe" << endl;
    }else{
        cout << "safe" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
def selection_sort(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    return A, count

if __name__ == '__main__':
    n = int(input())
    A = [int(x) for x in input().split()]
    result_A, count = selection_sort(A)
    print(*result_A)
    print(count)



Measured memory_bytes: 5616
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

int intrsect(pll lhs, pll rhs) {
	return max(lhs.first, rhs.first) <= min(lhs.second, rhs.second);
}

void solve() {
	ll N = fetch<ll>() - 1;
	ll A = fetch<ll>();
	ll B = fetch<ll>();
	ll C = fetch<ll>();
	ll D = fetch<ll>();

	for(ll i = 0; i <= N; ++i) {
		ll j = N - i;

		vector<pll> fst, snd;
		fst.emplace_back(A - i * D, A - i * C);
		fst.emplace_back(A + i * C, A + i * D);
		snd.emplace_back(B - j * D, B - j * C);
		snd.emplace_back(B + j * C, B + j * D);

		for(auto& x: fst) {
			for(auto& y: snd) {
				if(intrsect(x, y)) {
					cout << "YES\n";
					return;
				}
			}
		}
	}

	cout << "NO" << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 764
// ABC056B - NarrowRectanglesEasy

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

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

int main() {
	int W, a, b;
	cin >> W >> a >> b;

	cout << max(0, abs(a - b) - W) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

const long long MOD = 1000000007;

int comb[2510][2510];

int binom(int n, int m) {
    if (m > n) {
        return 0;
    }
    return comb[n][m];
}

void solve(long long N, long long K){
    comb[0][0] = 1;
    for(int i = 1; i <= 2500; ++i) {
        comb[i][0] = 1;
        for(int j = 1; j <= 2500; ++j) {
            comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % MOD;
        }
    }
    for(int i = 1; i <= K; ++i) {
        int a = binom(K - 1, i - 1);
        int b = binom(N - K - (i - 1) + i, i);
        cout << (a * b) % MOD << endl;
    }
}

signed main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 49408
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	scanner.Split(bufio.ScanWords)
	n, k := scanInt(), scanInt()

	ans := abs(n % k)
	s := abs(ans - k)

	if s < ans {
		ans = s
	}

	fmt.Println(ans)
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanText(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func scanTexts(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanText()
	}
	return s
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}


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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    int n, m; cin >> n >> m;

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

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

    bool ans;

    for (int i = 0; i < n-m+1; ++i) {
        for (int j = 0; j < n-m+1; ++j) {
            ans = true;

            for (int k = 0; k < m; ++k) {
                for (int l = 0; l < m; ++l) {
                    if (a[i+k][j+l] != b[k][l]){
                        ans = false;
                    }
                }
            }

            if (ans) {
                puts("Yes");
                return 0;
            }
        }
    }

    puts("No");
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace kyo
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            if (x <= 1199) { Console.WriteLine("ABC");}
            else if (x <= 2799) { Console.WriteLine("ARC"); }
            else { Console.WriteLine("AGC"); }
        }
    }
}


Measured memory_bytes: 13140
a, b = map(int, input().split())

def xor(n):
    if n % 4 == 0:
        return 0 ^ n
    elif n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return 1 ^ n
    else:
        return 0
fa = xor(a - 1)
fb = xor(b)
print(fa ^ fb)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define drep(i, n) for (long long i = n - 1; i > 0; i--)
#define pb push_back
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

int main()
{
    string s;
    int sum = 0;
    cin >> s;
    for (int i = 0; i < 3; i++)
    {
        if (s[i] == '1')
        {
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

#define rep(i,n) for(int i=0;i<(n);++i)

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

  int in[N];
  vvi edge(N, vi());
  rep(i, N) in[i] = 0;
  rep(i, N-1+M) {
    int a, b; cin >> a >> b;
    --a; --b;
    edge[a].push_back(b);
    ++in[b];
  }
  stack<int> st;
  vi sorted, parent(N, -1);
  rep(i, N)
    if (in[i] == 0) st.push(i);

  while (!st.empty()) {
    int p = st.top(); st.pop();
    sorted.push_back(p);
    for (const auto& e : edge[p]) {
      --in[e];
      if (in[e] == 0) {
        st.push(e);
        parent[e] = p;
      }
    }
  }
  rep(i, N)
    cout << parent[i] + 1 << endl;


  return 0;
}


Measured memory_bytes: 7544
#include <functional>
#include <type_traits>
#include <string>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>
namespace loquat {
template <int MOD>
class modulus_integer {
public:
	typedef modulus_integer<MOD> self_type;
private:
	int m_value;
	static self_type unsafe_construct(int x) noexcept {
		self_type y;
		y.m_value = x;
		return y;
	}
public:
	modulus_integer() noexcept
		: m_value(0)
	{ }
	modulus_integer(int x) noexcept
		: m_value(x % MOD)
	{
		if(m_value < 0){ m_value += MOD; }
	}
	int operator*() const noexcept { return m_value; }
	self_type& operator=(const self_type& x) noexcept {
		m_value = x.m_value;
		return *this;
	}
	self_type operator+(const self_type& x) const noexcept {
		const int y = m_value + x.m_value;
		return unsafe_construct(y >= MOD ? y - MOD : y);
	}
	self_type& operator+=(const self_type& x) noexcept {
		return (*this = *this + x);
	}
};
template <int MOD>
inline std::ostream& operator<<(
	std::ostream& os, const modulus_integer<MOD>& x)
{
	os << *x;
	return os;
}
}
using namespace std;
static const int MOD = 1000000007;
using mint = loquat::modulus_integer<MOD>;
int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	unordered_map<int, int> last_map;
	vector<int> next(n, n);
	for(int i = n - 1; i >= 0; --i){
		auto it = last_map.find(a[i]);
		if(it != last_map.end()){ next[i] = it->second; }
		last_map[a[i]] = i;
	}
	vector<mint> dp(n + 1);
	dp[0] = 1;
	for(int i = 0; i < n; ++i){
		const int j = next[i];
		if(j != n && j != i + 1){ dp[j] += dp[i]; }
		dp[i + 1] += dp[i];
	}
	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 10824
#include<stdio.h>
int main(void)
{
	int n,m,x;
	scanf("%d %d",&n,&m);
	if(n==0){
		if(m>=1868&&m<=1911) printf("M%d\n",44-(1911-m));
		if(m>=1912&&m<=1925) printf("T%d\n",14-(1925-m));
		if(m>=1926&&m<=1988) printf("S%d\n",63-(1988-m));
		if(m>=1989&&m<=2016) printf("H%d\n",28-(2016-m));
	}
	if(n==1) printf("%d\n",1911-(44-m));
	if(n==2) printf("%d\n",1925-(14-m));
	if(n==3) printf("%d\n",1988-(63-m));
	if(n==4) printf("%d\n",2016-(28-m));
	return 0;
}	

Measured memory_bytes: 2756
var lines = [];
var readline = require('readline');
var N; var Q; var T; var D; var S = [];
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
})

rl.on('close', function () {
    var tmp = lines.shift().split(" ");
    N = Number(tmp[0]); Q = Number(tmp[1]);
    T = Array(Q); D = Array(Q);

    var golem = {};
    S = lines.shift().split("");
    for (var i = 0; i < N; i++) {
        golem[i] = {
            now: i,
            alphabet: S[i],
        }
    }
    
    for (var i = 0; i < Q; i++) {
        tmp = lines[i].split(" ");
        T[i] = tmp[0]; D[i] = tmp[1];
    }
    
    // 左から飛び出すゴーレムは左から何番目？
    a = Math.ceil(binary_search(golem, -1, N, "L"));
    
    for (var i = 0; i < N; i++) {
        golem[i] = {
            now: i,
            alphabet: S[i],
        }
    }

    // 右から飛び出すゴーレムは左から何番目？
    b = Math.ceil(binary_search(golem, -1, N, "R"));

    // リターンされた値が 0より小さい or N-1より大きいの場合，落ちるゴーレムは0
    console.log(b - a < 0 ? 0 : b - a);


});

function binary_search(g, left, right, M) {
    var ave = (left + right) / 2;
    var result = ave;

    if (left + 1 < right) {
        ave = Math.floor(ave);
        for (var i = 0; i < Q; i++) {
            
            if (T[i] === g[ave].alphabet) {
                if (D[i] === "R") { g[ave].now++; g[ave].alphabet = S[g[ave].now]; }
                else { g[ave].now--; g[ave].alphabet = S[g[ave].now]; }
            }

            // 左から飛び出したら
            if (g[ave].now < 0) {
                result = binary_search(g, ave, right, M);
                break;
            }
            // 右からから飛び出したら
            else if (N - 1 < g[ave].now) {
                result = binary_search(g, left, ave, M);
                break;
            }
            // 右から飛び出さなかったら
            else if (i === Q - 1 && M === "R") {
                result = binary_search(g, ave, right, M);
            }
            // 左から飛び出さなかったら
            else if (i === Q - 1 && M === "L") {
                result = binary_search(g, left, ave, M);
            }
            else {

            }
        }
    }
    return (result);
}

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

int main(){
  long long n,k;
  cin>>n>>k;
  pair<int,int> a[100010];
  for(int i=0;i<n;++i){
    cin>>a[i].first>>a[i].second;
  }
  sort(a,a+n);
  for(int i=0;i<n;++i){
    k-=a[i].second;
    if(k<=0){
        cout << a[i].first << endl;
        return 0;
    }
  }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  while(n--){
    bool used[14]={},ans;
    for(int i=0,a;i<6;i++)
      cin>>a,used[a]=1;
    if(used[13]&&used[1])ans=0;
    else if(!used[1]&&!used[13])ans=1;
    else{
      int l=6,r=8,t=0;
      if(used[1]){
    while(1){
      if(t){
        if(!used[r])r++;
        else if(!used[l])l--;
      }
      else{
        if(used[l])l--;
        else if(used[r])r++;
      }
      if(r==13){ans=0;break;}
      if(l==1){ans=1;break;}
      t=!t;
    }
      }
      else{
    while(1){
      if(t){
        if(!used[l])l--;
        else if(!used[r])r++;
      }
      else{
        if(used[r])r++;
        else if(used[l])l--;
      }
      if(r==13){ans=1;break;}
      if(l==1){ans=0;break;}
      t=!t;
    }
      }
    }
    if(ans)cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3084
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as M
main=print.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<B.getContents
solve(n:m:as)=foldr(\(k,v)s->truncate k*v+s)0.M.toList.f m.M.fromListWith(+).map(\a->(fromIntegral a,1))$as
f m q=foldr g q[1..m]
g _ q=M.insertWith(+)(0.5*fst(M.findMax q))1.M.updateMax(\v->if v<2 then Nothing else Just(v-1))$q

Measured memory_bytes: 24072
from collections import deque
k = int(input())
d = [-1] * (k * 10)
d[0] = 0
q = deque([0])
ans = 100000000
while q:
    p = q.pop()
    x, r = p // 10, p % 10
    if r < 9:
        t = (x + 1) % k * 10 + r + 1
        if t // 10 == 0:
            ans = min(ans, d[p] + 1)
        elif d[t] == -1:
            q.appendleft(t)
            d[t] = d[p] + 1
    t = (x * 10) % k * 10
    if d[p] != 0 and t // 10 == 0:
        ans = min(ans, d[p])
    elif d[t] == -1:
        q.append(t)
        d[t] = d[p]
print(ans)


Measured memory_bytes: 93792
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}


 main()

{
    fast
    int n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    f(m,0,n-1)
    {
        int lft=-d*(n-1-m)+c*m;
        int rgt=-c*(n-1-m)+d*m;
        if(b-a>=lft && b-a<=rgt)
        {
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;

}





































Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LOCAL 0
#define lli long long int
const lli mod=1e9+7;
const lli pINF=LLONG_MAX;
const lli nINF=-LLONG_MAX;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;}b/=2;a*=a;} return ans;}
lli invmod(lli a) {return pow(a,mod-2);}
#define vi vector<int>
#define vlli vector<lli>
#define pb push_back
#define mp make_pair
#define F first
#define S second
const int INT=-1000000000;
const int INF=0x3f3f3f3f;
#define Pa pair<int,int>
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define ld long double
#define printli(n) printf("%lld\n",n)
#define all(v) v.begin(),v.end()
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}
int a[200005];
int dp[200005];

int main() 
{
    int n;
    si(n);
    
    for(int i=0;i<n;i++) si(a[i]);
    
    int ans=0;
    
    for(int i=0;i<n;i++){
        if(dp[a[i]-1]) dp[a[i]]=dp[a[i]-1]+1;
        else dp[a[i]]=1;
        ans=max(ans,dp[a[i]]);
    }
    cout<<(n-ans)<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner

fun main(args: Array<String>) {
    data class Input(val n: Int, val m: Int, val a: List<String>, val b: List<String>)
    val (n, m, a, b) = Scanner(System.`in`).use<Scanner, Input> {
        val n = it.nextInt()    //1≦M≦N≦50
        val m = it.nextInt()
        val a: MutableList<String> = mutableListOf()
        repeat(n, {n -> a.add(it.next())})
        val b: MutableList<String> = mutableListOf()
        repeat(m, {m -> b.add(it.next())})

        Input(n, m, a, b)       // 返した後はイミュータブルリスト扱い
    }

    // m, n が少ないので、bitなどを使用せず、正規表現を用いる。
    val firstLine = Regex(b[0], RegexOption.LITERAL)
    val result = (0..n - m).any { i ->        // n-mで一致したらn-m+m-1 = n-1で終わる。
        // 1行目に一致がある行を探す
        val matchResults = firstLine.findAll(a[i])
        matchResults.any { matchResult ->      // 一致がなければ以下は無視されfalseが返る。
            val range = matchResult.range
            // i以下の行全てで一致するか確認する。
            (1 .. m - 1).all {           // m == 1の時はtrueが返るがそれでよい。
                b[it] == a[i + it].slice(range)
            }
        }
    }
    print(if (result) "Yes" else "No")
}


Measured memory_bytes: 19520
S=input()
d={}
for i in S:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
v=list(d.values())
if len(d)==2:
    if (v[0]==2)and(v[1]==2):
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

long n;
long a, b, c;
long sub() {
  long x = a + b;
  if (x < c) return -1;
  if (x % 2 != c % 2) return -1;
  long cap = (x - c) / 2;
  if (cap & c) return -1;
  long rem = a - cap;
  long ans = cap;
  for (int k = 50; k >= 0; --k) {
    if ((1ll << k) > rem) continue;
    if (c & (1ll << k)) {
      ans += 1ll << k;
      rem -= 1ll << k;
    }
  }
  cerr << ans << endl;
  return ans;
}

int main() {
  cin >> n;
  cin >> a >> b;
  for (int i = 2; i < n; ++i) {
    long p;
    cin >> p;
    c ^= p;
  }
  
  long ans = sub();
  if (ans <= 0) {
    cout << -1 << endl;
  } else {
    cout << (ans > a ? -1 : a - ans) << endl;
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define bash push_back
#define alles(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
int dx[]={1,0,-1,0,1,1,-1,-1};
int dy[]={0,-1,0,1,-1,1,-1,1};
const int INF=1 << 30;
bool inside(int x,int y,int w,int h){
  return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vit;
typedef map<string,int> mstit;
typedef priority_queue<int> pqit;

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int a[3];
  FOR(i,3) cin >>a[i];
  sort(a,a+3,greater<int>());
  cout <<a[0]*10+a[1]+a[2] fin;


  return 0;
}



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

#define int long long
const int MOD = 998244353;
using ll = long long;
using intpair = pair<int, int>;
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

int binom_max = 2e5+3;
vector<int> fact(binom_max), inv_fact(binom_max), inv(binom_max);

void modbinom_init() {
    fact[0] = fact[1] = 1;
    inv_fact[0] = inv_fact[1] = 1;
    inv[1] = 1;
    for(int i=2; i<binom_max; i++){
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        inv_fact[i] = inv_fact[i-1] * inv[i] % MOD;
    }
}

int modbinom(int n, int k){
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return fact[n] * (inv_fact[k] * inv_fact[n-k] % MOD) % MOD;
}

int modpow(int a, int n, int m = MOD){
    ll ret = 1;
    while(n>0){
        if(n&1) ret = (ret*a) % m;
        a = (a*a) % m;
        n >>= 1;
    }
    return ret % m;
}

signed main(){
    ll n, m, k;
    cin >> n >> m >> k;
    modbinom_init();
    
    ll ans = mod(m * modpow(m-1, n-1));
    for(int i = 1; i <= k; ++i){
        ll t = modbinom(n-1, i);
        t = mod(t * mod(m * modpow(m-1, n-1-i)));
        ans = mod(ans + t);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 7888
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B; cin >> A >> B;
  for(int i = 1; i <= 3; i++){
    if((A*B*i)%2 == 1){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

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

int main() {
  int N, M, K, count;
  count=1;
  cin >> N >> M;
  if (N<2) {
    cout << "1" << endl;
  }
  
  else {
    while (N!=1) {
      cin >> K;
      if (M>=K) {
        M=K;
        count++;
      }
      N--;
    }
  cout << count << endl;
  }
}

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

const int N = 1000010;
const int moder = (int) 1e9 + 7;

int fac[N], inv[N], invf[N];

int comb(int n, int m){
    if (n < m || m < 0){
        return 0;
    }
    return 1ll * fac[n] * invf[m] % moder * invf[n - m] % moder;
}

int get(int n, int l, int r){
    int ans = comb(r + n, n) - comb(l + n - 1, n);
    ans += ans < 0 ? moder : 0;
    return ans;
}

int main(){
    fac[0] = invf[0] = 1;
    for (int i = 1; i < N; ++ i){
        fac[i] = 1ll * fac[i - 1] * i % moder;
        inv[i] = i == 1 ? 1 : moder - 1ll * (moder / i) * inv[moder % i] % moder;
        invf[i] = 1ll * invf[i - 1] * inv[i] % moder;
    }
    int n, m, l, r;
    scanf("%d%d%d%d", &n, &m, &l, &r);
    int ans = get(n, l, r);
    int sub = 0;
    for (int i = 0; r >= 0; ++ i){
        l -= m, r -= m;
        for (int j = 0; j <= n - m; ++ j){
            int ll = l - (i + 1) * j, rr = r - (i + 1) * j;
            if (rr < 0){
                break;
            }
            sub = (sub + (j & 1 ? -1ll : 1ll) * comb(n - m, j) * (get(n, ll, rr) - get(n, ll - m, rr - m))) % moder;
        }
    }
    ans = (ans - 1ll * comb(n, m) * sub) % moder;
    ans += ans < 0 ? moder : 0;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 11904
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
int main()
{
fast;
string s;
cin>>s;
sort(s.begin(),s.end());
if(s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2])
{
    cout<<"Yes";
}else
{
    cout<<"No";
}

return 0;
}


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

using ll = long long;

// 各桁の数の和
int digitSum(ll x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int k;
  cin >> k;
  
  vector<ll> x;
  for (ll i = 0; i < 15; i++) {
    ll keep = pow(10, i);
    for (ll j = 1; j <= 999; j++) {
      x.emplace_back(keep * j + keep - 1);
    }
  }
  
  sort(x.begin(), x.end());
  x.erase(unique(x.begin(), x.end()), x.end());
  
  vector<bool> judge(x.size(), true);
  for (int i = 0; i < x.size() - 1; i++) {
    for (int j = i + 1; j < x.size(); j++) {
      if ((double) x.at(i) / digitSum(x.at(i)) > (double) x.at(j) / digitSum(x.at(j))) {
        judge.at(i) = false;
        break;
      }
    }
  }
  
  int it = 0;
  for (int i = 0; i < k; i++) {
    while (!judge.at(it)) it++;
    cout << x.at(it) << '\n';
    it++;
  }
}

Measured memory_bytes: 4124
/*  
    Talkin' to myself and feelin' old
    Sometimes I'd like to quit, nothin' ever seems to fit
    Hangin' around, nothin' to do but frown
    Rainy days and Mondays always get me down
    _________________________
    _________________________
    960 Hours of Solitude
    Quarantine_Day : 40
*/

#include<bits/stdc++.h>

using namespace std;

typedef long long int       ll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef pair<int, int>      pii;
typedef pair<ll, ll>		pll;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<ll>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 200005

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

    int a, b, k;
    cin>>a>>b>>k;
    set<int>st;
    for(int i = a; i < min(b + 1, a + k); i++) st.insert(i);
    for(int i = b; i > max(b - k, a - 1); i--) st.insert(i);

    for(auto i : st) cout<<i<<"\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>

#define MAX_SIZE 100000000
typedef unsigned long long ull;
using namespace std;

int main() {
  int d; cin >> d;
  string s;
  if(d >= 22 && d <= 25) {
    s = "Christmas";
    if(d == 24) {
      s += " Eve";
    } else if (d == 23) {
      s += " Eve Eve";
    } else if(d == 22) {
      s += " Eve Eve Eve";
    }
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;

typedef long long ll;


int main() {
  int N;
  cin >> N;
  string str;
  cin >> str;

  int count1 = 0;
  int count2 = 0;
  int res;

  for (int i = 0; i != str.size(); ++i) {
    if (str.at(i) == 'E') ++count2;
  }

  res = count2;
  int tmp;
  for (int i = 0; i != str.size(); ++i) {
    if (str.at(i) == 'E') --count2;
    tmp = (i - count1) + count2;
    res = min(res, tmp);
    if (str.at(i) == 'E') ++count1;
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 900
#include<stdio.h>
typedef struct{
  int p;
  float t;
}track;
main(){
  track n[25]={0};
  track temp,top,top2;
  int i,a,b,c,d,e,f,j;
  for(i=1;i<=24;i++){
    scanf("%d %f",&n[i].p,&n[i].t);
  }
  top=top2=n[1];
  for(i=2;i<=8;i++){
    if(top.t>n[i].t){
      top2=top;
      top=n[i];
    }
    if(n[i].t>top.t && top2.t>n[i].t){
      top2=n[i];
    }
  }
  printf("%d %.2f\n%d %.2f\n",top.p,top.t,top2.p,top2.t);
  a=top.p;
  b=top2.p;
  top=top2=n[9];
  for(i=10;i<=16;i++){
    if(top.t>n[i].t){
      top2=top;
      top=n[i];
    }
    if(n[i].t>top.t && top2.t>n[i].t){
      top2=n[i];
    }
  }
  printf("%d %.2f\n%d %.2f\n",top.p,top.t,top2.p,top2.t);
  c=top.p;
  d=top2.p;
  top=top2=n[17];
  for(i=18;i<=24;i++){
    if(top.t>n[i].t){
      top2=top;
      top=n[i];
    }
    if(n[i].t>top.t && top2.t>n[i].t){
      top2=n[i];
    }
  }
  printf("%d %.2f\n%d %.2f\n",top.p,top.t,top2.p,top2.t);
  e=top.p;
  f=top2.p;
  top=top2=n[1];
  for(i=2;i<=24;i++){
    if(n[i].p!=a && n[i].p!=b && n[i].p!=c && n[i].p!=d && n[i].p!=e && n[i].p!=f){
      if(top.t>n[i].t){
	top2=top;
	top=n[i];
      }
      if(n[i].t>top.t && top2.t>n[i].t){
	top2=n[i];
      }
    }
  }
  printf("%d %.2f\n%d %.2f\n",top.p,top.t,top2.p,top2.t);
  return 0;
}

Measured memory_bytes: 644
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    
    sort(A.rbegin(), A.rend());
    int S = 0;
    rep(i, N) S += A[i];
    bool judge = true;
    rep(i, M) {
        if (A[i] * 4 * M < S) judge = false;
    }
    if (judge) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s,p,x;
int dp[3002][3002];
int main()
{
    int i,j,n,m;
    cin>>s>>p;
    n=s.size();
    m=p.size();
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=m;j++)
        {
            if(i==0 || j==0)
            {
                dp[i][j]=0;
            }
            else if(s[i-1]==p[j-1])
            {
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    x.clear();
    while(dp[n][m])
    {
        if(dp[n][m]==dp[n-1][m])
        {
            n--;
        }
        else if(dp[n][m]==dp[n][m-1])
        {
            m--;
        }
        else
        {
            n--,m--;
            x+=s[n];
        }
    }
    reverse(x.begin(),x.end());
    cout<<x<<"\n";
    return 0;
}



Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

#define substrID(l, r) substr((l), (r) - (l))
#define substrII(l, r) substr((l), (r) - (l) + 1)

int main() {
	IN(string, s);
	int n = SI(s);
	
	auto f = [](string t) -> bool {
		string u = t;
		reverse(ALL(u));
		return (t == u);
	};
	
	OUT(
		(
			f(s) &&
			f(s.substrII(0, (n - 1) / 2 - 1)) &&
			f(s.substrII((n + 3) / 2 - 1, n - 1))
			? "Yes" : "No"
		)
	);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int A, B, C;
    cin >> A >> B >> C;
    int K; cin >> K;
    
    int ans = 0;
    if (A >= K) {
        ans = K;
    } else {
        ans = A;
        K -= A+B;
        if (K > 0) {
            ans -= K;
        }
    }

    cout << ans << '\n';


    return 0;
}

Measured memory_bytes: 3648