akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);
const double PI = acos(-1);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x,y;
	cin >> x >> y;
	if(x%y==0)cout << -1 << endl;
	else cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#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 repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e16;
#define int long long

const int MAX_N = 10;




signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	int ans = INF;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0) {
			int tmp = 0;
			string p = to_string(i);
			string q = to_string(n / i);
			tmp = max(p.size(), q.size());
			chmin(ans, tmp);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
B = list(map(int, input().split()))
A = [0] * N

for i in range(N):
    if i == 0:
        A[0] = B[0]
    elif 0 < i and i < N - 1:
        if B[i-1] < B[i]:
            A[i] = B[i-1]
        else:
            A[i] = B[i]
    else:
        A[i] = B[i-1]
print(sum(A))

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int MOD = 1000000007;

//////検証する数,超えられない数////
long long cine(long long a, long long b) {
	if (a <= b) {
		return a;
	}
	else {
		return b;
	}
};
//vector型の初期化
void vec_initialize(vector<ll>& a, const ll N) {
	ll c;

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

		cin >> c;
		a.push_back(c);

	}

};

void vec2_initialize(vector<ll>& a, vector <ll>&b, const ll N) {
	ll c,d;

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

		cin >> c>>d;
		a.push_back(c);
		b.push_back(d);
	}

};

void vec_pair_initialize(vector<pair<ll, ll>>& a, const ll N) {
	ll c, d;
	for (int i = 0; i < N; i++) {
		cin >> c >> d;
		a.push_back(make_pair(c, d));
	}
};

int main() {
	ll H, W;
	cin >> H >> W;
	vector<string>a;
	string s;

	for (int i = 0; i < H; i++) {
		cin >> s;
		a.push_back(s);
	}

	for (int i = 0; i < H;i++) {
		for (int j = 0; j < W; j++) {

			if (a[i][j] == '#') {

				break;

			}
			if (j == W - 1) {
				for (int k = 0; k < W; k++) {

					a[i][k] = 'x';

				}

			}
		}


	}
	for (int i = 0; i < W; i++) {
		for (int j = 0; j < H; j++) {

			if (a[j][i] == '#') {

				break;

			}
			if (j == H - 1) {
				for (int k = 0; k < H; k++) {

					a[k][i] = 'x';

				}

			}
		}
	}
	ll cnt=0;
	for (int i = 0; i < H; i++) {
		cnt = 0;
		for (int j = 0; j < W; j++) {

			if (a[i][j]!='x') {

				cout << a[i][j];

				

			}
			else {

				cnt++;

			}
		}
		if (cnt != W) {
			cout << endl;
		}
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define scout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	string s; cin >> s;
	bool ok = false;
	rrep(i,1,4) {
		if(s[i]==s[i-1]) ok = true;
	}
	if(ok) cout << "Bad" << endl;
	else cout << "Good" << endl;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                1000000000000000001
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= mod;} b >>= 1; x *= x; x %= mod;} return p % mod;}
using namespace std;
# define INF 1e15
struct lex_compare {
    bool operator() (const pair<ll,pp(ll) > p1, const pair<ll,pp(ll) > p2){
        return (p1.first ==  p2.first) ? p1.ss.ff < p2.ss.ff : p1.first > p2.first;
    }
};

bool check(ll arr[], ll target, ll n, ll k){
    ll total = 0;
    forn(i,0,n){
        if(arr[i] % target == 0){
            total += (arr[i]/target -1);
        }else total += (arr[i]/target);
    }
    return total <= k;
}

int main(){
    FIO;
    ll n,k; cin >> n >> k;
    ll arr[n]; forn(i,0,n) cin >> arr[i];
    ll maxt = maxE(arr,n);
    ll ans = maxt;
    ll s = 1, e = maxt+1;
    while(s <= e){
        ll mid = (s+e)/2;
        if(check(arr,mid, n, k )){
            ans = min(ans, mid);
            e = mid-1;
        }else{
            s = mid+1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5144
import numpy as np
N = int(input())
a = np.array(list(map(int,input().split())),dtype=np.int)

nA = np.bincount(a[::2])
nB = np.bincount(a[1::2])
orderA = np.argsort(nA)
orderB = np.argsort(nB)

kA1 = orderA[-1]
kA2 = orderA[-2]
kB1 = orderB[-1]
kB2 = orderB[-2]
if kA1 == kB1:
    if nA[kA1] + nB[kB2] >= nA[kA2] + nB[kB1]:
        kA=kA1; kB=kB2
    else:
        kA=kA2; kB=kB1
else:
    kA=kA1; kB=kB1

print(N-nA[kA]-nB[kB])

Measured memory_bytes: 29332
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	
	
	public static void main(String[] args) throws IOException {
		try(Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			LinkedList<Integer> deque = new LinkedList<>();
			
			for(int i = 0; i < N; i++){
				if(i % 2 == 0){
					deque.addLast(sc.nextInt());
				}else{
					deque.addFirst(sc.nextInt());
				}
			}
			
			boolean first = true;
			if(N % 2 == 1){
				for(ListIterator<Integer> iter = deque.listIterator(N); iter.hasPrevious(); ){
					final int value = iter.previous();
					
					System.out.print((first ? "" : " " ) + value);
					first = false;
				}
			}else{
				for(ListIterator<Integer> iter = deque.listIterator(); iter.hasNext(); ){
					final int value = iter.next();
					
					System.out.print((first ? "" : " ") + value);
					first = false;
				}
			}
			
			System.out.println();
		}
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
		
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 76732
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;


int main(int argc, char const *argv[])
{
    int n;
    string str;
    cin >> n >> str;
    auto s = str.c_str();
    int w[n], e[n];

    w[0] = 0;
    for(int i=0;i<n-1;i++){
        if(s[i]=='W'){
            w[i+1]=w[i]+1;
        }else{
            w[i+1]=w[i];
        }
    }

    e[n-1] = 0;
    for(int i=n-1;i>0;i--){
        if(s[i]=='E'){
            e[i-1]=e[i]+1;
        }else{
            e[i-1]=e[i];
        }
    }


    int m = 200000;
    for(int i=0;i<n;i++){
        m = min(m, e[i]+w[i]);
    }

    // for(auto x: e){
    //     cout << x << " ";
    // }
    // cout << endl;
    // for(auto x: w){
    //     cout << x << " ";
    // }
    // cout << endl;

    cout << m << endl;

    return 0;
}


Measured memory_bytes: 3076
/*
 * 0286.cc: Computation of Salary
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 10000;
const int MAX_M = 10000;

/* typedef */

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

/* global variables */

vpii ses[MAX_M];
ll sums[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, m;
  cin >> n >> m;

  for (;;) {
    int si, ti, ei;
    cin >> si >> ti >> ei;
    if (si == 0) break;
    si--, ti--;
    ses[ti].push_back(pii(si, ei));
  }

  int l;
  cin >> l;

  while (l--) {
    memset(sums, 0, sizeof(sums));

    for (int i = 0; i < m; i++) {
      ll bi;
      cin >> bi;

      vpii& sei = ses[i];
      for (vpii::iterator vit = sei.begin(); vit != sei.end(); vit++)
	sums[vit->first] += bi * vit->second;
    }

    for (int i = 0; i < n; i++) {
      if (i) putchar(' ');
      printf("%lld", sums[i]);
    }
    putchar('\n');
  }
  return 0;
}

Measured memory_bytes: 2292
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
//#pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin>>x;
    cout<<1-x;
    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
int main(void)
{
	int i, n;
    int x[100];
    
    scanf("%d",&n);
    
    for(i = 0; i < n; i++)
    	scanf("%d",&x[i]);
    
    for(i = n - 1; i > 0; i--)
        printf("%d ",x[i]);
        
printf("%d\n",x[0]);

return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000009
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  ll K, N;
  cin >> K >> N;
  vector<ll> A(N);
  rep(i, N){
    cin >> A.at(i);
  }
  ll d = 0;
  rep(i, N-1){
    chmax(d, A.at(i+1)-A.at(i));
  }
  chmax(d, K-A.at(N-1)+A.at(0));
  cout << K-d << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define clr(a,x) memset(a,x,sizeof(a))
#define SZ(x) ((int)(x).size())
#define lson rt<<1
#define rson rt<<1|1
#define pb push_back
#define fi first
#define se second
#define what_is(x) cerr<<#x<<" "<<x<<endl;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
template <typename T>
inline void _read(T& x){
    cin>>x;
}
void R(){}
template <typename T,typename... U>
void R(T&head,U&... tail){
    _read(head);
    R(tail...);
}

template <typename T>
inline void _write(const T& x){
    cout<<x<<' ';
}
void W(){cout<<endl;}
template <typename T,typename... U>
void W(const T&head,const U&... tail){
    _write(head);
    W(tail...);
}

void go();
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    go();
    return 0;
}
/****************ackun*********************/

void go(){
    int a,b;
    R(a,b);
    W(max(a+b,max(a,b)*2-1));
}


Measured memory_bytes: 256
require 'pp'

s = gets.chomp.split("")
x, y = gets.chomp.split(" ").map(&:to_i)

flag = 0
count = 0
x_list = Array.new
y_list = Array.new
while v = s.shift
    if v == "F"
        count += 1
    else
        if flag == 0
            x_list << count
            flag = 1
        else
            y_list << count
            flag = 0
        end
        count = 0
    end
end
if count != 0
    if flag == 0
        x_list << count
    else
        y_list << count
    end
end

dp_x = Array.new
dp_y = Array.new

dp_x[0] = [0]
dp_y[0] = [0]

y_list.each_with_index do |val, i|
    dp_y[i+1] = Array.new
    dp_y[i].each do |w|
        dp_y[i+1].push(w+val)
        dp_y[i+1].push(w-val)
    end
    dp_y[i+1].uniq!
end

if !dp_y[y_list.size].include?(y)
    puts "No"
    exit
end

x_list.each_with_index do |val, i|
    dp_x[i+1] = Array.new(0)
    if i == 0
        dp_x[1] = [val]
    else
        dp_x[i].each do |w|
            dp_x[i+1].push(w+val)
            dp_x[i+1].push(w-val)
        end
    end
    dp_x[i+1].uniq!
end

if !dp_x[x_list.size].include?(x)
    puts "No"
    exit
end

puts "Yes"

Measured memory_bytes: 33916
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
using namespace std;

int main() {
	int dx[4]={1,-1,0, 0};
	int dy[4]={0, 0,1,-1};
	int W,H,nowx,nowy;
	while(cin>>W>>H,W){
		int kabex[31][31][31],kabey[31][31][31],count=1;
		bool flag[31][31]={false};
		REP(j,0,H){
			REP(i,0,W-1){
				cin>>kabex[j][i][i+1];
				kabex[j][i+1][i]=kabex[j][i][i+1];
			}
			if(j==H-1) 	break;
			REP(i,0,W){
				cin>>kabey[j][j+1][i];
				kabey[j+1][j][i]=kabey[j][j+1][i];
			}
		}
		queue< pair<int, int> > qu;
	
		qu.push({0,0});
		flag[0][0]=true;
		while(!flag[H-1][W-1]){
			queue< pair<int, int> > tmpqu;
			while(!qu.empty()){
				nowy=qu.front().first;
				nowx=qu.front().second;
				qu.pop();
				for(int i=0;i<4;i++){
					int nexty=nowy+dy[i];
					int nextx=nowx+dx[i];
					if(nextx<W&&0<=nextx&&nexty<H&&0<=nexty){
						if(!flag[nexty][nextx]&&((i<2&&!kabex[nowy][nowx][nextx])||(i>=2&&!kabey[nowy][nexty][nowx]))){
							tmpqu.push({nexty,nextx});
							flag[nexty][nextx]=true;
						}
					}
				}
			}
			qu=tmpqu;
			if(qu.empty()){
				count=0;
				break;
			}
			count++;
		}
		p(count);
	}
	
	return 0;
}

Measured memory_bytes: 3224
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N,M;
    cin>>N>>M;
    int kazu[100001]={0};
    int check[100001]={0};
    check[1]=1;
    kazu[1]=1;
    for(int i=1;i<=100000;i++)kazu[i]=1;
    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        if(check[a])check[b]=1;
        if(kazu[a]==1)check[a]=0;
        kazu[a]--;kazu[b]++;
        /*
        for(int j=1;j<=3;j++)printf("[%d]",kazu[j]);
        puts("");
        for(int j=1;j<=3;j++)printf("[%d]",check[j]);
        puts("");
        */
    }
    int ans=0;
    for(int i=1;i<=N;i++){
        if(check[i])ans++;
        //printf("[%d]",check[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  int x;
  cin >> x;
  cout << (1-x) << '\n';
  return;
} 

signed main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  FAST
  int T=1;
  // cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <set>
using namespace std;


int main(){
    int n;
    cin >> n;
    int ans = n;
    for (int i = 0; i < n; i++) {
        int l, r;
        cin >> l >> r;
        ans += r-l;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// a template for main.cpp
#include <bits/stdc++.h>
#define ll long long
using namespace std;

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

    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for (int &x : h) cin >> x;
    vector<set<int>> g(n);
    vector<bool> good(n, true);
    while (m--) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        g[u].insert(v);
        g[v].insert(u);
    }
    for (int i = 0; i < n; i++) {
        for (int adj : g[i]) {
            if (h[i] <= h[adj]) {
                good[i] = false;
                break;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += good[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 17720
//#define _XCODE_DEBUG

#include <iostream>
#include <vector>

#ifdef _XCODE_DEBUG
    #include <fstream>
#endif

using ll = long long;

    
int main() {
    #ifdef _XCODE_DEBUG
        std::ifstream in("input.txt");
        std::cin.rdbuf(in.rdbuf());
    #endif
    
    int x, y, a, b, c;
    std::cin >> x >> y >> a >> b >> c;
 
    std::vector<int> p(a);
    std::vector<int> q(b);
    std::vector<int> r(c);
 
    for (int i=0; i<a; i++) std::cin >> p[i];
    for (int i=0; i<b; i++) std::cin >> q[i];
    for (int i=0; i<c; i++) std::cin >> r[i];
    
    std::sort(p.begin(), p.end(), std::greater<int>());
    std::sort(q.begin(), q.end(), std::greater<int>());
    
 
    std::vector<int> s;
    for (int i=0; i<x; i++) r.push_back(p[i]);
    for (int i=0; i<y; i++) r.push_back(q[i]);
    std::sort(r.begin(), r.end(), std::greater<int>());
    
    long long ans = 0;
    for (int i=0; i<x+y; i++) ans += r[i];
    std::cout << ans << "\n";
    
    return 0;
}

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

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

const long long INF = 1LL << 60;

using namespace std;

int main() {

    long int n; cin >> n;
    long int h[n]; rep(i,n) cin >> h[i];

    long long dp[100010]; rep(i,100010) dp[i] = INF;

    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]);

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

        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));

    }

    cout << dp[n-1] << endl;

    return 0;
}

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

void solve(long long N, std::vector<long long> d) {
  long long sum = 0;
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = i + 1; j < N; j++) {
      sum += d[i] * d[j];
    }
  }
  cout << sum << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> d(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &d[i]);
  }
  solve(N, std::move(d));
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int dp[4001][4001][3];
int n;
string s;
vector<char> v = {'R', 'B', 'G'};
int solve(int a, int b, int c){
    int sum = 0;
    for(int k = n - 1; k >= 0; k--){
        for(int j = k - 1; j >= 0; j--){
            int i = 2 * j - k;
            if(s[k] == v[a] and s[j] == v[b]){
                sum += dp[0][j][c];
                sum -= (i >= 0 and s[i] == v[c]);
            }
        }
    }
    return sum;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        cin >> n;
        cin >> s;
        for(int i = 0; i < n; i++){
            int r = 0, b = 0, g = 0;
            for(int j = i; j < n; j++){
                if(s[j] == 'R'){
                    r++;
                }
                if(s[j] == 'B'){
                    b++;
                }
                if(s[j] == 'G'){
                    g++;
                }
                dp[i][j][0] = r;
                dp[i][j][1] = b;
                dp[i][j][2] = g;
            }
        }
        int ans = 0;
        ans += solve(0, 1, 2);
        ans += solve(0, 2, 1);
        ans += solve(1, 0, 2);
        ans += solve(1, 2, 0);
        ans += solve(2, 1, 0);
        ans += solve(2, 0, 1);
        cout << ans << '\n';
    }
}

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

int main(){
    int n;
    cin >> n;
    string a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    set<char> set1;
    for(int i=0;i<n;i++){
        set1.insert(a[i]);
        set1.insert(b[i]);
        set1.insert(c[i]);
        ans += set1.size()-1;
        set1.clear();
    }
    cout << ans << endl;
}


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

int main()
{
    string s1, s2, s3;
    cin>>s1>>s2;

    int len = s1.length() + s2.length();
    for(int i=0, j=0, k=0; i<len; i++){
        if(i%2==0) printf("%c", s1[k++]);
        else printf("%c", s2[j++]);
    }
    printf("\n");


}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;

int gcd(int a, int b) {//最大公約数
	if (b == 0)return a;
	return gcd(b, a%b);
}

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

	int K; cin >> K;
	int sum = 0;

	eFOR(i, 1, K) {
		eFOR(j, 1, K) {
			eFOR(k, 1, K) {
				sum += gcd(i, gcd(j, k));
			}
		}
	}
	cout << sum << endl;

	return 0;
}



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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    string sa, sb;
    cin >> sa >> sb;

    int x, y;
    x = sa.at(0) - 'A';
    y = sb.at(0) - 'A';

    if(x<y) cout << "<" << endl;
    else if(x>y) cout << ">" << endl;
    else cout << "=" << endl;
    return 0;
}


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

int main(){
  ll n;cin>>n;
  ll sum = 0,i = 1,count=1;
  while (true){
    sum+=i;
    if (sum>=n){
      cout << i;
      break;
    }
    i++;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int selectionSort(int A[],int N)
{
  int i,j,minj,count=0,temp;
  for(i=0;i<N-1;i++){
    minj=i;
    for(j=i;j<=N-1;j++){
      if(A[minj]>A[j]){
	minj=j;
      }
    }
	temp=A[i];
	A[i]=A[minj];
	A[minj]=temp;
	if(i!=minj){
	  count++;
	}
  }

  return count;
}
    
      
      

  
int main()
{
  int A[100],N,i,count;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  count=selectionSort(A,N);

  for(i=0;i<N;i++){
    if(i!=0){
      printf(" ");
    }
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",count);

 
  return 0;
}
  



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

using namespace std;

int main() {
	string s, buf = "01";
	int cnt, ans = 1e6;
	cin >> s;
	for(int j = 0;j < 2;++j){
		int k = j;
		cnt = 0;
		for(int i = 0;i < s.length();++i, k = 1 - k) {
			if(s[i] != buf[k]) ++cnt;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int r = sc.nextInt();
		int s = sc.nextInt();
		int p = sc.nextInt();
		String t = sc.next();
		sc.close();
		int ans = 0;
		for (int i = 0; i < k; i++) {
			int a = i;
			char prev = 'n';
			while (a < n) {
				if (prev == t.charAt(a)) {
					prev = 'n';
				} else {
					char c = t.charAt(a);
					ans += (c == 'r' ? p : c == 's' ? r : s);
					prev = c;
				}
				a += k;
			}
		}
		System.out.println(ans);
	}

	public static int arrayMax(int[] array) {
		int ans = Integer.MIN_VALUE;
		for (int i = 0; i < array.length; i++) {
			if (array[i] > ans)
				ans = array[i];
		}
		return ans;
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 26340
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

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

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

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

var H, W int
var ch, cw int
var dh, dw int
var S []string
var u [][]int

//---------------------------------------------
// priority queue
//---------------------------------------------
type pqi struct{ a, x, y int }

type priorityQueue []pqi

func (pq priorityQueue) Len() int            { return len(pq) }
func (pq priorityQueue) Swap(i, j int)       { pq[i], pq[j] = pq[j], pq[i] }
func (pq priorityQueue) Less(i, j int) bool  { return pq[i].a < pq[j].a }
func (pq *priorityQueue) Push(x interface{}) { *pq = append(*pq, x.(pqi)) }
func (pq *priorityQueue) Pop() interface{} {
	x := (*pq)[len(*pq)-1]
	*pq = (*pq)[0 : len(*pq)-1]
	return x
}

const inf = int(1e9)

func bsf(sx, sy int) int {
	u[sy][sx] = 0
	pq := priorityQueue{}
	heap.Push(&pq, pqi{0, sx, sy})
	for len(pq) != 0 {
		cx := pq[0].x
		cy := pq[0].y
		heap.Pop(&pq)
		for dy := -2; dy <= 2; dy++ {
			for dx := -2; dx <= 2; dx++ {
				if dx == 0 && dy == 0 {
					continue
				}
				x := cx + dx
				y := cy + dy
				if x < 0 || x >= W || y < 0 || y >= H {
					continue
				}
				if S[y][x] == '#' {
					continue
				}
				p := u[cy][cx]
				if (dx == 0 && abs(dy) == 1) || (dy == 0 && abs(dx) == 1) {
				} else {
					p++
				}
				if u[y][x] <= p {
					continue
				}
				u[y][x] = p
				heap.Push(&pq, pqi{p, x, y})
			}
		}
	}
	return 1
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	H, W = getInt(), getInt()
	ch, cw = getInt()-1, getInt()-1
	dh, dw = getInt()-1, getInt()-1
	S = make([]string, H)
	u = make([][]int, H)
	for i := 0; i < H; i++ {
		S[i] = getString()
		u[i] = make([]int, W)
		for j := 0; j < W; j++ {
			u[i][j] = inf
		}
	}

	bsf(cw, ch)

	// for i := 0; i < H; i++ {
	// 	out(u[i])
	// }

	if u[dh][dw] == inf {
		out(-1)
		return
	}
	out(u[dh][dw])
}


Measured memory_bytes: 26492
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
#define double long double
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,int> Pi;
typedef pair<P,P> PP;
double eps=1e-8;
int mod=1e9+7;
int inf=1LL<<55;

priority_queue<P,vector<P>,greater<P> > pq;

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end(), l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower
  return R-L;
}
int n,a[200000],sm1[200000],sm2[200000],x1[200000],x2[200000];

signed main(){
 
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i],sm1[i]=a[i],sm2[i]=a[i];
  }

  for(int i=1;i<n;i++)sm1[i]+=sm1[i-1];
  for(int i=n-2;i>=0;i--)sm2[i]+=sm2[i+1];
  
  for(int i=n-1;i>=0;i--){
    int y=(i+1<n?x1[i+1]:0);
    if(a[i]==0)x1[i]=min(y+2,sm2[i]);
    else x1[i]=min(y+a[i]%2,sm2[i]);
  }

  for(int i=0;i<n;i++){
    int y=(i-1>=0?x2[i-1]:0);
    if(a[i]==0)x2[i]=min(y+2,sm1[i]);
    else x2[i]=min(y+a[i]%2,sm1[i]);
  }
  

  
  int ans=1e9,c=0,f=1;

  for(int i=0;i<n;i++){
    if(f&&a[i]==0)continue;
    f=0;
    ans=min(ans,x1[i]+c);
    if(a[i]%2==0)c=min(c+1,x2[i]);
  }

  ans=min(ans,c);

  c=0,f=1;
  
  for(int i=n-1;i>=0;i--){
    if(f&&a[i]==0)continue;
    f=0;
    ans=min(ans,x2[i]+c);
    if(a[i]%2==0)c=min(c+1,x1[i]);
  }
  
  ans=min(ans,c);
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int dp[int(1e5)];
int main()
  {int N; cin >> N;
  vector<int> hs(N); for (auto &h: hs) cin >> h;
  for (int i = 1; i < N; ++i) dp[i] = min(dp[i - 1] + abs(hs[i - 1] - hs[i]), i < 2 ? int(1e9) : dp[i - 2] + abs(hs[i - 2] - hs[i]));
  cout << dp[N - 1] << endl;}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll yu[100010];	ll mo[100010];
int main() {
	ll n;
	cin>>n;
	n++;
	for(ll i=0;i<n;i++){
		cin>>mo[i];
	}
	for(ll i=0;i<n-1;i++){
		cin>>yu[i];
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		if(mo[i]>=yu[i]){
			ans+=yu[i];
			mo[i]-=yu[i];
		}
		else{
			ans+=mo[i];
			yu[i]-=mo[i];
			if(mo[i+1]>=yu[i]){
				ans+=yu[i];
				mo[i+1]-=yu[i];
			}
			else{
				ans+=mo[i+1];
				mo[i+1]=0;
			}
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 5196
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        // int n=sc.nextInt();
        int d=sc.nextInt(),n=d;
        int g=sc.nextInt();
        int p[] = new int[n];
        int c[] = new int[n];

        for(int i=0; i<n; i++) {
            p[i]=sc.nextInt();
            c[i]=sc.nextInt();
        }
        int ans=1<<28;
        for(int i=0; i<1<<n; i++) {
            int x=0,s=0;
            int e[]=new int[n];
            for (int t=0; t<n; t++ ) {
                if( ((i>>t)&1)==1 ){x+=p[t]; s+=p[t]*(t+1)*100+c[t]; e[t]++;}
            }
            if(s>=g){ans=min(ans,x); continue;}
            lp:for (int t=n-1; -1<t; t-- ) {
                if(e[t]>0)continue;
                for (int w=1; w<=p[t]; w++) {
                    s+=100*(t+1);
                    x++;
                    if(g<=s){ans=min(ans,x); break lp;}
                }
            }
        }

        out.println(ans);
        out.flush();
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return Integer.compare(d,p.d); //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 23124
n = int(input())
A = list(map(int,input().split()))
cnt = [0]*(n+1)
ans = []
for i in range(n,0,-1):
    a = A[i-1]
    s = 0
    for j in range(1,n//i+1):
        idx = i*j
        s+=cnt[idx]

    if s%2==0:
        cnt[i] = a
    else:
        cnt[i] = 1-a

    if cnt[i] ==1:
        ans.append(i)
m = sum(cnt)

print(m)
print(*ans)


Measured memory_bytes: 68060
<?php
$n = int();
$aArray = ints();
array_unshift($aArray, 0);

for($i = $n; $i >= 1; $i--){
  $sum = 0;
  for($j = $i*2; $j <= $n; $j+=$i){
    $sum+=$map[$j];
  }
  $map[$i] = ($aArray[$i] + $sum)%2;
}
echo array_sum($map),"\n";
foreach($map as $key => $value){
  if($value){
    echo $key,"\n";
  }
}


function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}

Measured memory_bytes: 29680
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>

#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>

#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		v.push_back(t);
	}
	int res = 0;
	for (int i = 1; i < n - 1; i++) {
		if (v[i] > v[i - 1] && v[i] > v[i + 1])
			;
		else if (v[i] < v[i - 1] && v[i] < v[i + 1])
			;
		else
			res++;
	}
	cout << res << endl;

}














Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner cin =  new Scanner(System.in);
        int a = cin.nextInt();
        int b = cin.nextInt();
        if(a > b) System.out.println("safe");
        else System.out.println("unsafe"); 
    }
}

Measured memory_bytes: 35776
def main():
    while True:
        H, W = map(int, input().split())
        if H == 0 and W == 0:
            break
        for _ in range(H):
            for _ in range(W):
                print("#", end="")
            print()
        print()
    return 0


if __name__ == "__main__":
    main()



Measured memory_bytes: 7004
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
ll two[202020];
ll two2[202020];
ll two3[202020];
ll popcount(ll x) {
	int res = 0;
	for (; x > 0; x >>= 1) res += (x & 1);
	return res;
}
ll modpow(string s, int mod) {
	ll res = 0;
	ll now = 1;
	rep(i, s.size()) {
		if (s[i] == '1') res = res + now % mod;
		now = now * 2 % mod;
	}
	return res;
}
ll rem(ll x, int s) {
	if (x == 0) return s;
	ll nxt = popcount(x);
	if (nxt == 0) return s;
	return rem(x % nxt, s + 1);
}
int main() {
	two[0] = 1;
	two2[0] = 1;
	two3[0] = 1;
	int n; string s;
	cin >> n >> s;
	reverse(all(s));
	int ppcnt = 0;
	rep(i, n) {
		ppcnt += s[i] - '0';
	}
	if (ppcnt == 0) {
		rep(i, n) {
			cout << 1 << endl;
		}
		return 0;
	}
	else if (ppcnt == 1) {
		V ans(n);
		rep(i, n) {
			if (s[i] == '1') ans[i] = 0;
			else {
				if (s[0] == '1') ans[i] = 2;
				else {
					if (i == 0) ans[i] = 2;
					else ans[i] = 1;
				}
			}
		}
		reverse(all(ans));
		rep(i, n) cout << ans[i] << endl;
		return 0;
	}
	rep1(i, 200005) two[i] = (two[i - 1] * 2) % ppcnt;
	rep1(i, 200005) two2[i] = (two2[i - 1] * 2) % (ppcnt + 1);
	if (ppcnt != 1) {
		rep1(i, 200005) two3[i] = (two3[i - 1] * 2) % (ppcnt - 1);
	}
	else {
		rep1(i, 200005) two3[i] = -1;
	}
	ll x = modpow(s, ppcnt);
	ll x2 = modpow(s, ppcnt + 1);
	ll x3 = (ppcnt != 0) ? modpow(s, ppcnt - 1) : -1;
	// 割り算はlog回で収束しそう
	V ans(n);
	rep(i, n) {
		int pc = ppcnt;
		if (s[i] == '0') {
			pc++;
			if (pc == 1) {
				ans[i] = 1;
				continue;
			}
			ll tmp = (x2 + two2[i]) % pc;
			if (tmp == 0) ans[i] = 1;
			else ans[i] = rem(tmp, 1);
		}
		else {
			pc--;
			if (pc == 1) {
				ans[i] = 1;
				continue;
			}
			else if (pc == 0) {
				ans[i] = 0;
				continue;
			}
			ll tmp = (x3 - two3[i] + pc) % pc;
			if (tmp == 0) ans[i] = 1;
			else ans[i] = rem(tmp, 1);
		}
	}
	reverse(all(ans));
	rep(i, n) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 9208
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

vector<string> mat;
vector<vector<bool>> seen;
int h, w;

const int dh[4] = {-1, 0, 1, 0};
const int dw[4] = {0, -1, 0, 1};

void dfs(int sh, int sw) {
    seen[sh][sw] = true;
    rep(i, 4) {
        int nh = sh+dh[i], nw = sw+dw[i];
        if (nh<0 || nh>h-1 || nw<0 || nw>w-1) continue;
        if (seen[nh][nw]) continue;
        if (mat[nh][nw] == '#') continue;
        dfs(nh, nw);
    }
}

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

    
    while(true) {
        cin >> w >> h;
        if (w+h == 0) break;
        mat.clear();
        rep(i, h) {
            string s; cin >> s;
            mat.push_back(s);
        }

        int sh, sw;
        rep(i, h) rep(j, w) if (mat[i][j]=='@') sh=i, sw=j;

        seen.assign(h, vector<bool>(w, false));
        dfs(sh, sw);

        int ans = 0;
        rep(i, h) rep(j, w) if(seen[i][j]) ans++;
        cout << ans << endl;
    }
}


Measured memory_bytes: 3200
#include <stdio.h>

int main(void) {
  int x1, x2, x3, x4, x5;
  scanf("%d", &x1);
  scanf("%d", &x2);
  scanf("%d", &x3);
  scanf("%d", &x4);
  scanf("%d", &x5);

  if(x1 == 0)
  puts("1");
  else if(x2 == 0)
  puts("2");
  else if(x3 == 0)
  puts("3");
  else if(x4 == 0)
  puts("4");
  else if(x5 == 0)
  puts("5");


}


Measured memory_bytes: 1608
#include <iostream>
#include <iomanip>

using namespace std;

int main(int argc, char* argv[]) {
  int N, K;
  cin >> N >> K;

  double e[N];
  for (int i = 0; i < N; ++i) {
    double p;
    cin >> p;
    double sum = (1 + p) * p / 2;
    e[i] = sum / p;
  }

  // go until K
  double ret = 0;
  double cur = 0;
  for (int i = 0; i < K; ++i)
    cur += e[i];

  ret = cur;

  for (int i = K; i < N; ++i) {
    cur -= e[i - K];
    cur += e[i];
    ret = max(ret, cur);
  }

  cout << std::fixed << std::setprecision(15) << ret << endl;

  return 0;
}

Measured memory_bytes: 1792