akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define dmp(x) cerr<<#x<<":"<<x<<endl
typedef pair<int,int> P;
typedef pair<int,P> PP; 
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1e9+7;

signed main(){
  int n;
  cin>>n;
  vector<int> w(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>w[i];
    sum+=w[i];
  }
  int ans=sum;
  int tsum=0;
  for(int i=0;i<n;i++){
    tsum+=w[i];
    chmin(ans,abs(sum-2*tsum));
  }
  cout<<ans<<endl;
  return 0;
}


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

#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))

int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int main(){
ll N,K,x; cin>>N>>K;
if(N>K){
    x=N%K;
}else{
    x=N;
}
ll ans=0;
while(true){
    ll tmp1,tmp2,tmp3;
    tmp1=x;
    x=abs(x-K);
    tmp2=abs(tmp1-K);
    tmp3=abs(tmp2-K);
    if(tmp1==tmp3){
        ans=min(tmp1,tmp2);
        break;
    }

}
cout<<ans<<endl;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
#define LL long long


using namespace std;
const int maxn=1e5+5;

int main()
{
    LL x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    LL ans;
    if(d>=x)
    {
        if(k%2==1)
            cout<<abs(d-x);
        else
            cout<<x;
    }
    else
    {
        if(x/d>=k)
        {
            cout<<abs(x-d*k);
        }
        else
        {
            LL ans;
            LL cha1=x-x/d*d;

            LL cha2=d-cha1;

            if(cha1<cha2)
            {
                if((k-x/d)%2==0)
                {
                    ans=cha1;
                }
                else
                    ans=cha2;
            }
            else
            {
                if((k-x/d)%2==1)
                    ans=cha2;
                else
                    ans=cha1;
            }
            cout<<ans<<endl;
        }
    }

}


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

int main() {
  string s;
  cin >> s;
  int n = s.size() + 1;
  int count = 0;
  vector<int> a(n, 0);
  for(int i=0; i<n-1; i++) {
    if(s.at(i) == '<') {
      count++;
    } else {
      count = 0;
    }
    a.at(i+1) = count;
  }
  count = 0;
  for(int i=n-2; i>=0; i--) {
    if(s.at(i) == '>') {
      count++;
    } else {
      count = 0;
    }
    a.at(i) = max(a.at(i), count);
  }
  long long ans = 0;
  for(int i=0; i<n; i++) {
    ans += a.at(i);
  }
  cout << ans << endl;
}

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

using namespace std;
 
int main() {
	int N;
	cin >> N;

	vector<int> A(N);
	for (int i = 0; i < N ; i++)
	{
		cin >> A.at(i);
	}

	for (int i = 0; i < N ; i++)
	{
		int _tmp = A.at(i);

		if ( _tmp % 2 == 0)
		{
			if (_tmp % 3 != 0 && _tmp % 5 != 0)
			{
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}

	cout << "APPROVED" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stdio.h>
#include <string>
#include <cctype>

#define rep(i,n) for(int i = 0; i < n; i++)

typedef long long ll;

using namespace std;

const int INF = 1e9;
const double PI=3.14159265358979323846;

int main(){
  while(100){
    string s;
    int ans=0;
    cin >> s;
    if(s=="0") break;
    for(int j=0; j<s.size();j++){
      ans+=s[j]-'0';
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3148
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::input;
use std::collections::*;

fn main() {
    input! {
        n:usize,
        m:usize,
        a:[i32;m],
    }
    let need = a.iter().fold(0, |sum, x| sum + x);
    let ans = if need <= n as i32 {
        n as i32 - need
    } else {
        -1
    };
    println!("{}", ans);
}

Measured memory_bytes: 2192
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	const inputLines = input.split("\n");

	const n = parseInt(inputLines, 10);
	result = n % 1000;
	if (result === 0) {
		console.log(result);
		return;
	}
	console.log(1000 - result);
	

	// tmp = input[1].split(" ");
	// //文字列から10進数に変換するときはparseIntを使います
	// var a = parseInt(input[0], 10);
	// var b = parseInt(tmp[0], 10);
	// var c = parseInt(tmp[1], 10);
	// var s = input[2];

	//出力
	// console.log('%d %s',a+b+c,s);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

// node index.js
// 1
// 2 3
// test
// (Ctrl + D)


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

int main(){
  int64_t N,K;
  cin >> N >> K;
  
  int64_t juko=N/K;
  
  int64_t yasu=N-juko*K;
  int64_t nao=K-yasu;
  
  cout <<  min(nao,yasu) <<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	int n; cin >> n;
	vector<int> as(n); REP(i, n) cin >> as[i];
	sort(as.begin(), as.end());
	const int N = as.back();
	int maxDist = 0;
	int r = 0;
	for (const int ai : as)
	{
		int dist = min(ai, N - ai);
		if (dist > maxDist)
		{
			maxDist = dist;
			r = ai;
		}
	}
	cout << N << ' ' << r << endl;
}


Measured memory_bytes: 3704
import math
import heapq

N=int(input())
V=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

heapq.heapify(V)
a=heapq.heappop(V)
b=0
for i in range(len(V)):
    b=heapq.heappop(V)
    a=(a+b)/2

print(a)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        if ((2 * K - 1) <= N) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 22868
program ABC176B
    implicit none
    integer(8)::i,ans=0
    character(2000000)::S
    read*,S
    do i=1,len_trim(S)
        ans=ans+ichar(S(i:i))-48
    end do
    
    if(mod(ans,9)==0)then
        print'(A)',"Yes"
    else
        print'(A)',"No"
    end if
end program ABC176B

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

class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		var B = Console.ReadLine().Split(' ');
		var Bl = new List<int>();
		foreach (var Bs in B) {
			Bl.Add(int.Parse(Bs));
		}
		var Bn = Bl.ToArray();
		int ans = 0;
		int An =0;
		
		
		for (int i = 0; i < N; i++) {
			if(i < Bn.Length){
				An = Bn[i];
			}else{
				An = Bn[i-1];
			}
			if (i - 1 != -1) {
				if (Bn[i - 1] < An)
					An = Bn[i - 1];
			}
			ans += An;
		}
		Console.Write(ans);
	}
}


Measured memory_bytes: 11092
package main

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

var nextReader func() string

func newScanner() func() string {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1024), int(1e11))
	sc.Split(bufio.ScanWords)
	return func() string {
		sc.Scan()
		return sc.Text()
	}
}

func nextString() string { return nextReader() }

func nextInt() int { n, _ := strconv.Atoi(nextReader()); return n }

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

func main() {
	nextReader = newScanner()
	N := nextInt()
	Ai := make(map[int]int, N)
	for i := 0; i < N; i++ {
		Ai[nextInt()] += 1
	}
	if len(Ai) == N {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


Measured memory_bytes: 9344
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int H = scan.nextInt();
    int N = scan.nextInt();
    int A[] = new int[N];
    int sum = 0;
    for (int i = 0; i < N; i++) {
      A[i] = scan.nextInt();
      sum += A[i];
    }
    if (sum >= H) {
      System.out.println("Yes");
    }
    else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 51040
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;
const int MaxN = 1e4;
long long T, n, m;
int a[MaxN + 5];
int main()
{
	scanf("%d%d%d", &T, &n, &m);
	int ans = 0;
	for(int i = 1; i <= T; i++)
	{
		int x = i;
		int sum = 0;
		while(x > 0)
		{
			sum += x % 10;
			x /= 10;
		}
		if(sum >= n && sum <= m) ans += i;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
import Data.Array

solve :: Int -> Int -> Mint
solve n k = sum $ map (\(i,a)->M i*a) $ assocs arr where
  arr = array (1, k) [ (i, M (div k i) ^ n - sum ext) |
    i <- [k, k-1 .. 1],
    let ext = [arr!(i*m) | m <- [2..div k i] ] ]

main = do
  [n, k] <- map read.words <$> getLine
  print $ solve n k

modulus = 10^9 + 7
newtype Mint = M Int
instance Enum Mint where
  toEnum a = M $ mod a modulus
  fromEnum (M a) = a
instance Num Mint where
  (M a) + (M b) = toEnum $ a + b
  (M a) * (M b) = toEnum $ a * b
  negate (M a) = toEnum $ negate a
  fromInteger = toEnum . fromInteger
  abs = id
  signum _ = M 1
instance Show Mint where
  show = show . fromEnum

Measured memory_bytes: 21372
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn vec<T, F: FnMut(usize) -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|i| f(i)).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let k: usize = scan(tokens);
    let h: Vec<usize> = vec(n, |_| scan(tokens));
    if k == n {
        println!("0");
        return;
    }
    let mut dp = vec![vec![0; k + 1]; n];
    for i in 0..n {
        for l in 0..k + 1 {
            let mut min = std::usize::MAX;
            if i <= l {
                min = std::cmp::min(min, h[i]);
            }
            for j in 0..std::cmp::min(i, l + 1) {
                min = std::cmp::min(min, dp[i - 1 - j][l - j] + f(h[i], h[i - 1 - j]));
            }
            dp[i][l] = min;
        }
    }
    let mut min = std::usize::MAX;
    for j in 0..k + 1 {
        min = std::cmp::min(min, dp[n - 1 - j][k - j]);
    }
    println!("{}", min);
}

fn f(x: usize, y: usize) -> usize {
    if x > y {
        x - y
    } else {
        0
    }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int N;
int A[202020];
int R[202020];



void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>A[i+1];
		R[A[i+1]]=i+1;
	}
	set<int> NG;
	NG.insert(0);
	NG.insert(N+1);
	
	ll ret=0;
	for(i=1;i<=N;i++) {
		auto it=NG.lower_bound(R[i]);
		int RR=*it;
		it--;
		int LL=*it;
		ret += 1LL*i * (RR-R[i])*(R[i]-LL);
		NG.insert(R[i]);
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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


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

  int cnt[30] = {};
  rep(i, n) ++cnt[s[i]-'a'];
  long long ans = 1;
  rep(i, 30) if (cnt[i] != 0) {
    ans = (ans * (cnt[i]+1)) % MOD;
  }
  print(ans-1);

  return 0;
}

Measured memory_bytes: 512
import java.util.*;

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

	Scanner sc = new Scanner(System.in);
	int x = 0;
	int j = 0;
	int n = sc.nextInt();
	int[] table = new int[n];

	for(int i=0;i<n;i++){

	    table[i] = sc.nextInt();
	    
	}

	while(table[j]%2==0){
	    
	    table[j] = table[j]/2;
	    x++;
	    if(j==n-1){
		j=0;
	    }else{
		j++;
	    }
	}
       
	System.out.println(x/n);
    }
}


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

int N, X;

int gcd(int a, int b) {
    while (b) {
        int t = a;
        a = b;
        b = t%b;
    }
    return a;
}

signed main() {
    cin >> N >> X;
    int G = 0;
    rep(i, N) {
        int x; cin >> x;
        G = gcd(G, abs(X-x));
    }
    cout << G << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int N = Integer.parseInt(st.nextToken());
        int T = Integer.parseInt(st.nextToken());

        int[] arr = new int[N];
        st = new StringTokenizer(br.readLine());
        for (int i=0; i<N; i++) {
            arr[i] = Integer.parseInt(st.nextToken());
        }

        int[] mins = new int[N];
        int[] maxs = new int[N];

        int curMin = arr[0]; 
        for (int i=0; i<N; i++) {
            curMin = Math.min(curMin,arr[i]);
            mins[i]= curMin;
        }

        int curMax = arr[N-1]; 
        for (int i=N-1; i>=0; i--) {
            curMax = Math.max(curMax,arr[i]);
            maxs[i]= curMax;
        }
        int profit=-1;
        for (int i=0; i<N-1; i++) {
            profit = Math.max(profit, maxs[i+1]-mins[i]);
        }

        if (profit<=0) {
            System.out.println(0);
        }
        else{
            int ans = 0;
            for (int i=0; i<N-1; i++) {
                if(maxs[i+1]-mins[i]==profit){
                    ans++;
                    curMin=mins[i];
                    while(i+1<N && mins[i+1]==curMin)
                        i++;
                }
            }
            System.out.println(ans);
        }

        
    }
}


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

int main() {
  string S;
  cin >> S;

  ll ans = 0, b_len = 0;
  rep(i,0,S.size()-1) {
    if (S[i] == 'B') b_len++;
    if (S[i] == 'W') {
      if (S[i-1] == 'B') {
        swap(S[i-b_len], S[i]);
        ans += b_len;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

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

int main() {
	int a, b; scanf("%d%d", &a, &b);
	
	if(13 <= a) printf("%d\n", b);
	else if(a <= 5) printf("0\n");
	else printf("%d\n", b >> 1);
	return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> grid(H);
  for (int i=0; i < H; i++) {
    cin >> grid.at(i);
  }
  vector<bool> rowmark(H,false), colmark(W,false);
  for (int i=0; i < H; i++) {
    bool flg = false;
    for (int j=0; j < W; j++) {
      if (grid.at(i).at(j) == '#') {
        flg = true;
      }
    }
    rowmark.at(i) = flg;
  }
    for (int i=0; i < W; i++) {
    bool flg = false;
    for (int j=0; j < H; j++) {
      if (grid.at(j).at(i) == '#') {
        flg = true;
      }
    }
    colmark.at(i) = flg;
  }
  for (int i=0; i < H; i++) {
    for (int j=0; j < W; j++) {
      if (rowmark.at(i) == true && colmark.at(j) == true) {
    cout << grid.at(i).at(j);
      }
    }
    if (rowmark.at(i) == true) {
    cout << endl;
    }
  }
}


Measured memory_bytes: 256
n,q=map(int,input().split())
S=input()
cnt=[0]*n

for i in range(1, n):
    s=S[i-1]+S[i]
    if s=="AC":
        cnt[i]+=1

for i in range(1, n):
    cnt[i]+=cnt[i-1]

for _ in range(q):
    l, r=map(int,input().split())
    ans=cnt[r-1]-cnt[l-1]
    print(ans)

Measured memory_bytes: 7668
s=[c for c in input()]

for i in range(len(s)-1):
  if s[i]==s[i+1]:
    print(i+1,i+2)
    exit()
for i in range(len(s)-2):
  if(s[i]==s[i+2]):
    print(i+1,i+3)
    exit()
    
print(-1,-1)

Measured memory_bytes: 3956
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = new int[9];
            for(int i = 1; i <= 9; i++)
            {
                A[i - 1] = 111 * i;
            }
            for(int i=0; i < 9; i++)
            {
                if (n <= A[i])
                {
                    Console.WriteLine(A[i]);
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 27456
p = list(map(int,input().split()))
K = int(input())
a = p[0]
b = p[1]
c = p[2]
i = 0
while b <= a:
  b = b*2
  i += 1
while c <= b:
  c = c*2
  i += 1
if i <= K:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9184
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoderPre
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] i = Console.ReadLine().ToCharArray();
            char[] R = Console.ReadLine().ToCharArray();

            int count = 0;
            if (i[0] == R[0]) count++;
            if (i[1] == R[1]) count++;
            if (i[2] == R[2]) count++;
            
            Console.WriteLine(count);


        }

    }
}

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

#pragma region Macros
using ll = long long;
#define int ll
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
#define IOS\
    ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SORT(name) sort(name.begin(), name.end())
#define RSORT(name)\
    SORT(name);\
    reverse(all(name));
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
template <class T> inline void print(T x){ cout << x << '\n';}
template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
#pragma endregion

#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const int MOD = 1000000007;
const int MAX_N = 100010;

signed main() {
    IOS;

    string S;
    cin >> S;

    auto sa = suffix_array(S);
    auto lcp = lcp_array(S, sa);

    // 全パターン
    int ans = 1LL * S.length() * (S.length() + 1) / 2;

    for(int i = 0; i < static_cast<int>(lcp.size()); ++i) {
        ans -= lcp[i];
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 15600
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o set
const ll INF = 1e18;
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n,k; cin >> n >> k;
    vector<ll> a(n);
    rep(i,n)  cin >> a[i];
    ll ans=INF;
    rep(i,(1ull<<n)){
        int cnt=0;
        rep(j,n){
            if(i&(1ull<<j)){
                cnt++;
            }
        }
        if(cnt!=k) continue;
        ll res=0;
        ll mxm=0;
        rep(j,n){
            if(i&(1ull<<j)){
                if(mxm>=a[j]){
                    mxm++;
                    res+=(mxm-a[j]);
                }else{
                    mxm=a[j];
                }
            }else{
                chmax(mxm,a[j]);
            }
        }
        chmin(ans,res);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3572
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  if(N == 1){
    myout(0);
    return;
  }
  var mod = 1000000007;
  var output = 1;
  var minus = 1;
  var plus = 1;
  for(var i = 1; i <= N; i++){
    output *= 10;
    output %= mod;
    minus *= 9;
    minus %= mod;
    plus *= 8;
    plus %= mod;
  }
  output -= minus;
  if(output < 0){
    output += mod;
  }
  output -= minus;
  if(output < 0){
    output += mod;
  }
  output += plus;
  output %= mod;
  myout(output);
}


Measured memory_bytes: 34984
#include <iostream>
#include<string>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<map>
using namespace std;

int main() {
	double N, X, T;
	cin >> N >> X >> T;
	double A = N/X;
	//cout << A << endl;
	int i, ans = 1;
	for (i = 0; i < A; i++)ans = T * (i + 1);
	cout << ans << endl;
	return 0;
}

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

int main(void)
{
    ios::sync_with_stdio(false);
    int n, l, ans=0;
    map<int, int> mp;
    map<int, int>::iterator it1, it2, it3;
    cin>>n;
    while(n--){
        cin>>l;
        mp[l]++;
    }
    for(it1=mp.begin(); it1!=mp.end(); it1++)
        for(it2=it1,it2++; it2!=mp.end(); it2++)
            for(it3=it2,it3++; it3!=mp.end(); it3++)
                if(it1->first+it2->first>it3->first)
                    ans += it1->second*it2->second*it3->second;
                else
                    break;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <sstream>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using boost::string_ref;

using namespace std;

int64_t f(int64_t b, const vector<int64_t>& as)
{
    int64_t ret = 0;
    for(size_t i = 0; i != as.size(); ++i)
    {
        ret += abs(as[i] - (b + (int64_t)i + 1));
    }
    return ret;
}

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

    int n;
    cin >> n;

    vector<int64_t> as(n);
    vector<int64_t> ds(n);
    for(int i = 0; i < n; ++i)
    {
        cin >> as[i];
        ds[i] = as[i] - (i + 1);
    }
    
    sort(begin(ds),end(ds));
    
    const auto median = ds.size() % 2 != 0 ? ds[ds.size()/2] : (ds[ds.size()/2 - 1] + ds[ds.size()/2])/2;
    
    cout << f(median, as) << '\n';
    
    return 0;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ull unsigned ll
#define pb push_back
#define popb pop_back
#define mt make_tuple
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define piii pair <pii,int>
#define piiii pair <pii,pii>
#define plll pair <pair <ll, ll>, ll>
#define rep0(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<=(ll)n;i++)
#define rep(i,x,y) for(ll i=(ll)x;i<=(ll)y;i++)
#define reprev(i,n) for(ll i=(ll)n;i>=0;i--)
#define all(c) c.begin(),c.end()
#define print(a) rep0(i,a.size()) cout << a[i] << " "
#define hi() cout << "\nHello, I am error. Can you find me? :):):)\n"
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_eppoch().count())
 
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;

const int mod = 1e9+7;
const long double pi = acos(-1);

ll power(ll x, ll y){
	x %= mod;
	if(y == 0) return 1;
	if(y == 1) return x;
	ll num = power(x,y/2) % mod;
	if(y%2 == 0) return (num*num)%mod;
	else return (((num*num)%mod)*x)%mod;
}


void solve(){

	ll k;
	cin >> k;
	ll ans = 0;
	if(k==2 || k==3){
		cout << k-1;
		return;
	}
	set <int> a;
	for(ll i = 2;i*i<=k;i++){
		if(k%i == 0){
			ll tmp = k;
			while(tmp%i==0) tmp /= i;
			if(tmp%i == 1){
				// cout << i << " ";
				ans++;
				a.insert(i);
			}

			if(k/i != i){
				ll var = k;
				while(var%(k/i)==0) var /= (k/i);
				if(var%(k/i)==1){
					// cout << k/i << " ";
					ans++;
					a.insert(k/i);
				}
			}
		}
	}

	k--;
	for(ll i=2;i*i<=k;i++){
		if(k%i==0){
			if(a.find(i)==a.end()) {ans++;}
			if(i != k/i && a.find(k/i)==a.end()) {ans++;}
		}
	}
	ans+=2;
		
	cout << ans;


	return;
}

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		// cout << "Case #" << t << ": ";
		solve();
		// cout << "\n";
	}

	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;//998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template<class _T> static void getint(_T& a) {
	if (sizeof(_T) > sizeof(int)) {
		scanf("%lld", &a);
	}
	else {
		scanf("%d", &a);
	}
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	int N, M, K;
	get(N, M, K);
	for (int n = 0; n <= N; n++) {
		for (int m = 0; m <= M; m++) {
			if ((n * M + m * N - 2 * n * m) == K) {
				printf("Yes\n");
				return;
			}
		}
	}
	printf("No\n");
}


Measured memory_bytes: 3596
import java.lang.reflect.Array;
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 
    int M = sc.nextInt(); 
    boolean b[] = new boolean[N+1]; 
    long dp[] = new long[N+1];

    Arrays.fill(b,true);
    for(int i = 0; i < M; i++){
      int tmp = sc.nextInt();  
      b[tmp]= false; 
    }
    dp[0] = 1;
    if(b[1]==true){
      dp[1] = 1;
    }else{
      dp[1] = 0;
    }
    for(int i = 2; i < N+1; i++){
      if(b[i]==true){
        dp[i] = (dp[i-1] + dp[i-2])%1000000007; 
      }else{
        dp[i] = 0; 
      }
    }  
    System.out.println(dp[N]);      
  }
}




Measured memory_bytes: 49320
#include <bits/stdc++.h>
 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll = long long;
 
const double PI = 3.14159265358979;
 
void solve()
{
  string a, b;
  cin >> a >> b;
  int n = stoi(a + b);
  for(int i = 0; i * i <= n; ++i)
  {
    if (i * i == n)
    {
      cout << "Yes";
      return;
    }
  }
  cout << "No";
}
 
int main()
{
  fastio;
  solve();
 
  return 0;
}

Measured memory_bytes: 3600
from itertools import permutations

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

cook_time = [A,B,C,D,E]

perm_times = list(permutations(cook_time))

result_time = 10**9

for perm_time in perm_times:
    total_time = 0
    cnt = 0
    for time in perm_time:
        cnt += 1
        if time % 10 != 0 and cnt != 5:
            total_time += time + 10 - time % 10
        else:
            total_time += time
        
    if result_time > total_time:
        result_time = total_time
        
    
    
print(result_time)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-6;
const long long inf = 2e12 + 12;
const int MAXN = 400005, MAXM = 102, Mod = 1000000007, MAXLog = 20;

bool isOdd(int n) {
	int cnt = 0;
	while (n)
	{
		++cnt;
		n /= 10;
	}
	return cnt & 1;
}

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(9), cout << fixed;

	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		ans += isOdd(i);
	}
	
	cout << ans << '\n';
	
	return 0;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] s = Console.ReadLine().Split(' ');

            int[] n = new int[3];
            n[0] = int.Parse(s[0]);
            n[1] = int.Parse(s[1]);
            n[2] = int.Parse(s[2]);

            Array.Sort(n);
            Console.WriteLine(n[0] + " " + n[1] + " " + n[2]);

        }
    }
}

Measured memory_bytes: 9352
<?php
$o=array();
while(1){
  list($a,$b)=explode(' ',trim(fgets(STDIN)));
  if($a||$b){$o[]=($a<$b)? "{$a} {$b}":"{$b} {$a}";}
  else{break;}
}
print implode("\n",$o);
?>

Measured memory_bytes: 15768
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;
int main(void){
    while (1) {
        int N;
        cin >> N;
        if (N == 0) break;
        int l[N];
        for (int i = 0; i < N; i++) cin >> l[i];
        
        double H = 1e10;
        int s,a,c;
        for (int S = 0; S < 16; S++) {
            for (int A = 0; A < 16; A++) {
                for (int C = 0; C < 16; C++) {
                    
                    int R = S;
                    int L[256];
                    for (int i = 0; i < 256; i++) L[i] = 0;
                    for (int i = 0; i < N; i++) {
                        R = (A*R+C)%256;
                        L[(l[i]+R)%256] += 1;
                    }
                    double tmp = 0.0;
                    for (int i = 0; i < 256; i++) {
                        if (L[i] > 0) {
                            tmp += -(double)L[i]/N*log2((double)L[i]/N);
                        }
                    }
                    if (tmp < H) {
                        H = tmp;
                        s = S; a = A; c = C;
                    }
                }
            }
        }
        printf("%d %d %d\n",s,a,c);
    }
    return 0;
}

Measured memory_bytes: 1168
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main()
{
	int n;
	cin>>n;
	int x = 1;
	bool answer = false;
	int ans = 0;
	for(x = 1; x <= 50000; x++){
		if( int( x * 1.08) == n){
			answer = true;
			ans = x;
			break;
		}
	}
	if( answer == true){
		cout<<ans<<endl;
	}else{
		cout<<":("<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	long long i,n,a,s=0;
	cin>>n;
	while(1)
	{
		if(n/2!=0) { s++; n/=2;
		} 
		else break;
	}
	s=pow(2,s+1)-1;
	cout<<s;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A, B;
    string S;
    string S2[7] = {"SUN","MON","TUE","WED","THU","FRI","SAT"}; 
    cin >> S;
    
    for (int i = 0; i < 7; i++){
        if (S == S2[i]){
            if (i == 0){
                cout << 7 << endl;
            } else {
                cout << 7 - i%7 << endl;
            }
            break;
        }
    }
            
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 1000000

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head=1, tail=1,n;

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

P dequeue(){
  P x;
  x = Q[head];
  if(head + 1 == LEN){
    head = 0;
  }
  else{ head++;}
  return x;
}


int main(){
  int elaps = 0, c=0;
  int i, q,a=0;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
    enqueue(Q[i]);
  }
  while(1){
    elaps++;
    if(n==c)break;
    if(Q[elaps].t - q > 0){
      a += q;
      Q[elaps].t -= q;
      enqueue(Q[elaps]);
    }
    else {
      a += Q[elaps].t;
      printf("%s %d\n",Q[elaps].name,a);
      c++;
      Q[elaps] = dequeue();
    }
  }
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int m, k;
  cin >> m >> k;
  int mx = power(2, m + 1);
  if (k == 0) {
    vi32 v(mx);
    rep(i, mx) if (i < mx / 2) v[i] = i; else v[i] = mx - i - 1;
    cout << v << '\n';
  } else if (k >= mx / 2) {
    cout << -1 << '\n';
  } else if (m == 1) {
    cout << -1 << '\n';
  } else {
    vi32 v;
    v.push_back(k);
    for (int i = 0; i < mx / 2; i++) if (i != k) v.push_back(i);
    v.push_back(k);
    for (int i = mx / 2 - 1; i >= 0; i--) if (i != k) v.push_back(i);
    cout << v << '\n';
  }
}


Measured memory_bytes: 2932
import std.stdio, std.array, std.conv, std.algorithm, std.string, std.numeric, std.range;
string swap(string s){
	if(s.indexOf("apple")!=-1) return s.replace("apple", "peach");
	else if(s.indexOf("peach")!=-1) return s.replace("peach", "apple");
	else return s;
}
void main() {
	string s;
	while( (s=readln.strip).length != 0 ){
		auto as = s.split(' ').map!(swap).join(" ");
		writeln(as);
	}
}

Measured memory_bytes: 2484
#include <iostream>
#include <algorithm>

using namespace std;

int h, w;
char data[20][20];
bool visited[20][20][4][16];
int dy[] = {-1, 0, 1, 0};
int dx[] = {0, 1, 0, -1};

bool solve(int y, int x, int d, int m){
  while(1){
    if(visited[y][x][d][m]) break;
    visited[y][x][d][m] = true;
    switch(data[y][x]){
      case '<':
        d = 3;
        break;
      case '>':
        d = 1;
        break;
      case '^':
        d = 0;
        break;
      case 'v':
        d = 2;
        break;
      case '_':
        if(m) d = 3;
        else d = 1;
        break;
      case '|':
        if(m) d = 0;
        else d = 2;
        break;
      case '.':
        break;
      case '@':
        return true;
        break;
      case '+':
        m = (m+1)%16;
        break;
      case '-':
        m = (m+15)%16;
        break;
    }
    if('0' <= data[y][x] && data[y][x] <= '9') m = data[y][x] - '0';
    if(data[y][x] == '?'){
      for(int i=0;i<4;i++){
        int ny = y + dy[i], nx = x + dx[i];
        if(ny == h) ny = 0;
        if(ny == -1) ny = h-1;
        if(nx == w) nx = 0;
        if(nx == -1) nx = w-1;
        if(solve(ny, nx, i, m)) return true;
      }
      return false;
    }
    int ny = y + dy[d], nx = x + dx[d];
    if(ny == h) ny = 0;
    if(ny == -1) ny = h-1;
    if(nx == w) nx = 0;
    if(nx == -1) nx = w-1;
    y = ny;
    x = nx;
  }
  return false;
}

main(){
  cin >> h >> w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> data[i][j];
    }
  }
  fill(visited[0][0][0], visited[20][0][0], false);
  if(solve(0, 0, 1, 0)) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

typedef struct {
    Int y, x;
} p_t;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for (Int i  = 0; i < n; i++) {
        cout << s[i] << t[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

ll n, q;
char str[100005];
ll sum[100005]; //[0, i]までのACの数

int main()
{
    int l, r;
    
    scanf("%d %d", &n, &q);
    scanf("%s", str);

    for (int i = 1; i < n; i++) {
        sum[i] = sum[i - 1];
        if (str[i] == 'C' && str[i - 1] == 'A') {
            sum[i]++;
        }
    }

    for (int i = 0; i < q; i++) {
        scanf("%d %d", &l, &r);
        r--;l--;
        
        printf("%d\n", sum[r] - sum[l]);
    }

    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

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

int main() {
  string A, B;
  cin >> A >> B;
  if (A.size() > B.size()) {
    cout << "GREATER" << endl;
  } else if (A.size() < B.size()) {
    cout << "LESS" << endl;
  } else {
    int i = 0;
    while (A[i] == B[i]) {
      i++;
      if (i == A.size()) {
        break;
      }
    }
    if (A[i] > B[i]) {
      cout << "GREATER" << endl;
    } else if (A[i] < B[i]) {
      cout << "LESS" << endl;
    } else {
      cout << "EQUAL" << endl;
    }
  }
}


Measured memory_bytes: 256
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        n = input()
        a = map(int, input().split())

        odds = len([e for e in a if e % 2 == 1])
        if odds % 2 == 0:
            print('YES')
        else:
            print('NO')
            
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()


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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int n, k, a[1000];
int sum;
vector<int> divs;
int ans = 1;

vector<int> enum_divisor(int n) {
    vector<int> divisors;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            divisors.push_back(i);
            if (i * i != n) divisors.push_back(n / i);
        }
    }
    sort(divisors.begin(), divisors.end(), greater<>());
    return divisors;
}

// k回で操作可能か
bool ok(int d) {
    int k_cnd = 0;
    int remainers[505] = {};
    for (int i = 0; i < n; i++) remainers[i] = a[i] % d;
    sort(remainers, remainers + n);

    int l = 0, r = n - 1;
    while (l != r) {
        int mi = min(remainers[l], d - remainers[r]);
        remainers[l] -= mi;
        remainers[r] += mi;
        k_cnd += mi;
        if (remainers[l] == 0) l++;
        else r--;   // remainers[r] == d
    }

    if (k_cnd <= k) return true;
    else return false;
}

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

    divs = enum_divisor(sum);

    // 全ての約数について条件を満たすか
    for (auto &it:divs) {
        ans = ok(it) ? max(it, ans) : ans;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 100001;
int main()
{
  int n,m,x,y,i,res=0;
  int b[N_MAX];
  bool r[N_MAX];
  cin >> n >> m;
  fill(b+1,b+n+1,1);
  fill(r+2,r+n+1,0);
  r[1]=1;
  for(i=0;i<m;i++){
    cin >> x >> y;
    b[x]--;
    b[y]++;
    if(r[x]==1){
      r[y]=1;
      if(b[x]==0)
        r[x]=0;
    }
  }
  for(i=1;i<=n;i++)
    res+=r[i];
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 768
def f(n):
    if n%2 == 0:
        return int(n/2)
    else:
        return 3*n+1


s = int(input())
a_i = [s]

for x in range(1000000):
    tmp = f(a_i[x])
    
    if tmp in a_i:
        print(x+2)
        break
    
    a_i.append(tmp)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll (i)=0; (i)<(n); (i)++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define pll pair<ll,ll> 
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
int inf=1000001000;
ll INF=100000000000000000;
ll MOD=1000000007;
//g++ code.cpp   ./a.out 

int main() {
   ll n,k;
   cin >> n >> k;
   vector<ll> a(n);
   rep(i,n){
      cin >> a[i];
   }
   n-=k;  
   ll ans=1;
   while(n>0){
      n-=(k-1);
      ans++;
   }
   cout << ans << endl;
}



Measured memory_bytes: 1024