akhauriyash/Code-Regression huggingface dataset:
/*
** author:mahmoud magdy
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

inline int D()
{
    int m ;
    cin>>m;
    return m ;
}
inline ll lD()
{
    ll m ;
    cin>>m;
    return m ;
}
inline double dD()
{
    double m;
    cin>>m;
    return m;
}
void fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
int n,w;
ll dp[105][100005],a[105],b[105];
ll solve(int i,int k)
{
    if(i==n)
    {
        return 0;
    }
    if(dp[i][k]!=-1)return dp[i][k];

    if(k<a[i])
        solve(i+1,k);
    else
        return dp[i][k]=max(solve(i+1,k),b[i]+solve(i+1,k-a[i]));
}
int main()
{
    fast();
    memset(dp,-1,sizeof dp);
    n=D();
    w=D();
    for(int i=0; i<n; ++i)
    {
        a[i]=D();
        b[i]=D();
    }
    cout<<solve(0,w)<<endl;
}


Measured memory_bytes: 82304
//ABC163 A

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = s; i < (int)(n); i++)
const lint mod = 1000000007;


lint ans = 0;
lint n;
lint a[300000];


int main() {
  cin >> n;

/*   rep(i,n){
    scanf("%lld",&a[i]);
  } */
  double PI=3.14159265358979323846;
  
  printf("%lf\n",2*n*PI);
}


Measured memory_bytes: 3728
/****************
 *		*
 * ALDS_1_4_B:  *
 * BinarySearch *
 *		*
 * 2019/08/15   *
 ****************/

#include<iostream>

#define MAX_ARRAY 100000

using namespace std;

bool binary_search(int* a,int num_array,int key);

int main(void){

  int n,S[MAX_ARRAY];
  int q,T;
  int count_match = 0; 

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

  cin >> q;
  for(int i=0;i<q;i++) {
    cin >> T;
    count_match += (int)(binary_search(S,n,T));
  }

  cout << count_match << endl;
  
  return 0;
}

bool binary_search(int *a,int num_array,int key){
  
  int left = 0;
  int right = num_array;
  int mid;
  
  while(left < right){
    mid = (left+right)/2;
    
    if(a[mid] == key) return true;
    else {
      if(a[mid] <key) left = mid+1;
      else right = mid;
    }
  }
  return false;
}



Measured memory_bytes: 3492
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a*b;
        int length = (a+b)*2;
        System.out.println(area+" "+length);
        sc.close();
    }
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    n=n%10;
    if(n==3)
    {
        cout<<"bon";
    }
    else if(n==0||n==1||n==6||n==8)
    {
        cout<<"pon";
    }
    else
    {
        cout<<"hon";
    }
    return 0;
}

Measured memory_bytes: 3652
suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]
for _ in range(int(input())):
    card = input().split()
    deck[suit[card[0]]][int(card[1]) - 1] = ""
for i in range(4):
    for j in range(13):
        if deck[i][j] != "":
            print(deck[i][j])



Measured memory_bytes: 5600
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

int main()
{
  char b;
  cin >> b;

  if (b == 'A')
  {
    cout << "T" << endl;
  }
  else if (b == 'C')
  {
    cout << "G" << endl;
  }
  else if (b == 'G')
  {
    cout << "C" << endl;
  }
  else if (b == 'T')
  {
    cout << "A" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
def main():
	n, m, *L = map(int, open(0).read().split())
	AB = L[:2 * m]
	Q = L[2 * m + 1:][::-1]
	G = [[] for _ in range(n)]
	C = [0] * n
	D = [-1] * n
	for a, b in zip(*[iter(AB)] * 2):
		a -= 1
		b -= 1
		G[a] += [b]
		G[b] += [a]
	for c, d, v in zip(*[iter(Q)] * 3):
		if D[v - 1] >= d:
			continue
		D[v - 1] = d
		q = [v - 1]
		while q:
			cur = q.pop()
			dd = D[cur]
			if not C[cur]:
				C[cur] = c
			if not dd:
				continue
			for nxt in G[cur]:
				if D[nxt] >= dd - 1:
					continue
				D[nxt] = dd - 1
				q.append(nxt)
	print("\n".join(map(str, C)))

if __name__=="__main__":
	main()


Measured memory_bytes: 49328
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <queue>
#include <string>

#define REP(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = (s); i < (n); i++)
#define ALLOF(c) c.begin(), c.end()
#define RANGEOF(c,i,n) c.begin() + (i), c.begin() + (i) + (n)
#define EPS 1e-9
#define INF 1000000000
using namespace std;

template <class T> T read() { T t; cin >> t; return t; }
template <class T> vector<T> read(int n) { vector<T> v; REP(i,n) { v.push_back(read<T>()); } return v; }
template <class T> vector<vector<T>> read(int n, int m)
{
	vector<vector<T>> v;
	REP(i,n) { v.push_back(read<T>(m)); }
	return v;
}

template <class T> void write(const T &t) { cout << t << endl; }
template <class T> void write(const T &t, const T &t2) { cout << t << ' ' << t2 << endl; }
template <class T> void write(const vector<T> &v)
{
	ostringstream ss; 
	for (auto x : v) ss << x << ' ';
	auto s = ss.str();
	cout << s.substr(0, s.length() - 1) << endl;
}

struct _Reader { template <class T> _Reader operator ,(T &rhs) { cin >> rhs; return *this; } };
#define READ(t,...) t __VA_ARGS__; _Reader(), __VA_ARGS__

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

/// template end ///



void solve()
{
	while (true)
	{
		READ(string, s);
		if (s == "#") { break; }
		struct pred
		{
			static bool left(char c) { return strchr("qwertasdfgzxcvb", c); }
			static bool right(char c) { return strchr("yuiophjklnm", c); }
		};
		replace_if(ALLOF(s), pred::left, 'L');
		replace_if(ALLOF(s), pred::right, 'R');
		s.erase(unique(ALLOF(s)), s.end());
		write(s.length() - 1);
	}
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
int n;
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
map<int,int>mp;
bool isp[1000004];
vector<int>v[1000004];
int main(){
	for(int i=2;i*i<=1e6;i++)if(!isp[i])
		for(int j=i*i;j<=1e6;j+=i)isp[j]=1;
	for(int i=2;i<=1e6;i++)if(!isp[i])
		for(int j=1;i*j<=1e6;j++)v[i*j].push_back(i);
	cin>>n;
	int x;scanf("%d",&x);
	int GCD=x;
	bool ok=0;
	for(int j=0;j<v[x].size();j++){
		mp[v[x][j]]++;
		if(mp[v[x][j]]>1)ok=1;
	}
	for(int i=1;i<n;i++){
		scanf("%d",&x);
		GCD=gcd(GCD,x);
		for(int j=0;j<v[x].size();j++){
			mp[v[x][j]]++;
			if(mp[v[x][j]]>1)ok=1;
		}
	}
	if(!ok)puts("pairwise coprime");
	else if(GCD==1)puts("setwise coprime");
	else puts("not coprime");
}

Measured memory_bytes: 63768
$n = gets.chomp.to_i
$array = Array.new($n + 1, 0)

($n).times do |i|
  if i > 0
    $ii = i
    while $ii < $n
      $array[$ii] += 1
      $ii += i
    end
  end
end

$ans = 0
$array.each do |i|
  $ans += i
end
puts $ans 

Measured memory_bytes: 21952
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,x,X,i;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	X=a*e;
	if(e<=c){
		x=b;
	}
	else{
		x=b;
		e-=c;
		x+=e*d;
	}
	if(X<x){
		printf("%d\n",X);
	}
	else{
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){

  int a,b,c;

  cin >> a >>b>>c;

  if(b-a==c-b){
    cout << "YES" << endl;
  }else if(a-b==b-c){
    cout << "YES" << endl;
  }else {
    cout << "NO" << endl;
  }
    





  return 0;
}
 



Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int L = sc.nextInt();
        int min = Math.abs(L);
        int x = 0;
        int ans = 0;

        for(int i=1; i<=N; i++){
            int abs = Math.abs(L + i - 1);
            if(min>=abs){
                min = abs;
                x = i;
            }
        }
        for(int i=1; i<=N; i++){
            if(i==x){
                continue;
            }
            ans += L + i - 1;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int mod =1000000007;
const double PI = acos(-1);
int main(){
    int h,w;cin>>h>>w;
    vector<string>s(h);
    rep(i,h)cin>>s[i];
    int ta[h][w],yo[h][w];
    rep(i,h)rep(j,w){
        ta[i][j]=0;
        yo[i][j]=0;
    }
    rep(i,h){
        int cnt =0;
        rep(j,w){
            if(s[i][j]=='.'){
                cnt++;
                yo[i][j]=cnt;
            }
            else{
                cnt=0;
                yo[i][j]=cnt;
            }
        }
        cnt=-1;
        rep(j,w){
            if(cnt==-1&&yo[i][w-j-1]!=0){
                cnt=yo[i][w-1-j];
            }
            else if(yo[i][w-1-j]!=0){
                yo[i][w-1-j]=cnt;
            }
            else {
                cnt=-1;
            }
        }
    }
    rep(j,w){
        int cnt =0;
        rep(i,h){
            if(s[i][j]=='.'){
                cnt++;
                ta[i][j]=cnt;
            }
            else{
                cnt=0;
                ta[i][j]=cnt;
            }
        }
        cnt=-1;
        rep(i,h){
            if(cnt==-1&&ta[h-1-i][j]!=0){
                cnt=ta[h-1-i][j];
            }
            else if(ta[h-1-i][j]!=0){
                ta[h-1-i][j]=cnt;
            }
            else {
                cnt=-1;
            }
        }
    }
    int ans=0;
    rep(i,h)rep(j,w){
        ans=max(ans,ta[i][j]+yo[i][j]-1);
    }
    cout<<ans<<endl;
}

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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define INF LLONG_MAX

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int n;
  
  cin >> n;
  vector<int> a(n);
  ll total = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(i==0){
      total += abs(a[i]);
    }
    else{
      total += abs(a[i]-a[i-1]);
    }
  }
  total += abs(a[n-1]);
  
  // 0 a1 a2 a3 a4 0
  for(int i=0;i<n;i++){
    int cost = total;
    int prev = (i==0)?0:a[i-1];
    int curr = a[i];
    int next = (i==n-1)?0:a[i+1];
    
    cost -= abs(curr-prev);
    cost -= abs(next-curr);
	cost += abs(next-prev);
    cout << cost << endl;
  }  
  
  return 0;
}



Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int d[10000];

int main(){
    int n,x,y;
    cin >> n >> x >> y;
    for(int i = 1; i < n; i++){
        for(int j = i+1; j < n+1;j++){
            int dd = min(j-i,abs(i-x)+1+abs(j-y));
            d[dd]++;
        }
    }
    for(int i = 1; i < n;i++)cout << d[i]<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int x;
    for(int i = 1; i < 6; i++){
        scanf("%d", &x);
        if(x == 0){
            printf("%d", i);
            break;
        }
    }
    
    return 0;
}


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

signed main(){
  int N;
  cin>>N;
  int ans=0;
  std::vector<int> v(3*N);
  for(int i=0;i<3*N;i++)cin>>v[i];
  sort(v.begin(),v.end());
  for(int i=0;i<N;i++)ans+=v[3*N-2-2*i];
  cout<<ans<<endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  } 
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int ans = 0;
  for (int i = 0; i <N ; i++){
    if (i%2 == 0)
      ans += vec.at(i);
    else
      ans -= vec.at(i);
  }

  cout << ans << endl;
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, y;
  while (cin >> n >> y) {
    // 10000
    // 5000
    // 1000
    // 10, 5, 1
    y /= 1000;
    bool f = false;
    for (int i = 0; (5 * i) <= y && i <= n; ++i) {
      for (int j = 0; (5 * i) + (10 * j) <= y && j <= n; ++j) {
        int k = y - (5 * i) - (10 * j);
        if (0 <= k && i + j + k == n) {
          cout << j << ' ' << i << ' ' << k << endl;
          f = true;
          i = j = 1 << 29;
        }
      }
    }
    if (!f) cout << "-1 -1 -1" << endl;
  }
  
  return 0;
}


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

using namespace std;

int main(int argc, char const *argv[])
{
    string S;
    cin >> S;
    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }else if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    int k,n;
    cin >> k >> n;
    int arr[n];
    for (int i=0;i<=n-1;i++)
    {
        cin >> arr[i];
    }

    int distance[n];
    for (int i=0;i<=n-2;i++)
    {
        distance[i]=arr[i+1]-arr[i];
    } 

    distance[n-1]=k-arr[n-1]+arr[0];
    sort(distance,distance+n);
    cout << k-distance[n-1] << endl;

    return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//よくわかんないけど通った？

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


	int N, K;
	cin >> N >> K;
	int H[302] = {};
	rep1(i, N) cin >> H[i];
	ll hutuu = 0;
	rep(i, N + 1) {
		if (H[i + 1] > H[i]) hutuu += H[i + 1] - H[i];
	}

	ll dp[302][301] = {};
	rep(i, N + 1) {
		ll tmp1 = max(0, H[i + 1] - H[i]);
		ll tmp2 = max(0, H[i] - H[i + 1]);
		ll tmp3 = min(tmp1, tmp2);
		int mae = H[i + 1];
		ll maetmp = tmp3;
		bool agari = (H[i + 1] > H[i]);
		for (int j = i + 2; j <= N + 1; j++) {
			if (mae < H[j]) tmp1 += H[j] - mae;
			if (mae > H[j]) tmp2 += mae - H[j];
			tmp3 = min(tmp1, tmp2);
			if (maetmp < tmp3) {
				int k = j - i - 1;
				rep(p, K - k + 1) chmax(dp[j][p + k], dp[i][p] + min(tmp1, tmp2));
			}
			mae = H[j];
			maetmp = tmp3;
		}
		rep(p, K + 1) chmax(dp[i + 1][p], dp[i][p]);
	}
	co(hutuu - dp[N + 1][K]);


	Would you please return 0;
}

Measured memory_bytes: 1024
A, B, K = list(map(int, input().split()))

if abs(A-B)<K:
    for i in range(A, B+1):
        print(i)
else:
    x = {i for i in range(A, A+K)}
    y = {j for j in range(B-K+1, B+1)}
    z = x | y
    z = sorted(list(z))
    for a in z:
        print(a)

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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)
#define PRINT_ARRAY_WITH_LABEL(P, L) do{cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)
#define RED "R";
#define BLUE "B";

int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);

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

    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

// integerの各桁を足す
int sum_digits(int num) {
    int rtn = 0;
    string num_str = to_string(num);
    for(int i=0; i<num_str.size(); i++) {
        rtn += num_str[i] - '0';
    }   
    return rtn;
}

// vectorのコピー
template <class T>
vector<T> copy_vector(vector<T> vec) {
    vector<T> rtn;
    rtn.reserve(vec.size());
    copy(vec.begin(), vec.end(), back_inserter(rtn));
    return rtn;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>

using namespace std;

int main()
{
  int m = 110000;
  
  vector<int> p( m, 1 );

  for ( auto i = 2; i < m; ++i )
    {
      if ( p[i] )
        {
          for ( auto j = 2 * i; j < m; j += i )
            {
              p[j] = 0;
            }
        }
    }

  vector<int> pl;

  for ( auto i = 2; i < m; ++i )
    {
      if ( p[i] )
        pl.push_back( i );
    }

  int n;

  while( cin >> n && n != 0 )
    {
      int s = 0;
  
      for ( auto i = 0; i < n; ++i )
        s += pl[i];

      cout << s << endl;
      
    }
  
  return 0;
}

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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;
  vector<bool> water(31,false);
  water[0] = true;
  REP(i,31)if(water[i] && i+a<31)water[i+a]=true;
  REP(i,31)if(water[i] && i+b<31)water[i+b]=true;
  vector<bool> sugar(3125,false);
  sugar[0] = true;
  REP(i,3125)if(sugar[i] && i+c<3125)sugar[i+c]=true;
  REP(i,3125)if(sugar[i] && i+d<3125)sugar[i+d]=true;
  int bestw = a, bests = 0;
  FOR(i,1,31)if(water[i]){
    int x = i*e;
    FOR(j,1,min(x+1,3125)){
      if(i*100+j>f)break;
      if(!sugar[j])continue;
      if(j*bestw > bests*i){
        bestw = i;
        bests = j;
      }
    }
  }
  printf("%d %d\n",bestw*100+bests,bests);
  return 0;
}


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

using namespace std;

int main() {
	int h,w;
	cin >> h >> w;
	vector<vector<char>> a(h,vector<char>(w));
	for (int hi=0;hi<h;++hi) {
		for (int wi=0;wi<w;++wi) {
			cin >> a[hi][wi];
		}
	}
	vector<size_t> h_rem;
	for (int hi=0;hi<h;++hi) {
		bool rem = true;
		for (int wi=0;wi<w;++wi) {
			if (a[hi][wi]=='#') {
				rem = false;
				break;
			}
		}
		if (rem) {
			h_rem.push_back(hi);
		}
	}
	int new_h = h - h_rem.size();
	int hosei = 0;
	for (auto rem_i : h_rem) {
		//cout << rem_i << ' ' << hosei << "\n";
		a.erase(a.begin()+rem_i-hosei);
		++hosei;
	}
	vector<size_t> w_rem;
	for (int wi=0;wi<w;++wi) {
		bool rem = true;
		for (int hi=0;hi<new_h;++hi) {
			if (a[hi][wi]=='#') {
				rem = false;
				break;
			}
		}
		if (rem) {
			w_rem.push_back(wi);
		}
	}
	hosei = 0;
	for (auto rem_i : w_rem) {
		//cout << rem_i << ' ' << hosei << "\n";
		for (int i=0;i<a.size();++i) {
			a[i].erase(a[i].begin()+rem_i-hosei);
		}
		++hosei;
	}
	for (int hi=0;hi<a.size();++hi) {
		for (int wi=0;wi<a[hi].size();++wi) {
			cout << a[hi][wi];
		}
		cout << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:38 on 2020-05-10.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string s, t;
    cin >> s >> t;
    for (ll i = 'a'; i <= 'z'; ++i) {
        if (t == s + char(i)) {
            cout << "Yes" << '\n';
            return;
        }
    }
    cout << "No" << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;
const long long linf = (1LL<<60);
 
signed main() {
  int L, R; cin >> L >> R;
  if(R-L >= 2019) {
    cout << 0 << endl;
  } else {
    int ans = linf;
    for(int i = L; i <= R; ++i) {
      for(int j = i+1; j <= R; ++j) {
        ans = min(ans, i*j%2019);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define mem(a, b) memset(a, b, sizeof(a))

const int MOD = 1000000007;
const int MAX = (int) 1e9;
const double PI = 3.141592653589793238462643383279502884;

template <typename T, typename U>
T max(T x, U y) {
    return x > y ? x : y;
}

template <typename T, typename U>
T min(T x, U y) {
    return x < y ? x : y;
}

template<typename T>
void debug(string msg, T t) {
	cout << msg << ": " << t << "\n";
}

int toDigit(char c) { return c - '0'; }

ll x, k, d, ans;

int main() {

	cin >> x >> k >> d;

	x = x < 0 ? -1 * x : x; // symmetric so doesn't matter 
	// if x is positive or negative

	ll moveToNeg = (x / d) + 1;
	if(moveToNeg >= k) {
		ans = x - k * d;
	} else {

		k -= moveToNeg;
		if(k % 2 == 0) {
			ans = x - moveToNeg * d;
		} else {
			ans = x - (moveToNeg - 1) * d;
		}
	}

	if(ans < 0) {
		ans *= -1;
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
using namespace std;

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

    int64_t rr = -1;
    int nn = 1 << n;
    for (int b = 0; b < nn; b++) {
        int c = 0;
        for (int m = 1; m < nn; m *= 2) {
            if (b & m) c++;
        }
        if (c != k) continue;

        int i = 0, t = 1;//見えるためには高さtが必要
        int64_t r = 0;
        for (int m = 1; m < nn; m *= 2, i++) {
            int e = a[i];
            if (b & m) {
                if (e < t) {
                    r += t - e;
                    e = t;
                }
            }
            if (e >= t) t = e + 1;
        }
        if (rr == -1) rr = r; else rr = min(rr, r);
    }
    cout << rr << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <string>
#include <random>
#include <map>
#pragma warning(disable : 4996)


int main(void) {
	int k, s;
	scanf("%d %d", &k, &s);
	int sum = 0;
	for (int x = 0; x <= k; ++x) {
		for (int y = 0; y <= k; ++y) {
			if ((s - x - y >= 0) && (s - x - y <= k)) ++sum;
		}
	}
	printf("%d", sum);
	return 0;
}


Measured memory_bytes: 128
N=int(input())
A=[int(x) for x in input().split()]

dict={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}

for a in A:
  if a>=3200:
    dict[8]+=1
  elif a>=2800:
    dict[7]+=1
  elif a>=2400:
    dict[6]+=1
  elif a>=2000:
    dict[5]+=1
  elif a>=1600:
    dict[4]+=1
  elif a>=1200:
    dict[3]+=1
  elif a>=800:
    dict[2]+=1
  elif a>=400:
    dict[1]+=1
  else:
    dict[0]+=1
ans=0
for i in range(8):
  if dict[i]>0:
    ans+=1
print(max(ans,1),ans+dict[8])

Measured memory_bytes: 3064
x,n = map(int, input().split())
if n == 0:
  print(x)
  exit()
P = list(map(int, input().split()))

if x not in P:
  print(x)
  exit()
  
i = 1
while True:
  if x-i not in P:
    print(x-i)
    exit()
  elif x+i not in P:
    print(x+i)
    exit()
  else:
    i += 1

Measured memory_bytes: 9204
'''بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ'''
#codeforces
gi = lambda : list(map(int,input().split()))
a, b, c, k = gi()
ans = min(a, k)
k -= min(a, k)
k -= min(b, k)
ans -= min(c, k)
print(ans)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 205
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int prime[SIZE];
bool is_prime[SIZE+1];

//n以下の素数判定
int sieve(int n){
  int p = 0;
  rep(i,0,n+1) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  rep(i,2,n+1){
    if(is_prime[i]){
      prime[p++] = i;
      for(int j = 2*i;j <= n;j+=i) is_prime[j] = false;
    }
  }
  return p;
}

//a!はpで何回割り切れるか
int num(int a,int p){
  int u=0;
  while(a>0){
    u += a/p;
    a /= p;
  }
  return u;
}

int nums[SIZE];
int p74,p2,p24,p4,p14;

int main(){
  int N;
  cin >> N;
  sieve(N);
  rep(i,2,N+1){
    if(is_prime[i]){
      nums[i] = num(N,i);
    }
  }
  //1~4の場合それぞれ集計

  rep(i,1,N+1){
    if(nums[i] >= 2)p2++;
    if(nums[i] >= 4)p4++;
    if(nums[i] >= 14)p14++;
    if(nums[i] >= 24)p24++;
    if(nums[i] >= 74)p74++;
  }
  cout << p74 + p24*(p24-1) + p24*(p2-p24) + p14*(p14-1) + p14*(p4-p14)
    + p4*(p4-1)*(p4-2)/2 + p4*(p4-1)*(p2-p4)/2 << endl;


  return 0;
}


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

int main(){
	string s;
	cin >> s;
	vector<int> v(4);
	for (char c: s){
		if (c=='N') v[0]++;
		else if (c=='S') v[1]++;
		else if (c=='E') v[2]++;
		else if (c=='W') v[3]++;
	}
	if (!( (v[0] > 0) ^ (v[1] >0)) && !((v[2]>0) ^ (v[3]>0))) cout << "Yes";
	else cout << "No";
	
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  while(cin>>a>>b>>c,a+b+c!=-3){
    if(a==-1||b==-1) cout<<"F"<<endl;
    else if(a+b>=80) cout<<"A"<<endl;
    else if(a+b>=65) cout<<"B"<<endl;
    else if(a+b>=50) cout<<"C"<<endl;
    else if(a+b>=30&&c>=50) cout<<"C"<<endl;
    else if(a+b>=30) cout<<"D"<<endl;
    else cout<<"F"<<endl;
  }
}


Measured memory_bytes: 3092
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		}
		int m = sc.nextInt();
		int count = 0;
		for (int i = 0; i < m; i++) {
		    if (set.contains(sc.nextInt())) {
		        count++;
		    }
		}
		System.out.println(count);
	}
	
}



Measured memory_bytes: 40580
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var ary = ToIntArray(input.ReadLine(), n);

        var co = new int[8];
        var all = 0;

        foreach(var a in ary) {
            var c = a/400;
            if(c < 8) co[c]++;
            else all++;
        }

        var min = co.Where(x => x > 0).Count();
        var max = min + all;//Math.Min(min + all, 8);

        return Math.Max(min,1) + " " + max;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l;
		int r;
		int sum = 0;

		for (int i = 0; i < n; i++) {
			l = sc.nextInt();
			r = sc.nextInt();
			sum += (r - l + 1);
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 25320
n,m,l=map(int,input().split())

#print("n:%d, m:%d, l:%d"%(n, m, l))

nmlist=[]
for i in range(n):
    nm=list(map(int,input().split()))
    nmlist.append(nm)
#print(nmlist)

mllist=[]
for j in range(m):
    ml=list(map(int,input().split()))
    mllist.append(ml)
#print(mllist)


result = []

for i in range(n):
  for j in range(l):
    sum = 0
    for k in range(m):
      sum = sum + nmlist[i][k]*mllist[k][j]
    result.append(sum)

#print(result)


for o in range(1,len(result)+1):
    if o%l==0:
        print(result[o-1])
    else:
        print(result[o-1],end=' ')
    






Measured memory_bytes: 7052
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n==0 && m==0) break;
			
			int[][] map = new int[n][2];
			for(int i=0;i<n;i++){
				map[i][0] = sc.nextInt();
				map[i][1] = sc.nextInt();
			}
			
			Arrays.sort(map, new Comparator<int[]>(){
				public int compare(int[] o1, int[] o2) {
					return o2[1] - o1[1];
				}
			});
			
			int sum = 0;
			boolean flag = false;
			for(int i=0;i<n;i++){
				if(flag==false){
					if(m<=map[i][0]){
						sum += (map[i][0]-m)*map[i][1];
						flag = true;
					}else{
						m -= map[i][0];
					}
				}else{
					sum += map[i][0] * map[i][1];
				}
			}
			System.out.println(sum);
		}	
	}	
}

Measured memory_bytes: 84268
import java.util.*;

public class Main {
	public static void main(String[] args) {
		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();
		
		double bunbo = 0;
		for(int i=0; i<N; i++)
			bunbo += 1.0/A[i];
		
		System.out.println(1.0/bunbo);
		sc.close();
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    vector<bool> dp(k+1,false);
    dp[0]=false;
    rep(i,k+1){
      bool flag=true;
      rep(j,n){
        if(i<a[j]) continue;
        flag&=dp[i-a[j]];
      }
      dp[i]=!flag;
    }
    if(dp[k]) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
  int a, p; cin >> a >> p;

  cout << (a * 3 + p) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb(x) push_back(x)

typedef pair<ll,ll> pp;
int lcm(int a, int b)
{
    int lar = max(a, b);
    int small = min(a, b);
    for (int i = lar; ; i += lar) {
        if (i % small == 0)
            return i;
    }
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b) {
    return (a.second < b.second);
}

ll power(ll x, unsigned ll y, ll p)
{
    ll res = 1;     // Initialize result
  
    x = x % p; // Update x if it is more than or
                // equal to p
   
    if (x == 0) return 0; // In case x is divisible by p;
  
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;
  
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

struct ArrayWrapper
{
    int a[101][101];
};

bool isPowerOfTwo (ll x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}


void solve(){
    ll n, k; cin >> n >> k;
    ll dp[n+1];
    memset(dp, 0, sizeof(dp));
    while(k--){
        ll d; cin >> d;
        while(d--){
            ll x; cin >> x;
            dp[x]++;
        }
    }
    ll count = 0;
    for(ll i = 1;i <= n;i++) if(dp[i] == 0) count++;
    cout << count << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //ll t; cin >> t; while(t--)
        solve();
}


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

int main(){
    int l;
    double x,y,z,ans;
    cin >> l;
    ans = l * l * l / 27.0;
  cout << fixed << setprecision(20) << ans << endl;
}

Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

long digit_sum(long b, long n) {
    if (n < b)
        return n;
    else
        return digit_sum(b, n/b) + n % b;
}

void main() {
    auto N = readln.chomp.to!long;
    auto S = readln.chomp.to!long;

    if (N == S) {
        writeln(N+1);
        return;
    }


    for (long b = 2; b * b <= N; b++) {
        if (digit_sum(b, N) == S) {
            writeln(b);
            return;
        }
    }

    long ans = long.max;

    for (long p = 1; p * p <= N; p++) {
        if ((p-S+N) % p != 0)
            continue;
        long b = (p-S+N) / p;
        if (b > 1 && digit_sum(b, N) == S)
            ans = min(ans, b);

    }

    writeln(ans == long.max ? -1 : ans);
}


Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    h_lst = list(map(int, input().split()))
    ok_lst = [1 for _ in range(n)]

    for _ in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        if h_lst[a] <= h_lst[b]:
            ok_lst[a] = 0
        if h_lst[b] <= h_lst[a]:
            ok_lst[b] = 0

    ans = sum(ok_lst)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 91268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    ll a[n]; zep(i, 0, n)cin >> a[i];
    sort(a, a + n, greater<>());
    
    ll ans = a[0];
    ll cnt = 2, at = 1;
    while(cnt < n){
    	cnt++;
    	ans += a[at];
    	if(cnt % 2 == 0)at++;
    }
    print(ans)
    
    return 0;
}

Measured memory_bytes: 5224
#include <iostream>
#include <cstdint>
#include <set>
#include <queue>

using namespace std;

set<int> outset[300'000];
bool is_finished[300'000];
int dist[300'000];
bool in_q[300'000];

int main()
{
    int n, m;

    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int u, v;
        cin >> u >> v;
        u--;
        v--;

        outset[0 * n + u].insert(1 * n + v);
        outset[1 * n + u].insert(2 * n + v);
        outset[2 * n + u].insert(0 * n + v);
    }
    int s, t;
    cin >> s >> t;
    s--;
    t--;

    queue<int> q;

    for (int i = 0; i < 3 * n; i++)
    {
        dist[i] = 300'001;
        is_finished[i] = false;
        in_q[i] = false;
    }

    q.push(s);
    dist[s] = 0;
    in_q[s] = true;

    while (!q.empty())
    {
        int v = q.front();
        q.pop();
        in_q[v] = false;
        is_finished[v] = true;

        for (auto aj = outset[v].begin(); aj != outset[v].end(); aj++)
        {
            dist[*aj] = min(dist[*aj], dist[v] + 1);
            if (!is_finished[*aj] && !in_q[*aj])
            {
                q.push(*aj);
                in_q[*aj] = true;
            }
        }
    }

    if (is_finished[t])
    {
        cout << dist[t] / 3 << endl;
    }
    else
    {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 30080
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

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


H,W = imn()
S = [input() for _ in range(H)]
ans = 0
dx = [-1, 0, 1, 0]
dy = [0, -1, 0, 1]

for h in range(H):
    for w in range(W):
        if S[h][w] == '#': continue
        d = [[-1 for _ in range(W)] for _ in range(H)]
        d[h][w] = 0
        max_s = 0
        queue = deque([(w, h)])
        while len(queue) > 0:
            p = queue.popleft()
            for i in range(4):
                x = p[0] + dx[i]
                y = p[1] + dy[i]
                if x < 0 or y < 0 or x >= W or y >= H or S[y][x] == '#' or d[y][x] != -1: continue
                d[y][x] = d[p[1]][p[0]] + 1
                queue.append((x,y))
                max_s = max(max_s, d[y][x])
        ans = max(ans, max_s)
print(ans)



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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    LL k,x;
    cin>>k>>x;
    if(k*500>=x)
        cout<<"Yes";
    else
        cout<<"No";

}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
typedef long long ll;
typedef double db;
typedef vector<int> ve;
typedef pair<int, int> pa;
typedef vector<pair<ll,ll> > vepa;
typedef map<int, int> mp;
const ll N=1e5+5;
ll arr[N],A[N],ARR[N]  ;
bool visited[N]={};
ll cnt[N]={};
bool f;
 int main()
{

  string s;
  int c1=0,c2=0;
  cin>>s;
  for(int i=0;i<s.size();i++)
  {
      if(s[i]=='0')c1++;
      if(s[i]=='1')c2++;

  }
  int mn=min(c1,c2);
  cout<<mn+mn;


go;
}


Measured memory_bytes: 512