akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "D:\C++\test_lib_projects\testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>

bool debug=true;
/*
   Write In New Computer
    By XiaoGeNintendo
	     gwq2017
	Type:
*/

ll n,a,b,k;
ll c[300005]; //C(n,x)

const ll mod=998244353l;


ll mpow(ll a,ll b,ll mod){
	if(b==0) return 1;
	ll ans=mpow(a,b/2,mod);
	if(b%2==1){
		return ans*ans%mod*a%mod;
	}else{
		return ans*ans%mod;
	}
}

ll inv(ll a,ll mod){
	return mpow(a,mod-2,mod);
}

int main(int argc,char* argv[]){
	//scanf("%d%d%d%d",&n,&a,&b,&k);
	cin>>n>>a>>b>>k;
	c[0]=1;
	for(ll i=1,j=n; i<=n; i++,j--)  {
		ll ooo=j*inv(i,mod)%mod;
		c[i]=c[i-1]*ooo%mod; 
	}
         
	
	
	
//	for(int i=0;i<=n;i++){
//		cout<<c[i]<<" ";
//	}
//	for(int i=0;i<=n;i++){
//		cout<<"C"<<i<<"="<<c[i]<<endl;
//	}
	
	ll ans=0;
	for(int i=0;i<=n;i++){
		ll acost=a*i;
		if(acost>k) break;
		//cout<<i<<" acost="<<acost<<"left="<<k-acost<<" mod b="<<(k-acost)%b<<endl;
		if((k-acost)%b==0){
			ll bTime=(k-acost)/b;
			if(bTime>n) continue;
			//cout<<"OK:"<<i<<" "<<bTime<<" --> "<<c[i]*c[bTime]<<endl;
			ans+=c[i]*c[bTime];
			ans%=mod;
		}
	}
	
	cout<<ans;
	return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

int main()
{
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    int i,j,ans=0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&j);
        if(j<a||j>=b)ans++;
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		long x= scanner.nextLong();
		long y=scanner.nextLong();
		
		long cnt=0;
		long tar=x;
		while(tar<=y) {
			cnt++;
			tar*=2;
		}
		
		System.out.println(cnt);
	}
}


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

int main(){
  int n,m,c,i,j,cur,ans=0;
  cin >> n >> m >> c;
  vector<int> a(m),b(m);
  for(i=0; i<m; i++){
    cin >> b[i];
  }
  for(j=0; j<n; j++){
    cur=c;
    for(i=0; i<m; i++){
      cin >> a[i];
    }
    for(i=0; i<m; i++){
      cur+=a[i]*b[i];
    }
    if(cur>0){
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define REPS(i, n) for (int i = 1; i <= (int)(n); i++)
#define RREPS(i, n) for (int i = (int)(n); i > 0; i--)
#define mp make_pair
#define pb(a) push_back(a)
typedef long long ll;
int main() {
  string s;
  int K;
  cin >> s >> K;
  set<string> v;
  REPS(i, K) {
    REP(j, (int)s.length() - i + 1) v.insert(s.substr(j, i));
  }
  auto itr = v.begin();
  REP(i,K-1) itr++;
  cout << *itr << endl;
  return 0;
}


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

int n, md = 1e9 + 7;
ll k, x[200];

struct CMP { bool operator ()(const vector<ll> &a, const vector<ll> &b) { f(i, 1, a.size()) { ll x = a[i] - a[i - 1], y = b[i] - b[i - 1]; if (x != y)return x < y; } return false; } };
map<vector<ll>, vector<pair<ll, ll> >, CMP> mp;

inline void ad(int &x, int y) { if ((x += y)>= md)x -= md; }
inline int bc(ll x) { int an = 0; while (x)an += x & 1, x >>= 1; return an; }

int main(){
	scanf("%d%lld", &n, &k);
	f(i, 0, n)scanf("%lld", x + i);
	sort(x, x + n);
	f(i, 0, min(k + 1, 61ll)){
		ll msk = (1ll << i) - 1;
		vector<ll> in(1, -1);
		f(j, 0, n)in.push_back(x[j] & msk);
		sort(in.begin(), in.end());
		in.resize(unique(in.begin(), in.end()) - in.begin());
		f(j, 1, in.size()){
			ll p, l = in[j - 1] + 1, r = in[j];
			int d;
			for (d = 60; d >= 0; --d)if (l >> d != r >> d)break;
			if ((l & (1ll << d + 1) - 1) == 0)p = l;
			else p = r >> d << d;
			ll kf = k - bc(p) - i;
			if (kf < 0)continue;
			vector<ll> v(n);
			f(w, 0, n)v[w] = x[w] - p >> i;
			pair<ll, ll> ds(max(0ll, v[0] - kf), v[0]);
			if (v[0] < 0)continue;
			mp[v].push_back(ds);
		}
	}
	int an = 0;
	for (map<vector<ll>, vector<pair<ll, ll> >, CMP>::iterator it = mp.begin(); it != mp.end(); ++it){
		ll l = -1;
		vector<pair<ll, ll> > &v = it->second;
		sort(v.begin(), v.end());
		f(i, 0, v.size())ad(an, max(0ll, v[i].second - max(v[i].first - 1, l)) % md), l = max(l, v[i].second);
	}
	printf("%d\n", an);
}

Measured memory_bytes: 16512
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = I()
mod = 10**9+7

kaijou = [1]
for i in range(1,S):
    kaijou.append((kaijou[-1]*i) % mod)

inv = [1]
for i in range(1,S):
    inv.append(pow(kaijou[i],mod-2,mod))


def nCr(n,r):
    if n < r:
        return 0
    return (kaijou[n]*inv[r]*inv[n-r]) % mod


ans = 0
for i in range(1,S//3+1):
    if S-3*i >= 0:
        ans += nCr(S-1-2*i,i-1)
        ans %= mod

print(ans)


Measured memory_bytes: 67752
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>     // pow
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

int gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
// cout << fixed << setprecision(10);
// vector<vector<int>> vec(H, vector<int>(W))    // int H*W
// int binary_search(int key) {
//     int ng = -1;
//     int ok = (int)a.size();
//     while(abs(ok - ng) > 1) {
//         int mid = (ok + ng) / 2;
//         if(isOK(mid, key))
//             ok = mid;
//         else
//             ng = mid;
//     }
//     return ok;
// }
int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int> pq;
    for(size_t i = 0; i < N; i++) {
        int a;
        cin >> a;
        pq.push(a);
    }
    for(size_t i = 0; i < M; i++) {
        int x = pq.top();
        pq.pop();
        pq.push(x / 2);
    }
    long long ans = 0;
    while(!pq.empty()) {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1020
#include<stdio.h>

int main(void){
  
  int h[100],w[100],i,j,k,l;
  
  for(i=0;;i++){
    
    scanf("%d %d",&h[i],&w[i]);    

    if(h[i]==0&&w[i]==0)break;
    
  }
  
  for(l=0;l<i;l++){
    
    for(j=0;j<h[l];j++){
      
      for(k=0;k<w[l];k++){
	
	printf("#");
	
      }
    
      printf("\n");  
    
    }

    printf("\n");

  }
  
  return 0;  
   
}

Measured memory_bytes: 1000
#include <stdio.h>

int main(void){
    double D=0,T=0, S=0;

    scanf("%lf %lf %lf", &D, &T, &S);

    if((int)(D / T + 0.9) <= S){
        printf("Yes");
    } else{
        printf("No");
    }

    return 0;

}

Measured memory_bytes: 1752
use std::io::Read;
use std::cmp::max;

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

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let w_limit: usize = iterator.next().unwrap().parse().unwrap();
    let mut w: Vec<usize> = Vec::new();
    let mut v: Vec<usize> = Vec::new();
    for _ in 0..n {
        w.push(iterator.next().unwrap().parse().unwrap());
        v.push(iterator.next().unwrap().parse().unwrap());
    }

    let mut dp: Vec<Vec<usize>> = vec![vec![0; w_limit + 1]; n + 1];
    for i in 1..(n + 1) {
        for j in 1..(w_limit + 1) {
            dp[i][j] = dp[i - 1][j];
            if j >= w[i - 1] {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
            }
        }
    }
    return dp[n][w_limit].to_string();
}


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

//#include <unordered_map>

//#include <iostream>//POJ
//#include <vector>
//#include <string>
//#include <iomanip>
//#include <math.h>
//#include <algorithm>
//#include <cstring>
using namespace std;
#define setc cin.tie(0);ios::sync_with_stdio(0)
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define repir(i,a,b) for(int i=(a)-1, i##_first=(b); i>=i##_first; --i)
#define repr(i,n) repir(i,n,0)
#define repir_(i,a,b) for(int i=(a), i##_first=(b); i>=i##_first; --i)
#define repr_(i,n) repir_(i,n,0)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
//template<typename T> T vpop(vector<T> *v) {
//	T res = v->back();
//	v->pop_back();
//	return res;
//}
//char vpop(string *v) {
//	char res = v->back();
//	v->pop_back();
//	return res;
//}
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define contain(q) !q.empty()
#define cont(q) !q.empty()
//#define qpop(q, a, b) a=q.back().first;b=q.back().second;q.pop()
//#define pqpop(p, a, b) a=q.top().first;b=q.top().second;q.pop()
#define el "\n"
#define sp " "
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#define wildcard(T) numeric_limits<T>::min()

#define pb push_back
#define pq priority_queue
#define np next_permutation

#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;
typedef vector<lint> lvec;
typedef vector<vector<int>> ivvec;
typedef pair<int, int> P;

const int
dx8[8] = { 0,1,1,1,0,-1,-1,-1 },
dy8[8] = { 1,1,0,-1,-1,-1,0,1 },
dx4[4] = { 0,1,0,-1 },
dy4[4] = { 1,0,-1,0 };

template<class T>inline bool maxi(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

int main(){
	setc;

	lint n,k;cin>>n>>k;
	ivec a(n);
	rep(i, n)cin>>a[i];

	int ans=inf;
	rep(i, n-k+1){
		mini(ans, min(a[i+k-1]-a[i]+abs(a[i+k-1]), a[i+k-1]-a[i]+abs(a[i])));
	}
	co(ans);
	gc();
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
#define maxn 1005
#define LL long long
#define mod 1000000007

using namespace std;

char s[15];

int main()
{
    scanf("%s",s);
    if (s[2]==s[3] && s[4]==s[5]) printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using ull = unsigned long long;

int main(int argc, char* argv[]) {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  /* */
  char c;
  cin >> c;
  switch (c) {
    case 'a':
    case 'i':
    case 'u':
    case 'e':
    case 'o':
      cout << "vowel" << endl;
      break;
    default:
      cout << "consonant" << endl;
  }
  /* */

  return EXIT_SUCCESS;
}


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

    const ll MAX = 1000000;
    const ll MOD = 1000000007;

    ll fac[MAX];

    // テーブルを作る前処理
    /*
    void COMinit() {
        fac[0] = fac[1] = 1;
        for (int i = 2; i < MAX; i++){
            fac[i] = fac[i - 1] * i % MOD;
        }
    }
    */

    ll pow_kai(ll a,ll n){//aのn乗を計算します。
    ll x = 1;
    while(n > 0){//全てのbitが捨てられるまで。
        if(n&1){//1番右のbitが1のとき。
        x = x*a%MOD;
        }
        a = a*a%MOD;
        n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
    }
    return x;
    }

    // 二項係数計算
    ll COM(int n, int k){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        ll tmp=1;
        for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

        return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
    }



    int main()
    {
        ll N;
        cin >> N;
    
        ll A[N-1];

        rep(i,N-1){
            cin >> A[i];
        }

        ll ans[N];

        rep(i,N) ans[i]=0;

        rep(i,N-1){
            ans[A[i]-1]++;
        }

    rep(i,N) cout << ans[i] << endl;
    
        return 0;

    }

Measured memory_bytes: 6672
import java.util.Scanner;

/**
 * Created by PC on 26-Nov-17.
 */
public class Main{
    public static void main(String[] Args){
        Scanner in = new Scanner(System.in);

        int n, dig,tempDig, cnt;

        while(in.hasNext()){
            n = in.nextInt();

            dig = n%10;
            n/=10;
            cnt = 1;
            boolean goodNumber = false;

            while(n>0){
                tempDig = n%10;
                n/=10;

                if(tempDig == dig){
                    cnt++;
                    if(cnt >= 3) goodNumber = true;
                }
                else{
                    if(cnt >= 3) goodNumber = true;
                    cnt=1;
                    dig = tempDig;
                }
            }

            if(goodNumber) System.out.println("Yes");
            else System.out.println("No");
        }
    }
}


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

int main()
{
    long long x,a,b;
    cin >> x >> a >> b;

    if(0 <= a-b) cout << "delicious" << endl;
    else if(b-a <= x) cout << "safe" << endl;
    else cout << "dangerous" << endl;
    return 0;
}

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

int main()
{
  long long int X;
  cin >> X;
  int div = X / 500, mod = X % 500;
  long long int ans = 0;
  ans += (1000 * div);
  ans += (5 * (mod/5));
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  char str[1000];
  int count;
  cin >> str >> count;
  for(int d = 0;d < count;d++){
    char prc[8];
    cin >> prc;
    if(prc[2] == 'p'){
      int a,b;
      char rep[100];
      cin >> a >> b >> rep;
      for(int c = 0;c<b-a+1;c++)str[c+a] = rep[c];
    }
    else if(prc[2] == 'v'){
      int a,b;
      char temp[1000];
      cin >> a >> b;
      for(int c = 0;c<b-a+1;c++)temp[c] = str[c+a];
      for(int c = 0;c<b-a+1;c++)str[c+a] = temp[b-a-c];
    }
    else{
      int a,b;
      cin >> a >> b;
      for(int c = a;c<=b;c++)cout << str[c];
      cout << endl;
    }
  }
  return 0;
}


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

int main() {
    int n; cin >> n;
    int t[n + 1], x[n + 1], y[n + 1];
    t[0] = 0; x[0] = 0; y[0] = 0;
    for (int i = 1; i < n + 1; i++) cin >> t[i] >> x[i] >> y[i];

    for (int i = 0; i < n; i++) {
        int dt = abs(t[i + 1] - t[i]);
        int dx = abs(x[i + 1] - x[i]);
        int dy = abs(y[i + 1] - y[i]);

        if (dt < dx + dy || (dt + dx + dy) % 2 != 0) { puts("No"); return 0;}
    }
    puts("Yes");
}

Measured memory_bytes: 1408
N, T = map(int, input().split())
A = list(map(int, input().split()))

min_town_price = A[0]
max_profit = -1
max_profit_pairs = 0
for i in range(1, N):
    profit = A[i] - min_town_price
    if max_profit < profit:
        max_profit = profit
        max_profit_pairs = 1
    elif max_profit == profit:
        max_profit_pairs += 1
    min_town_price = min(min_town_price, A[i])
print(max_profit_pairs)


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


void solve(long long N, long long K){
    N %= K;
    cout << min(K - N, N) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e18
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  int N;
  cin >> N;
  string s = to_string(N);
  REP(i,s.size()){
    if(s[i]=='7'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3688
from collections import defaultdict

S = input()

kind = defaultdict(int)

for s in S:
    kind[s] += 1

if len(kind) == 2:
    f = True
    for k in kind.values():
        if k != 2:
            f = False
    
    if f:
        print('Yes')
    else:
        print('No')
else:
    print('No')


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 11;
const ll INF = 1ll << 60;

ll h,w;
string s[e3];
ll u[e3][e3];
ll d[e3][e3];
ll l[e3][e3];
ll r[e3][e3];
ll ans;

int main(){
  cin >> h >> w;
  for(ll i = 0;i < h;i++) cin >> s[i];
  for(ll i = 1;i < h;i++){
    for(ll j = 0;j < w;j++){
      if(s[i-1][j] == '.') u[i][j] = u[i-1][j]+1;
    }
  }
  for(ll i = 0;i < h;i++){
    for(ll j = 1;j < w;j++){
      if(s[i][j-1] == '.') l[i][j] = l[i][j-1]+1;
    }
  }
  for(ll i = h-2;i >= 0;i--){
    for(ll j = 0;j < w;j++){
      if(s[i+1][j] == '.') d[i][j] = d[i+1][j]+1;
    }
  }
  for(ll i = 0;i < h;i++){
    for(ll j = w-2;j >= 0;j--){
      if(s[i][j+1] == '.') r[i][j] = r[i][j+1]+1;
    }
  }
  for(ll i = 0;i < h;i++){
    for(ll j = 0;j < w;j++){
      // cerr << '(' << u[i][j] << " " << l[i][j] << " " << d[i][j] << " " << r[i][j] << ')' << " ";
      if(s[i][j] == '.'){
        ans = max(ans,u[i][j]+l[i][j]+d[i][j]+r[i][j]+1);
      }
    }
    // cerr << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 135424
#include <bits/stdc++.h>
using namespace std;
 
 
int main(void){
  int N, K;
  cin >> N >> K;
  vector<double> temp(N + 1, 0);
  vector<double> sum(N + 1, 0);
  double p;
  for(int i = 1; i <= N; i++){
    cin >> p;
    temp[i] = (p + 1) / 2;
    int j = max(0, i - K);
    sum[i] = sum[i - 1] + temp[i] -temp[j];
  }
  sort(sum.begin(), sum.end());
  cout << fixed;
  cout << setprecision(10) << sum[N];
  return 0;
}

Measured memory_bytes: 3328
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

    string S;
    cin>>S;
    ll N=S.length();
    ll ans=0;
    FORI(i,0,N/2)
    {
        if (S[i]!=S[N-1-i])
        {
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n,k = IL()
    p = list(IL())
    p.sort()
    ans = 0
    ans = sum(p[:k])
    print(ans)
    return

if __name__=='__main__':
    Main()

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

int main() {
	int n;
	cin >> n;
	int mo = 0;
	while (mo < n) {
		mo += 1000;
	}
	pv(mo - n);
	return 0;
}

Measured memory_bytes: 3644
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

	n := nextInt()

	var a int
	var b int
	min := math.Inf(1)

	for i := 1; i < n; i++ {
		a = i
		b = n - i
		// fmt.Printf("N = %d, a = %d, b = %d\n", n, a, b)

		aDigitSum := 0
		bDigitSum := 0

		for {
			aDigitSum += a % 10
			a /= 10

			if a == 0 {
				break
			}
		}

		for {
			bDigitSum += b % 10
			b /= 10

			if b == 0 {
				break
			}
		}

		total := float64(aDigitSum + bDigitSum)

		// fmt.Printf("total = %f, A = %d, B = %d\n", total, aDigitSum, bDigitSum)

		if min > total {
			// fmt.Printf("N = %d, a = %d, b = %d\n", i, a, b)
			min = total
			// fmt.Println(min)

		}
	}

	fmt.Println(min)
}


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

int h[200], par[200], s[200];
int find(int x) {
	if (par[x] == x)return x;
	return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x); y = find(y);
	if (x == y)return;
	par[y] = x; s[x] += s[y];
}
struct st { int a, b, c; };
int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		rep(i, n)par[i] = i, s[i] = 1;
		vector<P>t;
		rep(i, n)scanf("%d", &h[i]), t.push_back(P(h[i], i));
		sort(t.begin(), t.end(), greater<>());
		vector<st>v;
		rep(i, m) {
			int a, b, c; scanf("%d%d%d", &a, &b, &c); a--; b--;
			v.push_back({ a,b,c });
		}
		sort(v.begin(), v.end(), [&](st a, st b) {
			return min(h[a.a], h[a.b]) > min(h[b.a], h[b.b]);
		});
		int u = INT_MAX;
		int g = 0;
		rep(i, n) {
			while (g < v.size() && t[i].first <= min(h[v[g].a], h[v[g].b])) {
				unite(v[g].a, v[g].b); g++;
			}
			if (s[find(t[i].second)] <= i) {
				if (i + 1 == n)u = 0;
				else u = t[i + 1].first;
			}
		}
		sort(v.begin(), v.end(), [&](st a, st b) {
			int c = min({ u,h[a.a], h[a.b] }), d = min({ u,h[b.a], h[b.b] });
			if (c == d)return a.c < b.c;
			return c > d;
		});
		int res = 0;
		rep(i, n)par[i] = i, s[i] = 1;
		for (st p : v) {
			if (find(p.a) == find(p.b))continue;
			unite(p.a, p.b); res += p.c;
		}
		if (s[find(0)] != n)puts("0");
		else printf("%d\n", res);
	}
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<double,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;



int main(){
    int a,b;
    cin >> a >> b;
    cout << (a+b+1)/2 << endl;

    return 0;
}


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

int main(){
	int n;
	while(cin >> n,n){
		int dp[31]={0};
		dp[0] = 1;
		for(int i=0;i<=n;i++)
			for(int j=1;j<=3 && i+j <= n;j++)
				dp[i+j] += dp[i];
		cout << (dp[n]+3649)/3650 << endl;
	}
	
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(){
    int a,b,c=0;
    string s,t,x;
    cin>>s>>t;
    for(a=0;a<s.size();a++){
        x=s[1];
        for(b=2;b<s.size();b++){
            x=x+s[b];
        }
        x=x+s[0];
        s=x;
        if(s==t){
            cout<<"Yes";
            c=1;
            break;
        }
    }
    if(c==0){
        cout<<"No";
    }
}

Measured memory_bytes: 256
/*  
     author : masaow    
     g++ : 17.3.20  
*/        
#include <bits/stdc++.h>  
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- "
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long  
#define p(x)               cout << x << "\n" ; 
#define MOD                100000007
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"
#define mi                 map <int,int> 
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             x.begin(),x.end() 
using namespace std ; 
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5+7;  
const int SIZE = 1e5+7 ; 
/*  
    time : 10 : 14    
    date : 22.01.2020
*/    
// int L,R,mid,target,idx ;
int tests() 
{   
    ll A,B,k ; 
    cin >> A >> B >> k ; 
    if( A >= k )
        return cout << A-k << ' ' << B << '\n' ,0;
    if( A+B >= k )
        return cout << 0 << ' ' << B-k+A <<'\n',0 ; 
    cout << 0 << ' ' << 0 <<  '\n' ; 
    return 0 ;
}
int main(){
    I__O ;  
    int cases = 1 ; 
    //cin >> cases;  
    while(cases--)
      tests(); 
  return 0 ; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
  string a, b, c, d;
  cin >> a;
  cin >> b;
  c = c.append(b, 0, b.length() - 1);
  if (c == a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3000
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main(){
    int n;
    cin >> n;
    set<vector<int> > s;
    vector<int> a(3);
    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            cin >> a[j];
        }
        sort(a.begin(), a.end());
        s.insert(a);
    }
    cout << n-s.size() << endl;
    return 0;
}


Measured memory_bytes: 3248
import java.util.*;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        sc.close();

        int sum = 0;
        int count = 0;
        if(B != 1){
        while(sum < B){
            count++;
            sum = A*count - (count-1);
        }
    }
        System.out.println(count);
    }
}

Measured memory_bytes: 23124
bound = [3200, 2800, 2400, 2000, 1600, 1200, 800, 400, 1]
d = {b: 0 for b in bound}

N = int(input())
A = list(map(int, input().split()))

for a in A:
    for b in bound:
        if b <= a:
            d[b] += 1
            break

mini = 0
for b in bound[1:]:
    if d[b] > 0:
        mini += 1

print(max(mini, 1), mini + d[3200])


Measured memory_bytes: 3064
#include <stdio.h>
const int N = 1000001;
int c[N],a[200000],n, p[N],ans;
int main(void){
    scanf("%d",&n);
    for(int i=0;i<n;++i){
        scanf("%d",&a[i]);
        ++c[a[i]];
    }
    for(int i=2;i<N;++i){
        if(!p[i]){
            for(int j=i+i;j<N;j+=i) p[j] = 1;
        }
    }
    for(int i=2;i<N;++i){
        if(!p[i]){
            for(int j=1,jj=i;jj<N;++j,jj+=i) c[jj]+=c[j];
        }
    }
    for(int i=0;i<n;++i) if(c[a[i]] == 1) ++ans;
    printf("%d",ans);
}




Measured memory_bytes: 10320
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    ll ans = 1;
    rep(i, n)
    {
        ll a;
        cin >> a;
        ans = ans * (a / __gcd(ans, a));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
n = int(input())
v = tuple(map(int, input().split()))

if len(set(v)) == 1:
    print(len(v)//2)
else:
    from collections import Counter
    ve = v[0::2]
    vec = Counter(ve).most_common()
    most_even = vec[0]

    vo = v[1::2]
    voc = Counter(vo).most_common()
    most_odd = voc[0]

    if most_even[0] == most_odd[0]:
        o2 = voc[1][1]
        e2 = vec[1][1]
        ans = n - max(most_even[1] + o2,
                      e2 + most_odd[1])
    else:
        ans = n - most_even[1] - most_odd[1]
    print(ans)

Measured memory_bytes: 20960
// -*- coding: utf-8 -*-
// Last-Updated : <2014/06/19 18:01:42 by samui>

#include <iostream>
#include <cstdio>
#include <string>

void writeBlock(int H,int W){
  std::string s;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      
      if(!(((j&1)+(i&1))&1))
	s = "#";
      else
	s = ".";
      std::cout<<s<<std::flush;
      
    }
    std::cout<<std::endl;
  }
}

int main(int argc, char **argv){
  int H,W;
  while(std::cin>>H>>W){
    if((H == 0 && W == 0)){
      break;
    }
    writeBlock(H,W);
    std::cout<<std::endl;
  }
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<ll, ll>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
 
struct Store {
  int i; string s; int p;
  Store(int i, string s, int p): i(i), s(s), p(p) {}
};
 
int main()
{
  int n;
  cin >> n;
  vector<Store> st;
  rep(i, n) {
    string s;
    int p;
    cin >> s >> p;
    st.emplace_back(i+1, s, p);
  }
  auto comp = [](Store a, Store b) {
    if (a.s!=b.s) return a.s<b.s;
    else return a.p>b.p;
  };
  sort(whole(st), comp);
  
  rep(i, n) {
    cout << st[i].i << endl;
  }
    
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;






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

	ll ans=0LL;
	ans += 2*(n / 11LL);

	if (0 < n % 11 && n%11<=6) {
		ans++;
	}
	else if (n % 11 > 6) {
		ans += 2;
	}

	cout << ans << endl;
}


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

#define int long long int 


int32_t main()
{
  int n;
  cin>>n;
  int a[n];
  int ans=0;
  int ans1=0;
  int ans2=0;
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    if(x%2!=0 && x%4!=0)
    ans++;
    else if(x%4==0)
    ans1++;
    else if(x%2==0)
     ans2++;
  }
//  cout<<ans1<<" "<<ans<<" "<<ans2<<endl;
  if(ans==0 ||ans1&&!ans||ans2&&!ans||  (!ans2 && ans1>=(ans-1)) || (ans2 &&ans1>=ans ))
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;
}

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

int main() {
  // ここにプログラムを追記
  int s1s2s3 ;
    cin >> s1s2s3;
    cout << s1s2s3/100%2 + s1s2s3/10%2 + s1s2s3%2 << endl;
}

Measured memory_bytes: 256
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define ABSS(a, b) (a > b ? a - b : b - a)

int compare_f(const void *a, const void *b) {
	return (int)(*(uint32_t *)b) - (int)(*(uint32_t *)a);
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	size_t N;
	size_t cntOdd = 0;
	size_t cntMul4 = 0;

	scanf("%zu\n", &N);
	for (size_t idx = 0; idx < N; idx++) {
		size_t a;
		scanf((idx != N - 1 ? "%zu " : "%zu"), &a);
		if (a % 2 != 0) {
			cntOdd++;
		}
		else {
			if (a % 4 == 0) {
				cntMul4++;
			}
		}
	}

	puts((cntOdd <= cntMul4 || cntMul4 >= N/2 ? "Yes" : "No"));

	return 0;
}


Measured memory_bytes: 128
/// meowa 

#pragma GCC optimize("O3")

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;

using ll = long long;
using pii = pair<int, int>;                                   

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

void stndrtn() {
#ifdef AM
    freopen(".in", "r", stdin);
#endif        
}                   

const bool flag = 0;

void ma1n() {
    string s;
    cin >> s;
    string t;
    cin >> t;
    int ans = 0;
    for (int i = 0; i < sz(s); ++i) {
        if (s[i] != t[i]) {
            ans++;
        }
    }
    cout << ans;                
} 

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), stndrtn();
    int ts = 1;
    if (flag) {
        cin >> ts;
    }
    while (ts--) {
        ma1n(); 
    }
    return 0;
}

Measured memory_bytes: 3832
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
using namespace std;
typedef long long ll;
const int maxn = 105;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int a,b,c,d,e,k;
  cin>>a>>b>>c>>d>>e>>k;
  if(e-a>k)cout<<":("<<endl;
  else cout<<"Yay!"<<endl;
  return 0;
}

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

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int k=0; k<n; k++) {
        int a[10];
        for(int i=0; i<10; i++) cin >> a[i];
        int b=-1, c=-1;
        bool f = 0;
        for(int i=0; i<10; i++) {
            if(b<a[i]) {
                b = a[i];
            } else if(c<a[i]) {
                c = a[i];
            } else {
                f = 1;
                break;
            }
        }
        printf("%s\n", f ? "NO" : "YES");
    }

    return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef double db;

#define mp make_pair
#define pb push_back
#define pt(i) printf("%lld\n",(ll)i)
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1.0)

ll in() { ll a;scanf("%lld",&a); return a;}
db din(){ db a;scanf("%lf",&a); return a; }
ll bigmod(ll b, ll p,ll md){if(p==0) return 1;if(p%2==1){ return ((b%md)*bigmod(b,p-1,md))%md;} else {ll y=bigmod(b,p/2,md);return (y*y)%md;}}
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b);}

long long getRandom(long long a,long long b){
    long long ret = (long long)rand()*(long long)rand();
    ret %= (b - a + 1);
    ret += a;
    return ret;
}

int main()
{
	//freopen("in.c","r",stdin);
	//freopen("out.c","w",stdout);
	int n=in();
	int ar[n+5][5];
	for(int i=0;i<n;i++)
		for(int j=0;j<3;j++){
			ar[i][j]=in();
			if(i)
			{
				if(j==0)
					ar[i][j]+=max(ar[i-1][1],ar[i-1][2]);
				else if(j==1)
					ar[i][j]+=max(ar[i-1][0],ar[i-1][2]);
				else
					ar[i][j]+=max(ar[i-1][1],ar[i-1][0]);
			}
		}
	pt(max(ar[n-1][0],max(ar[n-1][1],ar[n-1][2])));
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i,n)  for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define deb(x) cerr << #x <<": " << x << '\n';
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long double ld;
typedef long long ll;

int main(){
    ios;
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int hour = h2 - h1;
    int min = m1 - m2;
    hour *= 60;
    hour -= min;
    hour -= k;
    cout << ((hour < 0)? 0 : hour);
    return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>

int main(){

	int n,i,max,min,temp;
	int s[100][5];

	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		for(i=0;i<n;i++){
			scanf("%d %d %d %d %d",&s[i][0],&s[i][1],&s[i][2],&s[i][3],&s[i][4]);
		}
		max=min=s[0][0]+s[0][1]+s[0][2]+s[0][3]+s[0][4];
		for(i=0;i<n;i++){
			temp=s[i][0]+s[i][1]+s[i][2]+s[i][3]+s[i][4];
			if(temp>max){
				max=temp;
			}
			if(temp<min){
				min=temp;
			}
		}
		printf("%d %d\n",max,min);
	}

	return(0);
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

int main ()
{
    int a , b ;

    cin >> a >> b ;

    cout << max({a + b , a - b , a * b}) ;


    return 0 ;
}


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

int main()
{
   int N,K;
   cin >> N >> K;
   int Y = 2147483647;
   int temp;

   for (int i=0;i<N+1;i++)
   {
      int X = 1;
      for (int j=0;j<i;j++)
      {
         X *= 2;
      }
      for (int j=i;j<N;j++)
      {
         X += K;
      }
      
      if (Y>X)
      {
         Y = X;
      }
   }

   cout << Y << endl;;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int c = sc.nextInt();
		int num = 0;
		int total = 0;
		int [] addc = new int[c];
		for (int i=0;i<r; i++){
			int addr = 0;
			for (int j=0; j<c; j++){
				num = sc.nextInt();
				System.out.print(num + " ");
				addr += num;
				addc[j] += num;
				total += num;
			}
			System.out.println(addr);
		}
		for (int j=0; j<c; j++){
			System.out.print(addc[j] + " ");
		}
		System.out.println(total);
	}
}

Measured memory_bytes: 40516
S = input()
T = input()
L = len(S)
LL = len(T)

anslist = []
for i in range(L):
    if (S[i] == T[0] or S[i] == "?") and i+LL<=L:
        flag = 0
        for j in range(1,LL):
            if not(S[i+j] == T[j] or S[i+j] == "?"):
                flag = 1
        if flag == 0:
            anslist.append(i)

ans = "z"*51
LLL = len(anslist)
for i in range(LLL):
    j = anslist[i]
    tmp = ""
    for k in range(j):
        if S[k] == "?":
            tmp += "a"
        else:
            tmp += S[k]
    tmp += T
    for k in range(j+LL,L):
        if S[k] == "?":
            tmp += "a"
        else:
            tmp += S[k]
    if tmp < ans:
        ans = tmp
if ans == "z"*51:
    print("UNRESTORABLE")
else:
    print(ans)

Measured memory_bytes: 39664
from itertools import accumulate


N, K = map(int, input().split())
P = list(map(int, input().split()))

d = {}
for i in range(1, 1001):
    d[i] = (i + 1) * (i / 2) / i

E = []
for p in P:
    E.append((p+1)/2)

cum = list(accumulate(E))
mx = 0
idx = 0
ans = 0
for i in range(N-K+1):
    if i == 0:
        mx = max(mx, cum[i+K-1])
    else:
        mx = max(mx, cum[i+K-1] - cum[i-1])

print(mx)

Measured memory_bytes: 25152
from math import sqrt

N = int(input())
engine = {}
tan_key = []
tan_key_infty = []
for i in range(N):
    x, y = map(int,input().split())
    if x != 0:
        tan = y / x
    else:
        tan = -10**10

    if tan in tan_key:
        engine[tan].append((x, y))
    else:
        engine[tan] = [(x, y)]
        tan_key.append(tan)
tan_key.sort()

#print('engine = {}'.format(engine))
#print('tan_key = {}'.format(tan_key))

# starting line = y-axis
left_coordinate = [0, 0]
right_coordinate = [0, 0]
for tan in tan_key:
    for x, y in engine[tan]:
        if x > 0:
            right_coordinate[0] += x
            right_coordinate[1] += y
        elif x < 0:
            left_coordinate[0] += x
            left_coordinate[1] += y

max_left = sqrt(left_coordinate[0] ** 2 + left_coordinate[1] ** 2)
max_right = sqrt(right_coordinate[0] ** 2 + right_coordinate[1] ** 2)

#print('First time, left_goal = {}, right_goal = {}'.format(left_coordinate, right_coordinate))

# candidates for directions = the elements of tan_key and their middle
d = 2 * len(tan_key) - 1
for i in range(d):
    if i % 2 == 0:
        for x, y in engine[tan_key[i // 2]]:
            if x > 0:
                left_coordinate[0] += x
                left_coordinate[1] += y
            elif x < 0:
                right_coordinate[0] += x
                right_coordinate[1] += y
            elif x == 0:
                if y > 0:
                    right_coordinate[0] += x
                    right_coordinate[1] += y
                else:
                    left_coordinate[0] += x
                    left_coordinate[1] += y

    else:
        for x, y in engine[tan_key[(i + 1) // 2]]:
            if x > 0:
                right_coordinate[0] -= x
                right_coordinate[1] -= y
            elif x < 0:
                left_coordinate[0] -= x
                left_coordinate[1] -= y

    max_left = max(max_left, sqrt(left_coordinate[0] ** 2 + left_coordinate[1] ** 2))
    max_right = max(max_right, sqrt(right_coordinate[0] ** 2 + right_coordinate[1] ** 2))


    #print(('When i = {}, left_goal = {}, right_goal = {}'.format(i, left_coordinate, right_coordinate)))

print(max(max_left, max_right))


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int main()
{
    int n = 0;
    cin >> n;

    COUT(24 - n + 24);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S;
    cin >> S;
    int s0 = 0, s1 = 0;
    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] == '0')
        {
            s0++;
        }
        else
        {
            s1++;
        }
    }
    cout << min(s0, s1) * 2 << endl;
    return 0;
}


Measured memory_bytes: 512
#include<iostream> 
using namespace std; 
int main() 
{ 
  int x[5],i,a;
  for(i=0;i<5;i++){
   cin>>x[i]; 
   }
   for(i=0;i<5;i++)
   { 
      if(x[i]==0) 
      { 
        a=i+1; 
        break; 
      } 
    } 
    cout<<a<<endl; 
   return 0;  
}

Measured memory_bytes: 3584
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int H, W, w[55], b[55], r[55]; string s[55];
int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> s[i];
		for (int j = 0; j < W; j++) {
			if (s[i][j] == 'W') w[i]++;
			if (s[i][j] == 'B') b[i]++;
			if (s[i][j] == 'R') r[i]++;
		}
	}
	int ret = H * W;
	for (int i = 1; i < H - 1; i++) {
		for (int j = i + 1; j < H; j++) {
			int res = 0;
			for (int k = 0; k < i; k++) res += b[k] + r[k];
			for (int k = i; k < j; k++) res += w[k] + r[k];
			for (int k = j; k < H; k++) res += w[k] + b[k];
			ret = min(ret, res);
		}
	}
	cout << ret << endl;
	return 0;
}

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

int main(void){
	int a,b;
	cin>>a>>b;
	if(abs(a-b)%2 == 0)cout<<(a+b)/2<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
	return 0;
}


Measured memory_bytes: 256