akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;

int a[maxn],b[maxn];

int main(){
	int n,k,q;
	cin>>n>>k>>q;
	
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	
	for(int i=1;i<=q;i++){
		int flag;
		cin>>flag;
		b[flag]++;
	}
	
	for(int i=1;i<=n;i++){
	
		a[i] = k-(q-b[i]);
		
		if(a[i]<=0)
		 cout<<"No"<<endl;
		else
		  cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll          long long   
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define rall(v)     (v).rbegin(),(v).rend()
#define gcd(a,b)    __gcd((a),(b))

typedef pair<int,int> pii;
typedef vector<int> vi;
int main() 
{
    fastio;
    long double a;
    long double b;
    cin>>a>>b;
    long double p=(a*b);
    ll ans=trunc(p);
    cout<<ans<<endl;
}


Measured memory_bytes: 3796
#include <cstdio>
#include <algorithm>

int main()
{
	int		a[3];

	scanf("%d %d %d", &a, &(a[1]), &(a[2]));
	std::sort(std::begin(a), std::end(a));

	printf("%d %d %d\n", a[0], a[1], a[2]);

	return 0;
}

Measured memory_bytes: 2728
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long MOD = 998244353;

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

	int n, m;
	cin >> n >> m;
	cout << n * (n - 1) / 2 + m * (m - 1) / 2 << "\n";

	return 0;
 }


Measured memory_bytes: 256
a,b,k = [int(i) for i in input().split()]

if (b-a)/2 < k:
    [print(i+a) for i in range(b-a+1)]
else:
    al = {i+a for i in range(k)}
    bl = {b-i for i in range(k)}
    [print (i) for i in sorted(list(al | bl))]
        


Measured memory_bytes: 3060
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let mut s = read_as_string().chars().collect::<Vec<char>>();
    let mut t = read_as_string().chars().collect::<Vec<char>>();

    for i in 0..s.len(){
        if s == t{
            println!("Yes");
            return;
        }
        let tmp = *s.last().unwrap();
        s.insert(0, tmp);
        s.pop();
    }

    println!("No");
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(int i=0;i<(int)v.size();i++) cout<<" "<<v[i]; cout<<endl;
int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int t=1;
	//cin>>t;
	while(t--){
		int n;
		cin>>n;
		ll a[n];
		for (int i = 0; i < n; i++)
		{
			cin>>a[i];
		}
		ll money=1000;
		ll st=0;
		for(int i=0;i<n-1;i++){
			if(a[i]<a[i+1]){
				st=money/a[i];
				money=money%a[i];	
				money+=st*a[i+1];
			}
		}
		cout<<money<<endl;
	}
}



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

//{{{
#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
 vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x;
 while (getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
 template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}
//

int T;
const int N = 2e5 + 10;
int n;
int a[N];

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    for (int x = 1; x <= 100; x++)
    {
        for (int y = 1; y <= 100; y++)
        {
            for (int z = 1; z <= 100; z++)
            {
                int v = x * x + y * y + z * z + x * z + x * y + y * z;
                if (v <= 10000) a[v]++;
            }
        }
    }
    while (cin >> n)
    {
        for (int i = 1; i <= n; i++) cout << a[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>

int main(){
    int n, q, T;
    int S[10000];
    scanf("%d\n",&n);
    for ( int ix = 0 ; ix < n ; ix++){
        if ( ix == n-1 ) scanf("%d\n",&S[ix]);
        else scanf("%d ",&S[ix]);
    }
    scanf("%d\n",&q);
    int counter = 0;
    for ( int ix = 0 ; ix < q ; ix++){
        if ( ix == q-1 ) scanf("%d\n",&T);
        else scanf("%d ",&T);
        int jx = 0;
        while ( jx < n ){
            if ( T == S[jx] ){
                ++counter;
                break;
            }
            jx++;
        }
    }
    printf("%d\n",counter);
    
    return 0;
}


Measured memory_bytes: 2100
// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

const int N = 2e5+50, MOD = 1e9+7;

vector<LL> dpf[N];
LL dps[N];

vector<int> G[N];
int n;


int siz[N], sf[N];

LL ans[N];

inline LL bin(LL a, LL b, LL p=MOD) {
    LL res = 1;
    for (a%=p; b; b>>=1, a=a*a%p)
        if (b & 1)
            res = res * a % p;
    return res;
}


LL f[N], invf[N];
inline void init() {

    f[0] = invf[0] = 1;
    for (int i=1; i<N; ++i)
        f[i] = f[i-1] * i % MOD;
    invf[N-1] = bin(f[N-1], MOD-2, MOD);
    for (int i=N-2; i>=1; --i)
        invf[i] = invf[i+1] * (i+1) % MOD;

}

LL C(int n, int m) {
    if (n < m || n < 0 || m < 0)
        return 0;
    return f[n] * invf[m] % MOD * invf[n-m] % MOD;
}

inline LL inv(LL x) { return bin(x, MOD-2, MOD);}

void dfs(int u, int fa) {
    siz[u] = 0;
    dps[u] = 1;
    for (int v : G[u]) {
        if (v == fa)
            continue;
        dfs(v, u);
        siz[u] += siz[v];
        LL c = C(siz[u], siz[v]) * dps[v] % MOD;

        dps[u] = dps[u] * c % MOD;
    }

    for (int v : G[u]) {
        if (v == fa)
            continue;
        dpf[u].push_back(dps[u] * inv(C(siz[u], siz[v])) % MOD * inv(dps[v]) % MOD);
    }
    ++siz[u];
    sf[u] = n - siz[u];
}

void dfs2(int u, int fa, LL la) {
    ans[u] = C(n-1, sf[u]) * la % MOD * dps[u] % MOD;
    int now = 0;
    for (int v : G[u]) {
        if (v == fa)
            continue;
        LL c = dpf[u][now++];
        dfs2(v, u, c * la % MOD * C(n-1-siz[v], sf[u]) % MOD);
        // ++now;
    }
}

int main(int argc, char const *argv[]) {
    init();
    // code
    scanf("%d", &n);
    for (int i=0; i<n-1; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs(1, 1);
    // for (int i=1; i<=n; ++i)
    //     dbg(i, dps[i]);
    dfs2(1, 1, 1);
    for (int i=1; i<=n; ++i)
        printf("%lld\n", ans[i]);
    return 0;
}


Measured memory_bytes: 30080
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	l := make([]int, n)

	for i := 0; i < n; i++ {
		l[i] = nextInt()
	}

	for i := n - 1; i > 0; i-- {
		if l[i]-l[i-1] >= 0 {
			continue
		}

		l[i-1]--
		if l[i] != l[i-1] {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 4412
def solve(n, k):
    if k > (n-1)*(n-2)//2:
        return -1, []

    if k == 0:
        edges = []
        for i in range(n-1):
            for j in range(i+1,n):
                edges.append((i, j))
        return len(edges), edges
    
    edges = []
    for i in range(1, n):
        edges.append((0, i))
    cnt = (n-1)*(n-2)//2

    if k == cnt:
        return len(edges), edges

    for i in range(1, n-1):
        for j in range(i+1,n):
            edges.append((i, j))
            cnt -= 1
            if cnt == k:
                return len(edges), edges

    

if __name__ == "__main__":
    assert solve(5, 8) == (-1, [])


    n,k = map(int, input().split())
    n_edges, edges = solve(n,k)

    print(n_edges)
    
    if n_edges == -1:
        exit()

    for v,u in edges:
        print(v+1, u+1)


Measured memory_bytes: 43248
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll X;
    cin >> X;
    ll A,B;
    for (ll i = -200; i <= 200; i++){
        for (ll j = -200; j <= 200; j++){
            if (i * i * i * i * i - j * j * j * j * j == X){
                A = i;
                B = j;
            }
        }
    }
    cout << A << " " << B << endl;
}



Measured memory_bytes: 3624
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
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumInt64(a []int64) int64 {
	var ret int64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcdInt64(m, n int64) int64 {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcmInt64(m, n int64) int64 {
	return m / gcdInt64(m, n) * n
}

// 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() {
	n := readInt()
	a := make([]int64, n)
	var t int64
	for i := range a {
		a[i] = readInt64()
		t += a[i]
		if i%2 == 1 {
			t -= 2 * a[i]
		}
	}

	for i := range a {
		if i != 0 {
			t = 2*a[i-1] - t
		}
		fmt.Println(t)
	}
}


Measured memory_bytes: 4992
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
	int n;
	int a[120];
	cin >> n;
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	int ans = 0;
	rep(i, n - 1) ans += abs(a[i] - a[i + 1]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat
const int N = 1e7 + 5;
ll a[N];

int main(int argc, char const *argv[])
{
	sync;
	ll n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		for(int j = 1; i*j <= n; j++){
			a[i*j]++;
		}
	}
	ll sum = 0;
	for(int i = 1; i <= n; i++){
		//cout << a[i] << endl;
		sum += a[i]*i;
	}
	cout << sum << endl;
	return 0;
}


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

/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)

/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/* func */

/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

//#define int ll
//#define int long long

signed main()
{
  int n,l;cin >> n >> l;
  vector<string> s(n);
  REP(i,n)
    cin >> s[i];
  
  sort(ALL(s));
  
  REP(i,n)
    cout << s[i];
  
  return 0;
}

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


void main()
{
  int h, w;
  readf("%d %d\n", &h, &w);

  auto s = new char[][](h+1, w+1);
  auto d = new int[][][](h, w, 2);
  
  foreach (i; 0..h) {
    s[i] = readln.chomp.to!(char[]) ~ '#';
  }
  s[h] = '#'.repeat.take(w+1).array;

  int res;

  foreach (x; 0..h) {
    foreach (y; 0..w) {
      if (s[x][y] == '#') {
        continue;
      }
      if (d[x][y][0] == 0) {
        auto dy = 1;
        while (s[x][y+dy] == '.') {
          d[x][y+dy][0] = -1;
          dy++;
        }
        d[x][y][0] = dy;
      }
      if (d[x][y][0] == -1) {
        d[x][y][0] = d[x][y-1][0];
      }
      if (d[x][y][1] == 0) {
        auto dx = 1;
        while (s[x+dx][y] == '.') {
          d[x+dx][y][1] = -1;
          dx++;
        }
        d[x][y][1] = dx;
      }
      if (d[x][y][1] == -1) {
        d[x][y][1] = d[x-1][y][1];
      }

      res = max(res, d[x][y][0] + d[x][y][1] - 1);
    }
  }
  res.writeln;
}


Measured memory_bytes: 149628
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main(){
	int n ; string s; cin >> n >> s;
	int ans = 1;
	rep(i,n-1) ans += s[i] != s[i+1];
	cout<<ans<<endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> w;
  for(int i = 0;i < n;i++){
    int a;
    cin >> a;
    w.push_back(a);
  }
  vector<int> ans;
  int j = n;
  int i = 0;
  while(i != n){
    int a = 0;
    int b = 0;
    for(int k = 0;k < j;k++){
      a += w[k];
    }
    for(int k = j;k < n;k++){
      b += w[k];
    }
    ans.push_back(abs(a-b));
    j--;
    i++;
  }

  sort(ans.begin(),ans.end());
  cout << ans[0] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
  	cin>>n;
  	vector<int>A(n);
  	for(int i=0;i<n;i++)cin>>A[i];
  	
  	vector<long long>a(n);
  	a[0]=0;
  	for(int i=1;i<n;i++)a[i]=(long long)2*(A[i-1]-(a[i-1]/2));
  	long long x=A[n-1]-(a[n-1])/2;
  	int flag=1;
  	for(int i=0;i<n;i++)
    {
      cout<<(long long)a[i]+(flag*x)<<" ";
      flag*=-1;
    }
 	return 0;
}

Measured memory_bytes: 4572
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str0[200005];
char str1[200005];

void solve()
{
    scanf("%s%s", str0,str1);
    int n=strlen(str0);
    map<int,int> z;
    int i;
    for(i=0; i<n; i++) {
        int tmp0=str0[i]-'a';
        int tmp1=str1[i]-'a';
        auto it=z.find(tmp0);
        if(it==z.end()) {
            z[tmp0]=tmp1;
        }
        else {
            if(it->second!=tmp1) {
                printf("No\n"); return;
            }
        }    
    }
    set<int> zz;
    auto it=z.begin();
    for(; it!=z.end(); ++it) {
        if(!zz.insert(it->second).second) {
            printf("No\n"); return;
        }
    }
    printf("Yes\n");


    return;
}


int main(int argc, char* argv[])
{
#if 1
	solve();
#else
	int T; scanf("%d", &T);
	while (T--) {
		solve();
	}
#endif
	return 0;
}


Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Scanner;
import java.lang.Math;

public class Main {
	public static boolean quo(int n) {
		if((n == 0)||(n == 1)) {
			return false;
		}else{
			for(int i = 2; i<= Math.sqrt(n); i+=1) {
				if(n%i == 0) {
					return false;
				}
			}
			
		}
		return true;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int size = Integer.parseInt(sc.nextLine());
		
		int i = 0;
		int[] numbs = new int[size];
		ArrayList<Integer> result = new ArrayList<Integer>();
		while (i<size) {
			numbs[i] = Integer.parseInt( sc.nextLine());
			if(quo(numbs[i])) {
				result.add(numbs[i]);
			}
			i+=1;
		}
		System.out.println(result.size());
	}

}



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

struct Rect {
  int H;
  int W;
};

int main () {

  int H,W;
  std::vector <Rect> v;

  while(1) {
    std::cin >> H >> W;
    
    if ((H || W) == 0)
      break;

    v.push_back({H,W});
  }

  for (int rect_num = 0; rect_num < v.size(); rect_num++) {
    for (int h_num = 0; h_num < v[rect_num].H; h_num++) {
      for (int w_num = 0; w_num < v[rect_num].W; w_num++) {
        std::cout << "#";
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }

  return 0;
}



Measured memory_bytes: 3120
S = input()
from collections import deque
q = deque()
ans = 0
for s in S:
    if not q:
        q.append(s)
        continue
    pres = q.pop()
    if (s == '0' and pres == '1') or (s=='1' and pres=='0'):
        ans += 2
    else:
        q.append(pres)
        q.append(s)
print(ans)


Measured memory_bytes: 74220
import qualified Data.ByteString.Char8 as BS
import qualified Data.Maybe as Maybe

solve :: Int -> String
solve a = 
    if (elem a resultList)
        then "Yes"
        else "No"
    where
        resultList = [x * y | x <- [1..9], y <- [1..9]]

main = do
    a <- (fst . Maybe.fromJust . BS.readInt) <$> BS.getLine
    let ans = solve a
    putStrLn ans

Measured memory_bytes: 3716
#include <stdio.h>
#include <iostream>
using namespace std;


int main()
{
	int H, W;
	
	
	while(1){

		cin >> H >> W;
		if (H == 0 && W == 0) break;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cout << '#';
			}
			cout << '\n';
		}
		cout << '\n';
	} 
    return 0;
}

Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

vector<char> odd = {'R', 'U', 'D'};
vector<char> even = {'L', 'U', 'D'};

int main() {

    int N;
    cin >> N;

    long K;
    cin >> K;
    long Q;
    cin >> Q;

    vector<long> PS(N);

    for (int i = 0; i < N; ++i) {
        PS[i] = K - Q;
    }

    long A;
    for (int i = 0; i < Q; ++i) {
        cin >> A;
        PS[A - 1] += 1;
    }
    for (int i = 0; i < N; ++i) {
        if (PS[i] <= 0) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

const ll MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    COMinit();
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0;
    rep(i, k-1, n) ans += COM(i, k-1) * a[i], ans %= MOD;
    rep(i, 0, n-k+1) ans -= COM(n-i-1, k-1) * a[i], ans %= MOD;
    cout << (ans + MOD) % MOD << endl;
}


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

using namespace std;
typedef long long LL;

int main() {
  LL W, H, x, y;
  cin >> W >> H >> x >> y;
  int ok = 0;
  if (W == 2 * x && H == 2 * y) ok = 1;
  double ans = W * H / 2.0;
  printf("%.10lf %d\n", ans, ok);

  return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    println!("{:?}", (v[0] * 3 + v[1]) / 2);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
import java.util.Scanner;
public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a, b;
        for (;;) {
            a = sc.nextInt();
            b = sc.nextInt();
            if (a == 0 && b == 0)
                break;
            for (int j = 0; j < a; j++) {
                for (int k = 0; k < b; k++) {
                    if((j+k)%2==0)
                        System.out.print("#");
                    else
                        System.out.print(".");
                }
                System.out.println();
            }

            System.out.println();
        }
    }
}



Measured memory_bytes: 35296
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t n,k;
  cin >> n >> k;
  vector<int64_t> v(n);
  rep(i,n){
    cin >> v.at(i);
  }
  reverse(v.begin(),v.end());
  int64_t maxvalue = 0;
  rep(i,k+1){ //取り出す回数
    rep(j,i+1){ //左からとる回数
      int fetchleft = j;
      int fetchright = i-j;
      int returnback = k-i;
      int l=0;
      int r=n-1;
      vector<int64_t> gems;
      rep(pi,fetchleft){
        if(l <= r){
          gems.push_back(v.at(l));
          l++;
        }else{
          break;
        }
      }
      rep(pi,fetchright){
        if(l <= r){
          gems.push_back(v.at(r));
          r--;
        }else{
          break;
        }
      }
      if(!gems.empty()){
        sort(gems.begin(),gems.end());
        rep(pi,returnback){
          if(pi < gems.size() && gems.at(pi) < 0){
            gems.at(pi) = 0;
          }else{
            break;
          }
        }
        maxvalue = max(maxvalue,accumulate(gems.begin(),gems.end(),0L));
      }
    }
  }
  cout << maxvalue << endl;
}

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

int a[200005],n;

int main() {
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+n+1);
    for(int i=1;i<n;i++) {
        if(a[i]==a[i+1]) {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
using std::cout;
using std::cin;
using std::endl;

#include<string>
using std::string;

#include<cmath>
using std::abs;

#include<cstdlib>
using std::stoi;

int main()
{
  string s;
  cin >> s;
  
  const int favorite = 753;
  int min_diff = 1000;
  
  for (int i = 0; i < s.size() - 2; i ++)
  {
    int tmp = abs(favorite - stoi(s.substr(i, 3)) );
    if (tmp < min_diff) min_diff = tmp;
  }
        
  cout << min_diff << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

struct Node {
	Node *parent, *left, *right;
	int key;
};

Node *root, *nil;

void insert(int& a) {
	Node *b = (Node*)malloc(sizeof(Node)), *c = root, *d = nil;
	b->left = nil;
	b->right = nil;
	b->key = a;
	while (c != nil) {
		d = c;
		if (b->key < c->key) c = c->left;
		else c = c->right;
	}
	b->parent = d;
	if (b->parent == nil) root = b;
	else if (b->key < b->parent->key) b->parent->left = b;
	else b->parent->right = b;
}

bool find(int& a) {
	Node *b = root;
	while (b != nil && a != b->key) {
		if (a < b->key) b = b->left;
		else b = b->right;
	}
	return b != nil;
}

void inorderTreeWalk(Node* a = root) {
	if (a != nil) {
		inorderTreeWalk(a->left);
		cout << ' ' << a->key;
		inorderTreeWalk(a->right);
	}
}

void preorderTreeWalk(Node* a = root) {
	if (a != nil) {
		cout << ' ' << a->key;
		preorderTreeWalk(a->left);
		preorderTreeWalk(a->right);
	}
}

int main() {
	int m, k;
	cin >> m;
	for (int i = 0; i < m; i++) {
		string a;
		cin >> a;
		if (a == "insert") {
			cin >> k;
			insert(k);
		}
		else if (a == "find") {
			cin >> k;
			if (find(k)) cout << "yes";
			else cout << "no";
			cout << endl;
		}
		else {
			inorderTreeWalk();
			cout << endl;
			preorderTreeWalk();
			cout << endl;
		}
	}
}


Measured memory_bytes: 21940
#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main()
{
    int n,a[100005];
    bool vis[100005];
    while(scanf("%d",&n)!=EOF)
    {
        LL ans=0;
        memset(vis,false,sizeof(vis));
        for(int i=0; i<n; i++)
        {
            scanf("%d",&a[i]);
            if(a[i])vis[i]=true;
            ans+=a[i]/2;
            a[i]%=2;
        }
        for(int i=1; i<n; i++)
        {
            if(a[i]&&a[i-1])
            {
                a[i]=0;
                a[i-1]=0;
                ans++;
            }
            else if(a[i]==0&&a[i-1])
                if(vis[i]) a[i]++,a[i-1]--;
        }
        printf("%lld\n",ans);
    }
}

Measured memory_bytes: 768
package main

import "fmt"

func pow(a, n int) (b int) {
	b = 1
	for n > 0 {
		b *= a
		n--
	}
	return
}

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	fmt.Println(K * pow(K-1, N-1))
}


Measured memory_bytes: 512
N, A = int(input()), input()

tmp = list(map(int, A.split()))

flg = "True"
for i in tmp:
    if i % 2 == 0 and i % 3 != 0 and i % 5 != 0:
        flg = "False"

if flg == "True":
    print("APPROVED")
else:
    print("DENIED")
    

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

struct Forest_Uni{
private:
	vector<int> node;
public:
	void initialize(int n){
		node.clear();
		for(int i = 0; i < n; i++){
			node.push_back(i);
		}
	}
	int find(int p){
		if(p == node[p]) return p;
		return find(node[p]);
	}
	void unite(int p, int b){
		node[find(p)] = find(b);
	}
	int same(int x, int y){
		if(find(x) == find(y)) return 1;
		else return 0;
	}
};

int main() {
	unsigned int n, q;
	cin >> n >> q;
	Forest_Uni tr;
	tr.initialize(n);
	
	vector<long long> ans;
	for(unsigned int i = 0; i < q; i++){
		unsigned int c, x, y;
		cin >> c >> x >> y;
		if( c == 0){
			tr.unite(x, y);
		}
		else{
			ans.push_back(tr.same(x, y));
		}
	}
	
	for(unsigned int i = 0; i < ans.size(); i++){
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void abc_170a();
void abc_171a();
void abc_172a();
void abc_173a();
void abc_174a();
void abc_175a();

void abc_170b();
void abc_171b();
void abc_172b();
void abc_173b();


int main()
{
  //abc_170a();
  //abc_171a();
  //abc_172a();
  //abc_173a();
  //abc_174a();
  //abc_175a();

  //abc_170b();
  //abc_171b();
  //abc_172b();
  abc_173b();

}

void abc_170a()
{
  vector<int> x(5);
  for (int i = 0; i < 5; ++i) cin >> x[i];

  for (int i = 0; i < 5; ++i)
  {
    if (x[i] == 0)
    {
      cout << i + 1 << "\n";
      return;
    }
  }
}

void abc_171a()
{
  char c;
  cin >> c;

  if (c == tolower(c)) cout << "a\n";
  else cout << "A\n";
}

void abc_172a()
{
  int a;
  cin >> a;

  cout << a + a * a + a * a * a << "\n";
}

void abc_173a()
{
  int N;
  cin >> N;

  if (N % 1000) cout << 1000 - N % 1000 << "\n";
  else cout << "0\n";
}

void abc_174a()
{
  int x;
  cin >> x;

  if (x >= 30) cout << "Yes\n";
  else cout << "No\n";
}

void abc_175a()
{
  string s;
  cin >> s;

  int cnt = 0, tmp = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (s[i] == 'S')
    {
      tmp = 0;
    }
    else
    {
      ++tmp;
      cnt = tmp;
    }
  }

  cout << cnt << "\n";
}


void abc_170b()
{
  int x, y;
  cin >> x >> y;

  for (int i = 0; i <= x; ++i)
  {
    int n_c = i, n_t = x - i;
    if (n_c * 2 + n_t * 4 == y)
    {
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
}

void abc_171b()
{
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  for (int i = 0; i < N; ++i) cin >> p[i];

  sort(p.begin(), p.end());

  int price = 0;
  for (int i = 0; i < K; ++i)
  {
    price += p[i];
  }
  cout << price << "\n";
}

void abc_172b()
{
  string s, t;
  cin >> s >> t;

  int cnt = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (s[i] != t[i]) ++cnt;
  }

  cout << cnt << "\n";
}

void abc_173b()
{
  int N;
  cin >> N;

  int n_ac = 0, n_wa = 0, n_tle = 0, n_re = 0;
  for (int i = 0; i < N; ++i)
  {
    string s;
    cin >> s;

    if (s == "AC") ++n_ac;
    else if (s == "WA") ++n_wa;
    else if (s == "TLE") ++n_tle;
    else ++n_re;
  }

  cout << "AC x " << n_ac << "\n";
  cout << "WA x " << n_wa << "\n";
  cout << "TLE x " << n_tle << "\n";
  cout << "RE x " << n_re << "\n";
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ms(x,y) memset(x, y, sizeof(x))
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;


void run_case() {
    LL n; cin >> n;
    LL x = n+1, y = n+1;
    for(LL i = 1; i*i <= n; ++i) {
        if(n % i == 0) {
            LL nx = i, ny = n / i;
            if(nx + ny < x + y) x = nx, y = ny;
        }
    }
    cout << (x+y-2);
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cout.flags(ios::fixed);cout.precision(9);
    //int t; cin >> t;
    //while(t--)
    run_case();
    cout.flush();
    return 0;
}


Measured memory_bytes: 3616
n, m = map(int, input().split())
xyz = [list(map(int, input().split())) for i in range(n)]
# a[i][0]=x, a[i][1]=y, a[i][2]=z
total = 0

for a in (1, -1):
    for b in (1, -1):
        for c in (1, -1):
            l = []
            for (x, y, z) in xyz:
                l.append(a*x + b*y + c*z)
            l.sort(reverse=True)
            total = max(total, sum(l[:m]))

print(total)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
using pl = pair<ll,ll>;
#define ci(n,a)   ll a[n]; rep(i,(n)) cin>>a[i];
#define rep(i,n)  for(ll i = 0; i < (n); ++i)
#define red(i,n)  for(ll i = (n)-1; i >= 0; --i)
#define all(a)    begin(a),end(a)
#define pb(a)     push_back(a)
#define mp(a,b)   make_pair(a,b)
#define yn(a)     cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;

int main(int argc,char* argv[]) 
{
    ll n,m,ans=0,b,c;
    cin>>n>>m;
    ll a[n];
    map<ll,ll> q;
    q[0]=1;
    rep(i,n){
        cin>>a[i];
        b=(c+a[i])%m;
        q[b]++;
        c=b;
    }
    for(auto z:q)ans+=z.second*(z.second-1)/2;
    cout<<ans<<endl;

    return 0;
}


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

tmp = []

for i in range(n):
    tmp += [list(map(int,input().split()))]


ans = 0

for j in range(31):
    flg = 1
    for k in range(n):
        if not j in tmp[k][1:tmp[k][0]+1]:
            flg = 0
    if flg == 1:
        ans += 1
print(ans)
    

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

vector<int> L, R;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K, C;
    cin >> N >> K >> C;
    string S; cin >> S;
    int cnt = K;
    for(int i = 0; i < S.length(); i++) {
        if (S[i] == 'o') {
            L.push_back(i + 1);
            i += C;
            cnt--;
        }
    }
    if(cnt < 0) return 0;
    cnt = K;
    for(int i = S.length() - 1; i >= 0; i--) {
        if (S[i] == 'o') {
            R.push_back(i + 1);
            i -= C;
            cnt--;
        }
    }
    reverse(R.begin(), R.end()); 
    // for(auto& e: L) cout << e << " ";
    // cout << endl;
    // for(auto& e: R) cout << e << " ";
    // cout << endl;
    rep(i, L.size()) {
        if(L[i] == R[i]) cout << L[i] << endl;
    }


    return 0;
}


Measured memory_bytes: 5656
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int count = 0;
    for(int i = 0; i < n / 2; i++) {
        if(s.at(i) != s.at(n - i - 1)) {
            s.at(n - i - 1) = s.at(i);
            count++;
        }
    }
    cout << count << endl;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep1(i, n) {
        int c = 0, t = i;
        while (t) {
            t /= 10;
            ++c;
        }
        if (c%2==1) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
using namespace std;


int main(){
  int w,h,n; cin>>w>>h>>n;
  int x[110],y[110],a[110];
  for(int i=0;i<n;i++){
      cin>>x[i]>>y[i]>>a[i];
  }
  int maxX=w,minX=0,maxY=h,minY=0;
  for(int i=0;i<n;i++){
      if(a[i]==1){
          minX=max(x[i],minX);
        }
      else if(a[i]==2){
          maxX=min(x[i],maxX);
      }
      else if(a[i]==3){
          minY=max(y[i],minY);
      }
      else if(a[i]==4){
          maxY=min(y[i],maxY);
      }
  }
  int X=maxX-minX;
  int Y=maxY-minY;
  if(X<0||Y<0){
      cout<<0<<endl;
      return 0;
  }
  else{
     cout<<X*Y<<endl;
     return 0;
  }
}

Measured memory_bytes: 256
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := scanInt()
	ans := 0
	for i := 1; i <= n; i++ {
		if i % 3==0 || i %5 ==0 {
			continue
		}
		ans += i
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1760
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
-- end of templete

judge s = getFirst $ foldMap First [judge' i s | i <- ['0'..'9']]
  where
    split' = wordsBy (fnBin (||) (=='+') (=='='))
    judge' i s' = cond (Just [i]) Nothing $ all (fnBin (||) ((==1) . length) ((/='0') . head)) ts && readInt a + readInt b == readInt c
      where
        ts@[a,b,c] = split' $ replace 'X' i s'
main = lines <$> getContents >>= mapM_ (putStrLn . fromMaybe "NA" . judge )

Measured memory_bytes: 4348
import java.util.Scanner;

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

		int n = sc.nextInt();
		int[] a = new int[100001];

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

			int m = sc.nextInt();
			a[m]++;

		}

		int max = 0;
		for (int i = 1; i < a.length - 1; i++) {
			int sum = a[i - 1] + a[i] + a[i + 1];
			if (sum > max)
				max = sum;
		}

		System.out.println(max);

		sc.close();

	}

}


Measured memory_bytes: 50176
#include <bits/stdc++.h>
 
#define REP(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define fi first
#define sc second
#define pb push_back
#define all(x) x.begin(), x.end()
 
using namespace std;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int>> vpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<int, int> pii;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;
 
const i64 MOD = 1000000007;
const int INF = 2000000000;

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 
	i64 a, b, c, d;
	cin >> a >> b >> c >> d;

	i64 g = gcd(c, d);
	i64 i = c * d / g;

	cout << b - a + 1 - (b / c - (a-1) / c + b / d - (a-1) / d - b / (i) + (a-1) / (i)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

int main() {
	string s;
	cin >> s;
	int result = 0;
	rep(i, 4) {
		if (s.at(i) == '+') result++;
		else result--;
	}
	cout << result << endl;
}


Measured memory_bytes: 3600