akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;


int main(void)
{
	string S; cin >> S;
	if (S[2] == S[3] && S[4] == S[5])cout << "Yes" << endl;
	else cout << "No" << endl;



	return 0;
}

Measured memory_bytes: 256
package main

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func maxInt64(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

// sort ------------------------------------------------------------

type int64Array []int64

func (s int64Array) Len() int           { return len(s) }
func (s int64Array) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s int64Array) Less(i, j int) bool { return s[i] < s[j] }

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

func main() {
	r := readInt64()
	d := readInt64()
	x := readInt64()

	for i := 0; i < 10; i++ {
		x = r*x - d
		fmt.Println(x)
	}
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N, M, K;
    cin >> N >> M >> K;
    Vl A(N), B(M);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (ll i = 0; i < M; i++) {
        cin >> B[i];
    }
    Vl cumA(N + 1), cumB(M + 1);
    for (ll i = 0; i < N; i++) {
        cumA[i + 1] = cumA[i] + A[i];
    }
    for (ll i = 0; i < M; i++) {
        cumB[i + 1] = cumB[i] + B[i];
    }

    ll ans = 0;
    for (ll i = 0; i <= N; i++) {
        if (cumA[i] > K) {
            break;
        }
        ll idx = upper_bound(cumB.begin(), cumB.end(), K - cumA[i]) - cumB.begin();
        ans = max(ans, i + idx - 1);
    }

    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 9536
import math
a,b,x=map(float, input().split())
h=b*math.sin(math.pi*x/180)
c=(a**2+b**2-2*a*b*math.cos(math.pi*x/180))**0.5
print(a*h*0.5)
print(a+b+c)
print(h)

Measured memory_bytes: 7744
def main():
    N, M =map(int, input().split())

    if N % 2:
        left = 1
        right = N - 1
        for _ in range(M):
            print(left, right)
            left += 1
            right -= 1
    else:
        left = 1
        right = N - 1
        flag = False
        for _ in range(M):
            if right - left <= N//2:
                flag = True
            
            if flag:
                print(left, right-1)
            else:
                print(left, right)
            
            left += 1
            right -= 1

        
if __name__ == "__main__":
    main()

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

using namespace std;

const int A = 1e9;

int main() {
  int n, k, s;
  scanf("%d %d %d", &n, &k, &s);
  for (int i = 0; i < n; ++i) {
    int val = A;
    if (i < k)
      val = s;
    else {
      if (s == A)
        val = 1;
      else
        val = s+1;
    }
    printf("%d%c", val, i+1 == n ? '\n' : ' ');
  }
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  string s;cin>>s;
  int ans=0;int res=0;
  s+="WWWWW";
  for(int i=0;i<s.size();i++){
    if(s.substr(i,2)=="BC"){
      ans+=res;i++;
      continue;
    }
    if(s[i]=='A')res++;
    else res=0;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 764
#include <stdio.h>
#include <math.h>
 
int main() {
  int n,i,j,l;
  double s[10020];
  double a2,m,a;
   
  while(1) {
    m=0;
    a2 = 0;
    scanf("%d" , &n);
    if(n == 0) {
      break;
    }
 
    for(i=0;i<n;i++) {
      scanf("%lf", &s[i]);
    m=m+s[i];
    //printf("m[%d] = %lf\n",i ,m);
    }
    m=m/n;
 
    for(i=0; i<n; i++) {
      a2 =a2+(s[i]-m)*(s[i]-m);
    }
    a2 = a2/n;
 
    printf("%.11lf\n",sqrt(a2));
 
  }
 
  return 0;
 
}


Measured memory_bytes: 2132
n = int(input())
A = list(map(int , input().split()))
q = int(input())
B = list(map(int , input().split()))

ans = []

for bit in range(1<<n):
    tmp = 0
    for i in range(n):
        if bit & (1<<i):
            tmp += A[i]
    ans.append(tmp)

for j in range(q):
    if B[j] in ans:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 43076
# 入力
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n = ni()
t = li()
a = li()

MOD = 10**9 + 7

# T,A の更新と矛盾を確認
t_modified = [0]*n
a_modified = [0]*n
t_modified[0] = 1
a_modified[-1] = 1
consistent = True

if max(a) != max(t):
    consistent = False

for i in range(n-1):
    if t[i+1] != t[i]:
        t_modified[i+1] = 1
        
        if t[i+1] > a[i+1]:
            consistent = False
            
    if a[i] != a[i+1]:
        a_modified[i] = 1
        
        if a[i] > t[i]:
            consistent = False

# 更新があった点は1通り、無かった点はmin(ti,ai)通りの高さが考えられる      
ans = 1
for i in range(n):
    if t_modified[i] == 0 and a_modified[i] == 0:
        ans = (ans * min(t[i], a[i])) % MOD

if consistent:
    print(ans)
else:
    print(0)

Measured memory_bytes: 18624
import java.util.Collections

import scala.io.StdIn

object Main {
  def main(args: Array[String]) = {
    val N = StdIn.readInt
    val S = StdIn.readLine
    val whites = S.count(c => c == '.')
    val blacks = S.count(c => c == '#')

    var wCnt = 0
    var bCnt = 0
    var ans = Int.MaxValue
    for(i <- 0 until N) {
      if (S.charAt(i) == '.') {
        wCnt += 1
      }
      if (S.charAt(i) == '#') {
        bCnt += 1
      }
      ans = Math.min(ans, (whites - wCnt) + bCnt)
    }
    wCnt = 0
    bCnt = 0
    for(i <- N-1 to 0 by -1) {
      if (S.charAt(i) == '.') {
        wCnt += 1
      }
      if (S.charAt(i) == '#') {
        bCnt += 1
      }
      ans = Math.min(ans, (blacks - bCnt) + wCnt)
    }
    println(ans)

  }
}


Measured memory_bytes: 29444
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int h, w, n;
	scanf("%d%d%d", &h, &w, &n);
	static char c[1024][1024];
	rep(i, h)
		scanf("%s", c[i]);
	
	int px[10], py[10];
	rep(i, h)
	{
		rep(j, w)
		{
			if (c[i][j] == 'S')
				c[i][j] = '0';
			if (isdigit(c[i][j]))
			{
				px[c[i][j] - '0'] = j;
				py[c[i][j] - '0'] = i;
			}
		}
	}

	const int INF = 1 << 25;
	const int dx[] = { 0, 1, 0, -1 };
	const int dy[] = { 1, 0, -1, 0 };

	int dis[10];
	rep(s, n)
	{
		static int d[1024][1024];
		rep(i, h)
			rep(j, w)
			d[i][j] = INF;
		int sx = px[s], sy = py[s];
		int gx = px[s + 1], gy = py[s + 1];

		queue<pint> q;
		d[sy][sx] = 0;
		q.push(pint(sx, sy));
		while (!q.empty())
		{
			pint t = q.front(); q.pop();
			int x = t.first, y = t.second;

			int next = d[y][x] + 1;
			rep(i, 4)
			{
				int tx = x + dx[i], ty = y + dy[i];
				if (0 <= tx && tx < w && 0 <= ty && ty < h
					&& c[ty][tx] != 'X' && next < d[ty][tx])
				{
					d[ty][tx] = next;
					q.push(pint(tx, ty));
					if (tx == gx && ty == gy)
					{
						q = queue<pint>();
						break;
					}
				}
			}
		}
		dis[s] = d[gy][gx];
	}
	printf("%d\n", accumulate(dis, dis + n, 0));
}

Measured memory_bytes: 5900
#include <stdio.h>
#include <stdlib.h>

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

    int a[n], b[n], c[m], d[m];

    for (int i = 0; i < n; ++i) {
        scanf("%d %d", &a[i], &b[i]);
    }

    for (int i = 0; i < m; ++i) {
        scanf("%d %d", &c[i], &d[i]);
    }

    for (int i = 0; i < n; ++i) {
        int smallest = 0, distance[50] = {};

        for (int j = 0; j < m; ++j) {
            distance[j] = abs(a[i] - c[j]) + abs(b[i] - d[j]);
        }

        for (int j = 1; j < m; ++j) {
            if (distance[j] < distance[smallest]) {
                smallest = j;
            }
        }

        printf("%d\n", smallest + 1);
    }
    return 0;
}

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

int p[100001];

struct node{
	int x, y, id;
}nodes[100001];

struct edge{
	int u, v, cost;
}mst[100001];

int find(int u){
	if(p[u] == u)
		return p[u];
	else 
		return p[u] = find(p[u]);
}

bool cmp1(node &a, node &b){
	return a.x < b.x;
}

bool cmp2(node &a, node &b){
	return a.y < b.y;
}

bool cmp3(edge &a, edge &b){
	return a.cost < b.cost;
}

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n, k = 0;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> nodes[i].x >> nodes[i].y;
		nodes[i].id = i;
	}
	
	sort(nodes + 1, nodes + 1 + n, cmp1);
	
	for(int i = 1; i <= n - 1; i++) {
		mst[k].u = nodes[i].id;
		mst[k].v = nodes[i+1].id;
		mst[k].cost = abs(nodes[i].x - nodes[i+1].x);
		k++;
	}
	
	sort(nodes + 1, nodes + 1 + n, cmp2);
	
	for(int i = 1; i <= n - 1; i++) {
		mst[k].u = nodes[i].id;
		mst[k].v = nodes[i+1].id;
		mst[k].cost = abs(nodes[i].y - nodes[i+1].y);
		k++;
	}
	
	sort(mst, mst + k, cmp3);
	
	for(int i = 0; i <= n; i++)
		p[i]=i;
		
	long long ans=0;
	for(int i = 0; i < k; i++) {
		int a = mst[i].u, b = mst[i].v;
		a = find(a), b = find(b);
		if(a != b) {
			ans += mst[i].cost;
			p[a] = b;
		}
	}
	
	cout << ans;
}

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

int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	map<char, ll> cnt;
	for(ll i='a';i<='z';i++)
		cnt[i]=0;
	string s;
	cin >> s;
	for(const auto& i:s)
		cnt[i]++;
	bool find = false;
	for(const auto& i:cnt){
		if(!i.second){
			cout << i.first << "\n";
			find = true;
			break;
		}
	}
	if(!find) cout << "None\n";
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define INF 100000000
using namespace std;

int main()
{
	int N, Ma, Mb;
	cin >> N >> Ma >> Mb;
	vector<int> a(N), b(N), c(N);
	vector<vector<int>> dp(401, vector<int>(401, INF));
	dp[0][0] = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i] >> c[i];
		for (int j = 400  - a[i]; j >= 0; j--) {
			for (int k = 400 - b[i]; k >= 0; k--) {
				if (dp[j][k] != INF) {
					dp[j + a[i]][k + b[i]] = min(dp[j + a[i]][k + b[i]], dp[j][k] + c[i]);
				}
			}
		}
	}
	int res = INF;
	for (int i = 1; max(i * Ma, i * Mb) <= 400; i++) {
		res = min(res, dp[i * Ma][i * Mb]);
	}
	cout << (res == INF ? -1 : res) << endl;
	return 0;
}


Measured memory_bytes: 896
using System;

namespace StableSort
{
	struct Card {
		public char suit_type;
		public int number;
		public int ternAppear;

		public Card(char type, int num, int tern) {
			suit_type = type;
			number = num;
			ternAppear = tern;
		}

		public Card(Card card) {
			suit_type = card.suit_type;
			number = card.number;
			ternAppear = card.ternAppear;
		}

	};

	class MainClass
	{
		public static void trace(ref Card[] arr) {
			for (int i = 0; i < arr.Length; ++i) {
				if (i > 0)
					Console.Write (" ");
				Console.Write (arr[i].suit_type.ToString() + arr[i].number.ToString());
			}
			Console.WriteLine ();
		}

		public static bool isStable(ref Card[] bubble, ref Card[] selection) {
			for (int i = 0; i < bubble.Length; ++i) {
				if (bubble [i].suit_type != selection [i].suit_type)
					return false;
			}
			return true;
		}

		public static void Main (string[] args)
		{
			int n = int.Parse (Console.ReadLine ());
			string[] cards = (Console.ReadLine ()).Split (' ');
			Card[] arr = new Card[n];
			for (int i = 0; i < n; ++i) {
				
				// ??????????????±????¨????
				char[] cardChars = cards [i].ToCharArray ();
				arr [i] = new Card (cardChars[0], int.Parse (cardChars [1].ToString()), i);

			}
				
			stableSort (arr);

		}

		public static void stableSort(Card[] arr) {

			Card[] arr2 = new Card[arr.Length];
			for (int i = 0; i < arr.Length; ++i) {
				arr2[i] = new Card (arr [i]);
			}

			// ??????????????????
			bubbleSort(ref arr);
			Console.WriteLine ("Stable");

			// ???????????????
			selectionSort(ref arr2);
			Console.WriteLine (isStable (ref arr, ref arr2) ? "Stable" : "Not stable");

		}

		public static void bubbleSort(ref Card[] arr) {
			int numSwap = 0;
			bool isDone = false;
			while (!isDone) {
				isDone = true;
				for (int i = arr.Length - 1; i > 0; --i) {
					if (arr [i].number < arr [i - 1].number) {
						Card tmp = arr [i - 1];
						arr [i - 1] = arr [i];
						arr [i] = tmp;
						isDone = false;
						++numSwap;
					} 
					/*
					else if (arr [i].number == arr [i - 1].number) {
						if (arr [i].ternAppear < arr [i - 1].ternAppear) {
							Card tmp = arr [i - 1];
							arr [i - 1] = arr [i];
							arr [i] = tmp;
							isDone = false;
							++numSwap;
						}
					}
					*/
				}
			}

			trace (ref arr);

		}

		public static void selectionSort(ref Card[] arr) {

			int numSwap = 0;
			for (int i = 0; i < arr.Length; ++i) {
				int minj = i;
				for (int j = i; j < arr.Length; ++j) {
					if (arr [j].number < arr [minj].number) {
						minj = j;
					}
					/*
					else if (arr [j].number == arr [minj].number &&
						arr[j].ternAppear > arr[minj].ternAppear) {
						minj = j;
					}
					*/
				}

				if (i != minj) {
					Card tmp = arr [i];
					arr [i] = arr [minj];
					arr [minj] = tmp;
					++numSwap;
				}
			}

			trace (ref arr);

		}

	}
}

Measured memory_bytes: 9140
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

const ll MAX_V = 100000;
struct edge {long long to, cap, rev; };  // 行き先、容量、逆辺

vector<edge> G[MAX_V];  // 隣接リスト
bool used[MAX_V];  // すでに訪問済みかのフラグ

// fromからtoへの容量capの辺をグラフに追加する
void add_edge(long long from, long long to, long long cap) {
    G[from].push_back((edge){to, cap, (ll)G[to].size()});
    G[to].push_back((edge){from, 0, (ll)(G[from].size()-1)});
}

// DFSで増加パスを探索
long long dfs(long long v, long long t, long long f) {
    if (v == t) return f;
    used[v] = true;
    for (int i=0; i<G[v].size(); i++) {
        edge &e = G[v][i];
        if (!used[e.to] && e.cap > 0) {
            long long d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

// sからtへの最大流を求める
long long max_flow(long long s, long long t) {
    long long flow = 0;
    for (;;) {
        REP(i, MAX_V) used[i] = false;
        long long f = dfs(s, t, HIGHINF);
        if (f == 0) return flow;
        flow += f;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll vn, en; cin >> vn >> en;
    REP(i, en) {
        ll u, v, c; cin >> u >> v >> c;
        add_edge(u, v, c);
    }
    cout << max_flow(0, vn-1) << '\n';
    return 0;
}



Measured memory_bytes: 5688
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int a[n];
    int sum=0;
    for(int i=0;i<n;i++)
        cin>>a[i],sum+=a[i];
    sort(a,a+n);
    double thr=sum/((4.0)*m);
    if(a[n-m]>=thr)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

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

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int pref[n];
    for(int i=0; i<n; i++)
    {
        pref[i] = (s[i] == 'R');
        if(i)
        {
            pref[i] += pref[i-1];
        }
    }
    int mn = 200000;
    if(pref[n-1] == 0)
    {
        mn = 0;
    }

    for(int i=0; i<pref[n-1]; i++)
    {
        mn = min(mn, pref[n-1] - pref[i]);
    }

    cout << mn;
    return 0;
}


Measured memory_bytes: 4516
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

template <typename T>
T powint(T a, ll n) {
    T ret = 1;
    while (n > 0) {
        if (n & 1) ret *= a; 
        a *= a;
        n >>= 1;
    }
    return ret;
}

template <ll mod>
class ModInt {
private:
    ll num;
public:
    ModInt() {};
    ModInt(ll n) { num = n % mod; }
    ModInt inv() const { return powint(*this, mod-2); }
    explicit operator ll() const { return num; }

    ModInt& operator+=(const ModInt& a) {
        num += a.num; 
        if (num >= mod) num -= mod; 
        return *this;
    }
    ModInt& operator-=(const ModInt& a) {
        if (num < a.num) num += mod;
        num -= a.num;
        return *this;
    }
    ModInt& operator*=(const ModInt& a) {
        num = num * a.num % mod;
        return *this;
    }
    ModInt& operator/=(const ModInt& a) { return *this *= a.inv(); }
    friend ModInt operator+(const ModInt& a, const ModInt& b) { return ModInt(a) += b; }
    friend ModInt operator-(const ModInt& a, const ModInt& b) { return ModInt(a) -= b; }
    friend ModInt operator*(const ModInt& a, const ModInt& b) { return ModInt(a) *= b; }
    friend ModInt operator/(const ModInt& a, const ModInt& b) { return ModInt(a) /= b; }

    friend ostream& operator<<(ostream& os, const ModInt& a) { return os << a.num; }
    friend istream& operator>>(istream& is, ModInt& a) {
        ll tmp;
        is >> tmp;
        a.num = tmp % mod;
        return is;
    }
};
using mint = ModInt<1000000007>;
//using mint = ModInt<998244353>;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (auto &e: a) cin >> e;

    const int m = 60;
    vector<int> cnt(m, 0);
    for (auto e: a) {
        for (int i = 0; i < m; ++i) {
            if ((e >> i) & 1) cnt[i]++;
        }
    }

    mint sum = 0;
    for (auto e: a) sum += (mint)e * (n-1);

    mint t = 0;
    for (auto e: a) {
        mint base = 1;
        for (int i = 0; i < m; ++i) {
            if ((e >> i) & 1) {
                t += base * 2 * (cnt[i]-1);
            }
            base *= 2;
        }
    }

    cout << sum-t/2 << endl;

    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x)   cerr<<#x<<": "<<x<<endl;
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
typedef long long int ll;
using namespace std;


const ll mod = 1e9+7;
const double eps = 1e-9;


vector<int>cost,value;
int h , n;
int dp[10001][1002]; 

int recur(int ind,int w) {
    if(ind==0&&w>0)return 1e9;
    else if(ind>=0&&w<=0)return 0;

    if(dp[w][ind]!=-1)return dp[w][ind];

    int first=recur(ind,w-cost[ind-1])+value[ind-1];
    int second=recur(ind-1,w);
    return dp[w][ind]=min(first,second);
}

void show(int a,int b){
    for(int i=0;i<=a;i++) {
        for(int j=0;j<=b;++j) {
            cout<<dp[i][j]<<"  ";
        }
        cout<<endl;
    }
}

void solve(){
    cin>>h>>n;
    cost.resize(n+1);
    value.resize(n+1);
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++) {
        cin>>cost[i]>>value[i];
    }
    cout<<recur(n,h)<<endl;
}


void sec() {
    int n,k;
    cin>>n>>k;
    vector<ll>arr(n);
    for(int i=0;i<n;i++){ 
        cin>>arr[i]; 
    }
    sort(all(arr));
    if(k>=n) {
        cout<<0;
        return;
    }
    ll tt=0;
    for(int i=0;i<(n-k);i++) {
        tt+=arr[i];
    }
    cout<<tt;
}



int main(){
    fastio
    int test=1;
    while(test--)
        sec();
    return 0;
}


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

using namespace std;

int main(){
  long long H;
  cin >> H;
  long long d = 1;
  while(H > 1){
    d++;
    H >>= 1;
  }
  
  cout << (1ll << d) - 1 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  
  cin >> N;
  
  if (N % 1111 % 111 <= 1) {
    cout << "Yes" << endl;
  }
  else if (N / 11 % 101 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
#define lint long long int
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
*/

lint fact(lint n) {
	if (n == 0) return 1;
	else return n * fact(n - 1);
}

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

	lint sumb = 0;
	for (int i = 0; i < N+1; i++) {
		sumb += A[i];
	}
	cout << suma- sumb << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <stack>
#include <limits>
#include <climits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>
#include <set>
#include <array>

using namespace std;

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

#define inf 0x3f3f3f3f
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second
#define SETUP cin.tie(0), ios::sync_with_stdio(false), cout << setprecision(15)

namespace {
	struct input_returnner {
		int N; input_returnner(int N_ = 0) :N(N_) {}
		template<typename T> operator vector<T>() const { vector<T> res(N); for (auto &a : res) cin >> a; return std::move(res); }
		template<typename T> operator T() const { T res; cin >> res; return res; }
		template<typename T> T operator - (T right) { return T(input_returnner()) - right; }
		template<typename T> T operator + (T right) { return T(input_returnner()) + right; }
		template<typename T> T operator * (T right) { return T(input_returnner()) * right; }
		template<typename T> T operator / (T right) { return T(input_returnner()) / right; }
		template<typename T> T operator << (T right) { return T(input_returnner()) << right; }
		template<typename T> T operator >> (T right) { return T(input_returnner()) >> right; }
	};
	template<typename T> input_returnner in() { return in<T>(); }
	input_returnner in() { return input_returnner(); }
	input_returnner in(int N) { return std::move(input_returnner(N)); }
}

void solve();
/// ---template---

signed main(void) {
	SETUP;
	solve();
	return 0;
}

bool ok(const vector<int>& muv, int v) {
	vector<bool> mub(muv.size());
	FOR(i, 0, muv.size()) mub[i] = (muv[i] >= v);
	int mid = mub.size() / 2;
	int d = mub.size()-1;
	FOR(i, mid, mub.size()-1) {
		if (mub[i] == mub[i + 1]) {
			d = i;
			break;
		}
	}
	RFOR(i, 1, mid+1) {
		if (mub[i] == mub[i - 1]) {
			d = (d - mid >  mid - i ? i : d);
			break;
		}
	}
	return mub[d];
}


void solve() {
	int N = in();
	vector<int> A = in(2*N-1);
	int l = 1, h = 2*N;
	while (h - l > 1) {
		int mid = (h + l) / 2;
		if (ok(A, mid)) l = mid;
		else h = mid;
	}
	cout << l << endl;
}

Measured memory_bytes: 1152
import java.util.*;

public class Main{
    public static void main(String[] args){
        /*
        List<Integer> list = new ArrayList<>();
        int input_int_number;
        int cnt=0;
        Scanner sc = new Scanner(System.in);
        input_int_number = sc.nextInt(); 
        list.add(input_int_number);
        }
        for(Integer num :list){
            cnt++;
            System.out.println("Case "+cnt+": "+num);
        }
        */
        int input_int_number;
        int cnt=0;
        Scanner sc = new Scanner(System.in);
        while((input_int_number=sc.nextInt())!=0){
            cnt++;
            System.out.println("Case "+cnt+": "+input_int_number);
        }
    }
}


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

typedef vector<int> vi;
typedef pair<int, int> pi;

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define pb push_back
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); ++i)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

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

    string ans = "No";
    REP2(i, 1, 9) {
        if (N % i == 0 && N / i <= 9) {
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
A = [int(i) for i in input().split()]

def gcd(a,b):
    if a%b==0:
        return(b)
    else:
        return(gcd(b,a%b))
    
gcd_num = A[0]
for a in A:
    gcd_num = gcd(a,gcd_num)
    
if K%gcd_num==0 and K<=max(A):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 14252
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <cstdio>
#include<iomanip>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  double a;
  cin >> a;
  cout << 2.0*3.141592*a;
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
//配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 3788
package main

import (
	"fmt"
	"sort"
)

func main() {

	var N, K int
	fmt.Scanf("%d %d", &N, &K)

	p := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &p[i])
	}

	sum := 0
	sort.Ints(p)
	for i := 0; i < K; i++ {
		sum += p[i]
	}

	fmt.Println(sum)
}

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

long long func(long long H) {
	if(H == 1) return 1;
	else return 2 * func(H/2) + 1;
}

int main() {
	long long H; cin >> H;
	cout << func(H) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#if ONLINE_JUDGE
    #define DEBUG false
#else
    #define DEBUG true
#endif
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define forlist(i, vec) for(auto &&i : vec)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x) cerr << #x << ": " << (x) << endl
using namespace std;
typedef long long LL;
typedef long long int64;
typedef std::vector<int> VI;
typedef std::vector<VI> VVI;
typedef std::vector<LL> VL;
typedef std::vector<VL> VVL;
typedef std::vector<std::string> VS;
typedef std::pair<int, int> PII;
typedef std::pair<LL, LL> PLL;
typedef std::queue<int> QI;
typedef std::priority_queue<int> PQI;
template<class T,class U>inline bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>inline bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>inline void vcinpb(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}
template<class T>inline void dumpv(T &v){
    if(!DEBUG)return;cout<<"{";rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1)?",":"}";}cout<<endl;
}

const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;
// M_PI 3.1415...

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cill(n);
    cill(k);
    LL ans=0;
    VL v(n+2);
    rep(i, k){
        cill(d);
        rep(j, d){
            cill(a);
            v[a-1]++;
        }
    }
    rep(i, n){
        if (v[i]==0){
            ans++;
        }
    }
    co(ans);
    return 0;
}

Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    private const int MOD_N = 1000000000 + 7;

    public static void Main()
    {
        var list = Console.ReadLine().Split(' ');
        var n = int.Parse(list[0]);
        var k = int.Parse(list[1]);

        var list2 = Console.ReadLine().Split(' ');
        var vs = new int[n];
        for (int i = 0; i < vs.Length; ++i)
            vs[i] = int.Parse(list2[i]);

        var ans = 0;

        var hands = new int[n];
        for (int i = 0; i < k; ++i)
        {
            var t = k - i;
            var min = Math.Min(t, n);
            for (int l = min; l >= 0; --l)
            {
                var r = min - l;
                Array.Copy(vs, hands, l);
                Array.Copy(vs, vs.Length - r, hands, l, r);

                for (int j = min; j < hands.Length; ++j)
                    hands[j] = 0;

                Array.Sort(hands);
 
                int total = 0;
                for (int j = 0; j < hands.Length; ++j)
                {
                    var v = hands[j];
                    if (v < 0)
                    {
                        if (j < i)
                            v = 0;
                    }
                    total += v;
                }

                if (ans < total)
                    ans = total;
            }
        }

        Console.WriteLine(ans);
    }

    private static int Comb(int m, int n)
    {
        var t = m - n;
        if (n > t)
            n = t;

        long numerator = 1;
        for (int i = 0; i < n; ++i)
        {
            numerator *= m - i;
            numerator %= MOD_N;
        }
        long denominator = 1;
        for (; n != 0; --n)
        {
            denominator *= n;
            denominator %= MOD_N;
        }

        var inv_denominator = ModInv((int)denominator, MOD_N);
        var ret = (int)(numerator * inv_denominator % MOD_N);

        return ret >= 0 ? ret : ret + MOD_N;
    }

    private static int ModInv(int a, int m)
    {
        int b = m, x = 1, y = 0;
        while (b != 0)
        {
            var t = a / b;
            a -= t * b;
            Swap(ref a, ref b);
            x -= t * y;
            Swap(ref x, ref y);
        }
        x %= m;
        return x >= 0 ? x : x + m;
    }

    private static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
}


Measured memory_bytes: 13140
from collections import Counter, deque, OrderedDict, defaultdict
# from copy import copy, deepcopy # pythonのみ．copyは1次元，deepcopyは多次元．
# from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    n, m = map(int, input().split())
    A = list(map(int, input().split()))

    from itertools import accumulate

    B = [0] + A
    B = list(accumulate(B))

    for i in range(n+1):
        B[i] %= m

    BB = Counter(B)
    ans = 0

    for v in BB.values():
        ans += v*(v-1)//2

    print(ans)


resolve()

Measured memory_bytes: 100220
#include <math.h>
#include <stdio.h>
typedef long long ll;
int main() {
	ll s;
	int x1, x2, x3, y1, y2, y3;
	scanf("%lld", &s);
	x3 = y3 = 0;
	if (s == (ll)1e18) {
		x1 = y2 = 0;
		y1 = x2 = (int)1e9;
	} else {
		y1 = 1;
		x2 = (int)1e9 - s % (int)1e9;
		x1 = (int)1e9;
		y2 = (s + x2) / (int)1e9;
	}
	printf("%d %d %d %d %d %d\n", x1, y1, x2, y2, x3, y3);
	// printf("%lld\n", llabs((ll)x1 * y2 - (ll)x2 * y1));
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
  char a[202],b[101];
  scanf("%s%s",a,b);
  strcat(a,b);
  int i;
  int len=strlen(a);
  for(i=0;i<len;i++){
    a[i]=a[i]-'0';
    //printf("%d\n",a[i]);
  }
  int num=1;
  for(i=0;i<len-1;i++){
    num=num*10;
  }
  //printf("%d\n",num);
  int sum=0;
  for(i=0;i<len;i++){
    sum+=a[i]*num;
    num=num/10;
  }
  //printf("%d\n",sum);
  int c =(int)sqrt((double)sum);
  //printf("%d\n",c);
  if(c*c==sum){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll h,w;
ll direction2[4][2]={{1,0},{0,1},{0,-1},{-1,0}};
bool valid(int a,int b)
{
    if(a>=1&&a<=h&&b>=1&&b<=w)return true;
    else return false;
}

int main()
{
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    string s;
    cin>>s;
    ll k,y=0;
    cin>>k;vector<string>v,v2;

    ll x=0;map<string,ll>m;
    for(int i=min((ll)s.size(),5ll);i>=1;i--){
        for(int j=1;j<=s.size()-i+1;j++){
            if(m[s.substr(j-1,i)]!=1){x++;m[s.substr(j-1,i)]=1;v.push_back(s.substr(j-1,i));}
        }
    }
    sort(v.begin(),v.end());
    //for(auto i:v)cout<<i<<endl;
    cout<<v[k-1];return 0;
}


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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll HIGHINF = (ll)1e18;
const ll LOWINF = (ll)1e15;
const long double PI = 3.1415926535897932384626433;

template<typename T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template<typename... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	int N; cin >> N;
	V<int> a(N),b(N);
	for(int i = 0; i < N; ++i) {
		int p; cin >> p;
		p--;
		a[p] = i+1;
	}
	for(int i = 0; i < N; ++i){
		a[i] += (i+1)*30000;
		b[i] += (N-i)*30000; 
	}
	for(int i = 0; i < N; ++i) cout << a[i] << " "; cout << endl;
	for(int i = 0; i < N; ++i) cout << b[i] << " "; cout << endl;
	
    return 0;
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	long long a[n];
	long long ans = 0;
	for(int i=0; i<n; i++) cin >> a[i];
	for(int i=0; i<n-1; i++) {
		if(a[i]%2) {
			if(a[i+1]>0) {
				a[i+1]--;
				ans++;
			}
		}
		ans += a[i]/2;
	}
	ans += a[n-1]/2;
	cout << ans << endl;
	return 0;
}

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


class Node {
public:
	Node():number(i++), order(0), min(0), depth(-1), edges(0), parent(nullptr), uft(nullptr) {}
	bool rearch() const { return depth >= 0; }
	void close() {
		uft = parent;
	}
	Node* get_union() {
		if (uft) {
			return uft = uft->get_union();
		}
		else {
			return this;
		}
	}
	static int i;
	int number, order, min, depth;
	std::vector<Node*> edges;
	Node *parent;
	Node *uft;
};
struct Edge {
	Node *from, *to;
	int start, end;
	Edge(Node * const f = nullptr, Node * const t = nullptr, const int &s = 0, const int &e = 0) :from(f), to(t), start(s > e ? e:s), end(s > e? s:e) {};
	Edge &operator=(const Edge &other) { from = other.from; to = other.to; start = other.start; end = other.end; return *this; }
	bool bridge() { return from->get_union()->number != to->get_union()->number; }
	bool operator<(const Edge &other) const { return (start < other.start) || (start == other.start && end < other.end); }
	void show() { std::cout << start << " " << end << "\n"; }
};
int Node::i(0);
int dfs(Node &node, Node* const parent, const int &depth = 0) {
	if (node.rearch()) {
		return node.depth;
	}else{
		node.parent = parent;
		node.depth = depth;
		int min = depth;
		for (auto &e : node.edges) {
			if (e != parent) {
				auto temp = dfs(*e, &node, depth + 1);
				if (min > temp) {
					min = temp;
				}
			}
		}
		node.min = min;
		if (min < depth) {
			node.close();
		}
		return node.min;
	}
}
void sort(std::vector<Edge> &vector, const int &left, const int &right) {
	if (left < right) {
		auto pivot = vector.at(left + (right - left) / 2);
		auto l = left, r = right;
		while (l < r) {
			while (vector.at(l) < pivot)++l;
			while(pivot < vector.at(r))--r;
			if (l < r) {
				auto temp = vector.at(l);
				vector.at(l) = vector.at(r); vector.at(r) = temp;
				++l; --r;
			}
		}
		sort(vector, left, r); sort(vector, r + 1, right);
	}
}
int main() {
	int v, e;
	std::cin >> v >> e;
	std::vector<Edge> edge(0);
	std::vector<Node> node(v);
	for (auto i = 0; i < e; ++i) {
		int s, t;
		std::cin >> s >> t;
		edge.push_back(Edge(&node.at(s), &node.at(t), s, t));
		node.at(s).edges.push_back(&node.at(t));
		node.at(t).edges.push_back(&node.at(s));
	}
	dfs(node.at(0), &node.at(0));
	sort(edge, 0, edge.size() - 1);
	for (auto &e : edge) {
		if (e.bridge()) {
			e.show();
		}
	}
	return 0;
}

Measured memory_bytes: 4708
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
c = 0
N,Y = map(int,input().split())
for i in range(N+1):
    if c == 1:
        break
    for j in range(N-i+1):
        if i * 10000 + j * 5000 + 1000 * (N - i - j) == Y:
            print(i,j,N-i-j)
            c = 1
            break
if c == 0:
    print(-1,-1,-1)






Measured memory_bytes: 3060
//region Template
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "../debug_prettyprint.hpp"
#else
#define debug(...) 42
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#endif
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout<<fixed<<setprecision(12);
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
#define EXIT(answer) { cerr<<"EXIT #"<<__LINE__<<endl; cout<<answer<<endl; exit(0); }
#define sz(v) int(v.size())
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> istream& operator>>(istream& in, pair<T,U> &p) { in>>p.first>>p.second; return in; }
template<typename T> inline vector<T> READ(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T> >;
typedef signed long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
//endregion

const int MOD = 1e9+7;

int main() {
    FASTIO

    int n; cin>>n;
    vi a = READ<int>(n);

    ll sum=0;
    ll ans=0;
    REV(i, n-2, 0) {
        sum += a[i+1];
        sum %= MOD;

        ans += a[i] * sum;
        ans %= MOD;
    }

    cout<<ans<<endl;

}


Measured memory_bytes: 3988
while True:
    a,b,c=input().split()
    a=int(a)
    c=int(c)
    if b == '+':
        print(a + c)
    elif b == '-':
        print(a - c)
    elif b == '*':
        print(a * c)
    elif b == '/':
        print(int(a / c))                                                   
    else:
        break

Measured memory_bytes: 7644