akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

// AtCoder
#include <atcoder/all>
using namespace atcoder;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

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

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, d; cin >> n >> d;
    vector<ll> x(n), y(n);
    rep (i, n) cin >> x[i] >> y[i];

    two_sat ts(n);
    rep (i, n) {
        rep (j, i + 1, n) {
            if (abs(x[i] - x[j]) < d) ts.add_clause(i, false, j, false);
            if (abs(x[i] - y[j]) < d) ts.add_clause(i, false, j, true);
            if (abs(y[i] - x[j]) < d) ts.add_clause(i, true, j, false);
            if (abs(y[i] - y[j]) < d) ts.add_clause(i, true, j, true);
        }
    }
    if (!ts.satisfiable()) {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
    auto ans = ts.answer();
    rep (i, n) {
        cout << (ans[i] ? x[i] : y[i]) << "\n";
    }
    /***************************************************/
    /* Submit this code from the browser if using ACL! */
    /***************************************************/
    return 0;
}

Measured memory_bytes: 3780
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
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;}
signed main(){
	int n,k;
	cin>>n>>k;
	vector<int> a(n);
	rep(i,n) cin>>a[i];
	sort(All(a));
	vector<P> V;
	V.push_back(P(1,a[0]));
	rep(i,1,n){
		if(V.back().second==a[i]) V.back().first++;
		else V.push_back(P(1,a[i]));
	}
	sort(rAll(V));
	int ans=0;
	while(V.size()>k){
		ans+=V.back().first;
		V.pop_back();
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 7024
import collections
n = int(input())
a = list(map(int, input().split())) 
q = int(input())

co = collections.Counter(a)

s = [0]*(q+1)
s[0] = sum(a)

for i in range(0,q):
    b, c = map(int, input().split())
    s[i+1] = s[i] + (c-b)*co[b]
    co[c] = co[b] + co[c]
    co[b] = 0
for i in range(1,q+1):
    print(s[i])

Measured memory_bytes: 26968
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

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

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	var A [3][3]int
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			A[i][j] = sc.nextInt()
		}
	}
	N := sc.nextInt()
	for i := 0; i < N; i++ {
		b := sc.nextInt()
		for k := 0; k < 3; k++ {
			for j := 0; j < 3; j++ {
				if A[k][j] == b {
					A[k][j] = 0
				}
			}
		}
	}
	ok := false
	if A[0][0] == A[0][1] && A[0][1] == A[0][2] {
		ok = true
	}
	if A[1][0] == A[1][1] && A[1][1] == A[1][2] {
		ok = true
	}
	if A[2][0] == A[2][1] && A[2][1] == A[2][2] {
		ok = true
	}
	if A[0][0] == A[1][0] && A[1][0] == A[2][0] {
		ok = true
	}
	if A[0][1] == A[1][1] && A[1][1] == A[2][1] {
		ok = true
	}
	if A[0][2] == A[1][2] && A[1][2] == A[2][2] {
		ok = true
	}
	if A[0][0] == A[1][1] && A[1][1] == A[2][2] {
		ok = true
	}
	if A[0][2] == A[1][1] && A[1][1] == A[2][0] {
		ok = true
	}

	if ok {
		fmt.Fprintln(wtr, "Yes")
	} else {
		fmt.Fprintln(wtr, "No")
	}
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<stack>
#include<queue>
#include<vector>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define F(i,L,R) for(int i=L;i<R;i++)
#define FE(i,L,R) for(int i=L;i<=R;i++)
#define RF(i,l,r) for(int i=r;i>l;i--)
#define RFE(i,l,r) for(int i=r;i>=l;i--)
#define getI(i) scanf("%d",&i)
#define getII(i,j) scanf("%d%d",&i,&j)
#define getIII(i,j,k) scanf("%d%d%d",&i,&j,&k)
#define VgetI(i) int (i);scanf("%d",&(i));
#define VgetII(i,j) int (i),(j);scanf("%d%d",&(i),&(j));
#define VgetIII(i,j,k) int (i),(j),(k);scanf("%d",&(i),&(j),&(k));
#define EoF(n) int(n);while(~getI(n))
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define abs(n) (n>0?n:(-n))
#define INF 2147483647
#define nINF -2147483648
int main(){
	VgetI(n);
	int ans=1;
	while(ans<=n) ans*=2;
	printf("%d\n",ans/2);
}


Measured memory_bytes: 256
/********************************************************************************
	
	Code by a weak man who named CYJian, and he hopes the code can get more points.

	Algorithm: 

 ********************************************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//{{{Fast IO
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }
//}}}

template<typename T> inline void chkmin(T&a, T b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T&a, T b) { a = a > b ? a : b; }

const int mod = 924844033;

inline int fsp(int x, int k = mod - 2) {
	int s = 1;
	while(k) {
		if(k & 1) s = 1LL * s * x % mod;
		x = 1LL * x * x % mod, k >>= 1;
	} return s;
}

int F[2020];
int sz[2020];
int f[2020][2020];

int fac[2020];
int ifac[2020];

inline int C(int n, int m) { return 1LL * fac[n] * ifac[m] % mod * ifac[n - m] % mod; }

int main() {
#ifdef LOCAL
	FILE("");
#endif
	int n = ri, k = ri;
	fac[0] = ifac[0] = 1;
	for(int i = 1; i <= n; i++)
		ifac[i] = fsp(fac[i] = 1LL * i * fac[i - 1] % mod);
	for(int i = 1; i <= n; i++) sz[i] = 1;
	for(int i = n; i > k; i--) sz[i - k] += sz[i];
	int Sz = 0; f[0][0] = 1;
	for(int i = 1; i <= k; i++) {
		int S = sz[i] >> 1;
		for(int j = 0; j <= Sz; j++) {
			for(int k = 0; k <= S; k++) {
				f[i][j + k] = (f[i][j + k] + 1LL * f[i - 1][j] * C(sz[i] - k, k)) % mod;
			}
		} Sz += S;
	}
	for(int i = 0; i <= Sz; ++i)
		for(int j = 0; j <= Sz; ++j)
			F[i + j] = (F[i + j] + 1LL * f[k][i] * f[k][j]) % mod;
	Sz <<= 1;
	int res = 0;
	for(int i = 0; i <= Sz; i++)
		res = (res + 1LL * (i & 1 ? mod - F[i] : F[i]) * fac[n - i]) % mod;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 14336
#include <iostream>

using namespace std;

#define MAX 200000
int A[MAX];
int L[MAX / 2 + 2];
int R[MAX / 2 + 2];
#define INFINITY 2000000000

long long Merge(int A[], int l, int m, int r)
{
	long long count = 0;
	int ll = m - l;
	int rl = r - m;
	for (int i = 0; i < ll; ++i) L[i] = A[l + i];
	for (int i = 0; i < rl; ++i) R[i] = A[m + i];
	L[ll] = INFINITY;
	R[rl] = INFINITY;

	int i = 0;
	int j = 0;
	for (int k = l; k < r; ++k)
	{
		if (L[i] <= R[j])	A[k] = L[i++];
		else
		{
			A[k] = R[j++];
			count += ll - i;// = mid + j - k - 1
		}
	}

	return count;
}

long long MergeSort(int A[], int l, int r)
{
	long long result = 0;
	if (l + 1 < r)
	{
		int m = (l + r) >> 1;
		long long v1 = MergeSort(A, l, m);
		long long v2 = MergeSort(A, m, r);
		long long v3 = Merge(A, l, m, r);

		result = v1 + v2 + v3;
	}

	return result;
}

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

	cout << MergeSort(A, 0, n) << endl;

	return 0;
}


Measured memory_bytes: 4648
import fractions

a,b,c,d=map(int,input().split())

cd_lcm=c*d//fractions.gcd(c,d)

b_count=b-(b//c+b//d-b//cd_lcm)
a_count=a-1-((a-1)//c+(a-1)//d-(a-1)//cd_lcm)

print(b_count-a_count)


Measured memory_bytes: 5048
n=int(input())
# Disadvantages of not reading qn properly in the beginning, all of them must be distinct
if n==3:
    print(2, 5 ,63)
elif n==4:
    print(2 ,5 ,20, 63)
elif n==5:
    print(2,5,20,30,63)
else:
    ans=[]
    k=0
    while len(ans)<n:
        ans.append(6*k+2)
        ans.append(6*k+3)
        ans.append(6*k+4)
        ans.append(6*k+6)
        k+=1
    # print(ans)
    ans=sorted(ans)[:n]
    # print(ans)
    nxt=6*(ans[-1]//6)
    if sum(ans)%6==2:
        ans.remove(8)
        ans.append(nxt+6)
    elif sum(ans)%6==3:
        ans.remove(9)
        ans.append(nxt+6)
    elif sum(ans)%6==5:
        ans.remove(9)
        ans.append(nxt+4)
    print(" ".join(list(map(str,ans))))


Measured memory_bytes: 5204
#include <iostream>
using namespace std;
int main()
{
  long long int n,m,x,c[15],a[15][15],sum[15]={0};
  long long int mi=0,total=0;
  cin>>n>>m>>x;
  bool b[15]={false};
  for(int i=0;i<n;i++){
    cin>>c[i];
    mi+=c[i];
    for(int j=0;j<m;j++){
      cin>>a[i][j];
      sum[j]+=a[i][j];
      if(sum[j]>=x)b[j]=true;
      if(i==n-1&&b[j]!=true){cout<<"-1"<<endl; return 0;}
    }
  }
  
  for(int bit=0;bit<(1<<n);bit++){
    bool b[15]={false},cc=true;
    long long int sum[15]={0};
    total=0;
    for(int i=0;i<n;i++){
      if(bit&(1<<i)){
        total+=c[i];
        for(int j=0;j<m;j++){
          sum[j]+=a[i][j];
        }
      }
      for(int j=0;j<m;j++){
        if(sum[j]>=x)b[j]=true;
        if(i==n-1&&b[j]!=true)cc=false;
      }
    }
    if(cc){mi=min(mi,total);}
  }
  cout<<mi<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;

	vector<int> A;
	A.push_back(A1);
	A.push_back(A2);
	A.push_back(A3);
	
	sort(A.begin(), A.end());

	cout << abs(A[1] - A[0]) + abs(A[2] - A[1]) << endl;
	
}


Measured memory_bytes: 3624
N, K=map(int, input().split())
if K>(N-1)*(N-2)//2:
    print("-1")
    exit(0)
l=[]
for i in range(2,N+1):
    l.append((1,i))
s=(N-1)*(N-2)//2-K

a=2
b=3

for i in range(s):
    l.append((a,b))
    if b+1<=N:
        b+=1
    else:
        a+=1
        b=a+1
print(len(l))
for i in range(len(l)):
    print(l[i][0], l[i][1])

Measured memory_bytes: 3992
import Data.List
import Control.Applicative

main :: IO ()
main = do
    n <- readLn
    xs <- map read . words <$> getLine
    print $ solve n (flat xs)

flat :: [Int] -> [Int]
flat = zipWith (flip (-)) [1..]

solve :: Int -> [Int] -> Int
solve n xs
    | even n = min (sad' (ys !! (n `div` 2))) (sad' (ys !! (n `div` 2-1)))
    | odd n  = sad' (ys !! ((n-1) `div` 2))
        where ys = sort xs
              sad' = sad xs

sad :: [Int] -> Int -> Int
sad xs b = foldr (\x acc -> acc + abs (x-b)) 0 xs


Measured memory_bytes: 159100
import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = in.i();
        int[] a = in.ii(N);
        int b = 0;
        for (int i = 0; i < N; i++) {
            b ^= a[i];
        }
        for (int i = 0; i < N; i++) {
            out.print(a[i] ^ b);
            out.print(' ');
        }
        out.close();
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 47512
N = gets.to_i
A = gets.split.map(&:to_i)

def dfs(i, j, dp)
  return dp[i][j] if dp[i][j]
  return dp[i][j] = 0 if i == j
  if (N - (j - i)).even?
    a = dfs(i + 1, j, dp) + A[i]
    b = dfs(i, j - 1, dp) + A[j - 1]
    dp[i][j] = a > b ? a : b
  else
    a = dfs(i + 1, j, dp) - A[i]
    b = dfs(i, j - 1, dp) - A[j - 1]
    dp[i][j] = a < b ? a : b
  end
end
dp = Array.new(N + 1) { Array.new(N + 1, nil) }
ans = dfs(0, N, dp)
puts ans

Measured memory_bytes: 74748
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main()
{
	int seiribangou;
	cin >> seiribangou;
	int a,b,c,d;
	d = seiribangou % 10;
	seiribangou /= 10;
	c = seiribangou % 10;
	seiribangou /= 10;
	b = seiribangou % 10;
	a = seiribangou / 10;

	if(a+b+c+d == 7){
		cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
	}else if(a+b+c-d == 7){
		cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
	}else if(a+b-c+d == 7){
		cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
	}else if(a-b+c+d == 7){
		cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
	}else if(a+b-c-d == 7){
		cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
	}else if(a-b+c-d == 7){
		cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
	}else if(a-b-c+d == 7){
		cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
	}else if(a-b-c-d == 7){
		cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
	}

	return 0;
}


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

const int N = 1e5 + 5;

int n;
int a[N], b[N];

void quitif(boolean condition, const char* vert = "No") {
	if (condition) {
		puts(vert);
		exit(0);
	}
}

boolean check(int x, int y) {
	b[0] = x, b[1] = y;
	for (int i = 2; i < n; i++)
		b[i] = b[i - 1] ^ b[i - 2];
	if (b[n - 2] ^ b[n - 1] ^ x)
		return false;
	if (b[n - 1] ^ b[0] ^ y)
		return false;
	sort(b, b + n);
	for (int i = 0; i < n; i++)
		if (b[i] ^ a[i])
			return false;
	return true;
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", a + i);
	}
	sort(a, a + n);
	int cnt = 1;
	for (int i = 1; i < n; i++) {
		cnt += (a[i] != a[i - 1]);
	}
	quitif(cnt > 3);
	if (cnt == 1) {
		if (check(0, 0)) {
			puts("Yes");
		} else {
			puts("No");
		}
	} else if (cnt == 2) {
		if (check(a[0], a[n - 1])) {
			puts("Yes");
		} else {
			puts("No");
		}
	} else {
		vector<int> qaq {a[0]};
		for (int i = 1; i < n; i++) {
			if (a[i] ^ a[i - 1]) {
				qaq.push_back(a[i]);
			}
		}
		if (check(qaq[0], qaq[1]) || check(qaq[0], qaq[2]) || check(qaq[1], qaq[2])) {
			puts("Yes");
		} else {
			puts("No");
		}
	}
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    double L;
    cin >> L;

    double ans = (L*L*L)/27;
    printf("%.10f\n",ans);
    return 0;
}

Measured memory_bytes: 256
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
L = list(map(int, input().split()))
L.sort()
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if L[i] + L[j] > L[k] and L[i] != L[j] and L[i] != L[k] and L[j] != L[k]:
                ans += 1
print(ans)

Measured memory_bytes: 9524
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=0;i<N;i++)

signed main(){
  int A,B,C;
  cin>>A>>B>>C;
  int X,Y,Z;
  X=B;
  Y=A;
  Z=X;
  X=C;
  cout<<X<<" "<<Y<<" "<<Z<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
         
#define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define ll long long
#define ld long double
#define vll vector<ll>
#define infl LONG_LONG_MAX
#define infd LDBL_MAX
#define F first
#define S second
#define pll pair<ll,ll> 
#define G(a,b) get<a>(b)
#define ALL(v) v.begin(),v.end()
#define MP make_pair
#define MT make_tuple
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b) for(ll i=(b-1);i>=a;i--)    
#define endl "\n"
#define nl cout<<"\n";
#define pr(x) cout<<x;
#define pr1(x) cout<<x<<" ";
#define pr2(x,y) cout<<x<<" "<<y;
#define sz(x) (ll)x.size() 
#define ara cout<<"ara-ara\n"; 
 


void func()
{
   ll n;
   cin>>n;
   ll arr[n+1];
   ll ans=0;
   f(i,1,n+1)
   {
     cin>>arr[i];
     if(i%2!=0 && arr[i]%2!=0) ans++;
   }
   cout<<ans<<endl;
}   
     
     
     
int main() 
{
    fast
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif // ONLINE_JUDGE
        
     
    ll ntc=1;
    //cin>>ntc;
     
    f(i,1,ntc+1)
    {
      //cout<<"Case #"<<i<<": ";
       func();
    }
     
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int>a(9);
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        if(k>=3200)a[8]++;
        else{a[k/400]++;}
    }
    int cnt=0;
    for(int i=0;i<8;i++){
        if(a[i]>0)cnt++;
    }
    if(cnt!=0)cout<<cnt<<" "<<cnt+a[8]<<endl;
    else cout<<1<<" "<<cnt+a[8]<<endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  cin>>n;
  vector<tuple<ll,ll,ll>> abc(n);
  rep(i,n) {
    int a,b;
    cin>>a>>b;
    abc[i]=make_tuple(a+b,a,b);
  }
  sort(abc.begin(),abc.end());
  reverse(abc.begin(),abc.end());
  ll sa=0;
  ll sb=0;
  rep(i,n) {
    ll a,b,c;
    tie(c,a,b)=abc[i];
    if(i%2==0) {
      sa+=a;
    } else {
      sb+=b;
    }
  }
  cout << sa - sb << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

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

const int mod = 2019;

int main(){
    int n, m; cin >> n >> m;
    string ans; if(n==1) ans = "0"; else if(n==2) ans = "10"; else ans = "100";

    int count1 = true;
    string count2 = "000";
    rep(i,m){
        int a; char b; cin >> a >> b; a--;
      	if(n>=2 && a==0 && b=='0'){
        	count1 = false; break;
      	}else if(count2[a] == '0'){
            ans[a] = b;
            count2[a] = '1';
        }else if(ans[a] != b){
            count1 = false;
            break;
        }
    }
    if(count1) cout << ans << endl;
    else cout << -1 << endl;
}



Measured memory_bytes: 3604
n,*xy=map(int,open(0).read().split())
x=[[xx,i] for i,xx in enumerate(xy[::2])]
y=[[yy,i] for i,yy in enumerate(xy[1::2])]
x.sort()
y.sort()
px=[[x1-x0,i0,i1] for (x0,i0),(x1,i1) in zip(x,x[1:])]
py=[[y1-y0,i0,i1] for (y0,i0),(y1,i1) in zip(y,y[1:])]
p=px+py
x=[]
y=[]
px=[]
py=[]
p.sort()
r=[i for i in range(n)]
rank=[1 for i in range(n)]
def root(x):
  if x==r[x]:
    return x
  else:
    r[x]=root(r[x])
    return r[x]
def union(path):
  rx=root(path[1])
  ry=root(path[2])
  if rx==ry:
    return 0
  else:
    if rank[rx]>rank[ry]:
      r[rx]=ry
      rank[rx]+=rank[ry]
    else:
      r[ry]=rx
      rank[ry]+=rank[rx]
    return path[0]
ans=0
for i in range(len(p)):
  ans+=union(p[i])
print(ans)

Measured memory_bytes: 69088
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int n, c, h, a ;
    cin >> h >> n ;
    c = 0 ;
    
    for ( int i = 0 ; i < n ; i++ )
    {
        
        cin >> a ;
        h = h - a ;
        
    }
    
    if ( h > 0 )
    {
        
        cout << "No" ;
        
    }
    
    else
    {
        
        cout << "Yes" ;
        
    }

    return 0;
}


Measured memory_bytes: 256
# 49

v, e = map(int, input().split())
n_l = [[float("Inf")] * v for y in range(v)]
for i in range(e):
    _s, _t, _d = map(int, input().split())
    n_l[_s][_t] = _d

ans = float("Inf")
dp = [[float("Inf")] * v for y in range(2**v)]
dp[1][0] = 0
for s in range(2**v):
    for i in range(v):
        if not((s>>i) & 1):
            continue
        _s = s & ~(1<<i)
        for j in range(v):
            if (_s>>j) & 1:
                dp[s][i] = min(dp[s][i], dp[_s][j] + n_l[j][i])

for i in range(v):
    ans = min(ans, dp[2**v-1][i] + n_l[i][0])
                
if ans != float("Inf"):
    print(ans)
else:
    print("-1")
                    
            



Measured memory_bytes: 16232
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long a = n;
		StringBuilder org = new StringBuilder();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < 32; i++) {
		    org.append(a % 2);
		    sb.append((a % 2 + 1) % 2);
		    a /= 2;
		}
		System.out.println(org.reverse());
		System.out.println(sb.reverse());
		sb = new StringBuilder();
		for (int i = 0; i < 32; i++) {
		    sb.append(n % 2);
		    n /= 2;
		}
		sb.append(0);
		sb.reverse();
		sb.append(0);
		System.out.println(sb.substring(2));
		System.out.println(sb.substring(0, 32));
	}
}



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

int main(void) {
  int N, K;
  cin >> N >> K;
  vector<long long> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  sort(H.begin(), H.end());
  long long ans = 0;
  for (int i = 0; i < N - K; i++) {
    ans += H[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a)), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

ll gcd(ll a, ll b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}

void solve() {
  ll N, K; cin >> N >> K;
  N %= K;
  outl(min(N, K - N));
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    string S[4] = {"AC", "WA", "TLE", "RE"};
    int C[4]; F0R(i, 4) C[i] = 0;
    F0R(i, N) {
        string X; cin >> X;
        F0R(j, 4) {
            if (X == S[j]) C[j]++;
        }
    }
    F0R(i, 4) {
        cout << S[i] << " x " << C[i] << nl;
    }
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 3652
#include <cstdio>
#include <cmath>

typedef struct{
	double x;
	double y;
	double z;
}point;
	
int main(void){
	while(1){
		point p, q;
		double a, b, c, d;
		double ccc, theta, dist;
		
		scanf(" %lf %lf %lf %lf", &a, &b, &c, &d);
		if(a==-1 && b==-1) break;
		
		double e, f, g, h;
		e = (90-a) * M_PI / 180.0;
		f = b * M_PI / 180.0;
		g = (90-c) * M_PI / 180.0;
		h = d * M_PI / 180.0;
		
		//極座標変換
		p.x = sin(e) * cos(f);
		p.y = sin(e) * sin(f);
		p.z = cos(e);
		q.x = sin(g) * cos(h);
		q.y = sin(g) * sin(h);
		q.z = cos(g);
		
		//printf("P(%lf,%lf,%lf) , Q(%lf,%lf,%lf)\n", p.x, p.y, p.z, q.x, q.y, q.z);
		
		ccc = p.x*q.x + p.y*q.y + p.z*q.z;
		theta = acos(ccc);
		dist = theta * 6378.1 + 0.5;
		
		printf("%ld\n", (long)dist);
	}

	return 0;
}

Measured memory_bytes: 1108
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    ll n, m, sum=0;
    cin >> n >> m;
    vector<ll> v(m);
    for(ll i=0; i<m; i++){
        cin >> v[i];
        sum+=v[i];
    }
    cout << max((ll)-1, n-sum) << endl;
	return 0;
}


Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
int a[201000];
signed main()
{
	std::ios::sync_with_stdio(false);
	int n;cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>a[i];
	}
	int now=0;
	ll ans=0;
	for(int l=1,r=1;r<=n;++r)
	{
		while(now&a[r])
		    now^=a[l++];
		now|=a[r];
		ans+=r-l+1;
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  ll n,k;
  cin>>n>>k;
  ll a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  ll q=1;
  int z=0;
  set<int> s;
  vector<int> v;
  s.insert(1);
  map<int,int> m;
  v.push_back(1);
  m[1]=0;
  while(s.find(a[z])==s.end())
  {
    s.insert(a[z]);
    v.push_back(a[z]);
    m[a[z]]=q;
    z=a[z]-1;
    q++;
  }
  //cout<<q<<" "<<z<<"\n";
  if(k==1)
    cout<<a[0]<<"\n";
  else if(q==1)
    cout<<1<<"\n";
  else
  {
    int c=m[a[z]];
    if(k>c)
    {
      k=k-c;
      k=k%(q-c);
      cout<<v[c+k]<<endl;
    }
    else
      cout<<v[k]<<endl;
  }
}

Measured memory_bytes: 24048
#include<bits/stdc++.h>
#ifndef LOCAL_PROJECT
#define cerr if(0)cerr
#endif
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int mn=1e3+10;
const ll inf=0x3f3f3f3f3f3f3f3f;
const ll mod=998244353;
#define mid ((l+r)>>1)
int main(){
#ifdef LOCAL_PROJECT
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
#else
    cin.tie(0);
    cin.sync_with_stdio(0);
#endif
    int n;
    cin>>n;
    n=n%1000;
    n=1000-n;
    n%=1000;
    printf("%d",n);
}

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

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  vector<vector<int>> c(h, vector<int>(w));
  vector<int> vec;
  rep(i, n) rep(j, a[i]) vec.push_back(i + 1);
  // rep(i, vec.size()) printf("%d%c", vec[i], (i == vec.size() - 1 ? '\n' : '
  // '));
  rep(i, h) rep(j, w) {
    // cerr << i * h + j << endl;
    // c[i][j] = vec[i * w + j];
    if (i % 2 == 0) {
      c[i][j] = vec[i * w + j];
    } else {
      c[i][w - j - 1] = vec[i * w + j];
    }
  }

  rep(i, h) rep(j, w) printf("%d%c", c[i][j], (j == w - 1 ? '\n' : ' '));
  return 0;
}


Measured memory_bytes: 3776
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        p: usize,
        a:[i64;p],
    }
    let mut b:Vec<i64> = vec![0;p];
    let mut fact:Vec<usize> = vec![0;p];
    let mut inv:Vec<usize> = vec![0;p];
    fact[0] = 1;
    fact[1] = 1;
    for i in 2..p {
        fact[i] = fact[i-1] * i % p;
    }
    inv[0] = 1;
    inv[1] = 1;
    for i in 2..p {
        inv[i] = (p - p/i) * inv[p%i] % p;
    }
    let mut fact_inv:Vec<usize> = vec![0;p];
    fact_inv[0]=1;
    fact_inv[1]=1;
    for i in 2..p {
        fact_inv[i] = fact_inv[i-1] * inv[i] % p;
    }
    for i in 0..p {
        if a[i] == 1 {
            b[0]+=1;
            let mut ii:usize = 1;
            for j in 0..p {
                b[p-1-j]-= (((fact[p-1] * fact_inv[p-1-j] % p * fact_inv[j] % p) * ii) as i64) * (if j%2==0 {1}else{-1});
                b[p-1-j]%=p as i64;
                if b[p-1-j] < 0 {
                    b[p-1-j]+=p as i64;
                }
                ii*=i;
                ii%=p;
            }
        }
    }
    for i in 0..p {
        if i==p-1 {
            println!("{}", b[i]);
        }else{
            print!("{} ", b[i]);
        }

    }
}

Measured memory_bytes: 4352
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var nmp=(Arr.shift()).split(" ").map(Number);
   if(nmp[0]==0 && nmp[1]==0 && nmp[2]==0)break;
   var n=nmp[0];
   var m=nmp[1]-1;
   var p=nmp[2];
   var arr=[];
   var sum=0;
   for(var i=0;i<n;i++){
      var v=Arr.shift()-0;
      arr.push(v);
      sum+=(v*100);
   }
   sum=sum*(100-p)/100;
   var ans=0;
   if(arr[m]!=0)ans=Math.floor(sum/arr[m]);
   console.log(ans);
}


Measured memory_bytes: 17404
import java.util.*

import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val x = sc.nextLong()
  val k = sc.nextLong()
  val d = sc.nextLong()


  val xd = Math.abs(x) / d
  if (k <= xd) {
    println(Math.abs(x) - k * d)
    return
  }


  val min1 = Math.abs(x) - d * xd
  val min2 = Math.abs(min1) - d
  val min3 = Math.abs(min2)


  val last = k - xd
  if (last % 2 == 0L) {
    println(min1)
  } else {
    println(min3)
  }



}

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

int main(void){
	int n,i;
	long int na,min,max,sum;
	cin >> n;
	min=1000000000;
	max=-100000000;
    sum=0;
for(i=1;i<=n;i++){   
	cin >> na;
	if(na<min) min=na;
	if(na>max) max=na;
	sum+=na;


}cout << min << " " << max << " " << sum << endl;
		return 0;
}

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

int main()
{
    int n, a, b, sum = 0;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++)
    {
        int c;
        c = (i / 10000) + (i / 1000) % 10 + (i / 100) % 10 + (i / 10) % 10 + i % 10;
        if (a <= c && c <= b)
        {
            sum += i;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e,f,g;
    while(cin>>a,a){
        for(int i=b=0; i<a; i++){
            cin>>c>>d>>e>>f;
            g=c+d+e;
            if(g<=60&&f<=2) b+=600;
            else if(g<=80&&f<=5) b+=800;
            else if(g<=100&&f<=10) b+=1000;
            else if(g<=120&&f<=15) b+=1200;
            else if(g<=140&&f<=20) b+=1400;
            else if(g<=160&&f<=25) b+=1600;
        }
        cout<<b<<endl;
    }
}



Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
typedef long long LL;
const int MAXN = 1e4 + 5;
const LL mod = 1000000007;
LL qpow(LL base, LL times)
{
	LL tmp = base % mod;
	LL ans = 1;
	while (times)
	{
		if (times & 1) ans = ans * tmp % mod;
		tmp = tmp * tmp % mod;
		times >>= 1;
	}
	return ans % mod;
}
LL a[MAXN];
LL Num[MAXN * 100];

int main()
{
	int N;
	std::cin >> N;
	LL maxx = 0;
	for (int i = 1; i <= N; i++)
	{
		std::cin >> a[i];
		maxx = std::max(maxx, a[i]);
	}
	//std::cout << "0000000\n";
	for (int i = 1; i <= N; i++)
	{
		LL x = a[i];
		LL j = 2;
		//std::cout << "i is " << i << '\n';
		while (j * j <= x)
		{
			//std::cout << "j is " << j << '\n';
			if (x % j == 0)
			{
				LL cnt = 0;
				while (x % j == 0)
				{
					x /= j;
					cnt++;

				}

				Num[j] = std::max(Num[j], cnt);
				//std::cout << "33333333333\n";
				//std::cout << "x is " << x << '\n';
				
			}
			//std::cout << "jj is " << j << '\n';
			j++;
		}
		if (x != 1) Num[x] = std::max(Num[x], LL(1));
	}
	LL sum = 1;
	for (int i = 1; i <= maxx; i++)
	{
		sum = (sum % mod * qpow(i, Num[i]) % mod) % mod;
	}
	LL ans = 0;
	//std::cout << "111111\n";
	for (int i = 1; i <= N; i++)
	{
		ans = (ans + sum * qpow(a[i], mod - 2) % mod) % mod;
	}
	std::cout << ans << '\n';

}

Measured memory_bytes: 6656
import sys
w = int(input())
n = int(input())
l = list()
for _ in range(n):
    l.append(list(map(int,input().split(","))))

res = [0 for _ in range(w)]
for i in range(1,w+1):
    tgt = i
    for num in l:
        if tgt in num:
            if num.index(tgt) == 1:
                tgt = num[0]
            else:
                tgt = num[1]
    res[tgt-1] = i

for x in res:
    print(x)

Measured memory_bytes: 7800
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N];
    int sum = 0;
    for(int i = 0; i < N; i++){
      a[i] = sc.nextInt();
      sum += a[i];
    }
    long x = Math.round(sum / (double)N);
    
    long ans = 0;
    for(int i = 0; i < N; i++){
      ans += (a[i] - x) * (a[i] - x);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23636
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#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 <unordered_set>
#include <unordered_map>
using namespace std;
using LL = long long;

template <typename T>
class point
{
private:
	T x_m, y_m;
public:
	point(T x_, T y_)
		:x_m(x_), y_m(y_)
	{}
	point()
		:x_m(0), y_m(0)
	{}

	T x()const
	{
		return x_m;
	}
	T y()const
	{
		return y_m;
	}

	point operator+(const point& other)const
	{
		return point(x_m + other.x(), y_m + other.y());
	}
	point operator-(const point& other)const
	{
		return point(x_m - other.x(), y_m - other.y());
	}
	point operator+()const
	{
		return *this;
	}
	point& operator+=(const point& other)const
	{
		x_m += other.x();
		y_m += other.y();
		return *this;
	}
	point& operator-=(const point& other)const
	{
		x_m -= other.x();
		y_m -= other.y();
		return *this;
	}
	point& operator*=(const T& k)const
	{
		x_m *= k;
		y_m *= k;
		return *this;
	}
	point operator-()const
	{
		return point(-x_m, -y_m);
	}
	T dot(const point& other)const
	{
		return x_m * other.x() + y_m * other.y();
	}
	T cross(const point& other)const
	{
		return x_m * other.y() - y_m * other.x();
	}
	point mult(const T& k)const
	{
		return point(x_m * k, y_m * k);
	}
};

int main(void)
{
	vector<double>x, y;
	double xx, yy;
	while (true)
	{
		char s[114] = {};
		scanf("%s", s);
		if (!strlen(s))break;
		sscanf(s, "%lf,%lf", &xx, &yy);
		x.push_back(xx);
		y.push_back(yy);
	}
	double sx = x.back(), sy = y.back();
	x.pop_back(); y.pop_back();
	vector<point<double>>vec;
	for (int i = 0; i < x.size(); ++i)
	{
		vec.emplace_back(x[i] - sx, y[i] - sy);
	}
	double ans = 0;
	for (int i = 1; i < vec.size(); ++i)
	{
		auto area = vec[i - 1].cross(vec[i]) / 2.;
		ans += abs(area);
	}
	printf("%lf\n", ans);
	return 0;
}

Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define MODD 1000000007
#define ll long long
using namespace std;

// 0 to H1
// 0 to H2

// 0 to Hk


// ans, max_ht

vector<int> edges[111111];


int GetSumAllNonZero(const vector<int>& V) {
    int summ = 0;
    for(int x : V) {
        summ += max(1,x);
    }
    return summ;
}

int GetMinSumAtmostOneZero(const vector<int>& V) {
    int has_ret = 0;
    int num_zeros = 0;
    for(int x : V) {
        num_zeros += (x == 0);
        has_ret += x;
    }
    
    has_ret += max(0, num_zeros - 1);
    return has_ret;
}

int dp[111111][2];

int Solve(int par,int u,bool has) {
    
    
    
    if (dp[u][has]!=-1)
        return dp[u][has];
    
    
    vector<int> mins0;
    vector<int> mins1;

    
    
    
    int nc = 0;
    for(int v : edges[u]) {
        if (v == par)
            continue;
        
        mins0.push_back(Solve(u,v,0));
        mins1.push_back(Solve(u,v,1));
        nc++;

    }
    if (mins0.empty()) {
        return dp[u][has]=(!has ? 1 : 0);
    }
    

    

    if (has) {
        
        
        return dp[u][has]=GetMinSumAtmostOneZero(mins1);
    } else {
        if (nc == 1) {
            return dp[u][has]=min(1+mins1[0],mins0[0]);
        }
        
        int ret = 1+Solve(par,u,true);

        
        
        if (par != -1) {
            return dp[u][has]=min(ret, GetSumAllNonZero(mins1));
        }
        
        
        if (nc == 2) {
            
            if (mins1[0]>0 && mins1[1]>0)
                return min(ret,mins1[0]+mins1[1]);

            
            return dp[u][has]=min(ret,min(mins1[0]+mins0[1],mins0[0]+mins1[1]));
        }


        
        
        
        return dp[u][has]=min(ret, GetMinSumAtmostOneZero(mins1));
        
        /*
        int allsum = 0;
        for(int x : mins2) {
            allsum += max(1,x);
        }
        
        ret = min(ret,allsum);
        
        for(int x : mins1) {
            ret = min(ret, allsum - (max(1,x)-x));
        }
         */
        
    }

}



int main() {
    
    int N;
    cin>>N;
    for(int i=0;i<N-1;i++) {
        int u,v;
        cin>>u>>v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    for(int i=0;i<=N;i++)
        dp[i][0]=dp[i][1]=-1;
    
    cout << Solve(-1,1,false) << endl;
    
    
    
}

Measured memory_bytes: 23936
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;

		Console.WriteLine("{0}",(n-2)*180);
	}
}

public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public string Sz{get{return Console.ReadLine();}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2(int b){return Array.ConvertAll((((b&1)!=0?"0 ":"")+Console.ReadLine()+((b&2)!=0?" 0":"")).Split(),int.Parse);}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public string[] Sa2{get{return (Console.ReadLine()+" 0").Split();}}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a < b && b < c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int count = 0;
		for(int X = 0; X <= K; X++) {
			for(int Y = 0; Y <= K; Y++) {
				int Z = S - (X + Y);
				if(0 <= Z && Z <= K) {
					count++;
				}
			}
		}
		System.out.print(count);
	}

}


Measured memory_bytes: 21844