akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;
using ll = long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REV(v) reverse((v).begin(), (v).end())
#define IN(v) cin >> (v);
#define VIN(v, n) REP(i, n) cin >> v[i];
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  ll n, a, b, ca = 0, cb = 0;
  string s;
  cin >> n >> a >> b >> s;

  REP(i, n) {
    if (s[i] == 'a' && ca + cb < a + b) {
      OUT("Yes");
      ca++;
    } else if (s[i] == 'b' & ca + cb < a + b && cb < b) {
      OUT("Yes")
      cb++;
    } else {
      OUT("No");
    }
  }

  return 0;
}

Measured memory_bytes: 848
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
using namespace std;

int N, K;
vector<int> value;

int main() {
  cin >> N >> K;
  int maxV = 0;
  for(int i = 0; i < N; i++) {
    int v;
    cin >> v;
    value.push_back(v);
    if(v > 0) maxV += v;
  }
  if (K >= 2*N) {
    cout << maxV;
    return 0;
  }
  int ans = 0;
  for(int a = 0; a <= K; a++) {
    for(int b = 0; b <= K-a; b++) {
      for(int c = 0; c <= K-a-b; c++) {
        int d = K-a-b-c;
        priority_queue<int, vector<int>, std::greater<int>> left;
        int lsum = 0;
        for(int i = 0; i < a; i++)
          left.push(value[i]), lsum += value[i];
        for(int i = 0; i < b && left.size(); i++) {
          if(left.top() > 0) break;
          lsum -= left.top(); left.pop();
        }

        priority_queue<int, vector<int>, std::greater<int>> right;
        int rsum = 0;
        for(int i = 0; i < c; i++)
          right.push(value[value.size()-1-i]), rsum += value[value.size()-1-i];
        for(int i = 0; i < d && right.size(); i++) {
          if(right.top() > 0) break;
          rsum -= right.top(); right.pop();
        }
        ans = max(ans, lsum+rsum);
      }
    }
  }
  cout << ans;
}



Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
ll int dp[1000005];
ll int N;
vector<ll int> v;
ll int fun(int i)
{
  if(i==N-1)
    return 0;
  if(i>=N)
    return 999999999;
  if(dp[i+1]==-1)
    dp[i+1]=fun(i+1);
  if(dp[i+2]==-1)
    dp[i+2]=fun(i+2);
  dp[i]=min((abs(v[i+1]-v[i])+dp[i+1]),(abs(v[i+2]-v[i])+dp[i+2]));
  return dp[i]; 
}
int main()
{
  int i,x;
  for(i=0;i<1000005;i++)
    dp[i]=-1;
  cin>>N;
  for(i=0;i<N;i++)
  {
    cin>>x;
    v.pb(x);
  }
  dp[0]=fun(0);
  cout<<dp[0]<<endl;
  return 0;
}

Measured memory_bytes: 12148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007
 
int main(){
    ll N,A,B,C,D,E;
    cin >> N >> A >> B >> C >> D >> E;
    ll mint = min({A,B,C,D,E});
    ll ans = N/mint + (N%mint!=0) + 4;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
import bisect

A, B, C, D, E, F = map(int,input().split())

operation_water = [100*A, 100*B]
operation_sugar = [C, D]
water_lst = []
sugar_lst = [0]

def bfs_water():
    dq = deque()
    dq.append(0)
    while dq:
        water = dq.popleft()
        for add_water in operation_water:
            new_water = water + add_water
            if new_water <= F and new_water not in water_lst:
            	dq.append(new_water)
            	water_lst.append(new_water)
            
def bfs_sugar():
    dq = deque()
    dq.append(0)
    while dq:
        sugar = dq.popleft()
        for add_sugar in operation_sugar:
            new_sugar = sugar + add_sugar
            if new_sugar <= F/2 and new_sugar not in sugar_lst:
            	dq.append(new_sugar)
            	sugar_lst.append(new_sugar)

bfs_water()
bfs_sugar()
sugar_lst.sort()

concentration = []
for i in range(len(water_lst)):
  idx_maxmelt = bisect.bisect_right(sugar_lst, min(water_lst[i]/100*E, F-water_lst[i]))
  sugar_maxmelt = sugar_lst[idx_maxmelt-1]
  concentration.append((water_lst[i]+sugar_maxmelt, sugar_maxmelt, sugar_maxmelt/(water_lst[i]+sugar_maxmelt)))

max_concentration = sorted(concentration, key=lambda x:x[2], reverse=True)[0]
ans_weight = int(max_concentration[0])
ans_sugar = int(max_concentration[1])
print(ans_weight, ans_sugar)



Measured memory_bytes: 3316
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn = 255;
const int mod = 998244353;
struct node
{
    int x,y;
};
node a[maxn];
int cf[maxn];
int n;
int ans;
void init()
{
    cf[0]=1;
    for(int i=0;i<n;i++)
    {
        cf[i+1]=(cf[i]*2)%mod;
    }
    ans=cf[n]-(n+1);
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i].x>>a[i].y;
    }
    init();
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<i;j++)
        {
            int tot=0;
            for(int k=0;k<j;k++)
            {
                int l1=(a[i].x-a[j].x)*(a[i].y-a[k].y);
                int l2=(a[i].x-a[k].x)*(a[i].y-a[j].y);
                if(l1==l2)
                    tot++;
            }
            ans-=cf[tot];
            ans+=mod;
            ans%=mod;
        }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, k, a;
  in2(n, k);
  vector<ll> c(n);
  rep(i, n)
    in(c[i]);
  sort(all(c));
  reverse(all(c));
  a = 0;
  rep(i, k)
    a = a + c[i];
  out(a);
  memi;
}

Measured memory_bytes: 256
#!python3

import numpy as np

# input
N, K = list(map(int, input().split()))
x = np.array(list(map(int, input().split())))


def main():
    k = K - np.count_nonzero(x == 0)
    if k <= 0:
        print(0)
        return
    m, p = x[x < 0] * -1, x[x > 0]
    mn, pn = len(m), len(p)
    m.sort()
    m, p = np.append(0, m), np.append(0, p)
    
    ans = int(1e15)
    # first left
    for i in range(min(mn, k) + 1):
        j = k - i
        if j > pn:
            continue
        d = m[i] * 2 + p[j]
        ans = min(ans, d)
    
    # first right
    for i in range(min(pn, k) + 1):
        j = k - i
        if j > mn:
            continue
        d = p[i] * 2 + m[j]
        ans = min(ans, d)
    
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 23116
n,s = map(int,input().split())
s = s // 1000
xmax = s//10
ymax = s//5
if(xmax > 2000):
    xmax=2000
if(ymax > 2000):
    ymax = 2000
isloop = True
for x in range(xmax+1):
    
    if(isloop==False):
        break
    xv = x*10
    for y in range(ymax+1):
        
        if(isloop==False):
            break
        yv = y*5
        xysum = xv+yv
        if(xysum > s):
            continue
        
        z = (s-(xysum))
        if((x+z+y)==n):
            print(x,y,z)
            isloop=False
            break

if(isloop==True):
    print(-1,-1,-1)

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int N,A,B,C,X,Y[10000];

int main(){
	while(cin>>N>>A>>B>>C>>X&&N){
		rep(i,N)cin>>Y[i];
		int cur=X,z=0,f=0;
		while(1){
			if(cur==Y[z])z++;
			if(z==N)break;
			f++;
			if(f==10001)break;
			cur=(A*cur+B)%C;
		}
		cout<<(f<10001?f:-1)<<endl;
	}
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    FOREACH(x, v) { cout << x << " "; }                                        \
    cout << "\n";

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N, M;
struct edge {
    ll to, cost;
    bool operator<(const edge &another) const { return cost < another.cost; };
    bool operator>(const edge &another) const { return cost > another.cost; };
};
vector<vector<edge>> g;
VL d;

void bfs(ll s) {
    queue<ll> q;
    q.emplace(s);
    d.assign(N, LINF);
    d[s] = 0;
    while(!q.empty()) {
        ll now = q.front();
        q.pop();
        REP(i, g[now].size()) {
            edge e = g[now][i];
            if(d[e.to] == LINF) {
                d[e.to] = d[now] + 1;
                q.emplace(e.to);
            }
        }
    }
}

int main() {
    cin >> N >> M;
    g.resize(N);
    REP(i, M) {
        LCIN(a, b);
        g[--a].push_back({--b, 1});
        g[b].push_back({a, 1});
    }
    bfs(0);
    if(d[N - 1] <= 2)
        cout << "POSSIBLE"
             << "\n";
    else
        cout << "IMPOSSIBLE"
             << "\n";
}

Measured memory_bytes: 17152
use std::fmt::Debug;
use std::io;
use std::io::{Read, Stdin};
use std::str;
use std::str::FromStr;
use std::usize;
use std::cmp;
use std::collections::vec_deque::VecDeque;
use std::i64::MAX;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.parse::<usize>();
    let l = sc.parse::<i64>();
    let t = sc.parse::<i64>();

    let mut x: Vec<i64> = vec![0; n];
    let mut w: Vec<usize> = vec![0; n];

    for i in 0..n {
        x[i] = sc.parse::<i64>();
        w[i] = sc.parse::<usize>();
    }

    let cross_count = (0..n)
        .map(|i| {
            let w0 = w[0];
            let wi = w[i];
            if w0 == wi {
                return 0;
            }

            let interval;
            if w0 == 1 {
                interval = x[i] - x[0];
            } else {
                interval = x[0] + l - x[i];
            }

            if interval > t * 2 {
                return 0;
            }

            let time = t * 2 - interval;
            let mut count = time / l + 1;
            if time % l == 0 && w[0] == 1 {
                count -= 1;
            }
            return count;
        })
        .collect::<Vec<i64>>();

    let count_sum: i64 = cross_count.iter().sum::<i64>() % (n as i64);
    let position;
    let num;
    if w[0] == 1 {
        position = (x[0] + t) % l;
        num = count_sum;

    } else {
        position = (x[0] - (t % l) + l) % l;
        num = (n as i64) - count_sum;
    }

    let mut positions: Vec<i64> = Vec::new();
    for i in 0..n {
        let p;
        if w[i] == 1 {
            p = (x[i] + t) % l;
        } else {
            p = (x[i] - (t % l) + l) % l;
        }
        positions.push(p);
    }

    positions.sort();

    let mut a = 0;
    for i in 0..n {
        if positions[i] == position {
            a = i;
            break;
        }
    }

    let mut ans: Vec<i64> = vec![0;n];
    for i in 0..n {
        let idx = (i + num as usize) % n;
        let p = (a + i as usize) % n;
        ans[idx] = positions[p];
    }

    for a in &ans {
        println!("{}", a);
    }

}

struct Scanner {
    stdin: Stdin,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            buf: Vec::with_capacity(256),
        }
    }

    fn parse<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut it = self.stdin.lock().bytes();
        let mut c = it.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = it.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = it.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse::<T>().unwrap()
    }
}

Measured memory_bytes: 11388
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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

struct Edge {
	int to, cap, rev;
	Edge(int _to, int _cap, int _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, int from, int to, int cap, bool revFlag, int revCap) {
	G[from].push_back(Edge(to, cap, G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, G[from].size() - 1));
}

void solve() {
	ll n, l;
	cin >> n >> l;
	ll num = -1;
	ll pre = 0;
	REP(i, n) {
		ll a;
		cin >> a;
		if (pre + a >= l) num = i;
		pre = a;
	}

	if (num == -1) {
		cout << "Impossible" << en;
		return;
	}
	
	cout << "Possible" << en;
	rep2(i, num + 1, n) cout << i << en;
	rep(i, 1, num + 1) cout << i << en;
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n) {
  if (n == 0) return m;
  else return gcd(n, m % n);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  ll A[T], B[T], C[T], D[T];
  for (int i = 0; i < T; i++) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
  }
  for (int i = 0; i < T; i++) {
    if (B[i] > A[i] || B[i] > D[i]) {
      cout << "No\n";
    } else if(C[i] >= B[i] - 1) {
      cout << "Yes\n";
    } else {
      ll g = gcd(B[i], D[i]);
      ll l = A[i] - B[i] + 1;
      ll r = A[i] - C[i] - 1;
      ll q = 0;
      ll k = (r - q + g) / g - (l - q + g - 1) / g;
      if (k > 0) {
        cout << "No\n";
      } else {
        cout << "Yes\n";
      }
    }
  }
  return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

void chmax(int &a, int b){
  if(a < b)
    a = b;
}

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, 0, H)
    cin >> S[i];
  
  vvb wall(H, vb(W, false));
  rep(h, 0, H){
    rep(w, 0, W){
      if(S[h][w] == '#')
        wall[h][w] = true;
    }
  }    
  
  int ans = 0;
  vi tate = {-1, 0, 0, 1};
  vi yoko = {0, -1, 1, 0};
  
  rep(sh, 0, H){
    rep(sw, 0, W){
      if(wall[sh][sw])
        continue;
      vvi dist(H, vi(W, -1));
      dist[sh][sw] = 0;
      
      queue<pii> que;
      que.push(make_pair(sh,sw));
      
      while(!(que.empty())){
        pii p = que.front();
        que.pop();
        int h = p.first, w = p.second;
        
        int distmx = 0;
        
        rep(i, 0, 4){
          int next_h = h + tate[i], next_w = w + yoko[i];
          if(next_h < 0 || next_h >= H || next_w < 0 || next_w >= W)
            continue;
          if(wall[next_h][next_w])
            continue;
          if(dist[next_h][next_w] != -1)
            continue;
          dist[next_h][next_w] = dist[h][w] + 1;
          que.push(make_pair(next_h,next_w));
        }
      }
      
      rep(h, 0, H){
        rep(w, 0, W){
          chmax(ans, dist[h][w]);
        }
      }
      
    }
  }
  
  cout << ans << endl;
  
  return 0;
  
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int H;

signed main(){
    cin >> H;

    int d = 0;
    while(H > 0) d++, H >>= 1;

    cout << (1LL<<d)-1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  int ans = 0;
  ans += min(a,k);
  k = max(k-a, 0);
  k = max(k-b, 0);  
  if(k>0) ans -= min(c,k);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3652
//Daniel Grzegorzewski
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

int n, d, res, a[12][12];

bool is(int x) {
  int bla = (int)pow((double)x, 0.5);
  bla = max(0LL, bla-3);
  while (bla*bla < x)
    ++bla;
  return (bla*bla == x);
}

signed main() {
  init_ios();
  cin >> n >> d;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= d; ++j)
      cin >> a[i][j];
  for (int i = 1; i < n; ++i)
    for (int j = i+1; j <= n; ++j) {
      int tmp = 0;
      for (int k = 1; k <= d; ++k)
        tmp += (a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
      if (is(tmp))
        ++res;
    }
  cout<<res<<"\n";
}

Measured memory_bytes: 640
fun main(args: Array<String>) {
    val (N, M) = listOfInt()
    val AB = Array(M) { listOfInt(-1) }
    val ans = Array(M) { 0L }
    val U = UnionFind(N)
    ans[M - 1] = N.toLong() * (N.toLong() - 1) / 2
    for (n in M - 1 downTo 1) {
        val (a, b) = AB[n]
        if (U.isSame(a, b)) ans[n - 1] = ans[n]
        else ans[n - 1] = ans[n] - (U.size(a).toLong() * U.size(b).toLong())
        U.unite(a, b)
    }
    for (n in 0 until M) {
        println(ans[n])
    }
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt(offset: Int = 0) = listOfString().map { it.toInt() + offset}
class UnionFind(n: Int) {
    var rank: IntArray
    var par:  IntArray
    var size: IntArray
    init {
        this.rank = IntArray(n) { 0 }
        this.par  = IntArray(n) { it }
        this.size = IntArray(n) { 1 }
    }
    fun unite(x: Int, y: Int): Boolean {
        var rx = this.root(x)
        var ry = this.root(y)
        if (rx == ry) return false
        if (this.rank[rx] < this.rank[ry]) {
            val w = rx
            rx = ry
            ry = w
        } else if (this.rank[rx] == this.rank[ry]) {
            this.rank[rx] += 1
        }
        this.par[ry] = rx.toInt()
        this.size[rx] += this.size[ry]
        return true
    }
    fun find(x: Int): Int {
        if (this.par[x] == x) return x
        else {
            this.par[x] = this.find(this.par[x])
            return this.par[x]
        }
    }
    fun isSame(x: Int, y: Int): Boolean = this.root(x) == this.root(y)
    fun size(x: Int): Int = this.size[this.find(x)]
    fun root(x: Int): Int = this.find(x)
}

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

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

	int A,B,C;
	bool flag=false;
	int i,j;
	int tmp;
	int answer;
	int counter=0;
	double ave;
	vector<int> given;

	cin >> A >> B >> C;

	if(A==B && A!=C) flag=true;
	if(A==C && A!=B) flag=true;
	if(B==C && B!=A) flag=true;
	
	if(flag) cout << "Yes" << endl;
	if(!flag) cout << "No" << endl;

	return 0;
}



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

int N, a[100000];
string s;

void solve(){
  for(int i=1;i<N-1;i++){
    if(s[i]=='o'){
      if(a[i]==1) a[i+1]=a[i-1];
      else a[i+1]= a[i-1]==1?2:1;
    }else{
      if(a[i]==1) a[i+1]= a[i-1]==1?2:1;
      else a[i+1]=a[i-1];
    }
  }
  return;
}

bool judge(){
  for(int i=0;i<N;i++){
    int prev,next;
    if(i==0) prev=N-1;
    else prev=i-1;
    if(i==N-1) next=0;
    else next=i+1;
    if(s[i]=='o'){
      if(a[i]==1){
        if(a[prev]!=a[next]) return 0;
      }else{
        if(a[prev]==a[next]) return 0;
      }
    }else{
      if(a[i]==1){
        if(a[prev]==a[next]) return 0;
      }else{
        if(a[prev]!=a[next]) return 0;
      }
    }
  }
  return 1;
}

void print(){
  for(int i=0;i<N;i++){
    if(a[i]==1) cout<<"S";
    else cout<<"W";
  }
  cout<<endl;
  return;
}

int main(){
  cin>>N>>s;
  for(int i=1;i<=2;i++){
    for(int j=1;j<=2;j++){
      a[0]=i,a[1]=j;
      solve();
      if(judge()){
        print();
        return 0;
      }
    }
  }
  cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 896
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int x = scan.nextInt();
        int n = scan.nextInt();
        ArrayList<Integer> p = new ArrayList<>();
        for(int i = 0; i < n; i++) p.add(scan.nextInt());
        if(!p.contains(x)){
            System.out.println(x);
            return;
        }
        for(int i = 1; i <= 500; i++){
            if(!p.contains(x - i)){
                System.out.println(x - i);
                return;
            }else if(!p.contains(x + i)){
                System.out.println(x + i);
                return;
            }
        }
        scan.close();
    }
}

Measured memory_bytes: 27236
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	int n;
	cin >> n;
	VL count(n + 1, 0);
	V a(n);
	rep(i, n) {
		cin >> a[i];
		count[a[i]]++;
	}
	ll sum = 0;
	VL msum(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		sum += count[i] * (count[i] - 1) / 2;
	}
	rep(i, n) {
		ll ans = sum - (count[a[i]] * (count[a[i]] - 1) / 2);
		ans += (count[a[i]] - 1) * (count[a[i]] - 2) / 2;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 6528
while True :
    try :
        a = [int(_) for _ in input().split()]
        b = [int(_) for _ in input().split()]
        hit, blow = 0, 0
        for _ in range(4) :
            if a[_] == b[_] : hit += 1
            elif b[_] in a : blow += 1
        print(hit, blow)
    except : break


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

int main()
{
    int l,r,d,i,count=0;
    scanf("%d%d%d",&l,&r,&d);
    for(i=l;i<=r;i++)
    {
        if(i%d==0)
        {
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}


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

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

  if ((((N / 1000) == ((N / 100) % 10)) && (((N / 100) % 10) == ((N / 10) % 10)))
     ||(((N / 100) % 10) == ((N / 10) % 10)) && (((N / 10) % 10) == (N % 10))) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
 
int main()
{
	int n, m;
	std::cin >> n >> m;
 
	int r[ n ];
	std::memset( r, 0, sizeof( r ) );
 
	for( int i = 0; i < m; i++ ) {
		int a, b;
		std::cin >> a >> b;
 
		r[ a - 1 ] += 1;
		r[ b - 1 ] += 1;
	}
 
	for( int i = 0; i < n; i++ ) {
		std::cout << r[ i ] << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define int long long
void read (int &x) {
    char ch = getchar(); x = 0;
    while (!isdigit(ch)) ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
} const int N = 2e5 + 5;
int n, q, res;
struct tree {
    int c[N << 2], tag[N << 2];
    #define ls (p << 1)
    #define rs (p << 1 | 1)
    void build (int p, int l, int r) {
        if (l == r) { c[p] = n; return; }
        int mid (l + r >> 1);
        build (ls, l, mid), build (rs, mid + 1, r);
    }
    void push_down (int p) {
        if (c[p]) {
            if (c[ls] == 0 || c[ls] > c[p]) c[ls] = c[p];
            if (c[rs] == 0 || c[rs] > c[p]) c[rs] = c[p]; c[p] = 0;
        }
    }
    int query (int p, int l, int r, int pos) {
        if (l == r) return c[p];
        int mid (l + r >> 1), res; push_down (p);
        if (pos <= mid) res = query (ls, l, mid, pos);
        else res = query (rs, mid + 1, r, pos);
        return res;
    }
    void modify (int p, int l, int r, int ql, int qr, int v) {
        if (ql <= l && r <= qr) {
            if (c[p] == 0 || c[p] > v) c[p] = v;
            return;
        } int mid (l + r >> 1); push_down (p);
        if (ql <= mid) modify (ls, l, mid, ql, qr, v);
        if (qr > mid) modify (rs, mid + 1, r, ql, qr, v);
    }
} a, b;
signed main() {
    read (n), read (q);
    int o, x;
    a.build (1, 1, n);
    b.build (1, 1, n);
    res = (n - 2) * (n - 2);
    while (q--) {
        read (o), read (x);
        if (o == 1) {
            int w = a.query (1, 1, n, x);
            if (w >= 2) res -= (w - 2);
            if (w >= 2) b.modify (1, 1, n, 1, w - 1, x);
            // printf ("123 %lld %lld\n", w - 1, x);
            a.modify (1, 1, n, x, x, 1);
        } else {
            int w = b.query (1, 1, n, x);
            if (w >= 2) res -= (w - 2);
            if (w >= 2) a.modify (1, 1, n, 1, w - 1, x);
            // printf ("123 %lld\n", w);
            b.modify (1, 1, n, x, x, 1);
        }
        // printf ("%lld\n", res);
    }
    return printf ("%lld\n", res), 0;
}


Measured memory_bytes: 11700
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int dp[100010];

signed main()
{
    int N; cin>>N;
    REP(i,N+1) dp[i]=1e9;
    dp[0]=0;

    REP(i,N){
        for(int j=1;i+j<=N;j*=6) 
            dp[i+j]=min(dp[i+j],dp[i]+1);
        for(int j=1;i+j<=N;j*=9)
            dp[i+j]=min(dp[i+j],dp[i]+1);
    }
    cout<<dp[N]<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <numeric>
#include <tuple>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>
#include <type_traits>
#include <map>
#include <cstdio>
#include <string>

using namespace std;
using str = string;

#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define get cin>>
#define put cout<<

int gcd_euclid(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}

// 最大公約数算出
int calc_gcd(const vector<int> vec){
	int gcd = *min_element(vec.begin(), vec.end());
	for (const int ele: vec){
		gcd = gcd_euclid(gcd,ele);
	}
	return gcd;
}

// 最小公倍数
int calc_lcm(const vector<int> vec) {
	int tmp = 1;
	for (const int ele: vec){
		tmp *= ele;
	}
	int gcd = calc_gcd(vec);
	return tmp/gcd;
}

std::string join(const std::vector<std::string>& v, const char* delim = 0) {
  std::string s;
  if (!v.empty()) {
    s += v[0];
    for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) {
      if (delim) s += delim;
      s += v[i];
    }
  }
  return s;
}

// nが奇数、偶数の場合の場合分け
// n & 1 ? odd : even

// distinctはsortしてunique + erase
// https://qiita.com/ysk24ok/items/30ae72f4f1060b088588
//sort(vec.begin(), vec.end());
//vec.erase(unique(vec.begin(), vec.end()), vec.end());

void run() {
	int n,k;
	string s;

	get n; get s; get k;

	char m = s[k - 1];

	for(char& i : s) {
		if (i != m) {
			i = '*';
		}
	}

	put s;

}


int main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  
  public static void main (String[] args){
  
  	Scanner scanner = new Scanner (System.in);
    
    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int sum = 1;
    
    if (K <= 2){
      sum += K*N;
    } else {
      for (int i=0; i<N; i++){
        if (sum<K){
          sum=sum*2;
        } else {
          sum+=K;
        }
      }
    }
  
  	System.out.println(sum);
      
  }
}

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

long long X1, Y1, X2, Y2;
long long N, A[1 << 18], B[1 << 18];
long long S[1 << 18];

long long LIS(vector<long long>R) {
	for (int i = 0; i <= R.size(); i++) S[i] = -(1LL << 60);

	int sz = 0;
	for (int i = 0; i < R.size(); i++) {
		int pos1 = lower_bound(S, S + sz, R[i]) - S;
		if (pos1 == sz) sz++;
		S[pos1] = R[i];
	}
	return 1LL * sz;
}

int main() {
	cin >> X1 >> Y1 >> X2 >> Y2 >> N; bool flag = false; if (X1 > X2) { swap(X1, X2); flag ^= true; } if (Y1 > Y2) { swap(Y1, Y2); flag ^= true; }
	for (int i = 0; i < N; i++) cin >> A[i] >> B[i];

	if (X1 == X2 || Y1 == Y2) {
		long double TEISUU = 31.41592653589793238L - 20.0L;
		long double SCORE = 100.0L * (abs(X1 - X2) + abs(Y1 - Y2));
		for (int i = 0; i < N; i++) {
			if (X1 <= A[i] && A[i] <= X2 && Y1 <= B[i] && B[i] <= Y2) SCORE += TEISUU;
		}
		printf("%.12Lf\n", SCORE);
	}
	else {
		vector<pair<long long, long long>>C; vector<long long>D;
		for (int i = 0; i < N; i++) {
			if (X1 <= A[i] && A[i] <= X2 && Y1 <= B[i] && B[i] <= Y2) C.push_back(make_pair(A[i], B[i]));
		}
		sort(C.begin(), C.end());
		for (int i = 0; i < C.size(); i++) D.push_back(C[i].second);
		if (flag == true) reverse(D.begin(), D.end());

		long long I = LIS(D);
		long double F1 = 100.0L * (abs(X1 - X2) + abs(Y1 - Y2));
		long double F2 = 1.0L * (40.0L - 31.41592653589793238L) * I / 2.0L;
		long double F3 = 0.0L;
		if (I == min(X2 - X1 + 1LL, Y2 - Y1 + 1LL)) {
			F3 = 0.5L * 31.41592653589793238L;
		}
		printf("%.12Lf\n", F1 - F2 + F3);
	}
	return 0;
}

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

const int MOD = 1e9+7;
long long fact[200005];

long long fast_exp(long long x, long long y){
	long long ret=1;
	while(y){
		if(y&1) ret=ret*x%MOD;
		y>>=1;
		x=x*x%MOD;
	}
	return ret;
}

long long comb(int n, int r){
	return fact[n]*fast_exp(fact[r]*fact[n-r]%MOD,MOD-2)%MOD;
}

int main()
{
	ios_base::sync_with_stdio(0);

	long long h,w,a,b;
	cin >> h >> w >> a >> b;

	fact[0]=fact[1]=1;
	for(int i=2;i<=h+w;i++)
		fact[i]=i*fact[i-1]%MOD;

	int rep=min(h-a,w-b);
	long long ans=0;
	for(int k=0;k<rep;k++){
		int n=h+b-a-1;
		int r=b+k;
		long long temp = comb(n,r);
		n=w+a-b-1;
		r=a+k;
		temp=temp*comb(n,r)%MOD;
		ans=(ans+temp)%MOD;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
main :: IO()
main = do
  inputs <- getContents
  let specs = [ map (\x ->read x ::Int) $ words line | line <- lines inputs, length(line) > 0]
  mapM_ drawRect specs

drawRect :: [Int] -> IO()
drawRect [h,w]
         | (h,w) == (0,0) = return()
         | otherwise = do putStrLn $ concat $ replicate h $ concat $ (replicate w "#") ++ ["\n"]

Measured memory_bytes: 4616
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, m;
    while(cin >> n >> m, n){
        auto f = [&](int n, int m, auto &&f) -> int{
            if(n == 1) return 0;
            return (f(n-1, m, f)+m)%n;
        };
        printf("%d\n", f(n, m, f)+1);
    }
    return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
inline void print() { cout << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
string reversed(string& s) {
    string t = s;
    reverse(all(t));
    return t;
}
int main() {
    init();

    int n, k; cin >> n >> k;
    string s; cin >> s;
    FOR(i, 0, min(k, 13)) {
        string u = s + reversed(s);
        FOR(j, 0, n + 1)chmin(s, u.substr(j, n));
        reverse(all(s));
    }
    print(reversed(s));
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi; 
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(int i=vv;i<n;i++)
#define FORR(i,n,vv) for(int i=n-1;i>=vv;i--)
#define ve vector 
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define INF 1000000000000000000ll
#define PRECISE cout.precision(18);
#define all(v) v.begin(),v.end()
#define BS(v,n) binary_search(all(v),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(all(v),greater <ll>())
#define uni(v) v.resize(unique(all(v))-v.begin())
#define F first
#define S second
#define GET(i,p) get<p>(i)

int main(){

	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt	
 //    freopen("input.txt", "r", stdin);
 //    // for writing output to output.txt
 //    freopen("output.txt", "w", stdout);
	// #endif	

    FAST
//	PRECISE

ll n;
cin>>n;
ll xo=0;
ve <ll> v(n,0);
FOR(i,0,n)
cin>>v[i],xo^=v[i];
FOR(i,0,n)
cout<<(v[i]^xo)<<endl;

return 0;
 }

Measured memory_bytes: 4740
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<set>
#include<vector>
#define INF 100000000

#define MAX_H 300
#define MAX_W 301

typedef long long int ll;
using namespace std;



int main(){

	int H,W;

	while(true){
	
		scanf("%d %d", &H, &W);

		if(H == 0 && W == 0)
			break;
		else{
		
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					if(i%2 == 0 && j%2 == 0){
						printf("#");
					}
					else if(i%2 == 0 && j%2 != 0){
						printf(".");
					}
					else if(i%2 != 0 && j%2 == 0){
						printf(".");
					}
					else
						printf("#");

				}
				printf("\n");
			}
		
			printf("\n");
		
		}
	
	}


	return 0;

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;


 int ans1,ans2;

 int arr[1000];


int32_t main()
{


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

    
    int a,b,k;
    cin >> a >> b >> k;

    set<int> ans;

    for(int i = a; i <= a + k -1 and i <= b; i++)
    {
      ans.insert(i);
    }

    for(int i = b; i >=a and i >= b-k+1; i--)
    {
      ans.insert(i);
    }

    for(auto &i : ans)
    {
      cout << i << endl;
    }



    return 0;   
}


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

int main() {
    int A, B;
    string S,ans = "Yes\n";
    cin >> A >> B >> S;
    rep(i, A + B + 1) {
        if (i == A) {
            if (S[i] != '-') ans = "No\n";
        } else {//ハイフン以外のところ
            if (S[i] < '0' || S[i] > '9') ans = "No\n";
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll N;
  cin >> N;
  vll A(5, 0);
  for(int i = 0; i < N; i++){
    string S;
    cin >> S;
    if(S.at(0) == 'M') A.at(0)++;
    if(S.at(0) == 'A') A.at(1)++;
    if(S.at(0) == 'R') A.at(2)++;
    if(S.at(0) == 'C') A.at(3)++;
    if(S.at(0) == 'H') A.at(4)++;
  }
  ll ans = 0;
  for(int i = 0; i < 3; i++){
    for(int j = i+1; j < 4; j++){
      for(int k = j+1; k < 5; k++){
        ans += A.at(i) * A.at(j) * A.at(k);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTG(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL((a))), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define ENDL cout << endl;
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VI = vector<int>;
using VVI = vector<VI>;
using Vll = vector<ll>;
using VVll = vector<Vll>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  VI A(N), B(N), C(N-1);
  REP(i, N)
  {
    cin >> A.at(i);
    A.at(i)--;
  }
  REP(i, N) cin >> B.at(i);
  REP(i, N-1) cin >> C.at(i);
  int ans = 0;
  REP(i, N)
  {
    ans += B.at(A.at(i));
    if (i == N-1) continue;
    if (A.at(i+1) == A.at(i) + 1) ans += C.at(A.at(i));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
    ll n , m;
    cin >> n >> m;
    ll ans = 0;
    if(n * 2 > m) {
        ans += m / 2;
    }
    else {
        ans += n;
        ans += (m - n * 2) / 4;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_089_A.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 N      PIC 9(4).
    01 tmp    PIC 9(4).
    01 ZS     PIC Z(3)9.
    01 ans    PIC X(3).
    01 DUMMY  PIC X(1).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT N.

    DIVIDE 3 INTO N GIVING tmp.

    MOVE tmp TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 764
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	int ans = 0;
	for (string s; cin >> s; ) {
		string r = s;
		reverse(all(r));
		if(s == r) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 0