akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


inline void solve(){

    int n , k;
    cin >> n >> k;
    vector<int> vec(n);

    for(int i = 0; i < n; i++) {
        cin >> vec[i];
    }
    ll sum = 0;
    ll tmp = 0;
    for(int i  =0; i < n-1; i++) {
        for(int j = i+1; j < n; j++) {
            if(vec[i]==vec[j]) continue;
            tmp = (ll)k*(k+1)/2;
            if(vec[i] < vec[j]) tmp -=k;
            tmp %= SMOD;
            sum += tmp;
            sum %= SMOD;
            
        } 
    }

    cout << sum << endl;

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.String;

public class Main {

    public static void main(String[] args) {
        int A1;
        int num = 0;
        Scanner scan = new Scanner(System.in);
        String S = scan.nextLine();
        A1 = S.length();
        for(int i=0; i<(A1/2); i++){
            if(S.charAt(i) != S.charAt(A1-i-1)){
                num++;
            }
        }
        System.out.println(num);
    }
}

Measured memory_bytes: 22868
#include <iostream>
using namespace std;
 
int main()
{
   int x,k=0,i,n,z=0,v[200],m;
   cin>>n;
   for(i=1;i<=n;i++)
   {
       cin>>x;
       while(x%2==0)
       {
           x=x/2;
           k++;
       }
      v[i]=k;
      k=0;
   }
   m=v[1];
   for(i=2;i<=n;i++)
    if(m>v[i])
        m=v[i];
cout<<m;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int N; cin >> N;
	vector<int> T(N);
	vector<string> S(N);
	for(int i=0; i<N; i++) cin >> S[i] >> T[i];
	string X;
	cin >> X;

	bool f = false;
	int ans = 0;
	for(int i=0; i<N; i++){
		if (S[i] == X) {
			f = true;
		} else {
			if(f) ans += T[i];
		}
	}
	cout << ans << endl;

	return 0;
}


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

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

Measured memory_bytes: 256
s = list(input())
t = list(input())
n = len(s)
m = len(t)
k = -1
for i in range(n-m+1):
    x = s[i:i+m]
    flg = True
    for j in range(m):
        if x[j] != '?' and x[j] != t[j]:
            flg = False
            break
    if flg:
        k = i
if k != -1:
    for i in range(k,k+m):
        s[i] = t[i-k]
    for i in range(n):
        if s[i] == '?':
            s[i] = 'a'
    print(''.join(s))
else:
    print('UNRESTORABLE')

Measured memory_bytes: 9088
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(void){
  int k; cin>>k;
  queue<ll> qu;
  for(int i=1; i<=9; ++i) qu.push(i);
  while(--k){
    ll a=qu.front();
    if(a%10>0) qu.push(a*10+a%10-1);
    qu.push(a*10+a%10);
    if(a%10<9) qu.push(a*10+a%10+1);
    qu.pop();
  }
  cout<<qu.front();
  return 0;
}

Measured memory_bytes: 5144
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,k,ans;
int a[211111];
int cnt[211111];
signed main(){
	
	cin>>n;
	rep(i,n-1)cin>>a[i];
	rep(i,n){
		cnt[a[i]-1]++;
	}
	rep(i,n)cout<<cnt[i]<<endl;
}

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

int N;
int as[114514];

int main() {
  scanf("%d", &N);
  for (int i=0; i<N; i++) {
    scanf("%d", &as[i]);
  }
  sort(as, as+N);

  auto p = upper_bound(as, as+N, as[N-1]/2);
  auto q = p-1;
  if (*q >= as[N-1]-*p) printf("%d %d\n", as[N-1], *q);
  else printf("%d %d\n", as[N-1], *p);
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define dF3(i,a,b) for(int i=(a)-1;i>=(b);--i)
using namespace std;typedef long long ll;typedef double ld;int INF=0x3f3f3f3f;int INF2=0x7fffffff;ll LNF=0x3f3f3f3f3f3f3f3f;ll LNF2=0x7fffffffffffffff;

int n,q;
ll Ans;
int a[200005];

int h[100001],nxt[200001],to[200001],tot;
void ins(int x,int y){nxt[++tot]=h[x];to[tot]=y;h[x]=tot;}

int main(){
	scanf("%d",&n);
	F(i,1,n) scanf("%d",a+i);
	int ok=1;
	F(i,1,n) if(a[i]>=i) ok=0;
	F(i,1,n-1) if(a[i+1]-a[i]>=2) ok=0;
	if(!ok) return 0*puts("-1");
	F(i,2,n) if(a[i]==a[i-1]+1) ++Ans; else Ans+=a[i];
	printf("%lld",Ans);
	return 0;
}

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

using namespace std;

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

#define INF 1001001001
#define LLINF 1001001001001001001LL

int nums[100];
int n;

long long dp[100][21];

long long solve(int i, int s){
    if(s<0||s>20)return 0;
    if(dp[i][s]!=LLINF){
        //cout<<"dp!"<<endl;
        return dp[i][s];
    }
    else{
        //cout<<i<<"\t"<<s<<endl;
        if(i==n-1){
            dp[i][s]=(s==nums[n-1]);
            return s==nums[n-1];
        }
        else{
            long long t=solve(i+1, s+nums[i])+!!(i)*solve(i+1, s-nums[i]);
            dp[i][s]=t;
            return t;
        }
    }
}

int main(void){
    // Here your code !
    cin>>n;
    rep(i,n)fill(dp[i],dp[i]+21, LLINF);
    rep(i,n){
        int t;
        cin>>t;
        nums[i]=t;
    }
    //cout<<"end of input"<<endl;
    cout<<solve(0,0)<<endl;
    return 0;
}


Measured memory_bytes: 3052
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d[] = new int [n];
        
        for(int i=0; i<n;i++){
            d[i]=sc.nextInt();
        }
        
        
        int total=0;
        
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                total+=d[i]*d[j];
            }
        }
        
        System.out.println(total);
    }
}


Measured memory_bytes: 21716
import sys

n = int(input())
mod = 10 ** 9 + 7

if n == 1:
    print (1)
    sys.exit()

lis = [0] * n
lis[0] = 1
bsum = 0
ans = min(n-1,2) + (n-1) ** 2



for i in range(n-1):

    i += 1

    lis[i] += lis[i-1]

    if i - 3 >= 0:
        bsum += lis[i-3]
        bsum %= mod

    lis[i] += bsum
    lis[i] %= mod

    if i != n-1:

        ans += lis[i] * ((n-1) ** 2)
        ans += lis[i] * min(n-1 , i+2)
        ans %= mod

    

ans += lis[-1] * n
ans %= mod

#print (lis)
print (ans)


Measured memory_bytes: 48620
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    vec<ll> a(n); rep(i,n)cin >> a[i];
    ll x = a[0];
    rep(i,n-1)x = x ^ a[i+1];
    rep(i,n){
        ll ans = x ^ a[i];
       cout << ans << endl;
    }
}

Measured memory_bytes: 4724
s = input()

NUM_OF_ALPHABETS = 26

usable = [True for x in range(NUM_OF_ALPHABETS)]

for c in s:
    usable[ord(c) - ord('a')] = False

for i in range(NUM_OF_ALPHABETS):
    if usable[i]:
        print(s + chr(ord('a') + i))
        exit()

for i in range(len(s))[::-1]:
    index = ord(s[i]) - ord('a')
    usable[index] = True
    for j in range(index+1, NUM_OF_ALPHABETS):
        if usable[j]:
            print(s[0:i] + chr(ord('a') + j))
            exit()
print(-1)


Measured memory_bytes: 38384
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long
int inf = (1LL <<  62);
using namespace std;

signed main(){
    int n, m;
    cin >> n >> m;
    int can[n];
    for(int i = 0; i < n; i++){
        cin >> can[i];
    }
    int ans = 0;
    for(int i = 0; i < n - 1; i++){
        if(can[i] + can[i + 1] > m){
            if(can[i] <= m){
                ans += can[i] + can[i + 1] - m;
                can[i + 1] -= can[i] + can[i + 1] - m;
            }else{
                ans += can[i + 1];
                can[i + 1] = 0;
                ans += can[i] - m;
                can[i] = m;
            }
        }
    }
    cout << ans;
    
}


Measured memory_bytes: 1152
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
using namespace std;

int main(){
	long long a,b;
	while(cin>>a>>b ){

		cout<<a/b<<" "<<a%b<<" "<<setprecision(5)<<fixed<<a/(b*1.0)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main()
{
	string s;
	cin >> s;
	s.erase(s.end()-8,s.end());
	cout << s << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

vector<std::string> split(const string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}

int main()
{
    string input;
    getline(cin, input);

    auto inputs = split(input, ' ');
    ll x = stoll(inputs[0]);
    ll y = stoll(inputs[1]);

    int cnt = 1;
    while (true)
    {
        x *= 2;
        if (x <= y)
            cnt++;
        else
            break;
    }

    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)
to = Array.new(n){[]}
from = Array.new(n){[0, 0]}
m.times{
    a, b, c = gets.chomp.split.map(&:to_i)
    to[a] << [b, c]
    from[b][0] += 1
}
arr = to[0]
while temp = arr.shift
    a, b = temp[0], temp[1]
    from[a][0] -= 1
    from[a][1] = b if from[a][1] < b
    to[a].each{|c, d| arr << [c, from[a][1] + d]} if from[a][0] == 0
end
puts from[n - 1][1]


Measured memory_bytes: 8912
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

const ll MOD = 1e9+7;

signed main(){
    ll n;
    cin >> n;
    ll memo = 0;
    ll a[n] = {};
    rep(i,0,n){
        cin >> a[i];
        memo ^= a[i];
    }
    rep(i,0,n){
        cout << (memo ^ a[i]);
        if(i != n-1) cout << " ";
        else cout << endl;
    }
    return 0;
}


Measured memory_bytes: 5152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;

ll gcd(ll a, ll 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;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, std::vector<std::string> A, std::vector<std::string> B)
{

    for (size_t i = 0; i < N; i++)
    {
        for (size_t j = 0; j < N; j++)
        {
            bool flag = true;
            for (size_t k = 0; k < M; k++)
            {
                if (i + M <= N && j + M <= N)
                {
                    if (A[i + k].substr(j, M) != B[k])
                    {
                        flag = false;
                        break;
                    }
                }
                else
                {
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                cout << YES << endl;
                return;
            }
        }
    }

    cout << NO << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<std::string> A(N);
    for (int i = 0; i < N; i++)
    {
        std::cin >> A[i];
    }
    std::vector<std::string> B(M);
    for (int i = 0; i < M; i++)
    {
        std::cin >> B[i];
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    r = int(inputs[0])
    return r * r


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 38384
#include "bits/stdc++.h"
 
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<VVLL> VVVLL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_LARGE = 1000000100;
 
 
//debug func
template<typename T>
void vecprint(vector<T> v) {
    for(auto x : v) {
        cerr << x << " ";
    }
    cerr << endl;
}
 
template<typename T>
void vecvecprint(vector<vector<T>> v) {
    for(auto x :v) {
        REP(i, x.size()-1) {
            cerr << x[i] << " ";
        }
        cerr << x[x.size()-1] <<endl;
    }
}
 
template<typename T>
void pqprint(priority_queue<T> q) {
    while(!q.empty()) {
        cerr << q.top() << " ";
        q.pop();
    }
    cerr << endl;
}
 
template<typename T>
void qprint(queue<T> q) {
    while(!q.empty()) {
        cerr << q.front() << " ";
        q.pop();
    }
    cerr << endl;
}
 
template<typename T>
void vecqprint(vector<queue<T>> v) {
    for(int i = 0; i < v.size(); i++) {
        qprint(v[i]);
    }
}
 
template <typename Iterator>
inline bool next_combination(const Iterator first, Iterator k, const Iterator last)
{
   /* Credits: Thomas Draper */
   if ((first == last) || (first == k) || (last == k))
      return false;
   Iterator itr1 = first;
   Iterator itr2 = last;
   ++itr1;
   if (last == itr1)
      return false;
   itr1 = last;
   --itr1;
   itr1 = k;
   --itr2;
   while (first != itr1)
   {
      if (*--itr1 < *itr2)
      {
         Iterator j = k;
         while (!(*itr1 < *j)) ++j;
         iter_swap(itr1,j);
         ++itr1;
         ++j;
         itr2 = k;
         rotate(itr1,j,last);
         while (last != j)
         {
            ++j;
            ++itr2;
         }
         rotate(k,itr2,last);
         return true;
      }
   }
   rotate(first,k,last);
   return false;
}

inline double get_time_sec(void){
    return static_cast<double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count())/1000000000;
}

int main(void) {
    int n;
    cin >> n;
    VI vi(n, 0);
    int m=0, m2=0;
    REP(i, n) {
        int tmp;
        cin >> tmp;
        vi[i] = tmp;
        if(tmp > m) {
            m2 = m;
            m = tmp;
        } else if(tmp > m2) {
            m2 = tmp;
        }
    }
    REP(i, n) cout << (vi[i] == m ? m2 : m) << endl;
}

Measured memory_bytes: 2432
import java.util.HashMap;
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    sc.close();
    System.out.println((long) a * b / gcd(a,b));
  }
  public static int gcd(int a, int b){
    if(a % b == 0){
      return b;
    }
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
 
using namespace std;
 
auto main() -> int
{
  long long int HP, n = 2; cin >> HP;
  
  if(HP == 1) cout << 1 << endl; 

  else
  {
    while(HP)
    {
      HP /= 2;
      n *= 2;
    }

    cout << n/2 - 1 << endl;
  }
  
}

Measured memory_bytes: 256
n,m = map(int,input().split())
li = list(map(int,input().split()))
tmp_li = []
for _ in range(m):
    b,c = map(int,input().split())
    tmp_li.append([c,b])
tmp_li.sort(reverse=True)
#print(tmp_li)
count = 0
for t in tmp_li:
    li += [t[0]]*t[1]
    count += t[1]
    if count >=n:
        break
li.sort(reverse=True)
print(sum(li[:n]))

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  VL xs(N), ys(N);
  cin >> xs >> ys;

  LL p = 0, n = 0;
  REP(i,N){
	LL d = xs[i] - ys[i];
	if(d < 0)
	  n += -d / 2;
	else
	  p += d;
  }

  cout << (n >= p? "Yes": "No") << endl;

  return 0;
}


Measured memory_bytes: 384
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: String,
    }
    // annotate for rust-analyzer
    let n: usize = n;
    let a: String = a;
    let mut c = a.chars().collect_vec();

    let mut i = 0;
    let mut j = n - 1;
    let mut ans = 0;
    loop {
        if c[i] == 'W' && c[j] == 'R' {
            c.swap(i, j);
            i += 1;
            j -= 1;
            ans += 1;
        } else {
            if c[i] != 'W' {
                i += 1;
            } else if c[j] != 'R' {
                j -= 1;
            }
        }

        if i >= j {
            break;
        }
    }

    println!("{}", ans);
}


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

int main() {
    int n, sum = 0;
    int maxx = 0;
    cin >> n;
    vector<int> l(n);
    for(int i = 0; i < n; i++){
        cin >> l[i];
        sum += l[i];
        maxx = max(maxx, l[i]);
    }
    if(sum - maxx > maxx){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int i,j,digit;
  char str[21]={0},ch;

  scanf("%s",str);
  for(i=0;i<20 && str[i]!=0;i++){}
  digit=i;
  str[digit]=0;
  for(i=0,j=digit-1;i<digit/2;i++,j--){
    ch=str[i];
    str[i]=str[j];
    str[j]=ch;
  }
  printf("%s",str);
  printf("\n");
  return 0;
}

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

int main(){
  set<int> s;
  for(int i=0;i<3;i++){
    int a;
    cin >> a;
    s.insert(a);
  }
  if(s.size()==2){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}  

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

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

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}


double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

template<typename T>
inline T chmin(T& a, const T& b) {
	if (a > b)a = b;
	return a;
}

template<typename T>
inline T chmax(T& a, const T& b) {
	if (a < b)a = b;
	return a;
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	string s, t;
	scans(s);
	scans(t);
	int n = s.length(), m = t.length(), ans = INF, cnt = 0;
	rep(i, n - m + 1) {
		cnt = 0;
		rep(j, m) {
			if (s[i + j] != t[j])++cnt;
		}
		chmin(ans, cnt);
	}
	printf("%d\n", ans);

	Please AC;
}


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

const int MAX = 300000;
int parent[MAX], hol[MAX], siz[MAX];

int find(int x) {
	if (x == parent[x]) {
		return x;
	}
	else {
		return parent[x] = find(parent[x]);
	}
}

void merge(int a, int b) {
	a = find(a);
	b = find(b);
	if (a == b) {
		return;
	}
	if (hol[a] < hol[b]) {
		swap(a, b);
	}
	parent[b] = a;
	if (hol[a] == hol[b]) {
		hol[a]++;
	}
	siz[a] += siz[b];
}

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		parent[i] = i;
		hol[i] = 1;
		siz[i] = 1;
	}
	while (m--) {
		int a, b;
		cin >> a >> b;
		merge(a, b);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans = max(siz[i], ans);
	}
	cout << ans;
	return 0;
}



















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

int main() {
  int N, count = 1, M, ans = 0;
  cin >> N;
  M = N;
  while (N / 10 > 0) {
    N = N / 10;
    count++;
  }
  vector<int>n(count);
  for (int i = 0; i < count; i++) {
    n.at(i) = M/(pow(10,i));
  }
  vector<int>m(count);
  for (int i = 0; i < count - 1; i++) {
    m.at(i) = n.at(i) - n.at(i+1) * 10;
  }
  m.at(count-1) = n.at(count-1);
  for (int i = 0; i < count; i++) {
    ans += m.at(i);
  }
  if (M % ans == 0) {
    cout << "Yes";
  }
  else {
    cout << "No";
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,m,n;
    scanf("%d %d %d",&a,&b,&c);
    m=a-b;
    n=c-m;
    //printf("%d",n);
    if(n<0)
        printf("0");
    else
        printf("%d",n);
    return 0;

}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;



int main(){
    int n,k;
    cin>>n>>k;
    if(k==1){
        cout<<0<<endl;
    }
    else{
        cout<<n-(k-1)-1<<endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/

int main() {
    ll N;
    cin >> N;
    if (N%2==0)cout<<N<<endl;
    else cout<<N*2<<endl;
    return 0;
}


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

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
int mod = 998244353;

long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  

double eps = .000000001;

int n, m;

int main ()
{
  prep();
  
  cin >> n >> m;
  vector<int> graph[n+1];
  vector<int> rev[n+1];
  for (int i=0; i<m; i++){
      int a, b;
      cin >> a >> b;
      graph[a].push_back(b);
      rev[b].push_back(a);
  }
  int shortest = 1000000000;
  int path[1000];
  for (int i=1; i<=n; i++){
      int dists[n+1];
      bool vis[n+1] = {};
      queue<pair<int, int > > q;
      q.emplace(i, 0);
      bool did = false;
      int former = shortest;
      while (!q.empty()){
          pair<int, int > p = q.front();
          q.pop();
          int node = p.first;
          int dist = p.second;
          if (node == i && dist != 0){
              if (shortest > dist){
                  shortest = dist;
                  did = true;
              }
              break;
          }
          if (vis[node]){
              continue;
          }
          vis[node] = true;
          dists[node] = dist;
          for (int j=0; j<graph[node].size(); j++){
              q.emplace(graph[node][j], dist+1);
          }
      }
      if (!did){
          continue;
      }
      int len = 0;
      // recover path
      int curdist = shortest-1;
      int curnode = i;
      vector<int> put;
      while (curdist >= 0){
          bool didd = false;
          for (int j=0; j<rev[curnode].size(); j++){
              if (dists[rev[curnode][j]] == curdist){
                  put.push_back(curnode);
                  curnode = rev[curnode][j];
                  curdist--;
                  didd = true;
                  break;
              }
          }
          if (!didd){
              break;
          }
      }
      if (put.size() != shortest){
          shortest = former;
      }else{
          for (int j=0; j<put.size(); j++){
              path[j] = put[j];
          }
      }
  }
  if (shortest == 1000000000){
      cout << -1;
  }else{
      cout << shortest << '\n';
      for (int i=0; i<shortest; i++){
          cout << path[i] << '\n';
      }
  }
  return 0; 
}


Measured memory_bytes: 384
'use strict'

function Main(input) {
    let temp = input.trim().split(' ');
    let a = parseInt(temp[0]);
    let b = parseInt(temp[1]);

    let sum;
    if(a>b){
        sum=a+a-1;
    }else if(a===b){
        sum = a+b;
    }else{
        sum=b+b-1;
    }
    console.log(sum);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 9420
#include<iostream>

using namespace std;

int main(){
    int a,b,k;
    cin >> a >> b >> k;

    int count=0;
    int i;
    for(i=100;i > 0;i--){
        if(a%i == 0 && b%i == 0){
            count++;
            if(count == k){
                break;
            }
        }
    }
    
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAXN 2010
bitset<2000010> f;
int a[MAXN],n,sum;

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",a+i),sum+=a[i];
    f[0]=1;
    for(int i=n;i>=1;--i)f|=f<<a[i];
    for(int i=(sum+1)>>1;i<=sum;++i)
        if(f[i]){
            printf("%d\n",i);
            return 0;
        }
}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll h,w; cin>>h>>w;
    vector<string> c(h);
    rep(i,h) cin>>c[i];
    rep(i,h)rep(j,2) cout<<c[i]<<endl;
    return 0;
}

Measured memory_bytes: 3616
N, A, B, C = [int(i) for i in input().split()]
L = [int(input()) for _ in range(N)]
ans = float("inf")
for i in range(2 ** (N * 2)):
    a = b = c = 0
    cnt = 0
    for j in range(N):
        bit = i & 3
        if bit == 1:
            a += L[j]
        elif bit == 2:
            b += L[j]
        elif bit == 3:
            c += L[j]
        if bit:
            cnt += 1
        i >>= 2
    if a and b and c:
        ans = min(ans, (cnt - 3) * 10 + abs(A - a) + abs(B - b) + abs(C - c))
print(ans)

Measured memory_bytes: 45292
#include <iostream>


int main()
{
	int N, M, X, tmp;
	std::cin >> N;
	std::cin >> M;
	std::cin >> X;

	int right = 0, left = 0;
	for (int i = 0; i < M;i++) {
		std::cin >> tmp;
		if (tmp > X) {
			right++;
		} else {
			left++;
		}
	}

	std::cout << ((left < right) ? left: right) << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,b,tot,tot2,L,LL,ans;
ll a[500],A[500],s1[501],s2[501];
vector<ll> u;
int main(void){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>a[i];
        tot2+=a[i];
    }
    for(ll i=1;i*i<=tot2;i++){
        if(tot2%i==0){
            u.push_back(i);
            u.push_back(tot2/i);
        }
    }
    for(ll x:u){
        for(int i=0;i<n;i++){
            A[i]=a[i]%x;
        }
        sort(A,A+n);
        for(int i=0;i<=n;i++){
            s1[i]=0;
            s2[i]=0;
        }
        for(int i=0;i<n;i++){
            s1[i+1]=s1[i]+A[i];
            s2[i+1]=s2[i]+x-A[n-i-1];
        }
        for(int i=0;i<=n;i++){
            //cout<<s1[i]<<" "<<s2[n-i]<<endl;
            if(s1[i]==s2[n-i])LL=s1[i];
        }
        if(LL<=m)ans=max(ans,x);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a,b,A,B,aa,bb,aaa,bbb;
string s;
bool judge(int a,int b,int A,int B)
{
    A-=b;
    B-=a;
    return A>=0&&B>=0&&A==B;
}
vector<pair<int,int>>v;
bool cmp(pair<int,int>x,pair<int,int>y)
{
    return min(x.first,y.second)>min(x.second,y.first);
}
int main()
{
    srand(time(0));
    cin>>n;
    while(n--)
    {
        cin>>s;
        int l=0,r=0;
        for(int i=0;i<s.size();i++)
            if(s[i]=='(') r++;
        else
        {
            if(r) r--;
            else l++;
        }
        if(l&&r) v.push_back({l,r});
        else if(l) A+=l;
        else if(r) B+=r;
    }
    sort(v.begin(),v.end(),cmp);
    for(pair<int,int>x:v)
    {
        int l=x.first,r=x.second;
        int k=max(min(a,r),min(b,l));
        a=a+l-k;
        b=b+r-k;
    }
    if(judge(a,b,A,B))
        printf("Yes\n");
    else
    {
        printf("No\n");
    }
}


Measured memory_bytes: 5276
n = int(input())
tree = [[] for i in range(n+1)]

for i in range(1,n):
    u, v, w = map(int, input().split())
    tree[u].append((v, w))
    tree[v].append((u, w))

#print(tree)
stack=[1]
visitted={}
ans=[0]*n

while stack:
    cur = stack.pop()
    pre=ans[cur-1]
    visitted.setdefault(cur,1)
    #visitted.append(cur)
    for v, w in tree[cur]:
        if v in visitted:
            continue
        if w % 2 == 1:
            ans[v-1]=(pre+1)%2
        else:
            ans[v-1]=pre
        stack.append(v)

print(*ans, sep='\n')


Measured memory_bytes: 47268
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int main()
{
  int a, b;
  cin >> a >> b;
  int ans = a*(a - 1)/2 + b*(b - 1)/2;
  cout << ans << endl;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 998244353
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    li n;
    cin >> n;
    set<li> st;
    rin{
        li a;
        cin >> a;
        if (st.count(a) == 0) {
            st.insert(a);
        } else{
            st.erase(a);
        }
    }
    cout << sz(st) << endl;

    return 0;
}

Measured memory_bytes: 4864
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;


public class Main {
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    
    int[] time = new int[101];
    
    for (int i = A; i < B; i ++) {
      time[i] ++;
    }
    for (int i = C; i < D; i ++) {
      time[i] ++;
    }
    
    int count = 0;
    for (int i = 0; i < time.length; i ++) {
      if (time[i] == 2) {
        count ++;
      }
    }
    System.out.println(count);
  }

}


class FastScanner {
	public static String debug = null;

	private final InputStream in = System.in;
	private int ptr = 0;
	private int buflen = 0;
	private byte[] buffer = new byte[1024];
	private boolean eos = false;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				if (debug != null) {
					buflen = debug.length();
					buffer = debug.getBytes();
					debug = "";
					eos = true;
				} else {
					buflen = in.read(buffer);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen < 0) {
				eos = true;
				return false;
			} else 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;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean isEOS() {
		return this.eos;
	}

	public boolean hasNext() {
		skipUnprintable();
		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() {
		return (int) nextLong();
	}

	public long[] nextLongList(int n) {
		return nextLongTable(1, n)[0];
	}

	public int[] nextIntList(int n) {
		return nextIntTable(1, n)[0];
	}

	public long[][] nextLongTable(int n, int m) {
		long[][] ret = new long[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextLong();
			}
		}
		return ret;
	}

	public int[][] nextIntTable(int n, int m) {
		int[][] ret = new int[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextInt();
			}
		}
		return ret;
	}
}

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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 7;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 4e2 + 5;

int A[N], B[N], PW[N][N], PS[N][N], DP[N][N];

int main() {
 
	sync;

	for (int i = 0; i < N; i++) {
		PW[i][0] = 1;
		for (int j = 1; j < N; j++) PW[i][j] = 1LL * PW[i][j - 1] * i % MOD;
	}
	for (int i = 0; i < N; i++) PS[0][i] = PW[0][i];
	for (int i = 1; i < N; i++) for (int j = 0; j < N; j++) PS[i][j] = (PS[i - 1][j] + PW[i][j]) % MOD;

	int n, c; cin >> n >> c;
	for (int i = 1; i <= n; i++) cin >> A[i];
	for (int i = 1; i <= n; i++) cin >> B[i];
	DP[0][0] = 1;
	for (int i = 1; i <= n; i++) for (int j = 0; j <= c; j++) for (int k = 0; k <= j; k++) {
		DP[i][j] = (DP[i][j] + 1LL * DP[i - 1][j - k] * (PS[B[i]][k] - PS[A[i] - 1][k] + MOD) % MOD) % MOD;
	}
	cout << DP[n][c] << endl;

	return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n,k;
    cin >> n >> k;
    long ans = 0;
    for(long i=k;i<=n+1;i++){
        long minn = (i*(i-1))/2;
        long maxx = i*(n + (n-i+1))/2;
        
        ans += maxx-minn+1;
        ans %= 1000000007;
        
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 3604
import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    n = sc.intarr()[0]
    s = sc.strarr()[0]

    new_str = ''
    for i in s:
        i = ord(i)
        i = i + n
        if i > 90:
            i -= 26
        i = chr(i)
        new_str += i

    print(new_str)


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()


Measured memory_bytes: 3064
#include <cstdio>
typedef long long ll;
const int maxa = 1005;
const int maxb = 1000005;
const int maxn = 10005;
const ll p = 1000000007;

bool isp[maxa]; ll pc = 0, pr[maxa];
void sieve()
{
	for (int i = 0; i < maxa; i++) isp[i] = true;
	for (int i = 2; i < maxa; i++)
	{
		if (isp[i]) pr[pc++] = i;
		for (int j = 0; j < pc && pr[j]*i < maxa; j++)
		{
			isp[i*pr[j]] = false;
			if (pr[j]%i==0) break;
		}
	}
}

ll pow(ll a, ll n) { if (n == 0) return 1; ll b = pow(a, n/2); return n%2==0?b*b%p:b*b%p*a%p; }

int b[maxb];
int n; ll a[maxn];
int main()
{
	sieve();
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%lld", a+i);
	for (int i = 0; i < maxb; i++) b[i] = 0;
	for (int i = 0; i < n; i++)
	{
		int x = a[i];
		for (int j = 0; j < pc; j++)
		{
			int c = 0;
			while (x % pr[j] == 0) x /= pr[j], c++;
			if (b[pr[j]] < c) b[pr[j]] = c;
		}
		b[x] = 1;
	}
	
	ll lca = 1;
	for (int i = 2; i < maxb; i++) for (int j = 0; j < b[i]; j++) lca = lca*i%p;
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans = (ans+lca*pow(a[i], p-2)%p)%p;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 4096
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Node{
	private long value;
	private int next;

	Node (long v){
		value = v;
		next = -1;  //null代わり
	}

	public void setNext(int p) { next = p; }
	public long getValue() { return value; }
	public int getNext() { return next; }


}

class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner (System.in)){
			List<Node> all = new ArrayList<Node>();
			int n = sc.nextInt();
			int[] first = new int[n];
			int[] last = new int[n];
			for (int i=0; i<n; i++) {
				first[i] = last[i] = -1;  //nullにする
			}
			int times = sc.nextInt();
			for (int i=0; i<times; i++) {
				int query = sc.nextInt();  //命令：0 insert 1 dump 2 splice
				int al,al2 ;  //何個目のArrayList
				switch (query) {
				//insert(al,x)
				case 0:
					al = sc.nextInt();
					long x = sc.nextLong();
					all.add(new Node(x));
					int now = all.size()-1;  //今入れた位置
					if (first[al] == -1) {  //なにも入っていない場合
						first[al] = last[al] = now;  //今入れた位置を記録
					} else {
						all.get(last[al]).setNext(now);
						last[al] = now;
					}
					break;
				//dump(al)
				case 1:
					al = sc.nextInt();
					int target = first[al];  //先頭を取得
					if (target != -1) {  
						System.out.print(all.get(target).getValue());  //数字を出力
						while (all.get(target).getNext() != -1) {
							target = all.get(target).getNext();
							System.out.print(" " + all.get(target).getValue());  //数字を出力
						}
					}
					System.out.print('\n');  //空行出力
					break;
				//splice(al2,al)
				case 2:
					al2 = sc.nextInt();
					al = sc.nextInt();
					if (first[al] == -1) {  //なにも入っていない場合
						first[al] = first[al2];
						last[al] = last[al2];
					} else {
						all.get(last[al]).setNext(first[al2]);
						last[al] = last[al2];
					}
					first[al2] = last[al2] = -1;  //al2をnullにする
					break;
				}
			}

		}
	}
}


Measured memory_bytes: 316432