akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll k,x; cin >> k >> x;
  rep(i,2*k-1) cout << x-k+1+i << ' ';
  cout << endl;
}

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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
	
	int n; cin >> n;
	if(n==0) cout << 1;
	else if(n==1) cout << 0;
	
	return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
using namespace std;
#pragma warning(disable : 4996)


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string s1, s2, ans = "";
	cin >> s1 >> s2;
	for (int i = 0; i < n; i++) {
		ans += s1[i];
		ans += s2[i];
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#define ll long long
#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define MX 100010
using namespace std;

int a[5];
int mx,mxind;
int ans;

int func(int t){
        if(t%10==0){
                return t;
        }else{
                return 10*(t/10+1);
        }
}


int main(){
        FOR(i,0,5){
                cin >> a[i];
        }
        mx = 10;
        FOR(i,0,5){
                if(a[i]%10 > 0){
                        if(mx > a[i]%10){
                                mxind=i;
                                mx = a[i]%10;
                        }
                }
        }
        FOR(i,0,5){
                ans += func(a[i]);
        }
        ans -= func(a[mxind]);
        ans += a[mxind];
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 384
n=int(input());t,a=map(int,input().split());t-=a;t*=1000;t/=6;h=list(map(int,input().split()));minn,min=0,abs(h[0]-t)
for i in range(1,len(h)):
  if min>abs(h[i]-t):min=abs(h[i]-t);minn=i
print(minn+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(x, max(y, z))
#define MIN(x, y, z) min(x, min(y, z))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll 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);
  return (ret);
}

signed main() {
  init();
  // 入力
  ll D;
  cin >> D;
  vll C(26);
  rep(i, 26) cin >> C[i];
  vvll S(D, vll(26));
  rep(i, D) rep(j, 26) cin >> S[i][j];

  vll T(D);  // その日に行うコンテスト
  rep(i, D) {
    T[i] = (ll)(rand() % 26) + 1;
  }

  auto calc = [&]() -> ll {
    vll la(26, 0);
    ll res = 0;
    rep(i, D + 1) {
      if (i == 0) continue;
      ll t = T[i - 1];
      res += S[i - 1][t];
      la[t] = i;
      rep(j, 26) {
        res -= C[j] * (i - la[j]);
      }
    }
    return res;
  };

  rep(i, 300) {
    ll original = calc();
    ll index = rand() % D;
    ll before_contest = T[index];
    ll after_contest = rand() % 26 + 1;
    T[index] = after_contest;
    ll after = calc();
    if (original < after) {
      continue;
    } else {
      T[index] = before_contest;
    }
  }

  rep(i, D) {
    COUT(T[i]);
  }

  return 0;
}

Measured memory_bytes: 3716
#include <cstdio>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <queue>
#include <numeric>

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int d,n;
  cin >> d >> n;
  int ans;
  if (d==0) {
    if (n==100) ans = 101;
      else ans = n;
  }
  if (d==1) {
    if (n==100) ans = 10100;
    else ans = n*100;
  }
  if (d==2) {
    if (n==100) ans = 1010000;
    else ans = n*10000;
  }
  cout << ans << endl;


  return 0;
}








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

using namespace std;

#define MAX 200005
#define pb push_back

int a[MAX],f[MAX];

int main(){
	int n;
  	cin>>n;
  	for(int i=1;i<=n;i++){
      cin>>a[i];
    }
  	vector<int> ans;
  	for(int j=n;j>=1;--j){
    	int s=0;
      	for(int i=j+j;i<=n;i+=j){
        	s+=f[i];
        }
      	if(s%2!=a[j]%2){
          	ans.pb(j);
        	f[j]=1;
        }
    }
  cout<<ans.size()<<endl;
  for(int i=0;i<ans.size();++i){
  	cout<<ans[i]<<" ";
  }
	return 0;
}

Measured memory_bytes: 2936
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int res=0;
	FOR(i,1,s.size()) {
		if(s[i]!=s[i-1]) ++res;
	}
	cout<<res<<endl;
}


Measured memory_bytes: 512
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
using namespace std;

int n,y;

int main()
{
	cin >> n >> y;
	if(y > n*10000 || y < n*1000 || y%1000 != 0){
		cout << "-1 -1 -1" << endl;
		return 0;
	}
	y /= 1000;
	for(int i = 0;i <= 20005;i++){
		for(int j = 0;j <= 4005;j++){
			if(i + j*5 > y) break;
			int temp = y - (i + j*5);
			if(temp % 10 == 0 && temp/10 + i + j == n){
				cout << temp/10 << " " << j << " " << i << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

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

#define int long long
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()

#define fast ios::sync_with_stdio(0); cin.tie(0)
#define print(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1> void __f(const char* name, Arg1&& arg1){
	cout << name << ": " << arg1 << '\n';
}

template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

int32_t main(){
		
		fast;
		int n; cin >> n;
		int ar[n];

		for(int i=0;i<n;i++) cin >> ar[i];

		for(int i=n-2;i>=0;i--){
			if(ar[i]>ar[i+1]){
				ar[i]--;
			}
		}

		for(int i=1;i<n;i++){
			if(ar[i]<ar[i-1]){
				cout << "No\n";
				return 0;
			}
		}

		cout << "Yes\n";

		return 0;
} 

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

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		while(true) {
			String str=in.next();
			if(str.equals("-"))break;
			int m=in.nextInt();
			
			for(int i=0;i<m;i++) {
				int h=Integer.parseInt(in.next());
				String str1=str.substring(0, h),str2=str.substring(h);
				//out.println(str1+" "+str2);
				str=str2+str1;
			}
			out.println(str);
		}
		out.flush();
	}

}



Measured memory_bytes: 26380
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		int m = 4;
		int[] a = new int[m];
		Arrays.fill(a, Integer.MAX_VALUE);
		for (int i = 0; i < n; i++) {
			int tmp = Integer.parseInt(reader.readLine());
			if (tmp < a[0]) {
				a[3] = a[2]; a[2] = a[1]; a[1] = a[0]; a[0] = tmp;
			} else if (tmp < a[1]) {
				a[3] = a[2]; a[2] = a[1]; a[1] = tmp;
			} else if (tmp < a[2]) {
				a[3] = a[2]; a[2] = tmp;
			} else if (tmp < a[3]) {
				a[3] = tmp;
			}
		}
		reader.close();
		
		int[] ans = new int[3];
		Arrays.fill(ans, Integer.MAX_VALUE);
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < m; j++) {
				if (i != j && a[i] != Integer.MAX_VALUE && a[j] != Integer.MAX_VALUE) {
					int tmp = Integer.parseInt(String.format("%d%d", a[i], a[j]));
					if (tmp < ans[0]) {
						ans[2] = ans[1]; ans[1] = ans[0]; ans[0] = tmp;
					} else if (tmp < ans[1]) {
						ans[2] = ans[1]; ans[1] = tmp;
					} else if (tmp < ans[2]) {
						ans[2] = tmp;
					}
				}
			}
		}
		System.out.println(ans[2]);
	}
}


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

#define rep(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define repn(i, m, n) for (int (i) = (m) ; (i) < (int)(n) ; ++(i))
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define repn_rev(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= (m) ; --(i))

#define INF 2e9
#define ll long long
#define MOD 1e9+7

const int MAXN = 1005;
const int MAXV = MAXN*MAXN/2;
vector<int> to[MAXV];
int id[MAXN][MAXN];

/* 対戦する二人を入力として頂点番号を返す */
int toId(int i, int j){
    if(i > j) swap(i, j);
    return id[i][j];
}

bool visited[MAXV];
bool calculated[MAXV];
int dp[MAXV];  //max length of path from v;
int dfs(int v){
    if(visited[v]){
        if(!calculated[v]){
            return -1;
        }
        return dp[v];
    }
    visited[v] = true;
    dp[v] = 1;
    for(int u: to[v]){
        int res = dfs(u);
        if(res==-1){
            /* ループを検出した */
            return -1;
        }
        dp[v] = max(dp[v], res+1);
    }
    calculated[v] = true;
    return dp[v];
}


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

    /* 入力 */
    vector<vector<int>> a(n, vector<int>(n-1));
    rep(i, n) {
        rep(j, n-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }

    int V = 0;
    /* 試合にidを割り振る */
    rep(i, n)rep(j, n){
        if(i < j) {
            id[i][j] = V++;
        }
    }
    /* 頂点間の辺を作る */
    rep(i, n){
        rep(j, n-1){
        a[i][j] = toId(i, a[i][j]);
        }
        rep(j, n-2){
         to[a[i][j+1]].push_back(a[i][j]);   
        }
    }

    int ans = 0;
    rep(i, V){
        int res = dfs(i);
        if(res == -1){
            puts("-1");
            return 0;
        }
        ans = max(ans, dfs(i));
    }
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 38528
#include<stdio.h>
int main()
{
  int a[1000], n, i, j, k, v;
  scanf("%d", &n);
  for(k = 0; k < n; k++)
    {
      scanf("%d",&a[k]);
    }
  for(k = 0; k < n-1; k++)
    {
      printf("%d ",a[k]);
    }
  printf("%d\n", a[n-1]);
  for(i = 1; i < n; i++)
    {
      v = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > v)
	{
	  a[j+1] = a[j];
	  j--;
	  a[j+1] = v;
	}
      for(k = 0; k < n-1; k++)
	{
	  printf("%d ",a[k]);
	}
      printf("%d\n", a[n-1]);
    }
  return 0;
}



Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;

    mat ans(N, vec(N, -1));
    REP(i, N) REP(j, i){
        REP(k, 60){
            if(((i ^ j) >> k) & 1){
                ans[i][j] = k * 1;
                ans[j][i] = k * 1;
                break;
            }
        }
    }

    REP(i, N - 1){
        FOR(j, i + 1, N) cout << ans[i][j] + 1 << " ";
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 2432
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
using namespace std;

int main(){
    string S;
    cin >> S;
    int res = 0;
    if(S == "SSS"){
        res = 0;
    }else if(S == "SSR"){
        res = 1;
    }else if(S == "SRR"){
        res = 2;
    }else if(S == "RRR"){
        res = 3;
    }else if(S == "RSS"){
        res = 1;
    }else if(S == "RRS"){
        res = 2;
    }else if(S == "RSR"){
        res = 1;
    }else if(S == "SRS"){
        res = 1;
    }
    
    cout << res << endl;
}


Measured memory_bytes: 3524
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define index Index
#define Line pll
typedef long long LL;
int main(){
    int a[4];
    for(int i=0;i<4;i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+4);
    if(a[0]==1&&a[1]==4&&a[2]==7&&a[3]==9){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
	int n,c;
	double m=0;
	while(~scanf("%d",&n))
	{
		m = n;
		c = sqrt(m);
		if(pow(c,2)==m)
		{
			printf("%d\n",n);
		}
		else 
		{
			printf("%d\n",c*c);
		}
	}
	return 0;
}

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



int main(){
  long s,c;
  cin>>s>>c;
  long ans=0;
  if(2*s<=c){
    ans+=s;
    c-=s*2;
    ans+=c/4;
  }
  else{
    cout <<c/2;
    return 0;
  }
  cout <<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  ll i = 0;
  for (auto x : v){os << " [" << i++ << "]" << x; if (i % 5 == 0) os << std::endl;}
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 5 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll A, B;
  std::cin >> A >> B;

  print((A+B+1)/2);

  return 0;
}


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

#pragma GCC optimize("O3")

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for(auto x: a) {
		if(x % 2 == 0) {
			if(!(x % 3 == 0 || x % 5 == 0)) {
				cout << "DENIED";
				return 0;
			}
		}
	}
	cout << "APPROVED";
    return 0;
}


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

typedef unsigned long long  ULL;
typedef long long LL;

#define PB push_back
#define MP make_pair
#define RESET(a, b) memset(a, b, sizeof(a))
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define F first 
#define S second

 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int l;
    cin>>l;
    
    long double a= (long double)l/3;
    long double c=a*a*a;
    printf("%.12Lf", c);

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int x, a, b, c, y=0;
    scanf("%d""%d""%d", &a, &b, &c);
    for(x=a; x<=b; x++){
        if(c%x == 0){
            y=y+1;
        }
    }
    printf("%d\n", y);
    return 0;
}



Measured memory_bytes: 2108
#-*-coding:utf-8-*-

def main():
    s = input()

    if s[0] == 'A':
        s = s.replace('A', 'a', 1)
        if s[2:-1].count('C') == 1:
            temp = s[2:-1].replace('C', 'c', 1)
            ans = s[:2] + temp + s[-1]
            if ans.islower():
                print('AC')
                exit()
    print('WA')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
N, H = map(int,input().split())
L = []
maxi = 0
for _ in range(N):
    a,b = map(int,input().split())
    maxi = max(maxi, a)
    L.append((a,b))
L = [x for x in L if x[1] > maxi]
L = sorted(L,key = lambda x:x[1],reverse=True)
throw = 0
for i in range(len(L)):
    throw += L[i][1]
    if throw >= H:
        print(i + 1)
        quit()
from math import ceil
print(ceil((H - throw) / maxi) + len(L))
    


Measured memory_bytes: 64984
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b)*c/2<<endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include  "bits/stdc++.h"
using namespace std;
#define I_AM_SPEED  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define printclock  cerr <<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<" sec\n";
#define mp(a , b)   make_pair(a , b)
#define eb(a)       emplace_back(a)
#define anal         '\n'
#define mod 1000000007
//const double PI = acos(-1.0);
typedef long long ll;
typedef unsigned long long ull;

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  
  const int N = 1e6;
  ll arr[N];
  ll sum = 0;
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      
int main(){
I_AM_SPEED;
#ifndef ONLINE_JUDGE  
      freopen("input.in", "r", stdin);
      freopen("output.in", "w", stdout);
#endif 

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
          
     int n, q;
     cin >> n;
     
     for(int i = 0; i  < n; i++) {
         int x;
         cin >> x;
         sum += x;
         arr[x]++;
     }
      cin >> q;
      while(q--){
            ll  x, y;
            cin >> x >> y;
            sum -= (x*arr[x]);
            sum += y*arr[x];
            arr[y] += arr[x];
            arr[x] = 0;
            cout << sum <<anal;
      } 

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
printclock; 
return  0 ;      
}        



   

Measured memory_bytes: 4544
#include<stdio.h>
int R=1,C=1,H[1000010]={0};
int N[1000010]={-1000};
//ヒープに入れる
void hin(int a){
  int i=C++;
  for(N[R]=a;a<N[H[i/2]];i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//ヒープから最小値を取り出す
int hout(){
  int rt=H[1],nt=1,i=0,k=H[--C];
  while(nt-i){
    H[i=nt]=k;
    if(i*2  <C&&N[  k  ]>N[H[i*2  ]])H[i]=H[nt=i*2  ];
    if(i*2+1<C&&N[H[nt]]>N[H[i*2+1]])H[i]=H[nt=i*2+1];
  }
  return rt;
}
int CO[500010];
int i,id[500010],ta[100010],nt[500010],f[500010]={0};
void dijk(int v,int e,int *fr,int *to,int *co,int mi){
  //int i,id[500010],ta[100010],nt[500010],f[500010]={0};
  for(i=0;i<v;i++)ta[i]=-1;
  for(i=0;i<v;i++)CO[i]=1000000000;
  for(i=CO[mi]=0;i<e;i++){
    nt[i]=ta[fr[i]];
    ta[fr[i]]=i;
  }
  while(f[mi]-1){
    f[mi]=1;
    for(i=ta[mi];i+1;i=nt[i]){
      if(CO[to[i]]>CO[mi]+co[i])hin(CO[id[R]=to[i]]=CO[mi]+co[i]);
    }
    while(f[mi]&&C-1)mi=id[hout()];
  }
}
int main(){
  int n,m,s,a[500010],b[500010],c[500010],i;
  scanf("%d %d %d",&n,&m,&s);
  for(i=0;i<m;i++)scanf("%d %d %d",&a[i],&b[i],&c[i]);
  dijk(n,m,a,b,c,s);
  for(i=0;i<n;i++)CO[i]-1000000000?printf("%d\n",CO[i]):printf("INF\n");
  return 0;
}

Measured memory_bytes: 15652
import sys
input = sys.stdin.readline
N = int(input())
List = [[] for _ in range(N)]
ans = [-1]*N
for i in range(N-1):
    a, b, c = map(int, input().split())
    List[a-1].append((b-1, c))
    List[b-1].append((a-1, c))
Q, K = map(int, input().split())
queue = [K-1]
ans[K-1] = 0
while queue:
    edge = queue.pop()
    for node in List[edge]:
        index, cost = node
        if ans[index]>0:
            continue
        ans[index] = ans[edge]+cost
        queue.append(index)
for i in range(Q):
    x, y = map(int, input().split())
    print(ans[x-1]+ans[y-1])

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

using std::max;
using std::sort;
using std::swap;
using std::priority_queue;

typedef long long LL;
const int N=1e5+10;

struct Node {
	int a,b,c,val;
	bool operator < ( const Node &A ) const {
		return val>A.val;
	}
}p[N];

int X,Y,Z,n;

void Init() {
	scanf("%d%d%d",&X,&Y,&Z); n=X+Y+Z;
	for (int i=1;i<=n;++i) scanf("%d%d%d",&p[i].a,&p[i].b,&p[i].c);
}

LL Work(){
	LL ans=0;
	for (int i=1;i<=n;++i) p[i].val=max(p[i].c,p[i].b)-p[i].a;
	sort(p+1,p+n+1);
	for (int i=1;i<=X;++i) ans+=p[i].a;
	for (int i=X+1;i<=n;++i) p[i].val=p[i].c-p[i].b;
	sort(p+X+1,p+n+1);
	for (int i=X+1;i<=X+Y;++i) ans+=p[i].b;
	for (int i=X+Y+1;i<=n;++i) ans+=p[i].c;
	return ans;
}

priority_queue<Node>Q;
LL sumq,sum,pre[N];

void Push(Node p,int a,int b,int lim) {
	sum+=b;
	if (!Q.empty() && Q.size()>=lim) {
		Node u=Q.top();
		if (u.val<a-b) sumq-=u.val,Q.pop();
	}
	if (Q.size()<lim) sumq+=a-b,p.val=a-b,Q.push(p);
}

void Solve() {
	LL ans=Work();
	for (int i=1;i<=n;++i) p[i].val=p[i].b-p[i].a;
	sort(p+1,p+n+1); for (int i=1;i<=n/2;++i) swap(p[i],p[n-i+1]);
	sumq=sum=0;
	for (int i=1;i<=n;++i) {
		Push(p[i],p[i].a,p[i].c,X); 
		pre[i]=sum+sumq;
	}
	while (!Q.empty()) Q.pop();
	sumq=sum=0;
	for (int i=n;i>=1;--i) {
		Push(p[i],p[i].b,p[i].c,Y);
		if (n-i+1>=Y && i>=X)
			ans=max(ans,sum+sumq+pre[i-1]);
	}
	printf("%lld\n",ans);
}

int main() {
	Init();
	Solve();
	return 0;
}

Measured memory_bytes: 4724
n=int(input())
la=list(map(int,input().split()))
lb=list(map(int,input().split()))
limit=0
must=0
for i in range(n):
  if la[i]>lb[i]:
    must+=la[i]-lb[i]
  elif la[i]==lb[i]:
    pass
  else:
    limit+=(lb[i]-la[i])//2
if limit<must:
  print("No")
else:
  print("Yes")


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

typedef long long int ll;

#define endl '\n'

ll n;
ll arr[100005];
ll dp[100005];

ll solve(ll i)
{
    if(i==n-1){
        return 0;
    }
    if(dp[i]==-1){

        ll val = abs(arr[i]-arr[i+1])+solve(i+1);
        //cout<<i<<" * "<<val<<endl;
        if(i+2<=n-1){
            val = min(val,abs(arr[i]-arr[i+2])+solve(i+2));
        }
        dp[i] = val;
    }
    //cout<<i<<" "<<dp[i]<<endl;
    return dp[i];
}

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));

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

    cout<<solve(0)<<endl;
}


Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#define int long long
using namespace std;
const int N=3005;
const int mod=1e9+7;
int dp[N][N],sum[N][N];
signed main(){
	int n,i,j;
	string s;
	cin>>n>>s;
	dp[1][1]=1;
	sum[1][1]=1;
	for(i=2;i<=n;i++){
		for(j=1;j<=i;j++){
			if(s[i-2]=='<'){
				dp[i][j]=sum[i-1][j-1];
			}
			else{
				dp[i][j]=((sum[i-1][i-1]-sum[i-1][j-1])%mod+mod)%mod;
			}
			sum[i][j]=(sum[i][j-1]+dp[i][j])%mod;
		}
	}
	cout<<sum[n][n];
}

Measured memory_bytes: 139648
import java.util.Scanner;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if(a < b){
			if(b < c){
				System.out.println("Yes");
			}
			else{
				System.out.println("No");
			}
		}
		
		
		else{
			System.out.println("No");
		}
		
	}

}

Measured memory_bytes: 26176
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
	int a, b, c, x;
  int cnt=0;
  cin >> a >> b >> c >> x;
  for(int i=0; i<=a; i++){
    for(int j=0; j<=b; j++){
      for(int k=0; k<=c; k++){
        if(i*500+j*100+50*k==x){
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
long long int a,b,c;
int main(void){
scanf("%lld",&a);
 b=a/11;
 c=a%11;
 if(c==0){
 c=0;
 }else if(c<=6){
 c=1;
 }else {
 c=2;
 }
 printf("%lld",b+b+c);
 return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int x[102], y[102];
vector<int> g[102];
bool c[102];

bool dfs(int s) {
    for (int i : g[s]) if (!c[i]) {
        c[i] = 1;
        if (!y[i] || dfs(y[i])) {
            x[s] = i; y[i] = s;
            return true;
        }
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    int n, z = 0, u[102] = {}, v[102] = {}, x[102] = {}, y[102] = {};
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> u[i] >> v[i];
    for (int i = 1; i <= n; i++) cin >> x[i] >> y[i];
    for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (u[i] < x[j] && v[i] < y[j]) g[i].push_back(j);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) c[j] = 0;
        if (dfs(i)) z++;
    }
    cout << z << '\n';
}


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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 3; i <= 9; i++) {
    for (int n3 = 1; n3 + 2 <= i ; n3++) {
      for (int n5 = 1; n3 + n5 + 1 <= i ; n5++) {
          int n7 = i - n3 - n5;
          vector<int> vc;
          for (int j = 0; j < n3; j++) vc.push_back(3);
          for (int j = 0; j < n5; j++) vc.push_back(5);
          for (int j = 0; j < n7; j++) vc.push_back(7);
          do {
            string str = "";
            for (int j = 0; j < vc.size(); j++) {
              str = str + to_string(vc[j]);
            }
            if (stoi(str) <= N) {
              //cout << str << endl;
              ans++;
            }
          } while (next_permutation(vc.begin(), vc.end()));
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=[ input() for _ in range(n)]
b=[ input() for _ in range(m)]
#print(a)
#print(b)
ans='No'
for i in range(n-m+1):
    for j in range(n-m+1):
 #       print(i,j,end=' checking \n')
        #check if b is a matching from (i,j) as it's top left
        flag=True
        for ii in range(i,i+m):
            for jj in range(j,j+m):
  #              print(ii,jj,end=' ii, jj \n')
   #             print(ii-i,jj-j,end=' ii-i,jj-j\n')
                if a[ii][jj]!=b[ii-i][jj-j]:
                    flag=False
                    break
            if flag==False:
                break
        if flag==True:
            ans='Yes'
            print(ans)
            import sys
            sys.exit()
print(ans)



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

using namespace std;
const int OO = 0x3f3f3f3f;
//const long long OO = (long long) 1e18+7;
//const unsigned long long UOO = (long long) 10e18+7;
#define lp(i,a,n) for(long long i = a ; i < n ; ++i)
#define lpr(i,a,n) for(long long i = a ; i >= n ; --i)
#define rep(i,vec) for(ll i = 0 ; i < vec.size() ; ++i)
#define reprv(i,vec) for(ll i = vec.size()-1; i >=0 ; --i)
#define eps (1e-5)
#define pb(i) push_back(i)
#define EPS 1e-9
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl
#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl

typedef vector<int> vi ;
typedef   long long ll;
typedef   unsigned long long ull;
typedef vector<ll> vll ;
typedef pair<int,int> pii ;
typedef vector< pair<int,int> >  vpii;
typedef vector<pair<long long,long long>> vpll;
typedef vector<vector<int> > vvi ;
typedef complex<double> point;
typedef pair<ll,ll> pll;

using namespace std;
ll  inv(ll a, ll b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;}
ll  Pow(ll  B,ll  P){ll  R=1; while(P>0)  {if(P&1) R=(R*B);P/=2;B=(B*B);}return R;} //compute b^p
ll  GCD(ll  a,ll  b){ while(b){b ^= a ^=b ^= a %=b;}  return a;}
ll  LCM(ll  a,ll  b) { return (a / GCD(a,b)*b); }
ll  BigMod(ll  B,ll  P,ll  M){ ll  R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (ll )R;} //compute b^p%m
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//int i=uniform_int_distribution<int>(1,n)(rng);

ll MOD = 1000000007;
int n,m;
char g[1002][1002];
ll mem[1002][1002];

bool valid(int x,int y){
    return x >= 0 && y >= 0 && x < n && y < m && g[x][y] == '.';
}

ll dp(int x,int y){
    if(!valid(x,y)) return 0LL;
    if(x == n-1 && y == m-1) return 1LL;
    if(mem[x][y]!=-1) return mem[x][y];
    return mem[x][y] = (dp(x+1,y) + dp(x,y+1))%MOD;

}






int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
//    cout.tie(0);
//#ifndef ONLINE_JUDGE
//   freopen( "output.txt" , "w" , stdout ) ;
//   freopen( "input.txt" , "r" , stdin ) ;
//#endif

    cin >> n >> m;

    lp(i,0,n)lp(j,0,m) cin >> g[i][j],mem[i][j] = -1;
    cout << dp(0,0);


    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i += 2) {
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define mod 1000000007




int main()
{
	ll h,w,i,j;
	cin>>h>>w;
	char a[h][w];
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			cin>>a[i][j];
		}
	}
	long long int dp[h][w];
	for(i=0;i<w;i++)
	{
		if(a[0][i]=='#')
			break;
		dp[0][i]=1;
	}
	for(;i<w;i++)
	{
		dp[0][i]=0;
	}
	for(j=0;j<h;j++)
	{
		if(a[j][0]=='#')
		{
			break;
		}
		dp[j][0]=1;
	}
	for(;j<h;j++)
	{
		dp[j][0]=0;
	}
	for(i=1;i<h;i++)
	{
		for(j=1;j<w;j++)
		{
			if(a[i][j]=='#')
			{
				dp[i][j]=0;
			}
			else
			{
				dp[i][j]=(dp[i][j-1]%mod+dp[i-1][j]%mod)%mod;
			}
		}
	}
	cout<<dp[h-1][w-1];
}

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

int main(){
  int n;string s;
  int cnt;
  cin >> n >> s;
  for(int i=0;i<n-2;i++){
    if(s[i]=='A' && s[i+1]=='B'){
      if(s[i+2]=='C'){
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
int main() {
    ll k, a, b;
    cin >> k >> a >> b;
 
    if (a >= k){
        cout << 1 << endl;
        return 0;
    }
    if (b >= a){
        cout << -1 << endl;
        return 0;
    }
    cout << (k - a + a - b - 1) / (a - b) * 2 + 1 << endl;
 
 
    return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=998244353;
const ll INF=2e15;
const double PI=acos(-1);

vector<P> vectorCnt(vector<int> a) {
    sort(a.begin(),a.end());
    int n=a.size();
    vector<pair<int,int>> b;
    int cnt=1;
    rep(i,n-1) {
        if (a[i+1]!=a[i]) {
            b.push_back({cnt,a[i]});
            cnt=1;
        } else {
            ++cnt;
        }
    }
    b.push_back({cnt,a[n-1]});
    return b;
}

int main() {
    ios_base::sync_with_stdio(false); 

    int n;
    cin >> n;
    vector<ll> a(n);
    int cnt=0;
    rep(i,n) {
        cin >> a[i];
        if (a[i]<0) {
            ++cnt;
            a[i]=-a[i];
        }
    }
    sort(a.begin(),a.end());
    ll ans=0;
    rep(i,n) ans+=a[i];
    if (cnt%2==1) ans-=2*a[0];
    cout << ans << endl;
    


    return 0;
}


Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
int main()
{
  char x;
  //scanf("%c",&x);
  cin>>x;
  if(x=='G'){
    cout<<"C"<<endl;
  }
  if(x=='C'){
    cout<<"G"<<endl;
  }
  if(x=='A'){
    cout<<"T"<<endl;
  }
  if(x=='T'){
    cout<<"A"<<endl;
  }
  return 0;
}

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

int main(){
    int n, ans = 0;
    long long a;

    cin >> n;

    for(int i=0; i<n; ++i){
        cin >> a;
        while(a % 2 == 0){
            ++ans;
            a /= 2;
        }
    }

    cout << ans << endl;
}


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

a = [0 for i in range(3)]
b = [0 for i in range(3)]

a[0] = 0

b[0] = c[0][0]
b[1] = c[0][1]
b[2] = c[0][2]
a[1] = c[1][0] - b[0]
a[2] = c[2][0] - b[0]

if a[1] + b[0] == c[1][0] and a[2] + b[0] == c[2][0] and a[1] + b[1] == c[1][1] and a[2] + b[1] == c[2][1] and a[1] + b[2] == c[1][2] and a[2] + b[2] == c[2][2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
#include <vector>

constexpr std::uint64_t INF = 1ull << 50;

auto main() -> int {
  std::uint64_t N, K;
  std::cin >> N >> K;

  std::vector<std::uint64_t> hs(N);
  for (auto& hi : hs) {
    std::cin >> hi;
  }
  std::sort(hs.begin(), hs.end());

  std::uint64_t ans = INF;
  for (auto i = 0ul; i <= (N - K); ++i) {
    const auto hmin = hs.at(i);
    const auto hmax = hs.at(i + K - 1);
    ans = std::min(hmax - hmin, ans);
  }

  std::cout << ans << std::endl;
}


Measured memory_bytes: 1024
n=input()

n1,n2=int(n[:2]),int(n[2:])
if (n1>12 and n2>12) or (n1==0 and n2==0):
    print("NA")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("NA")



                                                                                 

Measured memory_bytes: 9100
#include <iostream>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
const ll MOD = 998244353;

int main(){
	ll n;
	string x;
	cin >> n >> x;
	
	ll e=0,m=n,t=1;
	while(m%2 == 0){
		e ++;
		m /= 2;
		t *= 2;
	}
	vector<ll> div;
	for(int i = 1 ; i <= n ; i ++){
		if(m%i == 0)div.push_back(i);
	}
	
	ll cnt[200010];
	for(int i = 0 ; i < div.size() ; i ++){
		ll d = div[i];
		cnt[d] = 0;
		for(int i = 0 ; i < d*t ; i ++){
			cnt[d] *= 2;
			cnt[d] %= MOD;
			cnt[d] += x[i]-'0';
		}
		string y = "";
		for(int i = 0 ; i < d*t ; i ++){
			y += x[i];
		}
		for(int i = 0 ; i < d*t ; i ++){
			y += '0'+(1-(x[i]-'0'));
		}
		bool b = true;
		for(int i = 0 ; i < x.size () ; i ++){
			if(x[i] < y[i%(2*d*t)]){
				b = false;
				break;
			}
			if(x[i] > y[i%(2*d*t)]){
				b = true;
				break;
			}
		}
		if(b)cnt[d] ++;
		for(int j = 0 ; j < i ; j ++){
			if(d%div[j] == 0)cnt[d] += MOD-cnt[div[j]];
		}
		cnt[d] %= MOD;
	}
	
	/*for(int i = 0 ; i < div.size() ; i ++){
		cout << div[i] << " " << cnt[div[i]] << endl;
	}*/
	
	ll ret = 0;
	/*for(int i = 0 ; i < x.size() ; i ++){
		ret *= 2;
		if(x[i] == '1')ret ++;
		ret %= MOD;
	}
	ret ++;
	ret *= 2*n;
	cout << ret << endl;
	ret %= MOD;*/
	for(int i = 0 ; i < div.size() ; i ++){
		ret += cnt[div[i]]*div[i]*2*t;
		ret %= MOD;
	}
	cout << ret%MOD << endl;
}

Measured memory_bytes: 1340
//My Conquest Is the Sea of Stars.
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define gcd __gcd
#define pb push_back
#define mp make_pair
#define lowbit(x) x & (-x)
#define PII  pair<int, int> 
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(__typeof(b) i = a; i <= (b); i++)
#define Rep(i, a, b) for(__typeof(a) i = a; i >= (b); i--)
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e6 + 5;
const ll INF = 0x3f3f3f3f3f3f3f3f;
using namespace std;

int main()
{
	int k, a, b; cin >> k >> a >> b;
	if(k < a - 1){
		cout << 1 + k << endl;
	}
	else {
		k -= a - 1;
		ll ans = a;
		if(b - a > 2){
			int t = k / 2;
			ans += (ll)t * (b - a);
			if(k & 1) ans++;
			cout << ans << endl;
		}
		else {
			cout << ans + k << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
using namespace std;
struct P{
	int num, lev;
};

int n;
string s[30];

int main() {

	while (true) {

		cin >> n;
		if (!n)break;
		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}

		stack<char> ch;
		stack<P> num;
		for (int i = 0; i <= n; i++) {

			//cout << "i:" << i << endl;
			if (n == i && ch.size() == 0)break;

			if (ch.size() >= s[i].size() || n == i) {//レベルが低かったら
				//cout << "a" << endl;
				int x;

				char ope = ch.top();
				if (ope == '+')x = 0;
				else x = 1;

				while (!num.empty()) {
					P p = num.top();
					if (p.lev < ch.size())break;
					num.pop();

					if (ope == '+') {
						x += p.num;
					}
					else {
						x *= p.num;
					}
				}

				ch.pop();
				num.push(P{ x, (int)ch.size() });
				i--;
				//cout << "  x:" << x << endl;
			}
			else {//同じか高い場合
				//cout << "b" << endl;
				if (s[i][s[i].size() - 1] == '+' || s[i][s[i].size() - 1] == '*') {//演算子の場合
					ch.push(s[i][s[i].size() - 1]);
				}
				else {//数値の場合
					num.push(P{ (int)(s[i][s[i].size() - 1] - '0'), (int)ch.size() });
				}
			}
		}

		cout << num.top().num << endl;
	}
}


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

using namespace std;

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

    if (s == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (s == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
}


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

int main(){
	int n,m;
	char a[102][102];
	
	cin >> n >> m;
	for(int i = 0;i<=n+1;i++){
		for(int j = 0;j<=m+1;j++){
			if(!i||i==n+1||!j||j==m+1) a[i][j] = '#';
			else{
				cin >> a[i][j];
			}
		}
	}
	for(int i = 0;i<=n+1;i++){
		for(int j = 0;j<=m+1;j++){
			cout << a[i][j];
			if(j==m+1) cout << endl;
		}
	}
} 

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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

std::string S;
int main() {
    std::cin >> S;
    if(S.find("AC") != std::string::npos) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int N, T;
    cin >> N >> T;
    VI a(N);
    int ama = 0;
    int mxid;
    REP(i, N) {
        //scanf("%d", &a[i]);
        cin >> a[i];
        if (ama < a[i]) {
            ama = a[i];
            mxid = i;
        }
    }
    int ami = INF;
    REP(i, mxid) {
        ami = min(ami, a[i]);
    }
    int sa = ama - ami;
    int cnt = 1;
    while (mxid < N) {
        ama = 0; ami = INF;
        int idbuf = N;;
        FOR(i, mxid + 1, N) {
            if (ama < a[i]) {
                ama = a[i];
                idbuf = i;
            }
        }
        FOR(i, mxid + 1, idbuf) {
            ami = min(ami, a[i]);
        }
        if (sa == ama - ami) {
            cnt++;
        } else if (sa < ama - ami) {
            sa = ama - ami;
        }
        mxid = idbuf;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 640
import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInt
readLnInt = map readInt'.C.words<$>C.getLine
readCsInt n = concat<$>replicateM n readLnInt

main = do
 inputs <- readLnInt
 print $ solve inputs

solve [a,b,c,k]
 | k < a = k
 | k < (a + b) = a
 | otherwise = 2*a + b - k


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

struct node{
	int key;
	node *p,*l,*r;
};

node *root,*nil;
int n;

void insert(int k){
	node *x,*y,*z;
	y=nil;
	x=root;
	z=(node*)malloc(sizeof(node));
	z->key=k;
	z->l=nil;
	z->r=nil;
	while(x!=nil){
		y=x;
		if(k<x->key){
			x=x->l;
		}
		else{
			x=x->r;
		}
	}
	z->p=y;
	if(y==nil){
		root=z;
	}
	else{
		if(z->key < y->key){
			y->l=z;
		}
		else{
			y->r=z;
		}
	}
}

void ino(node *x){
	if(x==nil){
		return;
	}
	ino(x->l);
	printf(" %d",x->key);
	ino(x->r);
}

void pre (node *x){
	if(x==nil){
		return;
	}
	printf(" %d",x->key);
	pre(x->l);
	pre(x->r);
}

int main() {
	cin>>n;
	int key;
	char c[20];
	for(int i=0;i<n;i++){
		cin>>c;
		if(c[0]=='i'){
			cin>>key;
			insert(key);
		}
		else{
			ino(root);
			cout <<endl;
			pre(root);
			cout<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 26660
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
using ll = long long;

ll n, q, a[110000], b[110000], c[110000], sum;
map<ll, ll> v;
int main() {
	scanf("%lld", &n);
	for (int i = 0; i < n; i++)
		scanf("%lld", a + i), v[a[i]]++, sum += a[i];
	scanf("%lld", &q);
	for (int i = 0; i < q; i++) {
		scanf("%lld %lld", b + i, c + i);
		sum += (c[i] - b[i]) * v[b[i]];
		v[c[i]] += v[b[i]];
		v[b[i]] = 0;
		printf("%lld\n", sum);
	}
}

Measured memory_bytes: 11528