akhauriyash/Code-Regression huggingface dataset:
import sys
from numpy import fromstring
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
def main():
  t=fromstring(sys.stdin.buffer.read(),'i',sep=' ')
  n,m,l=t[:3]
  m=m*3+3
  print('\n'.join((floyd_warshall(floyd_warshall(csr_matrix((t[5:m:3],(t[3:m:3],t[4:m:3])),[n+1]*2),0)<=l)[t[m+1::2],t[m+2::2]].clip(0,n).astype(int)%n-1).astype(str).tolist()))
main()

Measured memory_bytes: 28856
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long a = 1L;
		long b = 1L;
		for(int i = 0; i < n; i++) {
			long x = sc.nextLong();
			long y = sc.nextLong();
			long a_x = a/x;
			long b_y = b/y;
			a_x += (a%x==0) ? 0 : 1;
			b_y += (b%y==0) ? 0 : 1;
			long t = Math.max(a_x, b_y);
			a = t*x;
			b = t*y;
		}
		System.out.println(a+b);
	}
}

Measured memory_bytes: 25836
N = int(input())
D,X =  map(int, input().split())
N_chocolate=0
for i in range (N):
	A= int(input())
	if A == 1:
		N_chocolate=N_chocolate+D-1
	else:
		N_chocolate=N_chocolate+int((D-1)/A)
output=N_chocolate+X+N
print (output)

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

def eratosthenes(n):
    res = []
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    for i in range(n+1):
        if is_prime[i]:
            res.append(i)
    return res

li = eratosthenes(10**6)
for ele in li:
    if ele >= X:
        print(ele)
        exit()

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

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

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

using namespace std;
typedef long long ll;
ll N_MAX = 100100;
using P = pair<ll,ll>;
using Graph = vector<vector<P>>;
Graph G(N_MAX);
vector<ll> res(N_MAX), wt;
ll N;

void dijkstra(){
    priority_queue<P,vector<P>,greater<P>> Q;
    Q.push(P(0,0));

    while(!Q.empty()){
        P p = Q.top();Q.pop();
        ll v = p.second;
        if(res[v]<p.first) continue;
        //cout << p.first << " " << p.second << endl;
        for(auto e : G[v]){
            if(res[v]+e.first >= res[e.second]) continue;
            res[e.second]=res[v]+e.first;
            Q.push(P(res[e.second],e.second));
        }
    }
}

int main() {
    cin >> N;
    
    wt.push_back(1);
    ll tmp=6;
    while(tmp<=N){
        wt.push_back(tmp);
        tmp*=6;
    }
    tmp=9;
    while(tmp<=N){
        wt.push_back(tmp);
        tmp*=9;
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<wt.size();j++){
            if(i+wt[j]>N) continue;
            else{
                G[i].push_back(P(1,i+wt[j]));
            }
        }
    }
    for(int i=1;i<=N;i++){
        res[i] = 1<<30;
    }
    dijkstra();
    cout << res[N] << endl;
}

Measured memory_bytes: 29820
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb emplace_back
const int maxn = 1e5+1;
int n, m, cnt[maxn];
bool r[maxn];
signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	r[1] = true;
	fill(cnt, cnt+n+1, 1);
	while (m--) {
		int x, y;
		cin >> x >> y;
		r[y] |= r[x];
		++cnt[y], --cnt[x];
		if (cnt[x] == 0) r[x] = false;
	}
	int res =0 ;
	for (int i = 1;i <= n;++i)
		res += r[i];
	cout << res << '\n';
}



Measured memory_bytes: 768
# -*- coding: utf-8 -*-

n = int(input())
s = input()
k = int(input())

t = s[k-1]

s_list = list(s)

for i in range(n):
    if s[i] != t:
        s_list[i] = '*'

s_changed = "".join(s_list)
print(s_changed)

Measured memory_bytes: 3316
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define mod 1000000007 //1e9+7
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,n,k,x,tk=1000,stock;
    cin>>n;
    vector<ll> v(n);
    for(i=0; i<n; i++)
    {
        cin>>v[i];
    }
    for(i=0; i<n-1; i++)
    {
        stock=0;
        if(v[i]<v[i+1]){
           stock=tk/v[i];
        }
        tk+=stock*(v[i+1]-v[i]);
    }
    cout<<tk<<endl;
    return 0;
}


Measured memory_bytes: 3632
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 998244353
#define mod MOD
#define sec setprecision
constexpr double eps = 1e-9;
constexpr double PI = 3.141592653589793238462643383279;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
int ketasuu(ll h) {
	if (h < 0)return(-(ketasuu(-h)));
	else if (h < 10)return(1);
	else return(1 + ketasuu(h / 10));
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll 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;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a) % mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	int x, a;
	cin >> x >> a;
	if (x < a)cout << "0" << endl;
	else cout << "10" << endl;
}
int main() {
	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX;
constexpr long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//constexpr ll P = 1e9 + 7;
	//constexpr ll P = 998244353;

	ll n, d;
	cin >> n >> d;
	ll ans = 0;
	while (n--) {
		ll x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d) ans++;
	}
	cout << ans << endl;
}

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

using namespace std;

int main() 
{ 
   int A1,A2,A3;
   cin>>A1;
    cin>>A2;
     cin>>A3;
     if(A1+A2+A3>=22)
      cout<<"bust";
    else 
     cout<<"win";

return 0;
}


Measured memory_bytes: 256
def main():
  n=int(input())
  a=tuple(map(int,input().split()))
  cnt2,cnt4=0,0
  for i in a:
    cnt2+=1 if i%2==0 and i%4>0 else 0
    cnt4+=1 if i%4==0 else 0
  print('Yes' if (cnt2>=2 and cnt4>=(n-cnt2)/2) or (cnt2<2 and cnt4>=n//2) else 'No')
if __name__=='__main__':
  main()

Measured memory_bytes: 14352
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def prime_fact(m):
    pf={}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    return pf
def main():
    n,p=map(int,input().split())
    p_dict=prime_fact(p)
    ans=1
    for pp in p_dict.items():
        ans*=pp[0]**(pp[1]//n)
    print(ans)


if __name__=='__main__':
    main()

Measured memory_bytes: 13188
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    string s;
    cin >> n >> s;
    ll r = 0, g = 0, b = 0;
    forn(i, n) {
        r += s[i] == 'R', g += s[i] == 'G', b += s[i] == 'B';
    }
    ll ans = r * g * b;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int k = 2 * j - i;
            if (k < n && s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) ans--;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3652
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int count = 1;
		int i = 0;
		int ans = 0;
		int[] hairetu = new int[1000000];
		hairetu[count - 1] = n;
		while(count < 1000000){
			if(hairetu[count-1]%2 == 0){
				hairetu[count] = hairetu[count-1] / 2;
			}
			else{
				hairetu[count] = 3 * hairetu[count-1] + 1;
			}
			count++;
		}
		
		for(i = 0; i < 1000000; i++){
			if(hairetu[i] == 4){
				ans = i;
				break;
			}
			else if(hairetu[i] == 2){
				ans = i;
				break;
			}
			else if(hairetu[i] == 1){
				ans = i;
				break;
			}
			else{
				continue;
			}
		}
		System.out.println(ans + 4);
	}
}


Measured memory_bytes: 25940
#define DEBUG 0
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-6-29 20:56:52
 * Powered by Visual Studio Code
 */
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
using ll = long long;
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}
void No()
{
  cout << "No" << endl;
  exit(0);
}
const int MAX_SIZE = 1000010;
class mint
{
public:
  static ll MOD;
  ll x;
  mint() : x(0) {}
  mint(ll x) : x(x % MOD) {}
  mint operator-() const { return x ? MOD - x : 0; }
  mint &operator+=(const mint &a)
  {
    if ((x += a.x) >= MOD)
    {
      x -= MOD;
    }
    return *this;
  }
  mint &operator-=(const mint &a) { return *this += -a; }
  mint &operator*=(const mint &a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint &operator/=(const mint &a) { return (*this *= power(MOD - 2)); }
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  mint operator/(const mint &a) const { return mint(*this) /= a; }
  bool operator<(const mint &a) const { return x < a.x; }
  bool operator==(const mint &a) const { return x == a.x; }
  const mint power(ll N)
  {
    if (N == 0)
    {
      return 1;
    }
    else if (N % 2 == 1)
    {
      return *this * power(N - 1);
    }
    else
    {
      mint half = power(N / 2);
      return half * half;
    }
  }
};
ll mint::MOD = 1e9 + 7;
istream &operator>>(istream &stream, mint &a) { return stream >> a.x; }
ostream &operator<<(ostream &stream, const mint &a) { return stream << a.x; }
mint inv[MAX_SIZE];
mint fact[MAX_SIZE];
mint factinv[MAX_SIZE];
void init()
{
  inv[1] = 1;
  for (int i = 2; i < MAX_SIZE; i++)
  {
    inv[i] = (-inv[mint::MOD % i]) * (mint::MOD / i);
  }
  fact[0] = factinv[0] = 1;
  for (int i = 1; i < MAX_SIZE; i++)
  {
    fact[i] = mint(i) * fact[i - 1];
    factinv[i] = inv[i] * factinv[i - 1];
  }
}
mint choose(int n, int k)
{
  if (n >= 0 && k >= 0 && n - k >= 0)
  {
    return fact[n] * factinv[k] * factinv[n - k];
  }
  return 0;
}
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
// const double epsilon = 1e-10;
// const ll infty = 1000000000000000LL;
// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

int main()
{
  // init();
  string A;
  cin >> A;
  sort(A.begin(), A.end());
  if (A[0] == A[1] && A[1] != A[2] && A[2] == A[3])
  {
    Yes();
  }
  No();
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acos(-1);

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

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

#define DEBUG

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n;
	cin >> n;
	vector<P> a(n);
	rep(i, n) a[i].first = i + 1;
	rep(i, n) cin >> a[i].second;

	sort(all(a), [](P &a, P &b) { return a.second < b.second; });

	rep(i, n) cout << a[i].first << ' ';
	cout << endl;
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 3005;
const int MOD = 998244353;

int a, b, c, d;
int cache[N][N];

int dp(int x, int y)
{
	if(x > c)
		return 0;
	if(y > d)
		return 0;
	if(x == c && y == d)
		return 1;
	int &ans = cache[x][y];
	if(ans != -1)
		return ans;
	ans = 0;
	ans += y * dp(x + 1, y) + x * dp(x, y + 1) - x * y * dp(x + 1, y + 1);
	ans %= MOD;
	ans += MOD;
	ans %= MOD;
	return ans;
}

int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	cin >> a >> b >> c >> d;
	int ans = dp(a, b);
	cout << ans;
	return 0;
}

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

int G[410];
int R[410][410];
int D[410];
int bfs(int src,int num);

int main() {
	int W,H,root;
	char c;


	while (true) {
		for(int i=0;i<400;i++) {
			for(int j=0;j<400;j++) {
				R[i][j] = 0;
			}
		}
		for(int i=0;i<400;i++) {
			G[i] = 0;
		}
		for(int i=0;i<400;i++) {
			D[i] = 100;
		}
		cin >> W >> H;
		if((W == 0) && (H == 0)) break;
		for(int i=0;i<W*H;i++) {
			cin >> c;
			if(c == '.') G[i] = 1;
			if(c == '#') G[i] = 0;
			if(c == '@') {
				G[i] = 1;
				root = i;
			}
		}
		for(int i=0;i<W*H;i++) {
			if(G[i] == 1) {
				if(i%W != 0) { //????????????
					if(G[i-1] == 1) {//??????????????? 
						R[i][i-1] = 1;
					}
				}
				if(i%W != W-1) { //????????????
					if(G[i+1] == 1) { //???????????????
						R[i][i+1] = 1;
					}			

				}
				if(i > W-1) { //???????????????
					if(G[i-W] == 1) { //???????????????
						R[i][i-W] = 1;
					}	

				}
				if(i < W*H-W) {//???????????????
					if(G[i+W] == 1){
						R[i][i+W] = 1;
					}	

				}
			}
		}
		cout << bfs(root,W*H) << endl;
	}
	/*
	for(int i=0;i<99;i++) {
		cout << i << " " << G[i] << endl;
	}
	cout << G[98] << endl;
	cout << R[87][98] << endl;
	*/
	
}





int bfs(int src,int num) {
	int cur,dst;
	int count = 1;
	//cerr << "bfs root = " << src << endl;
	queue<int> Q; // ??´??°????????????????????\????????????
	Q.push(src);
	D[src] = 0; // ?????????
	while (!Q.empty()) {
		
		int cur = Q.front(); // ??????????´????????????????
		Q.pop();
// ???????¢??????¨??¨???
		//cerr << cur << " " << D[cur] << endl;
		for (int dst=0;dst<num;dst++) { // ???????????? dst ????????????
			if ((R[cur][dst] == 1) && (D[dst] == 100)) { // cur ?????? dst ??????????????????dst ???????¨??????????
				D[dst] = D[cur]+1; //
				Q.push(dst); // dst ????¨???????????????????
				count++;
			}
		}
	}
	return count;
}

Measured memory_bytes: 3732
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    int x, y, z;
    cin >> x >> y >> z;
    
    // calculation
    int mod = x%(y+z);
    if (mod >= z) {
        cout << x/(y+z) << "\n";
    } else {
        cout << x/(y+z) - 1 << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  random_device rd;
  mt19937 mt(rd());
  uniform_int_distribution<ll> a(1,26);
  vector<ll> day(26);
  vector<pair<ll,ll>> c(26);
  ll d;
  cin >> d;
  rep(i,26) {
    ll t;
    cin >> t;
    c[i] = pair(t,i);
  }
  Sort(c);
  ll p = 0;
  rep(i,26) {
    if (c[i].first < 45) {
      p = i;
      break;
    }
  }
  ll cnt = 0;
  while (1) {
    rep(i,p) {
      cout << c[i].second +1 << '\n';
      ++cnt;
      if (cnt >= 365) {
        return 0;
      }
    }
    rep(i,(26-p)/2) {
      cout << c[i+p].second +1 << '\n';
      ++cnt;
      if (cnt >= 365) {
        return 0;
      }
    }
    rep(i,p) {
      cout << c[i].second +1 << '\n';
      ++cnt;
      if (cnt >= 365) {
        return 0;
      }
    }
    rep(i,((26-p)+1)/2) {
      cout << c[i+p+(26-p)/2].second +1 << '\n';
      ++cnt;
      if (cnt >= 365) {
        return 0;
      }
    }
  }  
}

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

int  main()
{
  int n;
  vector<vector<int>> a(3,vector<int>(3));
  vector<int> b(n);
  for(int i=0;i<3;i++)
  {
    cin>>a.at(i).at(0)>>a.at(i).at(1)>>a.at(i).at(2);
  }
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>b.at(i);
  }
  for(int i=0;i<3;i++)
  {
    for(int j=0;j<3;j++)
    {
      for(int k=0;k<n;k++)
      {
        if(a.at(i).at(j)==b.at(k))
        {
          a.at(i).at(j)=0;
        }
      }
    }
  }
  if(a.at(0).at(0)+a.at(0).at(1)+a.at(0).at(2)==0)
    cout<<"Yes"<<endl;
  else if(a.at(1).at(0)+a.at(1).at(1)+a.at(1).at(2)==0)
    cout<<"Yes"<<endl;
  else if(a.at(2).at(0)+a.at(2).at(1)+a.at(2).at(2)==0)
    cout<<"Yes"<<endl;
  else if(a.at(0).at(0)+a.at(1).at(0)+a.at(2).at(0)==0)
    cout<<"Yes"<<endl;
  else if(a.at(0).at(1)+a.at(1).at(1)+a.at(2).at(1)==0)
    cout<<"Yes"<<endl;
  else if(a.at(0).at(2)+a.at(1).at(2)+a.at(2).at(2)==0)
    cout<<"Yes"<<endl;
  else if(a.at(0).at(0)+a.at(1).at(1)+a.at(2).at(2)==0)
    cout<<"Yes"<<endl;
  else if(a.at(0).at(2)+a.at(1).at(1)+a.at(2).at(0)==0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3728
n,m,q = map(int,input().split())
abcd = [[] for j in range(q)]
for i in range(q):
    abcd[i] = list(map(int,input().split()))
l = [1]*n
l[n-1]=m
def plus():
    l[n-2] += 1
    while m+1 in l:
        a = l.index(m+1)
        l[a-1]+=1
        for i in range(a,n-1):
            l[i] = l[a-1]

ans=0
while l[0]<=m:
    score = 0
    for i in range(q):
        if l[abcd[i][1]-1]-l[abcd[i][0]-1]==abcd[i][2]:
            score += abcd[i][3]
    if ans < score:
        ans = score
    plus()


print(ans)

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

int main() {
	ios_base::sync_with_stdio( false );

	int N, M;
	cin >> N >> M;

	vector<vector<int>> ct( N );
	for( int i = 0; i < M; ++i ) {
		int a, b;
		cin >> a >> b;

		ct[a-1].push_back( b-1 );
		ct[b-1].push_back( a-1 );
	}

	for( int i = 0; i < N; ++i ) {
		cout << ct[i].size() << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000

const ll MOD=998244353;

main(){
    int x,y;cin>>x>>y;
    int ans=INT_MAX;
    if(x<=y)ans=y-x;
    if(-x<=y)ans=min(ans,1+y+x);
    if(x<=-y)ans=min(ans,1-y-x);
    if(-x<=-y)ans=min(ans,2-y+x);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> v(N), c(N), diff(N);
    for(int i=0; i < N; i++){
        cin >> v[i];
    }
    for (int i = 0; i < N; i++){
        cin >> c[i];
    }

    int sum = 0;
    for(int i=0; i < N; i++){
        diff[i] = v[i] - c[i];
        if (diff[i] > 0)
            sum += diff[i];
    }

    cout << sum << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

int main() {
    string S;
    string T;

    cin >> S >> T;

    if (T.size() == S.size() + 1) {
        if (T.substr(0, S.size()) == S) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3552
let pow x y =
  let rec f m n odd b = match n with
      0 -> 1
    | 1 -> m * odd
    | _ -> let t = if n mod 2 = 1 then odd * b else odd in
           f (m * m) (n/2) t (b * b)
  in f x y 1 x;;

let rec read () =
  let n = read_int () in
  if n != 0 then
    begin
      let rec f ct i =
        let d = n / (pow 5 i) in
        if d <= 0 then ct else f (d+ct) (i+1)
      in
      Printf.printf "%d\n" (f 0 1);
      read ()
    end
;;
let () = read ();;

Measured memory_bytes: 2108
#include<stdio.h>
 int main(void)
 {
 	int n, h, m, s;
 	scanf("%d" , &n);
 	h= n / 3600;
 	m= (n % 3600)/60;
 	s= n % 60;
 	printf("%d:%d:%d\n" , h, m, s);
 	return 0;
 	
 	
 	
 	
 	
 }


Measured memory_bytes: 2712
A,B = map(int, input().split())
cost = 0
if B == 1:
    print(cost)
    quit()
B = B - A
cost += 1
if B < 0:
    print(cost)
    quit()
else:
    while B > 0:
        B -= A-1
        cost += 1
print(cost)

Measured memory_bytes: 3060
N=int(input())
T=list(map(int,input().split()))
A=list(map(int,input().split()))
X=[T[0]]
Y=[A[-1]]
for i in range(N-1):
  if T[i]<T[i+1]:
    X.append(T[i+1])
  else:
    X.append(0)
  if A[-i-1]<A[-i-2]:
    Y.append(A[-i-2])
  else:
    Y.append(0)
Y=Y[::-1]
for i in range(N):
  if min(X[i],Y[i]) and X[i]!=Y[i]:
    print(0)
    exit()
mod=10**9+7
Z=[max(X[i],Y[i]) for i in range(N)]
C=0
for i in range(N):
  C=max(C,Z[i])
  if C!=T[i]:
    print(0)
    exit()
C=0
for i in range(N):
  C=max(C,Z[-i-1])
  if C!=A[-i-1]:
    print(0)
    exit()
mod=10**9+7
P=1
for i in range(N):
  if Z[i]==0:
    P=P*min(A[i],T[i])%mod
print(P)

Measured memory_bytes: 110716
#include <stdio.h>

int main(void){
  int D,N;
  scanf("%d%d",&D,&N);

  if(N == 100){
    printf("101");
  }else{
    printf("%d",N);
  }
  while(D > 0){
    printf("00");
    D--;
  }

  printf("\n");
  return 0;
}

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

int main(){
    int c, n;
    cin >> n;
    long double b = 0;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        b += (long double)1/a[i];
    }
    cout <<setprecision(10) << 1/b << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np

MOD = 10 ** 9 + 7


def pow_matrix_mod(x, n, mod=MOD):
    if not n:
        return np.eye(len(x), dtype=np.object)
    if n % 2 == 0:
        return pow_matrix_mod(x @ x % mod, n // 2) % mod
    else:
        return x @ pow_matrix_mod(x @ x % mod, (n - 1) // 2) % mod


N, K = map(int, input().split())
A = np.array([tuple(map(int, input().split())) for _ in range(N)], dtype=np.object)
print(pow_matrix_mod(A, K).sum() % MOD)


Measured memory_bytes: 32880
#include<bits/stdc++.h>
#define NAME "A"
#define vt vector
#define ll long long
#define fi first
#define se second
#define pb push_back
#define time ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

void init()
{
    freopen(NAME".inp","r",stdin);
    freopen(NAME".out","w",stdout);
}

const int N=1e5+5;
int n,a[N];
int f[N] {0};

void inp()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
}

void out()
{
    a[0]=INT_MAX;
    for(int i=2;i<=n;i++)
    {
       // f[i]=min(abs(a[i]-a[i]))
        if(abs(a[i]-a[i-1])+f[i-1]<abs(a[i]-a[i-2])+f[i-2])
            f[i]=abs(a[i]-a[i-1])+f[i-1];
        else f[i]=abs(a[i]-a[i-2])+f[i-2];
       // cout<<f[i]<<" ";
    }
  //  cout<<endl;
    cout<<f[n];
}

int main()
{
   // init();
    inp();
    out();
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(){
	int a[4],b[4];
	int hit,blow;
	while(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3])!=EOF){
		hit=blow=0;
		scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
		for(int i=0;i<4;i++){
			if(a[i]==b[i]) hit++;
			for(int j=0;j<4;j++){
				if(i!=j){
					if(a[i]==b[j]) blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}
					

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define ll long long
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

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



Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N,K = LI()
    A = [0] + LI()

    his = [0] * (N+1)
    s = 1
    cnt = K

    while cnt > 0:
        his[s] = cnt
        s = A[s]
        cnt -= 1
        if his[s] > cnt:
            cnt = cnt % (his[s]-cnt)
    print(s)

if __name__ == '__main__':
    main()

Measured memory_bytes: 96812
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main() {

    int N, X, T; cin >> N >> X >> T;
    int ans = N / X * T;
    if (N%X != 0) ans += T;
    cout << ans << endl;


    return 0;
}





Measured memory_bytes: 3640
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        
        for (int i = 0; i < n; i++) {
            int[] pipeB = new int[10];
            int[] pipeC = new int[10];
            int topB = 0;
            int topC = 0;
            boolean isYes = true;
            
            String input = scanner.nextLine();
            String[] data = input.split(" ");
            
            for (int j = 0; j < 10; j++) {
                   int ball = Integer.parseInt(data[j]);
                if (topB == 0) {
                    pipeB[topB++] = ball;
                } else if (pipeB[topB-1] < ball) {
                        pipeB[topB++] = ball;
                } else if (topC == 0) {
                    pipeC[topC++] = ball;
                } else if (pipeC[topC-1] < ball) {
                        pipeC[topC++] = ball;
                } else {
                    isYes = false;
                    break;
                }
            }
            if (isYes) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }   
}

Measured memory_bytes: 17156
A,B,C=map(int,input().split())
K=int(input())
list=[A,B,C]

for i in range(K):
    if list[0]<list[1]<list[2]:
        break
    if list[1]>=list[2]:
        list[2]=2*list[2]
        continue
    elif list[0]>=list[1]:
        list[1]=2*list[1]

if list[0]<list[1]<list[2]:
    print("Yes")
else:
    print("No")


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}


inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}

int main()
{
    ///freopen("output.txt","w",stdout);
  // freopen("input.txt","r",stdin);
    FastIO;

    int n;
    while(cin>>n){


        int a[n+1];

        map<int,int>pos;

        for(int i=1; i<=n; i++){
            cin>>a[i];
            pos[a[i]] = i%2;
        }
        int ans = 0;

        sort(a+1,a+n+1);

        for(int i=1; i<=n; i++){
            ans += (pos[a[i]] != i%2);
        }


        cout<<ans/2<<endl;
    }

    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


Measured memory_bytes: 5376
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>	tree_set;
typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

ll mod=1e9 + 7;

int main()
{
    fast();
    ll r,d,x;
    cin>>r>>d>>x;

    for(ll i=1;i<=10;i++)
    {
        x = r*x - d;
        cout<<x<<endl;
    }
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,t,i;
  scanf("%d%d",&n,&t);
  int a[n+1];
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  int min[n+1],max[n+1];
  min[0]=a[0];
  max[n-1]=0;
  for(i=1;i<n;i++){
    if(min[i-1]>a[i])
      min[i]=a[i];
    else
      min[i]=min[i-1];
    if(max[n-i]<a[n-i])
      max[n-i-1]=a[n-i];
    else
      max[n-i-1]=max[n-i];
  }
  int num=0,cost=max[0]-min[0];
  for(i=0;i<n;i++){
    if(i==0)
      num++;
    else if(cost==max[i]-min[i] && (max[i]!=max[i-1] || min[i]!=min[i-1]))
      num++;
    else if(cost<max[i]-min[i]){
      num=1;
      cost=max[i]-min[i];
    }
  }
  printf("%d\n",num);
  return 0;
}

Measured memory_bytes: 2900
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;

ll solve1(string s,int l,int n){
	ll res=0;
	ll val=1;
	for(int i=l;i<n;i++){
		if(s[i]=='*')continue;
		else if(s[i]=='+'){
			res+=val;
			val=1;
		}
		else{
			val*=(s[i]-'0');
		}
	}
	res+=val;
	return res;
}

ll solve2(string s,int l,int n){
	ll res=s[0]-'0';
	char op='+';
	for(int i=1;i<n;i++){
		if(s[i]=='+'||s[i]=='*'){
			op=s[i];
		}else{
			if(op=='+'){
				res+=(s[i]-'0');
			}else{
				res*=(s[i]-'0');
			}
		}
	}
	return res;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	ll n; cin >> n;
	if(n==solve1(s,0,s.size())){
		if(n==solve2(s,0,s.size())){
			printf("U\n");
		}else{
			printf("M\n");
		}
	}else{
		if(n==solve2(s,0,s.size())){
			printf("L\n");
		}else{
			printf("I\n");
		}
	}
}


Measured memory_bytes: 3256
#include <cstdio>

int main() {
	int I, O, J, L, x;
	scanf("%d%d%*d%d%d", &I, &O, &J, &L);
	x = I % 2 + J % 2 + L % 2;
	printf("%lld\n", (long long)O + I + J + L - (I && J && L && x > 1 ? 3 - x : x));
	return 0;
}

Measured memory_bytes: 1736
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		NumberFinder finder = new NumberFinder();
		
		while(true){
			String str = br.readLine();
			
			if(str == null){
				break;
			}
			
			finder.addNumbers(str);
		}
		
		System.out.println(finder.getSum());
	}

}

class NumberFinder {
	ArrayList<Integer> array = new ArrayList<Integer>();
	
	public void addNumbers(String str){
		String[] tmpArray = str.split("\\D+", -1);
		
		for(int i = 0; i < tmpArray.length ; i++){
			if(!tmpArray[i].equals("")){
				array.add(Integer.parseInt(tmpArray[i]));
			}
		}
	}
	
	public int getSum(){
		int sum = 0;
		for(int i = 0 ; i < array.size(); i++){
			sum += array.get(i);
		}
		return sum;
	}
}

Measured memory_bytes: 24448
L,R = map(int,input().split())
min = 2018
if R - L >= 2019:
	print(0)
else:
	for i in range(L,R):
		for j in range(i+1,R+1):
			if min >= (i*j)%2019:
				min = (i*j)%2019
	print(min)

Measured memory_bytes: 9064
import std.stdio, std.string, std.array, std.conv, std.algorithm.iteration, std.functional;

void main()
{
    auto s = readln.chomp;
    auto n = s.length;
    foreach (c; s) {
        if (c == 'A') break;
        --n;
    }
    foreach_reverse (c; s) {
        if (c == 'Z') break;
        --n;
    }
    writeln(n);
}

Measured memory_bytes: 2556
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int d = a / b;
        int r = a % b;
        double f = (double)a / b;
        System.out.printf("%d %d %.5f", d, r, f);
    }
}


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

int sum(int a){
    int ans = 0;
    for(int i = 1; i <= a; i++){
        ans += i;
    }

    return ans;
}

int main(){
    int n, k;
    cin >> n >> k;
    int p[n];
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    double a[n];
    int su = 0;
    for(int i = 0; i < n; i++){
        su = sum(p[i]);
        a[i] = double(su) / double(p[i]);
    }
    /*for(int i = 0; i < n; i++){
        cout << a[i] << endl;
    }*/

    double now = 0;
    double max = 0;
    for(int i = 0; i < k; i++){
        now += a[i];
    }
    max = now;
    
    for(int i = k; i < n; i++){
        now -= a[i - k];
        now += a[i];
        if(max < now){
            max = now;
        }
    }

    cout << fixed << setprecision(12) << max << endl;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define llong long long
using namespace std;

inline int read()
{
	int x=0; bool f=1; char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=0;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
	if(f) return x;
	return -x;
}

const int N = 1e5;
struct Element
{
	llong x,coe;
	Element() {}
	Element(llong _x,llong _coe) {x = _x,coe = _coe;}
	bool operator <(const Element &arg) const {return x<arg.x;}
};
priority_queue<Element> pq;
llong a[N+3];
llong ans[N+3];
int n,m;

int main()
{
	scanf("%d%d",&n,&m); a[0] = n;
	for(int i=1; i<=m; i++) {scanf("%lld",&a[i]);}
	pq.push(Element(a[m],1ll));
	for(int i=m-1; i>=0; i--)
	{
//		printf("i=%d\n",i);
		llong tmp = 0ll; Element u = pq.top();
		while(u.x>a[i])
		{
			pq.pop();
//			printf("u(%lld,%lld)\n",u.x,u.coe);
			tmp += (u.x/a[i])*u.coe; u.x%=a[i];
//			printf("u'(%lld,%lld)\n",u.x,u.coe);
			if(u.x) {pq.push(u);/* printf("push (%lld,%lld)\n",u.x,u.coe);*/}
			if(pq.empty()) break;
			u = pq.top();
		}
		if(tmp) {pq.push(Element(a[i],tmp));}
	}
	while(!pq.empty())
	{
		Element u = pq.top(); pq.pop();
//		printf("(%lld,%lld)\n",u.x,u.coe);
		ans[u.x] += u.coe;
	}
	for(int i=n-1; i>=1; i--) ans[i] += ans[i+1];
	for(int i=1; i<=n; i++) printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 4976
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int n, s, g, c;

VVI _map;

void warshall_floyd( VVI &root ) {
	for ( int i = 0; i < root.size(); i++ ) {
		for ( int j = 0; j < root.size(); j++ ) {
			for ( int k = 0; k < root.size(); k++ ) {
				root[ j ][ k ] = root[ k ][ j ] = min( root[ j ][ k ], root[ j ][ i ] + root[ i ][ k ] );
			}
		}
	}
}

int gcd( int n, int m ) {
	if ( m == 0 ) {
		return n;
	}
	return gcd( m, n % m );
}

void make_prime( VI &pm, int max ) {
	vector<bool> is_pm( max + 1, true );
	is_pm[ 0 ] = is_pm[ 1 ] = false;
	for ( int i = 2; i * i <= max; i += 2 ) {
		if ( is_pm[ i ] ) {
			for ( int j = i * i; j <= max; j += i ) {
				is_pm[ j ] = false;
				if ( i != 2 ) {
					j += i;
				}
			}
			if ( i == 2 ) {
				--i;
			}
		}
	}
	for ( int i = 2; i <= max; i += 2 ) {
		if ( is_pm[ i ] ) {
			pm.push_back( i );
			if ( i == 2 ) {
				--i;
			}
		}
	}
}


int main() {
	while ( ~scanf( "%d", &n ) && n ) {
		_map.resize( 100 );
		for ( int i = 0; i < 100; i++ ) {
			_map[ i ].resize( 100 );
			for ( int j = 0; j < 100; j++ ) {
				if ( i == j ) {
					_map[ i ][ j ] = 0;
				}
				else {
					_map[ i ][ j ] = INF;
				}
			}
		}
		int max_town = 0;
		for ( int i = 0; i < n; i++ ) {
			scanf( "%d %d %d", &s, &g, &c );
			_map[ s ][ g ] = _map[ g ][ s ] = c;
			max_town = max( max_town, max( g, s ) + 1 );
		}
		warshall_floyd( _map );
		int ans_cost = INF, ans_town;
		for ( int i = 0; i < max_town; i++ ) {
			int cost = 0;
			for ( int j = 0; j < max_town; j++ ) {
				cost += _map[ i ][ j ];
			}
			if ( ans_cost > cost ) {
				ans_cost = cost;
				ans_town = i;
			}
		}
		printf( "%d %d\n", ans_town, ans_cost );
	}
	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.size();

    for(int i=0; i<n; ++i){
        s[i] -= 3;
        if(s[i] < 'A')
            s[i] += 26;
        cout << s[i];
    }
    cout << endl;

    return 0;
}

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

string s,t;
int dp[3001][3001], trace[3001][3001][2];
int solve(int i, int j) {
    if (i >= s.size()) return 0;
    if (j >= t.size()) return 0;
    if (dp[i][j] != -1) return dp[i][j];

    int ans;
    if (s[i] == t[j]) {
        ans = 1 + solve(i+1,j+1);
        trace[i][j][0] = i+1;
        trace[i][j][1] = j+1;
    }
    else {
        int temp1 = solve(i+1, j);
        int temp2 = solve(i, j+1);
        ans = max(temp1,temp2);

        if (temp1 > temp2) {
            trace[i][j][0] = i+1;
            trace[i][j][1] = j;
        }
        else {
            trace[i][j][0] = i;
            trace[i][j][1] = j+1;
        }
    }

    dp[i][j] = ans;
    return ans;
}

string getLCS() {
    string res = "";
    int ch = 0, i = 0, j = 0;
    while (ch < dp[0][0]) {
        int nxti = trace[i][j][0];
        int nxtj = trace[i][j][1];

        if (nxti>i and nxtj>j) {
            res += s[i];
            ch++;
        }
        i = nxti;
        j = nxtj;
    }
    return res;
}

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

    cin>>s>>t;
    memset(dp, -1, sizeof dp);
    solve(0,0);
    cout << getLCS() << endl;

    return 0;
}

Measured memory_bytes: 106240
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int x;
    cin >> x;
    if (x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3636