akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	N := ReadInt()
	h := ReadInts(N)

	ans := 0
	for l := 0; l < N; l++ {
		for h[l] > 0 {
			ans++
			for r := l; r < N && h[r] > 0; r++ {
				h[r]--
			}
		}
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1844
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        mut v: [i64; n],
    }
    for i in 0..v.len()-1{
        print!("{} ", v[v.len()-1-i]);
    }
    println!("{}", v[0]);
}


Measured memory_bytes: 5024
#include <bits/stdc++.h>
#define mod 998244353
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto i:a) cout << i << " "; cout << endl
#define adb2(a) for(auto i:a) cout << i.first << " " << i.second << endl;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define N 500010
using namespace std;

int main()
{
    fastIO;
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    if((a+d-1)/d >= (c+b-1)/b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	string S;
	cin >> S;
	ll Q;
	cin >> Q;
	vector<int> T(Q), F(Q, -1);
	vector<char> C(Q, 0);
	for (ll i = 0; i < Q; ++i)
	{
		cin >> T[i];
		if (T[i] == 2)
		{
			cin >> F[i] >> C[i];
			cin.ignore();
		}
	}
	bool rev = false;
	deque<char> que;
	for (const char c : S)
	{
		que.push_back(c);
	}
	for (ll i = 0; i < Q; ++i)
	{
		if (T[i] == 1)
		{
			rev = !rev;
		}
		else
		{
			if ((F[i] == 1 && !rev) || (F[i] == 2 && rev))
			{
				que.push_front(C[i]);
			}
			else
			{
				que.push_back(C[i]);
			}
		}
	}
	while (!que.empty())
	{
		if (rev)
		{
			cout << que.back();
			que.pop_back();
		}
		else
		{
			cout << que.front();
			que.pop_front();
		}
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 2688
function main(input){
    const lines = input.split('\n');
    const length = parseInt(lines[0]);
    const nums = lines.slice(1,-1);
    let min=parseInt(nums[0]);
    let max=parseInt(nums[1])-parseInt(nums[0])
    
    for(let i=1;i<length;i++){
        let diff = parseInt(nums[i])-min;
        if(diff>max){
            max = diff;
        }
        if(min>parseInt(nums[i])){
            min = nums[i];
        }

    }
    console.log(max);
    
    
}

main(require("fs").readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 35520
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let s: String = sc.read();
    let t: String = sc.read();
    println!("{}{}", t, s);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(){
  int i,n;
  int F[45];
  scanf("%d", &n);
  F[0] = 1;
  F[1] = 1;
  for(i = 2;i <= n;i++){
    F[i] = F[i-1] + F[i-2];
  }
    printf("%d\n", F[n]);
    return 0;
}
    

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int s;
    cin >> s;
    set<int> seen;
    for(int i = 1; ; i++) {
        if(seen.count(s)) {
            cout << i << endl;
            return 0;
        } else {
            seen.insert(s);
            if(s % 2) {
                s = 3 * s + 1;
            } else {
                s /= 2;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
def C():
    N, P = map(int, input().split())
    i = 2
    key = -1
    import math
    if N == 1:
        key = 1
    if key == 1:
        ans = P
    else:
        tmplist = [0 for i in range(int(math.sqrt(P)) + 1)]
        i = 2
        originarlP = P
        while True:
            if P % i == 0:
                #print(i)
                tmplist[i] += 1
                P /= i
            else:
                i += 1
            if P == 1 or i * i >= originarlP + 1:
                break
        ans = 1
        #print(tmplist[:20])
        for i in range(len(tmplist)):
            while tmplist[i] >= N:
                ans *= i
                tmplist[i] -= N
    print(ans)
C()

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

using namespace std;

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

	vector<int> A(N, 0);
	for (int i = 0; i < N; ++i)
		cin >> A[i];

	int min, count = 0;
	for (int i = 0; i < N; ++i)
	{
		min = i;
		for (int j = i; j < N; ++j)
			if (A[j] < A[min])
				min = j;

		if (i != min)
		swap(A[i], A[min]), count++;
	}

	for (int i = 0; i < N; ++i) {
		cout << A[i];
		i < N - 1 ? cout << " " : cout << endl;
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    string A;
    cin >> A;
    ll N = sz(A);
    vector<vector<ll>> s(26, vector<ll>(N+1, 0));
    rep(i, N){
        rep(j, 26){
            if(j == A.at(i)-'a'){
                s.at(j).at(i+1) = s.at(j).at(i)+1;
            }
            else{
                s.at(j).at(i+1) = s.at(j).at(i);
            }
        }
    }
    ll ans = 0;
    rep(i, N){
        rep(j, 26){
            if(j == A.at(i) - 'a'){
                continue;
            }
            ans += s.at(j).at(N) - s.at(j).at(i+1);
        }
    }
    cout << ans+1 << endl;
}

Measured memory_bytes: 45892
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ll mod;



int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt = 89;
	while (kkt) {
		string s; cin >> s; if (s == "#") break;
		ll y, m, d; cin >> y >> m >> d;
		if (y > 31 or (y == 31 && m > 4)) {
			cout << "? " << y - 30 << " " << m << " " << d << "\n";
		}
		else {
			cout << s << " " << y << " " << m << " " << d << "\n";
		}
	}
	return 0;

}


Measured memory_bytes: 3192
import math
a = []
mini = 9
flag = False
for i in range(5):
    x = int(input())
    if x%10==0:
        a.append(x)
    else:
        flag = True
        if x%10<mini :
            mini = x%10
        a.append(math.ceil(x/10)*10)

if flag:
    print(sum(a)-(10-mini))
else:
    print(sum(a))

Measured memory_bytes: 9100
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    ll N; cin>>N;
    ll tmp=N%1000;
    if(tmp==0) cout<<0<<endl;
    else cout<<1000-tmp<<endl;
    
}



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

using ll = long long;
using pii = pair<int, int>;

int main()
{
    int N; cin >> N;
    vector<vector<pii>> G(N);
    for (int i = 0; i < N-1; i++) {
        int u, v, w; cin >> u >> v >> w;
        u--; v--;
        G[u].push_back(make_pair(v, w));
        G[v].push_back(make_pair(u, w));       
    }
    vector<ll> dist(N, -1);
    queue<int> q;
    q.push(0);
    dist[0] = 0;
    while (!q.empty()) {
        int u = q.front(); q.pop();
        for (const auto& p : G[u]) {
            const int& v = p.first;
            const int& w = p.second;
            if (dist[v] != -1) continue;
            q.push(v);
            dist[v] = dist[u] + w;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << (dist[i] % 2) << endl;
    }
}


Measured memory_bytes: 7168
n = int(input())
AB = sorted([list(map(int,input().split())) for i in range(n)],key=lambda x:x[1])
# print(AB)
tmp=0
for a,b in AB:
	if tmp+a<=b:
		pass
	else:
		print("No")
		exit()
	tmp+=a
print("Yes")

Measured memory_bytes: 55264
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			for(;;) {
				int n = sc.nextInt();
				if(n==0) break;
				double sum = 0;
				int[] scores = new int[n];
				for(int i=0;i<n;i++) {
					scores[i] = sc.nextInt();
					sum += scores[i];
				}
				double avg = sum / n;
				sum = 0;
				for(int i=0;i<n;i++) {
					sum += Math.pow(scores[i]-avg,2);
				}
				System.out.println(Math.sqrt(sum/n));
			}
		}
	}
}


Measured memory_bytes: 31648
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

int main() {
  ll n;
  cin>>n;
  n--;
  string s;
  ll t = 1;
  FOR(i, 1, 10000000) {
    t *= 26;
    int x = n%26;
    s.push_back('a'+x);
    n /= 26;
    n--;
    if (n<0) break;
  }
  reverse(all(s));
  cout << s << endl;

  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200005;
long long f[maxn], s[maxn];
long long ans;
 
int main(){
    int n, x; cin >> n;
    for(int i = 1; i <= n; i++){
        scanf("%d", &x);
        f[i] = f[i-1] + x;
        s[i] = s[i-1] ^ x;
    }
    int l = 1;
    ans=0;
    for(int r = 1; r <= n; r++){
        for(; f[r] - f[l-1] != (s[r] ^ s[l-1]); l++);
        ans += r - l + 1;
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main() {
  for (int n, k, s; cin >> n >> k >> s, n;) {
    int ans = 0;
    REP(b, 1 << n) {
      if (__builtin_popcount(b) != k) continue;
      int sum = 0;
      REP(i, n) {
        if (b >> i & 1) sum += i + 1;
      }
      if (sum == s) ans++;
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3000
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int R,G;
  cin >> R >> G;;
  
  if(R%2==0 && G%2==0||R%2==1 && G%2==1){
      cout << (R + G)/2 << endl;
  }else{
      cout << (R + G)/2 + 1 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int test[150]={0};
void find()
{
    int i,flag=0;
    for(i=97;i<123;i++)
    {
        if(test[i]==0)
        {  printf("%c",char(i));flag=1;break;}
    }

    if(flag==0)
        printf("None\n");
        else printf("\n");
}
int main()
{
    int i=0;
    char a;
    while(scanf("%c",&a)!=EOF)
{   memset(test,0,sizeof(test));
    test[(int)a]=1;
    while(scanf("%c",&a)&&a!='\n')
    {

        test[(int)a]=1;
    }
    find();
}
    return 0;

}


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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int n; cin >> n;
  vector<int> a(n), b(n);
  for (auto &i : a) cin >> i;
  for (auto &i : b) cin >> i;
  int c = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] > b[i]) {
      c += a[i] - b[i];
      b[i] = a[i];
    }
  }
  for (int i = 0; i < n; i++) {
    c -= min(c, max(0ll, (b[i] - a[i]) / 2));
  }
  if (c) cout << "No" << '\n';
  else cout << "Yes" << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "- ---- -- ----- <3\n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


Measured memory_bytes: 3752
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 


int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
int h,w,K;
int sy,sx;
int res=1e8;
bool vis[800][800];
void bfs(vector<string> &a,int y,int x){

	
	vis[y][x]=true;
	int d=min({y,x,h-y-1,w-x-1});
	res=min(res,(d+K-1)/K);

	for(int i=0;i<4;i++){
		int ny=y+dy[i],nx=x+dx[i];
		if(0<=ny && ny<h && 0<=nx && nx<w && !vis[ny][nx] && a[ny][nx]!='#' && abs(sy-ny)+abs(sx-nx)<=K ){
			bfs(a,ny,nx);
		}
	}


}

int main(){

	
	cin>>h>>w>>K;

	vector<string> a(h);
	
	for(int i=0;i<h;i++){
		cin>>a[i];
		for(int j=0;j<w;j++){
			if(a[i][j]=='S') sy=i,sx=j;
		}
	}
	
	bfs(a,sy,sx);
	cout<<res+1<<endl;

	return 0;
}

Measured memory_bytes: 57472
/*for better*/
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define f(i,a,b) for(i=a;i<b;i++)
#define fr(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007
#define M 998244353
using namespace std;

ll dp[100][100005];

int main()
{
    fast; 
    ll n,k,i,j;
    cin>>n>>k;
  	ll a[n+1];
  	f(i,0,n)
  		cin>>a[i];

  	// sort(a,a+n);

  	f(j,0,a[0]+1)
  		dp[0][j]=1;
  	f(i,0,n)
  		dp[i][0]=1;

  	f(i,1,n)
  	{
  		f(j,1,k+1)
  		{
  			if(a[i]>=j)
  				dp[i][j]=(dp[i][j-1] + dp[i-1][j])%mod;
  			else dp[i][j]=(dp[i-1][j]+((dp[i][j-1]-dp[i-1][j-a[i]-1])+mod)%mod)%mod;
  		}
  	}
  	cout<<dp[n-1][k];
  	// f(i,0,n)
  	// {
  	// 	f(j,0,k+1)
  	// 		cout<<dp[i][j]<<' ';
  	// 	cout<<endl;
  	// }
}



Measured memory_bytes: 78336
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static void swap(ref long x, ref long y)
        {
            var tmp = x;
            x = y;
            y = tmp;
        }


        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var s = Console.ReadLine();
            if (s[2] == s[3] && s[4] == s[5])
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            
            
            

            

        Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      string s,t; cin >>s >>t;
      vector<char> a(s.size()), b(t.size());
      for (int i=0; i<s.size(); i++) a.at(i) = s.at(i);
      for (int i=0; i<t.size(); i++) b.at(i) = t.at(i);
      sort(a.begin(), a.end());
      sort(b.begin(), b.end());
      reverse(b.begin(), b.end());
      
      bool same = true;
      for (int i=0; i<min(a.size(), b.size()); i++){
        if (a.at(i)<b.at(i)){
          cout <<"Yes" <<endl;
          same = false;
          break;
        }else if (a.at(i)>b.at(i)){
          cout <<"No" <<endl;
          same = false;
          break;
        }
      }
      if (same){
        if (a.size() < b.size()) cout <<"Yes" <<endl;
        else cout <<"No" <<endl;
      }
      
    }

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cassert>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pii;
const int N = 500;
char m[N][N+1];
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};

bool cango(int r,int c,int y,int x,int ty,int tx){
  rep(i,4){
    int ddx=x+dx[i],ddy=y+dy[i];
    while(ddy != -1 && ddx != -1 && ddy != r && ddx != c){
      if (m[ddy][ddx] != '.')break;
      if (ddy == ty && ddx == tx)return true;
      ddx+=dx[i];
      ddy+=dy[i];
    }
  }
  return false;
}

bool erase(int r,int c,int y1,int x1,int y2,int x2){
  vector<int> tx,ty;
  if (y1 == y2){
    tx.push_back(x1 < x2?x1+1:x2+1);
    ty.push_back(y1);
  }else if (x1 == x2){
    tx.push_back(x1);
    ty.push_back(y1 < y2?y1+1:y2+1);
  }else {
    tx.push_back(x1);
    ty.push_back(y2);
    tx.push_back(x2);
    ty.push_back(y1);
  }
  bool isok=false;
  rep(i,(int)tx.size()){
    if (cango(r,c,y1,x1,ty[i],tx[i]) && cango(r,c,y2,x2,ty[i],tx[i])){isok=true;break;}
  }
  if (isok)m[y1][x1]=m[y2][x2]='.';
  return isok;
}

int main(){
  int r,c;
  while(cin>>r>>c){
    rep(i,r)cin>>m[i];
    vector<pii> in[26];
    rep(i,r){
      rep(j,c){
	if (!isalpha(m[i][j]))continue;
	in[m[i][j]-'A'].push_back(make_pair(i,j));
      }
    }
    int ans=0;
    while(true){
      bool iserased=false;
      rep(i,26){
	if (in[i].size() == 0)continue;
	if (abs(in[i][0].first-in[i][1].first)+abs(in[i][0].second-in[i][1].second) == 1)in[i].clear();
	if (erase(r,c,in[i][0].first,in[i][0].second,in[i][1].first,in[i][1].second))ans+=2,iserased=true,in[i].clear();
      }
      if (!iserased)break;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <array>
using namespace std;
int
main ()
{
  array < int, 3 > ar;
for (auto & e:ar)
    cin >> e;
  sort (ar.begin (), ar.end ());
  cout << ar[0] << " " << ar[1] << " " << ar[2] << endl;
}

Measured memory_bytes: 1176
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	char s[51][51];
	int n;
	cin >> n;
	rep(i, n) {
		cin >> s[i];
		sort(s[i], s[i] + strlen(s[i]));
	}
	int ans = 0;
	int tmp = 0;
	rep(i, (int)strlen(s[0])) {
		rep(j, n) {
			if (j == 0) {
				continue;
			}
			rep(k, (int)strlen(s[j])) {
				if (s[j][k] == s[0][i]) {
					s[j][k] = '1';
					break;
				}
				if (s[j][k] > s[0][i]) {
					tmp = 1;
					break;
				}
				s[j][k] = '1';
				if (k == strlen(s[j]) - 1) {
					tmp = 1;
					break;
				}
			}
			if (tmp == 1) {
				break;
			}
			tmp = 0;
		}
		if (tmp == 0) {
			cout << s[0][i];
			ans++;
		}
		tmp = 0;
	}
	if (ans != 0) {
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<double, int> P;
const int INF = 1e9;
const int W = 20;

int N;

double get_time(int b, int bef, int now, vector<int> &num, vector<int> &dist, vector<int> &cnt){
  int w = 0;
  REP(i, N) if(1 & (b >> i)) w += cnt[i];
  w *= 20;
  int d = abs(dist[bef] - dist[now]);
  return d / (2000.0 / (70 + w));
}

int main() {
  cin >>N;
  vector<int> num(N), dist(N), cnt(N);
  REP(i, N) cin >>num[i] >>dist[i] >>cnt[i];
  vector< vector<P> > dp((1 << N), vector<P>(N, P(INF, INF)));
  REP(i, N) dp[(1 << i)][i] = P(0.0, -1);
  REP(b, (1 << N)){
    REP(bef, N){
      if(dp[b][bef].first == INF) continue;
      REP(now, N){
        if(1 & (b >> now)) continue;
        double t = get_time(b, bef, now, num, dist, cnt);
        int nb = b | (1 << now);
        dp[nb][now] = min(dp[nb][now], P(dp[b][bef].first + t, bef));
      }
    }
  }
  int tar = 0, bit = (1 << N) - 1;
  FOR(i, 1, N) if(dp[bit][i].first < dp[bit][tar].first) tar = i;
  vector<int> ans;
  ans.push_back(tar);
  while(dp[bit][tar].second != -1){
    int nbit = bit & ~(1 << tar), ntar = dp[bit][tar].second;
    ans.push_back(ntar);
    tar = ntar;
    bit = nbit;
  }
  REVERSE(ans);
  REP(i, ans.size()) cout <<(i != 0 ? " " : "") <<num[ans[i]];
  cout <<endl;
  return 0;
}

Measured memory_bytes: 9980
main :: IO ()                                                                                                                                         
main = do                                                                                                                                             
  _ <- getLine                                                                                                                                        
  s <- getLine                                                                                                                                        
  k <- readLn :: IO Int                                                                                                                               
  let c = s !! (k-1)                                                                                                                                  
  putStrLn $ map (\x -> if x/=c then '*' else x) s

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

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;

	int result = N * X;
	if (N > K) result -= (X - Y) * (N - K);
	cout << result;
}

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

namespace WelcomeAtcordet
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            string[] search = new string[N];
            string ans = null;

            for (int i = 0; i < N; i++)
            {
                search[i] = Console.ReadLine();
            }

            Array.Sort(search);

            foreach (string s in search)
            {
                ans += s;
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13408
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int INF = 2147483600;

int N; LL ans,lst,mn;

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); mn=1;
	for(int i=1;i<=N;i++){
		LL x=read();
		if(i-x<mn) { puts("-1"); return 0; }
		if(i-x==mn) {lst=x; continue;}
		mn=i-x; ans+=lst; lst=x; 
	} printf("%lld\n",ans+lst);
	return 0;
}




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

int main() {
    int N; cin >> N;
    map<string, bool> dic;
    char b;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        if (dic[s]) {
            cout << "No" << endl;
            return 0;
        } else dic[s] = true;
        if (i > 0) {
            if (b != s.at(0)) {
                cout << "No" << endl;
                return 0;
            }
        }
        b = s.at(s.size()-1);
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <cassert>
#include <memory>

using namespace std;


int solve_(
    int i,
    std::unique_ptr<int[]>& table,
    std::unique_ptr<int[]>& num_sols
) {
    //段番号iが破損している場合は、到達できる組み合わせは0個
    if (table[i]==1) {
        return 0;
    }

    assert(i > 0);
    if (i==1) {
        return table[1]==1 ? 0 : 1;
    } else if (i==2) {
        auto x = table[2]==1 ? 0 : 1;
        auto y = solve_(1, table, num_sols);
        //cout << "x:" << x << " y:" << y << endl;
        return x + y;
    } else if (i>2) {
        auto x = num_sols[i-1] != -1 ?
            num_sols[i-1] :
            solve_(i-1, table, num_sols);
        auto y = num_sols[i-2] != -1 ?
            num_sols[i-2] :
            solve_(i-2, table, num_sols);
        return x + y;
    }
}

/**
 * N: 階段段数 
 * a: 破損段番号を格納する数列. 1<= a[1] < a[2] < ... < a[m] <= N-1の数列
 */
int solve(int n, std::vector<int>& a) {
    auto table = std::make_unique<int[]>(n);
    for(int i=0; i<a.size(); i++) {
        const int idx = a[i];
        assert(idx<n);
        table[idx] = 1;
    }
    auto num_sols = std::make_unique<int[]>(n + 1);
    for (int i=0; i<n+1; i++) {
        num_sols[i] = -1;
    }

    // 高橋さんの初期位置を段番号0として、
    // 段数iに昇段するための組み合わせを計算する.
    // 例えば、i=1の場合は、段数１の階段を表す.
    for(auto i=1; i<=n; i++) {
        auto n = solve_(i, table, num_sols);
        //std::cout << "i:" << i << " n:" << n << endl;
        num_sols[i] = n  % 1000000007;
    }
    return num_sols[n];
}

int main(int argc, char const *argv[])
{
    int n,m;
    cin >> n >> m;
    if(n > 100000){
        return -1;
    }
    if(m >= n){
        return -1;
    }

    // Parse a[0] .. a[N-1]
    vector<int> a;
    for(int i=0; i<m; i++){
        unsigned int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    const auto result = solve(n, a);
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl <<"\n"
#define con continue
#define br break
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
ll mx=INT_MAX;
ll mi=INT_MIN;
const ll MOD=998244353;
const ll inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
#define io { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

int main()
{
        io;
        //////////////////////////////////
        ll n,i,j,s=0,p=0;
        vll v(10000001);
        cin>>n;
        for(i=1;i<=n;i++)
        {
            v[i]=2;
        }
        v[1]=1;
        for(i=2;i*i<=n;i++)
        {
            for(j=i*i;j<=n;j=j+i) {v[j]=v[j]+2;
                if(j==i*i) v[j]--;
            }
        }
        for(i=1;i<=n;i++) s=s+i*v[i];
        cout<<s;
        //////////////////////////////////
        cer;
}


Measured memory_bytes: 81268
#include "bits/stdc++.h"

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<string> s(n);
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	int m;
	cin >> m;
	vector<string>t(m);
	for (int i = 0; i < m; i++)
	{
		cin >> t[i];
	}

	int ans = 0;
	for (auto item:s)
	{
		int tmp = 0;
		for (auto blue:s)
		{
			if (item == blue) tmp++;
		}
		for (auto red : t)
		{
			if (item == red) tmp--;
		}
		ans = max(ans, tmp);
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;
using namespace __gnu_pbds;

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

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;

const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 13;
const int M = 1e6 + 123;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

int main(){
    #ifdef KAZAKH
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    if (n&1){
        cout << "No";
        return 0;
    }
    n/= 2;
    //cout << s.substr(0, n);
    if (s.substr(0, n) == s.substr(n, n)){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
//	-*- mode: C++ -*-
//	Print a Rectangle
//		Draw a rectangle which has a height of H cm and a width of W cm. Draw a 1-cm square by single '#'.
//
//	Input
//		The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.
//
//		The input ends with two 0 (when both H and W are zero).
//
//	Output
//		For each dataset, print the rectangle made of H × W '#'.
//
//		Print a blank line after each dataset.
//
//	Constraints
//		1 ≤ H, W ≤ 300
//
//	Sample Input
//		3 4
//		5 6
//		2 2
//		0 0
//	Sample Output
//		####
//		####
//		####
//
//		######
//		######
//		######
//		######
//		######
//
//		##
//		##

#include <iostream>
#include <vector>

int	main(int	argc,
		 char*	argv[])
{
	unsigned int	h	{0};
	unsigned int	w	{0};
	std::vector<std::pair<unsigned int, unsigned int> >	v	{};

	for(;;){
		std::cin >> h >> w;

		if((h == 0) && (w == 0)){
			break;
		}

		v.push_back(std::make_pair(h, w));
	}

	for(std::pair<unsigned int, unsigned int> p : v){
		for(unsigned int i = 0; i < p.first; i++){
			for(unsigned int j = 0; j < p.second; j++){
				std::cout << '#';
			}
			std::cout << '\n';
		}
		std::cout << '\n';
	}
}



Measured memory_bytes: 3088
var input= require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=input.split("\n");
var str="";
for(var i=0;i<Arr.length;i++){
var arr=Arr[i].split(" ");
var a=arr[0]-0;
var b=arr[1];
var c=arr[2]-0;
if(b==="?")break;
if(b==="+")str+=a+c;
if(b==="-")str+=a-c;
if(b==="*")str+=a*c;
if(b==="/")str+=Math.floor(a/c);
str+="\n";
}
console.log(str.trim());

Measured memory_bytes: 7644
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve(ll N) {
  vector<ll> sq(100000);
  REP(i,100000) sq[i] = ll(i) * i;
  cout << *prev(upper_bound(ALL(sq), N)) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	solve(N);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    string s;
    cin >> s;
    bool flag = 0;
    for (int i = 1; i < s.size(); i++)
    {
        if (s.at(i)==s.at(i-1))
        {
            flag = 1;
        }
        
    }

    if (flag)
    {
        cout << "Bad" << endl;
    }else
    {
        cout << "Good" << endl;
    }
    
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt();
    set <int> s;
    while(n--)
    {
        int x=nxt();
        if(s.count(x))
            s.erase(x);
        else
            s.insert(x);
    }
    cout<<s.size()<<endl;
    
    
    
    return 0;   
}




 
 


Measured memory_bytes: 4992
package main
import(
  "fmt"
  "bufio"
  "os"
  "strconv"
)
var sc=bufio.NewScanner(os.Stdin)
func nextInt() int{
  sc.Scan()
  i, e :=strconv.Atoi(sc.Text())
  if e!=nil{
    panic(e)
  }
  return i
}
func main(){
  var i int
  sc.Split(bufio.ScanWords)
  n:=nextInt()
  a:=make([]int, n)
  for i=0;i<n;i++{
    a[i]=nextInt()
  }
  ans:=0
  for{
    for i=0;i<n;i++{
      if a[i]%2==0{
        a[i]/=2
      }else{
        fmt.Println(ans)
        return
      }
    }
    ans++
  }
}


Measured memory_bytes: 640
(let ((a (make-array 0 :element-type 'integer
                       :adjustable t
                       :fill-pointer 0))
      k
      (flg t))
     (dotimes (i 5)
       (vector-push-extend (read) a))
     (setf k (read))
     (loop for i from 0 upto 3
           do (loop for j from (1+ i) upto 4
                    do (if (> (abs (- (aref a i) (aref a j))) k) (setf flg nil))))
     (princ (if flg "Yay!" ":(")))

Measured memory_bytes: 12520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int a[5], k;

int main()
{
    for (int i = 0; i < 5; i++)
    {
        cin >> a[i];
    }
    cin >> k;
    if (a[4] - a[0] > k)
        cout << ":(" << endl;
    else
        cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    int st,e;
    string s;
    cin>>s;
    int l=s.length();
    for(int i=0;i<l;i++)
    {
        if(s[i]=='A')
        {
            st=i+1;
            break;
        }
    }
    for(int i=0;i<l;i++)
    {
        if(s[i]=='Z')
        {
            e=i+1;
        }
    }
    cout<<e-st+1<<endl;
    return 0;
}



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

public class Main {
    Stack<String> stack = new Stack<String>();

    String clear(String line){
        String res = "";
        for(int i=0; i<line.length(); i++){
            char c = line.charAt(i);
            if( c == '(' || c == ')' || c == '[' || c == ']' || c == '.'){
                res += String.valueOf(c);
            }
        }
        return res;
    }

    public static void main(String[] args){
        Main m = new Main();
        m.run();
    }


    void run(){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        while(true){
            String line = ".";

            try{
                line = br.readLine();
            }catch(IOException e){ }

            // end
            if(line.charAt(0) == '.'){
                break;
            }

            line = clear(line);  // カッコとドットだけにする

            
            if(line.length() == 1){ // >>  .
                System.out.println("yes");
                continue;
            }else if(line.length()%2 == 0){  // .の分+1
                
                System.out.println("no");
                continue;
            }

            // 1文字毎のチェック
            boolean f = true;
            stack = new Stack<String>();
            for(int i=0; i<line.length(); i++){
                f = true;
                String s = line.substring(i, i+1);
                
                if(s.equals(".")){
                    f = stack.empty();
                    
                    break;
                }else if(s.equals("(") || s.equals("[")){  // push
                    stack.push(s);
                }else{
                    String head = "";
                    try{
                        head = stack.pop();
                    }catch(EmptyStackException e){  // あまりが出た
                        f = false;
                        
                        break;
                    }
                    if(head.equals("(") && s.equals("]") || head.equals("[") && s.equals(")")){  // ちぐはぐ
                        f = false;
                        
                        break;
                    }
                }
                
            }
            if(f){
                System.out.println("yes");
            }else{
                System.out.println("no");
            }

        }

    }

}

Measured memory_bytes: 57504
#include<stdio.h>

int main(void)
{
	int n,d;
	scanf("%d%d",&n,&d);
	
	if(n%(2*d+1)==0)
		printf("%d",n/(2*d+1));
	else
		printf("%d",n/(2*d+1)+1);
	return 0;
}

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

int main(){
  int a,b,c,x;
  cin >> a >> b >> c >> x;
  int count=0;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        if(500*i+100*j+50*k==x){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
//============================================================================
// Author      : JCH
// Copyright   :
// Description : Contest ACM Div1 Div2
//============================================================================

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

string s, op;
 char ss[1000];
 int q, a, b;

 int main() {

 cin >> s >> q;

 int size = s.size();

 for (int i = 0; i < size; ++i)
 ss[i] = s[i];

 while (q--) {

 cin >> op;

 if (op == "replace") {

 cin >> a >> b >> op;

 for (int i = a, j = 0; i <= b; ++i, ++j)
 ss[i] = op[j];

 } else if (op == "reverse") {

 cin >> a >> b;

 for (int i = a, j = b; i < j; ++i, --j)
 swap(ss[i], ss[j]);

 } else {

 cin >> a >> b;

 for (int i = a; i <= b; ++i)
 cout << ss[i];

 cout << endl;
 }

 }

 return 0;
 }


Measured memory_bytes: 3240
import Control.Applicative

bubbleSort :: [Int] -> (Int ,[Int])
bubbleSort xs = loop (1, 0, xs)
  where
    n = length xs - 2
    loop (0, m, xs) = (m, xs)
    loop (1, m, xs) = loop $ foldr f (0, m, xs) [0 .. n]
    f i  (f, m, xs) = if b > c
                      then (1, m + 1, (as ++ c : b : ds))
                      else (f, m, as ++ bs)
      where (as, bs@(b : c : ds)) = splitAt i xs

main :: IO ()
main = do
  _  <- getLine
  xs <- map read . words <$> getLine
  let (m, ys) = bubbleSort xs
  putStrLn $ unwords $ map show ys
  print m



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


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define en '\n'

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    set<string> s;
    string s1;
    while(n--){
        cin >> s1;
        s.insert(s1);
    }
    cout << s.size();
}


Measured memory_bytes: 19248