akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>
#include <climits>
#include <algorithm>
using namespace std;

int n,a,b,c;
int ls[8];
int use=0;

void printb(int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}

int find_best(int a) {
    int res = INT_MAX, best_i=0;
    int i;
    for (i = 1; i < pow(2, n); ++i) {
        int c = 0, len=0;
        if (i & use) continue;
        for (int j = 0; j < n; ++j) {
            if(i & 1<<j) {
                len += ls[j];
                c++;
            }
        }
        int cost = ((a>len)?a-len:len-a) + 10 * (c-1);
        if (cost < res) {
            best_i = i;
            res = cost;
        }
    }
    use = use | best_i;
    return res;
}

int best_i=0,best_j=0,best_k=0;
int use_a[8]={0};
int find_best2() {
    int res = INT_MAX;
    int i;
    for (i = 1; i < pow(4, n); ++i) {
        int carry=1;
        for (int y=0;y<n;y++) {
            use_a[y] += carry;
            if (use_a[y] > 3) {
                use_a[y] = 0;
                carry = 1;
            } else {
                carry=0;
            }
        }
        int ca=0,cb=0,cc=0, lena=0, lenb=0,lenc=0;
        for (int x = 0; x < n; ++x) {
            if(use_a[x] == 1) {
                lena += ls[x];
                ca++;
            }
            else if(use_a[x] == 2) {
                lenb += ls[x];
                cb++;
            }
            else if(use_a[x] == 3) {
                lenc += ls[x];
                cc++;
            }
        }
        if (ca == 0 || cb == 0 || cc == 0) continue;
        int cost = ((a>lena)?a-lena:lena-a) + 10 * (ca-1);
        cost += ((b>lenb)?b-lenb:lenb-b) + 10 * (cb-1);
        cost += ((c>lenc)?c-lenc:lenc-c) + 10 * (cc-1);
        if (cost < res) {
            res = cost;
        }
    }
    return res;
}

int main(int argc, char *argv[])
{
    scanf("%d %d %d %d", &n,&a,&b,&c);
    for (int i = 0; i < n; ++i) {
        scanf("%d", ls+i);
    }
    printf("%d\n", find_best2());
    // for (int i = 0; i < n; ++i) {
    //     printf("%d ", use_a[i]);
    // }
    // printb(best_i);printf("\n");
    // printb(best_j);printf("\n");
    // printb(best_k);printf("\n");
    // printf("%d\n", find_best(c));
    // printb(use);
    // printf("\n%d\n", find_best(a));
    // printb(use);
    // printf("\n%d\n", find_best(b));
    // printb(use);
    // int t1 = find_best(a) + find_best(b) + find_best(c);
    // use = 0;
    // int t2 = find_best(b) + find_best(c) + find_best(a);
    // use = 0;
    // int t3 = find_best(c) + find_best(a) + find_best(b);
    // use = 0;
    // int t4 = find_best(a) + find_best(c) + find_best(b);
    // use = 0;
    // int t5 = find_best(b) + find_best(a) + find_best(c);
    // use = 0;
    // int t6 = find_best(c) + find_best(b) + find_best(a);
    // printf("%d\n", min(t1, min(t2, min(t3, min(t4, min(t5, t6))))));
    return 0;
}


Measured memory_bytes: 128
N = gets.to_i
v = gets.split.map(&:to_i)
odd = Hash.new(0)
div = Hash.new(0)

for i in 0..(N-1)
  if i % 2 == 0
    odd[v[i]] += 1
  else
    div[v[i]] += 1
  end
end

odds = Array.new(2, 0)
oddk = Array.new(2)
odd.each do |k, v|
  if odds[1] < v
    oddk[1] = k
    odds[1] = v
  end
  if odds[0] < odds[1]
    tmp = oddk[1]
    oddk[1] = oddk[0]
    oddk[0] = tmp
    tmp = odds[1]
    odds[1] = odds[0]
    odds[0] = tmp
  end
end

divs = Array.new(2, 0)
divk = Array.new(2)
div.each do |k, v|
  if divs[1] < v
    divk[1] = k
    divs[1] = v
  end
  if divs[0] < divs[1]
    tmp = divk[1]
    divk[1] = divk[0]
   divk[0] = tmp
    tmp = divs[1]
    divs[1] = divs[0]
    divs[0] = tmp
  end
end
  
if divk[0] != oddk[0]
  puts N - divs[0] - odds[0]
else
  if divs[0] > odds[0]
    puts N - divs[0] - odds[1]
  elsif divs[0] < odds[0]
    puts N - divs[1] - odds[0]
  else
    if divs[1] >= odds[1]
      puts N - divs[1] - odds[0]
    else
      puts N - divs[0] - odds[1]
    end
  end
end   
   

Measured memory_bytes: 14620
//解説参照
#include<bits/stdc++.h>
using namespace std;
#define int long long

int n,a,b,c,d; 

map<int,int> memo;
int dfs(int n){ 
  
  if( n == 0 ){ return 0;}
  if( n == 1 ){ return d;} 
  
  if( memo.count(n)){
    return memo[n];
  } 
  
  int res = 1e18;
  
  if( n < res/d ){ res = n*d;}
  
  int res2 = d*abs( n-2*((n+1)/2) ) + a + dfs((n+1)/2);
  res2 = min(res2, d*abs(n-2*(n/2)) + a + dfs( n/2 ));
  
  int res3 = d*abs( n-3*((n+2)/3) ) + b + dfs((n+2)/3);
  res3 = min(res3, d*abs(n-3*(n/3)) + b + dfs( n/3 ));
  
  int res5 = d*abs( n-5*((n+4)/5) ) + c + dfs((n+4)/5);
  res5 = min(res5, d*abs(n-5*(n/5)) + c + dfs( n/5 ));
  
  return memo[n] = min(min(res2,res3),min(res5,res));
  
}

signed main(void){ 
  
  int t; cin >> t;
  while(t--){ 
    cin >> n >> a >> b >> c >> d;
    
    cout << dfs(n) << endl;
    
    memo.clear();
    
  }
  
  return 0;
}
  

Measured memory_bytes: 4388
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
const int MOD = 1000000007;


int dp[41][401][401];

int main(){
    int N, Ma, Mb; cin >> N >> Ma >> Mb;
    vector<int> a(N), b(N), c(N);
    rep(i,N) cin >> a[i] >> b[i] >> c[i];

    rep(i,N+1){
        rep(j,401){
            rep(k,401){
                dp[i][j][k] = 100000000;
            }
        }
    }
    dp[0][0][0] = 0;
    rep(i,N){
        rep(j,401){
            rep(k,401){
                chmin(dp[i+1][j][k], dp[i][j][k]);
                if (j+a[i] > 400 || k+b[i] > 400) continue;
                chmin(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]); 
            }
        }
    }
    const int max_v = 100000000;
    int ans = max_v;
    for (int i = 1; i <= 400; i++){
        for (int j = 1; j <= 400; j++){
            if (i*Mb == j*Ma){
                ans = min(ans, dp[N][i][j]);
            }
        }
    }

    if (ans == max_v) cout << -1 << endl;
    else cout << ans << endl;
    

}

Measured memory_bytes: 29336
h,w = (int(i) for i in input().split())
a = [[int(i) for i in input().split()] for i in range(h)]
ans = []
for i in range(h-1):
	for j in range(w):
		if a[i][j]%2:
			ans.append([i+1,j+1,i+2,j+1])
			a[i+1][j]+=1
for j in range(w-1):
	if a[h-1][j]%2:
		ans.append([h,j+1,h,j+2])
		a[h-1][j+1]+=1
print(len(ans))
for i,j,i2,j2 in ans: print(i,j,i2,j2)

Measured memory_bytes: 30076
#include<bits/stdc++.h>
using namespace std;
long int maximum(long int x,long int y,long int z)
{
    if(x>y)
    return (x>z?x:z);
    else
    return (y>z?y:z);
    
}
int main()
{
    long int n;
    cin>>n;
    long int vac[n][3];
    for(long int i=0;i<n;i++)
    {
        cin>>vac[i][0]>>vac[i][1]>>vac[i][2];
    }
    long dp[n+1][3]={0};
    dp[1][0]=vac[0][0];
    dp[1][1]=vac[0][1];
    dp[1][2]=vac[0][2];
    for(long int i=2;i<n+1;i++)
    {
        dp[i][0]= max(dp[i-1][1],dp[i-1][2])+vac[i-1][0];
        dp[i][1]= max(dp[i-1][0],dp[i-1][2])+vac[i-1][1];
        dp[i][2]= max(dp[i-1][0],dp[i-1][1])+vac[i-1][2];
        
    }
    cout<<maximum(dp[n][0],dp[n][1],dp[n][2]);
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int xx;
//bool is_prime(ll x){
//if(x<=1) return 0;
//for(int i=2;i*i<=x;i++){
//    if(x%i==0)return 0;
//}
//return 1;
//}
ll mod=1e9+7;
int main(){
ll x;
cin>>x;
map<ll,ll> mp;
for(int i=1;i<=x;i++){
    int cur_num=i;
    for(int j=2;j*j<=i;j++){
        while(cur_num%j==0){
            mp[j]++;
            cur_num/=j;
        }

        }
          if(cur_num!=1){
            mp[cur_num]++;
    }

    }
    ll div=1;
    for(auto it:mp){
        div*= it.second+1;
        div %= mod;

    }
    cout<<div;
}






Measured memory_bytes: 3596
#include <iostream>

using namespace std;

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

  if((abs(a-c)<=d)||(abs(a-b)<=d&&abs(b-c)<=d)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
import math

a,b,h,m = map(int, input().split())
if h == 0:
  angle = math.radians(5.5*m)
else:
  angle = angle = math.radians(h * 30 - 5.5*m)
  
x = math.sqrt(a**2 + b**2 -2 * a * b * math.cos(angle))
print(x)

Measured memory_bytes: 9496
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;

int GCD(int x, int y) {
	return x ? GCD(y % x, x) : y;
//xが0以外なら、GCD(y % x, x) の結果を返し
//xが0ならyを返す
}
int main() {
	int n;
	cin >> n;
	double  sum=0.0000000000;
	rep(i, n) {
		double x;
		string u;
		cin >> x >> u;
		//cout << x <<endl<< u << endl;
		if (u == "JPY") {
			sum += x;
		}
		else {
			x= x * 380000.0;
			
			sum += x;
		}
		
	}
	cout << sum << endl;
	
}

Measured memory_bytes: 256
import sys
n, limit= map(int, sys.stdin.readline().split())
L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]

#各重さとi番目の荷物を入れ終わった状態のテーブルをつくる
dp = [[0 for _ in range(limit+1)] for _ in range(n)]

#初期状態
for w in range(limit+1):
    if L[0][0] <=w:
        dp[0][w] = L[0][1]

for i in range(n):
    for w in range(limit+1):
        if w < L[i][0]: #場合分け 荷物よりも容量が小さいとき
            dp[i][w] = dp[i-1][w]
        else:           # 荷物よりも容量が大きいとき
            dp[i][w] = max(L[i][1] + dp[i-1][w-L[i][0]], dp[i-1][w]) # w = (w - L[i][0]) + L[i][0]

print(max(dp[-1]))

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

int main() {
    int N,K;
    cin >> N >>K;
    vector<int> h(N);
    rep(i,N) cin >> h[i];
    int ans = 0;
    rep(i,N) if(h[i]>=K){
        ans++;
    }
    cout<<ans<<endl;
    return 0;    
}

Measured memory_bytes: 640
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

int n;
int main(){
  
    cin >> n;
    int d[n];
    inrep(n,d);

    sort(d,d+n);

    //   rep(i,0,n)PS(d[i]);
    // cout << endl;

    P(d[n/2] - d[n/2-1]);
    return  0;
}


Measured memory_bytes: 640
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
 
#include <bits/stdc++.h>
 
using namespace std;

#define ll long long
#define pussy push_back
#define F first
#define S second
#define mod 1000000007
#define inf 3000000000000000007ll
#define sz(a) signed(a.size())
const int N = 1e6 + 10;
template<class T, class U> inline void checkmin(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void checkmax(T &x, U y) { if (y > x) x = y; }
template<class T, class U> inline istream& operator>>(istream& str, pair<T, U> &p) { return str >> p.F >> p.S; }
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }


int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll a , b ; cin >> a >> b;
	ll ans = 0 ;
	ll x = __gcd(a , b);
	for(int i = 2; i <= sqrt(x);i ++ ) {
		if(x % i == 0) ans++;
		while(x % i == 0) {
			x = x / i;
		}
	}
	if(x != 1) ans++;

	cout << ans + 1;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

#define DEBUG(x) // cerr << #x << " = " << x << endl

const double EPS = 1e-8;

double deg_long(int hh, int mm) {
    hh %= 12;
    long double deg = (1.0 * 360) * hh / 12;
    deg += (1.0 * 360 / 12) * mm / 60;
    return deg;
}

double deg_short(int mm) {
    double deg = 1.0 * 360 * mm / 60;
    return deg;
}

int main() {
    int N; scanf("%d", &N);
    while(N--) {
        int hh, mm; scanf("%d:%d", &hh, &mm);
        double degA = deg_long(hh, mm);
        double degB = deg_short(mm);
        DEBUG(degA);
        DEBUG(degB);
        double diff = abs(degA - degB);
        diff = min(diff, abs((degA + 360) - degB));
        diff = min(diff, abs(degA - (degB + 360)));
        DEBUG(diff);
        if (diff < 30) puts("alert");
        else if(90 <= diff) puts("safe");
        else puts("warning");
    }
}

Measured memory_bytes: 1164
#include <iostream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#include <cmath>
#include <complex>
// #include "utiltime.hpp"

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

const int INFL = (int)1e9;
const ll INFLL = (ll)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(i, vector.size()) { cout << vector[i] << " "; } cout << endl;
#define printmx(matrix) Loop(i, matrix.size()) { Loop(j, matrix[i].size()) { cout << matrix[i][j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(double x) { ll m = (ll)sqrt(x); return m + (m * m <= (ll)(x) ? 0 : -1); }
ll ceilsqrt(double x) { ll m = (ll)sqrt(x); return m + ((ll)x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }

/*******************************************************/

int main() {
	ll n, k; cin >> n >> k;
	if (k % 2 == 0) {
		ll a = k / 2;
		ll x = n / a;
		ll x1 = ceildiv(x, 2);
		ll x2 = x / 2;
		ll ans = x1 * x1 * x1 + x2 * x2 * x2;
		cout << ans << endl;
	}
	else {
		ll x = n / k;
		ll ans = x * x * x;
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    
    long long n;
	long long idx, sum;
	
	cin >> n;
	
	sum = 0;
	for ( idx = 1; idx <= n; idx++ ) {
		if ( ((idx % 3) != 0 ) && ((idx % 5) != 0 ) ) {
			sum  += idx;
		}
	}
	
	cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
    int a,b,t;
    while(1){
        cin>>a>>b;
        if(a==0){
            if(b==0){
                break;
            }
        }
        if(a>b){
            t=a;
            a=b;
            b=t;
        }
        cout<<a<<" "<<b<<endl;
    }
    return 0;
    
}


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

string S;
string T;

bool bChk( const char *A, const char *B )
{
int i;
char C;

	i = 0;
	while( ( C = B[ i ] ) != '\0' )
	{
		if( A[ i ] != '?' && A[ i ] != C ) return false;

		i++;
	}

	return true;
}

void Conv( string &A, const char *B, int iPos )
{
int i;
char C;

	i = 0;
	while( ( C = A[ i ] ) != '\0' )
	{
		if( C == '?' ) A[ i ] = 'a';

		i++;
	}

	i = 0;
	while( ( C = B[ i ] ) != '\0' )
	{
		A[ i + iPos ] = C;
		i++;
	}
}

int main()
{
int i;
int iEnd;
char C;
string sChk;
string X;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> S;
	cin >> T;

	iEnd = S.size() - T.size();
	if( iEnd < 0 )
	{
		cout << "UNRESTORABLE" << endl;

		return 0;
	}

	X = "";
	for( i = 0; i <= iEnd; i++ )
	{
		if( ! bChk( S.c_str() + i, T.c_str() ) ) continue;

		sChk = S;
		Conv( sChk, T.c_str(), i );
		if( X == "" || X > sChk ) X = sChk;
	}

	if( X == "" )
		cout << "UNRESTORABLE" << endl;
	else
		cout << X << endl;

	return 0;
}




Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if (a[0]==5&&a[1]==5&&a[2]==7)
        cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

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

int main()
{
    int A, B, C, K;
    cin >> A >> B >> C >> K;

    if (A >= K)
    {
        cout << K << endl;
    }
    else if (A + B >= K)
    {
        cout << A << endl;
    }
    else
    {
        cout << A * 2 + B - K << endl;
    }
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define N 200005
using namespace std;
typedef long long ll;
typedef double db;
int n,a[N],f[N],Max;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	for(int i=1;i<=n;++i)
	{
		f[a[i]]=f[a[i]-1]+1;
		Max=max(Max,f[a[i]]);
	}
	cout<<n-Max<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
using namespace std;
#define MAX_M 4000000
#define MAX_N 2010
#define INF -9999999999999
struct edge{int to,from,cost;};
edge es[MAX_M];
long long d[MAX_N];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  cin >> n >> m;
  REP(i,1,m+1){
    cin >> es[i].from >> es[i].to >> es[i].cost;
  }
  rep(i,n+1){
    d[i] = INF;
  }
  d[1] = 0;
  int c = 0;
  bool flag = false;
  long long tmp;
  while(true){
    bool update = false;
    REP(i,1,m+1){
      edge e = es[i];
      if(d[e.from]!=INF && d[e.to] < d[e.from] + e.cost){
        d[e.to] = d[e.from] + e.cost;
        update = true;
      }
    }
    if(!update) break;
    c++;
    if(c>n&&flag==false){
      tmp = d[n];
      flag = true;
    }
    if(c>2*n){
      if(tmp==d[n]){
        cout << d[n] << endl;
      }else{
        cout << "inf" << endl;
      }
      return 0;
    }
  }
  cout << d[n] << endl;
  return 0;
}


Measured memory_bytes: 256
open Printf
open Scanf
open Core
open Stdio

(* Core.read_line is deprecated *)
let read_line () =
    (* Out_channel.(flush stdout); *)
    In_channel.(input_line_exn stdin)

let f = let rec loop l (money, kabu) = match l with
            | [] -> failwith ""
            | [x] -> money + kabu * x
            | (x::(y::_ as y_s)) -> let maisu = money / x in
                loop y_s (if x > y
                    then (money + kabu * x, 0)
                    else (money - maisu * x, kabu + maisu)
                )
    in
    Fn.flip loop (1000, 0)

let () =
    ignore (read_line ());
    read_line ()
    |> String.split_on_chars ~on:[' ']
    |> List.map ~f:int_of_string
    |> f
    |> printf "%d\n"


Measured memory_bytes: 13668
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repbtw(i, a, b) for (int i = a; i <= (int)(b); i++)
#define all(v) v.begin(), v.end()
#define pr(x) cout << x << endl

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

int gcd(int a, int b, int c){
    return gcd(gcd(a,b), c);
}

int main(int argc, char const *argv[])
{
    int K;
    cin >> K;
    int sum = 0;

    sum += K*(K+1)/2;

    repbtw(i, 1, K-1){
        repbtw(j, i+1, K){
            sum += 6 * gcd(i,j);
        }
    }

    repbtw(i, 1, K-2){
        repbtw(j, i+1, K-1){
            repbtw(k, j+1, K)
                sum += 6 * gcd(i,j,k);
        }
    }
    pr(sum);
    return 0;
}



Measured memory_bytes: 3636
a,b,k=map(int,input().split())
atmp=a; btmp=b;
ans=set()

for i in range(1,k+1):
    ans.add(atmp)
    atmp+=1
    if atmp>b:
        break

for i in range(1,k+1):
    ans.add(btmp)
    btmp-=1
    if btmp<a:
        break

ans=sorted(ans)
for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
/* END OF TEMPLATE */

vector<vp> g(1010);
ll n, m;
ll a[2020], b[2020], c[2020], score[2020];
ll ans = -INF;
bool close[1010];

void closelistup(){
    
}

void bf(){
    score[1] = 0;
    repr(i, 2, n+1){
        score[i] = -INF;
    }
    for(ll i = 0;; i++){
        bool finf = 0;
        bool finfv = 0;
        rep(j, m){
            ll u = a[j];
            ll v = b[j];
            if(score[v] < score[u] + c[j]){
                score[v] = score[u] + c[j];
                finf = 1;
                if(v == n){
                    finfv = 1;
                }
            }
        }
        if(!finf){
            ans = score[n];
            return;
        }
        if(finfv && i >= n){
            ans = INF;
            return;
        }
        if(i >= 3 * n){
            ans = score[n];
            return;
        }
    }
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, m){
        cin >> a[i] >> b[i] >> c[i];
        g[a[i]].emplace_back(b[i], c[i]);
    }
    bf();
    if(ans >= INF){
        cout << "inf" << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 384
from math import ceil
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
D.sort(key=lambda x: sum(x), reverse=True)
ans = 0
for i in range(N):
    ans -= D[i][1]
    if i < ceil(N / 2):
        ans += D[i * 2][0] + D[i * 2][1]
print(ans)

Measured memory_bytes: 32224
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc =new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int kame=b/2-a;
		int turu=-b/2+2*a;

		if(!(b%2==0)) {
			System.out.println("No");
		}
		else if(turu<0||kame<0) {
			System.out.println("No");
		}
		else if((kame+turu)==a) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		
		
	}

}


Measured memory_bytes: 35628
n, k, q = gets.split.map(&:to_i)
a = []
1.upto(q) do |_|
  a << gets.to_i
end
b = a.group_by{|i| i}
1.upto(n) do |i|
  if k - (q - b[i].to_a.length) > 0
    print "Yes\n"
  else
    print "No\n"
  end
end

Measured memory_bytes: 13436
#include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin >> N;
int A[N];
typedef pair<int, int> P;
priority_queue< P, vector<P>, greater<P> > Q;
for(int i=0; i<N; i++){ cin >> A[i]; Q.push(make_pair(A[i], i+1)); }
for(int i=0; i<N; i++){ cout << Q.top().second << " "; Q.pop(); }
cout << "\n";
}

Measured memory_bytes: 2164
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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; }

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

//vector<ll> a;

int main()
{
	string s, t,u;
	ll a, b;
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;

	if (s == u) {
		cout << a-1 << " "<< b << endl;
	}else if (t == u) {
		cout << a << " " << b-1 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll> 
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,cnt=0;cin>>n;
  ll seat=0,lseat=0,rseat=n;
  string s,ls,rs;
  print(0);cin>>s;ls=s,rs=s;
  while(cnt<19) {
    seat=(lseat+rseat)/2;
    print(seat);
    cin>>s;
    if(s=="Vacant") break;
    if(((seat-lseat)%2)^(ls==s)) {lseat=seat;ls=s;}
    else {rseat=seat;rs=s;}
    cnt++;
  }
  return 0;
}

Measured memory_bytes: 852
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define ll unsigned long long

ll gcd(ll a, ll b) {
    if(a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

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

int main() {
    ll N, v, value = 1, cnt = 0;
    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> v;
        if(value == v) {
            value++;
        } else {
            cnt++;
        }
    }

    if(cnt != N) {
        cout << cnt << endl;
    } else {
        cout << -1 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n; cin >> n;
	vi t(n);
	int sum = 0;
	for (auto& i : t)
	{
		cin >> i;
		sum += i;
	}
	int m; cin >> m;
	REP(i, m)
	{
		int p, x; cin >> p >> x;
		p--;
		cout << sum + (x - t[p]) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
	int k;
	char s[105];
	scanf("%d",&k);
	getchar();
	scanf("%s",&s);
	if(strlen(s)>k){
		for(int i=0;i<k;i++){
			printf("%c",s[i]);
		}
		printf("...");
		printf("\n");
	}
	else{
		int l = strlen(s);
		for(int i=0;i<l;i++)
			printf("%c",s[i]);
		printf("\n");
	}
}

Measured memory_bytes: 1668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}


int main(){

  int N;
  string s;
  cin >> N >> s;
  bool ok1[10]={},ok2[10][10]={},ok3[10][10][10]={};
  for(auto c:s){
    FOR(i,0,10)FOR(j,0,10)ok3[i][j][c-'0'] |= ok2[i][j];
    FOR(i,0,10)ok2[i][c-'0'] |= ok1[i];
    ok1[c-'0'] = true;
  }
  ll ans = 0;
  FOR(i,0,10)FOR(j,0,10)FOR(k,0,10){
    ans += ok3[i][j][k];
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Arrow (second)
import Control.Monad
import Control.Monad.Fix
import Data.Foldable (foldl')
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)

uread :: VUM.Unbox a => Int -> VUM.IOVector a -> a
uread i v = accursedUnutterablePerformIO $ VUM.unsafeRead v i

uwrite :: VUM.Unbox a => Int -> a -> VUM.IOVector a -> VUM.IOVector a
uwrite i a v = accursedUnutterablePerformIO $ VUM.unsafeWrite v i a >> return v

uswap :: VUM.Unbox a => Int -> Int -> VUM.IOVector a -> VUM.IOVector a
uswap i j v = accursedUnutterablePerformIO $ VUM.unsafeSwap v i j >> return v

ufreeze :: VUM.Unbox a => VUM.IOVector a -> VU.Vector a
ufreeze v = accursedUnutterablePerformIO $ VU.unsafeFreeze v

uthaw :: VUM.Unbox a => VU.Vector a -> VUM.IOVector a
uthaw v = accursedUnutterablePerformIO $ VU.unsafeThaw v

newtype UnionFind = UnionFind (VUM.IOVector Int, VUM.IOVector Int)

findUF :: UnionFind -> Int -> Int
findUF (UnionFind (elems, _)) k = fix
  ( \f (elems, k, path) -> case uread k elems of
    n | n == k -> foldl' (\acc p -> uwrite p n acc) elems path `seq` n
    n          -> f (elems, n, n : path)
  )
  (elems, k, [k])

sizeUF :: UnionFind -> Int -> Int
sizeUF (UnionFind (_, sizes)) i = uread i sizes

uwriteElem :: Int -> Int -> UnionFind -> UnionFind
uwriteElem i a (UnionFind (elem, sizes)) = UnionFind (uwrite i a elem, sizes)

uwriteSize :: Int -> Int -> UnionFind -> UnionFind
uwriteSize i a (UnionFind (elem, sizes)) = UnionFind (elem, uwrite i a sizes)

unionUF :: UnionFind -> Int -> Int -> (UnionFind, Int)
unionUF uf i j =
  let
    pi  = findUF uf i
    pj  = findUF uf j
    si  = sizeUF uf pi
    sj  = sizeUF uf pj
    sij = si + sj
  in
    if pi == pj
    then
      (uf, 0)
    else
      if si < sj
        then
          (uwriteSize pi 0 $ uwriteSize pj sij $ uwriteElem pi pj uf, si * sj)
        else
          (uwriteSize pj 0 $ uwriteSize pi sij $ uwriteElem pj pi uf, si * sj)

comb2 k = k * (k - 1) `div` 2

solve :: Int -> Int -> VU.Vector (Int, Int) -> VU.Vector Int
solve n m abs = ufreeze $ (\(_, _, acc) -> acc) $ VU.foldr'
  go
  (group, 0, accursedUnutterablePerformIO $ VUM.replicate m 0)
  abs
 where
  go (a, b) (uf, k, acc) =
    let (uf', d) = unionUF uf a b
        prev     = if k == 0 then 0 else uread (k - 1) acc
    in  (uf', k + 1, uwrite k (prev + d) acc)

  nC2 = comb2 n

  group :: UnionFind
  group = UnionFind
    (uthaw $ VU.enumFromN 0 n, accursedUnutterablePerformIO $ VUM.replicate n 1)

main = do
  let readInt = fmap (second B.tail) . B.readInt

  nm  <- VU.unfoldrN 2 readInt <$> B.getLine
  abs <- VU.replicateM
    (nm VU.! 1)
    (   (\vec -> (vec VU.! 0 - 1, vec VU.! 1 - 1))
    .   VU.unfoldrN 2 readInt
    <$> B.getLine
    )

  let solutions = solve (nm VU.! 0) (nm VU.! 1) abs
  let nC2       = comb2 $ nm VU.! 0

  mapM_ (print . (nC2 -) . (solutions VU.!)) [nm VU.! 1 - 2, nm VU.! 1 - 3 .. 0]
  print nC2


Measured memory_bytes: 32380
// scanf 等でエラーを出さないように追加
#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <algorithm>
#include <numeric>
#include <set>
#include <functional>
#include <utility>


using namespace std;


typedef long long ll;


const int MAX_T = 100;
int K, T;

int a[MAX_T];


int rec(const int result_day) {

	a[0]--;
	sort(a + 1, a + T, greater<int>());

	bool hasEaten = true;

	for (int i = 0; i < T; i++) {
		if (a[i] > 0) {
			hasEaten = false;
			break;
		}
	}

	if (hasEaten) {
		return result_day;
	}

	if (a[1] == 0) {
		return rec(result_day + 1);
	}
	else {
		swap(a[0], a[1]);
		return rec(result_day);
	}
}

int main() {

	scanf("%d %d", &K, &T);

	for (int i = 0; i < T; i++) {
		scanf("%d", &a[i]);
	}

	sort(a, a + T, greater<int>());

	cout << rec(0) << endl;

	return 0;
}

Measured memory_bytes: 384
def main(n,a):
  k=60
  mp=[[0]*k for _ in range(k)]
  o=k//2
  ary=[]
  for i in range(n):
    b=list(a[i].split('.'))
    b.append('0')
    x=int(b[0])
    y=int((b[1]+'0'*9)[:9])
    x=x*pow(10,9)+y
    # x10^9
    cnt5=-9
    xx=x
    while xx>1:
      if xx%5==0:
        cnt5+=1
        xx//=5
      else:
        break
    cnt2=-9
    xx=x
    while xx>1:
      if xx%2==0:
        cnt2+=1
        xx//=2
      else:
        break
    #if 0<=cnt5+o<23 and 0<=cnt2+o<23:
    mp[cnt5+o][cnt2+o]+=1
    ary.append([cnt5+o,cnt2+o])

  ans=0
  for i in range(k-1,0,-1):
    for j in range(k):
      mp[j][i-1]+=mp[j][i]
  for i in range(k-1,0,-1):
    for j in range(k):
      mp[i-1][j]+=mp[i][j]
  for x,y in ary:
    if x>=o and y>=o:
      i=1
    else:
      i=0
    x-=o
    x*=-1
    x+=o
    y-=o
    y*=-1
    y+=o
    ans+=mp[x][y]-i
  print(ans//2)
  #mp[o,o]+=10
  #print(mp)

n=int(input())
a=[input() for _ in range(n)]
main(n,a)



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


int max_happy(int money){
    int exchange_500=0, exchange_5=0;
    exchange_500 = money/500;
    money -= 500*exchange_500;
    exchange_5 = money/5;
    return 1000*exchange_500+5*exchange_5;
}
int main(){
    int X; cin >> X;
    cout << max_happy(X);
}

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

typedef long long ll;
typedef unsigned long long ull;

void add(stack<char>& s, char c){
    if(c == '('){
        s.push(c);
    }else if(c == ')'){
        if(!s.empty() && s.top() == '('){
            s.pop();
        }else{
            s.push(c);
        }
    }else{ abort();}
}

void add(stack<char>& s, string str){
    for(auto c : str){
        add(s, c);
    }
}

int main()
{
    ll N;
    cin >> N;
    string Si;
    vector<string> lr(N);
    vector<array<int, 2>> order(N);
    int i_left_candidate = 0;
    int i_right_candidate = 0;
    for(int i=0;i<N;i++){
        cin >> Si;
        stack<char> s;
        add(s, Si);
        while(!s.empty()){
            auto v = s.top(); s.pop();
            lr[i] += v;
        }
        reverse(lr[i].begin(), lr[i].end());
        order[i][0] = 0;
        for(auto c : lr[i]){
            if     (c=='(') order[i][0]--;
            else if(c==')') order[i][0]++;
            else{ abort();};
        }
        order[i][1] = i;
        if(lr[i].size() > 0 && lr[i].front() == '(') i_left_candidate = i;
        if(lr[i].size() > 0 && lr[i].back() == ')') i_right_candidate = i;
    }
    sort(order.begin(), order.end());

    //if(i_left_candidate == -1 || i_right_candidate == -1){
    //    cout << "No" << endl;
    //    return 0;
    //}

    stack<char> s;
    add(s, lr[i_left_candidate]);
    for(auto v : order){
        if(v[1] == i_left_candidate) continue;
        if(v[1] == i_right_candidate) continue;
        add(s, lr[v[1]]);
    }
    add(s, lr[i_right_candidate]);
    if(s.size() == 0) cout << "Yes" << endl;
    else              cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 42744
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  string x, y; cin >> x >> y;
  if (x == y) cout << "=" << endl;
  else if (x < y) cout << "<" << endl;
  else cout << ">" << endl;
}


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <vector>
#define int long long
using namespace std;
int n, k, a[100], ans;
signed main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i <= min(n, k); i++) {
		for (int j = 0; i + j <= min(n, k); j++) {
			vector<int>v; int sum = 0;
			for (int p = 0; p < i; p++) {
				v.push_back(a[p]); sum += a[p];
			}
			for (int p = 0; p < j; p++) {
				v.push_back(a[n - p - 1]); sum += a[n - p - 1];
			}
			sort(v.begin(), v.end());
			for (int p = 0; p < min(k - i - j, i + j); p++)sum -= min(v[p], (int)0);
			ans = max(ans, sum);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << "/n"
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    char c; cin >> c;
    if(c == 'a' ||c == 'e' ||c == 'i' ||c == 'o' ||c == 'u' ){
        cout << "vowel" << endl;
    }
    else cout << "consonant" << endl;
}

Measured memory_bytes: 256
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N,K = LI()

prob = []
for i in range(1,N+1):
    if i >= K:
        prob.append(1)
    else:
        a = 0
        while i*2**a < K:
            a += 1
        prob.append(1/2**a)

print(sum(prob)/N)

Measured memory_bytes: 71268
N = int(input())
W = []
judge = 1

for i in range(N):
  w = input()    
  W.append(w)
  if(i != 0):
   tmp1 = list(W[-2])
   tmp2 = list(w)
   if(tmp1[-1] != tmp2[0]):
     judge = 0
     break

len1 = len(W)
len2 = len(list(set(W)))
if(len1 != len2):
  judge = 0

if(judge == 1):
  print('Yes')
else:
  print('No')

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

int main() {
    string S;
    cin >> S;
    set<char> A;
    for(int i=0; i<S.size(); ++i) A.insert(S[i]);

    for(int i=0; i<26; ++i) {
        if(A.find('a' + i) == A.end()) {
            cout << S << (char)('a' + i) << endl;
            return 0;
        }
    }

    int pos = 0;
    for(int i = 1; i<S.size(); ++i) {
        if(S[i-1] < S[i]) pos = i;
    }
    if(pos == 0) {
        cout << -1 << endl;
        return 0;
    }
    char a = 'z';
    for(int i=pos; i<S.size(); ++i) {
        if(S[pos-1] < S[i]) a = min(a, S[i]);
    }
    cout << S.substr(0, pos - 1) << a << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++)
		sum *= (x--);
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n, x, a[2000];
int b[2000][2000];
signed main() {
	cin >> n >> x;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int l = 0; l < n; l++) {
		int sum = a[l];
		for (int r = l; r < n; r++) {
			sum = min(sum, a[r]);
			b[l][r] = sum;
		}
	}
	int ans = inf;
	for (int k = 0; k < n; k++) {
		int sum = 0;
		for (int i = 0; i < n; i++) {
			int res = b[i][min(n - 1, i + k)];
			if (i + k >= n)
				res = min(res, b[0][i + k - n]);
			sum += res;
		}
		ans = min(ans, sum + x*k);
	}
	cout << ans << endl;
	getchar(); getchar();
}

Measured memory_bytes: 31104
#include <bits/stdc++.h>
//#pragma GCC optimize(3)

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define mset(var,val) memset(var,val,sizeof(var))
#define IOS ios::sync_with_stdio(false);cin.tie(0)

#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)

using namespace std;
typedef long long ll;

namespace debug {
#ifdef local
#define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
#else
#define dbg(...)
#endif
void err() {
    cout << endl;
}
template<template<typename...> class T, typename t, typename... Args>
void err(T<t> a, Args... args) {
    for (auto x: a)
        cout << x << ' ';
    err(args...);
}
template<typename T, typename... Args>
void err(T a, Args... args) {
    cout << a << ' ';
    err(args...);
}
}

namespace stdio_input {
#define scd(args...) do{scanf_int(args);} while(0)
void scanf_int() {}
template<typename T, typename... Args>
void scanf_int(T &a, Args&... args) {
    scanf("%d", &a);
    scanf_int(args...);
}
#define scl(args...) do{scanf_ll(args);} while(0)
void scanf_ll() {}
template<typename T, typename... Args>
void scanf_ll(T &a, Args&... args) {
    scanf("%lld", &a);
    scanf_ll(args...);
}
#define scf(args...) do{scanf_double(args);} while(0)
void scanf_double() {}
template<typename T, typename... Args>
void scanf_double(T &a, Args&... args) {
    scanf("%lf", &a);
    scanf_double(args...);
}
}

namespace const_var {
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const double PI = acos(-1.0);
const int N = 1e5+10;
const long double eps = 1e-20;
const int mod = 1e9+7;
}

using namespace debug;
using namespace stdio_input;
using namespace const_var;

int T = 0;
void testcase() {
    cout << "Case #" << (++T) << ": ";
}

int dis[N];
bool vis[N];

struct P{
    int u, w;
    bool operator < (const P & b) const {
        return w > b.w;
    }
};

priority_queue<P> q;
void work() {
    int k;
    cin >> k;
    mset(dis, inf);
    dis[1] = 1;
    q.push({1,1});
    while(!q.empty()){
        int u = q.top().u;
        int w = q.top().w;
        q.pop();
        if(u == 0) break;
        if(vis[u] || dis[u] != w) continue;
        vis[u] = true;
        int v = u * 10 % k;
        if(dis[u] < dis[v]){
            dis[v] = dis[u];
            q.push({v, dis[v]});
        }
        v = (u + 1) % k;
        if(dis[u] + 1 < dis[v]){
            dis[v] = dis[u] + 1;
            q.push({v, dis[v]});
        }
    }
    cout << dis[0] << endl;
}

int main() {
#ifdef local
    freopen("in.txt","r",stdin);
//    freopen("out.sql","w",stdout);
#endif // local
    IOS;
//    getPrime();
//    init();
    int t;
//    cin >> t;
//    cin.get();
//    for(;t--;)
    work();
    return 0;
}


Measured memory_bytes: 1404