akhauriyash/Code-Regression huggingface dataset:
total_nights = int(input())
first_nights = int(input())
first_rate = int(input())
extra_rate = int(input())

if total_nights <= first_nights:
  total = total_nights * first_rate
else:
  total = (first_nights * first_rate) + ((total_nights - first_nights) * extra_rate)
print(total)


Measured memory_bytes: 9164
#include <cstdio>
#define min(a, b) (a < b ? a : b)

const int MAX_N = 505, MAX_COLOURS = 35;
int cost[MAX_COLOURS][MAX_COLOURS], frequency[MAX_COLOURS][3];

int all_different(int x, int y, int z)
{
    return (x != y && y != z && z != x);
}

int main()
{
    int n, no_of_colours;
    scanf("%d %d", &n, &no_of_colours);

    for(int i = 1; i <= no_of_colours; i++)
        for(int j = 1; j <= no_of_colours; j++)
            scanf("%d", &cost[i][j]);

    int number;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            scanf("%d", &number), frequency[number][(i + j)%3]++;

    const int oo = 1e9;
    int minimum_cost = oo;

    for(int c0 = 1; c0 <= no_of_colours; c0++)
    {
        for(int c1 = 1; c1 <= no_of_colours; c1++)
        {
            for(int c2 = 1; c2 <= no_of_colours; c2++)
            {
                if(all_different(c0, c1, c2))
                {
                    int cost_here = 0;

                    for(int c = 1; c <= no_of_colours; c++)
                        cost_here += cost[c][c0]*frequency[c][0];

                    for(int c = 1; c <= no_of_colours; c++)
                        cost_here += cost[c][c1]*frequency[c][1];

                    for(int c = 1; c <= no_of_colours; c++)
                        cost_here += cost[c][c2]*frequency[c][2];

                    minimum_cost = min(minimum_cost, cost_here);
                }
            }
        }
    }

    printf(minimum_cost >= oo ? "-1\n" : "%d\n", minimum_cost);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

using ll = long long;

using namespace std;

using P = pair<int, int>;
#define fi first
#define se second

int main() {
    int x, n;
    cin >> x >> n;
    vector<int> p(110);
    iota(p.begin(), p.end(), 0);
    for (int i=0, pi; i<n; i++) {
        cin >> pi;
        p[pi] = -1000;
    }
    sort(p.begin(), p.end(), [&](int a, int b) {
        return P{abs(x - a), a} < P{abs(x-b), b};
    });
    cout << p[0] << '\n';
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<int> vi;
#define pb push_back
#define en "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=e; i>=s; i--)
#define asort(arr,n) sort(arr,arr+n)
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(),greater<int>())
#define ff first
#define ss second
#define aout(a) for (auto u:a) {cout<<u<<" ";}cout<<en;

 
#define out(x1) cout << x1 << en
#define out2(x1,x2) cout << x1 << " " << x2 << en
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << en

 
#define in(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
 
#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << en;
 

int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("oput.txt", "w", stdout);
#endif

ios_base::sync_with_stdio(false);
    cin.tie(NULL);


ll n;
in(n);
ll a[n];
ll b[n];
ll c[n];
for (ll i = 0; i < n; i++)
{in3(a[i],b[i],c[i]);}

ll dp[n][3];
dp[0][0]=max(b[0],c[0]);
dp[0][1]=max(a[0],c[0]);
dp[0][2]=max(a[0],b[0]);

for (ll i = 1; i < n; i++)
{
dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
dp[i][2]=c[i]+max(dp[i-1][1],dp[i-1][0]);
}
out(max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])));














    return 0;
}


Measured memory_bytes: 8280
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAXN = 3e5;
bool to[MAXN], fr[MAXN];

int main() {
	int N, M;
	scanf("%d%d", &N, &M);
	for(int i = 0; i < M; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		if(a == 1 || b == 1) to[a + b - 1] = true;
		if(a == N || b == N) fr[a + b - N] = true;
	}
	for(int i = 2; i < N; i++)
		if(to[i] && fr[i]) {
			puts("POSSIBLE");
			exit(0);
		}
	puts("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 640
t_x, t_y, a_x, a_y = map(int, input().split())

i = 0
while True:
    if i % 2 == 0:
        a_x -= t_y
    else:
        t_x -= a_y
    if t_x <= 0:
        print("No")
        break
    elif a_x <= 0:
        print("Yes")
        break
    i += 1

Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int N, W, M, dp[2000][10005];
vector<int> v, w;

int main() {
    cin >> N >> W;
    REP(i,N){
        int vi, wi, m, b=1;
        cin >> vi >> wi >> m;
        // divide m into 1, 2, 4, 8...
        while(b<=m){
            v.push_back(vi*b);
            w.push_back(wi*b);
            m -= b;
            b *= 2;
        }
        // the rest of m
        if(m>0){
            v.push_back(vi*m);
            w.push_back(wi*m);
        }
    }
    M = v.size();
    REP(i,M){
        REP(j,W+1){
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            if(j >= w[i]) dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]]+v[i]);
        }
    }
    cout << dp[M][W] << endl;
    return 0;
}



Measured memory_bytes: 57836
#include<stdio.h>
int main(void){
      int i,j,a,b;

  while(1){
    scanf("%d %d",&a,&b);
     if(a==0&&b==0) break;
     for(i=0;i<a;i++){
         for(j=0;j<b;j++){
             
             if(j==0 || j==b-1) printf("#");
          else if(i==0||i==a-1) printf("#");  
        else printf(".");
         }
       printf("\n");
       }
   printf("\n");
   }
return 0;
}



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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    vector<int> a;
    int temp;
    REP(i,N){
        cin>>temp;
        a.pb(temp);
    }
    sort(all(a));
    bool color[8]={};
    int ans_min;ans_min=0;
    int ans_max;ans_max=0;
    REP(i,N){
        if(a[i]<400){
            if(!color[0]){
                ans_min++;
                ans_max++;
                color[0]=true;
            }
        }else if(a[i]<800){
            if(!color[1]){
                ans_min++;
                ans_max++;
                color[1]=true;
            }
        }else if(a[i]<1200){
            if(!color[2]){
                ans_min++;
                ans_max++;
                color[2]=true;
            }
        }else if(a[i]<1600){
            if(!color[3]){
                ans_min++;
                ans_max++;
                color[3]=true;
            }
        }else if(a[i]<2000){
            if(!color[4]){
                ans_min++;
                ans_max++;
                color[4]=true;
            }
        }else if(a[i]<2400){
            if(!color[5]){
                ans_min++;
                ans_max++;
                color[5]=true;
            }
        }else if(a[i]<2800){
            if(!color[6]){
                ans_min++;
                ans_max++;
                color[6]=true;
            }
        }else if(a[i]<3200){
            if(!color[7]){
                ans_min++;
                ans_max++;
                color[7]=true;
            }
        }else{
            if(ans_min==0){
                ans_min++;
                ans_max++;
            }else{
                ans_max++;
            }
        }
    }
    cout<<ans_min<<" "<<ans_max<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String ans = S.substring(0,3);
		System.out.println(ans);
	}

}

Measured memory_bytes: 35680
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN (1 << 10)

ll a[MAXN], s[MAXN];
vector<ll> v;
int n, k;

void solve(vector<ll> & v, int pos, ll cur) {
	if (pos < 0) {
		cout << cur << endl;
		return;
	}
	vector<ll> tv;
	ll posmask = (1LL << pos);
	for (int i = 0; i < v.size(); i++) {
		if (v[i] & posmask) {
			tv.push_back(v[i]);
		}
	}
	if (tv.size() >= k) {
		solve(tv, pos - 1, cur | posmask);
	} else {
		solve(v, pos - 1, cur);
	}
}

int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		s[i] += a[i] + s[i - 1];
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j++) {
			v.push_back(s[j] - s[i - 1]);
		}
	}
	solve(v, 41, 0);	
	return 0;
}


Measured memory_bytes: 14320
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define mod 100000007
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}
ll prime[1000000];bool visprime[10000000];
void sieve(){ll k=0;for(ll i=2;i*i<=1000000;i++){for(ll j=i*i;j<=1000000;j+=i){visprime[j]=true;}}for(ll i=2;i<=1000000;i++){if(visprime[i]==false) prime[k++]=i;}}


int main()
{

    int a,b;
    cin>>a>>b;
    int cnt=0;
    int ans=0,temp=1;
    if(b==1) return cout<<0<<endl,0;
    if(a>=b) return cout<<1<<endl,0;
    while(temp<b)
    {



        temp--;
        temp+=a;
        cnt++;
    }
    cout<<cnt<<endl;




}
























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

const int mod = 1e9 + 7;

void add_self(int& a, int b) {
    a += b;
    if(a >= mod) a -= mod;
}

int main() {
    int n;
    cin>>n;
    bool a[n][n];
    for(int i=0; i<n; i++) for(int j=0; j<n; j++) cin>>a[i][j];
    vector<int> dp(1<<n, 0);
    dp[0] = 1;
    for(int mask=0; mask < (1<<n); mask++) {
        int i = __builtin_popcount(mask);
        for(int j=0; j<n; j++)
            if(a[i][j] && !(mask & (1<<j)))
                add_self(dp[mask ^ (1<<j)], dp[mask]);
    }
    cout<< dp.back() <<endl;
    return 0;
}

Measured memory_bytes: 8448
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <climits>
#include <cstdint>
using namespace std;

inline namespace atcoder {
    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;

    constexpr int64_t mpow(int64_t a, int64_t b, int64_t mod = 1000000007) {
        if (b <= 0) return 1; if (b == 1) return a % mod; if (b == 2) return (a * a) % mod;
        return (max(a * (b & 1), (int64_t)1) * mpow(mpow(a, b / 2, mod), 2, mod)) % mod;
    }
    constexpr int64_t mdiv(int64_t a, int64_t b, int64_t mod = 1000000007) {
        return (a * mpow(b, mod - 2, mod)) % mod;
    }
}

int main() {
    int x; cin >> x;
    int m = 1;
    while ((360 * m) % x) ++m;
    cout << (360 * m) / x << endl;
}



Measured memory_bytes: 3588
s = input()
t = input()

def LCS(X,Y):
    XL = len(X)
    YL = len(Y)
    dp = [[0 for j in range(YL+1)] for i in range(XL+1)]
    for i in range(XL):
        for j in range(YL):
            if X[i] == Y[j]:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])
    # 以下復元
    idx = dp[XL][YL]-1
    S = [0]*(idx+1)
    i,j = i+1,j+1
    while i > 0 and j > 0:
        if dp[i][j] == dp[i-1][j]:
            i -= 1
        elif dp[i][j] == dp[i][j-1]:
            j -= 1
        else:
            i,j = i-1,j-1
            S[idx] = X[i]
            idx -= 1
    return S

print(''.join(LCS(s,t)))


Measured memory_bytes: 120156
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

map<int, bool> M;
std::vector<ll> V;
ll NN;
ll ans = 0;

void rec(int i, int v) {
  if (i == V.size())
    return;

  rec(i + 1, v);

  // M[v + V[i]] = true;
  if ((v + V[i]) % 10 != 0 && ans < v + V[i]) {
    ans = v + V[i];
  }

  rec(i + 1, v + V[i]);
}

void solve(long long N, vector<long long> s) {
  V = s;
  NN = N;

  // rec(0, 0);

  ll aans = 0;
  REP(i, N) aans += s[i];
  if (aans % 10 != 0) {
    cout << aans << endl;
    return;
  }

  sort(ALL(s));
  REP(i, N) {
    if (s[i] % 10 != 0) {
      aans -= s[i];
      cout << aans << endl;
      return;
    }
  }

  cout << "0" << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> s(N - 1 + 1);
  for (int i = 0; i <= N - 1; i++) {
    cin >> s[i];
  }
  solve(N, s);
  return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int main() {
  ULL n, k;
  cin >> n >> k;
  map<int, ULL> mp;
  int a, b;
  REP(i, n) {
    cin >> a >> b;
    mp[a] += b;
  }
  ULL sum = 0;
  for(auto m : mp) {
    sum += m.second;
    if((ULL)k <= sum) {
      cout << m.first << endl;
      return 0;
    }
  }

  return 0;
}


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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

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

    ll sum = 0;
    reps(a, 1, K+1) {
        reps(b, 1, K+1) {
            reps(c, 1, K+1) {
                sum += std::__gcd(std::__gcd(a, b), c);
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define N 100009
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
int a[N];


void init(LL &ans1, LL &sum1, LL &ans2, LL &sum2)
{
    if(a[1] == 0)
    {
        ans1 = ans2 = 1;
        sum1 = 1; sum2 = -1;
        return ;
    }
    if(a[1] > 0)
    {
        ans1 = 0; sum1 = a[1];
        ans2 = a[1]+1; sum2 = -1;
        return ;
    }
    ans1 = -a[1]+1; sum1 = 1;
    ans2 = 0; sum2 = a[1];
}

void solve(int n, LL &ans, LL &sum)
{
    for(int i = 2; i <= n; i++)
    {
        if(sum < 0)
        {
            if(sum + a[i] <= 0)
            {
                ans += abs(a[i]+sum)+1;
                sum = 1;
            }
            else sum += a[i];
        }
        else
        {
            if(sum + a[i] >= 0)
            {
                ans += a[i]+sum+1;
                sum = -1;
            }
            else sum += a[i];
        }
    }
    if(sum == 0) ans++;
}


int main()
{
    int n;
    LL ans1, ans2, sum1, sum2;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    init(ans1, sum1, ans2, sum2);
    solve(n, ans1, sum1);
    solve(n, ans2, sum2);
    cout << min(ans1, ans2) << endl;
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(void){
    int a,b,big,small,i,j,tmp,yaku,bai;

    while(scanf("%d %d",&a,&b)!=EOF){

		if(a<b){
			big=a;
			small=b;
		}
		else{
			big=a;
			small=b;
		}

		i=big;
		j=small;

		while(1){
            if(i%j!=0){
				tmp=i;
				i=j;
				j=tmp%j;
			}
			else{
				yaku=j;
				break;
			}
		}

		bai=(a/yaku)*(b/yaku)*yaku;

		printf("%d %d\n",yaku,bai);

    }

    return 0;
}

Measured memory_bytes: 596
#include<stdio.h>

int main(){
	int N;
	int n1;
	int M;
	int m1;
	int k;
	scanf("%d %d %d %d %d",&N ,&n1,&M,&m1,&k );
	int waktu = ((M*60+m1)-(N*60+n1))-k;
	printf ("%d",waktu);
	
	
	
	return 0;
}

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

int main() {
  int H,W,A;
  cin>>H>>W;
  int d[10][10];
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      cin>>d[i][j];
    }
  }
    for (int k = 0; k < 10; k++){       // 経由する頂点
    for (int i = 0; i < 10; i++) {    // 始点
      for (int j = 0; j < 10; j++) {  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  int total=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W; j++){
      cin>>A;
      if(A>=0) total+=d[A][1];
    }
  }
  cout<< total;
      
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;

inline void normal(ll &a) {if(a>=MOD)a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) {normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) {normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) {normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll findProductSum(ll A[], ll n)
{
   ll array_sum = 0;
    for (ll i = 0; i < n; i++)
        array_sum = modAdd((array_sum) , A[i]);

    ll array_sum_square = modMul((array_sum) , (array_sum));

    ll individual_square_sum = 0;
    for (ll i = 0; i < n; i++)
        individual_square_sum = modAdd((individual_square_sum) , modMul((A[i]),(A[i])));

    return (modDiv(modSub(array_sum_square , individual_square_sum), 2));
}

int main()
{
    ll n;  cin >> n;
    ll A[n + 2] ;

    for(ll i = 0; i < n ; i++) cin >> A[i];
    ll ans = findProductSum(A, n);

    cout  << ans % MOD << endl;

    return 0;
}


Measured memory_bytes: 5128
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	for i, _ := range s {
		fmt.Scan(&s[i])
	}

	ma := make(map[string]int)
	for _, v := range s {
		ma[v]++
	}

	max := 0
	for _, v := range ma {
		max = Max(v, max)
	}

	var ans []string
	for i, v := range ma {
		if v == max {
			ans = append(ans, i)
		}
	}
	sort.Strings(ans)
	for _, v := range ans {
		fmt.Println(v)
	}
}

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

Measured memory_bytes: 34944
#include<stdio.h>
int main(){
double x;
while(scanf("%lf",&x)!=EOF){
if(x<=48.00)
printf("light fly\n");
else if(x<=51.00)
printf("fly\n");
else if(x<=54.00)
printf("bantam\n");
else if(x<=57.00)
printf("feather\n");
else if(x<=60.00)
printf("light\n");
else if(x<=64.00)
printf("light welter\n");
else if(x<=69.00)
printf("welter\n");
else if(x<=75.00)
printf("light middle\n");
else if(x<=81.00)
printf("middle\n");
else if(x<=91.00)
printf("light heavy\n");
else
printf("heavy\n");
}
return 0;
}

Measured memory_bytes: 0
N = int(input())
S = list(input())

R = []
G = []
B = []

R_append = R.append
G_append = G.append
B_append = B.append

for i in range(N):
    if S[i] == 'R':
        R_append(i)
    elif S[i] == 'G':
        G_append(i)
    else:
        B_append(i)

ans = len(R) * len(G) * len(B)

for r in R:
    for g in G:
        tmp = abs(r - g)
        small = min(r, g)
        large = max(r, g)
        if small >= tmp:
            if S[small - tmp] == 'B':
                ans -= 1
        if large + tmp < N:
            if S[large + tmp] == 'B':
                ans -= 1
        if tmp % 2 == 0:
            if S[small + tmp // 2] == 'B':
                ans -= 1

print (ans)


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

typedef long long int llint;

int main(){
	llint X,Y;
	cin >> X >> Y;
	llint A=X;
	int cnt=0;

	while(A<=Y){
		cnt++;
		A*=2;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
//  cout.precision(15); cout << fixed;

int G[55][55];

int main() {
  int h, w; cin >> h >> w;
  vector<string> S(h);
  loop(i,0,h) cin >> S[i];
  loop(i,0,h) {
    loop(j,0,w) {
      G[i][j] = S[i][j] == '#' ? -1 : 0;
    }
  }
  loop(y,0,h) {
    loop(x,0,w) {
      if (G[y][x] == -1) continue;
      loop(dx,-1,2) loop(dy,-1,2) {
        if (dx == 0 and dy == 0) continue;
        int x1 = x+dx, y1 = y+dy;
        if (x1<0 or x1 >= w or y1 < 0 or y1 >= h) continue;
        G[y][x] += G[y1][x1] == -1;
      }
    }
  }
  loop(y,0,h) {
    loop(x,0,w) {
      if (G[y][x] == -1) cout << '#';
      else cout << G[y][x];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b);
#define chmin(a, b) (a)=min(a, b);
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k;
  
  ll N;
  cin >> N;
  vector<ll> v;
  for(i=0; i<N; i++) {
    ll t; cin >> t;
    if(i==0 || v[(ll)v.size()-1]!=t) v.push_back(t);
  }
  
  if(N==1) {pt(1); return 0;}
  
  ll ans=0;
  N=v.size();
  for(i=0; i<N; i++) {
    if(v[i]<v[i+1]) {
      while(i<N-1 && v[i]<v[i+1]) i++;
      ans++;
    }else {
      while(i<N-1 && v[i]>v[i+1]) i++;
      ans++;
    }
  }
  
  pt(ans);
  
}





Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;++i)
using namespace std;
int main(){
int u,r,q,a,b,c;
while(cin>>r,r){cin>>r>>r;
vector<int>t(r),m(r),s(r);
r(i,r)cin>>t[i]>>m[i]>>m[i]>>s[i];cin>>q;
r(i,q){cin>>a>>b>>c;
int an=0,cn=0,p=a;
r(i,t.size()){u=min(t[i],b);
if(cn)an+=max(u-p,0);
if(m[i]==c){if(s[i])cn++;else cn--;}
p=max(p,u);}
cout<<an<<endl;}}}

Measured memory_bytes: 3052
N = int(input())

import math
import itertools

x = []
y = []
for i in range(N):
    x_, y_ = map(int, input().split())
    x.append(x_)
    y.append(y_)

per = list(itertools.permutations(list(range(N)), N))

sum = 0
for i in per:
    for j in range(len(list(i))-1):
        x_ = x[i[j]] - x[i[j+1]]
        y_ = y[i[j]] - y[i[j+1]]
        sum += math.sqrt(x_**2 + y_**2)

print(sum / len(per))

Measured memory_bytes: 8052
//Source:
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define un unsigned
#define vi vector<int>
#define pb push_back

using namespace std;
//******************************************************************************
int main() {

  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(NULL);

  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin); //Read external file
  //freopen("output.txt", "w", stdout); //Write to external file
  #endif

  ll n;
  cin>>n;
  unsigned long long a{1},x{1};
  vector<unsigned long long> nums(n);
  unsigned long long lim{1000000000000000000};
  for(int i=0;i<n;i++)
    cin>>nums[i];

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

  if(nums[0]==0){
    cout << 0;
    return 0;
  }

  if(nums[nums.size()-1]>lim){
    cout << -1;
    return 0;
  }

  a=1;
  for(int i=0;i<n;i++){
    x=a*nums[i];
    if (a != 0 && x / a != nums[i]) {
        // overflow handling
        cout << -1;
        return 0;
    }
    if(x>lim){
      cout << -1;
      return 0;
    }
    a=x;
  }


  cout << a;

  return 0;
}
//******************************************************************************
//******************************************************************************


Measured memory_bytes: 3992
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <queue>

using namespace std;

int main()
{
        // 整数の入力
    long long N,H,i,maxNormalDamage,normalDamage,throwDamage,totalAttacks;
    cin >> N >> H;
    maxNormalDamage = -1;
    priority_queue<long long> ordredThrowDamages;
    for (i=0;i<N;i++){
        cin >> normalDamage >> throwDamage;
        if (normalDamage > maxNormalDamage){
            maxNormalDamage = normalDamage;
        }
        ordredThrowDamages.push(throwDamage);
    }

    totalAttacks = 0;
    while(H > 0 &&  !ordredThrowDamages.empty() && ordredThrowDamages.top() > maxNormalDamage){
        H -=  ordredThrowDamages.top();
        ordredThrowDamages.pop();
        totalAttacks++;
    }

    if (H > 0 ){
        totalAttacks += H/maxNormalDamage;
        if (H % maxNormalDamage != 0){
            totalAttacks++;
        }
    }
    cout << totalAttacks << endl;

    return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int a = sc.nextInt();
    if(x < a){
      System.out.println("0");
    }else{
      System.out.println("10");
    }
  }
}

Measured memory_bytes: 23636
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<cmath>
#include<stack>
#include<cstring>
#include<cstdio>
using namespace std;
const int maxn = 100 + 8;

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int n,m,xx,yy;
char graph[maxn][maxn];
bool vis[maxn][maxn];
int ans;

void dfs1(int x,int y)
{

    graph[x][y] = '!';
    for(int i = 0; i < 4; ++i)
    {
        xx = x + dx[i];
        yy = y + dy[i];
        if(xx >= 0 && xx < n && yy >= 0 && yy < m && graph[xx][yy] == '#' && !vis[xx][yy])
        {
           // vis[xx][yy] = true;
            dfs1(xx,yy);
           // vis[xx][yy] = false;
        }
    }
}
void dfs2(int x,int y)
{

    graph[x][y] = '!';
    for(int i = 0; i < 4; ++i)
    {
        xx = x + dx[i];
        yy = y + dy[i];
        if(xx >= 0 && xx < n && yy >= 0 && yy < m && graph[xx][yy] == '*' && !vis[xx][yy])
        {
           // vis[xx][yy] = true;
            dfs2(xx,yy);
           // vis[xx][yy] = false;
        }
    }
}
void dfs3(int x,int y)
{

    graph[x][y] = '!';
    for(int i = 0; i < 4; ++i)
    {
        xx = x + dx[i];
        yy = y + dy[i];
        if(xx >= 0 && xx < n && yy >= 0 && yy < m && graph[xx][yy] == '@' && !vis[xx][yy])
        {
            //vis[xx][yy] = true;
            dfs3(xx,yy);
            //vis[xx][yy] = false;
        }
    }
}

int main()
{
    while(scanf("%d %d", &n, &m) && n + m)
    {
        memset(vis, false, sizeof vis);
        for(int i = 0 ;i < n; ++i) cin >> graph[i];
        ans = 0;
        for(int i = 0; i < n; ++i)
        {
            for(int j = 0; j < m; ++j)
            {
                if(graph[i][j] == '#') {
                    dfs1(i,j);
                    vis[i][j] = true;
                    ++ans;
                } else if(graph[i][j] == '*') {
                   dfs2(i,j);
                    ++ans;
                } else if(graph[i][j] == '@') {
                    dfs3(i,j);
                    ++ans;
                }
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}
/*
10 10
####*****@
@#@@@@#*#*
@##***@@@*
#****#*@**
##@*#@@*##
*@@@@*@@@#
***#@*@##*
*@@@*@@##@
*@*#*@##**
@****#@@#@
0 0
*/

Measured memory_bytes: 3500
(defn input []
  (do (read-line)
      (->> (clojure.string/split (read-line) #"\s")
        (map #(Integer/parseInt %)))))



(defn MaximamDifference [As]
  (apply max
    (for [x As
          y As
          :let [d (- x y)]]
      d)))

(-> (input)
  MaximamDifference
  println)

Measured memory_bytes: 66820
IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 INP PIC X(11000).
       01 A-REC.
      	02 A-DATA OCCURS 100.
      	 03 A PIC 999.
       01 B PIC 999.
       01 C PIC 999.
       01 D PIC 999.
       01 ALICE PIC 999999.
       01 BOB PIC 999999.
       01 REN PIC 9999999999.
       01 RE PIC ZZZZZZZZZZ9.
       01 temp1 PIC 9999999.
       01 temp2 PIC 9999999.
       01 temp3 PIC 9999999.
       01 NOW PIC 9999999.
       01 N PIC 999.
       01 MAX PIC 999.
       PROCEDURE DIVISION.
       MAIN.
       	ACCEPT B.
      	ACCEPT INP.
      	ADD 1 TO B.
      	MOVE 1 TO NOW.
      	PERFORM VARYING C FROM 1 BY 1 UNTIL C = B
      		PERFORM VARYING temp1 FROM NOW BY 1 
      				UNTIL INP(temp1:1) = SPACE
			END-PERFORM
      		COMPUTE N = temp1 - NOW
      		MOVE INP(NOW:N) TO A(C)
      		COMPUTE NOW = NOW + N + 1
      	END-PERFORM.
      	PERFORM VARYING C FROM 1 BY 1 UNTIL C = B
      		MOVE C TO MAX
      		PERFORM VARYING D FROM C BY 1 UNTIL D = B
      			IF A(D) > A(MAX) THEN
      				MOVE D TO MAX
      			END-IF
      		END-PERFORM
      		COMPUTE temp1 = A(C)
      		COMPUTE A(C) = A(MAX)
      		COMPUTE A(MAX) = temp1
      	END-PERFORM.
      	MOVE 0 TO ALICE.
      	MOVE 0 TO BOB.
      	PERFORM VARYING C FROM 1 BY 1 UNTIL C >= B
      		COMPUTE ALICE = ALICE + A(C)
      		ADD 1 TO C
      		IF C < B THEN
      			COMPUTE BOB = BOB + A(C)
      		END-IF
      	END-PERFORM.
		COMPUTE REN = ALICE - BOB.
      	MOVE REN TO RE.
      	DISPLAY RE.
      	STOP RUN.



Measured memory_bytes: 384
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
DP = [i for i in range(n + 1)]
for cost in c:
	for i in range(cost, n + 1):
		DP[i] = min(DP[i], DP[i - cost] + 1)
print(DP[n])



Measured memory_bytes: 7644
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = new Date();
  Main();
  var end = new Date() - start;
  
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var r = nextInt();
	myout(r*r*3);
}


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

int c_moon(long long n);

signed main()
{
    long long n;
    int ans ;
    
    cin >> n;
    ans = c_moon(n);
    
    cout << ans << endl;
    return(0);
}

int c_moon(long long n)
{
    int ans = 0, make[10000] , step = 0 , sum;
    long long tem;
    bool issosu;
    make[0] = 0;
    
    for(int i=1 ;i<10000 ;i++ ){
        make[i] = i + make[i-1];
    }
    
    tem = n;
    
    for(long long i=2 ;i<=1000000 && tem > 1;i++ ){
        if(tem%i == 0){
            sum = 0 , step = 0;
            while(tem%i == 0){
                tem = tem / i;
                sum++;
                
                if(sum >= make[step+1]){
                    step++;
                }
            }
            ans += step;
        }
    }
    
    if(tem > 1){
        ans++;
    }
    return(ans);
}

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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair

int N, M, Q, a[50], b[50], c[50], d[50];

int A[11];
int res = 0;

void rec(int k) {
    if (k == N+1) {
        int pt = 0;
        REP(i, Q) {
            if (A[b[i]] - A[a[i]] == c[i]) pt += d[i];
        }
        res = max(res, pt);
        return;
    }
    FOR(i, A[k-1], M) {
        A[k] = i;
        rec(k+1);
    }
    return;
}

int main() {
    cin >> N >> M >> Q;
    REP(i, Q) cin >> a[i] >> b[i] >> c[i] >> d[i];

    A[0] = 1;
    rec(1);
    PRINT(res);
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long int lli;
using namespace std;
// #define int long long int

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

inline int euclid(int a, int b) {
    if (a > b) swap(a, b);
    int r = a % b;
    while (r > 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main() {
    lli X, Y, Z, K;
    cin >> X >> Y >> Z >> K;

    vector<lli> A, B, C;
    for (int i = 0; i < X; i++) {
        lli input;
        cin >> input;
        A.push_back(input);
    }
    sort(A.begin(), A.end(), greater<lli>());
    for (int i = 0; i < Y; i++) {
        lli input;
        cin >> input;
        B.push_back(input);
    }
    sort(B.begin(), B.end(), greater<lli>());
    for (int i = 0; i < Z; i++) {
        lli input;
        cin >> input;
        C.push_back(input);
    }
    sort(C.begin(), C.end(), greater<lli>());

    vector<lli> ans;
    for (int i = 0; i < X; i++) {
        for (int j = 0; j < Y; j++) {
            for (int k = 0; k < Z; k++) {
                if ((i + 1) * (j + 1) * (k + 1) <= K) ans.push_back(A[i] + B[j] + C[k]);
                else break;
            }
        }
    }
    sort(ans.begin(), ans.end(), greater<lli>());

    for (int i = 0; i < K; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 1412
#include<stdio.h>
    int main(){
    int a[100001];
    int N,i,j,x,y;
    scanf("%d",&N);
    x=0;
    y=0;
    for(i=0;i<N;i++){
    scanf("%d",&a[i]);
    if(a[i]%4==0) y+=1;
    else if(a[i]%2==0) x+=1;
    }
    for(i=0;i<N/2;i++){
      if(x>=(N-2*i)&&y>=i){
      printf("Yes\n");
      return 0;
      }
    }
    if(y>=N/2){
    printf("Yes\n");
    return 0;
    }
    printf("No\n");
    return 0;
    }

Measured memory_bytes: 512
#include <cstdio>

int main(){
    int i, n, k, p;
    scanf("%d %d",&n,&k);
    int w[n];
    int tmp1 = 0;
    int tmp2 = 0;
    int sum = 0;
    for(i=0;i<n;i++){
        scanf("%d",w+i);
        sum += w[i];
        if(w[i]>tmp1)tmp1=w[i];
    }
    tmp2 = sum / k;
    if(sum%k)tmp2++;
    if(tmp1>tmp2)p=tmp1;
    else p = tmp2;
    int p_, k_;
    for(;;p++){
        p_ = 0;
        k_ = 0;
        for(i=0;i<n;i++){
            if(w[i]>p)break;
            else if(p_+w[i]<=p)p_+=w[i];
            else{
                p_ = w[i];
                k_++;
            }
            if(k_>=k)break;
        }
        if(i==n)break;
    }
    printf("%d\n",p);
    return 0;
}



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

ll gcd(ll a, ll b){
    if(a < b) return gcd(b, a);
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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

int main(){
    ll n, X;
    cin >> n >> X;
    vector<ll> x(n+1);
    rep(i, 0, n) cin >> x[i];
    x[n] = X;
    sort(x.begin(),x.end());
    ll g = x[1] - x[0];
    rep(i, 1, n) g = gcd(g, x[i+1] - x[i]);
    cout << g << endl;
    return 0;
}

Measured memory_bytes: 1024
nums = list(map(int, input().split()))
n = nums[0]
m = nums[1]

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

sum = 0
for v in a:
  sum += v

result = []
for s in a:
    if s >= sum * (1 / (4 * m)):
        result.append(s)
if len(result) >= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))
T = defaultdict(int)
total = 0
for i in range(N):
    total += A[i]
    total %= M
    T[total] += 1
ans = T[0]
for v in T.values():
    ans += v*(v-1)//2
print(ans)

Measured memory_bytes: 93200
#include<bits/stdc++.h>
using namespace std;
	string a,b;
int cek(int now){
	int x;
	int cnt=0;
	int ans=0;
	for(x=now;x<now+b.size();x++){
		if(a[x]!=b[cnt]){
			ans++;
		}
		cnt++;
	}
	return ans;
}
int main(){

	cin>>a>>b;
	int x;
	int ans=999999999;
	for(x=0;x<=a.size()-b.size();x++){
		ans=min(ans,cek(x));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

class node{
    public:
    ll R, A, W, T;
    bool operator < (const node &n)const{
        return (-(R + T) < -(n.R + n.T));
    }
};

ll dp[5000][2];

void update(){
    rrep1(i, 4500){
        chmax(dp[i][0], dp[i][1]);
        chmax(dp[i][0], dp[i + 1][0]);
        dp[i][1] = -INF;
    }
}

int main(){

    ll N;
    cin >> N;
    vector<node>v(N);
    rep(i, N){
        cin >> v[i].R >> v[i].A >> v[i].W >> v[i].T;
    }
    sort(v.begin(), v.end());
    update();
    rep(i, N){
        ll R = v[i].R, A = v[i].A, W = v[i].W, T = v[i].T;
        for(ll from = R + T; from > 1; from--){
            ll to = from - R;
            if(to < 1)break;
            chmax(dp[to][1], dp[from][0] + A);
            chmax(dp[to][1], dp[from][1] + W);
        }
        update();
    }
    cout << dp[1][0] << endl;

    return 0;
}


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

using namespace std;

const int MAX = 333;
int n;
long long a[MAX][MAX];

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        const int aa = a[i][k] + a[k][j];
        if (a[i][j] > aa) {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }

  long long sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      bool con = true;
      for (int k = 0; k < n; k++) {
        if (i == k || j == k) {
          continue;
        }
        if (a[i][j] == a[i][k] + a[k][j]) {
          con = false;
          break;
        }
      }
      if (con) {
        sum += a[i][j];
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1024
N,C,K = map(int,input().split())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
cur = T[0]
bus = 0
limit = 0
for i in range(N):
    if i != N-1:
        if limit <= C-1:
            if T[i] <= cur+K:
                limit += 1
            else:
                bus += 1
                limit = 1
                cur = T[i]
        else:
            bus += 1
            limit = 1
            cur = T[i]
    else:
        if limit <= C-1:
            if T[i] <= cur+K:
                bus += 1
            else:
                bus += 2
        else:
            bus += 2
print(bus)

Measured memory_bytes: 7384
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

int bin(vector<int> &a, int target){
    int l = 0, r = sz(a)-1;

    while (r >= l){
        int m = (l+r)/2;
        if (a[m] == target) return m;
        if (a[m] > target) r = m-1;
        else l = m+1;
    }
    return -1;
}

void solve(){
    int n;
    cin >> n;
    for (int i = 1; i < 10; i++){
        if (n % i == 0 && n/i < 10){
            cout << "Yes\n";
            return;
        }
    }
    cout << "No\n";
}

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

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3620
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  ll A, B1, B2;

  scanf("%lld%lld.%lld", &A, &B1, &B2);

  ll ans = A * B1 + A * B2 / 100;

  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 3816