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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))

// #define DEBUG

#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif

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

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

const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}

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

    int n, K; cin >> n >> K;

    int res = 0;
    if(n % K != 0) res = 1;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }

signed main()
{
	int K;
	cin >> K;
	int ans = 0;
	for (int i = 1; i <= K; i++)
	{
		for (int j = i; j <= K; j++)
		{
			if ((i % 2 == 0 && j % 2 == 1) || (i % 2 == 1 && j % 2 == 0))
			{
				ans++;
			}
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 3164
# coding: utf-8
# 貪欲法で解く
N, M = map(int, input().split()) # N, Mの入力
ab = [list(map(int, input().split())) for i in range(M)] # ai, biをlistで管理
ans = 0 # 解答の初期化
left = 1 # 左限を定義
ab.sort(key = lambda x: x[1]) # 要望をbiの昇順で並べる
for request in ab:
    if left <= request[0]: # 左限よりもaiが大きいならば分断の必要があるので分断
        ans += 1
        left = request[1] # 左限を新たに分断後の左限にする
print(ans) # 解答の出力

Measured memory_bytes: 29064
#include <iostream>
#include <string>
#include <cstdint>

using namespace std;

int main()
{
    uint64_t *A, *B;
    uint32_t N, i;

    cin >> N;

    A = new uint64_t[N];
    B = new uint64_t[N];

    for(i = 0; i < N; i++){
        cin >> A[i];
    }

    B[0] = A[N - 1];
    for(i = 0; i < N - 1; i += 2){
        B[0] += A[i] - A[i + 1];
    }
    for(i = 0; i < N - 1; i++){
        B[i + 1] = 2 * A[i] - B[i];
    }

    for(i = 0; i < N; i++){
        cout << B[i] << ' ';
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 2944
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //------------------------------
    int n;cin>>n;
    int t=0,h=0;
    for(int i=0;i<n;i++){
        string s1,s2;cin>>s1>>s2;
        if(s1>s2){
            t+=3;
        }
        else if(s1<s2){
            h+=3;
        }
        else{
            t++;h++;
        }
    }
    cout<<t<<" "<<h<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------


































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

typedef long long ll;
#define rep(i, s, n) for(int i=s;i<n;i++)
#define repeq(i,s,n) for(int i=s;i<=n;i++)
#define MOD 10e9+7

void max_self(int& a, int b) { a=a>b?a:b; }
void min_self(int& a, int b) { a=a<b?a:b; }

using namespace std;

int n, k;
int x;
const int MAX_N = 1e6+5;

bool visited[MAX_N];

int main() {
    cin >> x;

    int top = 2*x;

    int temp_one=2;
    int temp_two;

    while(temp_one < top) {
        if(visited[temp_one]) {
            temp_one++;
            continue;
        }

        if(temp_one >= x) {
            cout << temp_one << endl;
            break;
        }

        temp_two = temp_one+temp_one;
        while(temp_two < top) {
            visited[temp_two] = true;
            temp_two+=temp_one;
        }

        temp_one++;
    }


    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int h, w, a, b, num, i, j;
	cin >> h >> w >> a >> b;
	vector<string> s(h, "");
	for (i = 0; i < b; i++) {
		for (j = 0; j < a; j++)
			s[i] += "0";
		for (; j < w; j++)
			s[i] += "1";
		cout << s[i] << "\n";
	}
	for (; i < h; i++) {
		for (j = 0; j < a; j++)
			s[i] += "1";
		for (; j < w; j++)
			s[i] += "0";
		cout << s[i] << "\n";
	}
	return 0;
}

Measured memory_bytes: 2304
/** "Ever tried.
         Ever failed.
               No matter.
                   Try Again.
                        Fail again.
                             Fail better.**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define bp  __builtin_popcount
#define endl "\n"
#define oo 0x3f3f3f3f3f3f3f3fLL
#define pb push_back
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define sz(s) (int)(s.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define debug(x) cout<<" LOOK "<<(#x)<<" = "<<x <<'\n'
#define NumofDigits(n)   ((long long)log10(n)+1)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e5+5;
const  double EPS = 1e-9;
const int MOD = 1e9+7;
/*
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll fastpow(ll b, ll p)
{if(!p)return 1;ll ret = fastpow(b, p >> 1);ret *= ret;if(p&1)ret*= b;return ret;}
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};*/
inline void File()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}


int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    //File();
    int n;
    cin>>n;
    vector<ll>v(n);
    for(int i=0; i<n; i++)
        cin>>v[i],v[i] -= i + 1;
    sort(all(v));
    ll b=v[(n-1)/2];
    ll ans=0;
    for(int i=0; i<n; i++)
        ans+=abs(v[i]-(b));
    cout<<ans;
}


Measured memory_bytes: 4788
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;
	vector<lli> a(n);
	REP(i,0,n)cin>>a[i];

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

	vector<lli> v;
	lli first = 1;
	v.push_back(a[0]);
	lli last = a.size()-1;

	while(first <= last){
		lli t1 = max(abs(a[first]-v[0]),abs(a[first]-v[v.size()-1]));
		lli t2 = max(abs(a[last]-v[0]),abs(a[last]-v[v.size()-1]));
		if(t1>t2){
			if(abs(a[first]-v[0])>abs(a[first]-v[v.size()-1])){
				auto itr = v.begin();
				v.insert(itr,a[first]);
			}
			else{
				v.push_back(a[first]);
			}
			first++;
		}
		else{
			if(abs(a[last]-v[0])>abs(a[last]-v[v.size()-1])){
				auto itr = v.begin();
				v.insert(itr,a[last]);
			}
			else{
				v.push_back(a[last]);
			}
			last--;
		}
	}

	lli sum=0;
	REP(i,1,v.size()){
		sum += abs(v[i]-v[i-1]);
	}
	cout<<sum<<endl;


	return 0;
}

Measured memory_bytes: 2168
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#define rep(i,n) for (int i = 0; i <= (n); ++i)
using ll = long long;
using namespace std;

int main() {
    int N;
    cin >> N;
    int check = N % 2;
    if ( check == 1 ) {
        int ans = N / 2 + 1;
        cout << ans << endl; 
    } else {
        int ans = N / 2;
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main(){
    set<int> st;
    for(int i = 0;i<3;i++){
        int a; cin >> a;
        st.insert(a);
    }    
    if(st.size()==2) puts("Yes");
    else puts("No");
    return 0;
}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		
		if(A == 5 && B ==5 && C == 7)
		{
			System.out.println("YES");
		}else if(A == 7 && B ==5 && C == 5)
		{
			System.out.println("YES");
		}else if(A == 5 && B ==7 && C == 5)
		{
			System.out.println("YES");
		}else
		{
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 23636
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
long M = 1000000007;

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

  priority_queue<int> Pq;


  long A;
  for(int i=0;i<N;i++){
  	cin >> A;
  	Pq.push(A);
  }

  for(int i=0;i<M;i++){
  	long T = Pq.top();
  	Pq.pop();
  	T /= 2;
  	Pq.push(T);
  }
  long ans = 0;
  while(!Pq.empty()){
  	ans += Pq.top();
  	Pq.pop();
  }
  cout << ans <<endl;
  
  return 0;
}




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

const int MOD = pow(10, 9) + 7;

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

  vector<int> A(N);
  vector<long long> S(N + 1, 0);

  for (int i = 0; i < A.size(); i++) {
    cin >> A[i];
    S[i + 1] = S[i] + A[i];
  }

  long answer = 0;

  for (int i = 0; i < A.size() - 1; i++) {
    long long sum = (S[N] - S[i + 1]) % MOD;
    answer += A[i] * sum;
    answer %= MOD;
  }

  cout << answer << endl;
}


Measured memory_bytes: 5544
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  int m;
  cin >> m;
  cout << 24 + (24-m) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int a,b,c,d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  int sum = a;
	if (b < a) {
		sum = b;
	}
	if (c < d) {
		sum += c;
	} else {
		sum += d;
	}
	printf("%d\n", sum);

  return 0;
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int[] v = new int[N];
		for (int i = 0; i < N; ++i) {
			v[i] = sc.nextInt();
		}
		Arrays.sort(v);
		
		double tempResult = 0.0d;
		double two = 2.0d;
		
		tempResult += (double)v[0];
		tempResult += (double)v[1];
		for (int i = 0; i < N - 2; ++i) {
			tempResult += two * v[i+2];
			two *= (double)2.0d;
		}
		
		double result = tempResult / two;
		
		
		System.out.println(result);
		
	}
	
	private static int kaijo(int x) {
		int result = 1;
		for(int i = 1; i <= x; ++i) result *= 2;
		return result;
	}

}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define ll long long
#define M 998244353
#define all(v) (v).begin(),(v).end()
#define fr first
#define sc second
#define sz(x) (ll)((x).size())
#define endl "\n"
#define vc vector
#define pb push_back
#define pii pair<ll,ll>
#define psi pair<string,ll>
#define msi map<string,ll>
#define mii map<ll,ll>
#define mp  make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PI 3.14159265
#define mem(x,val) memset(x,val,sizeof(x))
#define r0 return 
const long long INF=1e13;
template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
#define dbgv(container) {cerr << #container << " : \n"; int cnt = 0; for (auto& x: container) cerr << #container << "[" << cnt++ << "] = " << x << '\n';} 
#define dbgvv(container) {cerr << #container << " : \n"; int c1=0,c2=0; for (auto& x : container){c2 = 0; for (auto& y : x) {cerr << #container << "[" << c1 << "][" << c2++ << "] = " << y << '\n';}c1++;}}
#define dbg(...)__f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

//code begins here
ll dp[105][100005],n,w1,w[105],v[105];
ll calc(ll i,ll val)
{
	if(i==n+1)
	{
		if(val==0) return 0;
		else return INF;
	}
	ll ans=INF;
	if(dp[i][val]!=-1) return dp[i][val];
	if(val-v[i]>=0) amin(ans,calc(i+1,val-v[i])+w[i]);
	amin(ans,calc(i+1,val));
	//dbg(ans,i,val);
	return dp[i][val]=ans;
}
void solve()
{
 	cin>>n>>w1;
 	mem(dp,-1);
 	rep(i,1,n+1) cin>>w[i]>>v[i];
 	for(ll i=100003;i>=1;--i)
 	{
 		ll a=calc(1,i);
 		if(a<=w1) {cout<<i; r0;}
 	}
}
signed main()
{
	fast
	ll t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 82304
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

int main() {
  string X;
  cin >> X;
  deque<char> deq;
  rep(i, X.size()) {
    if(deq.empty()) {
      deq.push_back(X[i]);
      continue;
    }
    char c = deq.back();
    deq.pop_back();
    if(c == 'S' && X[i] == 'T')
      continue;
    deq.push_back(c);
    deq.push_back(X[i]);
  }
  cout << deq.size() << endl;
  return 0;
}

Measured memory_bytes: 644
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
 */
//入力終了→Ctrl+D
import java.util.*;
import java.awt.*;
import java.awt.Graphics.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        while (true){
            int n=sc.nextInt();
            if(n==0)break;
            double sum=0;
            double[] s=new double[n];
            for (int i = 0; i < n; i++) {
                s[i]=sc.nextDouble();
                sum+=s[i];
            }
            double ave=sum/n;
            double d=0;
            for (int i = 0; i < n; i++) {
                d+=pow(s[i]-ave,2);
            }
            out.println(sqrt(d/n));
        }
    }
}


Measured memory_bytes: 39836
// g++ -std=c++11 test.cpp && ./a.out
// g++ -std=c++11 bfs.cpp && cat bfs.txt | ./a.out

#include <algorithm>
#include <iostream>
#include <queue>
#include <functional>
#include <numeric>
#include <math.h>

using namespace std;

#define PRINT(A) {for (int i = 0; i < A.size(); i++) { cout << A[i] << " ";} cout << endl;}
#define SUM(A) accumulate(A.begin(), A.end(), 0)
#define MAX(A) *max_element(A.begin(), A.end())
#define GETLINE(A) {string I; while(getline( cin, I, ' ' )){A.push_back(stoi(I));}}
#define BIT_LENGTH(N) floor(log2(N)) + 1
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;

bool check(int length, int K, VI &logs) {
    int count = 0;
    for (auto log: logs) {
        count += (ceil(log / (double)length) - 1);
        if (count > K) {
            return false;
        }
    }
    return true;
}

int main() {
    int N, K;
    cin >> N >> K;    
    VI logs;
    GETLINE(logs);

    int left = 1, right = pow(10,9);
    while (left < right) {
        int mid = (left + right) / 2;
        if (check(mid, K, logs)) {
            right = mid;
        } else {
            left = mid + 1;
        }
    }
    cout << left << endl;
    return 0;
}

Measured memory_bytes: 4308
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

priority_queue<pair<int, int> > q;
map<int, int> d;
int n, m;

main(){
  cin >> n >> m;
  for(int i=0;i<n;i++) q.push(make_pair(0, -n));
  for(int i=0;i<m;i++){
    int a, b;
    cin >> a >> b;
    d[a] += b;
    q.push(make_pair(d[a], -a));
    while(1){
      pair<int, int> p = q.top();
      if(p.first == d[-p.second]){
        cout << -p.second << ' ' << p.first << endl;
        break;
      }
      q.pop();
    }
  }
}

Measured memory_bytes: 21180
import java.util.*;
import java.text.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        double r = scn.nextDouble();
        DecimalFormat df = new DecimalFormat("#.#####");
        System.out.println(
          df.format(Math.PI * Math.pow(r, 2)) + " " +
          df.format(Math.PI * r * 2)
        );
    }
}

Measured memory_bytes: 27792
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    k = I()
    from math import gcd
    s=0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for e in range(1,k+1):
                s+=gcd(gcd(i,j),e)
    print(s)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9620
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define INF 1e9
using namespace std;

int main(){
	int n,m;
	cin>>n>>m;
	vector<int> a(m);
	REP(i,m) cin>>a[i];
	
	const int num[]={0,2,5,5,4,5,6,3,7,6};//数iを作るのに必要なマッチ棒がnum[i]本.
	
	vector<int> dp(n+1,-INF);//ちょうどi本でdp[i]桁作れる.
	dp[0]=0;
	for(int i=0;i<=n;++i){
		if(dp[i]==-INF) continue;//for.
		REP(j,m){
			if(i+num[a[j]]>n) continue;//REP.
			dp[i+num[a[j]]]=max(dp[i+num[a[j]]],dp[i]+1);
		}
	}
	
	sort(ALL(a),greater<int>());//降順.
	int rest=n;
	string ans="";
	while(rest>0){
		REP(i,m){
			if(rest-num[a[i]]<0) continue;//REP.
			if(dp[rest]==dp[rest-num[a[i]]]+1){
				ans+='0'+a[i];
				rest-=num[a[i]];
				break;//REP.
			}
		}
	}
	
	cout<<ans<<endl;
	return 0;
}//解答解説参考.

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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

int find_root(int i, vec_int &UF_tree){
    vec_int route_nodes;
    int node = i;
    while(true){
        route_nodes.push_back(node);
        int parent = UF_tree.at(node);
        if(parent == node){
            break;
        }
        node = parent;
    }
    for(auto aa: route_nodes){
        UF_tree.at(aa) = node;
    }

    return node;
}

void merge_trees(int node_i, int node_j, vec_int& UF_tree){
    // node i と jの所属する木をくっつける
    // それぞれのrootを探してきて、片っぽのrootをもう片っぽのrootに付け替える
    int root_i = find_root(node_i, UF_tree);
    int root_j = find_root(node_j, UF_tree);

    if(node_i%2==0){
        UF_tree.at(root_j) = root_i;
    }else{
        UF_tree.at(root_i) = root_j;
    }
}

signed main(){
    int N, M; cin>>N>>M;
    vec_int X(M), Y(M),Z(M);
    rep(i,M)cin>>X.at(i)>>Y.at(i)>>Z.at(i);

    vec_int UF_tree(N+1);
    rep(i,N+1)UF_tree.at(i) = i;

    for(int i=0;i<M;i++){
        merge_trees(X.at(i),Y.at(i),UF_tree);
    }

    for(int i=0;i<N;i++){
        int temp = find_root(i+1,UF_tree);
    }
    set<int> out_set;
    for(int i=0;i<N;i++){
        out_set.insert(UF_tree.at(i+1));
    }
    cout<<out_set.size()<<endl;




    // これは雰囲気union-find系の問題だな
    // X, Yの組になっている数値は片っぽがわかればもう片っぽは瞬時にわかる 
    // union-findでくっつけていって、





    return 0;
}

Measured memory_bytes: 10824
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

#https://note.nkmk.me/python-union-find/

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

##############################
#n,w = map(int,input().split()) #n:頂点数　w:辺の数
n=I()

w=0
d = [[float("inf")]*n for i in range(n)]
for i in range(n):
    d[i][i]=0
for i in range(n):
    s=list(SI())
    for j in range(n):
        if int(s[j])==1:
            w+=1
            d[i][j]=1
            d[j][i]=1
    
nodes=[0 for i in range(2*n)]
uf=UnionFind(2*n)
for i in range(n):
    for j in range(i,n):
        if d[i][j]==1:
            uf.union(i,n+j)
            uf.union(j,n+i)
for i in range(n):
    if uf.same(i,i+n):
        print(-1)
        sys.exit()
warshall_floyd(d)
#print(d)
ans=0
for i in range(n):
    for j in range(n):
        if d[i][j]<inf and d[i][j]>ans:
            ans=d[i][j]
print(ans+1)
    

        
    
    
    
    




Measured memory_bytes: 75592
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if lc == 1
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

nn = inputs[0][0]
aa = inputs[0][1]-1
bb = inputs[0][2]-1
cc = inputs[0][3]-1
dd = inputs[0][4]-1
rd = inputs[1][0]

# body
if $debugFlag
  p nn
  p aa
  p bb
  p cc
  p dd
  p rd
end

def can_goal?(chk)
  return false if chk[-1] == '#'
  ans = true
  (chk.length-1).times do |i|
    if chk[i..i+1] == "##"
      ans = false
      break
    end
  end
  return ans
end

bb_goals_first = false
tmp = can_goal?(rd[bb+1..dd])
if tmp
  chk = rd.clone
  chk[dd] = '#'
  bb_goals_first = can_goal?(chk[aa+1..cc])
end

### dd < cc
bb_goals_last = false
aa_ovtk_bb = false
if (bb - 1 + 2) <= (dd+1)
  (rd[bb-1..dd+1].length-2).times do |i|
    if rd[bb-1+i..bb-1+i+2] == '...'
      print "overtake:" if $debugFlag
      pd i
      aa_ovtk_bb = true
      break
    end
  end
end


if aa_ovtk_bb
  tmp = can_goal?(rd[aa+1..cc])
  if tmp
    chk = rd.clone
    chk[cc] = '#'
    bb_goals_last = can_goal?(chk[bb+1..dd])
  end
end

pd bb_goals_first
pd bb_goals_last

if bb_goals_first or bb_goals_last
  puts "Yes"
else
  puts "No"
end


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

const int mod=1e9+7;

int n, f[303000][2][3][4];
char s[303000];

void U(auto &x,auto y){
    x=(x+y)%mod;
}

int main(){
    cin>>s+1; n=strlen(s+1);
    f[0][0][2][0]=1;
    for (int i=1;i<=n;++i)
        for (int a=0;a<=1;++a)
            for (int b=0;b<=2;++b)
                for (int c=0;c<=3;++c)
                    if (f[i-1][a][b][c]){
                        if (s[i]=='0'||s[i]=='?'){
                            U(f[i][a^1][0][c],f[i-1][a][b][c]);
                        }
                        if (s[i]=='1'||s[i]=='?'){
                            if (b==0){
                                U(f[i][a^1][1][c],f[i-1][a][b][c]);
                            }else if (b==1){
                                U(f[i][0][2][min(3,c+(a? 0: 1))],f[i-1][a][b][c]);
                            }else if (b==2){
                                U(f[i][0][2][min(3,c+1)],f[i-1][a][b][c]);
                            }
                        }
                    }
    int ans=0;
    for (int a=0;a<=1;++a)
        for (int b=0;b<=2;++b)
            for (int c=0;c<=3;++c){
                if (b==2||b==0&&c-(a?1:2)>0||b==1&&c-(a?1:0)>0)
                    U(ans,f[n][a][b][c]);
            }
    cout<<ans<<endl;
}

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

int main()
{
	int64_t n, k;
	cin >> n >> k;
	int64_t puni[k]{};
	for (int64_t i = 1; i <= n; i++)
	{
		puni[i % k]++;
	}
	int64_t ans = 0;
	for (int64_t i = 0; i < k; i++)
	{
		if ((4 * k - 2 * i) % k == 0)
		{
			ans += puni[i] * puni[(2 * k - i) % k] * puni[(2 * k - i) % k];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
let X,K,D = stdin.ReadLine().Split() |> Array.map int64 |> fun input -> abs input.[0],input.[1],input.[2]
if K < X/D then X - K*D 
elif (K-X/D)%2L = 1L then abs (X - X/D * D - D)
else X - X/D * D
|> stdout.WriteLine

Measured memory_bytes: 28008
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    string s;cin>>s;
    int ans = 0;
    for(int i=0;i<s.length();i++){
        ans += (int)(s[i] - '0');
    }
    if(ans % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define MOD 1e9+7
using namespace std;

int main() {
  int w, a, b;
  cin >> w >> a >> b;
  if (abs(a - b) <= w) cout << 0 << endl;
  else cout << abs(a - b) - w << endl;
}

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

public class Main {
    public static PrintWriter out;
    public static FastScanner in;

    private void solve(){
        int n = in.nextInt();
        int m = in.nextInt();

        String[] s = new String[n];
        for(int i=0;i<n;i++){
            s[i] = in.nextLine();
        }

        String[] t = new String[m];
        for(int i=0;i<m;i++){
            t[i] = in.nextLine();
        }

        for(int x = 0; x<=n-m;x++){
            for(int y=0;y<=n-m;y++){
                int k;
                for(k=0;k<m;k++){
                    String sb1 = s[x+k].substring(y,y+m);
                    if(!sb1.equals(t[k])) break;
                }
                if(k == m){
                    out.print("Yes");
                    return;
                }
            }
        }
        out.print("No");
    }

    private void runIO() {
        in = new FastScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
    }
    private static class FastScanner {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        private FastScanner() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        private String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private String nextLine() {
            String ret = "";
            try {
                ret = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return ret;
        }
    }

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


Measured memory_bytes: 23252
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
    
//------ Believe yourself as a genius!!!!!! ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>s;
    rep(i,Size(alph)){
        char ans=alph[i];
        int ok=1;
        rep(j,Size(s)){
            if(s[j]==ans)ok=0;
        }
        if(!ok)continue;
        Cout(ans);
        return 0;
    }
    Cout("None");
    return 0;
}

Measured memory_bytes: 512
from collections import Counter
MOD = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


prime = [0] * (10**6+1)
for i in range(N):
    c = Counter(prime_factorize(A[i]))
    for j in c.items():
        prime[j[0]] = max(j[1], prime[j[0]])
lcm = 1
for i in range(10**6):
    if prime[i] > 0:
        lcm *= pow(i, prime[i],MOD)

ans = 0
for i in range(N):
    ans += lcm * pow(A[i], MOD - 2, MOD)
    ans %= MOD
print(ans)


Measured memory_bytes: 83196
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	ll h, w;
	cin >> h >> w;

	vector<vector<string>> a(h, vector<string>(w));
	for (ll i = 0; i < h; i++)
	{
		string s;
		cin >> s;
		for (ll j = 0; j < w; j++)
		{
			a[i][j] = s[j];
		}
	}

	bool b = true;
	for (ll i = 1; i < h; i++)
	{
		for (ll j = 1; j < w; j++)
		{
			ll x = j - 1;
			ll y = i - 1;
			if ((x >= 0 && a[i][x] == "#") && (y >= 0 && a[y][j] == "#"))
			{
				b = false;
			}
		}
	}

	println((b ? "Possible" : "Impossible"));
}

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

int main(void){

	int W,H,x,y,r; 
	cin >> W>> H>> x>> y>> r;

	if (x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H){
		cout << "Yes" << endl;     
	}     else    {
		cout << "No" << endl;     
	} 
	
return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define MXN 200005
map<int,int> f;
int Find(int x){
    if(f.find(x)==f.end()) return f[x]=x;
    if(f[x]==x)return x;
    return f[x]=Find(f[x]);
}
int main(){
    int n;
    scanf("%d",&n);
    int a[100005];
    int b[100005];
    int c[100005];
    //c[n+1]=0;
    int d[100005];
    a[n+1]=b[n+1]=c[n+1]=d[n+1]=0;
    for(int i = 1;i<=n;i++){
        scanf("%d",&a[i]);
        c[i]=a[i];
        c[n+1]^=a[i];
        a[n+1]^=a[i];
    }
    for(int i = 1;i<=n;i++){
        scanf("%d",&b[i]);
        d[i]=b[i];
        d[n+1]^=b[i];
        b[n+1]^=b[i];
    }
    sort(c+1,c+n+2);
    sort(d+1,d+n+2);
    for(int i = 1;i<=n+1;i++){
        if(c[i]!=d[i]){
            printf("-1\n");
            return 0;
        }
    }
    int ans=0;
    int ok=0;
    for(int i = 1;i<=n+1;i++){
        if(a[i]!=b[i]){
            int fa=Find(a[i]),fb=Find(b[i]);
            f[fa]=fb;
            if(i!=n+1)
            ans++;
        }
    }
    int fx=Find(a[n+1]);
  //  printf("?\n");
    for(auto it:f){
        if(it.x==it.y)ans++;
    }
    printf("%d\n",ans-1);
}
/*

23847657 
23458792534

102334155
111111111 
111111111
*/

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

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    int ans = N / 2;
    if (N % 2 != 0) ans += 1;
    cout << fixed << setprecision(12) << (double)ans / (double)N << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);++i)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;--i)
#define FOR(i,s,n) for(int i = s;i < (int)n;++i)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;--i)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline void out(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
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;}
constexpr int INF = 1e18;

signed main(){
	int H,W;
	cin >> H >> W;
	if(H == 1 || W == 1){
		out(1);
	}else{
		out((H * W + 1) / 2);
	}
}

Measured memory_bytes: 256
#include<iostream>

using ll = long long;

int main(){
    ll a, b, x;
    std::cin >> a >> b >> x;
    ll start;
    if(a % x == 0) start = a / x;
    else start = a / x + 1;
    ll end = b / x;
    if(start > end) std::cout << 0 << std::endl;
    else std::cout << end - start + 1 << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
string a, b, c;
int i, n;
int main()
{
	cin >> a;
	n = a.size();
	for(i = 0; i < n; i++)
	{
		b = a.substr(i, 1);
		if(b == "1") c += "1";
		if(b == "0") c += "0";
		if(b == "B" && c.size() > 0) c.erase(c.end() - 1);
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>

using namespace std;

struct edge {
  int to;
  int cost;
};

vector<bool> cash_can_arrive_goal;
// 到達できるか確認
// 有効グラフを逆にたどる
bool can_arrive_goal(const vector<vector<edge>>& reverse_edges, int from, int goal) {
  if (cash_can_arrive_goal.size() == 0) {
    cash_can_arrive_goal.assign(goal, false);

    stack<int> s;
    s.push(goal);
    while (s.size() > 0) {
      const auto& current = s.top();
      s.pop();
      cash_can_arrive_goal[current] = true;

      for (const auto& e : reverse_edges[current]) {
        if (cash_can_arrive_goal[e.to] == true) {
          continue;
        } else {
          s.push(e.to);
        }
      }
    }
  }

  return cash_can_arrive_goal[from];
}

int main() {
  int n,m,p;
  cin >> n >> m >> p;
  
  vector<vector<edge>> edges(n+1);
  vector<vector<edge>> reverse_edges(n+1);
  for (int i = 0; i < m; i++) {
    int a,b,c;
    cin >> a >> b >> c;
    edges[a].push_back({b,p-c}); // 支払いを辺の重みとして、最小値を求める
    reverse_edges[b].push_back({a,0});
  }

  //ベルマンフォード法で探す
  bool is_minus = false;
  int init_value = pow(10,9); // ありえない最大値
  vector<int> d(n+1, init_value);
  vector<bool> is_arrived(n+1, false);
  d[1] = 0; // 始点は0
  is_arrived[1] = true;
  
  for (int count = 1; count <= n; count++) {
    for (int from = 1; from <= n; from++) {
      if (!is_arrived[from]) {
        continue;
      }

      for (const auto& e : edges[from]) {
        int to = e.to;
        int old = d[to];
        is_arrived[to] = true;

        d[to] = min(d[to], d[from] + e.cost);
        if (count >= n && old != d[to]) {
          if (can_arrive_goal(reverse_edges, to, n)) {
            is_minus = true; // 負の経路あり
          }
        }
      }
    }
  }
  
  if (is_minus) {
    cout << -1 << endl;
  } else if (d[n] > 0) {
    // 支払のほうが多い
    cout << 0 << endl;
  } else {
    cout << -d[n] << endl;
  }
  
  return 0;
}


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

using namespace std;


int main()
{
  int N, F[50];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> F[i];
  }
  sort(F, F + N);

  int cur[50] = {};

  auto getCost = [&](int idx)
  {
    int ret = 114514;
    for(int i = 0; i <= idx; i++) {
      for(int j = 0; j < i; j++) {
        ret = min(ret, min(abs(cur[i] - cur[j]), 24 - abs(cur[i] - cur[j])));

      }
    }
    return (ret);
  };


  for(int i = 13; i >= 0; i--) {
    memset(cur, 0, sizeof(cur));
    bool flag = true;
    for(int j = 0; j < N; j++) {
      int s = F[j], t = 24 - F[j];

      cur[j + 1] = s;
      int st = getCost(j + 1);

      cur[j + 1] = t;
      int gt = getCost(j + 1);

      if(st >= i) {
        cur[j + 1] = s;
      } else if(gt >= i) {
      } else {
        flag = false;
      }
    }
    if(flag) {
      cout << i << endl;
      return (0);
    }

  }
  cout << 0 << endl;
}

Measured memory_bytes: 256