akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int X, Y, Z, K;
priority_queue<tuple<int64_t, int, int, int>> PQ;

int main()
{
  cin >> X >> Y >> Z >> K;
  vector<int64_t> A(X), B(Y), C(Z);
  for (int i = 0; i < X; i++)
    cin >> A.at(i);
  for (int i = 0; i < Y; i++)
    cin >> B.at(i);
  for (int i = 0; i < Z; i++)
    cin >> C.at(i);
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  sort(C.begin(), C.end());
  reverse(C.begin(), C.end());
  int64_t ma = A.at(0) + B.at(0) + C.at(0);
  PQ.push(make_tuple(ma, 0, 0, 0));
  int64_t x, ia, ib, ic, k = 0;
  map<tuple<int, int, int>, bool> Checked;
  while (!PQ.empty())
  {
    tie(x, ia, ib, ic) = PQ.top();
    PQ.pop();
    if (ia + 1 < X && !Checked.count(make_tuple(ia + 1, ib, ic)))
    {
      int64_t na = A.at(ia + 1) + B.at(ib) + C.at(ic);
      PQ.push(make_tuple(na, ia + 1, ib, ic));
      Checked[make_tuple(ia + 1, ib, ic)] = true;
    }
    if (ib + 1 < Y && !Checked.count(make_tuple(ia, ib + 1, ic)))
    {
      int64_t nb = A.at(ia) + B.at(ib + 1) + C.at(ic);
      PQ.push(make_tuple(nb, ia, ib + 1, ic));
      Checked[make_tuple(ia, ib + 1, ic)] = true;
    }
    if (ic + 1 < Z && !Checked.count(make_tuple(ia, ib, ic + 1)))
    {
      int64_t na = A.at(ia) + B.at(ib) + C.at(ic + 1);
      PQ.push(make_tuple(na, ia, ib, ic + 1));
      Checked[make_tuple(ia, ib, ic + 1)] = true;
    }
    cout << x << endl;
    k++;
    if (k == K)
      break;
  }
}

Measured memory_bytes: 896
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

fatigue = [0] * n

for i in range(1, n):
    fatigue[i] = fatigue[i - 1] + min((x[i] - x[i - 1]) * a, b)

print(fatigue[n - 1])


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

void pict(int H, int W){
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++) {
      cout << "#";
    }
    cout << endl;
  }
}

int main(){
  int H, W;

  while(1){
    cin >> H >> W;

    if (H == 0 && W ==0)  break;
    pict(H, W);
    cout << endl;
  }
}

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

typedef long long int lli;

lli get_(lli &n, lli a) {
	return (n * (2*a + (n-1) * a))/2;
}

lli get(lli &n) {
	lli n3 = n/3, n5 = n/5, n15 = n/15;
	lli sum3 = get_(n3, 3), sum5 = get_(n5, 5), sum15 = get_(n15, 15);
	return sum3 + sum5 - sum15;

}

int main(void) {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	lli n ;
	cin>>n;

	lli sum1 = get(n);
	lli sum = (n*(n+1))/2 - sum1;
	cout<<sum<<"\n";
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  string s;
  cin >> s;
  int len = s.length();
  string s01 = "";
  string s10 = "";
  for(int i = 0; i < len / 2; ++i)
  {
    s01 += "01";
    s10 += "10";
  }
  if (len & 1)
  {
    s01 += "0";
    s10 += "1";
  }

  int dist01 = 0;
  int dist10 = 0;
  for(int i = 0; i < len; ++i)
  {
    if (s[i] == s01[i]) dist01++;
    if (s[i] == s10[i]) dist10++;
  }
  cout << min(dist01, dist10);
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3912
#include <iostream>

using namespace std;

int main() {
    int a, b;

    cin >> a >> b;

    if (!(a%3) || !(b%3) || !((a+b)%3)) {
        cout << "Possible" << endl;
    }
    else {
        cout << "Impossible" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
# ABC 84, C - sunuke festival
import bisect

n = int(input())
A = sorted([int(el) for el in input().split(' ')])
B = [int(el) for el in input().split(' ')]
C = sorted([int(el) for el in input().split(' ')])

total = 0
for b in B:
    total += bisect.bisect_left(A, b) * (len(C) - bisect.bisect_right(C, b))
print(total)


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

int main( void )
{
    int n;
    cin >> n;
    
    string ans = "ABC";
    if ( n >= 1000 )
        ans = "ABD";
    cout << ans << endl;
}


Measured memory_bytes: 256
def gcd(x,y):
  r=x%y
  return gcd(y,r) if r else y

n,x=map(int,input().split())
X=list(map(int,input().split()))
X.append(x)
X.sort()
X=[X[i]-X[i-1] for i in range(1,len(X))]
k=X[0]
for i in X:
  k=gcd(k,i)
print(k)

Measured memory_bytes: 14228
#include <bits/stdc++.h>
#define ll long long
#define P pair<int,int>
#define MAX_N 8
using namespace std;

int s[MAX_N];

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


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
al = sum(a)
sunuke = 0
arai = 0
mn = 2*(10**9)
for i in range(n-1):
    sunuke += a[i]
    arai = al - sunuke
    mn = min(mn, abs(sunuke - arai))
print(mn)

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

typedef pair<int,int> P;

P merge(P a,P b){
  int left=min(a.first,b.first);
  int right=max(a.second,b.second);
  return P(left,right);
}

int n,m;

vector<int> G[200005];

P ans[200005];

int main(){
  scanf("%d %d",&n,&m);

  for(int i=0;i<m;i++){
    int x,y;
    scanf("%d %d",&x,&y);
    G[x].push_back(y);
  }

  for(int i=0;i<n;i++){
    ans[i]=P(i,i);
  }

  for(int x=0;x<100005;x++){
    for(int i=0;i<(int)G[x].size();i++){
      int y=G[x][i];
      ans[y] = ans[y-1] = merge(ans[y],ans[y-1]);
    }
  }

  for(int i=0;i<n;i++){
    if(i)printf(" ");
    printf("%d",ans[i].second-ans[i].first+1);
  }
  printf("\n");
  return 0;
}

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

int main(){
  string str;
  cin >> str;
  int ans = 0;
  for(int i = 0; i < str.length(); i++){
    char tmp = str[i];
    ans += (int)tmp -48;
  }
  if(ans % 9 == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3724
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var buff []byte

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buff, bufio.MaxScanTokenSize*1024)
	log.SetFlags(log.Lshortfile)
}

var N int
var A []int
var ans int

func main() {
	N = nextInt()
	N++
	A = nextInts(N)
	if N == 0 {
		fmt.Println("0")
		return
	}
	if N == 1 {
		if A[0] == 1 {
			fmt.Println("1")
		} else {
			fmt.Println("-1")
		}
		return
	}
	if A[0] != 0 {
		fmt.Println("-1")
		return
	}
	L := make([]int, N)
	R := make([]int, N)
	for i := N - 2; i >= 0; i-- {
		L[i] = (A[i+1] + L[i+1] + 1) / 2
		R[i] = A[i+1] + R[i+1]
	}
	if !(L[0] <= 1 && 1 <= R[0]) {
		fmt.Println("-1")
		return
	}
	x := make([]int, N)
	x[0] = 1
	for i := 1; i < N; i++ {
		left := max(x[i-1]-A[i], L[i])
		right := min(2*x[i-1]-A[i], R[i])
		if left <= right {
			x[i] = right
		} else {
			fmt.Println("-1")
			return
		}
	}
	ans := 0
	for i := 0; i < N; i++ {
		ans += A[i] + x[i]
	}
	fmt.Println(ans)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextInts(n int) (r []int) {
	r = make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 5872
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define sz(v) (v).size()
#define debug(x) cerr << #x << "_=_" << x << "\n";
#define sum(n) ((n)*((n)+1)>>1)
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;

const int MAXN = 1e5+5;
int dp[MAXN], arr[MAXN];

int f(int i){
    if(i==0) return 0;
    if(i==1) return abs(arr[1]-arr[0]);
    if(~dp[i]) return dp[i];
    int ans = min(f(i-1) + abs(arr[i]-arr[i-1]), f(i-2) + abs(arr[i]-arr[i-2]));
    return dp[i] = ans;
}


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

//    #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//    #endif

    int n;
    cin >> n;
    for (int i=0; i<n; i++) cin >> arr[i];
    memset(dp, -1, sizeof dp);
    cout << f(n-1) << "\n";

    return 0;
}

/*
1
9 3
111100000
 */

Measured memory_bytes: 2560
//abc144_a.cpp
//Sun Oct 27 20:49:49 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int n,m;
	cin >> n >> m;

	if (n<=9 && m <=9){
		cout << n*m << endl;
	}else {
		cout << -1 << endl;
	}
}

Measured memory_bytes: 256
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    double maxPercentage = -100.0;
    int maxSum = 0;
    int maxSugar = 0;
    for (int i = 0; 100 * A * i <= F; ++i)
    {
        for (int j = 0; 100 * A * i + 100 * B * j <= F; ++j)
        {
            if (i == 0 && j == 0) continue;

            for (int k = 0; 100 * A * i + 100 * B * j + C * k <= F; ++k)
            {
                for (int l = 0; 100 * A * i + 100 * B * j + C * k + D * l <= F; ++l)
                {
                    if (i == 0 && j == 0 && k == 0 && l == 0) continue;
                    int sugar = C * k + D * l;
                    int water = 100 * A * i + 100 * B * j;
                    int sum = water + sugar;
                    double percentage = (sugar * 100.0) / sum;
                    if ((percentage <= ((100.0 * E) / (100.0 + E))) && (percentage > maxPercentage))
                    {
                        maxPercentage = percentage;
                        maxSum = sum;
                        maxSugar = sugar;
                    }
                }
            }
        }
    }
    cout << maxSum << " " << maxSugar << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>

using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    int digit = 1;
    for (int i = 0;; i++) {
        if (i == 10) {
            digit++;
        }
        if (i == 100) {
            digit++;
        }
        if (i == 1000) {
            digit++;
        }
        if (i == 10000) {
            digit++;
        }
        int num = 0;
        for (int j = 1; j <= digit; j++) {
            num += d[n - j] * pow(10, j - 1);
        }
        if (num == i) {
            continue;
        }
        bool ok = false;
        for (int j = n - digit - 1; j >= 0; j--) {
            num = num / 10 + pow(10, digit - 1) * d[j];
            if (num == i) {
                ok = true;
                break;
            }
        }
        if (ok) {
            continue;
        }
        cout << i << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3280
n,m = map(int,input().split())
if(( n ==1) &( m == 1)):
    print(1)
if( (n == 1) & (m != 1)):
    print(m - 2)
if( (n != 1) & (m == 1)):
    print(n - 2)
    
if ((n != 1) &( m != 1)):
    print(n*m -(2*n + 2*m -4))

Measured memory_bytes: 3060
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  int x, y;
  readf("%s %s\n", &x, &y);

  if (x + y >= 10) {
    writeln("error");
  } else {
    writeln(x + y);
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		double ans = 0;
		for(int i = 0; i < N; i++) {
			double x = scan.nextDouble();
			String s = scan.next();

			if(s.equals("JPY")) {
				ans += x;
			}
			if(s.equals("BTC")) {
				ans += x * 380000.0;
			}
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 29008
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust, fromMaybe )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.IntMap.Lazy            as IML
import qualified Data.Map.Strict               as M
import           Data.Char
import qualified Data.Array.IArray as A
import qualified Data.Array.Unboxed as UA
import Data.Bits
import Control.Monad.State.Strict
import qualified Data.Array.ST as STA
import qualified Data.Array.IO as IOA
import qualified Data.Array.MArray as MA
import Control.Monad.ST
import System.IO (stdin)
import Control.Arrow
import qualified Data.Vector.Unboxed as UV
import qualified Data.Vector.Generic as GV



readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- readInts
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- readInts
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las

solve :: Int -> BC.ByteString -> Int
solve n as = minimum eachnum where
    scanner (east, west) 'E' =  (east +1, west) 
    scanner (east,west) _ = (east, west+1)
    lrsumacc :: UV.Vector (Int, Int)
    lrsumacc = GV.fromList $ scanl' scanner (0, 0) $ BC.unpack as
    rlsumacc :: UV.Vector (Int, Int)
    rlsumacc = GV.fromList $ reverse $ scanl' scanner (0, 0) $ reverse $ BC.unpack as
    eachnum = (\i -> (snd $ lrsumacc GV.! (i - 1)) + (fst $ rlsumacc GV.! i)) <$> [1..n]

main = do
    n <- readInt
    s <- BC.getLine
    print $ solve n s


Measured memory_bytes: 71036
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    vector<int> k(Q);
    cin >> k;

    vector<int> cntM(N), cntC(N);
    REP(i, N) {
        cntM[i] = (i > 0 ? cntM[i - 1] : 0) + (S[i] == 'M');
    }
    REPR(i, N - 1) {
        cntC[i] = (i < N - 1 ? cntC[i + 1] : 0) + (S[i] == 'C');
    }

    vector<int> ScntC(N);
    REP(i, N) {
        if (S[i] != 'M') continue;
        ScntC[i] = cntC[i];
    }
    REP(i, N - 1) {
        ScntC[i + 1] += ScntC[i];
    }

    // [a, c]
    auto f = [&](int a, int c) {
        int R = c < N - 1 ? cntC[c + 1] : 0;
        int cM = cntM[c] - (a > 0 ? cntM[a - 1] : 0);
        int ans = ScntC[c] - (a > 0 ? ScntC[a - 1] : 0) - R * cM;
        return ans;
    };

    REP(q, Q) {
        int ans = 0;
        REP(i, N - 2) {
            if (S[i] != 'D') continue;
            ans += f(i, min(N - 1, i + k[q] - 1));
        }
        cout << ans << endl;
    }
    return (0^_^0);
}



Measured memory_bytes: 24860
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second

bool sgs(int x){
    bool f3=false,f5=false,f7=false;
    
    while(x!=0){
        if(x%10==3){
            f3=true;
        }else if(x%10==5){
            f5=true;
        }else if(x%10==7){
            f7=true;
        }else{
            return false;
        }
        x/=10;
    }

    if(f3==true && f5==true && f7==true){
        return true;
    }else{
        return false;
    }
}

int main(){
    int n,ans=0;
    cin >> n;
    n=min(n,780000000);
    for(int i=357;i < n+1;i+=10)
    {
        if(sgs(i)==true){
            ans++;
        }
    
    }
    for(int i=375;i < n+1;i+=10)
    {
        if(sgs(i)==true){
            ans++;
        }
    
    }
    for(int i=573;i < n+1;i+=10)
    {
        if(sgs(i)==true){
            ans++;
        }
    
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// abc067_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    
    sort(ALL(A), greater<int>());
    
    int ans = 0;
    REP(i, K){
        ans += A[i];
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
ll n;
int main() {
	cin >> n;
	ll ans = 0;
	if (n == 2) { puts("1"); return 0; }
	for (ll k = 2; k*k <= n; k++) {
		if (n%k)continue;
		ll tmp = n;
		while (tmp%k == 0)tmp /= k;
		if (tmp%k == 1)ans++;
		tmp = n;
		ll b = n / k;
		while (tmp%b == 0)tmp /= b;
		if (tmp%b == 1)ans++;
		if (b == k)ans--;
	}
	for (ll k = 2; k*k <= (n - 1); k++) {
		//cout << k << endl;
		if ((n - 1) % k != 0 || (n%k) == 0)continue;
		//cout << k << endl;
		ans++;
		ll b = (n - 1) / k;
		if (b == k || (n - 1) % b != 0 || (n%b) == 0)continue;
		//cout << k << endl;
		ans++;
	}
	printf("%lld\n", ans + 2);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<int,int>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}
int n;
ll k;
int a[200005],f[200005];
bool cheak(ll b){
	ll x=0;
	rep(i,0,n){
		ll v=b/f[i];
		if(v<a[i])x+=a[i]-v;
	}
	if(x>k)return 0;
	return 1;
}
ll reg(ll l,ll r){
	if(l==r)return r;
	ll c=(l+r)/2;
	if(cheak(c)){
		return reg(l,c);
	}else{
		return reg(c+1,r);
	}
}
int main() {
	cin>>n>>k;
	rep(i,0,n)cin>>a[i];
	rep(i,0,n)cin>>f[i];
	sort(a,a+n);
	sort(f,f+n,greater<int>());
	cout<<reg(0,1000000000000);
	return 0;
}


Measured memory_bytes: 1792
from itertools import accumulate
n = int(input())
a = list(accumulate([int(i) for i in input().split()]))
d = 0
ans = 0
for i, n in enumerate(a):
    n += d
    if i & 1:
        if n >= 0:
            ans += n + 1
            d -= n + 1
    # 奇数回目でマイナスのとき
    elif n <= 0:
        ans += - n + 1
        d += - n + 1
c = ans
ans = 0
d = 0
for i, n in enumerate(a):
    n += d
    if i & 1 == 0:
        if n >= 0:
            ans += n + 1
            d -= n + 1
    elif n <= 0:
        ans += - n + 1
        d += - n + 1
print(min(ans, c))

Measured memory_bytes: 65620
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    vector<int> a(n, -1);
    for (int i = 0, nr = 1; nr <= k; i += c + 1, ++nr)
    {
        while (s[i] == 'x')
            ++i;
        a[i] = nr;
    }
    vector<int> dp(n);
    if (s[n - 1] == 'o')
        dp[n - 1] = 1;
    else
        dp[n - 1] = 0;
    for (int i = n - 2; i >= 0; --i)
    {
        if (s[i] == 'o')
        {
            dp[i] = 1;
            if (i + c + 1 < n)
                dp[i] += dp[i + c + 1];
        }
        else
            dp[i] = dp[i + 1];
    }
    for (int i = 0; i < n - 1; ++i)
    {
        if (a[i] == -1)
            continue;
        if (dp[i + 1] < k - (a[i] - 1))
            cout << i + 1 << endl;
    }
    if (a[n - 1] != -1)
        cout << n;
    return 0;
}


Measured memory_bytes: 3348
def main():
    N, M = map(int, input().split(" "))
    formed_year = []
    order = [0] * (N + 1)
    cities_order = [0] * (M + 1)
    for i in range(1, M + 1):
        p, y = map(int, input().split(" "))
        formed_year.append((i, p, y))
    formed_year_formated = sorted(formed_year, key=lambda x: x[2])
    for year in formed_year_formated:
        order[year[1]] += 1
        cities_order[year[0]] = order[year[1]]
    for i in range(M):
        print(str(formed_year[i][1]).zfill(6) + str(cities_order[formed_year[i][0]]).zfill(6))


if __name__ == '__main__':
    main()

Measured memory_bytes: 27380
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int mx=2e5+777;
ll A[mx], B[mx];

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll N,M,K; cin>>N>>M>>K;
	map<ll,ll> amp, bmp;
	ll cur=0;
	amp[0]=0;
	for (int i=1; i<=N; i++)
		cin>>A[i], cur+=A[i], amp[cur]=i;
	cur=0;
	bmp[0]=0;
	for (int i=1; i<=M; i++)
		cin>>B[i], cur+=B[i], bmp[cur]=i;
	cur=0;
	ll ret=0;
	for (ll i=0; i<=N; i++) {
		cur+=A[i];
		if(cur>K) break;
		ll tmp=K-cur;
		auto it=bmp.upper_bound(tmp);
		if(it==bmp.begin()) continue;
		it--;
		ret=max(ret,i+it->second);
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 31776
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename Tuple, size_t N>
struct TuplePrinter {
  static void print(const Tuple &t) {
    TuplePrinter<Tuple, N-1>::print(t);
    cout << ", " << get<N-1>(t);
  }
};

template<typename Tuple>
struct TuplePrinter<Tuple, 1> {
  static void print(const Tuple &t) {
    cout << get<0>(t);
  }
};

template<typename... T>
ostream &operator<<(ostream &os, const tuple<T...> &tup) {
  os << "(";
  TuplePrinter<decltype(tup), sizeof...(T)>::print(tup);
  return os << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }
#define dump(...) cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }

template<typename T>
T gcd(T a, T b) {
  while (a) {
    b %= a;
    swap(a, b);
  }
  return b;
}

int main() {
  int k; cin>>k;
  int ans = 0;
  REP(i, 1, k+1) REP(j, 1, k+1) REP(l, 1, k+1) {
    ans += gcd(i, gcd(j, l));
  }
  print(ans);

  return 0;
}

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

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	vector<char> vec (N);
	for(int i = 0;i < N;i++){
		cin >> vec.at(i);
	}
	for(int i = 0;i < N;i++){
		if(vec.at(i) == 'a'){
			if(A > 0){
				A--;
				cout << "Yes" << endl;
			}
			else if(B > 0){
				B--;
				cout << "Yes" << endl;
			}
			else{
				cout << "No" << endl;
			}
		}
		else if(vec.at(i) == 'b'){
			if(B > 0){
				B--;
				cout << "Yes" << endl;
			}
			else{
				cout << "No" << endl;
			}
		}
		else if(vec.at(i) == 'c'){
			cout << "No" << endl;
		}
		else{
			cout << "ERROR!  " << vec.at(i) << " is not a,b,c" << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 768
#include<iostream>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    if(s.length()+1==t.length()){
        for(int i=0;s[i];i++){
            if(s[i]!=t[i]) {
                cout<<"No";
                return 0;
            }
        }
    }
    else {cout<<"No";return 0;}
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3624
def main():
    N, X, Y = (int(i) for i in input().split())
    cnt = [0]*N
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            d = min(abs(i-j), abs(i-X)+1+abs(j-Y), abs(i-X)+abs(X-Y)+abs(j-Y))
            cnt[d] += 1
    for d in cnt[1:]:
        print(d)


if __name__ == '__main__':
    main()


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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll animals, legs;
  scanf("%lld %lld", &animals, &legs);

  bool r = false;
  for (ll i = 0; i <= animals; i++) {
    ll v = 2 * i + (animals - i) * 4;
    if (v == legs) {
      r = true;
      break;
    }
  }

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


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int d1[N],d2[N];
 
  for ( int i=0; i < N; i++){
      cin >> d1[i] >> d2[i];
  }

  int count = 0;
 
  for (int i = 0; i < N; i++) {
    if (d1[i]==d2[i] && d1[i+1]==d2[i+1] && d1[i+2] == d2[i+2]){
      count ++;
    }
  }
  if (count == 0){
    cout << "No" << endl;
  }
  else if(count != 0){ 
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int L = a + b;
    int R = c + d;

    if(L > R){
        cout << "Left" << endl;
    } else if (L < R){
        cout << "Right" << endl;
    } else {
        cout << "Balanced" << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))


B_N = A[-1]
for i in range(n-1):
	B_N += (-1)**(i+1) * A[i]
	
	
B = [0 for _ in range(n)]
B[-1] = B_N
for i in range(1,n):
	B[n-1-i] = 2 * A[n-i-1] - B[n-i]
	
print(' '.join(map(str,B)))

Measured memory_bytes: 19140
#include<cstdio>
#define rep(i,n) for(int i=0;i<n;++i)
int a[1<<18],v[1<<18][3],n,m,q,c;
main(){scanf("%d %d %d",&n,&m,&q);rep(i,n)rep(j,2)v[i][j]=(i+n+1-2*j)%n;rep(i,m){scanf("%d",a+i);rep(j,a[i])c=v[c][a[i]&1];v[c][2]=1;rep(j,2)v[v[c][j^1]][j]=v[c][j];c=v[c][0];}rep(i,q) scanf("%d",&c),printf("%d\n",1-v[c][2]);}

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

colors = { "gray": 0, "brown": 0, "green": 0, "water": 0, "blue": 0, "yellow": 0, "orange": 0, "red": 0 }

other = 0

for a in A:
  if 1 <= a <= 399:
    colors["gray"] += 1
  elif 400 <= a <= 799:
    colors["brown"] += 1
  elif 800 <= a <= 1199:
    colors["green"] += 1
  elif 1200 <= a <= 1599:
    colors["water"] += 1
  elif 1600 <= a <= 1999:
    colors["blue"] += 1
  elif 2000 <= a <= 2399:
    colors["yellow"] += 1
  elif 2400 <= a <= 2799:
    colors["orange"] += 1
  elif 2800 <= a <= 3199:
    colors["red"] += 1
  else:
    other += 1

num = len(list(filter(lambda x: x > 0, colors.values())))

if num == 0:
  print(1, other)
else:
  print(num, num + other)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
	ll a,b,c,d; cin>>a>>b>>c>>d;
	ll ans = b-a+1;
	ans -= (b/c) - ((a-1)/c);
	ans -= (b/d) - ((a-1)/d);
	ll e = __gcd(c,d);
	e = c*d/e;
	ans += (b/e) - ((a-1)/e);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

enum FACE { TOP, BOTTOM, NORTH, SOUTH, WEST, EAST };

class dice {
private:
	int num[6];

public:
	inline void roll(FACE a, FACE b, FACE c, FACE d) {
		swap(num[a], num[b]);
		swap(num[b], num[c]);
		swap(num[c], num[d]);
	}

	dice() {
		num[TOP] = 1;
		num[BOTTOM] = 6;
		num[NORTH] = 5;
		num[SOUTH] = 2;
		num[EAST] = 3;
		num[WEST] = 4;
	}

	dice(const dice& d) {
		num[TOP] = d[TOP];
		num[BOTTOM] = d[BOTTOM];
		num[NORTH] = d[NORTH];
		num[SOUTH] = d[SOUTH];
		num[EAST] = d[EAST];
		num[WEST] = d[WEST];
	}

	int encode() const {
		return (num[TOP] - 1) * 6 * 6 + (num[NORTH] - 1) * 6 + (num[EAST] - 1);
	}

	const int& operator[] (FACE f) const { return num[f]; }
};

void north(dice& d) { d.roll(TOP, SOUTH, BOTTOM, NORTH); }
void east(dice& d) { d.roll(TOP, WEST, BOTTOM, EAST); }
void west(dice& d) { d.roll(TOP, EAST, BOTTOM, WEST); }
void south(dice& d) { d.roll(TOP, NORTH, BOTTOM, SOUTH); }


const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
void (*func[4])(dice& d) = {east, south, west, north};

constexpr int MAX_SIZE = 10;
constexpr int INF = 0xfffffff;

int h, w;
int gx, gy;
int field[MAX_SIZE][MAX_SIZE];

typedef int weight;
vector<weight> dist;
struct state {
	int x, y;
	dice d;
	weight dist;
	state(int x, int y, const dice& d, weight dist):x(x), y(y), d(d), dist(dist){}

	bool operator>(const state& s) const {
		return dist > s.dist;
	}
};

inline bool out(int x, int y) {
	return x < 0 || x >= w || y < 0 || y >= h;
}

weight dijkstra(int sx, int sy, dice d) {
	priority_queue<state, vector<state>, greater<state> > que;
	vector<vector<vector<weight>>> dist(h, vector<vector<weight>>(w, vector<weight>(6*6*6, INF)));
	dist[sy][sx][d.encode()] = 0;
	que.push(state(sx, sy, d, 0));

	while(!que.empty()) {
		const state s = que.top();
		que.pop();

		if(dist[s.y][s.x][s.d.encode()] < s.dist)
			continue;

		if(s.x == gx && s.y == gy)
			return s.dist;

		for(int i = 0; i < 4; ++i) {
			const int nx = s.x + dx[i];
			const int ny = s.y + dy[i];
			if(out(nx, ny)) continue;
			dice next_d(s.d);
			func[i](next_d);

			const int next_dist = s.dist + next_d[BOTTOM] * field[ny][nx];
			const int value = next_d.encode();
			if(dist[ny][nx][value] > next_dist) {
				dist[ny][nx][value] = next_dist;
				que.push(state(nx, ny, next_d, next_dist));
			}
		}
	}

	assert(false);
}

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

	while(cin >> h >> w && h) {
		for(int i = 0; i < h; ++i) {
			for(int j = 0; j < w; ++j) {
				cin >> field[i][j];
			}
		}

		int sx, sy;
		cin >> sy >> sx >> gy >> gx;

		cout << dijkstra(sx, sy, dice()) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1352
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <assert.h>
#include <climits>
using namespace std;
#define ll long long int
int main(){
    ll X;
    cin >> X;
    double t;
    t= (1+0.01);
    ll ans=100;
    ll years=0;
    while(ans<X){
        if(ans*t-ans>=1)
        { 
            ans=ans*t;
            years++;
          //  cout << ans << endl;
        }
    }
    cout << years<<endl;    
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    ll X;
    cin >> X;

    ll now   = 100;
    int year = 0;

    while (now < X) {
        now = now * 1.01;
        ++year;
    }
    cout << year << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;


int main(){
    double W,H,x,y; cin >> W >> H >> x >> y;
    double ans = W * H / 2;
    if(W / 2 == x && H / 2 == y){
        cout << fixed << setprecision(10) << ans << " " << 1 << endl;
    }
    else cout << fixed << setprecision(10) << ans << " " << 0 << endl;

}


Measured memory_bytes: 256
H, N = map(int, input().split())
A = [0 for _ in range(N)]
B = [0 for _ in range(N)]
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b
MP = [0 for _ in range(H+1)]
tmp = [0 for _ in range(N)]
for h in range(1, H+1):
    for n in range(N):
        if A[n] >= h:
            tmp[n] = B[n]
        else:
            tmp[n] = MP[h-A[n]]+B[n]
    MP[h] = min(tmp)
print(MP[H])


Measured memory_bytes: 43656
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		HashSet<Integer> set = new HashSet<Integer>();
		Scanner scan = new Scanner(System.in);
		set.add(scan.nextInt());
		set.add(scan.nextInt());
		set.add(scan.nextInt());
		if(set.size() == 2) System.out.println("Yes");
		else System.out.println("No");
		scan.close();
	}

}

Measured memory_bytes: 21844
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::cmp::*;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(std::io::stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.read()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(104_857_600)
        .spawn(solve)
        .unwrap()
        .join()
        .unwrap();
}

fn solve() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n = sc.read();
    let mut a: Vec<u32> = sc.vec(n);

    println!("{}", a.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(" "));
    for i in 1..n {
        let v = a[i];
        let mut j = i;
        while j >= 1 && a[j-1] > v {
            a[j] = a[j-1];
            j -= 1;
        }
        a[j] = v;
        println!("{}", a.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(" "));
    }
}



Measured memory_bytes: 9084
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b < c){
        print("No");
    }else{
        print("Yes");
    }
    return 0;
}

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

typedef long long ll;

int main(){
  int N,K;
  cin >> N >> K;
  vector<ll> v(N);

  for(int i = 0; i < N; i++){
    cin >> v.at(i);
  }
  
  ll tmpans = 100000000 * K;
  for(int j = 0; j + K -1 < N; j++){
    ll tmpleft = 0;
    ll tmpright = 0;
    
    tmpleft = abs(v[j]) + abs(v[j] - v[j+K-1]) ;
    tmpright = abs(v[j+K-1]) + abs(v[j] - v[j+K-1]);
    
    ll tmp = min(tmpleft, tmpright);
    
    if(tmp < tmpans){
      tmpans = tmp;
    }
  }
  
  cout << tmpans << endl;

}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;
import static java.lang.Math.*;
public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int [] a = new int[3];
		for(int i = 0;i < 3;i ++) {
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		System.out.println(a[2] - a[0]);
	}
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    string s,t;
    cin>>s>>t;

    ll n = s.length();
    ll m = t.length();
    Vs S;
    rep(i,n+1-m){
        bool ok = true;
        rep(j,m){
            if(s[i+j]=='?')continue;
            if(s[i+j]!=t[j]){
                ok =false;
                break;
            }
        }
        if(ok){
            string x = s;
            rep(j,m){
                x[i+j] = t[j];
            }
            rep(j,n){
                if(x[j]=='?'){
                    x[j] = 'a';
                }
            }
            S.pb(x);
        }
    }
    sort(ALL(S));
    if(S.size()==0){
        out("UNRESTORABLE");
    }else{
        out(S[0]);
    }
    return  0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel.Design;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Schema;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<int> Slist() {
            var t = ReadLine();
            if (t.Trim().Length == 0) return new List<int>();
            return new List<int>(t.Split().Select(int.Parse)); }
        static void Main(string[] args)
        {
            var h = Sarray()[0];
            var s = Sarray().Sum();
            WriteLine(h <= s ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 26828
# include "bits/stdc++.h"
 
using namespace std;
 
#define endl "\n"
typedef long long int ll;
#define f first
#define s second
 
#define SEND_HELP ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
inline void setPrecision(int n){cout.precision(n);}
 
//DEBUG
#define BR cerr<<endl
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
 
ll INF = 1e10;
int MOD = 1e9+7;

int main(){
	#ifndef ONLINE_JUDGE
        freopen("inputf.in", "r", stdin);
    #endif
    SEND_HELP

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < n; ++ i){
    	cout << s[i] << t[i];
    }

    return 0;
}

/*

*/

Measured memory_bytes: 3568