akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		char[] arr = sc.next().toCharArray();
		int all = 0;
		int over = 0;
		StringBuilder sb = new StringBuilder();
		for (char c : arr) {
			if (c == 'a') {
				all++;
				if (all <= a + b) {
					sb.append("Yes");
				} else {
					sb.append("No");
				}
			} else if (c == 'b') {
				all++;
				over++;
				if (all <= a + b && over <= b) {
					sb.append("Yes");
				} else {
					sb.append("No");
					all--;
				}
			} else {
				sb.append("No");
			}
			sb.append("\n");
		}
		System.out.print(sb);
	}
}


Measured memory_bytes: 28652
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
 
typedef long long int ll;
using   namespace std;
#define ALL(a) ((a).begin(),(a).end())
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
const ll MOD = 1000000007;
const ll INF = 100000000;
    ll N,M;
    ll C[30];
    ll dp[21][100000];
 
    int DP(int n,int v){
      if(n<0||v<0){return INF;}
      if(dp[n][v]!=-1)return dp[n][v];
      else{
        return dp[n][v] = min(DP(n-1,v),DP(n,v-C[n])+1);
      }
    }
 
 
int main() {
    cin>>N>>M;
    REP(i,M)cin>>C[i];
    memset(dp,-1,sizeof(dp));
    REP(i,21)dp[i][0]=0;
    cout<<DP(M - 1,N)<<endl;
 
 
}

Measured memory_bytes: 19568
#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
using namespace std;

int main() {
	int n, a;
	cin >> n >> a;
	cout << n * n - a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define SZ(vvv) ((int)vvv.size())
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
using namespace std;

const int N = 5e1 + 5, M = 5e2 + 9, MOD = 1e9 + 7;

void runtestcase() {
	int x;
	cin >> x;
	if(x >= 400 && x <= 599) {
		cout << 8;
	} else if(x >= 600 && x <= 799) {
		cout << 7;
	} else if(x <= 999){
		cout << 6;
	} else if(x <= 1199) {
		cout << 5;
	} else if(x <= 1399) {
		cout << 4;
	} else if(x <= 1599) {
		cout << 3;
	} else if(x <= 1799) {
		cout << 2;
	} else
		cout << 1;
}


int main() {
	fastIO;
#ifdef LOCAL
	freopen("input.in", "rt", stdin);
//	freopen("output.in", "wt", stdout);
#endif
	int t = 1, tt = 1;
//	cin >> t;
	while(t) {
//		cout << "Case #" << tt << ':' << '\n';
		runtestcase();
		--t, ++tt;
//		cout << '\n';
	}
}


Measured memory_bytes: 3636
from itertools import *
g=lambda a,x,b:a+b if x=='+'else a-b if x=='-'else a*b
def f(s):
 for a,b,c,d in permutations(s):
  for x,y,z in product('+-*',repeat=3):
   if g(g(g(a,x,b),y,c),z,d)==10:return f"(({a}{x}{b}){y}{c}){z}{d}"
   if g(g(a,x,b),y,g(c,z,d))==10:return f"({a}{x}{b}){y}({c}{z}{d})"
 return 0
for e in iter(input,'0 0 0 0'):print(f(list(map(int,e.split()))))


Measured memory_bytes: 5652
#include <stdio.h>

int main(void)
{
        int a[5],i;
        for(i=0;i<5;i++)
                scanf("%d",&a[i]);
        for(i=0;i<5;i++)
                if(a[i]==0) break;
        printf("%d\n",i+1);
        return 0;
}


Measured memory_bytes: 1704
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<stack>
#include<map>
#include<queue>
#include<vector>
#include<cmath>
#include<set>
#define inf 0x3f3f3f3f
typedef long long ll;

const int maxn=1e5+5;

ll red[maxn],green[maxn],col[maxn];
ll t1,t2,minn,sum;
int x,y,a,b,c,flag;
bool cmp(ll a,ll b)
{
    return a>b;
}

using namespace std;

int main()
{
    scanf("%d%d%d%d%d",&x,&y,&a,&b,&c);
    for(int i=1;i<=a;i++)
        scanf("%d",&red[i]);
    for(int i=1;i<=b;i++)
        scanf("%d",&green[i]);
    for(int i=1;i<=c;i++)
        scanf("%d",&col[i]);
    sort(red+1,red+a+1,cmp);
    sort(green+1,green+b+1,cmp);
    sort(col+1,col+1+c,cmp);
    int l1=x,l2=y;
    minn=min(red[x],green[y]);
    int i=1;
    red[0]=green[0]=inf;
    while(l1>0||l2>0)
    {
        if(red[l1]<green[l2])
            flag=1;
        else
            flag=0;

        if(col[i]<minn)
            break;
        else
        {
            if(flag)
            {
                red[l1]=col[i++];
                l1--;
            }
            else
            {
                green[l2]=col[i++];
                l2--;
            }
            minn=min(red[l1],green[l2]);
        }
    }
    for(int i=1;i<=x;i++)
        sum+=red[i];
    for(int i=1;i<=y;i++)
        sum+=green[i];
    printf("%lld\n",sum);
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define modulo 1000000007
typedef long long int ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

struct alist{
	int junjo;
	int value;

	bool operator<(const alist& right) const{
		return this->value < right.value;
	}
};

int main() {
	int n;
	cin >> n;
	vector<alist> a(n);
	for(int i=0; i<n; i++) a[i].junjo = i;
	for(int i=0; i<n; i++){
		cin >> a[i].value;
	}

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

	for(int i=0; i<n; i++){
		if(a[n-1].junjo != i) cout << a[n-1].value << endl;
		else cout << a[n-2].value << endl;
	}

	return 0;
}

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

const ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    long double L;
    cin >> L;
    long double e = L/3;
    printf("%.12Lf\n", e*e*e);
    return 0;
}

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

int main() {
        int N, M;

        cin >> N >> M;
        while (N + M != 0) {
                vector<int> st(N + 1, 0);
                vector<pair<int, int>> p(M*2);
                rep(m, M) {
                        int a, b;
                        cin >> a >> b;
                        p.at(m)   = make_pair(b, a);
                        p.at(m+M) = make_pair(a, b);
                }
                sort(p.begin(), p.end());
                rep(m2, M*2) {
                        if (p.at(m2).first == 1) {
                                st.at(p.at(m2).second) = 1;
                                rep(m3, M*2) {
                                        if (p.at(m3).first == p.at(m2).second) {
                                                st.at(p.at(m3).second) = 1;
                                        }
                                }
                        } else {
                                break;
                        }
                }
                st.at(1) = 0;
                cout << accumulate(st.begin(), st.end(),0) << endl;
                cin >> N >> M;
        }
        return 0;
}



Measured memory_bytes: 3036
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    string S;
    cin>>S;
    if ('a'<=S[0]&&S[0]<='z')cout<<'a'<<endl;
    else cout<<'A'<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
typedef pair < ll , pair < ll , ll > > cm;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)
#define clean cout.flush()

const ll mod = (ll)1e9+7;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};

void solve(){
	
	ll n;
	cin >> n;
	vector < string  > s;
	s.pb("AC");
	s.pb("WA");
	s.pb("TLE");
	s.pb("RE");
	map < string , ll > m;
	while(n--){
		string k;
		cin >> k;
		m[k]++;
	}
	for(auto u : s){
		cout << u << " x " << m[u] << '\n';
	}
	return;
}


int main(int argc, char *argv[]) {
   
   ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    //	printf("Case %lld: \n",++CT);
		solve();
	}
    
    return 0;
}

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

#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<cstdlib>

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<complex>
using namespace std;

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


//4-side
//int xx[] = {0,0,-1,1};
//int yy[] = {-1,1,0,0};
//6-side hexagonal
//int xx[] = {2,-2,1,1,-1,-1};
//int yy[] = {0,0,1,-1,1,-1};

#define popc(a) (__builtin_popcount(a))
//ll bigmod(ll a,ll b,ll m){if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a) % m;return x;}
//ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;} /// (B^P)%M

#define MX 100005
#define inf 100000000

const double pi = acos(-1.0);
const ll mod = 1000000007ll;

int cnt[MX];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        char ch;
        scanf(" %c", &ch);
        cnt[ch] = 1;
    }
    int ans = 0;
    for(int i = 0; i < MX; i++)
        ans += cnt[i];
    if(ans == 3)
        puts("Three");
    else if(ans == 4)
        puts("Four");
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++){
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());

    for (int i = 0; i < n - 1; i++){
        if(A.at(i) == A.at(i+1)){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int N = 7e2 + 1;
vector<int>g[N];
bool is[N][N];
int n,m,col[N],ans[2][N],at,dp[N][N];
void no(){puts("-1");exit(0);}
void dfs(int u){
	ans[col[u] - 1][at]++;
	for(auto i : g[u]){
		if(col[i] == col[u])no();
		if(!col[i]){
			col[i] = (col[u]&1) + 1;
			dfs(i);
		}
	}
}
int find(int a,int b){return a*(a - 1)/2 + b*a;}
int calc(int u,int black,int sum){
	if(u == n)return 0;
	int &ref = dp[u][black];
	if(ref != -1)return ref;
	ref = 1e9;
	return ref = min(calc(u + 1,black + ans[0][u],sum + ans[0][u] + ans[1][u]) + find(ans[0][u],black) + find(ans[1][u],sum - black),calc(u + 1,black + ans[1][u],sum + ans[0][u] + ans[1][u]) + find(ans[0][u],sum - black) + find(ans[1][u],black));
}
int main(){
	//freopen("readin.txt","r",stdin);
	scanf("%d%d",&n,&m);
	for(int i = 0,a,b;i < m;i++){
		scanf("%d%d",&a,&b);
		if(a > b)swap(a,b);
		is[a - 1][b - 1] = 1;
	}
	memset(dp,-1,sizeof dp);
	for(int i = 0;i < n;i++)
		for(int j = i + 1;j < n;j++)
			if(!is[i][j])
				g[i].push_back(j),
				g[j].push_back(i);
	for(int i = 0;i < n;i++)
		if(!col[i])col[i] = 1,at = i,dfs(i);
	printf("%d\n",calc(0,0,0));
}

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

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

    vector<long long> a(3 * N);
    for (long long &aa : a)
    {
        cin >> aa;
    }

    vector<long long> dp(3 * N, 0);
    priority_queue<long long, vector<long long>, greater<long long>> q;
    long long sum = 0;
    for (size_t i = 0; i < 2 * N; i++)
    {
        sum += a[i];
        q.push(a[i]);
        if (q.size() > N)
        {
            sum -= q.top();
            q.pop();
        }
        dp[i] = sum;
    }

    vector<long long> ep(3 * N, 0);
    priority_queue<long long> qq;
    sum = 0;
    for (size_t i = 0; i < 2 * N; i++)
    {
        size_t j = a.size() - i - 1;
        sum += a[j];
        qq.push(a[j]);
        if (qq.size() > N)
        {
            sum -= qq.top();
            qq.pop();
        }
        ep[j] = sum;
    }

    long long ans = LONG_LONG_MIN;
    for (int i = N; i <= 2 * N; i++)
    {
        ans = max(ans, dp[i - 1] - ep[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 9588
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include <tuple>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
//#include "toollib.h"
#pragma warning (disable:4018)
#define INT_MAX 2147483647
using namespace std;

int main() {
	vector<int> ret;
	int n, q;
	int find_x = -1, find_y = -1;
	cin >> n >> q;
	vector<int> a(n, INT_MAX);
	for (int i = 0; i < q; i++) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0) a[x] = y;
		else {
			int m = INT_MAX;
			for (int i = x; i <= y; i++) m = min(m, a[i]);
			ret.push_back(m);
		}
	}
	for (int i = 0; i < ret.size(); i++) {
		cout << ret[i] << endl;
	}
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	auto Q=in();
	REP(i,Q){
		auto x1=in(),y1=in(),x2=in(),y2=in();
		auto x3=in(),y3=in(),x4=in(),y4=in();
		double dx1 = x2-x1,dy1 = y2-y1;
		double norm = hypot(dx1,dy1);
		dx1/=norm,dy1/=norm;
		double dx2 = x4-x3,dy2 = y4-y3;
		norm = hypot(dx2,dy2);
		dx2/=norm,dy2/=norm;

		double inner = dx1*dx2+dy1*dy2;
		if(abs(inner)<=1e-10){
			out(1);
		}
		else if(abs(inner)>=1.0-1e-10){
			out(2);
		}
		else out(0);
	}
	return 0;
}



Measured memory_bytes: 3224
#include "bits/stdc++.h"
using namespace std;


int main() {
  int N,K,sum=1;
  cin >> N >> K;
  for(int i=0;i < N; i++){
    if(sum*2 < sum + K){
      sum *=2;
    }else{
      sum +=K;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
z='abcdefghijklmnopqrstuvwxyz'
def f(x):
 for i in range(1,26,2):
  for j in range(26):
   a=''.join(z[(z.index(c)*i+j)%26]if c in z else c for c in x)
   if'that'in a or'this'in a:return a
for _ in[0]*int(input()):print(f(input()))


Measured memory_bytes: 5608
// スタックサイズ: 100MB

#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1e18;
const double EPS = 1e-10;
const ll mod = 1e9 + 7;
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }




int main() {
	fastio;

	ll N, M;
	cin >> N >> M;
	ll maxl = -INF, minr = INF;
	rep(i, M) {
		ll l, r;
		cin >> l >> r;
		maxl = max(maxl, l);
		minr = min(minr, r);
	}
	cout << max(ll(0), minr - maxl + 1) << endl;
}

Measured memory_bytes: 256
use std::collections::HashSet;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();

    let s = buf.trim().parse::<i32>().unwrap();

    let mut results = HashSet::new();

    results.insert(s);
    let mut v = s;
    for (index, _) in (s-1000000..s).rev().enumerate() {
        let index = index + 2;
        v = func(v);
        if results.contains(&v) {
            println!("{}", index);
            break;
        }
        results.insert(v);
    }
}
fn func(n: i32) -> i32 {
    return if n % 2 == 0 {
        n / 2
    } else {
        3 * n + 1
    }
}


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

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int x;
	cin >> x;
	if (x < 1200) cout << "ABC\n";
	else cout << "ARC\n";

	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] n = new int[s];
		
		for(int i= 0; i < s; i++){
			n[i] = sc.nextInt();
		}

		int b,c;

		for(int i = 1; i < s; i++){
			for(int k = 0; k < s-1; k++){
				System.out.print(n[k] + " ");
			}
			System.out.println(n[s-1]);

			b = n[i];
			c = i-1;

			while(c >= 0 && n[c] > b){
				n[c+1] = n[c];
				c--;
			}
			n[c+1] = b;
		}
		for(int k = 0; k < s-1; k++){
			System.out.print(n[k] + " ") ;
		}
		System.out.println(n[s-1]);
	}
}

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

using namespace std;

/*
各記号の意味
 I:1, V:5, X:10, L:50, C:100, D:500, M:1000

 規則
 小さい数字が大きい数字の後に続いている。(右側にある)
 　→足し算する

 小さい数字が大きい数字の前にある。(左側)
 　→一つだけ引き算をする。
 
 方法
  基本的には前から順番に足し算していく。
  引き算が発生するのは1つ前の値が小さい場合だけ。
  一文字ずつチェックするときに前の値を記録しておき、
  小さければ引き算、それ以外ならその値を足していく。
*/

int roman_to_number(char roman){
	switch (roman) {
	case 'I':
		return 1;
	case 'V':
		return 5;
	case 'X':
		return 10;
	case 'L':
		return 50;
	case 'C':
		return 100;
	case 'D':
		return 500;
	case 'M':
		return 1000;
	default:
		// その他の数字の場合入力にエラーがある。
		// このプログラムでは例外を投げて対処しない。
		throw -1;
	}
}

int main() {
	string line;
	while (cin >> line) {
		int sum = 0;
		int temp = 0;
		for (auto c : line) {
			int num = roman_to_number(c);
			if (temp == 0) {
				//初回 or 前回引き算の処理をしている。
				temp = num;
			}
			else if (num > temp) {
				// 前回の値が今回の値より小さいとき、
				// 前回の値を今回の値から引いた値を合計に足す
				// 今回の値は合計値に利用するためtempは0にしておく
				sum += num - temp;
				temp = 0;
			}
			else {
				// 前回の値が今回の値以上の場合、前回の値を合計値に足す。
				// 今回の値は次回の値チェックで使用するためtempに記録
				sum += temp;
				temp = num;
			}
		}
		// 最後にチェックした時に引き算でないと合計値が確定していないため、値を加算しておく。
		sum += temp;

		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 1184
# bit全探索

S = input().strip()

ans = 0
for i in range(2**(len(S)-1)):
    e = ['' if c == '0' else '+' for c in format(i, 'b').zfill(len(S))]
    ans += eval(''.join(a+b for a, b in zip(e, S)))
print(ans)


Measured memory_bytes: 40048
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>

#define ll long long
#define ull unsigned long long
#define ui unsigned int

using namespace std;

int tbl[40320][8];
int N;
int sz;

int temp[8];
bool used[9];

int X[8];
int Y[8];

void calc(int idx)
{
	if (idx == N)
	{
		for (int i = 0; i < N; ++i) tbl[sz][i] = temp[i];
		sz++;
		return;
	}
	for (int i = 1; i <= N; ++i)
	{
		if (used[i]) continue;
		temp[idx] = i;
		used[i] = true;
		calc(idx + 1);
		used[i] = false;
	}
}

int main()
{
	scanf("%d", &N);
	calc(0);
	
	for (int i = 0; i < N; ++i) scanf("%d", &X[i]);
	int ed = 1;
	for (int i = 0; i < N; ++i)
	{
		ed *= (i + 1);
		scanf("%d", &Y[i]);
	}

	int ans = 0;
	int i;

	int a = 0;
	int b = 0;

	for (i = 0; i < ed; ++i)
	{
		bool X_same = true;
		bool Y_same = true;

		for (int j = 0; j < N; ++j)
		{
			if (tbl[i][j] != X[j])
			{
				X_same = false;
			}
			if (tbl[i][j] != Y[j])
			{
				Y_same = false;
			}
		}

		if (X_same)
		{
			a = i;
		}
		if (Y_same)
		{
			b = i;
		}
	}

	printf("%d\n", (a - b) < 0 ? (b - a) : (a - b));

	return 0;
}

Measured memory_bytes: 1408
x1, y1, x2, y2 = map(int, input().split())

x = x2 - x1
y = y2 - y1
x3, y3, x4, y4 = x2 - y, y2 + x, x1 - y, y1 + x

print('{} {} {} {}'.format(x3, y3, x4, y4))


Measured memory_bytes: 2940
#include<stdio.h>
int main(void){
  int N,a,b,c,d;
  scanf("%d",&N);
  a = N/10;
  b = N%10;
  c = a/10;
  d = a%10;
  if(b==7||c==7||d==7){printf("Yes\n");
  }else {printf("No\n");
} return 0;
}


Measured memory_bytes: 2084
#include<bits/stdc++.h> 
#include <chrono> 
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#define mod 1000000007
#define mod2 998244353
#define int long long
#define endl "\n"
#define p_b push_back
#define m_p make_pair
#define fastIO ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
using namespace std::chrono; 

template <class T> 
using _ost = tree<
		T, 
		null_type, 
		less_equal<T>, 
		rb_tree_tag, 
        tree_order_statistics_node_update>;

char alphabet[26] = {'a','b','c','d','e','f','g','h','i',
       'j','k','l','m','n','o','p','q','r','s','t','u','v',
       'w','x','y','z'};

// rectangle intersection
// x5 = max(x1, x3);
// y5 = max(y1, y3);
// x6 = min(x2, x4);
// y6 = min(y2, y4); 

// const int mx = 20005;

// char get_next(char c) {
// 	for(int i=0; i<25; i++) if(c == alphabet[i]) return alphabet[i+1];
// 	return 'a';
// }

int32_t main() {
 	fastIO;
	int tc;
	// cin >> tc;
	tc = 1;
	while(tc--) {
		int n, k;
		cin >> n >> k;
		int a[n+1];
		vector<string> res;
		for(int i=1; i<=n; i++) {
			cin >> a[i];
			if(i>=k+1) {
				if(a[i-k] >= a[i]) res.p_b("No");
				else res.p_b("Yes");
			}
		}
		for(auto v: res) cout << v << endl;
    }     
}


Measured memory_bytes: 12656
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 1e6 + 10;
int n, m;
ll k, a[N], b[N];
int ans;
int main() {
	scanf("%d%d%lld", &n, &m, &k);
	for (int i = 1; i <= n; i++)scanf("%lld", &a[i]);
	for (int i = 1; i <= m; i++)scanf("%lld", &b[i]);
	for (int i = 1; i <= n; i++)a[i] += a[i - 1];
	for (int i = 1; i <= m; i++)b[i] += b[i - 1];
	for (int i = 0; i <= n && k >= a[i]; i++) {
		int tmp = upper_bound(b + 1, b + m + 1, k - a[i]) - b - 1;
		ans = max(ans, tmp + i);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 6852
n, s = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353

dp = [0] * (s+1)
ans = 0
for i in range(n):
    ndp = dp[:]
    if a[i] <= s:
        ndp[a[i]] = (ndp[a[i]] + i+1) % mod
    for j in range(s):
        if j+a[i] <= s:
            ndp[j+a[i]] = (ndp[j+a[i]] + dp[j]) % mod
    ans = (ans + ndp[s]) % mod
    dp = ndp[:]
print(ans)


Measured memory_bytes: 44092
import sys

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

ans = 0
max = -1
min = sys.maxsize

for i in range(a):
    
    c = b[i]

    if c <= min:
        min = c

    if c <= max and c <= min or i == 0:
        ans += 1

    if c >= max:
        max = c

print(ans)

Measured memory_bytes: 24744
#include<stdio.h>
#define N 100

int main()
{
  int i,j,num,A[N],swap,cnt = 0;

  while(1)
    {
      scanf("%d",&num);
      if(num >= 1 && num <= N) break;
    }

  for(i=0;i<num;i++) scanf("%d",&A[i]);
  
  for(i=0;i<num;i++)
    {
      for(j=num-1;j>=1;j--)
	{
	  if(A[j] < A[j-1])
	    {
		  swap = A[j];
		  A[j] = A[j-1];
		  A[j-1] = swap;
		  cnt++;
	    }
	}
    }


  for(i=0;i<num;i++)
    {
      if(i!=num-1) printf("%d ",A[i]);
      else printf("%d\n",A[i]);
    }

  printf("%d\n",cnt);
  
  return 0;
}



Measured memory_bytes: 2124
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

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

const int INF = 1e9;
const int MOD = 1e9+7;

int main(void){
    int l, n;
    cin >> l >> n;
    int m = 0;
    REP(i, n){
        int x, w;
        cin >> x >> w;
        if(x){
            m += w * x;
        }
    }
    if(m == 0){
        cout << 0 << endl;   
    }else{
	    cout << 1 << endl;
        cout << (m < 0 ? "1 " : "-1 ") << abs(m) << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    vector <char> C;
    int n=s.length(),m=t.length(), Y=n, X=m;
    int D[n+1][m+1];
    for (int i = 0; i <= n; i++)
    {
        for (int y = 0; y <= m; y++)
        {
            D[i][y] = 0;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        for (int y = 1; y <= m; y++)
        {
            D[i][y] = max(D[i-1][y],D[i][y-1]);
            if (s[i-1] == t[y-1])
            {
                D[i][y] = max(D[i-1][y-1] + 1,D[i][y]);
            }
        }
    }
    while (D[Y][X] > 0)
    {
        while (Y > 0 && D[Y-1][X] == D[Y][X])
        {
            Y--;
        }
        while (X > 0 && D[Y][X-1] == D[Y][X])
        {
            X--;
        }
        C.push_back(s[Y-1]);
        Y--;
        X--;
    }
    for (int i = C.size()-1; i >= 0; i--)
    {
        cout << C[i];
    }
    return 0;
}


Measured memory_bytes: 35456
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
using System.IO;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var n = cin.ReadInt;
            var q = cin.ReadInt;
            var s = cin.Read;
            var counts = new List<int>();
            counts.Add(0);
            var sumval = 0;

            for (var i = 0; i < s.Length-1; i++) {
                if (s[i] == 'A' && s[i+1] == 'C') {
                    sumval++;
                } 
                counts.Add(sumval);
            }
            
            for (var i = 0; i < q; i++) {
                var l = cin.ReadInt;
                var r = cin.ReadInt;
                var ans = counts[r-1]-counts[l-1];
                WriteLine(ans);
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 17604
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000000000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll a,b;
    cin>>a>>b;
    if(b >= a)
        cout<<"unsafe";
    else
        cout<<"safe";
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    uint N, K; cin >> N >> K;
    cout << (N%K==0 ? 0:1) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

string S, T;
int K, res, DP[302][302][302];
int main() {
	cin >> S >> K;
	T = S;
	reverse(T.begin(), T.end());
	for (int i = 0; i <= K; i++) {
		for (int j = 0; j < S.size(); j++) {
			for (int k = 0; k < T.size(); k++) {
				if (S[j] == T[k]) {
					DP[j + 1][k + 1][i] = max(DP[j + 1][k + 1][i], DP[j][k][i] + 1);
				}
				DP[j + 1][k][i] = max(DP[j + 1][k][i], DP[j][k][i]);
				DP[j][k + 1][i] = max(DP[j][k + 1][i], DP[j][k][i]);
				DP[j + 1][k + 1][i + 1] = max(DP[j + 1][k + 1][i + 1], DP[j][k][i] + 1);
			}
		}
	}
	res = 1;
	for (int i = 1; i < S.size(); i++) {
		res = max(res, DP[i][S.size() - i][K] * 2);
		res = max(res, DP[i][S.size() - i - 1][K] * 2 + 1);
	}
	cout << res << endl;
}

Measured memory_bytes: 107520
#include<stdio.h>
int main(){
  int n,i,s;
  int d[110];
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<=n;i++){
      scanf("%d",&d[i]);
    }
    if(d[1]-d[0]==d[2]-d[1]&&d[3]-d[2]==d[1]-d[0]){
      s=d[1]-d[0];
      for(i=2;i<n;i++){
	if(d[i+1]-d[i]!=s){
	  printf("%d\n",d[i+1]);
	  break;
	}
      }
    }
    else{
      if     (d[4]-d[2]==d[1]-d[0])printf("%d\n",d[3]);
      else if(d[4]-d[3]==d[1]-d[0])printf("%d\n",d[2]);
      else if(d[4]-d[3]==d[2]-d[0])printf("%d\n",d[1]);
      else                         printf("%d\n",d[0]);
    }
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
	int n,max=0,sum=0;
	cin >> n;
	vector<int> h(n);
	
	for(int i=0;i<n;i++){
		cin >> h[i];
		if(h[i] >= max){
			sum ++;
			max = h[i];
		}
	}
	cout << sum << endl;
	
	
	return 0;
}


Measured memory_bytes: 256
// Devarshi

#include<bits/stdc++.h>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn=1000001;

int main(){

sync
map<char,char> hsh;
string s,t;
cin>>s>>t;
int n=s.size();
forn(i,n){
    if(hsh.find(t[i])==hsh.end()){
        hsh[t[i]]=s[i];
    }
    else{
        if(hsh[t[i]]!=s[i]){
            cout<<"No";
            return 0;
        }
    }
}
hsh.clear();
forn(i,n){
    if(hsh.find(s[i])==hsh.end()){
        hsh[s[i]]=t[i];
    }
    else{
        if(hsh[s[i]]!=t[i]){
            cout<<"No";
            return 0;
        }
    }
}
cout<<"Yes";
return 0;
}


Measured memory_bytes: 916
import math
while True:
    count = int(input())
    if count == 0:
        break

    data = [int(i) for i in input().split()]
    m = sum(data) / len(data)
    a = sum([(x - m) ** 2 for x in data]) / count

    print('{0:.5f}'.format(math.sqrt(a)))

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

int main(){
	int A,B;
	cin>>A>>B;
	if(A<B){
		swap(A,B);
	}

	if (A%2 == B%2){
		cout<<(A+B)/2<<endl;
	}
	else{
		cout<<"IMPOSSIBLE"<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fr(i, a, b) for(int i=a; i>=b; i--)
using namespace std;

int main()
{
    FAST
 int a,b,c;
 int k,cnt=0;
  cin>>a>>b>>c;
  cin>>k;
  
  while(b<=a)
  {
  	b*=2;
  	cnt++;
  }
  while(c<=b)
  {
  	c*=2;
  	cnt++;
  }
//  cout<<cnt<<endl;
  if(cnt<=k)
  cout<<"Yes";
  else
  cout<<"No";
  
    return 0;
}

Measured memory_bytes: 3636
import sys
import pprint
from collections import deque
import itertools

def bfs(i,j,maze,depth):
    queue = deque([[i,j]])
    depth[i][j] = 0
    while queue:
        x, y = queue.popleft()

        if maze[x][y] == '#':
            continue

        for a,b in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_x, new_y = x+a, y+b
            if maze[new_x][new_y] == '#' or depth[new_x][new_y] >= 0:
                pass
            else:
                depth[new_x][new_y] = depth[x][y] + 1
                queue.append([new_x, new_y])

    return max(list(itertools.chain.from_iterable(depth)))

def main():
    H, W = list(map(int, input().split()))
    maze = [['#'] * (W+2) for _ in range(H+2)]

    for m in range(1,H+1):
        maze[m][1:W+1] = list(input())

    ans = []
    for i in range(1, H+1):
        for j in range(1, W+1):
            depth = [[-1] * (W+2) for __ in range(H+2)]
            ans.append(bfs(i,j,maze,depth))

    print(max(ans))

main()

Measured memory_bytes: 3572
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " << a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	string s;
	cin >> s;
	ll ans = 0, len = 0;
	rep(i, 0, s.length())
	{
		if (s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T')
			len++;
		else
		{
			ans = max(ans, len);
			len = 0;
		}
	}
	ans = max(ans, len);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3616
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        S: chars,
    }
    let mut S = S;
    S.sort();
    println!("{:}", if S.into_iter().collect::<String>()=="abc"{"Yes"}else{"No"});
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
 
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<VVLL> VVVLL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_LARGE = 1000000100;
 
 
//debug func
template<typename T>
void vecprint(vector<T> v) {
    for(auto x : v) {
        cerr << x << " ";
    }
    cerr << endl;
}
 
template<typename T>
void vecvecprint(vector<vector<T>> vv) {
    REP(i, SIZE(vv)) {
        REP(j, SIZE(vv[i])) {
            cerr << vv[i][j] << " ";
        }
        cerr << endl;
    }
}
 
template<typename T>
void pqprint(priority_queue<T> q) {
    while(!q.empty()) {
        cerr << q.top() << " ";
        q.pop();
    }
    cerr << endl;
}
 
template<typename T>
void qprint(queue<T> q) {
    while(!q.empty()) {
        cerr << q.front() << " ";
        q.pop();
    }
    cerr << endl;
}
 
template<typename T>
void vecqprint(vector<queue<T>> v) {
    for(int i = 0; i < v.size(); i++) {
        qprint(v[i]);
    }
}
 
template <typename Iterator>
inline bool next_combination(const Iterator first, Iterator k, const Iterator last)
{
   /* Credits: Thomas Draper */
   if ((first == last) || (first == k) || (last == k))
      return false;
   Iterator itr1 = first;
   Iterator itr2 = last;
   ++itr1;
   if (last == itr1)
      return false;
   itr1 = last;
   --itr1;
   itr1 = k;
   --itr2;
   while (first != itr1)
   {
      if (*--itr1 < *itr2)
      {
         Iterator j = k;
         while (!(*itr1 < *j)) ++j;
         iter_swap(itr1,j);
         ++itr1;
         ++j;
         itr2 = k;
         rotate(itr1,j,last);
         while (last != j)
         {
            ++j;
            ++itr2;
         }
         rotate(k,itr2,last);
         return true;
      }
   }
   rotate(first,k,last);
   return false;
}

inline double get_time_sec(void){
    return static_cast<double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count())/1000000000;
}

template<typename T>
T gcd(T a, T b) {
    if(a > b) swap(a, b);
    if(a == 0) return b;
    else return gcd(b%a, a);
}

template<typename T>
map<T, T> prime_list(T n) {
    map<T, T> ret;
    for(T i = 2; i*i <= n; i++) {
        if(n % i == 0) {
            ret[i] = 0;
            while(n % i == 0) {
                n /= i;
                ret[i]++;
            }
        } 
    }
    if(n != 1) ret[n]++;
    return ret;
}

int main(void) {
    int k, x;
    cin >> k >> x;
    FOR(i, x-k+1, x+k) cout << i << " ";
    cout << endl;
}

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

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin>>N;
vector<int>H(N);
rep(i,N)cin>>H[i];

int max_height=0;
int cnt=0;

rep(i,N){
    if(H[i]>=max_height)cnt++;
    max_height=max(max_height,H[i]);
}
cout<<cnt<<endl;;
//system("pause");
return 0;
}

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

typedef struct {
	char before;
	char after;
}Change;

int main()
{
	int n, m;
	std::vector<Change> vec;
	char temp1, temp2;
	std::vector<char> ans;
	std::vector<std::vector<char>> answer;


	while (1) {
		std::cin >> n;

		if (n == 0) {
			break;
		}

		vec.clear();
		for (int i = 0; i < n; i++)
		{
			std::cin >> temp1 >> temp2;
			Change temp = { temp1,temp2 };
			vec.push_back(temp);
		}

		std::cin >> m;

		ans.clear();
		for (int i = 0; i < m; i++)
		{
			std::cin >> temp1;
			for (unsigned int j = 0; j < vec.size(); j++) {
				if (vec[j].before == temp1) {
					temp1 = vec[j].after;
					break;
				}
			}
			ans.push_back(temp1);
		}
		answer.push_back(ans);
	}

	for (unsigned int i = 0; i < answer.size(); i++)
	{
		for (unsigned int j = 0; j < answer[i].size(); j++)
		{
			std::cout << answer[i][j];
		}
		std::cout << std::endl;
	}
	
	return 0;
}

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

int main() {
  int a,b,c;
  cin>>a>>b;
  if(a==1&&b==2) cout<<"3"<<endl;
  if(a==2&&b==1) cout<<"3"<<endl;
  if(a==1&&b==3) cout<<"2"<<endl;
  if(a==3&&b==1) cout<<"2"<<endl;
  if(a==2&&b==3) cout<<"1"<<endl;
  if(a==3&&b==2) cout<<"1"<<endl;

   return 0;
}


Measured memory_bytes: 256
#define q(x,y)(f[x]*h[y]%m*h[(x)-(y)]%m)
const z=2e5,m=1e9+7;long long H,W,A,B,i=2,f[1<<18],g[1<<18],h[1<<18],r;
main(){
for(f[0]=f[1]=g[1]=1;i<z;i++)f[i]=f[i-1]*i%m,g[i]=g[m%i]*(m-m/i)%m;
for(h[0]=i=1;i<z;i++)h[i]=h[i-1]*g[i]%m;
for(scanf("%d%d%d%d",&H,&W,&A,&B),i=0;i<W-B;i++)r=(r+q(A+i-1,i)*q(W-i+H-A-2,H-A-1))%m;
i=!printf("%d\n",r);
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>;
using namespace std;
//#define LOCAL
typedef long long ll;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
int main(){
#ifdef LOCAL
     freopen("in.txt", "r", stdin);
     //freopen("out.txt", "w", stdout);
#else
 fastIO;
#endif
//***************************//**************************//******************************
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.size()<=k){
        cout<<s;
    }else{
        vector<char> aux;
        for(int i=0;i<k;i++){
            aux.push_back(s[i]);
        }
        for(auto &x:aux){
            cout<<x<<"";
        }
        cout<<"...";
        aux.clear();
    }
}


Measured memory_bytes: 3676
#include<stdio.h>

#define N 50

/*int fib(int n){

  if(n==0 || n==1) return 1;

  return fib(n-1)+fib(n-2);

  }*/

int main(){
  int i,n,fib[N];

  scanf("%d",&n);

  fib[0]=fib[1]=1;

  for(i=2;i<=n;i++){
    fib[i]=fib[i-2]+fib[i-1];
  }
  
  printf("%d\n",fib[n]);

  return 0;
}



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

int main() {
    int answer = 0;
    int N, A, B;
    cin >> N >> A >> B;
    for (int i = 1; i <= N; ++i) {
        int temp = 0, j = i;
        while (j != 0) {
            temp += j % 10;
            j /= 10;
        }
        if (A <= temp && temp <= B) {
            answer += i;
        }
    }
    cout << answer << endl;
}


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

using namespace std;

void swap(int& a, int& b){
	int tmp = a;
	a = b;
	b = tmp;
}

int main(void){
	int a,b;
	vector<int> gcd;
	vector<int> lcd;
	while (cin >> a >> b){
		if (a < b){
			swap(a,b);
		}
		int hiyosu = a;
		int yosu = b;
		int amari = -1;
		while (amari != 0){
			amari = hiyosu % yosu;
			hiyosu = yosu;
			yosu = amari;
		}
		gcd.push_back(hiyosu);
		lcd.push_back(a*(b/hiyosu));
	}
	for (unsigned int i=0; i<gcd.size(); ++i){
		cout << gcd[i] << " " << lcd[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include<iostream>

using namespace std;

int GCD(int c, int d)
{
    int m;
    
    while(d != 0)
    {
        m = c % d;
        c = d;
        d = m;
    }
    
    return c;
}

int LCM(int c, int d)
{
    int lcmValue;
    lcmValue = (c / GCD(c, d)) * d;  //  not %
    
    return lcmValue;
}
  
int main()
{  
    int a, b;
    
    while(cin>>a>>b)
    {
        cout<<GCD(a, b)<<" "<<LCM(a, b)<<endl; 
    }
    
    return 0;
}

Measured memory_bytes: 1160
_ = input()
s = input()

count = 0
for i in range(0, 1000):
    ans = '{:03d}'.format(i)
    idx = s.find(ans[0])
    if idx == -1:
        continue
    else:
        s1 = s[idx+1:]
        idx = s1.find(ans[1])
        if idx == -1:
            continue
        else:
            s2 = s1[idx+1:]
            idx = s2.find(ans[2])
            if idx != -1:
                count += 1
print(count)

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int cmpchar(const void* a, const void* b) {
	return *(char*)a - *(char*)b;
}
int cmpstr(const void* a, const void* b) {
	return strcmp((char*)a, (char*)b);
}
int main() {
	int n;
	long long ans = 0, num = 1;
	char s[100000][11] = {};
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%s", s[i]);
	}
	for (int i = 0; i < n; i++) {
		qsort(s[i], 10, sizeof(char), cmpchar);
	}
	qsort(s, n, sizeof(s[0]), cmpstr);
	for (int i = 0; i < n - 1; i++) {
		if (strcmp(s[i], s[i + 1]) == 0) {
			num++;
		}
		else {
			ans += (num - 1) * num / 2;
			num = 1;
		}
	}
	ans += (num - 1) * num / 2;
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 2300