akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ll N = 50;
    ll K;
    scanf("%lld", &K);
    ll p = K/N;
    K %= N;
    ll ans[N];
    for(ll i = 0; i < N - K; ++i) {
        ans[i] = p + i;
    }
    for(ll i = 0; i < K; ++i) {
        ll j = N - 1 - i;
        ans[j] = p + N - i;
    }
    printf("%lld\n", N);
    for(int i = 0; i < N; ++i) printf("%lld ", ans[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll MOD=100000007;
const ll INF=1000000000000000001;
int main(){
long double a,b;cin>>a>>b;
ll tmp=0;
tmp=a*b;
double j;
ll i;
stringstream ss;
ss<<tmp;
ss>>i>>j;
cout<<i<<endl;

}

Measured memory_bytes: 3772
input_str = input()

num1 = int(input_str[0:2])
num2 = int(input_str[2:4])

def isMonthFormat(num):
    return num >= 1 and num <= 12

flag1 = isMonthFormat(num1)
flag2 = isMonthFormat(num2)

if flag1 and flag2:
    print("AMBIGUOUS")
elif not flag1 and not flag2:
    print("NA")
elif flag1:
    print("MMYY")
else:
    print("YYMM")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mod 1000000007
#define INF 1e9+100
#define pii pair<int,int>
#define ppi pair<pii,int>
#define ff first
#define ss second
#define cy cout<<"Yes"<<endl;
#define cn cout<<"No"<<endl;
#define urs(r...)          typename decay<decltype(r)>::type
#define fo(i,n)                for(urs(n) i=0;i<n;i++)
#define re(i,n)               for(urs(n) i=1;i<=n;i++)
#define pb push_back
#define gap ' '
main()
{
	int i,j,n,m,k;
	int t;
	string x;
	cin>>x;
	if(x[2]==x[3] and x[4]==x[5]) cy
		else cn
}


Measured memory_bytes: 256
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define pb push_back
# define pdd pair < db , db >
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    const int mod = 1e9 + 7;
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    auto prim = [&](int n)
    {
        for (int i = 2;i * i <= n;++i)
            if (!(n % i))
                return 0;
        return 1;
    };
    function < int(int,int) > f = [&](int n,int p)
    {
        return n < p ? 0 : n / p + f(n / p,p);
    };
    int n;
    fi>>n;
    int ans = 1;
    for (int i = 2;i <= n;++i)
        if (prim(i))
            ans = (1ll * ans * (f(n,i) + 1)) % mod;
    fo << ans << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main (){
    int N, T,c[1000],t[1000],anc;
    cin >> N >> T ;
    for(int i = 0; i < N; i++)    cin >> c[i] >> t[i];
    anc = 10000;
    for(int i = 0; i < N; i++){
        if(T >= t[i] && anc > c[i])    anc = c[i];
    }
    if(anc == 10000){
        cout << "TLE" << endl; 
    }else{
        cout << anc << endl;
    }

}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))

current = H.pop(0)
count = 0
count_max = 0

for h in H:
    if current >= h:
        count += 1
    else:
        count_max = max(count, count_max)
        count = 0
    current = h

count_max = max(count, count_max)
print(count_max)


Measured memory_bytes: 63856
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  map<int, int> amap;
  int tmp;
  for(int i=0;i<3;++i) {
    cin>>tmp;
    amap[tmp]++;
  }
  if(amap[5]==2 && amap[7]==1) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 3572
import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
pragma(inline, true) T[] Reads(T)() { return readln.split.to!(T[]); }
alias reads = Reads!int;
pragma(inline, true) void scan(Args...)(ref Args args) {
    string[] ss = readln.split;
    foreach (i, ref arg ; args) arg = ss[i].parse!int;
}

void main() {
    readln;
    int[] a = reads();
    double b = 0;
    foreach (i; a)
        b += 1.0 / i;
    writefln("%.10f", 1/b);
}


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

int main()
{
  ll n, a, b;
  cin >> n >> a >> b;
  ll num = n / (a + b);
  ll mod = n % (a + b);
  ll ext = min(a, mod);
  cout << num * a + ext << endl;

  return 0;
}

Measured memory_bytes: 256
/*
[abc110] A - Maximize the Formula
*/

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

int ABC[3];

int solve() {
    sort(ABC, ABC + 3);

    return ABC[2] * 10 + ABC[1] + ABC[0];
}

int main() {
    cin >> ABC[0] >> ABC[1] >> ABC[2];

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N;
    vi a(N), b(N), c(N - 1);
    cin >> a >> b >> c;
    ans += b[a[0] - 1];
    for (int i = 1; i < N; i++) {
        int id = a[i] - 1;
        ans += b[id];
        if (a[i] - a[i - 1] == 1) {
            ans += c[id - 1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 3e5 + 7;

vi r[N], c[N];
bool yes[N];

signed main()
{
	IO_OP;
	
	int h, w, m;
	cin >> h >> w >> m;	
	int mxr = 0, mxc = 0;
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		r[x].PB(y);
		mxr = max(mxr, (int)r[x].size());
		c[y].PB(x);
		mxc = max(mxc, (int)c[y].size());
	}
	int ans = mxr + mxc - 1, ccnt = 0;;

	for(int i = 0; i < N; i++)
		if((int) c[i].size() == mxc) yes[i] = 1, ccnt++;

	for(int i = 0; i < N; i++) {
		if((int)r[i].size() == mxr) {
			int cnt = 0;
			for(int j:r[i]) {
				if(yes[j]) cnt++;
			}
			if(cnt != ccnt) {
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;



}





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

int main()
{
  int L;

  cin >> L;

  vector<float> side(3);

  side.at(0) = L / 3.0;
  side.at(1) = L / 3.0;
  side.at(2) = L / 3.0;

  float ans = side.at(0) * side.at(1) * side.at(2);

  cout << fixed << setprecision(12) << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import itertools
import math

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

a = list(itertools.permutations(range(n), n))

D = 0
for _ in a:
    for s in range(n -1):
        c = _[s]
        c1 = _[s+1]
        X = (x[c] - x[c1])**2
        Y = (y[c] - y[c1])**2
        r =  math.sqrt(X+Y)
        D += r
print(D / len(a))

Measured memory_bytes: 8100
#include <bits/stdc++.h>
using namespace std;
using pp=pair<int,int>;

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> V(N);
  for (int i=0; i<N; i++) {
    cin >> V[i];
  }
  sort(V.begin(), V.end());
  for (int i=0; i<N; i++) {
    cout << V[i];
  }
  cout << endl;
}

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

using namespace std;
#define ll long long int


int main()
{
    ll n;
    cin>>n;
    //int a[n];
    ll sum = 0;
    map<ll,ll> freq;
    for(ll i=0;i<n;i++){
        ll x;
        cin>>x;
        sum+=x;
        freq[x]++;
    }
    ll q;
    cin>>q;
    //int temp[q];
    for(ll i=0;i<q;i++){
        ll b,c;
        cin>>b>>c;
        sum = (sum-b*freq[b])+c*freq[b];
        //temp[i]=sum;
        freq[c]+=freq[b];
        freq[b]=0;
        cout<<sum<<endl;
    }

}


Measured memory_bytes: 9384
#include <bits/stdc++.h>
 
#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << endl;
#else
#define DBG(X)
#endif
 
using namespace std;

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

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

const ll mod = 1e9 + 7;
static mt19937 _g(time(nullptr));

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

void solve()
{
	ll a, b, t;
	cin >> a >> b >> t;

	cout << (t / a) * b << endl;
}

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

	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vivi vector<vi>
const int INF = 1<<29;
typedef long long int ll;

int main(){
    int c[3][3];
    int N = 0;
    rep(i, 3)
        rep(j, 3)
            cin >> c[i][j];
    rep(i, 101){
        int a[3], b[3];
        a[0] = i;
        b[0] = c[0][0] - a[0];
        b[1] = c[0][1] - a[0];
        b[2] = c[0][2] - a[0];
        a[1] = c[1][0] - b[0];
        a[2] = c[2][0] - b[0];
        bool flg = true;
        rep(s, 3)
            rep(t, 3)
                if(c[s][t] != a[s] + b[t])flg = false;

        if(flg){
            cout << "Yes";
            return 0;
        }
    }
    cout <<"No";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  int N,K;
  cin >> N >> K;
  vll H(N);
  cin >> H;
  sort(H.begin(),H.end(),greater<int>());
  
  ll cnt = 0;
  REP(i,N){
    if(i < K)continue;
    cnt += H[i];
  }
  
  cout << cnt << endl;
  
}

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

class Main {

  public static void main(String[] args) {
  
  	try {
    
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String strLine = br.readLine();
      String costsLine = br.readLine();
      String[] nkLine = strLine.split(" ");
      int n = Integer.parseInt(nkLine[0]);
      int k = Integer.parseInt(nkLine[1]);
      String[] costs = costsLine.split(" ");
	  int[] dp = new int[n];
      dp[0] = 0;
      dp[1] = Math.abs(Integer.parseInt(costs[1]) - Integer.parseInt(costs[0]));
      for(int i = 2; i < n ; i++) {
      	dp[i] = Integer.MAX_VALUE;
        for(int j = Math.max(0, i-k) ; j < i ; j++) {
        dp[i] = Math.min(dp[i], dp[j] + Math.abs(Integer.parseInt(costs[i])
                                            - Integer.parseInt(costs[j])));
        }
      } 
    
      System.out.println(dp[n-1]);
		                         
    } catch(Exception ex) {
    
    }
  
  }

}

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

int main()
{
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    int ans = 0;
    for (int i = 1; i <= N; ++i)
    {
        if (i > K)
        {
            ans += Y;
        }
        else
        {
            ans += X;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
/*******************************************
****************** BY **********************
******* FUTURE GOOGLE EMPLOYEE *************
****** KARTHICK KUPPURAJ M *****************
********************************************/
#define ms(s, n) memset(s, n, sizeof(s))
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define prec(n) fixed<<setprecision(n)
#define sll(x) scanf("%lld",&x);
#define pll(x) printf("%lld",x);
#define pn printf("\n");
#define ps printf(" ");
#define pc(c) printf("%c",c);
typedef long long int ll;
#define EPS 1e-9
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;

ll add(ll a, ll b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
    return a;
}

int N, X, Y, Z;

ll dp[41][1 << 17];
const int mask = (1 << 17) - 1;

int trans[1 << 17][11];
ll powten[41];

int main() {
    scanf("%d%d%d%d", &N, &X, &Y, &Z);

    dp[0][1] = 1;

    powten[0] = 1;
    for (int i = 0; i < N; ++i)
    { powten[i + 1] = powten[i] * 10 % MOD; }

    for (int i = 0; i < (1 << 17); ++i)
    {
        for (int j = 1; j <= 10; ++j)
        {
            int i2 = i;
            for (int k = 0; k < 17; ++k)
            {
                if (k < X && k + j > X) i2 &= ~(1 << k);
                if (k < X + Y && k + j > X + Y) i2 &= ~(1 << k);
                if (k < X + Y + Z && k + j > X + Y + Z) i2 &= ~(1 << k);
            }
            i2 <<= j;
            i2 |= 1;
            i2 &= (1 << 18) - 1;

            trans[i][j] = i2;
        }
    }

    ll ans = 0;
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < (1 << 17); ++j)
        {
            for (int k = 1; k <= 10; ++k)
            {
                int j2 = trans[j][k];

                if (j2 & (1 << (X + Y + Z)))
                {
                    ans = add(ans, dp[i][j] * powten[N - i - 1] % MOD);
                    continue;
                }
                j2 &= mask;
                dp[i+1][j2] = add(dp[i + 1][j2], dp[i][j]);
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 47872
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdlib>
#include<vector>
#define MAX_V 1000
#define INF 1<<29
#define cl(a,b) for(int i=0;i<a;i++)for(int j=0;j<b;j++)cost[i][j] = INF;
#define de(a)  for(int i=0;i<a;i++){cout << mincost[i] << " "; if(i == a-1){cout << endl;}}
#define de2(a,b) for(int I=0;I<a;I++){for(int j=0;j<b;j++){cout << cost[I][j] << " ";}cout << endl;}cout << endl;
using namespace std;

int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int V;
bool connect[10000];

int prime()
{
  for(int i=0;i<V;++i)
    {
      mincost[i]=INF;
      used[i]=false;
    }
  mincost[0] = 0;
  int res = 0;
  while(true)
    {
      int v = -1; 
      for(int u = 0; u<V ; u++ )
	{
	  if(connect[u] && !used[u] && (v == -1 || mincost[u] < mincost[v]))
	    {
	      v = u;
	    }
	}
      if(v == -1)break;
      used[v] = true;
      res += mincost[v];
      for(int u = 0; u < V; u++)
	{
	  mincost[u] = min(mincost[u],cost[v][u]);	  
	}
    }
  return res;
}

int main()
{
  int n,m,a,b;
  while(true)
    {
      cin >> n >> m;
      if(n == 0 && m == 0)break;
      cl(n,n);
      memset(connect,false,sizeof(connect));
      V = n; // VÍ¸_
      for(int i=0;i<m;i++)
	{
	  cin >> a >> b;
	  cin >> cost[a][b];
	  cost[b][a] = cost[a][b];
	  connect[a] = true;
	  connect[b] = true;
	}
      cout << prime() << endl;
    }
}

Measured memory_bytes: 0
#include<stdio.h>

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

int main(void) {

	int i;
	int n;
	int a[100000];
	int c = 0;
	int min = 1000000000;

	scanf("%d", &n);

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

	for (i = 0; i < n - 1; i++) {
		c = gcd(a[i], a[i + 1]);
		if (c < min)min = c;
	}

	printf("%d\n", min);

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int ma[n][m];
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
      cin>>ma[i][j];
  int l[m];
  for(int i=0;i<m;i++)
    cin>>l[i];

  for(int i=0;i<n;i++)
  {
    int sum=0;
    for(int j=0;j<m;j++)
    {
      sum+=ma[i][j]*l[j];
    }
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 3096
#include <stdio.h>

int main() {
  int number_x, number_y;
  scanf("%d %d", &number_x, &number_y);
  if(number_x + number_y < 10) {
    printf("%d\n", number_x + number_y);
  } else {
    printf("error\n");
  }
  return 0;
}


Measured memory_bytes: 128
rec, loz = 0, 0
while True:
    try:
        a, b, c = map(int, input().split(','))
    except:
        break
    if a == b:
        loz += 1
    elif a ** 2 + b ** 2 == c ** 2:
        rec += 1
print(rec)
print(loz)

Measured memory_bytes: 7588
#include<stdio.h>
#define A 1 B 2 C 3 D 4 E 5 F 6
int main(){
    int X , Y ;
    scanf("%x%x",&X,&Y);
    if(X<Y){
        printf("<");
    }else if(X > Y){
        printf(">");
    }else{
        printf("=");
    }



}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstdio>
using namespace std;
#define pi acos(-1)
int main() {
	double a, b, h, m, c, sz, fz, cha, t, fi;
	cin >> a >> b >> h >> m;
	fz = 6 * m;
	sz = h * 30 + 0.5 * m;
	cha = abs(sz - fz);
	t = cha * pi / 180;
	fi = pow(a * a + b * b - 2 * a * b * cos(t), 0.5);
	printf("%.15lf\n", fi);
	return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h> 
using namespace std; 
int main() {
    long double a, n;
    cin >> a >> n;
    int counter = 0;
    long double total = 0;
    int count = 0;
    for (int i = 1; i <= a; i++) {
        count = i;
        while (count < n) {
            count = count*2;
            counter++;
        }
        total = total + ((1/a)*pow(0.5, counter));
        counter = 0;
    }
    cout << setprecision(10);
    cout << total;
} 

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] L = new int[2*N];
		for(int i = 0;i < L.length;i++) {
			L[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(L);
		int sum = 0;
		for(int i = 0;i < L.length;i+=2) {
			sum += Math.min(L[i], L[i+1]);
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 21844
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	long long int a, b, c, ans;
	scanf("%lld %lld %lld", &a, &b, &c);
	if(a%2==0 || b%2==0 || c%2==0){
		ans = 0;
	}else{
		if(a <= b && b <= c) ans = a*b;
		else if(b <= c && c <= a) ans = b*c;
		else if(c <= a && a <= b) ans = c*a;
		else if(b <= a && a <= c) ans = a*b;
		else if(c <= b && b <= a) ans = b*c;
		else ans = c*a;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
from collections import defaultdict
N,K=map(int,input().split())
L=list(map(int,input().split()))
Hash=defaultdict(lambda:list())
for i in range(K):
    x,y=map(int,input().split())
    Hash[x-1].append(y-1)
    Hash[y-1].append(x-1)
count=0
for i in range(N):
    FLAG=0
    for k in Hash[i]:
        if L[k]>=L[i]:
            FLAG=1
            break
    if FLAG==0:
        count+=1
print(count)

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

struct UnionFind {
  vector<int> d; // 親の番号、但し根の場合はサイズのマイナス
  UnionFind(int n): d(n,-1) {}
  int root(int x) { // 根を見つける
    if (d[x] < 0) return x;
    return d[x] = root(d[x]); // 経路圧縮
  }
  bool unite(int x, int y) { // 結合
    x = root(x); y = root(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y);} // 親が一緒
  int size(int x) { return -d[root(x)];} // サイズ
};

int main(){
    int n, m;
    cin>>n>>m;
    int a,b;
    UnionFind uf(n); // 初期化
    rep(i,m){
        cin>>a>>b;
        a--;
        b--;
        uf.unite(a,b);
    } 
    int ans=0;
    rep(i,n) ans=min(ans,uf.d[i]);
    cout<<-ans<<endl;
    return 0;
}

Measured memory_bytes: 4036
import sys
input = sys.stdin.readline
 
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n-k):
    ki_1 = a[i]
    ki = a[i + k]
    if ki_1 < ki:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 31164
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n;
	cin >> n;
	int d[26] = {};
	string s;
	cin >> s;

	for(int i = 0;i < s.size();i++){
		d[s[i]-'a']++;
	}

	for(int i = 0;i < n-1;i++){
		string t;
		cin >> t;
		int now_d[26] = {};
		for(int j = 0;j < t.size();j++){
			now_d[t[j]-'a']++;
		}
		for(int j = 0;j < 26;j++){
			d[j] = min(d[j],now_d[j]);
		}
	}

	string ans = "";
	for(int i = 0;i < 26;i++){
		for(int j = 0;j < d[i];j++){
			ans += i + 'a';
		}
	}

	cout << ans << endl;
}


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

int binarySearch(int n, int s[], int t) {
	int i = 0;
	int j = n - 1;
	while (i <= j) {
		int mid = i + (j - i) / 2;
		int guess = s[mid];
		if (guess == t) {
			return 1;
		}
		if (guess < t) {
			i = mid + 1;
		}
		else {
			j = mid - 1;
		}
	}
	return 0;
}

int main() {
	int n, q, s[100000], t, ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	cin >> q;
	for (int i = 0; i < q;i++) {
		cin >> t;
		ans += binarySearch(n, s, t);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3468
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	bool x=true;
	cin>>s;
	int cnt=0;
	for(int i=0;i<s.size()/2;i++){
		for(int j=0;j<=i;j++){
			if(s[j]!=s[j+i+1])
				x=false;
		}
		if(x==true&&i*2+2!=s.size())
			cnt=max(cnt,i*2+2);
		x=true;
	}
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
	//int i;
	char s[100];
	char p[100];
	char sp[200];

	/*for(i = 0; i < 100; i++)
	{
		s[i] = '\0';
		p[i] = '\0';
	}
	
	for(i = 0; i < 200; i++)
	{
		sp[i] = '\0';
	}*/
	
	scanf("%s", s);
	scanf("%s", p);
    strcat(sp, s);
	strcat(sp, s);
	
	if(strstr(sp, p))
	{
	    printf("Yes\n");
	}
	else
	{
	    printf("No\n");
	}
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s; cin >> s;
	s = ">" + s + "<";

	vl a(sz(s)-1);
	FOR(i,0,sz(s)-1) if (s[i] == '>' && s[i+1] == '<') {
		for (ll j = i-1; j >= 0 && s[j] == '>'; j--) {
			a[j] = a[j+1] + 1;
		}
		for (ll j = i+1; j < sz(s) && s[j+1] == '<'; j++) {
			a[j] = a[j-1] + 1;
		}
	}
	FOR(i,0,sz(s)-1) if (s[i] == '<' && s[i+1] == '>') {
		a[i] = max(a[i-1],a[i+1]) + 1;
	}
	
	cout << accumulate(all(a),0LL) << endl;
}



Measured memory_bytes: 4784
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
#include <set>
using namespace std;
typedef long long ll;

void lcs(string a,string b,int n,int m)
{
  int l[n+1][m+1];
  for(int i=0;i<=n;i++){
    for(int j=0;j<=m;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 ind = l[n][m],i=n,j=m;
  char ans[ind+1];
  ans[ind]='\0';
  while(i>0 && j>0){
    if(a[i-1]==b[j-1]){
      ans[ind-1]=a[i-1];
      ind--,i--,j--;
    } else if(l[i][j-1]>l[i-1][j]) j--;
    else i--;
  }
  cout<<ans;
}

int main()
{
  string a,b;
  cin>>a>>b;
  lcs(a,b,a.size(),b.size());
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  string s;
  cin>>n>>s>>k;
  for(int i=0;i<n;i++){
    if(s[i]!=s[k-1]){
      cout<<'*';
    }
    else{
      cout<<s[i];
    }
  }
  cout<<endl;
  return(0);
}


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

int main()
{
  int n,r;
  cin>>n>>r;
  int inner=r+(100*(10-n));
  if(n<10){
    cout<<inner<<endl;
  }
  else if(n>=10)
  {
      cout<<r<<endl;
  }


}












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

using namespace std;

using int64 = long long;
using pi = pair< int64, int >;

template< class T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};


int main() {
  int N, A[100000];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int64 sum = 1LL * N * (N + 1) / 2;
  sum = (sum + 2) / 2;

  // 8以下にsum個以上中央値がx以下のものが含まれている
  auto check = [&](int x) {
    vector< int > B(N), C(N + 1);
    for(int i = 0; i < N; i++) B[i] = A[i] <= x;
    for(int i = 1; i <= N; i++) C[i] = B[i - 1] + C[i - 1];
    vector< int > es;
    for(int i = 0; i < N; i++) es.emplace_back(2 * C[i] - i + 1);
    sort(begin(es), end(es));
    es.erase(unique(begin(es), end(es)), end(es));
    BinaryIndexedTree< int > uku(es.size() + 1);
    int64 ret = 0;
    for(int i = 0; i <= N; i++) {
      ret += uku.sum(upper_bound(begin(es), end(es), 2LL * C[i] - i) - begin(es) - 1);
      uku.add(lower_bound(begin(es), end(es), 2 * C[i] - i + 1) - begin(es), 1);
    }
    return ret >= sum;
  };

  int ok = 1 << 30, ng = 0;
  while(ok - ng > 1) {
    int mid = (ok + ng) / 2;
    if(check(mid)) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;

}

Measured memory_bytes: 2376
# C
N, L, T = map(int, input().split())
X = list()
W = list()
positions = list()
for _ in range(N):
    x, w = map(int, input().split())
    X.append(x)
    W.append(w)
    if w == 1:
        positions.append((x + T) % L)
    else:
        positions.append((x - T) % L)

# find which is the position
cnt_conf = 0
if W[0] == 1:
    for i in range(N):
        if W[i] != W[0]:
            cnt_conf += (2*T - (X[i] - X[0])) // L + 1
    n0 = cnt_conf % N
    p0 = (X[0] + T) % L
else:
    for i in range(N):
        if W[i] != W[0]:
            cnt_conf += (2*T - (X[0] + L - X[i])) // L + 1
    n0 = -cnt_conf % N
    p0 = (X[0] - T) % L

positions.sort()

# find index
if W[0] == 1:
    num = max([n for n in range(N) if positions[n]==p0])
else:
    num = min([n for n in range(N) if positions[n]==p0])

for i in range(N):
    print(positions[(num - n0 + i) % N])

Measured memory_bytes: 12860
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,w,h) rep(j,h)rep(i,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> a(n);rep(i,n)std::cin >> a[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
int main(){
  string s,t;
  std::cin >> s>>t;
  sort(all(s));sort(all(t),greater<char>());
  if(s<t)std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
}

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

int wari(int j){
    int u;
    if(j/10==0){
        return j%10;
    }else{
        u=j%10;
        int h=wari(j/10);
        return u+h;

    }
    
}

int main(void){
    int a,b,n,sum=0;
    scanf("%d",&n);
    scanf("%d",&a);
    scanf("%d",&b);
    for(int i=0;i<=n;i++){
        int h=wari(i);
        if(a<=h && h<=b){
            sum=sum+i;
        }
    }

    printf("%d\n",sum);


    
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int n,i,j,m;
    double w,sum=0;
    scanf("%d%d",&n,&m);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum=sum+a[i];
    }
    //降順ソート
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if(a[i]<a[j]){
                int temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }
        }
    }
    w=m;
    if(a[m-1]>=sum/(4*w))
    printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 1724
S=input()
if S== 'SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)

Measured memory_bytes: 3060
K = int(input())

if K % 2 == 0:
  ans = -1
elif K % 5 == 0:
  ans = -1
else:
  ans = 1
  s = 7
  while s % K != 0:
    ans += 1
    s = str(s) + '7'
    s = int(s) % K
print(ans)

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

int main() {
  string S;
  cin >> S;
  int ans = 700;
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == 'o')
      ans += 100;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;

int main() {
	string S;
	cin >> S;
	int N = S.size();
	for (int i = 0;i < N;i++) {
		if (S[i] == '?')S[i] = 'D';
	}
	cout << S << endl;
}

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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

struct Trie {
  array<int, 26> value = {};
  array<unique_ptr<Trie>, 26> children;
};

class RollingHash {
 public:
  void Add(char c) {
    const unsigned long long base = 100000007;
    hash_ = hash_ * base + c;
  }
  size_t hash() const { return hash_ ^ (hash_ >> 32); }
  bool operator==(const RollingHash &h) const { return hash_ == h.hash_; }

 private:
  unsigned long long hash_ = 0;
};

namespace std {
template <>
class hash<RollingHash> {
 public:
  size_t operator()(const RollingHash &h) const { return h.hash(); }
};
}  // namespace std

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  rd(int, n);

  V<string> s(n);
  rep(i, n) {
    cin >> s[i];
    reverse(all(s[i]));
  }
  sort(all(s),
       [](const string &a, const string &b) { return a.size() > b.size(); });

  ll ans = 0;
  unordered_map<RollingHash, array<int, 26>> m;
  for (const auto &si : s) {
    vector<bitset<26>> cum(si.size() + 1);
    for (int i = si.size() - 1; i >= 0; --i) {
      cum[i] = cum[i + 1];
      cum[i].set(si[i] - 'a');
    }
    RollingHash h;
    rep(i, si.size() - 1) {
      rep(j, 26) {
        if (cum[i][j]) {
          m[h][j]++;
        }
      }
      h.Add(si[i]);
    }
    ans += m[h][si.back() - 'a'];
  }
  wt(ans);
}


Measured memory_bytes: 156812
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[300010], mp[300010], trakm[300010];
vector <int> v;
int sz;
int ans[300010];
int main(){
    int n;
    while(cin>>n){
        memset(ans, 0, sizeof ans);
        for(int i=0; i<n; ++i){
            scanf("%d",a+i);
            ++mp[a[i]];
        }
        for(int i=0; i<=n; ++i){
            v.push_back(mp[i]);
        }
        sz=v.size();
        sort(v.begin(), v.end());
        trakm[0]=v[0];
        for(int i=1; i<v.size(); ++i){
            trakm[i]=trakm[i-1]+v[i];
        }
        int tmp;
        for(int i=1; i<=n; ++i){
            tmp=lower_bound(v.begin(), v.end(), i)-v.begin();
            ans[sz-tmp+trakm[tmp-1]/i]=i;
        }
        for(int i=n-1; i>=1; --i){
            ans[i]=max(ans[i], ans[i+1]);
        }
        for(int i=1; i<=n; ++i){
            printf("%d\n",ans[i]);
        }
    }
  return 0;
}




Measured memory_bytes: 6896
firstinput = input("")
firstinputsplit = firstinput.split(" ")
H = int(firstinputsplit[0])
N = int(firstinputsplit[1])
kill = 0
if H <= 10000 and N <= 10000:
    while H > 0:
        H = H - N
        kill = kill + 1
    print(kill)
else:
    print(H)


Measured memory_bytes: 2940
#include <stdio.h>

int main(void) {
    int N;
    int ans = 0;
    int max = 0;

    scanf("%d", &N);

    int P[N];
    for (int j=0; j<N; j++) {
        scanf("%d", &P[j]);
        if (max < P[j]) {
            max = P[j];
        }
    }

    for (int i=0; i<N; i++) {
        ans += P[i];
    }
    printf("%d", ans-max+(max/2));
    return 0;
}

Measured memory_bytes: 128
//***Because people who are crazy enough to think that they can change the world are the ones who do it***
//Think different
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

char a[6][6];
ll mark[6][6];
int main(){
	ll h,w,k1,ans=0,tot=0;
	cin>>h>>w>>k1;
	forn(i,h) {
		forn(j,w) {
		cin>>a[i][j];
		if(a[i][j]=='#') tot++;
	}
	}
	
	for(ll i=0;i<pow(2,h);i++){
		for(ll j=0;j<pow(2,w);j++){
			ll c=0;
			for(ll k=0;k<h;k++){
				if((i&(1<<k))!=0){
					for(ll p=0;p<w;p++) if(a[k][p]=='#'){
						mark[k][p]=1;
						c++;
					}
				}
			}
			for(ll k=0;k<w;k++){
				if((j&(1<<k))!=0){
					for(ll p=0;p<h;p++) if(a[p][k]=='#'){
						if(mark[p][k]==1) continue;
						c++;
					}
				}
			}
			if(k1==(tot-c)) ans++;
			forn(p,h) forn(q,w) mark[p][q]=0;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 4092
#include <stdio.h>
#include<string.h>
int main(void){
    long long int n,ans=1;
    scanf("%lld",&n);
    for(int i=1;i<=n;i++){
        ans*=i;
        if(ans>1000000007)ans%=1000000007;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
long long sum(long long n){
    return (n*(n+1)/2);
}
int main(){
    int x;
    cin >>x;
    long long ans =0;
    ans = sum(x) - sum(x/5)*5 - sum(x/3)*3+sum(x/15)*15;
    
    cout <<ans;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
using namespace std;
long double x[20][20], m, n, neko[20][20][20], dp[20][100000];
inline long double solve(int pos, int ret) {
	if (pos == n)return 1.0l;
	if (dp[pos][ret] >= -0.1l)return dp[pos][ret];
	long double maxn = 0.0l;
	for (int i = 0; i < m; i++) {
		if ((ret / (1 << i)) & 1 == 1)continue;
		long double cnt = 0.0;
		for (int j = pos; j <= n; j++) {
			long double w1 = solve(j, ret + (1 << i))*neko[i][pos][j];
			cnt += w1;
		}
		maxn = max(maxn, cnt);
	}
	dp[pos][ret] = maxn;
	return maxn;
}
int main() {
	for (int i = 0; i < 20; i++) { for (int j = 0; j < 100000; j++)dp[i][j] = -1.0l; }
	cin >> m >> n; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++)cin >> x[i][j]; }
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			neko[i][j][j] = 1.0l; long double cnt = 1.0l;
			for (int k = j; k < n; k++) {
				cnt *= x[i][k]; neko[i][j][k + 1] = cnt;
			}
			for (int k = j; k <= n; k++) {
				neko[i][j][k] = neko[i][j][k] - neko[i][j][k + 1];
			}
		}
	}
	printf("%.12Lf\n", solve(0, 0));
	return 0;
}

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


#define ll long long
#define ld long double
#define ull unsigned long long
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long ,long long>
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x,0,sizeof(x))
#define mod 1000000007LL
#define INF 1000000000007


 
//     long long power(long long x, long long y, long long p) 
// { 
//     long long res = 1;      
  
//     x = x % p;  
  
//     while (y > 0) 
//     { 
      
//         if (y & 1) 
//             res = (res*x) % p; 

//         y = y>>1; 
//         x = (x*x) % p; 
//     } 
//     return res; 
// } 
  

// long long modInverse(long long n, long long p) 
// { 
//     return power(n, p-2, p); 
// }  

// long long ncrp(long long n, long long r, long long p) 
// { 
   
//    if (r==0) 
//       return 1; 
  
    
//     long long fac[n+1]; 
//     fac[0] = 1; 
//     // for (long long i=1 ; i<=n; i++) 
//     //     fac[i] = fac[i-1]*i%p; 
  
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }




int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);


   if (fopen("input.txt", "r")) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }


   ll n;
   cin>>n;


   ll i;
   ll a[n],dp[n];
   ll k;
   cin>>k;


   for(i=0;i<n;i++)
   {
       cin>>a[i];
    //    dp[i]=INF;

   }

   dp[0]=0;
//    dp[1]=llabs(a[1]-a[0]);


   ll j;

   for(i=1;i<n;i++)
   {
       ll min=INF;
       for(j=i-1;j>=0;j--)
       {
            if(i-j>k)
            {
                break;
            }

            if(dp[j]+llabs(a[i]-a[j])<min)
            {
                min=dp[j]+llabs(a[i]-a[j]);
            }


       }

       dp[i]=min;
   }

   cout<<dp[n-1]<<endl;
   


 



  

    return 0;
}

Measured memory_bytes: 1792
n = int(input())

arr = list(map(int, input().split()))

odd_num = len([e for e in arr if e % 2 != 0])
four_num = len([e for e in arr if e % 4 == 0])
even_num = n - odd_num - four_num

if even_num:
    print("Yes" if four_num >= odd_num else "No")
else:
    print("Yes" if four_num >= odd_num - 1 else "No")

Measured memory_bytes: 20136
X = int(input())

for a in range(1001):
        if 100 * a == X:
                print(1)
                exit()
        if 100 * a > X:
                continue
        for b in range(0,1001):
                if 100 * a + 101 * b == X:
                        print(1)
                        exit()
                if 100 * a + 101 * b > X:
                        continue
                for c in range(0,1001):
                        if 100 * a + 101 * b + 102 * c == X:
                                print(1)
                                exit()
                        if 100 * a + 101 * b  + 102 * c > X:
                                continue
                        for d in range(0,1001):
                                if 100 * a + 101 * b + 102 * c + 103 * d == X:
                                        print(1)
                                        exit()
                                if 100 * a + 101 * b  + 102 * c + 103 * d > X:
                                        continue
                                for e in range(0,1001):
                                        if 100 * a + 101 * b + 102 * c + 103 * d + 104 * e == X:
                                                print(1)
                                                exit()
                                        if 100 * a + 101 * b  + 102 * c + 103 * d + 104 * e > X:
                                                continue
                                        for f in range(0,1001):
                                                if 100 * a + 101 * b + 102 * c + 103 * d + 104 * e + 105 * f == X:
                                                        print(1)
                                                        exit()
                                                if 100 * a + 101 * b  + 102 * c + 103 * d + 104 * e + 105 * f > X:
                                                        continue
print(0)

Measured memory_bytes: 46812
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,k;
  cin >> a >> b >> k;
  int i,ans;
  for(i=min(a,b);i>=1;i--){
    if(a%i==0 && b%i==0)k--;
    if(k==0){
      ans = i;
      break;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toInt() }

    var max = -101

    max = Math.max(max, a+b)
    max = Math.max(max, a-b)
    max = Math.max(max, a*b)

    println(max)
}

Measured memory_bytes: 37868
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll fac(ll a) { return a > 1 ? fac(a - 1) * a : 1; }
int dp[5001000];
int v[20];
void solve(){
  rep(i,500009)dp[i + 1] = INF;
  int n,m;
  scanf("%d%d",&n,&m);
  rep(i,m)scanf("%d",&v[i]);
  REP(i,1,n + 1){
    rep(j,m){
      if(i - v[j] < 0)continue;
      dp[i] = min(dp[i],dp[i - v[j]] + 1);
    }
  }
  printf("%d\n",dp[n]);
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  solve();
  return 0;
}


Measured memory_bytes: 5172
#include <cstdio>

using namespace std;

int n, a[100005], f[100005];
int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n ; ++i)
        scanf("%d", &a[i]);
    int x = 1, nr = 0;
    while(f[x] == 0){
        f[x] = ++nr;
        x = a[x];
    }
    if(f[2] == 0) printf("-1");
    else printf("%d", f[2] - 1);
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
const int N = 2000;

#define PI acos(-1)
typedef long long ll;
#define INF 0x3f3f3f3f
int mod = 1000000007;
typedef pair<int, int> pii;
char rec[55][55];
int main()
{
	//freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	 // freopen("output.txt", "w", stdout);
	int n, m;
	while (~scanf("%d%d", &n, &m))
	{
		for (int i = 0; i < n; i++)
			scanf("%s", rec[i]);
		bool f = true;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++) if (rec[i][j] == '#')
			{
				int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
				f = false;
				for (int k = 0; k < 4; k++)
				{
					int x = i + dir[k][0];
					int y = j + dir[k][1];
					if (x < 0 || x >= n || y < 0 || y >= m)
						continue;
					if (rec[x][y] == '#')
					{
						f = true;
						break;
					}
				}
				if (!f)
					goto end;
			}
end:
		printf("%s\n", f ? "Yes":"No");
	}
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
	ll cost;
};
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RES(a, n) (a).resize(n)
#define VLCIN(a, n) REP(i,n){cin >> a[i];}
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 2.0 * asin(1.0);
const ll INF = 1L<<60;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = (ll)pow(10,7);
/****** define constant end ********/
/****** define variable start ******/
ll a, b, c, k;
/******* define variable end *******/
int solve() {
	cin >> a >> b >> c >> k;
	REP(i, k){
		if(a >= b){
			b *= 2;
		}else if(b >= c){
			c *= 2;
		}
	}
	if(a < b && b < c){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}
int main() {
	// clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 3636