akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <list>
using namespace std;

//??\?????????????????????????§???????
struct Edge {
	vector<int> in_n, out_n;
	void set_in(int a) { in_n.emplace_back(a); }
	void set_out(int a) { out_n.emplace_back(a); }
};

int main() {
	//Wiki:?????????????????????????????¢?????´??????????????????

	int V, E; cin >> V >> E;
	vector<Edge> edge(V+1);
	list<int> L;    //??????????????????????????????????????????????????????????????????
	queue<int> S;   //??\???????????????????????????????????????????????????

	//?????????
	for (int i = 0; i < E;i++) {
		int s, t; cin >> s >> t;
		edge[s].set_out(t);
		edge[t].set_in(s);
	}

	//??\???????????????????????????????????????????????¢?´¢
	for (int i = 0; i < V;i++) {
		if (edge[i].in_n.size() == 0) { S.push(i); }
	}
	
	while (!S.empty()) {
		//S???????????????n???????????????
		int n = S.front(); S.pop();
		//L???n???????????????
		L.push_back(n);

		/*
		for each n ???????????? e ??¨????????????????????? m do
			??? e ?????°????????????????????????
			if m ?????????????????\??????????????£?????????????????° then
				m ??? S ???????????????
		*/

		int size = edge[n].out_n.size();
		for (int i = 0; i < size; i++) {
			int m = edge[n].out_n[0];

			edge[n].out_n.erase(edge[n].out_n.begin());

			for (int j = 0; j < edge[m].in_n.size();j++) {
				if (edge[m].in_n[j] == n) {
					edge[m].in_n.erase(edge[m].in_n.begin() + j);
					break;
				}
			}
			E--;

			if (edge[m].in_n.size() == 0) {
				S.push(m);
			}
		}
	}

	/*
	if ??°????????????????????£????????? then
		??????????????? DAG ??§???????????§??????
	*/
	if (E == 0) { cout << 0; }
	else { cout << 1; }
	cout << endl;
	return 0;
}

Measured memory_bytes: 3148
input_line1 = map(int,raw_input().split(" "))
#input_line2 = map(int,raw_input().split(" "))
#input_line = raw_input().split(" ")
a = input_line1[0]
b = input_line1[1]

n = a + b
if n >= 24:
	print n - 24
else:
	print n

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

DPLIST=[[None]*N for i in range(N)]

SUM=[0]
for i in range(N):
    DPLIST[i][i]=0
    SUM.append(SUM[-1]+A[i])

for i in range(1,N):
    for j in range(i,N):

        ANS=float("inf")

        for k in range(j-i,j):

            if ANS>DPLIST[j-i][k]+DPLIST[k+1][j]+SUM[j+1]-SUM[j-i]:
                ANS=DPLIST[j-i][k]+DPLIST[k+1][j]+SUM[j+1]-SUM[j-i]
        
        DPLIST[j-i][j]=ANS

print(DPLIST[0][N-1])


Measured memory_bytes: 45404
#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>;

int main() {
  char a, b;
  cin >> a >> b;
  if (a == b) cout << 'H' << endl;
  else cout << 'D' << endl;
  return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool up_min(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool up_max(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_mdvector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_mdvector(int n, Ts ... ts){
        return vector<decltype(make_mdvector(ts...))>(n, make_mdvector(ts...));
    }

    inline ll bit(int x){
        return 1ll << x;
    }

    template<class T>
    istream& operator>>(istream& is, vector<T>& v){
        for (auto &&x : v) { is >> x; } return is;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    ll N;
    void run();
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef XELMH
    string test_cases = "test_A.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


void solver::run(){
    ll X, Y;
    is >> X >> Y;
    if(!is) return;
    ll ans = 0;
    if(X <= 3){
        ans += (4-X) * 100000;
    }
    if(Y <= 3){
        ans += (4-Y) * 100000;
    }
    if(X == Y and X == 1) {
        ans += 400000;
    }
    os << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			// 整数の入力
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			
			int firstmin = 0;
			int secondmin = 0;
			
			if(a<b & b<c){
				firstmin = a;
				secondmin = b;
			}else if(b<c & c<a){
				firstmin = b;
				secondmin = c;
			}else if(c<a & a<b){
				firstmin = c;
				secondmin = a;
			}else if(a<c & c<b){
				firstmin = a;
				secondmin = c;
			}else if(b<a & a<c){
				firstmin = b;
				secondmin = a;
			}else if(c<b & b<a){
				firstmin = c;
				secondmin = b;
			}else if(a==b & b==c){
				firstmin = a;
				secondmin = b;
			}else if(a==b & a<c){
				firstmin = a;
				secondmin = b;
			}else if(b==c & b<a){
				firstmin = b;
				secondmin = c;
			}else if(a==c & a<b){
				firstmin = a;
				secondmin = c;
			}else if(a==b & a>c){
				firstmin = c;
				secondmin = b;
			}else if(b==c & b>a){
				firstmin = a;
				secondmin = c;
			}else if(a==c & a>b){
				firstmin = b;
				secondmin = c;
			}
			
			int sum = firstmin + secondmin;
			// 出力
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N;
cin >> N;
for (int64_t i = N;i > 0;i--) {
  int a = sqrt(i);
  if (i == a * a) {
    cout << i << endl;
    return 0;
  }
}




return 0;
}

Measured memory_bytes: 256
s = input()
q = int(input())

sg = 1
fr = []
ba = []
for x in range(q):
  query = [s for s in input().split()]
  if query[0] == '1':
    sg *= -1
  else:
    if int(query[1])*2 + sg == 3:
      fr.append(query[2])
    else:
      ba.append(query[2])

if sg == 1:
  fr.reverse()
  frn = ''.join(fr)
  ban = ''.join(ba)
  print(frn + s + ban)
else:
  ba.reverse()
  frn = ''.join(fr)
  ban = ''.join(ba)
  print(ban + ''.join(list(reversed(s))) + frn)

Measured memory_bytes: 5868
#include "bits/stdc++.h"
using namespace std;

int main() {
	static long long N, A[100000];
	static bool X[100000];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	X[0] = true;
	for (int i = 1; i < N; i++) {
		if (A[i] != A[i - 1]) X[i] = true;
		else X[i] = !X[i - 1];
	}
	reverse(A, A + N), reverse(X, X + N);
	for (int i = N - 1; i >= 0; i--) {
		if (i - A[i] == 0 && X[i]) {
			cout << "First" << endl;
			return 0;
		}
		if (i - A[i] + 1 <= 0) {
			cout << (X[i] == (A[i] - i + 1) % 2 ? "First" : "Second") << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring>
 
int main(){
	int N;
	(void)scanf("%d", &N);
 
	char map[100][100+1];
	memset(map, 0, sizeof(map));
 
	int tmp;
	for (int i = 1; i < N + 1; i++) {
		(void)scanf("%d", &tmp);
		for (int j = 0; j < 100; j++) {
			map[j][i] = (j < tmp) ? 1 : 0;
		}
	}
 
	int count = 0;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < N; j++) {
			if (map[i][j] == 0 && map[i][j + 1] == 1) count++;
		}
	}
 
	printf("%d\n", count);
 
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
//#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/
 
int32_t main()
{
	fastio();
	int n,m,k;
	cin>>n>>m>>k;
	int a[n],b[m];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<m;i++)
	{
		cin>>b[i];
	}
	for(int i=1;i<n;i++)
	{
		a[i]+=a[i-1];
	}
	for(int i=1;i<m;i++)
	{
		b[i]+=b[i-1];
	}
	int ans=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>k)
		{	
			break;
		}
		int pt=upper_bound(b,b+m,k-a[i])-b;
		ans=max(ans,i+1+pt);
	}
	for(int i=0;i<m;i++)
	{
		if(b[i]<=k)ans=max(ans,i+1);
	}
	
	cout<<ans<<endl;
}


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

int32_t main(){

    int l , r;  cin >> l >> r;
    
    if(l*r < 2019){
        cout << l*r << endl;
        exit(0);
    }

    int ans = INT16_MAX;

    for(int x=l; x<= min(l+2019,r) ; x++){
        for(int y=x+1 ;y <= min(l+2019,r);y++){
            ans = min(ans,((x%2019) * (y%2019)) % 2019 );
        }
        if(ans == 0) break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter
N=input()

S=[ sys.stdin.readline().strip() for _ in range(N) ]

C=Counter(S)
C=list(C.items())
C.sort(key=lambda x:(-x[1],x[0]) )

max_cnt=None
for i,x in enumerate(C):
    name=x[0]
    cnt=x[1]
    if i==0:
        max_cnt=cnt
        print name
    else:
        if max_cnt==cnt:
            print name
        else:
            quit()


Measured memory_bytes: 79092
#define CPP17
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
#ifdef CPP17
#include <variant>
#endif

#define endl codeforces

#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
using size_type = ssize_t;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

template <typename T, std::size_t Head, std::size_t... Tail> 
struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };

template <typename T, std::size_t Head> 
struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };

template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

#ifdef CPP17
template <typename T, typename F, typename... Args> 
void fill_seq(T &t, F f, Args... args) { 
    if constexpr (std::is_invocable<F, Args...>::value) { 
        t = f(args...); 
    } else { 
        for (size_type i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); 
    } 
}
#endif

template <typename T> vec<T> make_v(size_type sz) { return vec<T>(sz); }

template <typename T, typename... Tail> 
auto make_v(size_type hs, Tail&&... ts) { 
    auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); 
    return vec<decltype(v)>(hs, v); 
}

namespace init__ { 
struct InitIO { 
    InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } 
} init_io; 
}
#define CPP17


int main() {
    ll n, k;
    std::cin >> n >> k;
    vec<ll> av(n);
    for (ll &e : av) std::cin >> e;
    ll ok = 1e9, ng = 0;
    while (1 < ok - ng) {
        ll mid = (ok + ng) / 2;
        ll cnt = 0;
        for (ll e : av) if (mid < e) cnt += e / mid;
        (cnt <= k ? ok : ng) = mid;
    }

    std::cout << ok << "\n";
    return 0;
}


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

	cin >> n;
	vector<int>a(n);
	rep(i,n)cin>>a[i];
	int cnt=1;
	rep(i,n){
		if (a[i]==cnt){
			cnt++;
		}
	}
	int ans;
	if (cnt==1) ans=-1;
	else ans=n-cnt+1;
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main() {

    int N, ans = 1;
    cin >> N;

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

    sort(d, d+N);

    for(int i = 0; i < N; i++){
        if(i < N-1)
            if(d[i]<d[i+1]){
                ans++;
            }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    int n;
    cin >> n;

    char s[16];
    int p[256] = {};
    for (int i = 0; i < n; i++) {
        cin >> s;
        p[s[0]]++;
    }

    char *c = "MARCH";
    int64_t q[5];
    for (int i = 0; i < 5; i++) {
        q[i] = p[c[i]];
    }

    int64_t r = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < i; j++) {
            for (int k = 0; k < j; k++) {
                r += q[i] * q[j] * q[k];
            }
        }
    }

    cout << r << endl;

    return 0;
}

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

// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    int n;
    cin>>n;
    map<int,int> m;
    rep(i,n){
        int a;
        cin>>a;
        m[a]++;
    }
    if(n%2==0){
        for(int i=1;i<n;i+=2){
            if(m[i]!=2){
                cout<<0<<endl;
                return 0;
            }
        }
        ll ans=modpow(2,n/2,MOD);
        cout<<ans<<endl;
    }
    else{
        if(m[0]!=1){
            cout<<0<<endl;
            return 0;
        }
        for(int i=2;i<n;i+=2){
            if(m[i]!=2){
                cout<<0<<endl;
                return 0;
            }
        }
        ll ans=modpow(2,n/2,MOD);
        cout<<ans<<endl;
    }
}

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

using namespace std;

const int N_MAX = 102;

typedef long long ll;

int n, m;

int a[N_MAX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    int sum = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    sort(a + 1, a + n + 1);
    if(a[n - m + 1] < 1.0 * sum / (4 * m))
        cout << "No";
    else
        cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 5001;
int n, k, v[N];
short L[N][N], R[N + 1][N];
ll mx[N];
int main()
{
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
		cin >> v[i];
	L[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= k; ++j) {
			L[i][j] = L[i - 1][j];
			if (j >= v[i])
				L[i][j] |= L[i - 1][j - v[i]];
		}
	}
	R[n+1][0] = 1;
	for (int i = n; i>0; --i) {
		mx[i] = v[i] + mx[i + 1];
		for (int j = 0; j <= k; ++j) {
			R[i][j] = R[i + 1][j];
			if (j >= v[i])
				R[i][j] |= R[i + 1][j - v[i]];
		}
	}
	for (int i = 1; i <= n + 1; ++i)
		for (int j = 1; j <= k; ++j) {
			R[i][j] += R[i][j - 1];
		}
	int res = 0;
	for (int i = 1; i <= n; ++i) {
		bool need = false;
		for (int t = 0; t < k; ++t) {
			if (!L[i - 1][t])
				continue;
			if (t + v[i] + mx[i + 1] < k)
				continue;
			int l = max(0, k - t - v[i]);
			int r = max(0, k - t - 1);
			int cnt = R[i + 1][r];
			if (l)
				cnt -= R[i + 1][l - 1];
			if (cnt) {
				need = true;
				break;
			}
		}
		if (!need) {
			++res;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 98048
import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if(a==b && b!=c) System.out.println("Yes");
        else if (a==c && c!=b) System.out.println("Yes");
        else if (b==c && b!=a) System.out.println("Yes");
        else System.out.println("No");

        sc.close();
    }
}

Measured memory_bytes: 21588
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main():
    dot=[]
    h,w = map(int,input().split())
    dot=np.array([list(input().rstrip()) for _ in range(h)])
    
    for i in range(1,h+1):
        print("".join(dot[i-1]))
        print("".join(dot[int(i+1/2)-1]))

if __name__=="__main__":
    main()

Measured memory_bytes: 27156
//10のi乗pow(10, i);
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  vector<int>n(5);
  vector<int>m(5);
  int sum=0;
  rep(i,5)cin >> n.at(i);
  rep(i,5){
    if(n.at(i)%10==0){
      sum +=n.at(i);
    }
    m.at(i)=n.at(i)%10;
  }
  int mi=123;
  int flag=0;
  rep(i,5){
    if(m.at(i) !=0){
      mi = min(mi,m.at(i));
      sum += (n.at(i)/10+1)*10;
      flag =1;
    }
  }
  
  if(flag==0)cout<<sum<<endl;
  else if(flag==1)cout<<sum-(10-mi)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int count = 0;
  vector<int>a(N);
  for(int i = 0; i<N; i++){
    cin >> a.at(i);
  }

  for(int i=0; i<N; i++){
    if(a.at(i)%2==1)
      break;
    a.at(i) /= 2;
    if(i == N-1){
      i = 0;
      count += 1;
    }
    
  }
  
  cout << count << endl;
  

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807;
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }


int main() {
	//int N, H, W;
	//scanf("%d%d%d", &N, &H, &W);
	//int ans;
	//ans = ((N - H) + 1) * ((N - W) + 1);
	//printf("%d\n", ans);

	int N, A, B;
	int P[102];
	scanf("%d%d%d", &N, &A, &B);
	int a = 0, b = 0, c = 0;
	for (int i = 0; i < N; i++) {
		scanf("%d", &P[i]);
		if (P[i] <= A) {
			a++;
		}
		else if (A + 1 <= P[i] && P[i] <= B) {
			b++;
		}
		else if (B + 1 <= P[i]) {
			c++;
		}
	}
	int tmp;
	tmp = Min(a, b);
	tmp = Min(c, tmp);
	int ans = tmp;
	printf("%d\n", ans);

#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

//Card Game
public class Main {

	int[] g, j;
	boolean[] u;
	int res;

	void dfs(int k, int pa, int pb) {
		int p, q;
		if (k == 9) {
			if (pb < pa) {
				res++;
			}
			return;
		}
		for (int i = 0; i < 9; i++) {
			if (!u[i]) {
				u[i] = true;
				if (j[k] < g[i]) {
					p = g[i] + j[k];
				} else {
					p = 0;
				}
				if (j[k] < g[i]) {
					q = 0;
				} else {
					q = g[i] + j[k];
				}
				dfs(k + 1, pa + p, pb + q);
				u[i] = false;
			}
		}
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		while (T-- != 0) {
			g = new int[9];
			j = new int[9];
			u = new boolean[9];
			for (int i = 0; i < 9; i++)
				g[i] = sc.nextInt();
			for (int i = 0; i < 9; i++)
				j[i] = sc.nextInt();
			res = 0;
			dfs(0, 0, 0);
			double x = res * 1.0 / 362880;
			System.out.printf("%.5f %.5f\n", x, 1 - x);
		}
	}

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

Measured memory_bytes: 20804
n = gets.to_i
d = n.to_s.size

sft = ["3", "5", "7"]
res = 0

1.step(d) do |t|
  sft.repeated_permutation(t).each do |p|
    if sft & p == sft
      x = p.join("").to_i
      if x > n
        break
      end
      res += 1
    end
  end 
end
puts res

Measured memory_bytes: 14372
using System;
using System.Collections.Generic;

namespace abc130_b
{
  class Program
  {
    static void Main(string[] args)
    {
      var n = CIn.ReadInt();
      var x = CIn.ReadInt();

      var d = 0L;
      var a = 0;

      for (var i = 1; i <= n; i++)
      {
        d += CIn.ReadInt();
        a = i;

        if (d > x)
        {
          Console.WriteLine(i);
          return;
        }
      }

      Console.WriteLine(a + 1);
    }
  }

  class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }

      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(long n)
    {
      var array = new string[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }

      return array;
    }

    public static int[] ReadIntArray(long n)
    {
      var array = new int[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }

      return array;
    }

    public static long[] ReadLongArray(long n)
    {
      var array = new long[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }

      return array;
    }
    public static double[] ReadDoubleArray(long n)
    {
      var array = new double[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }

      return array;
    }
  }
}

Measured memory_bytes: 11348
import java.util.Scanner;
public class Main
{
	public static void main(String args[])
	{
		Scanner input = new Scanner(System.in);
		double x = input.nextDouble();
		double y = input.nextDouble();
		double x1 = input.nextDouble();
		double y1 = input.nextDouble();
		System.out.println( Math.sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1)));
		input.close();
	}
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int Sum(const string&s){
  int n = (int)s.size();
  int sum = 0;
  for(int i = 0; i < n; ++i)sum += s[i] - '0';
  return sum;
}

int main(){
  int x,y,z; cin >> x >> y >> z;
  int n = 0;
  x -= z;
  while(x > 0){
    x -= y;
    x -= z;
    if(x >= 0)n++;
  }
  cout << n << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

// auto mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator-=(const mint a) {
      if ((x += mod-a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
      if (!t) return 1;
      mint a = pow(t>>1);
      a *= a;
      if (t&1) a *= *this;
      return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int n;
vector< vector<int> > amap(25, vector<int>(25, 0));
// dp[決まっている女の集合]
mint dp[(1<<22)];

int main() {
    cin >> n;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            cin >> amap.at(i).at(j);
        }
    }
    memset(dp, 0, sizeof(dp));

    dp[0] = 1;
    for(int bit = 0; bit < (1<<n); ++bit) {
        int ch = 0;
        for(int i = 0; i < n; ++i) if(bit&(1<<i)) ch++;
        for(int j = 0; j < n; ++j) {
            // 今ch人目を入れようとしているからaはch-1人目を☑
            if(bit&(1<<j) && amap[ch-1][j]) {
                dp[bit] += dp[bit^(1<<j)];
            }
        }
    }
    cout << dp[(1<<n)-1] << endl;
}

Measured memory_bytes: 36396
#include<bits/stdc++.h>
using namespace std;
int a,b,n;
int o[20][20]={{}};
int dfs(int x,int y){
  if(x==a&&y==b) return 1;
  if(x>a||y>b) return 0;
  int res=0;
  if(!o[x+1][y]) res+=dfs(x+1,y);
  if(!o[x][y+1]) res+=dfs(x,y+1);
  return res;
}
int main(){
  while(cin >> a >> b,a||b){ 
    cin >> n;
    memset(o,false,sizeof(o));
    int x,y;
    for(int i=0;i<n;i++){
      cin >> x >> y;
      o[x][y]=true;
    }
    cout << dfs(1,1) << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second     
#define fio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define mp make_pair
#define int long long
#define double float
using namespace std;
template <typename T>
void watch(vector<T> v)
{
    for(int i=0;i<v.size();i++)
        cout<<v[i]<<" ";
    cout<<"Look above\n";
    cout<<"\n";
}
const int INF = 1e15;
const int MAX = 1e5+3;
bool comp(pair<int, int> p1, pair<int, int> p2)
{
    if(p1.f > p2.f)
        return true;

    if(p1.f < p2.f)
        return false;

    if(p1.s > p2.s)
        return false;

    return true;
}
int32_t main()
{
    fio
    int n, m, p;
    cin>>n>>m>>p;
    vector<pair<int, pair<int, int> > > edge;
    vector<int> d(n+3, INF);
    for(int i=0;i<m;i++)
    {
        int u, v, w;
        cin>>u>>v>>w;
        edge.pb({-w+p, {u, v}});
    }
    d[1] = 0;
    for(int i=0;i<2*n;i++)
    {
        for(int j=0;j<m;j++)
        {
            int u = edge[j].s.f, v = edge[j].s.s, w = edge[j].f;
            if(d[u] < INF){
                if(d[v] > d[u] + w){
                    if(i < n)
                        d[v] = max(-INF, min(INF, d[u] + w));
                    else
                        d[v] = -INF;
                }
            }
        }
    }
    
    if(d[n] == -INF)
        cout<<-1;
    else
    {
        int ans = max(0LL, -d[n]);
        cout<<ans;
    }

}



Measured memory_bytes: 576
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <map>
#include <set>
using namespace std;

int main()
{
	int32_t N, M;
	cin >> N >> M;

	vector<vector<int32_t>> roads(N);
	for (int32_t i = 0; i < M; i++) {
		int32_t a, b;

		cin >> a >> b;
		a--;
		b--;

		roads[a].push_back(b);
		roads[b].push_back(a);
	}

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

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll MOD = 1e9 + 7;

// North, west, south, east
int dy[] = {-1, 0, 1, 0};
int dx[] = {0, -1, 0, 1};

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<char>> maze(h, vector<char>(w));
    rep(i, h)
    {
        rep(j, w)
        {
            cin >> maze.at(i).at(j);
        }
    }

    int answer = 0;
    for (int sy = 0; sy < h; sy++)
    {
        for (int sx = 0; sx < w; sx++)
        {
            for (int gy = 0; gy < h; gy++)
            {
                for (int gx = 0; gx < w; gx++)
                {
                    if (sy == gy && sx == gx)
                    {
                        continue;
                    }
                    if (maze.at(sy).at(sx) == '#')
                    {
                        continue;
                    }
                    if (maze.at(gy).at(gx) == '#')
                    {
                        continue;
                    }

                    // cout << "path:" << sx << " " << sy << " " << gx << " " << gy << endl;
                    // cout << maze.at(sy).at(sx) << "->" << maze.at(gy).at(gx) << endl;

                    std::queue<std::pair<int, int>> que;

                    std::vector<std::vector<int>> distance(h, std::vector<int>(w, -100));

                    distance[sy][sx] = 0;

                    que.push({sy, sx});

                    while (que.size())
                    {
                        int y, x;
                        std::tie(y, x) = que.front();

                        que.pop();
                        for (int i = 0; i < 4; i++)
                        {
                            int ny = y + dy[i];
                            int nx = x + dx[i];

                            if (ny < 0 || ny >= h || nx < 0 || nx >= w || maze[ny][nx] == '#' || distance[ny][nx] != -100)
                            {
                                continue;
                            }

                            distance[ny][nx] = distance[y][x] + 1;
                            que.push({ny, nx});
                        }
                    }

                    answer = max(answer, distance[gy][gx]);

                    // cout << "pathend:" << sx << " " << sy << " " << gx << " " << gy << endl;
                }
            }
        }
    }

    cout << answer << endl;

    // rep(i, h)
    // {
    //     rep(j, w)
    //     {
    //         cout << s.at(i).at(j);
    //     }
    //     cout << endl;
    // }
}

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

#define REP(i,n) for(ll i=0; i < (n); ++i)
#define REPR(i,n) for(ll i=(n); i >= 0; --i)
#define FOR(i, m, n) for(ll i = (m); i < (n); ++i)

#define INF 1e9

int main(){
  int N;
  cin >> N;
  vector<int> v(N);
  REP(i, N){
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  double ans = v[0];
  REP(i, N-1){
    ans = (ans + v[i+1]) / 2;
  }
  printf("%.9f\n", ans);
  return 0;
}


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

#define ll long long
#define ld long double
#define fi first
#define se second
#define pi 3.1415926535
#define mod1 1000000007
#define mod2 1000000009
#define mp make_pair
#define no_of_digits(n) floor(log10(n)) + 1
#define lcm(a, b) (a/__gcd(a,b)*b)

using namespace std;

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

  string s;
  cin >> s;
  int ok = 0;
  for(int i =0; i < 2; i++){
    for(int j = i+1; j < 3; j++){
      if(s[i] != s[j]){
        ok = 1;
        break;
      }
    }
  }

  cout << (ok?"Yes":"No") << '\n';

  return 0;
}



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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri(), c = ri(), k = ri();
	int a[n];
	for (int i = 0; i < n; i++) a[i] = ri();
	std::sort(a, a + n);
	int cnt = 1;
	int last_time = a[0] + k;
	int pas = 1;
	for (int i = 1; i < n; i++) {
		if (pas >= c || a[i] > last_time) {
			cnt++;
			last_time = a[i] + k;
			pas = 1;
		} else pas++;
	}
	std::cout << cnt << std::endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<math.h>

#define DIV 1000000007
using namespace std;
using ll = long long;

int main(void) {
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	bool flag=false;
	if ((c + b - 1) / b <= (a + d - 1) / d)
		flag = true;

	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main() {
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;
    return 0;
}

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

typedef long long ll;
using namespace std;

int main() {
    int x;
    cin >> x;
    while (1) {
        bool is_prime = true;
        for (int i = 2; i * i <= x; i++) {
            if (x % i == 0) {
                is_prime = false;
                break;
            }
        }
        if (is_prime) {
            cout << x;
            return 0;
        }
        x++;
    }
    return 0;
} 


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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int main(){
    int N, C;
    cin >> N >> C;
    vector<int> A(N), B(N);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<N; i++) cin >> B[i];

    static int64_t accum[401][401];
    for(int i=1; i<=400; i++) for(int j=0; j<=400; j++){
        accum[i][j] = (accum[i-1][j] + power_mod(i, j)) % MOD;
    }

    static int64_t dp[401][401];
    dp[0][0] = 1;

    for(int i=0; i<N; i++) for(int j=0; j<=C; j++) for(int k=0; j+k<=C; k++){
        int64_t c = accum[B[i]][k] - accum[A[i]-1][k] + MOD;
        add(dp[i+1][j+k], dp[i][j] * c);
    }
    cout << dp[N][C] << endl;
    return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int ll;
typedef vector<int > vecint;
typedef vector<string > vecstr;
int main()
{
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> mp(m);
  REP(i,m){cin >> mp[i].second >> mp[i].first;}
  sort(all(mp));
  int ans = 0;
  int t = 0;
  REP(i,m){
    if(mp[i].second >= t){
      t = mp[i].first;
      ans ++;
    }
  }
  cout << ans << endl;
}


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

int main() 
{
    string A,B;
    cin >> A;
    B=A;
    reverse(B.begin(),B.end());
    int count=0;
    int C=A.size();
    for(int i=0; i<C/2; i++)
    {
        if(!(A.at(i)==B.at(i)))
        {
            count++;
        }
    }
    cout << count <<endl;
}

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

int main(){
	int a,b,c,x;
	cin >> a >> b >> c >> x;
	int ans = 0;
	for(int i=0; i<=a; i++){
		for(int j=0; j<=b; j++){
			if(i*500 +j*100 <= x && x <= i*500 +j*100 +c*50){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()

lst = []
bef = S[0]
if bef == '0':
	lst.append(0)
	
count = 0

#run length encoding
for char in S:
	if bef == char:
		count += 1
	else:
		lst.append(count)
		count = 1
		bef = char
		
lst.append(count)

if S[-1] == "0":
	lst.append(0)
	
# 並び方は0101...となるか10101...となるか
l = len(lst)
if l <= 2*K + 1:
	print(N)
	exit()
	
tmp = sum(lst[:2*K+1])
ans = tmp
d = 2*K + 1
for i in range(2*K+1, l, 2):
	tmp -= lst[i-d] + lst[i-d+1]
	tmp += lst[i] + lst[i+1]
	ans = max(ans, tmp)

print(ans)

Measured memory_bytes: 79220
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	char a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a == b || b == c || c == d) cout << "Bad" << endl;
	else cout << "Good" << endl;

	return 0;
}


Measured memory_bytes: 3584
import java.util.*;

public class Main {

    static class Node{
        List<Node> next=new ArrayList<>();
    }

    public static void main(String[] args) {
        Scanner sc  = new Scanner(System.in);
        int N = sc.nextInt();// vertex
        int M = sc.nextInt(); // edges
        Node[] nodes = new Node[N];
        for (int i = 0; i < M ; i++) {
            int x  = sc.nextInt();
            int y  = sc.nextInt();
            if(nodes[x-1]==null){
                nodes[x-1]= new Node();
            }
            if(nodes[y-1]==null){
                nodes[y-1]= new Node();
            }
            Node node = nodes[x-1];
            node.next.add(nodes[y-1]);
        }


        int max =0;
        for (int i = 0; i < N  ; i++) {
//            System.out.println(nodes[i]);
            if(nodes[i] != null ){
                int res = longest(nodes[i]);
//                System.out.println("i="+i+"  path="+res);
                if(res>max) max = res;
            }
        }

        System.out.println(max);
    }
    static Map<Node,Integer> map = new HashMap<>();
    static int longest(Node root ){

        if(map.containsKey(root)){
            return map.get(root);
        }
        List<Node> list = root.next;
        if(list.size()==0) return 0;
        int max =0;
        for(Node node: list){
            int pth = longest( node);
            if(pth>max) max = pth;
        }
        map.put(root,max+1);
        return max+1;
    }
}

Measured memory_bytes: 105876
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<ll, ll> P;
int main()
{
    ll H, W, N;
    cin >> H >> W >> N;
    vector<ll> A(N), B(N);

    map<P, ll> cnt;
    rep(i, N) cin >> A[i] >> B[i];

    rep(i, N) {
        ll r = W - B[i], d = H - A[i];
        if (r >= 2) r = 2;
        if (d >= 2) d = 2;
        r++; d++;
        ll dd = d;
        for (ll w = B[i] - 2; r > 0; r--, w++) {
            d = dd;
            for (ll h = A[i] - 2; d > 0; d--, h++) {
                if (w < 1 || w > W || h < 1 || h > H) continue;
                cnt[P(h, w)]++;
            }
        }
    }

    vector<ll> ans(10);
    ll sum = 0;
    for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
        //cout << itr->first.first << " " << itr->first.second << endl;;
        ans[itr->second]++;
        sum++;
    }

    ll tmp = (H - 2) * (W - 2);
    ans[0] = tmp - sum;
    rep(i, 10) cout << ans[i] << endl;
    return 0;
}

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

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

    int N,i; cin >> N>>i;
    
    cout <<N-i+1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii  pair<int,int>
#define vpii vector<pii>
#define vll  vector<ll>
#define vi  vector<int>
#define pb push_back
#define f  first
#define s  second

int main() {

  int n,k,x,y;
    cin>>n>>k>>x>>y;
    
    if(n<=k)
     {
         cout<<n*x;
         return 0;
     }
   cout<<k*x+(n-k)*y;  
  
    
    
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, P> P3;
typedef pair<P, P> PP;
constexpr ll MOD = ll(1e9 + 7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()



int main() {
    ll n, cnt = 0, ans = 1, b;
    string s;
    cin >> n >> s;
    vector<ll> a(n*2);
    REP(i,n*2){
        if(s[i] == 'B') a[i] = 1;
        else a[i] = 0;
    }
    if(a[0] == 0 || a[n*2-1] == 0){
        cout << 0 << endl;
        return 0;
    }
    b = 1LL;
    cnt = 1;
    for(int i=1;i<n*2;i++){
        if(a[i] == b){
            ans *= cnt;
            ans %= MOD;
            cnt--;
        }
        else{
            cnt++;
        }
        b ^= 1LL;
        if(cnt < 0 || cnt > n){
            ans = 0;
            break;
        }
    }
    if(cnt != 0) ans = 0;
    for(ll i=2;i<=n;i++){
        ans *= i;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2180
/*
AizuOnline A1173
Title The Balance of the World
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
#define LEN 200
char s[LEN];
char stack[LEN];
//
int chk_paren(char * s)
{
  int i,lv;
  char c;
  lv=0;
  for(i=0;i<strlen(s);i++)
    { c=s[i];
      if('('==c || '['==c)
	stack[lv++]=c;
      else if (')'==c)
	{
	  if(lv <= 0)
	    return(0);
	  if(stack[lv-1]!='(')
	    return(0);
	  lv--;
	}
      else if (']'==c)
	{
	  if(lv <= 0)
	    return(0);
	  if(stack[lv-1]!='[')
	    return(0);
	  lv--;
	}
    }
  if(lv==0 && s[i-1]=='.') //last 1 chars=CRLF
    return(1);
  else
    return(0);
}

main()
{
  char *cptr;

  while(1)
    {
      fgets(s,sizeof(s),stdin);
      cptr=strchr(s,'\n');
      if(cptr)*cptr='\0';
      //printf("L%d",strlen(s));
      if(strcmp(".",s)==0)
	break;
      printf("%s\n",chk_paren(s)?"yes":"no");
    }
return(0);
}

Measured memory_bytes: 524