akhauriyash/Code-Regression huggingface dataset:
data = [
     "{0} {1}".format(s, r) 
      for s in ('S', 'H', 'C', 'D')
      for r in range(1, 13 +1)
        ]
count = int(input())
for c in range(count):
      card = input()
      data.remove(card)
 
for c in data:
   print(c)

Measured memory_bytes: 7684
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	string s;
	scans(s);
	int cntt = 0, cnts = 0, ans = 0;
	rep(i, s.length()) {
		if (s[i] == 'T') {
			if (cnts) {
				ans += 2;
				--cnts;
				--cntt;
			}
			else {
				++cntt;
			}
		}
		else {
			//if (cntt)cnts = cntt = 0;
			++cnts;
		}
	}

	printf("%d\n", s.length() - ans);

	Please AC;
}


Measured memory_bytes: 832
#pragma GCC optimize ("-O3")
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
 
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
ll NUM = 1e9+7;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define zer ll(0)

void solve()
{
  int n;
  cin>>n;
  int a=0,b=0,c=0,d=0;
  string s;
  for(int i=0;i<n;i++)
  {
    cin>>s;
    if(s=="AC")a++;
    else if(s=="WA")b++;
    else if(s=="TLE")c++;
    else d++;
  }
  cout<<"AC x "<<a<<ln;
  cout<<"WA x "<<b<<ln;
  cout<<"TLE x "<<c<<ln;
  cout<<"RE x "<<d<<ln;
}
 
int  main()
{
  fast_cin();
  ll t=1;
  //cin>>t;
  while(t--)solve();
  return 0;
} 

Measured memory_bytes: 3656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String input = br.readLine();
            Map<String, Integer> days = new HashMap<>();
            days.put("MON", 6);
            days.put("TUE", 5);
            days.put("WED", 4);
            days.put("THU", 3);
            days.put("FRI", 2);
            days.put("SAT", 1);
            days.put("SUN", 7);

            System.out.println(days.get(input).intValue());
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 21460
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n, m;
	std::cin >> n >> m;
	while(m--) {
		int x;
		std::cin >> x;
		n -= x;
	}
	std::cout << std::max(-1, n) << '\n';
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define Rrep(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1000000007

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

ll N, A, B;
ll X1, X2;

int main() {
	scanf("%lld %lld %lld", &N, &A, &B);
	scanf("%lld", &X1);
	ll ans = 0;
	rep(i, N - 1) {
		scanf("%lld", &X2);
		ll tmp = (X2 - X1) * A;
		ans += (tmp < B) ? tmp : B;
		X1 = X2;
 	}
 	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n, k;
    cin >> n >> k;
    if(k >= n){
        cout << 0 << endl;
        return 0;
    }
    ll s = 0;
    vector<ll>h(n);
    rep(i,n){
        cin >> h[i];
        s += h[i];
    }
    sort(h.rbegin(),h.rend());
    rep(i,k)s -= h[i];
    cout << s << endl;
}


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


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

int main () {
  int a, b, m;
  cin >> a >> b >> m;
  vector<int> va(a), vb(b), x(m), y(m), c(m);
  rep(i, a) cin >> va[i];
  rep(i, b) cin >> vb[i];
  rep(i, m) cin >> x[i] >> y[i] >> c[i];
  
  //割引券を使う場合
  int minPrice = va[x[0] - 1] + vb[y[0] - 1] - c[0];
  rep(i, m) {
    int price = va[x[i] - 1] + vb[y[i] - 1] - c[i];
    minPrice = min(minPrice, price);
  }
  
  //割引券を使わない場合
  sort(va.begin(), va.end());
  sort(vb.begin(), vb.end());
  int minPrice2 = va[0] + vb[0];
  
  //出力
  cout << min(minPrice, minPrice2) << endl;
}

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

int main(){
    int n;
    int p[26];
    int ans = 0;

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

    for(int i=1;i<n-1;i++){
        if((p[i-1] <= p[i] && p[i] <= p[i+1]) || (p[i-1] >= p[i] && p[i] >= p[i+1])){
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main()
{
    unsigned short *A, *B;

    int C[VMAX + 1];  // 配列Cはカウンタ配列(ソートする配列Aの累積和を記録する)
    int n, i, j;
    scanf("%d", &n);

    A = malloc(sizeof(short) * n + 1);  // ソートする配列Aのメモリ領域を確保
    B = malloc(sizeof(short) * n + 1);  // ソートされた配列Bのメモリ領域を確保

    for (i = 0; i <= VMAX; i++) {
        C[i] = 0;  // カウンタ配列Cを初期化
    }
    
    for (i = 0; i < n; i++) {
        scanf("%hu", &A[i + 1]);
        C[A[i + 1]]++;  // 配列Aの値を添字とするCの一部をインクリメントする
    }

    for (i = 1; i <= VMAX; i++) {
        C[i] = C[i] + C[i - 1];  // Cの累積和を求める
    }
    
    for (j = 1; j <= n; j++) {
        // Aの要素を添え字とするCのカウンタ配列を添字とする部分にAの要素を入れる
        // CはAの要素の累積和だからAの要素が何番目に出てきたかが記録されている
        // C[A[j]]が3ということはA[j]が3番目に出てきたということ
        // 同じ要素が複数回出ているかもしれないのでBに代入後は添字となったCの要素はデクリメント
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }

    for (i = 1; i <= n; i++) {
        if (i > 1) {
            printf(" ");
        }
        printf("%d", B[i]);
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 9568
s=input()
length=len(s)
cost=0
for i in range(2**(length-1)):
    string=s[0]
    for j in range(length-1):
        if((i>>j)&1):
            string=string+"+"+s[j+1]
        else:
            string=string+s[j+1]
    cost=cost+sum(map(int, string.split("+")))
print(cost)


Measured memory_bytes: 41580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

int main(){
  ll x;
  cin >> x;
  x = abs(x);
  ll k,d;
  cin >> k >> d;
  ll need_step = x/d;
  if(need_step > k){//k*dはx以下なのでオーバーフローはありえない
    cout << x-k*d << endl;
    return 0;
  }
  
  x -= need_step*d;
  k -= need_step;
  
  if(k%2 == 0){
    cout << x << endl;
  }
  if(k%2 == 1){
    cout << d-x << endl;
  }
  
}

Measured memory_bytes: 3684
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<ll> cnt(100005,0);
    for(int i=0; i<N; i++){
        int a;
        cin>> a;
        cnt[a]++;
    }
    ll sum = 0;
    for(int i=0; i<100005; i++){
        sum += cnt[i] * i;
    }
    int Q;
    cin >> Q;
    for(int i=0; i<Q; i++){
        ll c,d;
        cin >> c >> d;
        sum -= cnt[c]*c;
        sum += cnt[c]*d;
        cnt[d] += cnt[c];
        cnt[c] = 0;
        cout << sum << "\n";
    }
    return 0;
}


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

using namespace std;

int main(){
  int k,s;
  int z;
  cin >> k >> s;
  int ans = 0;
  for(int i = 0; i <= k; i++){
    for(int j = 0; j <= k; j++){
      z = s - i - j;
      if(z <= k && 0 <= z){
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
s=[]
ans=[]

for i in range(N):
    s.append(list(map(int,input().split())))

for i in range(N):
    tmp=s[i][0]*s[i][2]+s[i][1]*s[i][3]
    if s[i][2]>=5 and s[i][3]>=2:
        tmp*=0.8
        ans.append(int(tmp))
    else:
        if s[i][2]>=5:
            tmp2=tmp+s[i][1]*(2-s[i][3])
            tmp2*=0.8
        elif s[i][3]>=2:
            tmp2=tmp+s[i][0]*(5-s[i][2])
            tmp2*=0.8
        else:
            tmp2=tmp+s[i][0]*(5-s[i][2])+s[i][1]*(2-s[i][3])
            tmp2*=0.8
        ans.append(int(min(tmp,tmp2)))

for i in range(N):
    print(ans[i])



Measured memory_bytes: 5744
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main() {
    lli a, b, c, d;
    cin >> a >> b >> c >> d;
    lli bc = b/c - (a-1)/c;
    lli bd = b/d - (a-1)/d;
    lli lcm = (c*d)/__gcd(c, d);
    // cout << lcm << " ";
    lli bcd =  b/(lcm) - (a-1)/(lcm);
    cout << (b-a + 1) - (bc + bd - bcd);
    
}

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

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
template<class T> using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-10;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int n;
void solve() {
    cin >> n;
    while (n != 0) {
        if (n % 10 == 7) {
            cout << "Yes" << endl;
            return;
        }
        n /= 10;
    }
    cout << "No" << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <stdlib.h>
#include <vector>
#include <climits>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <iomanip>
using namespace std; 
#define Endl '\n'
int main()
{
    int b[3][3];
    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            cin>>b[i][j];
        }
    }
    int n;
    cin>>n;int x;
    while(n--)
    {
        cin>>x;
        for (int i = 0; i < 3; ++i)
        {
            for (int j = 0; j < 3; ++j)
            {
                if (b[i][j]==x)
                {
                    b[i][j]=-1;
                }
            }
        }
    }
    if (b[0][0]==-1 && b[1][1]==-1 && b[2][2]==-1)
    {
        cout<<"Yes";
    }
    else

    if (b[0][1]==-1 && b[0][2]==-1 && b[0][0]==-1)
    {
        cout<<"Yes";
    }
    else
    if (b[1][0]==-1 && b[1][1]==-1 && b[1][2]==-1)
    {
        cout<<"Yes";
    }
    else
    if (b[2][0]==-1 && b[2][1]==-1 && b[2][2]==-1)
    {
        cout<<"Yes";
    }
    else
    if (b[0][0]==-1 && b[1][0]==-1 && b[2][0]==-1)
    {
        cout<<"Yes";
    }
    else

    if (b[0][1]==-1 && b[1][1]==-1 && b[2][1]==-1)
    {
        cout<<"Yes";
    }
    else
    if (b[0][2]==-1 && b[1][2]==-1 && b[2][2]==-1)
    {
        cout<<"Yes";
    }
    else
    if (b[0][2]==-1 && b[1][1]==-1 && b[2][0]==-1)
    {
        cout<<"Yes";
    }
    else
        cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007
using namespace std;

int main(void){
  int n;
  cin >> n;
  int d[n];
  rep(i,n) cin >> d[i];

  sort(d,d+n);
  int ans = 1;

  rep(i,n-1){
	if(d[i] < d[i+1])ans++;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    int i,j,k,p=1,q=1;
    long n,m,tmp;
    string s[200000];
    string str;
    ll sum=0;
    int strr[200005];
    int a[90];
    int f=0;
    cin>>n;
   for(int i=1;i<10;i++){
       for(int j=1;j<10;j++){
           if(i*j==n){
               cout<<"Yes"<<endl;
               f=1;
               return 0;
           }
       }
   }
   if(f==0) cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 1792
import itertools

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

X = [A, B, C, D, E]

def calc_time(cand):
  tm = 0
  for i in range(len(cand)):
    tm += cand[i]
    if i < 4:
      if tm % 10 != 0:
        tm += 10 - (tm % 10)
  return(tm)

res = 100000
for cand in itertools.permutations(X):
  tm = calc_time(cand)
  if tm < res:
    res = tm

print(res)

Measured memory_bytes: 3064
import java.util.*

fun main(args:Array<String>){
    val (a,b,c,d) = readLine()!!.split(" ").map{it.toInt()}
    val ans = if(a >= c){
        if(a >= d) 0
        else if(b <= d) b - a
        else d - a
    }
    else{
        if(c >= b) 0
        else if(d <= b) d - c
        else b - c
    }
    println(ans)
}


Measured memory_bytes: 38128
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007

using namespace std;

string lcs(string a, string b){

	int L[a.length()+1][b.length()+1];
	for(int i=0;i<=a.length();i++){
		for(int j=0;j<=b.length();j++){
			if(i==0 || j==0){
				L[i][j]=0;
			}
			else if(a[i-1]==b[j-1]){
				L[i][j]=L[i-1][j-1]+1;
			}
			else{
				L[i][j] = max(L[i][j-1], L[i-1][j]);
			}
		}
	}

	int len=L[a.length()][b.length()];

	string ans = string(len,'0');
	
	int i=a.length(),j=b.length();
	while(i>0 && j>0){
		if(a[i-1]==b[j-1]){
			ans[--len] = a[i-1];
			i--;j--;
		}
		else if(L[i-1][j] > L[i][j-1]){
			i--;
		}
		else j--;
	}

	return ans;
}

int main(){
	
	//fastio
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	string s,t;
	cin>>s>>t;
	cout<<lcs(s,t)<<endl;

	return 0;
}

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

#define fastIO ios::sync_with_stdio(false);cout.tie(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MP make_pair
#define inf INT_MAX
#define minf INT_MIN

typedef long long int lli;

ofstream outfile;
ifstream infile;
int main()
{
	infile.open("input.txt");
	outfile.open("output.txt");

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if( a >= c && b <= d){
		cout << b-a << "\n";
	}
	else if( c >= a && d <= b){
		cout << d-c<< "\n";
	}

	else if( b < c || d < a){
		cout << "0\n";
	}

	else
		cout << min(b-c, d-a) << "\n";
}

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

int arr[100007];
int dp[100007];

int Solve(int idx, int n){
//	cout<<cost<<" "<<idx<<endl;
	if(idx >= n)return 1e9;
	if(idx == n - 1){
		return 0;	
	}
	
	if(dp[idx] != -1)return dp[idx];
	
	
	return dp[idx] = min(abs(arr[idx] - arr[idx+1]) + Solve(idx+1, n), abs(arr[idx] - arr[idx+2]) + Solve(idx+2,n));
}

int main(){
	int n; cin>>n;
	memset(dp,-1,sizeof(dp));
	for(int i = 0; i < n; i++)cin>>arr[i];
		
	cout<<Solve(0,n)<<endl;
	return 0;
}

Measured memory_bytes: 3328
import java.util.*;
import java.io.*;
import java.lang.*;

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

        int n = sc.nextInt();
        long ans = 0;
        for (int i = 1; i<=n; i++){
            if ((i%3) != 0 && (i%5) != 0){
                ans += i;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35528
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    string s[n];
    for(i=0;i<n;i++)
    cin>>s[i];
    for(i=0;i<n;i++)
    sort(s[i].begin(),s[i].end());
    vector<string>v;
    for(i=0;i<n;i++)
    v.push_back(s[i]);
    sort(v.begin(),v.end());
    string last=v[0];
    long long int ans=0,temp=1;
    for(i=1;i<n;i++)
    {
        if(v[i]==v[i-1])
        temp++;
        else
        {
            ans+=((temp*(temp-1))/2);
            temp=1;
            last=v[i];
        }
    }
     ans+=((temp*(temp-1))/2);
    cout<<ans<<endl;
}

Measured memory_bytes: 12788
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N int

func main() {
	sc.Split(bufio.ScanWords)

	N = nextInt()

	fmt.Println(powInt(N, 2) + powInt(N, 3) + N)
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
#define mp make_pair
#define pii pair<int,int>
#define fr first
#define se second
using namespace std;
typedef long long ll;
const int N=1e5+100;
pii a[N];
set<int>S[3];
map<int,int>H[3];
int n,X,Y,Z,sz[3],ssz[3];
ll ans=0,tmp,ans1[N],ans2[N];
inline bool cmp(pii a,pii b){return a.fr-a.se<b.fr-b.se;}
void Erase(int x,int ty)
{
	if(H[ty][x]==1)S[ty].erase(x);
	H[ty][x]--;
	ans-= x;
	ssz[ty]--;
}
void Insert(int x,int ty)
{
	if(!H[ty][x])S[ty].insert(x);
	H[ty][x]++;
	ans+=x;
	ssz[ty]++;
}
void S_insert(int x,int ty)
{
	if(ssz[ty]==sz[ty])
	{
		int y=*S[ty].begin();
		if(y>x)return;
		Erase(y,ty);
	}
	Insert(x,ty);
}
int main()
{
	scanf("%d%d%d",&X,&Y,&Z);
	n=X+Y+Z;
	for(int i=1,x,y,z;i<=n;++i)
	{
		scanf("%d%d%d",&x,&y,&z);
		x-=z;y-=z;
		ans+=z;
		a[i]=mp(x,y);
	}
	tmp=ans;ans=0;
	sort(a+1,a+n+1,cmp);
	sz[0]=X;sz[1]=Y;
	for(int i=1;i<=Y;i++)S_insert(a[i].se,1);
	ans1[Y]=ans;
	for(int i=Y+1;i<=n-X;i++)S_insert(a[i].se,1),ans1[i]=ans;
	ans=0;
	for(int i=n;i>=n-X+1;i--)S_insert(a[i].fr,0);
	ans2[n-X+1]=ans;
	for(int i=n-X;i>=Y+1;i--)S_insert(a[i].fr,0),ans2[i]=ans;
	ans=-1e18;
	for(int i=Y;i<=n-X;i++)ans=max(ans,ans1[i]+ans2[i+1]);
	cout<<ans+tmp;
}

Measured memory_bytes: 10368
from collections import deque
import sys
input = sys.stdin.readline
    
def bfs(v, N, G, E):
    visited = [0]*N
    queue = deque()
    K = -1
    node2color = [-1 for _ in range(N)]
    queue.append(v)
    visited[v] = 1
    while queue:
        q = queue.popleft()
        color = 0
        for nex in G[q]:
            if visited[nex]:
                continue
            visited[nex] = 1
            color += 1
            if color == node2color[q]:
                color += 1
            
            node2color[nex] = color
            E[(min(q, nex), max(q, nex))] = color
            queue.append(nex)
        K = max(K, color)
    return K

def main():
    N = int(input())
    G = [deque() for _ in range(N)]
    E = dict() # (a, b) -> [idx, color]
    for i in range(N-1):
        a, b = map(lambda x: int(x)-1, input().split())
        G[a].append(b)
        G[b].append(a)
        E[(a, b)] = 0
    K = bfs(0, N, G, E)
    # ans_list = [value for value in E.values()]
    print(K)
    for value in E.values():
        print(value)
main()

Measured memory_bytes: 162888
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  vector<int>a(101);
  
  int n,k;
  cin >> n >> k;
  ll ans = k;
  rep(i,n-1){
    ans *= (k-1);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3616
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO.Pipes;

public class HelloWorld
{
    static public void Main()
    {
        var NM = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var N = NM[0];
        var M = NM[1];
        var UF = new UnionFind(M + 1);
        var used = new bool[M + 1];
        for (int i = 0; i < N; i++)
        {
            var inp = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            for (int j = 1; j <= inp[0]; j++)
            {
                used[inp[j]] = true;
                UF.Union(inp[1],inp[j]);
            }
        }

        var st = 0;
        for (int i = 1; i <= M; i++)
        {
            if (used[i])
            {
                st = i;
                break;
            }
        }

        var ans = true;
        for (int i = 1; i <= M; i++)
        {
            if (used[i])
            {
                if (!UF.Same(st,i))
                {
                    ans = false;
                }
            }
        }
        Console.WriteLine(ans? "YES":"NO");
    }
}

class UnionFind



{



    // 親要素のインデックスを保持する



    // 親要素が存在しない(自身がルートである)とき、マイナスでグループの要素数を持つ



    public long[] Parents { get; set; }



    public UnionFind(long n)



    {



        this.Parents = new long[n];



        for (int i = 0; i < n; i++)



        {



            // 初期状態ではそれぞれが別のグループ(ルートは自分自身)



            // ルートなのでマイナスで要素数(1個)を保持する



            this.Parents[i] = -1;



        }



    }







    // 要素xのルート要素はどれか



    public long Find(long x)



    {



        // 親がマイナスの場合は自分自身がルート



        if (this.Parents[x] < 0) return x;



        // ルートが見つかるまで再帰的に探す



        // 見つかったルートにつなぎかえる



        this.Parents[x] = Find(this.Parents[x]);



        return this.Parents[x];



    }







    // 要素xの属するグループの要素数を取得する



    public long Size(long x)



    {



        // ルート要素を取得して、サイズを取得して返す



        return -this.Parents[this.Find(x)];



    }







    // 要素x, yが同じグループかどうか判定する



    public bool Same(long x, long y)



    {



        return this.Find(x) == this.Find(y);



    }







    // 要素x, yが属するグループを同じグループにまとめる



    public bool Union(long x, long y)



    {



        // x, y のルート



        x = this.Find(x);



        y = this.Find(y);



        // すでに同じグループの場合処理しない



        if (x == y) return false;







        // 要素数が少ないグループを多いほうに書き換えたい



        if (this.Size(x) < this.Size(y))



        {



            var tmp = x;



            x = y;



            y = tmp;



        }



        // まとめる先のグループの要素数を更新



        this.Parents[x] += this.Parents[y];



        // まとめられるグループのルートの親を書き換え



        this.Parents[y] = x;



        return true;



    }



}

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

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var main = new Program();
            main.solve();
        }

        void solve()
        {
            long n = long.Parse(Console.ReadLine());
            long[] nums = Console.ReadLine().Split(' ').Select(val => long.Parse(val)).ToArray();

            var dic = new Dictionary<long, long>();

            foreach(var num in nums)
            {
                if (dic.ContainsKey(num))
                {
                    dic[num]++;
                }
                else
                {
                    dic.Add(num, 1);
                }
            }
            long count = 0;
            foreach(var key in dic.Keys)
            {
                if (dic[key] > key) count += dic[key] - key;
                else if (dic[key] < key) count += dic[key];
            }

            Console.WriteLine(count);
        }
    }

    struct Vector2
    {
        public Vector2(long x, long y)
        {
            this.x = x;
            this.y = y;
        }
        public long x;
        public long y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 32608
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

ll K;
ll N = 50, a[55];

int main() {
	rd(K);
	wrln(N);
	repi(i, 0, N) {
		if (i < (K%N)) wr((N - 1) + (K / N) + (N - (K%N) + 1));
		else wr((N - 1) + (K / N) - (K%N));
		if (i != N - 1) wr(" ");
		else cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#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;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    int h,n;
    cin>>h>>n;
    int sum = 0;
    rep(i,n){
        int a;
        cin>>a;
        sum+=a;
    }
    if(sum>=h){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
return 0;
}


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

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

			long n_num = long.Parse(Console.ReadLine());

			var sDatas = new List<string>();

			for (int n = 0; n < n_num; ++n) {
				sDatas.Add(Console.ReadLine());
			}

			long m_num = long.Parse(Console.ReadLine());

			var mDatas = new List<string>();

			for (int m = 0; m < m_num; ++m) {
				mDatas.Add(Console.ReadLine());
			}

			var datas = new List<string>(sDatas);
			datas.AddRange(mDatas);
			datas = datas.Distinct().ToList();

			long result = 0;

			foreach (var data in datas) {
	
				long sCount = 0;

				foreach (var sData in sDatas) {
					if (sData == data) {
						++sCount;
					}
				}

				long mCount = 0;

				foreach (var mData in mDatas) {
					if (mData == data) {
						++mCount;
					}
				}

				var ret = sCount - mCount;

				if (ret > result) {
					result = ret;
				}
			}

			//if (result <= 0) {
			//	result = 0;
			//}

            Console.WriteLine(result.ToString());

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13280
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,x,y=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+k*50==x) y++;
            }
        }
    }
    cout<<y<<endl;
}


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

int main() {
 string s1 , s2 , s3 ;
 cin >> s1 >> s2 >> s3 ;
 string ans = "YES" ;
  
 if(s1.at(s1.size()-1) != s2.at(0))
   ans = "NO";
  if(s2.at(s2.size()-1) != s3.at(0))
   ans = "NO";
   
  cout << ans ;
  
 
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)












int main(){
    ll n, l, r;
    while(cin >> n >> l >> r, n || l || r){
        vector<ll> a(n);
        REP(i, n){
            cin >> a[i];
        }
        ll ans = 0;
        for(ll x = l; x <= r; x++){
            REP(i, n){
                if(x % a[i] == 0){
                    if(i % 2 == 0){
                        ans++;
                    }
                    break;
                }
                if(i == n - 1 && n % 2 == 0){
                    ans++;
                }
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3092
x, k, d = map(int, input().split())
c = 1
if x < 0:
    c = -1
x = abs(x)
a = x // d
b = a + 1
aa = x - a * d
bb = aa - d
if b <= k:
    if k % 2 == a % 2:
        ans = aa
    else:
        ans = bb
else:
    ans = x - k * d
print(abs(ans))

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

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();
 
using namespace std;
const int N=3e3+10, mod=1e9+7;
pair<int,int> dp1[N][N];
int dp[N][N];

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,t;
	cin>>n>>t;
	
	int a[n],b[n];
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	
	for(int j=a[0];j<=t;j++) dp[0][j]=b[0];
	for(int i=1;i<n;i++){
		for(int j=0;j<=t;j++){
			if( j<a[i] ) dp[i][j]=dp[i-1][j];
			else dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i]]+b[i]);
		}
	}
	
	for(int i=a[0];i<t;i++) dp1[0][i]={b[0],0};
	
	for(int i=1;i<n;i++){
		for(int j=0;j<t;j++){
			if( j<a[i] ){
				dp1[i][j].xx= dp1[i-1][j].xx;
				dp1[i][j].yy= max(dp1[i-1][j].yy,b[i]);
			}else{
				if( dp1[i-1][j].xx+max(dp1[i-1][j].yy,b[i]) > dp1[i-1][j-a[i]].xx+dp1[i-1][j-a[i]].yy +b[i] ){
					dp1[i][j].xx= dp1[i-1][j].xx;
					dp1[i][j].yy= max(dp1[i-1][j].yy,b[i]);
				}else{
					dp1[i][j].xx= dp1[i-1][j-a[i]].xx+b[i];
					dp1[i][j].yy= dp1[i-1][j-a[i]].yy;
				}
			}
		}
	}
	
	
	cout<<max(dp[n-1][t],dp1[n-1][t-1].xx+dp1[n-1][t-1].yy);
}



Measured memory_bytes: 106240
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long int ll;

int main()
{
    ll a, b;
    cin >> a >> b;
    ll cnt = 0;
    string s;
    for (ll i = a; i <= b; i++)
    {
        s = to_string(i);
        if (s[0] == s[4])
        {
            if (s[1] == s[3])
            {
                cnt++;
            }
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array)
#define inin freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

int main(){
   // inin
    IOS
    string s,t;
    cin>>s>>t;
    bool can=true;
    for(auto kk:s){
        if(kk>='a'&&kk<='z') ;
        else can=false;
    }
     for(auto kk:t){
        if(kk>='a'&&kk<='z') ;
        else can=false;
    }
    if(sz(s)==sz(t)-1) ;
    else can=false;

    fo(i,sz(s)){
        if(s[i]==t[i]) ;
        else can=false;
    }

    if(can) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define r0 return 0;
#define f(k,i,n,j) for(ll k=i;k<=n;k=k+j)
#define cin(a) cin>>a;
#define loop while(t--)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
signed main()
{
    int h,n,sum=0;
    cin>>h>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>=h)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

bool keta(int x){
    int keta=1;
    while(x>=10){
        x/=10;
        keta++;
    }
    if(keta%2==1){
        return true;
    }
    else{
        return false;
    }
}

signed main(){
    int N;
    cin>>N;
    int ans=0;
    REP(i,N){
        if(keta(i+1)){
            ans++;
        }
    }
    cout << ans<<endl;
}

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

int main() {
    int64_t n, k;
    cin >> n >> k;
    vector<int64_t> a(n);
    vector<int64_t> s(n + 1, 0);
    int64_t acc = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s[i + 1] = s[i] + a[i];
    }
    for (int i = 1; i <= n; i++) {
        s[i] = (s[i] - i) % k;
    }
    int64_t ans = 0;
    map<int64_t, int64_t> count;
    for (int j = 0; j <= n; j++) {
        count[s[j]]++;
        if (j - k >= 0) {
            count[s[j - k]]--;
        }
        ans += count[s[j]] - 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int N; cin >> N;
    vector<int> D(N); for (auto &d : D) cin >> d;
    vector<int> C(13);
    for (auto d : D) {
        C[d]++;
    }
    vector<bool> X(24);
    X[0] = true;
    auto recur = [&](auto rec, int i) {
        if (i == 13) {
            int j = 0, k = 1, ans = 999;
            while (j < 24) {
                while (k < 24 && X[k] == false) k++;
                ans = min(ans, k - j);
                j = k, k += 1;
            }
            return ans;
        } else if (C[i] == 0) {
            return rec(rec, i+1);
        } else if (C[i] == 1) {
            int ans = 0;
            if (!X[i]) {
                X[i] = true;
                ans = max(ans, rec(rec, i+1));
                X[i] = false;
            }
            if (i != 0 && !X[24-i]) {
                X[24-i] = true;
                ans = max(ans, rec(rec, i+1));
                X[24-i] = false;
            }
            return ans;
        } else if (C[i] == 2) {
            if (X[i] || X[24-i]) {
                return 0;
            }
            X[i] = X[24-i] = true;
            int ans = rec(rec, i+1);
            X[i] = X[24-i] = false;
            return ans;
        } else {
            return 0;
        }
    };
    cout << recur(recur, 0) << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b,c;
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    
    if(a < b && b < c){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2620
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    string a,b,c;
    cin >> a >> b >> c;
    //処理
    //出力
	cout << a[0] << b[1] << c[2] << ENT;
    return 0;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();

        int total = 0;
        total += s.charAt(0) == '1' ? 1 : 0;
        total += s.charAt(1) == '1' ? 1 : 0;
        total += s.charAt(2) == '1' ? 1 : 0;
        System.out.println(total);

    }
}


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

int main()
{
    ll n, m;
    cin >> n >> m;

    ll ans = min(n, m / 2);

    if (n > m / 2)
        cout << m / 2 << endl;
    else
    {
        ll ans = n + (m - 2 * n) / 4;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import Data.List
import Data.Array.IO
import Data.IORef
import Control.Monad
import Control.Applicative

rInt = read :: String -> Int

type Ary = IOUArray (Int, Int) Int
type Var = IORef Int

infinity = maxBound :: Int

putAry ary s t d = do
    writeArray ary (s, t) d

putDAry ary [a, b, c] = do
    writeArray ary (a, b) c
    writeArray ary (b, a) c

getAry ary s t = do
    readArray ary (s, t)

updateAry :: Ary -> Int -> Int -> Int -> IO ()
updateAry ary s t k = do
    v <- readArray ary (s, t)
    k1 <- readArray ary (s, k)
    k2 <- readArray ary (k, t)
    writeArray ary (s, t) (if (k1==infinity || k2 == infinity) then v else min v (k1 + k2))

accum :: Ary -> Var -> (Int, Int) -> IO ()
accum ary tmp (s, t) = do
    v <- getAry ary s t
    modifyIORef tmp (+v)

calc :: Ary -> Var -> [Int] -> IO ()
calc ary res path = do
    tmp <- newIORef 0
    mapM_ (accum ary tmp) (zip path (tail path))
    tvar <- readIORef tmp
    modifyIORef res (min tvar)



main = do
    [n, m, r] <- ((map rInt) . words) <$> getLine
    rs <- ((map rInt) . words) <$> getLine
    l <- map ((map rInt) . words) <$> replicateM m getLine
    array <- newArray ((1, 1), (n, n)) infinity :: IO Ary
    mapM_ (putDAry $ array) l
    mapM_ (\(k, i, j) -> updateAry array i j k) [(k, i, j) | k <- [1..n], i <- [1..n], j <- [1..n]]
    result <- newIORef infinity
    mapM_ (calc array result) $ permutations rs
    readIORef result >>= print
    --return ()

Measured memory_bytes: 24956