akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL; 
int N;
bitset<60> A[300005];

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

  cin >> N;
  ll a;
  rep(i, N) {
    cin >> a;
    bitset<60> bs(a);
    A[i] = a;
  }
  ll ans = 0ll;
  rep(d, 60) { // 桁数
    ll m = 1ll<<d;
    m%=MOD;
    ll cnt1=0ll;
    ll cnt2=0ll;
    rep(i, N) {
      bitset<60> bs = A[i];
      if (bs[d]) cnt1++;
      else cnt2++; 
    }
    ll sm = cnt1*cnt2%MOD;
    ans+=(sm*m)%MOD;
  }
  ans%=MOD;
  cout << ans << "\n";
  return 0;
}

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

ans = []
def f1():
  for i in range(1,N):
    mx = -(10**7)
    mxi = 0
    for j in range(N):
      if A[j] > mx:
        mx = A[j]
        mxi = j
    A[i] += mx
    ans.append((mxi,i))
def f2():
  for i in range(N-2,-1,-1):
    mn = 10**7
    mni = 0
    for j in range(N):
      if A[j] < mn:
        mn = A[j]
        mni = j
    A[i] += mn
    ans.append((mni,i))

mx = -(10**7)
mxi = 0
mn = 10**7
mni = 0
for i in range(N):
  if A[i] > mx:
    mx = A[i]
    mxi = i
  if A[i] < mn:
    mn = A[i]
    mni = i
if mn >= 0:
  f1()
elif mx <= 0:
  f2()
elif mx >= abs(mn):
  for i in range(N):
    if A[i] < 0:
      A[i] += mx
      ans.append((mxi,i))
  f1()
else:
  for i in range(N):
    if A[i] > 0:
      A[i] += mn
      ans.append((mni,i))
  f2()

print(len(ans))
for a1,a2 in ans:
  print(a1+1,a2+1)


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

using namespace std;

int main(){
	string initial, str;
	int n, l, r, m;

	ios::sync_with_stdio(false);

	cin >> n;

	cout << 0 << endl;
	fflush(stdout);
	cin >> initial;

	if (initial == "Vacant"){
		return 0;
	}

	// Number of even seats
	l = 0;
	r = (n + 1) / 2;

	while (l < r){
		m = (l + r) / 2;

		cout << 2 * m << endl;
		fflush(stdout);
		cin >> str;

		if (str == "Vacant"){
			return 0;
		}

		if (str == initial){
			l = m + 1;
		}
		else{
			r = m;
		}
	}

	// l contains the first different from initial
	cout << ((2 * l - 1) % n + n) % n << endl;
	fflush(stdout);
	cin >> str;

	if (str == "Vacant"){
		return 0;
	}

	cout << ((2 * l - 2) % n + n) % n << endl;
	fflush(stdout);
	cin >> str;

	return 0;
}

Measured memory_bytes: 852
import std.stdio : writeln, write;
import std.array;
import std.range;

int n;
int m;
int star;
int d;
bool[][] map;

int[] dir = [-1, 0];

int[] solve(){
	int[] foot;
	int a = m;
	for(int i=0; i<d; ++i){
		if(map[i][a]){
			++a;
		}else if(map[i][a-1]){
			--a;
		}
		foot ~= a;
	}
	if(a == star) return [0];
	
	debug{foot.dbg;}
	
	bool[][] tmp = map.clone;
	
	a = m;
	for(int i=0; i<d; ++i){
		if(a==foot[i]){
			debug {(i+1).dbg;}
			for(int j=0; j<2; ++j){
				map = tmp.clone;
				map[i][dir[j]+a] = true;
				debug{map[i].dbg;}
				
				bool f = false;
				f |= map[i][0];
				for(int k=1; k<n; ++k){
					f |= map[i][k] && map[i][k+1];
				}
				f |= map[i][n];

				if(!f){
					int ptr = a;
					debug{ dbg("ptr", ptr, "dir", dir[j]); }
					if(j==0){
						--ptr;
					}else{
						++ptr;
					}
					for(int k=i+1; k<d; ++k){
						debug{ dbg("ptr", ptr); }
						if(map[k][ptr]){
							++ptr;
						}else if(map[k][ptr-1]){
							--ptr;
						}
					}
					debug{ dbg("ptr", ptr); }
					
					if(ptr == star){
						return [i+1, a+dir[j]];
					}else{
						debug {dbg("failed", i+1, a+dir[j]);}
					}
				}else{
					debug {dbg("cannot");}
				}
			}
		}else{
			a=foot[i];
		}
	}

	return [1];
}

void main(){
	while(true){
		n.next;
	
		if(n==0)break;
		m.next;
		star.next;
		d.next;
		
		for(int i=0; i<d; ++i) map.nmap;
		
		debug{ map.dbg; }
		
		auto ans = solve;
		for(int i=0; i<ans.length; ++i){
			write = ans[i];
			if(i+1<ans.length){
				write = " ";
			}
		}
		writeln;
		
		map = map.init;
	}
}

void nmap(ref bool[][] m){
	string str = readln.chomp;
	bool[] m_;
	m_ ~= false;
	foreach(c; str){
		m_ ~= c=='1';
	}
	m_ ~= false;
	m ~= m_;
}

import std.stdio : readln, chomp;
import std.conv : to;
import std.string : split;
shared string[] input;
shared string delim = " ";
T next(T)()
in
{
	if(input.length==0){
		input ~= readln.chomp.split(delim);
	}
}
out
{
	input.popFront;
}
body
{
	return input.front.to!T;
}

void next(T)(ref T v){
	v = next!T();
}


void dbg(T...)(T vs)
{
	import std.stdio : stderr;
	foreach(v; vs)
		stderr.write(v.to!string ~ " ");
	stderr.write("\n");
}

T clone(T)(T v){
	T v_;
	static if(isInputRange!(T)){
		foreach(ite; v){
			v_ ~= ite.clone;
		}
	}else{
		v_ = v;
	}
	
	return v_;
}

Measured memory_bytes: 1044
//minamoto
#include<bits/stdc++.h>
#define R register
#define fi first
#define se second
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=1e5+5,inf=0x3f3f3f3f;
typedef pair<int,int> pi;
pi L[N],a[N];int b[N],suf[N],n,res,mxl,mxr,len;
int main(){
	scanf("%d",&n);
	mxl=mxr=1,len=0;
	fp(i,1,n){
		scanf("%d%d",&L[i].fi,&L[i].se),++L[i].se;
		cmax(len,L[i].se-L[i].fi);
		if(L[i].fi>L[mxl].fi)mxl=i;
		if(L[i].se<L[mxr].se)mxr=i;
	}
	cmax(res,len+max(0,L[mxr].se-L[mxl].fi));
	if(mxl==mxr)return printf("%d\n",res),0;
	fp(i,1,n){
		a[i].fi=max(L[i].se-L[mxl].fi,0);
		a[i].se=i;
		b[i]=max(L[mxr].se-L[i].fi,0);
	}
	sort(a+1,a+1+n),reverse(a+1,a+1+n);
	suf[n+1]=inf;
	fd(i,n,1)suf[i]=min(suf[i+1],b[a[i].se]);
	fp(i,1,n-1)cmax(res,a[i].fi+suf[i+1]);
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	vector<ll> b(n + 1);
	for(int i = 0; i < n; ++i){
		b[i + 1] = b[i] + a[i];
	}
	map<ll, ll> mp;
	for(int i = 0; i <= n; ++i){ ++mp[b[i]]; }
	ll answer = 0;
	for(int i = 0; i < n; ++i){
		--mp[b[i]];
		answer += mp[b[i]];
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 15872
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def cost(index, a,b,c):
    if index == N:
        return (abs(a-A) + abs(b-B) + abs(c-C) - 30) if min(a,b,c) > 0 else INF
    ret0 = cost(index+1, a,b,c)
    ret1 = cost(index+1, a+l[index],b,c) + 10
    ret2 = cost(index+1, a,b+l[index],c) + 10
    ret3 = cost(index+1, a,b,c+l[index]) + 10
    return min(ret0, ret1, ret2, ret3)

print(cost(0,0,0,0))

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

int main()
{
  string x;
  int i, sum;
  
  while(1)
    {
      sum=0;
      cin >> x;
      
      if(x == "0")
	break;

      for(i=0; i<(int)x.size(); i++)
	sum += (int)x[i]-'0';

      cout << sum << endl;

    }
}

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

// macros
#define int long long 
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define PB push_back
#define MP make_pair
#define bitcount __builtin_popcount
#define watch(x) cerr<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long double ld;

// template functions
template < typename A, typename B >
ostream& operator << ( ostream& os, const pair< A, B > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "{";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename A, typename B >
ostream &operator << ( ostream & os, const map< A, B > &v ) {
    os << "[";
    typename map< A, B >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " -> " << it -> second ;
    }
    return os << "]";
}
template <typename T>
inline void printV(vector<T>& a, int n) { for(int i=0; i<n; i++) { cerr<<a[i]<<" "; } cerr<<"\n"; }
template <typename T>
inline void printVV(vector<vector<T>>& a) { for(int i=0; i<sz(a); i++) { cerr<<a[i]<<"\n"; } cerr<<"\n"; }
template <typename T>
inline void clearVV(vector<vector<T>>& a) { for(auto &x : a) { x.clear(); } a.clear(); }
template <typename T>
inline void assignVV(vector<vector<T>> &a, T val) { for(int i=0; i<sz(a); i++) { a[i].assign(sz(a[i]), val); } }
template<typename T>
T gcd(T a, T b) { if(a==0 or b==0) return a+b; return gcd(b, a%b) ; }

// random number generation
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// constants
const long double eps = LDBL_EPSILON;
const int inf = 5e8;
const int modn = 1e9+7;
const int MAX = 1e5;


int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0; i<n; i++) {
		cin>>a[i];
	}
	int ans =0 ;
	for(int i=1; i<n-1; i++) {
		int pi = a[i];
		vector<int> tmp{a[i-1], a[i], a[i+1]};
		sort(all(tmp));
		if(pi == tmp[1]) ans++;
	}
	cout<<ans<<"\n";
    return 0;
}



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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int N=1e5 + 5;
const int M=1e9 + 7;

int32_t main()
{
	IOS;
	//memset(dp,-1,sizeof(dp));	
	int n;
	cin >> n;
	int fact[10];
	fact[1] = 1;
	fact[0] = 1;
	rep(i,2,8)
	{
		fact[i] = fact[i-1]*i;
	}
	map<string,int> mp;
	int T;
	T = fact[n];
	string s = "";
	rep(i,1,n)
	{
		char c = i + '0';
		s += c;
	}
	int c=1;
	while(T--)
	{
		mp[s] = c;
		c++;
		next_permutation(all(s));
	}
	string s1 = "";
	rep(i,1,n)
	{
		int x;
		cin >> x;
		char xx = x + '0';
		s1 += xx;
	}
	string s2 = "";
	rep(i,1,n)
	{
		int x;
		cin >> x;
		char xx = x + '0';
		s2 += xx;
	}
	cout << abs(mp[s1] - mp[s2]) << endl;
}


Measured memory_bytes: 4736
import numpy as np

A,B = map(int, input().split())
tmp1 = int(np.ceil(A/0.08))
tmp2 = int(B/0.1)

if tmp1>=tmp2:
    max=tmp1
    if int(np.floor(max*0.1))==B:
        print(max)
    else:
        print(-1)
else:
    max=tmp2
    if int(np.floor(max*0.08))==A:
        print(max)
    else:
        print(-1)

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

string pls(string a,string b)
{
	string ret;
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	if(a.size()<b.size())swap(a,b);
	while(b.size()  !=a.size()  )b+='0';
	while(ret.size()!=a.size()+1)ret+='0';
	for(int i=0;i < a.size(); i++){
		ret[i] = a[i] + b[i] + ret[i] - '0'*3;
		if(ret[i]>9){
			ret[i] = '0' + ret[i]%10;
			ret[i+1] = '1';
		}else{
			ret[i]= '0' + ret[i];
		}
	}
	reverse(ret.begin(),ret.end());
	if(~ret.find_first_not_of('0'))return ret.substr(ret.find_first_not_of('0'),ret.size()-ret.find_first_not_of('0'));
	else return "0";
}

bool func(vector<string> f , int n)
{
	for(int i=0;i<3;i++){
		for(int j=0;j<f[i].length();j++){
			if(f[i][j]=='X'){
				f[i][j]='0'+n;
			}
		}
	}
	return ( pls(f[0],f[1]) == f[2] );
}

int main()
{
	bool flag;
	int ret;
	vector<string> m;
	string s,t;
	while(cin >> s){
		s+=" ";
		m.clear();
		flag = false;
		ret = -1;
		
		for(int i=0;i<s.length();i++){
			if(s[i]>='0' && s[i]<='9' || s[i]=='X'){
				t+=s[i];
			}else{
				if(t.size()>=2 && t[0] == 'X')flag = true;
				m.push_back(t);
				t.clear();
			}
		}
		for(int i=(flag?1:0);i<10;i++){
			if(func(m,i))ret=i;
		}
		if(~ret)cout << ret << endl;
		else cout << "NA" << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
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;
}

signed main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B and B == C)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    // system("pause");
}

Measured memory_bytes: 256
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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;
}

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n;
	string s;
	cin >> n >> s;

	REP(i, 2) {
		REP(j, 2) {
			Array ans(n, -1);//wolf:0 sheep:1
			ans[n-1] = i;
			ans[0] = j;

			bool flag = true;
			REP(k, n) {
				if (s[k] == 'o') {
					if (ans[k] == 1) {
						if (ans[(k + 1) % n] == -1) {
							ans[(k + 1) % n] = ans[(k - 1 + n) % n];
						}
						else {
							if (ans[(k + 1) % n] != ans[(k - 1 + n) % n]) {
								flag = false;
								break;
							}
						}
					}
					else {
						if (ans[(k+1) % n] == -1) {
							if (ans[(k-1+n) % n] == 1) {
								ans[(k + 1) % n] = 0;
							}
							else {
								ans[(k + 1) % n] = 1;
							}
						}
						else {
							if (ans[(k + 1) % n] == ans[(k - 1 + n) % n]) {
								flag = false;
								break;
							}
						}
					}
				}
				else {
					if (ans[k] == 0) {
						if (ans[(k + 1) % n] == -1) {
							ans[(k + 1) % n] = ans[(k - 1 + n) % n];
						}
						else {
							if (ans[(k + 1) % n] != ans[(k - 1 + n) % n]) {
								flag = false;
								break;
							}
						}
					}
					else {
						if (ans[(k + 1) % n] == -1) {
							if (ans[(k - 1 + n) % n] == 1) {
								ans[(k + 1) % n] = 0;
							}
							else {
								ans[(k + 1) % n] = 1;
							}
						}
						else {
							if (ans[(k + 1) % n] == ans[(k - 1 + n) % n]) {
								flag = false;
								break;
							}
						}
					}
				}
			}


			if (flag) {
				for (auto i : ans) {
					if (i == 0) {
						cout << "W";
					}
					else {
						cout << "S";
					}
				}
				cout << endl;
				return 0;
			}
		}
	}
	


	cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 1360
#include<bits/stdc++.h>
using namespace std;
string debug_string(const string& s) {
	return '"' + s + '"';
}
string debug_string(bool b) {
	return (b ? "true" : "false");
}
string debug_string(const char* s) {
	return debug_string((string)s);
}
template<class T, class U>
string debug_string(const pair<T, U>& p);
template<class U>
struct can_be_string {
	template<typename...>
	static int f(...) {
		return 0;
	}
	template<typename T>
	static char f(decltype(to_string(T()), char())) { 
		return 'a';
	}
	static const bool value = sizeof(f<U>(char())) == sizeof(char);
};
template<class T> 
typename enable_if<can_be_string<T>::value, string>::type debug_string(const T& a) {
	string s = to_string(a);
	return s;
}
template<class T>
typename enable_if<!can_be_string<T>::value, string>::type debug_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += debug_string(x);
	}
	s += "}";
	return s;
}
template<class T, class U>
string debug_string(const pair<T, U>& p) {
	string s = "(";
	s += debug_string(p.first);
	s += ", ";
	s += debug_string(p.second);
	s += ")";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << debug_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 1e18l + 100;
int solve(const string& a) {
	int res = 0;
	for (int i = 0;i < (int)a.size() - 1;++i) {
		if (a[i] == a[i + 1]) {
			++res;
		}
	}
	return res;
}
bool comp(const pair<int, int>& a, const pair<int, int>& b) {
	return a.second - a.first > b.second - b.first;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	vector<pair<int, int>> good[2];
	int l = 0;
	for (int i = 1;i < n;++i) {
		if (s[i] == s[i - 1]) {
			continue;
		}
		else {
			if (s[i - 1] == 'L') {
				good[0].emplace_back(l, i - 1);
			}
			else {
				good[1].emplace_back(l, i - 1);
			}
			l = i;
		}
	}
	sort(good[0].begin(), good[0].end());
	sort(good[1].begin(), good[1].end());
	string t = s;
	for (int i = 0;i < min(k, (int)good[0].size());++i) {
		int l = good[0][i].first;
		int r = good[0][i].second;
		for (int j = l;j <= r;++j) {
			assert(t[j] == 'L');
			t[j] = 'R';
		}
	}
	int answer = solve(t);
	t = s;
	for (int i = 0;i < min(k, (int)good[1].size());++i) {
		int l = good[1][i].first;
		int r = good[1][i].second;
		for (int j = l;j <= r;++j) {
			assert(t[j] == 'R');
			t[j] = 'L';
		}
	}
	answer = max(answer, solve(t));
	cout << answer << '\n';
	return 0;
}


Measured memory_bytes: 1356
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N,H;
  cin>>H>>N;
  vector<int> A(N);
  rep(i,N) cin>>A[i];

  int sum=0;
  rep(i,N) sum+=A[i];
  if(sum>=H) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 640
N,A,B=map(int,input().split())
ant=0
for i in range(1,N+1):
  sum=0
  j = i
  while j != 0:
    hoge = j % 10
    sum = sum + hoge
    j = j // 10
  if A <= sum <= B:
    ant = ant + i
print(ant)

Measured memory_bytes: 3060
/*************************************\
*           بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ             *
*             رَّبِّ زِدْنِى عِلْمًا                *
*   Mir Abdullah yousuf, KUET_EEE14   *
\*************************************/
#include <bits/stdc++.h>
#define LL              long long
#define PI              acos(-1.0)
#define PII             pair<int,int>
#define xx              first
#define yy              second
#define MS(a,b)         memset(a, b, sizeof (a))
#define MP(a,b)         make_pair(a, b)
#define pb              push_back
#define sf(a)           scanf("%d", &a)
#define sfl(a)          scanf("%lld", &a)
#define READ()          freopen("input.txt", "r", stdin)
#define WRITE()         freopen("output.txt", "w", stdout)
#define GCD(a, b)       __gcd(a, b)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define sqr(a)          (a) * (a)
#define MOD             1000000007
#define MAX             1000000 + 5
#define inf             2147483647
using namespace std;

///***********-8-direction*************/
//int fx[] = {1, -1, 0, 0, 1, -1, -1, 1};
//int fy[] = {0, 0, 1, -1, 1, 1, -1, -1};
//
///***********-4-direction*************/
//int fx[] = {1, -1, 0, 0};
//int fy[] = {0, 0, 1, -1};


int main()
{
    int n, k; cin >> n >> k;
    int ara[n];
    for (int i = 0; i < n; i++) sf(ara[i]);
    int mini = 0;
    for (int i = 0; i < n; i++) {
        mini += min(abs(ara[i] - k), ara[i]);
    }
    cout << mini * 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define max 300000

typedef struct process{
  char name[256];
  int time;
} p;

int  head = 0, tail = 0, n;
p Q[max+1];

void enqueue(struct process);
p dequeue(void);

int main(){
  int i, q, temp, passage = 0;
  p dq;

  scanf("%d%d", &n, &q);

  head = 1; 
  tail = n + 1;

  for(i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].time);
  }

  while( !(tail == head)){
    p dq = dequeue();
    if(q > dq.time)   temp = dq.time;
    else               temp = q;
    passage += temp;
    dq.time -= temp;
    if(dq.time > 0)   enqueue(dq);
    else                     printf("%s %d\n", dq.name, passage);
  }
      
  return 0;
}

void enqueue(p x){
  Q[tail] = x;
  if(tail + 1 == max)    tail = 0;
  else                           tail++;
}

p dequeue(void){
  p x = Q[head];
  if(head + 1 == max)    head = 0;
  else                              head++;
  return x;
}

Measured memory_bytes: 49748
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

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

fn bfs(start: usize, edges: &Vec<Vec<usize>>) -> Option<(i64, Vec<usize>)> {
    let mut que = VecDeque::new();
    que.push_back(start);
    let mut dist = vec![std::i64::MAX; edges.len()];
    dist[start] = 0;
    let mut from = vec![std::usize::MAX; edges.len()];
    while let Some(cur) = que.pop_front() {
        for &to in edges[cur].iter() {
            if dist[to] < std::i64::MAX {
                continue;
            }
            dist[to] = dist[cur] + 1;
            que.push_back(to);
            from[to] = cur;
        }
    }
    let mut min_dist = std::i64::MAX;
    let mut goal = std::usize::MAX;

    for cur in 0..edges.len() {
        for &to in edges[cur].iter() {
            if start == to {
                if dist[cur] < min_dist {
                    min_dist = dist[cur];
                    goal = cur;
                }
                break;
            }
        }
    }
    if min_dist == std::i64::MAX {
        return None;
    }

    // back_trace
    let mut root = vec![start, goal];
    let mut cur = goal;
    while from[cur] != start {
        root.push(from[cur]);
        cur = from[cur];
    }
    root.push(start);
    root.reverse();
    Some((min_dist + 1, root))
}

fn main() {
    let v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let mut edges = vec![vec![]; n];
    for i in 0..m {
        let v = read_vec::<usize>();
        let (a, b) = (v[0] - 1, v[1] - 1);
        edges[a].push(b);
    }

    let mut min_cycle = std::i64::MAX;
    let mut min_root = vec![];
    for i in 0..n {
        if let Some((cycle, root)) = bfs(i, &edges) {
            if cycle < min_cycle {
                min_cycle = cycle;
                min_root = root;
            }
        }
    }
    if min_cycle == std::i64::MAX {
        println!("-1");
    } else {
        println!("{}", min_cycle);
        // debug!(min_root);
        for i in 0..min_root.len() - 1 {
            println!("{}", min_root[i] + 1);
        }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define x first
#define y second
#pragma gcc optimize("O3")
#pragma gcc optimize("Ofast")
#pragma gcc optimize("unroll-loops")
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef long double ld;
typedef pair <int,int> pi;
typedef pair <ll,ll> pl;
typedef vector <int> vec;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int x; cin >> x;
    cout << !x;
}


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

char chess(int h, int w){
    if((h+w)%2==0){
        return '#';
    }
    return '.';
}

int main(void){
    int H, W;
    while(true){
        cin >> H >> W;
        if(H==0 && W==0){
            break;
        }
        for(int i=0; i < H; i++){
            for(int j = 0; j < W; j++){
                cout << chess(i,j);
            }
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3088
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  double a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f;
  double d_m = e/(e+100);
  double ans = 0;
  int water=a, sugar=0;
  for(int i=0; i<=30; i++){
    for(int j=0; i+j<=30; j++){
      double w = (a*i+b*j)*100;
      if(w>f||w==0) continue;

      for(int k=0; k<=3000; k++){
        for(int l=0; k+l<=3000; l++){
          double s = c*l+d*k;
          double n = s/(s+w);
          if(w+s>f||n>d_m) continue;

          if(ans<=n){
            ans = n;
            water=w; sugar=s;
          }
        }
      }
    }
  }
  cout << water+sugar SP sugar << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
    int d,i,sum;
    scanf("%d",&d);
    int a[d];
    for(i=0;i<d;i++)
    scanf("%d",&a[i]);
    sort(a,a+d);
    for(i=0;i<d-1;i++)
    sum=sum+a[i];
    sum=sum+(a[d-1]/2);
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 256
data = [
    [[0 for r in range(10)] for f in range(3) ] for b in range(4)
] 


count = int(input())
for c in range(count):
    b, f, r, v = [int(i) for i in input().split()]
    data[b-1] [f-1] [r-1] += v

for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')
        print()
    
    if bi < 3:
        print('#' * 20)

Measured memory_bytes: 7680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    BufferedReader rd;

    Main() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        long[] a = longarr();
        long n = a[0];
        long k = a[1];
        out(solve(n,k));
    }

    private long solve(long n, long k) {
        long res;
        if(k == 0) {
            res = n*n;
        } else {
            res = 0;
            for (long b = k + 1; b <= n; b++) {
                long m = n / b;
                res += m * (b - k);
                long d = m * b + k;
                if (d <= n) {
                    res += n - d + 1;
                }
            }
        }
        return res;
    }

    private long[] longarr() throws IOException {
        return longarr(rd.readLine());
    }

    private long[] longarr(String s) {
        String[] q = split(s);
        int n = q.length;
        long[] a = new long[n];
        for(int i=0;i<n;i++) {
            a[i] = Long.parseLong(q[i]);
        }
        return a;
    }

    private String[] split(String s) {
        if(s == null) {
            return new String[0];
        }
        int n = s.length();
        int start = -1;
        int end = 0;
        int sp = 0;
        boolean lastWhitespace = true;
        for(int i=0;i<n;i++) {
            char c = s.charAt(i);
            if(isWhitespace(c)) {
                lastWhitespace = true;
            } else {
                if(lastWhitespace) {
                    sp++;
                }
                if(start == -1) {
                    start = i;
                }
                end = i;
                lastWhitespace = false;
            }
        }
        if(start == -1) {
            return new String[0];
        }
        String[] res = new String[sp];
        int last = start;
        int x = 0;
        lastWhitespace = true;
        for(int i=start;i<=end;i++) {
            char c = s.charAt(i);
            boolean w = isWhitespace(c);
            if(w && !lastWhitespace) {
                res[x++] = s.substring(last,i);
            } else if(!w && lastWhitespace) {
                last = i;
            }
            lastWhitespace = w;
        }
        res[x] = s.substring(last,end+1);
        return res;
    }

    private boolean isWhitespace(char c) {
        return c==' ' || c=='\t';
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new Main();
    }
}


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

using namespace std;

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

    int n, k, ind, ans = 0;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        if (tmp == 1)
            ind = i;
    }

    for (int i = ind; i < n; i += k - 1)
        ans++, ans -= (i == n - 1);

    for (int i = ind; i >= 0; i -= (k - 1))
        ans++, ans -= (!i);

    cout << min(ans, (n - 1) / (k - 1) + ((n - 1) % (k - 1) != 0)) << '\n';

    return 0;
}


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

const int INF = 1001001001;

/*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, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/

int n, m, q;
vector<int> a(0);
vector<int> b(0);
vector<int> c(0);
vector<int> d(0);
int ans = 0;

void dfs(int _now_num, vector<int> a_array) {
    if (_now_num == n) {
        int num = 0;
        for (int i = 0; i < q; i++) {
            if (a_array[b[i] - 1] - a_array[a[i] - 1] == c[i])
                num += d[i];
        }
        ans = max(num, ans);
        return;
    }
    else {
        int num = 1;
        if (a_array.size() != 0)
            num = a_array[a_array.size() - 1];
        for (int i = num; i <= m; i++) {
            a_array.emplace_back(i);
            dfs(_now_num + 1, a_array);
            a_array.erase(a_array.begin() + _now_num);
        }
    }
}

int main() {
    cin >> n >> m >> q;
    rep(i, q) {
        int n_a, n_b, n_c, n_d;
        cin >> n_a >> n_b >> n_c >> n_d;
        a.emplace_back(n_a);
        b.emplace_back(n_b);
        c.emplace_back(n_c);
        d.emplace_back(n_d);
    }
    vector<int> a_array(0, 0);
    vector<int> nokori(0);
    for (int i = 0; i < m; i++) {
        nokori.emplace_back(i);
    }
    dfs(0, a_array);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define ll  long long
#define mod 1000000007
ll int v;
map<ll int,list<ll int> > m;
ll int dp[100002][2];
ll int ans(ll int node,ll int par)
{ll int w=1;
	ll int b=1;
	bool c=false;
for(auto i: m[node])
{
if(i!=par)
{c=true;
ans(i,node);
b=( (b%mod)   * (dp[i][0]%mod) )%mod;
w=((w%mod)   * (dp[i][1]%mod) )%mod;

}	
}

int op3=1;
for(auto i: m[node])
{if(i!=par)
	{
		op3=(  (op3%mod)  *( dp[i][0]%mod + dp[i][1]%mod )%mod ) %mod;
	}

}

if(c==false)
{
dp[node][0]=1;
dp[node][1]=1;
}
else
{

	dp[node][1]=op3;
	dp[node][0]=w;

}

return 0;

}
int main()
{
	
cin>>v;
for(ll int i=1;i<v;i++)
{ll int e,f;
	cin>>e>>f;
	m[e].push_back(f);
m[f].push_back(e);
}
ll int d=ans(1,-1);



cout<<(dp[1][0]%mod+dp[1][1]%mod)%mod<<endl;
}

Measured memory_bytes: 24064
N = int(input())
s = []
for i in range(N):
    s.append(str(input()))
M = int(input())
t = []
for i in range(M):
    t.append(str(input()))
    
from collections import Counter
import numpy as np
counter = Counter(s)
sw = []
sc = []
for word, cnt in counter.most_common():
    sw.append(word)
    sc.append(cnt)
counter2 = Counter(t)
tw = []
tc = []
for word, cnt in counter2.most_common():
    tw.append(word)
    tc.append(cnt)
    
sw = np.array(sw)
sc = np.array(sc)
tw = np.array(tw)
tc = np.array(tc)

anslist = []
for i in range(len(sw)):
    anslist.append(sc[i] - sum((sw[i] == tw)*tc))
ans = max(anslist)
if(ans < 0):
    print("0")
else:
    print(ans)

Measured memory_bytes: 21468
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;
int n;

void dfs() {

}

int main() {
    cin >> n;
    vector<int> c1(n), c2(n), sums1(n+1, 0), sums2(n+1, 0);
    rep(i, n) cin >> c1[i];
    rep(i, n) cin >> c2[i];
    rep(i, n) {
        sums1[i+1] = sums1[i]+c1[i];
        sums2[i+1] = sums2[i]+c2[i];
    }

    int ans = 0;
    for(int i = 1; i <= n; i++) ans = max(ans, sums1[i] + sums2[n] - sums2[i-1]);
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int n = Integer.valueOf(arr01[0]);
        int m = Integer.valueOf(arr01[1]);

        ArrayList<Integer> list02 = new ArrayList<Integer>();
        ArrayList<Integer> list03 = new ArrayList<Integer>();

        for (int j = 1; j <= n; j++) {
            list02.add(0);
            list03.add(0);

        }

        for (int i = 1; i < 1 + m; i++) {

            String arr_temp[] = mylist.get(i).split(" ");
            int p = Integer.valueOf(arr_temp[0]);
            String s = arr_temp[1];

            if (s.equals("AC") && list02.get(p - 1) == 0) {
                list02.set(p - 1, 1);
            }
            if (s.equals("WA") && list02.get(p - 1) == 0) {
                int val = list03.get(p - 1);
                list03.set(p - 1, val + 1);
            }

        }

        int mysum1 = 0;
        int mysum2 = 0;

        for (int k = 1; k <= n; k++) {

            if (list02.get(k - 1) >= 1) {
                mysum1 += 1;
                mysum2 += list03.get(k - 1);

            }
        }

        //        int mysum1 = list02.stream()
        //                .mapToInt(x -> x)
        //                .sum();
        //        int mysum2 = list03.stream()
        //                .mapToInt(x -> x)
        //                .sum();

        System.out.println(mysum1 + " " + mysum2);

    }

}


Measured memory_bytes: 52880
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;
const ll oo = 1e18L+7;

int abso(ll a) {
    if(a < 0) return -a;
    return a;
}

vector<ll> h, dp;
int n, k;

int main() {
    
    scanf("%d%d",&n,&k);
    h.resize(n+1);
    
    for(int i = 1; i <= n; ++i) {
        scanf("%lld",&h[i]);
    }
    
    dp.assign(n+1, oo);
    dp[1] = 0;
    
    for(int i = 1; i <= n; ++i) {
        for(int j = i+1; j <= i+k && j <= n; ++j) {
            dp[j] = min(dp[j], dp[i]+abso(h[i]-h[j]));
        }
    }

    printf("%lld\n", dp[n]);
    
    return 0;
}




Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define LL long long
#define MOD 1000000007
using namespace std;

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  LL a,b,c,d, rema=0, remb=0;
  
  cin>>a>>b>>c>>d;
  if(c%b!=0){
  	rema++;
  }
  if(a%d!=0){
    remb++;
  }
   if((c/b)+rema <= (a/d)+remb)
     cout<<"Yes"<<"\n";
   else
    cout<<"No"<<"\n";
  
  
return 0;
}

Measured memory_bytes: 3580
N=int(input())
L=list(map(int,input().split()))
C=0
#print(L)

for i in range(N-2):
  if (L[i]>L[i+1] and L[i+1]>L[i+2]) or (L[i]<L[i+1] and L[i+1]<L[i+2]):
    C=C+1
    
print(C)

Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        System.out.println(z+" "+x+" "+y);
    }

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

Measured memory_bytes: 23764
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        string s = Console.ReadLine();
        char[] c = s.ToCharArray();
        int[] num = Array.ConvertAll<char,int>(c,delegate(char d){return int.Parse(d.ToString());});
        if(int.Parse(s)%num.Sum() == 0)Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}


Measured memory_bytes: 13268
s = raw_input()
abcd = map(int, s.split())
if abcd[0] > abcd[2]:
	begin = abcd[0]
else:
	begin = abcd[2]
if abcd[1] > abcd[3]:
	end = abcd[3]
else:
	end = abcd[1]

if (end - begin) >= 0:
	print(end - begin)
else:
	print(0)


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

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

Measured memory_bytes: 256
N , M , X = map(int,input().split())
cost_ = []
A = []
for i in range(N):
    temp_ = list(map(int,input().split()))
    cost_.append(temp_[0])
    del temp_[0]
    A.append(temp_)

    
opt_cost = 10 ** 10    
    
for i in range(2 ** N):
    temp_num = i
    lst_ = []
    for j in range(N):
        if temp_num % 2 == 0:
            lst_.append(0)
        else:
            lst_.append(1)
        temp_num = temp_num // 2
        
        
    temp_cost = 0
    temp_ability = [0 for n in range(M)]
    
    for k in range(N):
        if lst_[k] == 1:
            temp_cost += cost_[k]
            for a in range(M):
                temp_ability[a] += A[k][a]
    
    if min(temp_ability) >= X:
        if temp_cost <= opt_cost:
            opt_cost = temp_cost

if opt_cost == 10 ** 10:
    print(-1)
else:
    print(opt_cost)
    

Measured memory_bytes: 9240
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pll;
ll x, n, mn;
set<ll>st;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> x >> n;
    while(n--)
    {
        ll y;
        cin >> y;
        st.insert(y);
    }
    while(1)
    {
        if(st.find(x - mn) == st.end())
            return cout << x - mn, 0;
        if(st.find(x + mn) == st.end())
            return cout << x + mn, 0;
        ++mn;
    }
    return 0;
}


Measured memory_bytes: 3636
def myAnswer(S:str) -> str:
   N = len(S) - 7
   for i in range(N,len(S)):
      # print(S[:i-N],S[i:])
      if(S[:i-N]+S[i:] == "keyence"):
         return "YES"
   return "NO"



def modelAnswer():
   return
def main():
   S = (input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long int ll;

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

	int ans = 10000000;
	for (int i = 1; i <= N / 2; ++i) {
		int a = i;
		int b = N - a;

		int sum = a % 10 + (a / 10) % 10 + (a / 100) % 10 + (a / 1000) % 10 + (a / 10000) +
			b % 10 + (b / 10) % 10 + (b / 100) % 10 + (b / 1000) % 10 + (b / 10000);

		ans = min(ans, sum);
	}

	cout << ans << endl;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    ll sum1 = 0, sum2 = 0;
    REP(i,0,N) sum1 += A[i];
    ll m = sum1;
    REP(i,0,N) {
        sum1 -= A[i];
        sum2 += A[i];
        m = MIN(abs(sum1-sum2),m);
    }
    PR(m);

    return 0;
}

/*



*/

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

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

    int ans = 0;
    ans += B[A[0]];
    for(int i=1; i<N; i++){
        ans += B[A[i]];
        if(A[i-1]+1 == A[i])
            ans += C[A[i-1]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.Scanner;

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

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] A = new int[N];

		for(int i=0;i<N;i++) {
			A[i] = sc.nextInt();
		}
		int height = A[0];
		long ans = 0;
		for(int i=1;i<N;i++) {
			if(A[i]>height) {
				height = A[i];
			} else {
				ans += height - A[i];
			}
		}
		System.out.println(ans);

	}
}

Measured memory_bytes: 59516
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
#import copy

#import numpy as np

l=int(input())
if l%3==0:
    print((l//3)**3)
elif l%3==1:
    print((l/3)**3)
else:
    print((l/3)**3)


Measured memory_bytes: 3060