akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
             1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int k;
  cin >> k;
  cout << a[k - 1] << endl;
}


Measured memory_bytes: 256
import math

def main():
	n, a, b = [int(x) for x in input().split(" ")]
	# 2^n - 1 - nCa - nCb
	p = 1000000007
	a = min([a, n - a])
	b = min([b, n - b])
	M = max([a, b])
	f = [1, 1]
	finv = []
	for i in range(M):
		f.append((f[-1] * (i + 2)) % p)
	lf = len(f)
	finv.append(modpower(f[-1], p - 2, p))
	for i in range(lf - 1):
		finv.append((finv[-1] * (lf - i - 1)) % p)
	na = 1
	nb = 1
	for i in range(M):
		if a > i:
			na = (na * (n - i)) % p
		if b > i:
			nb = (nb * (n - i)) % p
	print((modpower(2, n, p) - 1 - (na * finv[lf - 1 - a]) % p - (nb * finv[lf - 1 - b]) % p) % p)


def modpower(a, p, d): # a^p % d
	pp = [a]
	for i in range(int(math.log2(p)) + 1):
		pp.append((pp[-1] ** 2) % d)
	b_p = format(p, 'b')
	m = 1
	for i in range(len(b_p)):
		if b_p[-i-1] == "1":
			m = (m * pp[i]) % d
	return m

main()

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

using namespace std;

typedef long long ll;
#define endl '\n'

int N;

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

    cin >> N;
    ll m = 0;
    int aux;
    int r=0;
    for(int i=0;i<N;i++)
    {
        cin >> aux;
        m+=(aux+r)/2;
        r = aux ? (aux+r)%2 : 0;
    }

    cout << m << endl;
    return 0;
}



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

typedef long long ll;

main()
{
    int n, i, j, c = 0;
    cin >> n;
    for(i = 1; i <= 9; i++){
        if(n % i == 0){
            if(n / i <= 9){
                cout << "Yes";
                break;
            }
        }
        c++;
    }

    if(c == 9 && i != 9){
        cout << "No";
    }


}





///promy_pompom
//hello world

Measured memory_bytes: 3636
import java.util.Scanner;
 
public class Main {
	
	public void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long[] ai = new long[N];
		long before = 0;
		for (int i=0; i<N; i++) {
			ai[i] = in.nextLong();
			if (i % 2 == 0) {
				before += ai[i];
			} else {
				before -= ai[i];
			}
		}
		in.close();
		
		System.out.print(before);
		for (int i=1; i<N; i++) {
			before = (ai[i-1] - before/2) * 2;
			System.out.print(" " + before);
		}
		System.out.println();
	}
	
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}
 
}


Measured memory_bytes: 62472
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int S(int N)
{
	int ans = 0;
	while (N > 0)
	{
		ans += N % 10;
		N /= 10;
	} 
	return ans;
}

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

	int N;
	cin >> N;
	cout << (N%S(N) == 0 ? "Yes" : "No") << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;


int main() {
    ll n;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    for (ll i = 10; i <= n; i *= 5) {
        ll now = n / i;
        ans += now;
    }
    cout << ans << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  ll n, k; cin >> n >> k;
  ll kmax = (n-1) * (n-2) / 2;
  if (k > kmax) {
    cout << "-1" << endl;
    return 0;
  }

  vector<P> E;
  rep(i, n-1) {
    E.push_back(P(0, i+1));
  }
  ll added = 0;

  if (kmax - added == k) {
    cout << (added + n - 1) << endl;
    for (auto e : E) {
      cout << (e.first+1) << " " << (e.second+1) << endl;
    }
    return 0;
  }


  rep2(i, 1, n) rep2(j, i+1, n) {
    E.push_back(P(i, j));
    ++added;
    if (kmax - added == k) {
      cout << (added + n - 1) << endl;
      for (auto e : E) {
        cout << (e.first+1) << " " << (e.second+1) << endl;
      }
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).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; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  char C; std::cin >> C;
  char N = C+1;
  std::cout << (char)N << std::endl;
  return 0;
}


Measured memory_bytes: 256
use std::io;
use std::io::{Read, BufReader};

macro_rules! read {
    ( $( $t:ty ),* ) => {
        {
            let mut buf = String::new();
            io::stdin().read_line(&mut buf);
            let mut sp = buf.trim().split(" ");
            ($(
                {
                    sp.next().unwrap().parse::<$t>().unwrap()
                },
            )*)
        }
    }
}
macro_rules! read_vec {
    ($t:ty) => {
        {
            let mut buf = String::new();
            io::stdin().read_line(&mut buf);
            let mut sp = buf.trim().split(" ");
            let mut ret = vec![];
            for s in sp {
                ret.push(s.parse::<$t>().unwrap());
            }
            ret
        }
    }
}

fn main() {
    let (n,) = read!(usize);
    let p = read_vec!(usize);
    
    let mut ngs = vec![];
    for i in 0..n {
        ngs.push(i == p[i] - 1);
    }

    let mut ret = 0;
    let mut last = false;
    for i in 0..n {
        if ngs[i] {
            if !last {
                ret += 1;
                last = true;
            } else {
                last = false;
            }
        } else {
            last = false;
        }
    }
    println!("{}", ret);
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
#define LL long long
int n,m,x,y,L,R,M,T,fl;
int f[100005],vis[100005],a[100005],b[100005],rt[100005];
vector <int> e[100005];
int g[500005],lc[500005],rc[500005];
LL sum,w[100005];
int find(int x){
	return f[x]==x?x:f[x]=find(f[x]);
}
int he(int u,int v){
	if (!u||!v) return u+v;
	if (a[g[u]]-b[g[u]]>a[g[v]]-b[g[v]]) swap(u,v);
	lc[u]=he(lc[u],v);
	swap(lc[u],rc[u]);
	return u;
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i) scanf("%d%d",&a[i],&b[i]),sum+=b[i];
	for (int i=1;i<=m;++i){
		scanf("%d%d",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	L=0; R=1000000000;
	while (L<R){
		M=(L+R)/2; T=0; fl=0;
		for (int i=1;i<=n;++i)
			{f[i]=i; w[i]=M; vis[i]=0;}
		for (int i=1;i<=n;++i)
		if (a[i]<=b[i]+M&&!vis[i]){
			g[++T]=i; lc[T]=rc[T]=0; rt[i]=T;
			while (rt[i]){
				x=g[rt[i]];
				if (a[x]-b[x]>w[i]) break;
				rt[i]=he(lc[rt[i]],rc[rt[i]]);
				if (vis[x]) continue;
				w[i]+=b[x]; f[x]=i; vis[x]=1;
				for (unsigned j=0;j<e[x].size();++j){
					y=find(e[x][j]);
					if (y==i) continue;
					if (!vis[y]){
						g[++T]=y; lc[T]=rc[T]=0;
						rt[i]=he(rt[i],T);
					}else{
						rt[i]=he(rt[i],rt[y]);
						f[y]=i; w[i]+=w[y]-M;
					}
				}
				if (w[i]==sum+M) {fl=1; break;}
			}
			if (fl) break;
		}
		if (fl) R=M; else L=M+1;
	}
	printf("%lld\n",sum+L);
	return 0;
}

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

int main(){
  int n;
  int i; //done sort area
  int v; //a[i] keep
  int j; //loop value 

  cin >> n;

  int a[n];

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

  for(int i=0;i < n;i++){
    
    v = a[i];
    
    j = i - 1;

    while( j >= 0 && a[j] > v){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
    
    for(int k=0;k < n;k++){
      cout << a[k];
      if(k != n-1) cout << " ";
    }
    cout << endl;
  }
  return 0;
}


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

int main() {
        int rooms[4][3][10], b, f, r, v, x, y, z, n;
        for (x = 0; x < 4; x++) {
                for (y = 0; y < 3; y++) {
                        for (z = 0; z < 10; z++) {
                                rooms[x][y][z] = 0;
                        }
                }
        }
        cin >> n;
        for (int i = 0; i < n; i++) {
                cin >> b >> f >> r >> v;
                rooms[b - 1][f - 1][r - 1] += v;
        }
        for ( x = 0; x < 4; x++) {
                for ( y = 0; y < 3; y++) {
                        for ( z = 0; z < 10; z++) {
                                cout << " " << rooms[x][y][z];
                        }
                        cout << endl;
                }
                if (x != 3) cout << "####################" << endl;
        }
        return 0;
}

Measured memory_bytes: 3096
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        int ans = a * b;
        if (ans % 2 == 1){
            Console.WriteLine("Odd");
        }else{
            Console.WriteLine("Even");
        }
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<cmath>
using namespace std;
#define Maxsize 100005
int n,m;
int l,r,a,b;
void Solve(){
    cin>>n>>m;
    a=1,b=n;
    for(int i=1;i<=m;i++){
        cin>>l>>r;
        a=max(l,a);
        b=min(r,b);
    }
    if(b<a) cout<<0<<endl;
    else cout<<b-a+1<<endl;    
}
int main(){
    Solve();
    return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const llint big=1e15+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-9;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<int>ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<int>ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int n,i;cin>>n;
	vector<llint>kaz(n);
	int tid=-1;llint tma=-big;
	for(i=0;i<n;i++){
		cin>>kaz[i];
		if(maxeq(tma,kaz[i])){tid=i;}
	}
	vector<int>retu(n);
	if(tma<=0){retu[tid]=1;cout<<tma<<endl;}
	else{
	llint Kwa=0,Gwa=0;
	for(i=0;i<n;i++){
		if(kaz[i]<0){continue;}
		if(i%2==0){Gwa+=kaz[i];}
		else{Kwa+=kaz[i];}
	}
	if(Gwa>Kwa){
		for(i=0;i<n;i+=2){if(kaz[i]>=0){retu[i]=1;}}
	}else{
		for(i=1;i<n;i+=2){if(kaz[i]>=0){retu[i]=1;}}
	}
	cout<<max(Gwa,Kwa)<<endl;
	}
	vector<int>out;
	while(retu.size()>1){
		int n=retu.size();
		int ok=false;
		for(i=1;i+1<n;i++){
			if(retu[i]==0&&retu[i-1]==retu[i+1]){
				int aa=retu[i-1];
				out.pub(i+1);
				retu.erase(retu.begin()+i-1,retu.begin()+i+2);
				retu.insert(retu.begin()+i-1,aa);
				ok=true;break;
			}
		}
		if(!ok){
			if(retu[0]==0){
				out.pub(1);
				retu.erase(retu.begin());
			}else{
				out.pub(n);
				retu.pob();
			}
		}
	}
	cout<<out.size()<<endl;
	for(auto it:out){cout<<it<<endl;}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
//#include<unordered_map>
using namespace std;
#define ll long long
#define dd cout<<endl
const long long int inf = 1e18+7;
const int mod = 998244353;

using namespace std;

inline ll int max(ll int a,ll int b) { return a>b?a:b; }
inline ll int min(ll int a,ll int b) { return a<b?a:b; }

//const int maxn=

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	int x,y;
	
	cin>>x>>y;
	
	for(int i=0,j;i<=x;i++)
	{
		j=x-i;
		
		if(i*4+j*2==y)
		{
			return cout<<"Yes"<<endl,0;
		}
	}
	
	return cout<<"No"<<endl,0;
	
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define int long long

using namespace std;

int dp[101][100005];

signed main(){
	int n , w , INF = 1e17 + 9;
	cin>>n>>w;
	vector<int> inn(n + 1) , inw(n + 1);
	for(int i = 1 ; i <= n ; i++) cin>>inw[i]>>inn[i];
	for(int i = 0 ; i <= n ; i++) for(int t = 0 ; t < 100005 ; t++) dp[i][t] = INF;
	dp[0][0] = 0;
	for(int k = 1 ; k <= n ;  k++) for(int i = 0 ; i <= 100000 ; i++){
		dp[k][i] = min(dp[k - 1][i] , (i >= inn[k] ? dp[k - 1][i - inn[k]] + inw[k] : INF));
		// cout<<dp[k][i]<<endl;
	}
	int ans  = 100000;
	while(dp[n][ans] > w) ans--;
	cout<<ans<<endl;
}

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

using namespace std;

using i64 = long long int;

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(a) a.begin(), a.end()

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

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

int main(){
    string s;
    cin >> s;
    i64 x = 0, y = 0;
    i64 shift = 0, rshift = 1;
    bool flag = false, flag2 = false;
    rep(i, s.length()){
        if(s[i] == ')') continue;
        else if(s[i] == '.'){
            flag2 = true;
        }else if(s[i] == '('){
            shift = s.length() - i - 2;
            flag = true;
        }else{
            x = x * 10 + (s[i] - '0');
            if(flag) y = y * 10 + (s[i] - '0');
            if(flag2) rshift *= 10;
        }
    }
    if(!flag){
        i64 g = gcd(x, rshift);
        cout << x / g << '/' << rshift / g << endl;
        return 0;
    }
    i64 u = x;
    i64 d = 1;
    rep(i, shift){
        d *= 10;
        u *= 10;
    }
    i64 up = u + y - x;
    i64 down = d - 1;
    down *= rshift;
    i64 g = gcd(up, down);
    cout << up / g << '/' << down / g << endl;
}


Measured memory_bytes: 3180
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

int main() {
	int n;
	std::cin >> n;
	std::vector<lnt> a(n);
	rep(i,n) std::cin >> a[i];
	std::vector<lnt> dp(n,0),b(n,0),c(n,0);
	dp[0]=1000;
	rep(i,n) {
		if(i>0) {
			dp[i]=dp[i-1];
			b[i]=b[i-1];
			c[i]=c[i-1];
		}
		dp[i]=std::max(dp[i],b[i]*a[i]+c[i]);
		if(b[i]<dp[i]/a[i] || (b[i]==dp[i]/a[i]&&c[i]<dp[i]%a[i])) {
			b[i]=dp[i]/a[i]; c[i]=dp[i]%a[i];
		}
	}
	print(dp[n-1]);
}


Measured memory_bytes: 3656
#include <iostream>
#include <string>

#define SAT 1

using namespace std;

int main()
{
    string S;
    int out;
    cin >> S;
    //SUN, MON, TUE, WED, THU, FRI, SAT

    if (S == "SUN")
    {
        out = 7;
    }
    else if (S == "MON")
    {
        out = 6;
    }
    else if (S == "TUE")
    {
        out = 5;
    }
    else if (S == "WED")
    {
        out = 4;
    }
    else if (S == "THU")
    {
        out = 3;
    }
    else if (S == "FRI")
    {
        out = 2;
    }
    else if (S == "SAT")
    {
        out = 1;
    }

    cout << out;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int a,b;
    cin>>a>>b;
    if(a>12) cout<<b<<endl;
    else if(a>5) cout<<b/2<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int l, r, d, res = 0;
  scanf("%d", &l);
  scanf("%d", &r);
  scanf("%d", &d);

  for (int i = l; i <= r; i++)
  {
    if (i % d == 0)
      res++;
  }

  printf("%d", res);
  return 0;
}

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

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    string str;
    cin>>str;
    for(int i=0;i<str.size();i++)
    {
        if(i==k-1)
        {
            if(str[i]=='A')
                cout<<"a";
            else if(str[i]=='B')
                cout<<"b";
            else if(str[i]=='C')
                cout<<"c";
        }
        else
        {
            cout<<str[i];
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool prime[10000001];
int main() {
    for(long long int i=3;i<3162;i++)if(!prime[i])for(long long int j=i*i;j<10000001;j+=i)prime[j]=1;
    int n;
    while(cin>>n,n){
        if(n%2==0)n--;
        for(;;n-=2){
            if(!prime[n]&&!prime[n-2]&&!prime[n-6]&&!prime[n-8]){
                cout<<n<<endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 10924
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define mod 1000000007
#define ll long long
#define PI acos(-1)
#define mp make_pair
#define mod 1000000007
int main()
{
	int n,ans=0;
	cin>>n;
	for(int i=105;i<=n;i++)
	{
		int sum=0;
		if(i&1)
		{
			for(int j=1;j<=i;j++)if(i%j==0)sum++;
			if(sum==8)ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int temp;
  if(a>=c && b<=d) temp = max(0,b-a);
  if(a>=c && b>d) temp = max(0,d-a);
  if(a<c && b>d) temp = max(0,d-c);
  if(a<c && b<=d) temp = max(0,b-c);
  cout << temp << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

#define MOD (10000)

using namespace std;

int check[101];
int memo[101][4][3];
int n, k;

int getWay(int day, int menu, int cont)
{
	if (cont > 2){
		return (0);
	}
	
	if (memo[day][menu][cont] >= 0){
		return (memo[day][menu][cont]);
	}
	
	if (day == n){
		return (1);
	}
	
	int ans = 0;
	if (check[day + 1]){
		ans = getWay(day + 1, check[day + 1], (menu == check[day + 1] ? cont + 1 : 1));
		ans %= MOD;
	}
	else {
		for (int i = 1; i <= 3; i++){
			ans += getWay(day + 1, i, (menu == i ? cont + 1 : 1));
			ans %= MOD;
		}
	}
	
	return (memo[day][menu][cont] = ans);
}

int main()
{
	
	scanf("%d %d", &n, &k);
	
	for (int i = 0; i < k; i++){
		int day, menu;
		scanf("%d %d", &day, &menu);
		check[day] = menu;
	}
	
	memset(memo, -1, sizeof(memo));
	
	printf("%d\n", getWay(0, 0, 0));
}

Measured memory_bytes: 1032
x,y,a,b,c = [int(x) for x in input().split()]
p = [int(x)*(-1) for x in input().split()]
q = [int(x)*(-1) for x in input().split()]
r = [int(x)*(-1) for x in input().split()]

import heapq
heapq.heapify(p)
heapq.heapify(q)
heapq.heapify(r)
for _ in range(x):
    r.append(heapq.heappop(p))
for _ in range(y):
    r.append(heapq.heappop(q))
heapq.heapify(r)
s = 0
for i in range(x+y):
    s+=heapq.heappop(r)*(-1)
print(s)

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

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

using llint = long long;
using vint = vector<int>;
using vvint = vector<vector <int>>;
const int INF = 1e9;
const llint llINF = 1e18;

int main () {
    int h, a; cin >> h >> a;
    cout << ((h + a - 1) / a) << endl;
    return 0;
}

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

int main(){
  long long N,ans;
  ans=0;
  cin>>N;
  vector<long long>a(N),b(N);
  for(int i=0;i<N;i++){
cin>>a[i];
    if(i%2==0){
      ans+=a[i];
    }
    else{
      ans-=a[i];
    }
  }
  b[0]=ans/2;
    for(int i=1;i<N;i++){
      b[i]=a[i-1]-b[i-1];
  }
    for(int i=0;i<N;i++){
cout<<b[i]*2;
    if(i!=N-1){
      cout<<" ";
    }
    else{
     cout<<endl;
    }
  }
}

Measured memory_bytes: 2944
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>

using namespace std;

int i = 1;
int x;

void endCheckNum(int max);
void checkNum(int max);
void call(int max);

void endCheckNum(int max){
    if(++i <= max){
        call(max);
    }
}

void checkNum(int max){
    if(i > max){
        return;
    }
    
    x = i;
    if(x % 3 == 0){
        cout << " " << i;
        endCheckNum(max);
    }
}

void include3(int max){
    if(i > max){
        return;
    }
    
    if(x % 10 == 3){
        cout << " " << i;
        endCheckNum(max);
    }
    x /= 10;
    if(x){
        include3(max);
    }
}

void call(int max){
    checkNum(max);
    include3(max);
    endCheckNum(max);
}

int main(void){
    int num;
    cin >> num;
    call(num);
    cout << endl;
    return 0;
}


Measured memory_bytes: 3248
from operator import itemgetter, attrgetter
import sys

a = [] # linesを入れる
b = [] # 1st lineを入れる
for line in sys.stdin:
    a.append(line)
# print(a)

N = float(a[1]) # 小数に変換

b = list(map(int, list(a[0].strip().split()))) # 0行目を分ける
Q = b[0]
H = b[1]
S = b[2]
D = b[3]

list_tuples_origin = [
	(1, Q, 8 * Q),
	(2, H, 4 * H),
	(4, S, 2 * S),
	(8, D, D),
]

list_tuples = sorted(list_tuples_origin, key=lambda list: list[2])

value = 0

M = int(4 * N)

while True:
	# print(list_tuples[0])
	if M == 0:
		break
	s = list_tuples[0][0]
	v = list_tuples[0][1]

	sho = M // s
	amari = M % s
	M = amari
	value += sho * v

	del list_tuples[0]
print(value)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    String b = sc.next();

    if (b.equals("A")) {
      System.out.println("T");
    } else if (b.equals("C")) {
      System.out.println("G");
    } else if (b.equals("T")) {
      System.out.println("A");
    } else {
      System.out.println("C");
    }
    
  }
}

Measured memory_bytes: 21712
#include <stdio.h>
#include <memory.h>

int map[52][52];
int sum;

int snake(int x,int y){
    if(map[y][x] == 0)
        return 0;
    map[y][x]=0;
    return snake(x+1,y)+snake(x,y-1)+snake(x-1,y)+snake(x,y+1)+snake(x+1,y+1)+snake(x+1,y-1)+snake(x-1,y-1)+snake(x-1,y+1)+1;
}

int main(void){
    int w,h,sum1,i,o;
    for(;scanf("%d %d",&w,&h),h;){
        sum1=0;
        sum=0;
        memset(map,0,sizeof(map));
        for(i=1;i<=h;i++){
            for(o=1;o<=w;o++){
                scanf("%d",&map[i][o]);;
            }
        }
        for(i=1;i<=h;i++){
            for(o=1;o<=w;o++){
                if(map[i][o] == 1){
                    sum++;
                    snake(o,i);
                }
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    if (a > 8 || b > 8)
    {
        cout << ":(";
    }
    else
    {
        cout << "Yay!";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace C___Fennec_vs_Monster
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var n = int.Parse (input[0]);
            var k = int.Parse (input[1]);
            var h = new int[n];
            input = Console.ReadLine ().Split (' ');
            if (k >= n)
            {
                Console.WriteLine (0);
                return;
            }
            for (var i = 0; i < n; i++)
            {
                h[i] = int.Parse (input[i]);
            }
            Array.Sort (h);
            Array.Reverse (h);
            var total = 0L;
            for (var i = k; i < n; i++)
            {
                total += h[i];
            }
            Console.WriteLine (total);
        }
    }
}

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

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

	vector<bool> check(1000001, false);
	check[s] = true;

	int ret = 1;
	while (1)
	{
		++ret;
		if (s % 2 == 0) {
			s = s / 2;
		}
		else
		{
			s = 3 * s + 1;
		}
		if (check[s]) {
			cout << ret << endl;
			break;
		}
		check[s] = true;
	}

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
  ll x,y,w,h,r;
  cin >>w>>h >> x >> y >> r;
  if(0<=x-r&&x+r<=w&&0<=y-r&&y+r<=h){
    cout << "Yes\n";
  }else{
    cout <<"No\n";
  }
}



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

int main(){
    char s[200001], t[200001];
    int count, l;

    count = 0;

    scanf("%sn", s);
    scanf("%sn", t);

    l = strlen(s);

    for(int i=0; i<l; i++){
        if(s[i] != t[i]){
            count += 1;
    }
    }

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

    return 0;


}

Measured memory_bytes: 2092
x, n = map(int,input().split())
if n==0:
  print(x)
else:
  a = input().split(" ")
  lista = [int(n) for n in a]
  for i in range (200):
    for j in range(100):
      if x-j not in lista:
        print(x-j)
        exit()
      if x+j not in lista:
        print(x+j)
        exit()

Measured memory_bytes: 9200
n=int(input())
w=[list(map(str,input())) for _ in range(n)]

for i in range(n-1):
  if w[i][-1] != w[i+1][0]:
    print('No')
    exit()
  for j in range(i+1,n):
    if w[i]==w[j]:
      print('No')
      exit()
print('Yes')

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

int ansmap[100002];

int main() {

    int n;

    cin >> n;

    int a;

    for(int i=0;i<n;i++){
        scanf(" %d",&a);
        ansmap[a]++;
        ansmap[a+1]++;
        if(a!=0)
            ansmap[a-1]++;
    }

    int ansnum=0;

    for(int i=0;i<100002;i++){
        if(ansnum < ansmap[i]){
            ansnum = ansmap[i];
        }
    }

    cout << ansnum << endl;

    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N), F(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> F[i];
    sort(A.begin(), A.end());
    sort(F.rbegin(), F.rend());

    auto check = [&](ll x) {
        ll re = K;
        rep(i, N) {
            ll a = A[i];
            ll f = F[i];
            if (a * f <= x) {
                continue;
            } else {
                ll y = a - x / f;
                re -= y;
            }
        }
        return re >= 0;
    };

    ll ok = INF;
    ll ng = -1;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        if (check(mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3328
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N;
    in(N);

    vll A(N);
    inN(A, N);
    
    reverse(all(A));

    ll ans = 0;
    ll sum = 0;

    reps(i, 1, N)
    {
        sum += A[i - 1];
        sum %= MOD;

        ans += sum * A[i];
        ans %= MOD;
    }

    outl(ans);

    return 0;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
vector<int> d;
vector<vector<int>> A;
    
int main () {
  int K;
  string S;
  cin >> K;
  cin >> S;
  if (S.size() <= K ){
    cout << S << endl;}
  else if (S.size() > K) {
    cout << S.substr(0, K) + "..." << endl;}
return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
using namespace std;

int n,q,com,x,y;
int *parent,*club,*rank;

int find(int x){
    if(x == parent[x])return x;
    else{
        return parent[x] = find(parent[x]);
    }
}

bool isSame(int x,int y){
    return find(x) == find(y);
}

void unite(int x,int y){
    x = find(x);
    y = find(y);

    if(x == y)return;

    if(rank[x] < rank[y]){
        parent[x] = y;
    }else{
        parent[y] = x;
        if(rank[x] == rank[y])rank[x]++;
    }
}

int main(){

    int N,M,K,tmp,left,right;
    scanf("%d %d %d",&N,&M,&K);

    parent = new int[N+1];
    club = new int[N+1];
    rank = new int[N+1];
    for(int i = 1; i <= N; i++){
        parent[i] = i;
        club[i] = -1;
        rank[i] = 0;
    }

    int ans = 0;

    for(int loop = 1; loop <= K; loop++){
        scanf("%d",&tmp);

        if(tmp == 1){
            scanf("%d %d",&left,&right);
            if(club[find(left)] == -1 && club[find(right)] == -1){
                unite(left,right);
            }else if(club[find(left)] == -1 && club[find(right)] != -1){
                club[find(left)] = club[find(right)];
                unite(left,right);
            }else if(club[find(left)] != -1 && club[find(right)] == -1){
                club[find(right)] = club[find(left)];
                unite(left,right);
            }else{
                if(club[find(left)] != club[find(right)]){
                    if(ans == 0){
                    	ans = loop;
                    	break;
                    }
                }else{
                    unite(left,right);
                }
            }
        }else{
            scanf("%d %d",&left,&right);
            if(club[find(left)] == -1){
                club[find(left)] = right;
            }else{
                if(club[find(left)] == right){
                    //Do nothing
                }else{
                    if(ans == 0){
                    	ans = loop;
                    	break;
                    }
                }
            }
        }
    }

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

    return 0;
}

Measured memory_bytes: 3884
#include<cstdio>
#include<cstring>
#define Z int
#define V void
#define L long long
#define S(n) scanf("%lld",&n)
#define P(n) printf("%lld",n)
#define M(f) memset(f,0x8f,sizeof f)
#define F(i,a,b) for(L i=a;i<=b;i++)
#define G(k,x) for(L k=las[x];k;k=nex[k])
#define W while
#define sm(a,b) ((a)<(b)?(a):(b))
#define I if
#define R return
#define nx 21000
#define inf 8102099357864587377
L n,x,y,b;
L las[nx],nex[nx],r[nx],v[nx],c[nx],l=1;
L p1,p2,p3,p4,s,t,stop,ans;
L d[nx+1],ex[nx],f[nx],to[nx],hd,tl,nw,fl;
V ins(L x,L y,L z,L p){r[++l]=y,nex[l]=las[x],v[las[x]=l]=z,c[l]=p;}
V link(L x,L y,L z,L p){ins(x,y,z,p),ins(y,x,0,-p);}
L spfa(){
	M(f),hd=0,f[d[tl=1]=s]=0;
	W(hd^tl){
		ex[d[hd=hd<nx?hd+1:1]]=0;
		G(k,d[hd])I(v[k])I(f[d[hd]]+c[k]>f[r[k]]){
			f[r[k]]=f[d[hd]]+c[to[r[k]]=k];
			I(!ex[r[k]])ex[d[tl=tl<nx?tl+1:1]=r[k]]=1;
		}
	}
	I(f[t]==-inf){stop=1;R 0;}
	nw=t,fl=inf;
	W(nw^s)fl=sm(fl,v[to[nw]]),nw=r[to[nw]^1];
	nw=t;
	W(nw^s)v[to[nw]]-=fl,v[to[nw]^1]+=fl,nw=r[to[nw]^1];
	R fl*f[t];
}
Z main(){
	S(n),p1=n+n+1,p2=p1+1,p3=p2+1,p4=p3+1,s=p4+1,t=s+1;
	F(i,1,n)S(x),S(y),S(b),link(s,i,b,0),
	link(i,p1,nx,-x-y),link(i,p2,nx,y-x),
	link(i,p3,nx,x-y),link(i,p4,nx,x+y);
	F(i,1,n)S(x),S(y),S(b),link(i+n,t,b,0),
	link(p1,i+n,nx,x+y),link(p2,i+n,nx,x-y),
	link(p3,i+n,nx,y-x),link(p4,i+n,nx,-x-y);
	W(!stop)ans+=spfa();
	P(ans);
}

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

#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

//tourist head

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pw(x) (1ll << (x))
////////////////////////////////////////////////////////////////////////

void read_input(){
	
}

void solve(){
	
}
int a[100005];
int b[100005];
int main(){
	int N,H;
	cin>>N>>H;
	for(int i=0;i<N;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	sort(a,a+N);
	sort(b,b+N);
	int res = 0;
	int total = 0;
	int maxA = a[N-1];
	if (total>=H){
		cout<<res<<endl;
		return 0;
	}
	for(int i = N-1;i>=0;i--){
		if (b[i] > maxA){
			res++;
			total+=b[i];
			if (total>=H){
				cout<<res<<endl;
				return 0;
			}
		}else{
			int rem = H - total;
			res+=(rem/maxA);
			if (rem % maxA !=0){
				res++;
			}
				cout<<res<<endl;
				return 0;
		}
	}
				int rem = H - total;
			res+=(rem/maxA);
			if (rem % maxA !=0){
				res++;
			}
				cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Text;

namespace GRL1_C
{
    class Program
    {
        const long INF = (long)1 << 32;
        static void Main(string[] args)
        {
            var a = scan;
            int n = a[0];
            int e = a[1];
            var d = new long[n, n];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    d[i, j] = i == j ? 0 : INF; 
                }
            }
            for (int i = 0; i < e; i++)
            {
                var f = scan;
                d[f[0], f[1]] = f[2];
            }

            for (int k = 0; k < n; k++)
            {
                for (int i = 0; i < n; i++)
                {
                    if (d[i, k] == INF) continue;
                    for (int j = 0; j < n; j++)
                    {
                        if (d[k, j] == INF) continue;
                        d[i, j] = Math.Min(d[i, j], d[i, k] + d[k, j]);
                    }
                }
            }

            bool posi = true;
            for (int i = 0; i < n; i++)
            {
                if (d[i,i]<0)
                {
                    posi = false;
                    Console.WriteLine("NEGATIVE CYCLE");
                    break;
                }
            }

            if (posi)
            {
                var ans = new StringBuilder();
                for (int i = 0; i < n; i++)
                {
                    string st= "";
                    for (int j = 0; j < n; j++)
                    {
                        if (d[i, j] == INF) st += "INF ";
                        else st += d[i, j] + " ";
                    }
                    ans.AppendLine(st.Trim());
                }
                Console.Write(ans);
            }
        }

        static int[] scan
        {
            get { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
        }
    }
}

Measured memory_bytes: 10832
#!/usr/bin/env python3
#ABC122 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,q = LI()
s = list(input())
lst = [0]*n
for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'C':
        lst[i+1] = 1
lst = list(accumulate(lst))
for _ in range(q):
    l,r = LI()
    print(lst[r-1] - lst[l-1])


Measured memory_bytes: 58248
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

//submit change class name to Main and at main method also correct class name
public class Main {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable t) {
            t.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    void solve() throws IOException {
        int n = readInt();
        int k = readInt();
        int[] all = new int[n];
        int[] res = new int[n];
        for(int i=0;i<n;i++)
            all[i]=readInt();
        res[0]=0;
        for(int i=1;i<n;i++){
            res[i] = Integer.MAX_VALUE;
            for(int j=i-1;j >= Math.max(0, i-k);j--) {
                int cost = Math.abs(all[i]-all[j]) + res[j];
                if(cost<res[i])
                    res[i]=cost;
            }
        }
        System.out.println(res[n-1]);
    }
}


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

int n;
bool f;

int main(){
	cin >> n;
	f = false;
	for (int k = 0; k <= n/4; ++k){
		if ((n - 4*k) % 7 == 0){
			f = true;
			break;
		}
	}
	cout << (f ? "Yes" : "No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define LL long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=2011;
#define pii pair<int,int>
#define x first
#define y second
int n,K,len[N];
bitset<N*50> ok[N];
string s[N],ans;
pii f[2][N*10];
int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>K;
	for(int i=1;i<=n;i++){
		cin>>s[i];
		len[i]=s[i].size();
	}
	ok[n+1][0]=1;
	for(int i=n;i>0;i--){
		ok[i]=ok[i+1]|(ok[i+1]<<len[i]);
//		cout<<i<<' ';
//		for(int j=0;j<=K;j++){
//			ok[i][j]|=ok[i+1][j];
//			if(j+len[i]<=K)ok[i][j+len[i]]|=ok[i+1][j];
//			printf("%d ",ok[i][j]);
//		}
//		cout<<endl;
	}
	int qcnt=0,tcnt=0;
	for(int i=1;i<=n;i++)
	  if(ok[i+1][K-len[i]])
	    f[1][++qcnt]=pii(i,0);
	for(int t=1;t<=K;t++)
	{
		int i=t&1;
//		cout<<' '<<i<<endl;
		qcnt=min(qcnt,K);
//		cout<<qcnt<<"  ";
		char ch='z';
		for(int j=1;j<=qcnt;j++)
		  ch=min(ch,s[f[i][j].x][f[i][j].y]);//cout<<f[i][j].x<<' '<<f[i][j].y<<"  ";
//		cout<<endl;
		ans.push_back(ch);
		int head=n+1;
		for(int j=1;j<=qcnt;j++)
		{
			if(s[f[i][j].x][f[i][j].y]!=ch) continue;
			if(f[i][j].y==len[f[i][j].x]-1)
			  head=min(head,f[i][j].x);
			else
			  f[i^1][++tcnt]=pii(f[i][j].x,f[i][j].y+1);
		}
//		cout<<head<<endl;
		for(int j=head+1;j<=n;j++)
		  if(K-t-len[j]>=0&&ok[j+1][K-t-len[j]])
		    f[i^1][++tcnt]=pii(j,0);
		qcnt=tcnt; tcnt=0;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 26112
using System;

namespace ABC_131_A_Csharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) Console.WriteLine("Bad");
            else Console.WriteLine("Good");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>

template <typename T>
struct stackElm{
  T value;
  stackElm<T>* nextPtr;

  stackElm() = default;
};

template <typename T>
struct stack{
  stackElm<T> * topPtr = nullptr;

  void push(T value)
  {
    stackElm<T> * tmpPtr = new stackElm<T>;
    tmpPtr->value = value;
    tmpPtr->nextPtr = topPtr;
    topPtr = tmpPtr;
  }

  T pop()
  {
    if (topPtr == nullptr)
      {
        std::cout << "Error!: No element in stack" << std::endl;
        return 0;
      }
    auto retVal = topPtr->value;
    auto tmpPtr = topPtr;
    topPtr = topPtr->nextPtr;
    delete tmpPtr;

    return retVal;
  }

  void print()
  {
    auto tmpPtr = topPtr;
    while (tmpPtr->nextPtr != nullptr)
      {
        std::cout << tmpPtr->value << " ";
        tmpPtr = tmpPtr->nextPtr;
      }
    std::cout << tmpPtr->value << std::endl;
  }
};


int main ()
{
  stack<int> s;

  std::string exp;

  while ((std::cin >> exp))
    {
      if (exp == "+")
        {
          auto a = s.pop();
          auto b = s.pop();
          s.push(a + b);
        }
      else if (exp == "*")
        {
          auto a = s.pop();
          auto b = s.pop();
          s.push(a * b);
        }
      else if (exp == "-")
        {
          auto a = s.pop();
          auto b = s.pop();
          s.push(b - a);
        }
      else
        {
          s.push(std::stoi(exp));
        }

      // s.print();
    }

  std::cout << s.pop() << std::endl;
}



Measured memory_bytes: 3216