akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>
#include<boost/multiprecision/cpp_int.hpp>


using namespace std;
using namespace boost::multiprecision;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
template<typename A, typename B>
void mins(A & a, const B & b) { a = min(a, (A)b); };
template<typename A, typename B>
void maxs(A & a, const B & b) { a = max(a, (A)b); };


int main() {
	ll N;
	cin >> N;
	vector<ll> A(N + 1), S(N + 1);
	S[0] = 0;
	REP(i, 1, N + 1) cin >> A[i];
	REP(i, 1, N + 1) S[i] = S[i - 1] + A[i];
	vector<ll> dpl(N+1), dpr(N+1);
	auto f_l = [&](int n, int l) { return abs((S[n] - S[l]) - (S[l] - S[0])); };
	auto f_r = [&](int n, int r) { return abs((S[N] - S[r]) - (S[r] - S[N - n])); };
	dpl[2] = 1;
	REP(i, 3, N + 1) {
		ll tmp = dpl[i - 1];
		while (tmp < i && f_l(i, tmp) >= f_l(i, tmp + 1))++tmp;
		dpl[i] = tmp;
	}
	dpr[2] = N - 1;
	REP(i, 3, N + 1) {
		ll tmp = dpr[i - 1];
		while (N - i + 1 < tmp && f_r(i, tmp) >= f_r(i, tmp - 1)) --tmp;
		dpr[i] = tmp;
	}
	ll ans = 1e18;
	REP(i, 2, N - 1) {
		int l = dpl[i];
		int r = dpr[N - i];
		array<ll,4> a;
		a[0] = S[l];
		a[1] = S[i] - S[l];
		a[2] = S[r] - S[i];
		a[3] = S[N] - S[r];
		ll tmp = *max_element(a.begin(), a.end()) - *min_element(a.begin(),a.end());
		mins(ans, tmp);
	}
	PRI(ans);
	return 0;
}

Measured memory_bytes: 9572
// In the name of Allah the Lord of the Worlds.

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

struct myStruct{

    ll number , fre;

    myStruct(ll _number , ll _fre){

        number = _number;
        fre = _fre;
    }
};

bool operator<(myStruct A , myStruct B)
{

    return A.fre < B.fre;
}

int main(void)
{
    int n;
    scanf("%d",&n);
    vector<myStruct>v;

    for(int i=0;i<n;i++){

        ll in;
        scanf("%lld",&in);

        ll temp = in , counter = 0;

        while(temp%2==0){

            counter++;
            temp/=2;
        }

        v.push_back(myStruct(in , counter));
    }

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

    int si = v.size();

    for(int i=0;i<si/2;i++){

        if(v[i].fre+v[si-1-i].fre<2){si = -1; break;}
    }

    if(si==-1)printf("No\n");
    else printf("Yes\n");

    return 0;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
#define clrg(i, l, r) for(int i=(int)(l);i<(int)(r);i++)vis[i]=0,v[i].clear();
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<"\n";
#define ln length()
#define sz size()
#define mod 1000000007
#define elif else if
int32_t main(){
   int n,x,t; cin>>n>>x>>t;
   int m=ceil((double)n/x)*t;
   cout<<m<<"\n";
   return 0;
}
/*
Edge cases? n=1? a[i]<=0?
long vs int? 1LL? 64bits?
Re-read question. Is it as easy as it seems?
KEEP CORRECTING AND SUBMITTING!
*/


Measured memory_bytes: 3628
#![allow(unused_imports)]
use {
    itertools::Itertools,
    proconio::{fastout, input, marker::*},
    std::cmp::*,
    std::collections::*,
    std::ops::*,
};

#[allow(unused_macros)]
macro_rules !dbg {($($e :expr ) ,*) =>{#[cfg (debug_assertions ) ] $({let (e ,mut err ) =(stringify !($e ) ,std ::io ::stderr () ) ;writeln !(err ,"{} = {:?}" ,e ,$e ) .unwrap () } ) *} ;}

struct UnionFind {
    n: usize,
    par: Vec<usize>,
    rank: Vec<usize>,
}
impl UnionFind {
    fn new(n: usize) -> Self {
        UnionFind {
            n,
            par: (0..n).collect(),
            rank: vec![1; n],
        }
    }
    fn unite(&mut self, x: usize, y: usize) {
        if self.same(x, y) {
            return;
        }
        let rx = self.par[x];
        let ry = self.par[y];
        if self.rank[rx] > self.rank[ry] {
            self.par[ry] = rx;
            self.rank[rx] += self.rank[ry];
        } else {
            self.par[rx] = ry;
            self.rank[ry] += self.rank[rx];
        }
    }
    fn same(&mut self, x: usize, y: usize) -> bool {
        self.root(x) == self.root(y)
    }
    fn root(&mut self, x: usize) -> usize {
        if self.par[x] == x {
            x
        } else {
            self.par[x] = self.root(self.par[x]);
            self.par[x]
        }
    }
    #[allow(dead_code)]
    fn size(&mut self, x: usize) -> usize {
        let r = self.root(x);
        self.rank[r]
    }
    #[allow(dead_code)]
    fn sizes(&mut self) -> Vec<usize> {
        let mut s = vec![];
        for x in 0..self.n {
            if x == self.root(x) {
                s.push(self.rank[x]);
            }
        }
        s
    }
}

#[fastout]
fn main() {
    input! {
       n: usize,
       xy: [(Usize1, Usize1); n]
    }
    let mut xyi = xy
        .iter()
        .enumerate()
        .map(|(i, &(x, y))| (x, y, i))
        .collect::<Vec<_>>();
    xyi.sort();
    let mut uf = UnionFind::new(n);
    let mut s = vec![xyi[0].1];
    for &(_, y, _) in xyi.iter().skip(1) {
        if s[s.len() - 1] < y {
            let yi = s[s.len() - 1];
            let mut yj = None;
            while let Some(s) = s.pop() {
                if s > y {
                    yj = Some(s);
                    break;
                }
                uf.unite(s, y);
            }
            if let Some(yj) = yj {
                s.push(yj);
            }
            s.push(yi);
        } else {
            s.push(y);
        }
    }
    let mut ans = vec![0; n];
    for &(_, y, i) in xyi.iter() {
        ans[i] = uf.size(y);
    }
    println!("{}", ans.iter().format("\n"));
}


Measured memory_bytes: 16968
N=int(input())
L=list(map(int,input().split()))

ans=0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i] and ((L[i]+L[j])>L[k] and (L[j]+L[k])>L[i] and (L[k]+L[i])>L[j]):
                ans+=1

print(ans)

Measured memory_bytes: 9212
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#define ll long long int

using namespace std;

int n,l;
vector <string> v;

int main()
{
    ///freopen("INA.txt","r",stdin);
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>> n >> l;
    for(int i=1;i<=n;i++){
        string s;
        cin>> s;
        v.push_back(s);
    }

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

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

    return 0;
}



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

const int N = 1e5 + 100;

int n, ind[N], dp[N];
int sum, mn;
bool vis[N];
char s[N];

struct edg {
  int v;
  edg *nxt;
} pol[N << 1], *h[N], *cur = pol;

void add(int u, int v) {
  edg *p = ++cur, *q = ++cur;
  ind[u]++, ind[v]++;
  p->v = v, p->nxt = h[u], h[u] = p;
  q->v = u, q->nxt = h[v], h[v] = q;
}

void topo() {
  queue <int> Q;
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'B' && ind[i] == 1) {
      Q.push(i);
    }
  }
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    vis[u] = 1;
    for (edg *p = h[u]; p; p = p->nxt) {
      int v = p->v;
      if (ind[v]) ind[v]--;
      if (s[v] == 'B' && ind[v] == 1 && vis[v] == 0) {
        Q.push(v);
      }
    }
  }
}

int tp(int u) {
  return (ind[u] & 1) ^ (s[u] == 'W');
}

int val(int u) {
  return tp(u) == 1 ? -2 : 0;
}

void dfs(int u, int fa) {
  sum += (tp(u) == 1) + 2;
  dp[u] = val(u);
  for (edg *p = h[u]; p; p = p->nxt) {
    int v = p->v;
    if (v == fa || vis[v]) continue ;
    dfs(v, u);
    mn = min(mn, dp[u] + dp[v]);
    dp[u] = min(dp[u], dp[v] + val(u));
  }
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    add(u, v);
  }
  scanf("%s", s + 1);
  topo();
  int x = 1;
  while (x <= n) {
    if (vis[x] == 0) break ;
    x++;
  }
  dfs(x, 0);
  sum -= 2;
  printf("%d\n", sum + mn);
  return 0;
}

Measured memory_bytes: 9344
import java.util.Scanner;

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

		int n = sc.nextInt();
		int[] c = new int[n - 1];
		int[] s = new int[n - 1];
		int[] f = new int[n - 1];

		for (int i = 0; i < n - 1; i++) {
			c[i] = sc.nextInt();
			s[i] = sc.nextInt();
			f[i] = sc.nextInt();
		}

		for (int i = 0; i < n; i++) {
			if (i == n - 1) {
				System.out.println(0);
				break;
			}
			int t = s[i];
			for (int j = i; j < n - 1; j++) {
				while (t < s[j] || t % f[j] != 0) {
					t++;
				}
				t += c[j];
			}
			System.out.println(t);
		}
		sc.close();
	}

}


Measured memory_bytes: 26244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
const ll mod = 1000000000 + 7;
#define NMAX 100010

ll dp[NMAX][13];

void init(){
    rep(i, 0, NMAX) rep(j, 0, 13) dp[i][j] = 0;
}

int main(){

    init();

    string s;
    cin >> s;
    ll n = s.size();
    reverse(s.begin(), s.end());

    ll pw = 1;
    dp[0][0] = 1;
    rep(i, 0, n) {
        if(s[i] == '?') {
            rep(j, 0, 13) {
                rep(k, 0, 10) {
                    // j に k*pw を足した時の遷移
                    ll nj = (j + k * pw) % 13;
                    dp[i+1][nj] += dp[i][j];
                    dp[i+1][nj] %= mod;
                }
            }
        } else {
            rep(j, 0, 13) {
                ll now = s[i] - '0';
                ll nj = (j + now * pw) % 13;
                dp[i+1][nj] += dp[i][j];
                dp[i+1][nj] %= mod;
            }
        }
        pw *= 10;
        pw %= 13;
    }

    cout << dp[n][5] << endl;
    return 0;
}

Measured memory_bytes: 13912
import math
N, M = map(int, input().split())
d = []
for i in range(1, int(math.sqrt(M)) + 1):
    if M % i == 0:
        d.append(i)
        d.append(int(M / i))
d = list(filter(lambda x: x <= int(M / N), d))
print(max(d))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{

    long long a,b,c=0,d,e=0,g,h,i,j,k;
    double aa,bb,cc,dd;
    cin>>a>>b;
    vector<long>vc[12];
    for(i=0; i<a; i++)
    {
        for(j=0; j<b; j++)
        {
            cin>>d;
            vc[i].push_back(d);
        }

    }
    for(i=0; i<a-1; i++)
    {
        for(j=i+1; j<a; j++)
        {
            e=0;
              for(k=0; k<b; k++)
            {
                e=e+(vc[i][k]-vc[j][k])*(vc[i][k]-vc[j][k]);
            }
            aa=sqrt(e);
            h=sqrt(e);
            bb=(double)h;
            if(aa==bb)
                c++;

        }

    }


cout<<c;


}


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

int n, w[110], s, t, m;

int main(){
	cin >> n;
	s = t = 0;
	for (int i = 0; i < n; ++i){
		cin >> w[i];
		s += w[i];
	}
	m = s;
	for (int i = 0; i < n; ++i){
		t += w[i];
		if (abs(2*t - s) < m) m = abs(2*t - s);
	}
	cout << m;
}

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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>

const int mod=1e9+7;
int lowbit(int x) {return x&(-x);}

struct G{
	int e[55][55];
} g;
int n;
ll k;

G by(G a,G b) {
	G res;
	for (int i=0;i<n;i++)
		for (int j=0;j<n;j++) res.e[i][j]=0;
	for (int k=0;k<n;k++)
		for (int i=0;i<n;i++)
			for (int j=0;j<n;j++)
				(res.e[i][j]+=(ll)a.e[i][k]*(ll)b.e[k][j]%mod)%=mod;
	return res;
}

G power(G base,ll d) {
	G res;
	for (int i=0;i<n;i++) 
		for (int j=0;j<n;j++) {
			if (i==j) res.e[i][i]=1;
			else res.e[i][j]=0;
		}
	while (d) {
		if (d&1) res=by(res,base);
		base=by(base,base);
		d>>=1;
	}
	return res;
}

int main(){
	cin>>n>>k;
	for (int i=0;i<n;i++)
		for (int j=0;j<n;j++) scanf("%d",&g.e[i][j]);
	G tmp=by(g,g);
	g=power(g,k);
	int ans=0;
	for (int i=0;i<n;i++)
		for (int j=0;j<n;j++) (ans+=g.e[i][j])%=mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 384
n=int(input())
a=[]
for _ in range(2):
  x=list(map(int, input().split()))
  a.append(x)

ans=0
for i in range(n):
  tmp=sum(a[0][:i+1])+sum(a[1][i:])
  ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 38512
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    string s; cin >> s;
    int N; cin >> N;

    int ans = 0;
    for(int i=0; i<N; i++) {
        string pat; cin >> pat;
        pat += pat;
        if(pat.find(s) != string::npos) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3208
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
in p2(in a){
  return 1LL<<a;
}
VVI egs;
const in mx=50;
pair<in,in> dfs(in u, in pr){
  VI hv(mx,0);
  pair<in,in> tp;
  forv(i,egs[u]){
    if(egs[u][i]==pr)
      continue;
    tp=dfs(egs[u][i],u);
    forn(j,tp.second+1){
      if(tp.first&p2(j))
	++hv[j];
    }
  }
  in tt=mx-1;
  while(tt>=0 && hv[tt]<=1)
    --tt;
  ++tt;
  while(hv[tt])
    ++tt;
  hv[tt]=1;
  in tmsk=0;
  while(tt<mx){
    if(hv[tt])
      tmsk|=p2(tt);
    ++tt;
  }
  --tt;
  while(!hv[tt])
    --tt;
  return MP(tmsk,tt);
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n;
  cin>>n;
  egs.resize(n);
  in ta,tb;
  forn(z,n-1){
    cin>>ta>>tb;
    --ta;
    --tb;
    egs[ta].PB(tb);
    egs[tb].PB(ta);
  }
  cout<<dfs(0,0).second<<endl;
  return 0;
}


Measured memory_bytes: 39984
N,u,v = map(int,input().split())
E = [[] for _ in range(N + 1)]
for i in range(N-1):
    a,b = map(int,input().split())
    E[a].append(b)
    E[b].append(a)
#print(E)
def bfs(start,N):
    d = [-1]*(N+1)
    d[start] = 0
    q = [start]
    while q:
        #print(d,q)
        v = q.pop()
        cnt = d[v]+1
        for i in E[v]:
            if(d[i] == -1):
                q.append(i)
                d[i] = cnt
    return d
taka = bfs(u,N)
aoki = bfs(v,N)
#print(taka,aoki)
fin = 0
for i in range(N+1):
    if(taka[i] < aoki[i]):
        fin = max(fin,aoki[i])
print(fin - 1)

Measured memory_bytes: 28464
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main(){
	int N;
	cin >> N;
	long a[N];
	for (int i = 0; i < N; ++i)
		cin >> a[i];

	long res = 0;
	for (int i = 0; i < N; ++i)
		res += a[i] - 1;

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
S = input()
S1 = int(S[0:2])
S2 = int(S[2:4])

flag_year = {}
flag_month = {}

flag_YYMM = True
flag_MMYY = True

if S1 == 0:
    flag_MMYY = False
elif S1 >= 13:
    flag_MMYY = False

if S2 == 0:
    flag_YYMM = False
elif S2 >= 13:
    flag_YYMM = False

if flag_YYMM == True and flag_MMYY == True:
    print("AMBIGUOUS")
elif flag_YYMM == True:
    print("YYMM")
elif flag_MMYY == True:
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 3064
#include <iostream>

bool solve()
{
    int b;
    std::cin >> b;
    if (b == 0) {
        return false;
    }

    int sum = 0, L = 1, R = 1;
    while (true) {
        sum += R;
        R++;
        
        while (sum > b) {
            sum -= L;
            L++;
        }

        if (sum == b) {
            std::cout << L << " " << R - L << std::endl;
            break;
        }
    }

    return true;
}

int main()
{
    while (solve());
    return 0;
}



Measured memory_bytes: 3068
# -*- coding: utf-8 -*-
N = int(input())
ans_list = [0 for i in range(N + 1)]
for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            now_num = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if now_num > N:
                break
            ans_list[now_num] += 1

for i in range(1, N + 1):
    print(ans_list[i])

Measured memory_bytes: 9300
A, B, AB, X, Y = map(int,input().split())

ans = 0
if A + B < 2*AB:
    ans += min(X,Y) * (A+B)
else:
    ans += min(X,Y) * 2 * AB

X, Y = X-min(X,Y), Y-min(X,Y)

if X > 0:
    ans += min(X*A, 2*X*AB)
else:
    ans += min(Y*B, 2*Y*AB)

print(ans)

Measured memory_bytes: 9196
#include<string>
#include<iostream>
#include<cctype>
using namespace std;
int main(){
    string a,b,c;
    int x=0,y;
    cin >> a;
    while(1){
        b="";
        cin >> c;
        y=c.size();
        if(c=="END_OF_TEXT"){
               cout << x << endl;
            break;
        }
        for(int i=0;i<y;i++){
            b += tolower(c[i]);
        }
        if(b==a){
            x++;
        }
    }return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;


int main() {
int N, C, K; cin >> N >> C >> K;
VI T(N); rep(i, 0, N) scanf("%d", &T[i]);

sort(ALL(T));

int bus=0, pass, leavetime;

for(int i = 0; i < N;){
    pass = 0;
    leavetime= T[i] + K;
    for (; i < N && pass < C && T[i] <= leavetime; ++i) {
        ++pass;
    }
    ++bus;
}

cout << bus << "\n";

return 0;
}

// 境界，出力文字列 チェック
// int は ± 2*10⁹.


Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	as := make([]int, 3)
	bs := make([]int, 3)

	for i := 0; i < 3; i++ {
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%d %d", &as[i], &bs[i])
	}

	mp := make(map[int]int)
	for _, a := range as {
		mp[a]++
	}
	for _, b := range bs {
		mp[b]++
	}
	//fmt.Println(mp)

	cnt1 := 0
	cnt2 := 0
	for _, cnt := range mp {
		if cnt == 1 {
			cnt1++
		} else if cnt == 2 {
			cnt2++
		}
	}

	if cnt1 == 2 && cnt2 == 2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


Measured memory_bytes: 640
#input
N = int(input())
A = [[int(j) for j in input().split()] for i in range(N)]

length = []

l = 0
for i in A:
    for j in A:
        if i == j:
            continue
        l += (((j[0] - i[0])**2 + (j[1] - i[1])**2)**0.5)
        for k in A:
            if j == k or i == k:
                continue
            l += (((k[0] - j[0])**2 + (k[1] - j[1])**2)**0.5)
        length.append(l)
        l = 0

print(sum(length)/len(length))



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

public class Main {
	private static void solve(){
		//Implement solution here.
		long k = nl();
		long a = nl();
		long b = nl();
		long result = 0;
		
		if(a >= b - 1){
			result = 1 + k;	
    	}else{
    		if(k < a + 1){
    			result = 1 + k;
    		}else{
    			result += a + (b - a) * ((k - a + 1) / 2);
    			result += (k - a + 1) % 2;
    		}
    	}
    	System.out.println(result);
	}

    //Switch input source (stdin/file)
	private static Scanner scanner = new Scanner(System.in);
	public static void main(String[] args){
        String debugDataPath = System.getenv("DD_PATH");        
        if(debugDataPath != null){
            try{
                scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath)))));
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        }
        solve();
	}

    //Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(scanner.nextLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
    //Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
    //Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
    //Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
    //Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
    //Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 22868
import java.util.*;

public class Main {
	
	public static void main(String[] args) {

		// argumentの取得
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
	    int y = sc.nextInt();
      
		// 戻り値の返却
        if ( x < 10 && y < 10) {
          System.out.println(x * y);
        } else {
          System.out.println(-1);
        }
		
	
	} 
}

Measured memory_bytes: 22228
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if(s == u) cout << a - 1 << ' ' << b << endl;
    else cout << a << ' ' << b - 1 << endl;
    return 0;
}

Measured memory_bytes: 3592
#coding:utf-8
import sys
 
ab=sys.stdin.readline()
a,b=ab.split( ' ' )
a=int( a )
b=int( b )
if a < b:
	print( "a < b" )
elif a > b:
	print( "a > b" )
else:
	print( "a == b" )

Measured memory_bytes: 6724
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = ~~arg[0];
    const a = arg[1].split(" ").map(n=>~~n);
    
    const limit = [];
    
    for(let i in a) {
        let cnt = 0;
        
        while(a[i] % 2 === 0 || a[i] === 0) {
            a[i] = a[i] / 2;
            cnt++;
        }
        
        limit.push(cnt);
        cnt = 0;
    }
    
    console.log(limit.reduce((m,n)=>m+n));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
	ll n,m=0;
	cin>>n;
	ll t=n;
	while(t){
		m++;
		t=t/10;
	}
	ll ans=0;
	if(m%2==1) ans=n-pow(10,m-1)+1,m--;
	//cout<<ans<<endl;
	for(int i=m;i>0;){
		ans=ans+pow(10,i-1)-pow(10,i-2);
		i-=2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>

int main(){
  char x;
  int s;

  while(x != '\n'){
  SCAN: 
    scanf("%c", &x);
    s += atoi(&x);
    if(s == 0) goto END;
  }
  printf("%d\n",s);
  s = 0;
  goto SCAN;

 END:
  return 0;
}

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

char* change(char* str);

int main(){
	char* str1=new char[10];
	char* str2=new char[1001];
	int count=0;
	memset(str1,'\0',10);
	memset(str2,'\0',1001);

	scanf("%s",str1);
	str1=change(str1);
	while(1){
		scanf("%s",str2);
		if(strcmp(str2,"END_OF_TEXT")==0){
			break;
		}
		str2=change(str2);
		if(strcmp(str2,str1)==0){
			count++;
		}
	}
	printf("%d\n",count);
	delete [] str1;
	delete [] str2;
	return 0;
}
char* change(char* str){
	for(int i=0; i<(int)strlen(str); i++){
		if(str[i]>='A' && str[i]<='Z'){
			str[i]+='a'-'A';
		}
	}
	return str;
}



Measured memory_bytes: 2752
#include <iostream>

using namespace std;

int main(void){
  int N;
  string S;
  cin >> N >> S;

  //スライムの数を格納する
  int ans = 1;
  for(int i=0; i<N-1; i++){
    //スライムiの色が，スライムi+1の色と同じであれば統合(数は変わらない)
    if(S[i] == S[i+1])
      continue;
    //色が違えば統合できないので数を増やす
    else
      ans++;
  }

  cout << ans << endl;
    
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <numeric>

int main()
{
   int nBox;
   std::cin >> nBox;
   std::vector<int> a(nBox + 1, 0);
   for (int iBox = 0; iBox < nBox; iBox++) {
      std::cin >> a[iBox + 1];
   }
   std::vector<int> hasBall(nBox + 1, 0);
   for (int iBox = nBox; iBox > 0; iBox--) {
      hasBall[iBox] = a[iBox];
      int times = 2;
      while (iBox * times <= nBox) {
         hasBall[iBox] ^= hasBall[iBox * times];
         times++;
      }
   }
   std::cout << std::accumulate(hasBall.begin(), hasBall.end(), 0) << std::endl;
   for (int iBox = 1; iBox <= nBox; iBox++) {
      if (hasBall[iBox]) {
         std::cout << iBox << std::endl;
      }
   }
   return 0;
}


Measured memory_bytes: 2432
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

for i in range(3):
	if S[i] == S[i+1]:
		print("Bad")
		break
else:
	print("Good")
	

Measured memory_bytes: 5780
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double h = 0;
		double w = 0;
		while(sc.hasNext()){
			String in = sc.nextLine();
			String[] ch = in.split(",");
			h = Double.parseDouble(ch[2]); 
			w = Double.parseDouble(ch[1]);
			if(w / h /h >=25)
				System.out.println(ch[0]);
				}
		}
	}

Measured memory_bytes: 26096
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
typedef long double db;
#define pb push_back
#define mp make_pair
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define np(str) next_permutation(str.begin(),str.end())
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rev(p) reverse(p.begin(),p.end());
#define v vector
#define PI 3.1415926535
#define len length()
#define repc(i,s,e) for(ll i=s;i<e;i++)
#define fi first
#define se second
#define mset(a,val) memset(a,val,sizeof(a));
#define mt make_tuple
#define repr(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for( i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll M = 1e9 + 7 ;
ll inf = 1e18;

ll n, m;
v<ll>  used;
v<v<ll>> adj;
ll cnt = 0;
void dfs(ll s) {
	used[s] = 1;
	cnt++;
	for (auto u : adj[s]) {
		if (!used[u]) {
			dfs(u);
		}
	}
}
int main() {
	// your code goes here
	IOS;

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll i, j, k, t, x, y, z,  N;
	cin >> n >> m;
	adj.resize(n);
	map<pair<ll, ll>, ll> edge;
	rep(i, m) {
		cin >> x >> y;
		if (edge[ {x, y}] == 0) {
			adj[x - 1].pb(y - 1);
			adj[y - 1].pb(x - 1);
			edge[ {x, y}] = 1;
		}
	}
	used.assign(n, 0);
	ll mx = 0;
	cnt = 0;
	rep(i, n) {
		if (!used[i]) {
			dfs(i);
			mx = max(mx, cnt);
			cnt = 0;
		}
	}
	cout << mx;






	return 0;
}

Measured memory_bytes: 34324
#include<bits/stdc++.h>
using namespace std;
#define all(s) s.begin(), s.end()
string yn(bool p){ if(p) return "Yes"; return "No"; }


auto x()
{
	int N; string s;
	cin >> s; sort(all(s));
	return yn(s=="abc");
}
int main()
{
	cout << x() << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
LL gcd(LL a,LL b)
{
	if (!b) return a;
	return gcd(b,a%b);
}
int main()
{
	int n,k,d=0,a,m=0;
	cin>>n>>k;
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a);
		d=gcd(d,a);
		m=max(m,a);
	}
	if (m>=k&&(k%d)==0) cout<<"POSSIBLE";
	else cout<<"IMPOSSIBLE";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  string s;
  string t;
  
  cin >> s;
  sort(s.begin(), s.end());
 
  cin >> t;
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
 
  if(s < t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
 
}

Measured memory_bytes: 256
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

def binsearch(threshold, lst):
    left, right = -1, len(lst)
    while right - left > 1:
        mid = (left + right) // 2
        if lst[mid] < threshold:
            right = mid
        else:
            left = mid
    return right


last=[]
for val in A:
    temp = binsearch(val, last)
    if temp == len(last):
        #last.insert(0, val)
        last.append(val)
    else:
        last[temp] = val
    #print(last)
print(len(last))




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

int main(){
	int a=1,b=1;
while(a!=0||b!=0){
	scanf("%d %d",&a,&b);
	if(a==0&&b==0){
		break;
	}
	if(a>b){
	printf("%d %d\n",b,a);}
	else
	printf("%d %d\n",a,b);
}
return 0;
}


Measured memory_bytes: 3116
int main(int argc, const char * argv[]){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else if(a==b){
        printf("a == b\n");
    }
    return 0;
}

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

int main() {
    string str,str1;
    cin>>str>>str1;
    int n=str.length(),c=0;
    for(int i=0;i<n;i++)
    {
        if(str[i]!=str1[i])
        c++;
    }
    cout<<c<<endl;
	return 0;
}


Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
int main(){
	string a;
	cin >> a;
	if(a=="Sunny") cout<<"Cloudy"<<endl;
	if(a=="Cloudy") cout<<"Rainy"<<endl;
	if(a=="Rainy") cout<<"Sunny"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,d[100005];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>d[i];
  }
  sort(d,d+n);
  cout<<abs(d[n/2]-d[n/2-1])<<"\n";
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define DUMP(x) cout << #x << " = " << (x) << endl;
#define REP(i, n) for(size_t i = 0; i < (n); i++)
#define REPR(i, n) for(size_t i = (n); i >= 0; i--)
#define FOR(i, a, b) for(size_t i = (a); i < (b); i++)
#define FOREACH(x, a) for(auto& (x) : (a))

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

ld W, H, x, y;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> W >> H >> x >> y;
    ld area = W * H / 2;
    bool is_multiple = (W / 2 == x) && (H / 2 == y);
    cout << fixed << setprecision(10) << area << " " << ((is_multiple) ? "1" : "0") << "\n";
}

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

using namespace std;














int main(){

    int A = 0;
    int B = 0;
    int C = 0;
    int X = 0;
    int Y =0;
    int way =0;

    cin >> A >> B >> C >> X;



    for(int i=0;i<=A;i++){
        for(int j=0;j<=B;j++){
            for(int k=0;k<=C;k++){
              Y = 500*i+100*j+50*k;
              if(Y==X) way++;   
            }
        }
    }

    cout << way;
 
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int m[105];

int main(){

	int N,X;

	scanf("%d %d",&N,&X);

	int i;

	int min_m=10000;

	for(i=0;i<N;i++){
	scanf("%d",&m[i]);
	if(min_m>m[i]){min_m=m[i];}
	}

	for(i=0;i<N;i++){
	X-=m[i];
	}

	int ans=N;

	while(1){	
		if(X-min_m<0){break;}
		X-=min_m;
		ans++;
	}

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


	return 0;
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var N, A, B int
	fmt.Scan(&N, &A, &B)
	fmt.Println(max(0, A+(B*(N-1))-(B+(A*(N-1)))+1))
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}


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

using namespace std;

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

#define REP(i, n) for(int i=0; i<n; ++i)
#define FOR(i, a, b) for(int i=a; i<b; ++i)
#define FORR(i, a, b) for(int i=b-1; i>=a; --i)

const int INF=1<<20;
int h, w, d[60][60], dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
char s[60][60];

void bfs(){
	queue<pii> q;
	REP(i, h){
		REP(j, w) d[i][j]=INF;
	}
	q.push(pii(0, 0));
	d[0][0]=0;
	while(q.size()){
		pii p=q.front();
		q.pop();
		if(p.first==h-1 && p.second==w-1) return;
		REP(i, 4){
			int nx=p.first+dx[i];
			int ny=p.second+dy[i];
			if(nx>=0 && nx<h && ny>=0 && ny<w && s[nx][ny]!='#' && d[nx][ny]==INF){
				q.push(pii(nx, ny));
				d[nx][ny]=d[p.first][p.second]+1;
			}
		}
	}
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>h>>w;
	int count=0;
	REP(i, h){
		REP(j, w){
			cin>>s[i][j];
			if(s[i][j]=='.') ++count;
		}
	}
	bfs();
	d[h-1][w-1]!=INF ? cout<<count-d[h-1][w-1]-1<<'\n' : cout<<-1<<'\n';
	return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    X = [int(x) for x in input().split()]

    ans = float("inf")
    for a in range(1, 101):
        tmp = 0
        for x in X:
            tmp += (x - a) ** 2
        ans = min(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
    int n, i, j, flag = 0, mochi = 0;
    int d[100];
    cin >> n;
    for(i = 0; i < n; i++)
    {
        cin >> d[i];
        mochi++;
        if(i > 0)
        {
            for(j = 0; j < i; j++)
            {
                if(d[j] == d[i])
                {
                    mochi--;
                  //  flag = 1;
                    break;
                }
            }
        }
     /*   if(flag != 1)
        {
            mochi++;
        }
        flag = 0;*/
    }
    cout << mochi << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
dp = [[-1 for i in range(3010)] for j in range(3010)]
for i in range(3010):
    dp[i][i] = 0
for len in range(1, N+1):
    for i in range(N - len + 1):
        j = i + len
        if (N - len) % 2 == 0: # 前が誰の手番であったか
            # 先手番
            dp[i][j] = max(dp[i+1][j] + a[i], dp[i][j-1] + a[j-1]) # lenが1つ短いものから遷移

        else:
            # 後手番
            dp[i][j] = min(dp[i+1][j] - a[i], dp[i][j-1] - a[j-1])
print(dp[0][N])

Measured memory_bytes: 153212
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            // 整数の入力

            //string[] input = Console.ReadLine().Split(' ');
            //int ans;
            //int A= int.Parse(input[0]);
            //int B= int.Parse(input[1]);

            int N = int.Parse(Console.ReadLine());//整数
            int a;//奇数
            float ans;//答え
            int c=0;//カウンター

            for (a = 1; a <= N; a++)
            {
                if (a % 2 != 0)
                {
                    c++;


                }
                else
                {

                }
            }
            ans = (float)c / N;
                Console.WriteLine(ans);
            

        }
    }
}

Measured memory_bytes: 13140
H,W,D=map(int,input().split())
A = [[] for i in range(H)]

for i in range(H):
	A[i] = list(map(int,input().split()))
rev = [0] * (H * W + 1)
for i in range(H):
	for j in range(W):
		rev[A[i][j]] = i * W + j

cum_sum = [0] * (H * W + 1)
for i in range(1, H * W - D + 1):
	crow = rev[i] // W
	ccol = rev[i] % W
	nrow = rev[i + D] // W
	ncol = rev[i + D] % W
	cum_sum[i + D] = cum_sum[i] + abs(crow - nrow) + abs(ccol - ncol)

Q = int(input())
for i in range(Q):
	L,R = map(int,input().split())
	res = cum_sum[R] - cum_sum[L];
	print(res)


Measured memory_bytes: 16344
N, M = map(int, input().split())

lis = [1] * 10 ** 5
ind_red = [False] * 10 ** 5
ind_red[0] = True
for m in range(M):
    x, y = map(int, input().split())
    if ind_red[x - 1] and lis[x - 1] >= 2:
        ind_red[y - 1] = True
    elif ind_red[x - 1] and lis[x - 1] < 2:
        ind_red[y - 1] = True
        ind_red[x - 1] = False
    lis[x - 1] -= 1
    lis[y - 1] += 1
print(sum(ind_red))

Measured memory_bytes: 4596
let N = Int(readLine()!)!
let digit = N % 10
if digit == 2 || digit == 4 || digit == 5 || digit == 7 ||
  digit == 9 {
  print("hon")
} else if digit == 0 || digit == 1 || digit == 6 || digit == 8 {
  print("pon")
} else {
  print("bon")
}

Measured memory_bytes: 7676
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

ll modfact(ll n){
	if(n > 1){
		return n * modfact(n - 1) % mod;
	}
	else{
		return 1;
	}
}



int main(){
	ll n;cin>>n;
	cout << modfact(n) << endl;
	return 0;
}

Measured memory_bytes: 1792
import sys
sys.setrecursionlimit(10**5)
def solve():
    N,M = map(int,input().split())
    G = [[False]*N for _ in range(N)]
    for _ in range(M):
        a, b = map(int,input().split())
        a -= 1
        b -= 1
        G[a][b] = True
        G[b][a] = True
    
    visited = [False] * N
    print(dfs(0, G, visited[:], N))

def dfs(now, G, visited, N):
    visited[now] = True
    if not (False in visited):
        return 1
    
    cnt = 0
    for next in range(N):
        if not visited[next] and G[now][next]:
            cnt += dfs(next,G,visited[:],N)
    
    return cnt

if __name__ == '__main__':
    solve()

Measured memory_bytes: 42332
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int up_time = (h1*60)+m1;
    int sleep_time = (h2*60)+m2;
    int duration = (sleep_time - k) - (up_time);
    cout<<duration<<"\n";
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
#define all(a)  (a).begin(), (a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i = 0; i < n; i++)
#define repR(i,n) for(int i = n; i >= 0; i--)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define PB push_back
#define MP make_pair
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    sort(rall(h));
    int minv = INF;
    rep(i,n-k+1){
        int v = h[i] - h[i+k-1];
        minv = min(minv,v);
    }
    cout << minv << endl;
    return 0;
}


Measured memory_bytes: 768
H, W = map(int, input().split())
S = [list(input().replace(".", "0")) for _ in range(H)]

def f(m, i, j):
    if 0 <= i-1:
        start = j-1 if 0 <= j-1 else j
        end = j+2 if j+2 <= W else j+1
        for k in range(start, end):
            if m[i-1][k] != "#":
                m[i-1][k] = str(int(m[i-1][k]) + 1)
    if i+1 < H:
        start = j-1 if 0 <= j-1 else j
        end = j+2 if j+2 <= W else j+1
        for k in range(start, end):
            if m[i+1][k] != "#":
                m[i+1][k] = str(int(m[i+1][k]) + 1)
    if 0 <= j-1:
        if m[i][j-1] != "#":
            m[i][j-1] = str(int(m[i][j-1]) + 1)
    if j+1 < W:
        if m[i][j+1] != "#":
            m[i][j+1] = str(int(m[i][j+1]) + 1)
    return m

for h in range(H):
    for w in range(W):
        if S[h][w] == "#":
            S = f(S, h, w)

for h in range(H):
    print("".join(S[h]))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(x) for(auto it=(x).begin();it!=(x).end();it++) 
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
 
using namespace std;

int main(){
    int n;
    while(cin>>n){
        if(n==0)break;
        int mi=INF,ma=0;
        int sum=0;
        for(int i=0;i<n;i++){
            int x; cin>>x;
            sum+=x;
            mi=min(mi,x);
            ma=max(ma,x);
        }
        cout<<(sum-ma-mi)/(n-2)<<endl;
    }
    
    return 0;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, M; cin >> N >> M;
	int K; cin >> K;
	vector<int>A(N); rep(i, 0, N) { cin >> A[i]; }
	vector<int>B(M); rep(i, 0, M) { cin >> B[i]; }
	A.eb(K + 1);
	B.eb(K + 1);

	int i = 0;
	int sum = 0;
	while (i < N and sum + A[i] <= K) {
		sum += A[i];
		i++;
	}
	int ans = i;
	int j = 0;
	while (i > 0) {
		while (j < M and sum + B[j] <= K) {
			sum += B[j];
			j++;
		}
		chmax(ans, i + j);
		sum -= A[--i];
	}
	while (j < M and sum + B[j] <= K) {
		sum += B[j];
		j++;
	}
	chmax(ans, i + j);
	cout << ans << endl;



	return 0;
}


Measured memory_bytes: 7952
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
typedef long long ll;
#define MOD 1000000007

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    
    if(a > b) {
        for(int i = 0; i < a; i++) {
            cout << b;
        }
        cout << endl;
    }
    else {
        for(int i = 0; i < b; i++) {
            cout << a;
        }
        cout << endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    for (int i = 1; i <= 5; i++) {
        int x;
        cin >> x;
        if (x == 0)
            cout << i << endl;
    }
        
    return 0;
}


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[]str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		long K = long.Parse(str[1]);
		int[]A = new int[N];
		string[]str2 = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = int.Parse(str2[i]);
		}
		int t = 0;
		long ct = 0;
		long[]B = new long[N];
		while(true){
 			//Console.Error.WriteLine(B[t]+" "+ct);
			if(B[t] > 0){
				ct += (K - ct)/(ct - B[t])*(ct - B[t]);
              	B[t] = ct;
			} else {
               B[t] = ct;
            }
			if(ct==K){
				Console.WriteLine(t+1);
				break;
			}
			t = A[t]-1;
			ct++;
		}
	}
}

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

int main(void)
{
    long k;
    long i = 1;

    scanf("%ld", &k);

    long x = 7 % k;
    for (i = 1; i <=k; i++) {
        if (x == 0) {
            printf("%ld", i);
            return 0;
        }
        x = (x * 10 + 7) % k;
    }
    printf("-1");

    return 0;
}

Measured memory_bytes: 1708
import java.util.*;

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

        int[] ant = new int[5];
        int k;
        boolean judge =true;
        int A = 0;

        for(int i = 0;i < ant.length;i++){
            ant[i] = sc.nextInt();
        }

        k = sc.nextInt();

        for(int i = 0;i < ant.length;i++){
            for(int j = i+1;j < ant.length;j++){
                A = ant[j] - ant[i];
                if(k < A)
                    judge = false;
            }
        }

        if(judge == false){
            System.out.println(":(");
        }else
            System.out.println("Yay!");

    }
}

Measured memory_bytes: 22996
/*input

*/

#include <bits/stdc++.h>
#include <unistd.h>

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define UQ(x) (x).resize(distance((x).begin(),unique(x.begin(),x.end())))

using namespace std;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rnd64(chrono::high_resolution_clock::now().time_since_epoch().count());

ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2) ans*=a, ans%=(mod);
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}

void solve(){
	ll i,j,_;
	ll x;
	cin>>x;
	if(x > 29) cout << "Yes\n";
	else cout << "No\n";
}

int main()
{
	ios::sync_with_stdio(0);
 	cin.tie(0);
	ll T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}




Measured memory_bytes: 3580