akhauriyash/Code-Regression huggingface dataset:
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug (fprintf(stderr,"orzyrt\n"),fflush(stderr))
	#define debug(__a...) (fprintf(stderr,__a),fflush(stderr))
	#define setfile(__a) ('orzyrt')
	#define Compile(__a) system("g++ "__a".cpp -lm -o "__a)
#else
	#define Debug ('orzyrt')
	#define debug(__a...) ('orzyrt')
	#define setfile(__a) freopen(__a".in","r",stdin);freopen(__a".out","w",stdout)
	#define Compile(__a) ('orzyrt')
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline TT cmin(R TT &a,R TT b){(b<a)&&(a=b);}
template<class TT>inline TT cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

namespace Night{
	const int maxn = 100010;
	int gcd(R int a,R int b){return b?gcd(b,a%b):a;}
	int x[maxn];
	int n;
	int X;
	int ans;
	int main(){
		read(n);read(X);
		for(R int i=1;i<=n;++i)read(x[i]);
		if(n==1){
			printf("%d\n",Abs(x[1]-X));
			return 0;
		}
		ans=gcd(Abs(x[1]-X),Abs(x[2]-X));
		for(R int i=3;i<=n;++i){
			R int d=x[i]-X;
			d=Abs(d);
			ans=gcd(ans,d);
		}
		printf("%d\n",ans);
		return 0;
	}
}
int main(){
	return Night::main();
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a,b;
	cin >> a >> b;
	int ans = 0;
	for (int i = a; i <= b; i++) {
		string str = to_string(i);
		bool flag = true;
		for (int j = 0; j < (int)str.length()/2; j++) {
			if (str[j] == str[str.length()-1-j]) continue;
			else {
				flag = false;
				break;
			}
		}
		if (flag) ans++;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        ++$this->pointer;

        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int) $this->next();
    }

    public function nextDouble()
    {
        return (float) $this->next();
    }
}

$sc = new Scanner();
$a = $sc->nextInt();
$b = $sc->nextInt();
$num = $a;
$count = 0;

while($num <= $b){
    $num = $num * 2;
    $count++;
}

echo $count.PHP_EOL;


Measured memory_bytes: 16256
#include <cstdio>
#include <algorithm>
using namespace std;

#define int long long
#define N 2005

int n,f[N][N],ans=0;
pair <int,int> a[N];

inline int read(){
	int s=0,t=1;
	char c=getchar();
	while((c<'0'||c>'9')&&c!='-')c=getchar();
	if(c=='-')c=getchar(),t=-1;
	while(c>='0'&&c<='9')s=(s<<1)+(s<<3)+(c^48),c=getchar();
	return s*t;
}

int ABS(int x){
	if(x<0)return -x;
	return x;
}

signed main(void){
	n=read();
	for(int i=0;i<n;i++){
		a[i].first=read();
		a[i].second=i;
	}
	sort(a,a+n);
	reverse(a,a+n);
	for(int i=0;i<n;i++){
		for(int j=0;j<=i;j++){
			int k=n-(i-j);
			f[j+1][k]=max(f[j+1][k],f[j][k]+a[i].first*ABS(a[i].second-j));
			f[j][k-1]=max(f[j][k-1],f[j][k]+a[i].first*ABS(a[i].second-(k-1)));
		}
	}
	for(int i=0;i<=n;i++)
	ans=max(ans,f[i][i]);
	printf("%lld\n",ans);
} 

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

string s1, s2;

int main(){
	cin>>s1>>s2;
	
	for(int i=0; i<s2.size(); i++){
		cout<<s1[i]<<s2[i];
	}
	if(s1.size()>s2.size()) cout<<s1[s1.size()-1];
	cout<<endl;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<string.h>
int main(void){
  int i, k;
  char s[101];
  scanf("%d%s", &k, &s);
  if(k>=strlen(s)){
    printf("%s" ,s);
  }
  else{
    for(i=0;i<k;i++){
      printf("%c", s[i]);
    }
    printf("...");
  }
  return 0;
}
    


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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int cnt1 = c/b+bool(c%b);
	int cnt2 = a/d+bool(a%d);
	if (cnt1 <= cnt2) cout << "Yes";
	else cout << "No";
	return 0;
}



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

#define INF 9'000'000'000'000'000;
#define int long long
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;

class SegmentTree {
private:
	int n;
	vector<int> node;
public:
	SegmentTree (vector<int> v) {
		int sz = v.size();
		n = 1;while(n < sz) n *= 2;
		node.resize(2*n-1, -1);
		for (int i = 0;i < sz;i++) {node[i+n-1] = v[i];}
		for (int i = n-2;i >= 0;i--) node[i] = max(node[2*i+1], node[2*i+2]);
	}

	int getmax(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		//要求区間と対象区間が交わらない
		if (r <= a || b <= l) return -1;
		//要求区間と対象区間を完全に被覆
		if (a <= l && r <= b) return node[k];
		int vl = getmax(a,b,2*k+1,l,(l+r)/2);
		int vr = getmax(a,b,2*k+2,(l+r)/2,r);
		return max(vl,vr);
	}
};

signed main() {
	int n;
	cin >> n;
	int a[5];
	int mi = INF;
	REP (i,5) {cin >> a[i];mi = min(mi,a[i]);if (mi < a[i]) a[i] = mi;}
	int time = 0;
	REP (i,5) {
		if (i == 0) {time = n / a[0];if (n % a[0] != 0) time++;}
		else {
			int now = n - (time-i) * a[i];
			time += now / a[i];
			if (now % a[i] != 0) time++;
		}
	}
	cout << time << endl;
}

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

int main(){
    int n, m;
    cin>>n>>m;
    vector<int> arr[200009];
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        arr[a].push_back(b);
        arr[b].push_back(a);
    }
    vector<int> mid;
    for(int i=0;i<arr[1].size();i++){
        mid.push_back(arr[1][i]);
    }
    for(int i=0;i<mid.size();i++){
        for(int j=0;j<arr[mid[i]].size();j++){
            if(arr[mid[i]][j]==n){
                cout<<"POSSIBLE";
                return 0;
            }
        }
    }
    cout<<"IMPOSSIBLE";
    return 0;
}

Measured memory_bytes: 12784
#include <cstdio>
int main (){
    int a,b;scanf ("%d%d",&a,&b);
    if (a<=0&&b>=0) puts("Zero");
    else if (a<0&&b<0&&((b-a+1)&1)) puts("Negative");
    else puts("Positive");
    return 0;
}

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


#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ll long long


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

    cin >> s;

    int tam = s.size();
    int i = 0;
    int rem = 0;

    while ( i < tam - 1 ) {
        // cout << s << endl;
        if ( (s[i] == '0' and s[i + 1] == '1') or (s[i] == '1' and s[i + 1] == '0') ) {
            tam -= 2;
            rem += 2;
            s.erase(i, 2);
            i--;
        } else {
            i++;
        }
    }

    cout << rem << endl;


    return 0;
}

Measured memory_bytes: 512
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();

    if(A >= 13){
      System.out.println(B);
    }else if (A >= 6){
      System.out.println(B/2);
    }else{
      System.out.println(0);
    }
  }
}


Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
int64_t X,Y,A,B,C,ans=0LL;
int main(void){
    cin>>X>>Y>>A>>B>>C;
    int p[A],q[B],r[C];
    for(int i=0;i<A;i++)cin>>p[i];
    for(int i=0;i<B;i++)cin>>q[i];
    for(int i=0;i<C;i++)cin>>r[i];
    sort(p,p+A,std::greater<int64_t>());
    sort(q,q+B,std::greater<int64_t>());
    sort(r,r+C,std::greater<int64_t>());
    stack<int64_t>red,blue;
    for(int i=0;i<X;i++)ans+=p[i],red.push(p[i]);
    for(int i=0;i<Y;i++)ans+=q[i],blue.push(q[i]);
    for(int i=0;i<C;i++){
        if(min((red.empty()?1000000001:red.top()),(blue.empty()?1000000001:blue.top()))<r[i]){
            if((red.empty()?1000000001:red.top())<(blue.empty()?1000000001:blue.top()))ans+=r[i]-red.top(),red.pop();
            else ans+=r[i]-blue.top(),blue.pop();
        }
        else break;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main(){
ll N, Ans = 0, Total = 0;cin >> N;
vector<ll> V(N);
vector<ll> T{0};

rep(i, 0, N){

    cin >> V[i];

    Total += V[i];

    T.push_back(Total);

}

rep(i, 0, N - 1){
  
 ll X = (Total - T[i + 1])%1000000007;

    Ans += V[i]*X;

    Ans %= 1000000007;

}

cout << Ans;

}

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

int main() {
	
	int n,m,x;
	cin >> n >> m >> x;
	int i,a[m+1];
	int costS=0,costE=0;
	
	for(i=0;i<m;++i)cin>>a[i];
	
    for(i=0;i<m;++i){
       if(a[i]>x)costE++;
       else costS++;
    }
	
	int ans=min(costS,costE);
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cout << #v "=" << (v) << endl;
#define ppa(v) cout << "----\n"; rep(i,v.size()) cout << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;

int main() {
  int n;cin>>n;
  string s;cin>>s;
  int x = 0;
  int ans = 0;
  rep(i,n) {
    x += (s[i]=='I')-(s[i]=='D');
    ans = max(ans,x);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

const int mod = 1e9 + 7;
const int mod2 = 998244353;

void fact_init(int n);
ll exp(ll taban, ll us, ll md);
ll ebob(ll a, ll b);
ll ekok(ll a, ll b);
ll komb(ll a, ll b);

vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
    fact.resize(n+5);
    inv_fact.resize(n+5);
    fact[0] = inv_fact[0] = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = (fact[i-1] * i) % mod;
        inv_fact[i] = exp(fact[i], mod-2, mod);
    }
}
ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
    if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}

ll komb(ll a, ll b){
    if(a < b) return 0;
    return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}

const int N = 1e5 + 5;

int main(){
    ios::sync_with_stdio(false); cin.tie(NULL);
	int n, x, t; cin>>n>>x>>t;
	cout<<(n + x + -1)/x * t;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 
// nomura 2020 c
int main() {
  int n; cin >> n;
  vector<ll> a(n+1);
  cin >> a[0];
  rep(i,n) {
    cin >> a[i+1];
  }  
  vector<pll> range(n+1);
  range[n] = pll(a[n], a[n]); 
  for (int i=n-1; i>=0; i--) {
    ll mx = range[i+1].second + a[i];
    ll mn = ceil(range[i+1].first/(double)2) + a[i];
    range[i] = pll(mn, mx);
  } 
  if (range[0].first > 1) {
    cout << -1 << endl; return 0;
  }
  ll ans = 1;
  ll prevBranch = 1 - a[0];
  for (int i=1; i<=n; i++) {
    ll node = min(2ll * prevBranch, range[i].second);
    ans += node;
    prevBranch = node - a[i];
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 5564
// @author: arch_

#include <bits/stdc++.h>
using namespace std;

int main(void) {
    int h, w;
    vector<array<int, 2>> a;
    while (cin >> h >> w, h | w) {
        array<int, 2> i{h, w};
        a.emplace_back(i);
    }
    for (auto&& i : a) {
        for (int y = 0; y < i[0]; y++) {
            for (int x = 0; x < i[1]; x++) {
                cout << (0 < y && y < i[0] - 1
                         && 0 < x && x < i[1] - 1 ? "." : "#");
            } cout << "\n";
        } cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
const int mod = 1e9 + 7;
typedef pair<lint, lint> pi;
 
lint d;
lint p[20];
int dx1[20], dx2[20];
vector<lint> v;
 
void dfs(int s, int e, vector<pi> &w, lint val, lint cnt){
	if(s == e){
		w.push_back(pi(val, cnt));
		return;
	}
	for(int i=-9; i<=9; i++){
		dfs(s+1, e, w, val + i * v[s], cnt * (s == 0 ? dx2[i + 10] : dx1[i + 10]));
	}
}
 
lint solve(int l){
	v.clear();
	for(int i=0; l-1-i > i; i++){
		v.push_back(p[l-1-i] - p[i]);
	}
	vector<pi> v1, v2;
	dfs(0, (v.size() + 1) / 2, v1, 0, 1);
	dfs((v.size() + 1) / 2, v.size(), v2, 0, 1);
	lint ans = 0;
	map<lint, lint> mp;
	for(auto &i : v2) mp[i.first] += i.second;
	for(auto &i : v1){
		ans += mp[i.first + d] * i.second;
	}	
	if(l % 2 == 1) ans *= 10;
	return ans;
}
 
int main(){
	p[0] = 1;
	for(int i=1; i<20; i++) p[i] = p[i-1] * 10;
	for(int i=0; i<10; i++){
		for(int j=0; j<10; j++){
			dx1[i-j+10]++;
		}
	}
	for(int i=1; i<10; i++){
		for(int j=0; j<10; j++){
			dx2[i-j+10]++;
		}
	}
	cin >> d;
	lint ans = 0;
	for(int i=2; i<=18; i++) ans += solve(i);
	cout << ans << endl;
}

Measured memory_bytes: 206928
n = int(input())
a = [0] * n
b = [0] * n
task = []

for i in range(n):
  a[i],b[i] = map(int, input().split())
  temp = [a[i],b[i]]
  task.append(temp)
  
task.sort(key=lambda x: x[1])
suma = 0
output = 'Yes'

for i in range(n):
  suma += task[i][0]
  if suma > task[i][1]:
    output = 'No'
    break

print(output)


Measured memory_bytes: 41768
import numpy as np
n=int(input())
V=[int(v) for v in input().split()]

M=max(V)
count_odd=np.array([0 for i in range(M+1)])
count_even=np.array([0 for i in range(M+1)])

for i in range(len(V)):
	if(i%2==0):
		count_even[V[i]]+=1
	if(i%2==1):
		count_odd[V[i]]+=1

if(np.argmax(count_odd)!=np.argmax(count_even)):
	print(n-max(count_odd)-max(count_even))
else:
	count_odd.sort()
	count_even.sort()
	print(min(n-count_odd[-1]-count_even[-2],n-count_odd[-2]-count_even[-1]))

Measured memory_bytes: 23408
#include <iostream>
#include <vector>
#include <array>

using namespace std;

template<int mod>
struct Ring_mod {
    int val;
    Ring_mod(): val(0) {}
    Ring_mod(int x)
    {
        if (x < 0) x += mod;
        if (x >= mod) x -= mod;
        val = x;
    }
    explicit operator int() { return val; }
    Ring_mod operator+(const Ring_mod& b) { return Ring_mod(val + b.val); }
    Ring_mod operator-(const Ring_mod& b) { return Ring_mod(val - b.val); }
    void operator+=(const Ring_mod& b) { val = Ring_mod(val + b.val).val; }
    void operator-=(const Ring_mod& b) { val = Ring_mod(val - b.val).val; }
};

typedef Ring_mod<(int) 1e9 + 7> int_mod;

struct Array {
    int_mod& operator[](int id) { return a[id]; }
    int_mod get(int id) const { return id >= 0 ? a[id] : 0; }
    vector<int_mod> a;
};

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int& x : a) cin >> x;
    array<Array, 2> dp;
    dp.fill({vector<int_mod>(k + 1, 0)});

    auto& cur = dp[0];
    auto& pre = dp[1];
    cur[0] = 1;
    for (int i = 0; i < n; ++i) {
        swap(cur, pre);
        for (int j = 0; j <= k; ++j)
            cur[j] = cur.get(j - 1) + pre[j] - pre.get(j - a[i] - 1);
    }
    cout << (int) cur[k];
    return 0;
}


Measured memory_bytes: 1408
def insertionSort(A, n, gap):
    cnt = 0
    for i in range(gap, n):
        v = A[i]
        j = i - gap
        while j >= 0 and A[j] > v:
            cnt += 1
            A[j + gap] = A[j]
            j = j - gap
        A[j + gap] = v
    return cnt


def shellSort(A, n):
    if len(A) == 1:
        print(1,1,0,A[0],sep='\n')
        exit()
    cnt = 0
    G = []
    m = 1
    while (3**m - 1) // 2 < n:
        G.append((3**m - 1) // 2)
        m += 1
    m -= 1
    print(m)
    for i in range(m):
        cnt += insertionSort(A, n, G[m - i - 1])
    print(*G[::-1])
    print(cnt)
    print(*A, sep='\n')

N = int(input())
A = list([int(input()) for i in range(N)])
shellSort(A, N)

Measured memory_bytes: 63156
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
const int maxn=25;
int a[maxn],b[maxn];

int main()
{
    //freopen("int.txt","r",stdin);
    int w,h;
    while(~scanf("%d%d",&w,&h)&&w&&h){
        int num;
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        for(int i=0;i<w;i++){
            scanf("%d",&num);
            a[num]++;
        }
        for(int i=0;i<h;i++){
            scanf("%d",&num);
            b[num]++;
        }
        int ans=0;
        for(int i=1;i<=20;i++){
            ans+=max(a[i],b[i])*i;
        }
        printf("%d\n",ans);
    }
    return 0;
}

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

int main(){
    int h,n;
    cin>>h>>n;
    
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    
    sort(a.begin(),a.end());
    bool flag=false;
    rep(i,n){
        h-=a[i];
        if(h<=0){
            flag=true;
            break;
        }
    }
    
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3792
#include<stdio.h>

main(){
  int a,b,c;
  
  scanf("%d %d %d", &a, &b, &c);
  
  if(a+b==c || b+c==a|| c+a==b){
    printf("Yes\n");
  }else{
  	printf("No\n");
  }
  
}  
  

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



set<int>q;
int n,x;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x;
        if(q.find(x)!=q.end()){
            q.erase(x);
        }
        else{
            q.insert(x);
        }
    }
    cout<<q.size();
}


Measured memory_bytes: 4992
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const s = input[0];
let result = Infinity;
for (let i = 0; i + 2 < s.length; i++) {
  const tmp = Math.abs(+s.substring(i, i + 3) - 753);
  if (tmp < result) result = tmp;
}

console.log(result);


Measured memory_bytes: 7372
#include <cmath>
#include <iostream>

using namespace std;

using ull = unsigned long long;

int main(int argc, const char *argv[]) {
  ull n;
  cin >> n;

  if (n % 2 == 1) {
    cout << 0 << '\n';
    return 0;
  }

  n /= 2;
  ull ans = 0;
  while (n != 0) {
    ans += n / 5;
    n /= 5;
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
import sys

n = int(input())
aL = [int(input()) for i in range(n)]

count = 1
tmp_num = aL[0]
if tmp_num == 2:
    print(1)
    sys.exit()
for i in range(n-1):
    tmp_num = aL[tmp_num-1]
    count += 1
    if tmp_num == 2:
        print(count)
        sys.exit()
print(-1)

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }

  int mi = INF, ans = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] <= mi) ans++;
    mi = min(mi, v[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1152
package main

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

//•*¨*•.¸¸♪I/O•*¨*•.¸¸♪

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a,_ := strconv.ParseInt(sc.Text(),10,64)
	return a
}

func scanFloat64() float64 {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return float64(a)
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer(make([]byte, 10000), 100000000)

	n := scanInt()
	as := scanInts(n)

	pf := make([]map[int]int, n)
	for i := 0; i < n; i++ {
		pf[i] = factorize(as[i])
	}

	gcm := make(map[int]int, n)

	for i := 0; i < n; i++ {
		for num,e := range pf[i] {
			gcm[num] = max(gcm[num],e)
		}
	}

	l := 1
	for num, e := range gcm {
		l = l*mpow(num,e)%mod
	}

	ans := 0
	for i := 0; i < n; i++ {
		ans = (ans+l*mpow(as[i],mod-2)%mod)%mod
	}

	fmt.Println(ans)
}

const mod = 1000000007

func factorize(n int) map[int]int {
	res := make(map[int]int, 0)
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			res[i]++
			n /= i
		}
	}
	if n!=1 {
		res[n] = 1
	}
	return res
}

func min(a ...int) int {
	res := a[0]
	for i := 1; i < len(a); i++ {
		if res > a[i] { res = a[i] }
	}
	return res
}

func max(a ...int) int {
	res := a[0]
	for i := 1; i < len(a); i++ {
		if res < a[i] { res = a[i] }
	}
	return res
}

func mpow(a,n int) int {
	res := 1
	for n>0 {
		if n&1 == 1 {
			res = res*a%mod
		}
		a = a*a%mod
		n= n>>1
	}
	return res
}


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

typedef long long ll;
typedef pair<int,int> P;

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(c,it) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	static bool p[50001];
	fill(p, p + 50001, true);
	p[0] = p[1] = false;
	for(int i = 2; i * i < 50001; i++)
		if(p[i])
			for(int j = 2 * i; j < 50001; j += i)
				p[j] = false;
	for(int a; cin>>a, a;) {
		int ans = 0;
		for(int i = 2; 2 * i <= a; i++) {
			if(p[i] && p[a - i]) ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,c,d=0,e,f,i,j,k,l;
    scanf("%lld",&a);
    c=100;
    while(c<a)
    {
        c+=c/100;
        d++;
    }
    printf("%lld\n",d);
    return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <vector>
//#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.ohajiki", "r", stdin );
	int n;

	while (1) {
		cin >> n;

		if (n == 0 ){
			break;
		} // end if

		vector <int> a (n, 0 );
		int i;

		for (i = 0; i < n; ++i){
			cin >> a[i];
		} // end for
		int ohajiki = 32;
		i = 0;		
	
		while (ohajiki > 0 ){
			int taro = (ohajiki - 1 ) % 5;
			ohajiki -= taro;
			cout << ohajiki << endl;
			int jiro = min (a[i], ohajiki );
			ohajiki -= jiro;
			cout << ohajiki << endl;
			i = (i + 1) % n;
		} // end while
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>

using namespace std;

struct Node {
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k) {
	while(u != NIL && k != u->key) {
		if(k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;
	
	z = (Node *)malloc(sizeof(Node));
	z->key   = k;
	z->left  = NIL;
	z->right = NIL;
	
	while(x != NIL) {
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	
	z->parent = y;
	if(y == NIL) {
		root = z;
	} else {
		if( z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if(u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u) {
	if(u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
	
int main(void) {
	int n, i, x;
	string com;
	scanf("%d",&n);
	
	for(i=0;i<n;i++) {
		cin >> com;
		if(com[0] == 'f') {
			scanf("%d",&x);
			Node *t = find(root,x);
			if(t != NIL) printf("yes\n");
			else printf("no\n");
		} else if(com == "insert") {
			scanf("%d",&x);
			insert(x);
		} else if(com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}

	return 0;
}

/*
8
insert 30
insert 88
insert 12
insert 1
insert 20
find 12
insert 17
insert 25
find 16
print
*/


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

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

  int count;
  if(a+b==c||b+c==a||c+a==b){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
using namespace std;
#define reep(i,a,b) for(int i=(a);i<(b);++i)
int main() {
	int n;
	cin>>n;
	int a[4];
	reep(i,0,4){
		cin>>a[i];
		--a[i];
	}
	int ans=999;
	reep(i,1,n+1){
		ans=min(ans,abs(a[0]%i-a[1]%i)+abs(a[0]/i-a[1]/i)+abs(a[2]%i-a[3]%i)+abs(a[2]/i-a[3]/i));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <set>
#include <bitset>
#include <limits>

using namespace std;

#define ll long long

int main(void){
    int n;
    cin >> n;

    multiset<int> coe;
    for(int x = 1;x <= (int)sqrt((double)n)+1;++x){
        for(int y = 1;y <= (int)sqrt((double)n)+1;++y){
            for(int z = 1;z <= (int)sqrt((double)n)+1;++z){
                coe.insert(x*x + y*y + z*z + x*y + y*z + z*x);
            }
        }
    }

    for(int i = 1;i <= n;++i){
        cout << coe.count(i) << endl;
    }


    return 0;
}

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

public class Main{

    static int n;
    
    public static void main(String args[]) throws IOException{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	Scanner scan = new Scanner(System.in);

	//n=Integer.parseInt(br.readLine());
	n=scan.nextInt();
	int a[]=new int[n];
	int result[]=new int[n];
	int max=Integer.MIN_VALUE;
	
	//String str[]=br.readLine().split(" ");
	
	for(int i=0;i<n;i++){
	    //a[i]=Integer.parseInt(str[i]);
	    a[i]=scan.nextInt();
	    max=Math.max(max,a[i]);
	}

	CountingSort(a,result,max);

	StringBuilder sb=new StringBuilder();
	sb.append(result[0]);
	for (int i = 1; i < n; i++) {
	    sb.append(' ');
	    sb.append(result[i]);
	}
	System.out.println(sb);
	
    }
    
    
    
    static  void CountingSort(int A[], int B[], int k){
	int[] C = new int[k+1];
	
	/* C[i] に i の出現数を記録する */
	for (int i = 0 ;i<n;i++)
	    C[A[i]]++;
	
	/* C[i] に i 以下の数の出現数を記録する*/
	for (int i = 1;i<=k;i++)
	    C[i] += C[i-1];
	
	for (int i = n - 1; i >= 0; i--) {
	    C[A[i]]--;
	    B[C[A[i]]] = A[i];
	    
	}
    }
}



Measured memory_bytes: 515824
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define INF (1<<29)
using namespace std;
typedef long long ll;
int R,C,G[2];
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
char fld[30][30];
bool pos(int x,int y){
      return 0<=x&&x<C&&0<=y&&y<R&&fld[x][y]!='#'&&fld[x][y]!='x';
}
bool pos1(int x,int y){
      return 0<=x&&x<C&&0<=y&&y<R&&fld[x][y]!='#';
}
int main(){
      int d[30][30];
      cin>>R>>C;
      REP(i,R)REP(j,C)d[j][i]=-1;
      priority_queue<pair<int,int> > Q;
      REP(i,R)REP(j,C){
            cin>>fld[j][i];
            if(fld[j][i]=='S'){
                  d[j][i]=0;
                  Q.push(MP(j,i));
            }
            if(fld[j][i]=='G'){
                  G[0]=j;
                  G[1]=i;
            }
      }
      while(!Q.empty()){
            pair<int,int> q=Q.top();Q.pop();
            int x=q.first,y=q.second;
            REP(i,3){
                  int nx=x+i+1;
                  if(!pos1(nx,y))break;
                  if((d[nx][y]==-1||d[nx][y]>d[x][y]+3+i)){
                        d[nx][y]=d[x][y]+3+i;
                        Q.push(MP(nx,y));
                  }
            }
            REP(i,3){
                  int nx=x-i-1;
                  if(!pos1(nx,y))break;
                  if((d[nx][y]==-1||d[nx][y]>d[x][y]+3+i)){
                        d[nx][y]=d[x][y]+3+i;
                        Q.push(MP(nx,y));
                  }
            }
            REP(i,3){
                  int ny=y+i+1;
                  if(!pos1(x,ny))break;
                  if((d[x][ny]==-1||d[x][ny]>d[x][y]+3+i)){
                        d[x][ny]=d[x][y]+i+3;
                        Q.push(MP(x,ny));
                  }
            }
            REP(i,3){
                  int ny=y-i-1;
                  if(!pos1(x,ny))break;
                  if((d[x][ny]==-1||d[x][ny]>d[x][y]+3+i)){
                        d[x][ny]=d[x][y]+3+i;
                        Q.push(MP(x,ny));
                  }
            }
            REP(i,4){
                  int nx=x+dx[i],ny=y+dy[i];
                  if(!pos(nx,ny))continue;
                  if(fld[nx][ny]=='o'){
                        if(d[nx][ny]==-1||d[nx][ny]>d[x][y]+1){
                              d[nx][ny]=d[x][y]+1;
                              Q.push(MP(nx,ny));
                        }
                  }else{
                        if(d[nx][ny]==-1||d[nx][ny]>d[x][y]+2){
                              d[nx][ny]=d[x][y]+2;
                              Q.push(MP(nx,ny));
                        }
                  }
            }
      }
      cout<<d[G[0]][G[1]]<<endl;
}

Measured memory_bytes: 1212
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
    int n, k;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    sort(p, p + n);
    int ans = 0;
    for (int i = 0; i < k; i++) {
        ans += p[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define LL long long
#define MOD 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
using namespace std;

int main()
{
    fastio;
  	LL n;
  	cin>>n;
  	char a[26];
  	LL c=1,count=0;
  	a[0]='z';
  	vector<char> ans;	
  	for(char i='a';i<='z';i++){
      a[c++]=i;
    }
  
  	while(n>0){
//     	cout<<n%26<<"\t"<<n<<"\n";
      	ans.push_back(a[n%26]);

      if(n%26==0)
        n=n/26-1;
      else 
        n=n/26;
    }
  
  for(LL i=ans.size()-1;i>=0;i--)
    cout<<ans[i];
  	
}


Measured memory_bytes: 3600
N = int(input().rstrip())
l = [int(v) for v in input().rstrip().split()]
r = 'APPROVED'
for v in l:
    if v % 2 == 1:
        continue

    if v % 3 == 0 or v % 5 == 0:
        pass
    else:
        r = 'DENIED'
        break#
        
print(r)



Measured memory_bytes: 9176
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

int main() {
  int H, W;
  cin >> H >> W;
  int ii = 0, jj = 0;
  REP(i,0,H) {
    REP(j,0,W) {
      string s;
      cin >> s;
      if(s == "snuke") {
        ii = i;
        jj = j;
      }
    }
  }
  cout << (char)('A' + jj) << (ii+1) << endl;
      
  return 0;
}


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

typedef long long int ll;
const ll MAX=6e6 + 10;

int main()
{
	int a[MAX]={0}; int n; cin>>n;
	int i=2; vector<int> p;
	while(i*i <= MAX){
		if(!a[i]){
			if(i%10==1)p.push_back(i);
			if(p.size()==n) break;
			int j=2*i;
			while(j <= MAX){
				a[j]=1;
				j += i;
			}
		}
      i++;
	}

	for(int i=0;i<n;i++) cout<<p[i]<<" ";
	
}


Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a[3],b,n;
  cin >> a[0] >> a[1] >> a[2];
  while(a[0] != 0 && a[1] != 0 && a[2] != 0){
    sort(a,a+3);
    cin >> n;
    for(int i = 0;i < n;i++){
      cin >> b;
      if(a[1] > b+b) cout << "NA" << endl;
      else if( pow(b+b,2) > pow(a[0],2)+pow(a[1],2)) cout << "OK" << endl;
      else cout << "NA" << endl;
    }
    cin >> a[0] >> a[1] >> a[2];
  }
  return (0);
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A,B,C;
    cin >> A >> B >> C;
    int ans;
    if ( A*C<B ) {
        ans = C;
    } else {
        ans = B/A;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int[] c = new int[26];
        Arrays.setAll(c, i -> sc.nextInt());
        int[][] s = new int[d][26];
        for (int i = 0; i < d; i++) {
            Arrays.setAll(s[i], i1 -> sc.nextInt());
        }
        long ans = 0;
        int[] last = new int[26];
        for (int i = 0; i < d; i++) {
            int t = sc.nextInt() - 1;
            ans += s[i][t];
            last[t] = i + 1;
            for (int j = 0; j < 26; j++) {
                ans -= (i + 1 - last[j]) * c[j];
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 46324
#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()
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main() {
  while (true) {
    int n, x, res = 0;
    cin >> n >> x;
    if (n == 0 && x == 0) break;

    FOR(i, 1, n+1) {
      FOR(j, i+1, n+1) {
        FOR(k, j+1, n+1) {
          if (i + j + k == x) res++;
        }
      }
    }

    cout << res << "\n";
  }
}



Measured memory_bytes: 3076
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n = ini()
a = inl()


def solve():
    mincnt = 100000
    for x in a:
        cnt = 0
        while x % 2 == 0:
            x //= 2
            cnt += 1
        mincnt = min(mincnt, cnt)

    return mincnt


print(solve())


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

public class Hello
{
    static void Main()
    {
        int ans = 0;

        int[] holding_times = new int[]
        {
            111, 222, 333, 444, 555, 666, 777, 888, 999
        };

        int entry = int.Parse(Console.ReadLine());
        
        for(int i = 0; i < holding_times.Length; i++)
        {
            if (entry <= holding_times[i])
            {
                ans = holding_times[i];
                break;
            }
        }

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string result;
 
  for (int i = 0; i < N; i++) {
    string color;
    cin >> color;
    
    if (color == "Y") {
	  result = "Four";
      break;
    }
    
    if (result != "Four") {
      result = "Three";
    }
    
  }
 
  cout << result << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main(){
    int n;cin >> n;
    vl a(n);
    rep(i,n){
        cin >> a[i];
    }
    ll ans=LINF;
    int flip=0;
    rep(si,2){
        int f=flip;
        ll cnt=0;
        ll sum=0;
        rep(i,n){
            if(!f&&sum+a[i]>-1){
                ll need=-1-sum;
                cnt+=a[i]-need;
                sum=-1;
            }
            else if(f&&sum+a[i]<1){
                ll need=1-sum;
                cnt+=need-a[i];
                sum=1;
            }
            else{
                sum=sum+a[i];
            }
            f^=1;
        }
        ans=min(ans,cnt);
        flip^=1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

using ll = long long;

int main() {
    // freopen('b.txt', 'r', stdin);
    // fastio;

    string S;
    cin >> S;

    int n = S.size();

    string s1, s2;
    for (int i = 0; i < n; i ++) {
        if (i % 2 == 0)
            s1 += '0', s2 += '1';
        else
            s2 += '0', s1 += '1';
    }

    int d1 = 0, d2 = 0;
    for (int i = 0; i < n; i ++) {
        if (S[i] != s1[i])
            d1 ++;
        if (S[i] != s2[i])
            d2 ++;
    }

    cout << min(d1, d2) << '\n';

    return 0;
}



Measured memory_bytes: 3952
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	string A,B;
	cin >> A >> B;
	for(int i=N;i>=0;--i){
		bool flag = true;
		for(int j=0;j<i;++j){
			if( A[N-i+j] != B[j] ){
				flag = false;
				break;
			}
		}
		if( flag ){
			cout << 2*N - i << endl;
			return;
		}
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

// index が条件を満たすかどうか
int main() {
	int h, w, n;
	cin >> h >> w >> n;
	int k = max(h, w);
	cout << (n + k - 1) / k;
}

Measured memory_bytes: 256
N = int(input())
a1 = list(map(int,input().split(' ')))
a2 = list(map(int,input().split(' ')))
d1 = []
for i in range(len(a1)):
  d1.append(sum(a1[0:i+1])+sum(a2[i:]))
  #print(d1)
print(max(d1))

Measured memory_bytes: 38512
use std::io::stdin;

fn main(){
    let (_, w) = getpair();
    let _: Vec<String> = getvec();
    let xs: Vec<usize> = getvec();
    let mut ys = Vec::new();
    for (c, &x) in xs.iter().enumerate() {
        for _ in 0..x {
            ys.push(c+1);
        }
    }

    for (i, vs) in ys.chunks(w).enumerate() {
        for j in 0..vs.len()-1 {
            print!("{} ", vs[if i%2==0 {j} else {vs.len()-j-1}]);
        }
        println!("{}", vs[if i%2==0 {vs.len()-1} else {0}]);
    }
}

#[allow(dead_code)]
fn getline() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn getvec<T: std::str::FromStr>() -> Vec<T>{
    let line = getline();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn getpair() -> (usize, usize){
    let nm = getvec();
    (nm[0], nm[1])
}

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define si scanf
#define so printf
#define N 200100
#define M 
#define INF  
template<typename TP>inline bool rd(TP& r)
{
	r=0;
	char tmp=getchar();
	while(tmp<'0'||tmp>'9')
	{
		if(tmp==EOF)
			return 0;
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		r=(r<<3)+(r<<1)+tmp-'0';
		tmp=getchar();
	}
	return 1;
	
} 
int n,k;
int cnt[N],kd;
int main()
{
	rd(n),rd(k);
	int a;
	for(int i=1;i<=n;++i)
	{
		rd(a);
		if(cnt[a]==0)
			++kd;
		++cnt[a];
	}
	sort(cnt+1,cnt+n+1);
	int ans=0;
	for(int i=1;i<=n&&kd>k;++i)
		if(cnt[i])
		{
			ans+=cnt[i];
			--kd;
		}
	so("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=50;
int A[N],B[N],C[N];
int main(){
	int n,ans=0;
	if (scanf("%d", &n)) {
    /* code */
	}
	for(int i=0;i<n;i++) {
		if (scanf("%d", &A[i])) {
		    /* code */
		}
		//scanf("%d",&A[i]);
	}
	for(int i=0;i<n;i++) {
		if (scanf("%d", &B[i])) {
		    /* code */
		}
		//scanf("%d",&B[i]);
		ans+=B[i];
	}
	for(int i=0;i<n-1;i++) {
		if (scanf("%d", &C[i])) {
		    /* code */
		}
		//scanf("%d",&C[i]);
	}
	for(int i=1;i<n;i++){
		if(A[i]-A[i-1]==1){
			ans+=C[A[i-1]-1];
		}
	}
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 256
import java.io.*;
 
public class Main{
public static void main(String[] args){
try{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] str = br.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
 
    int count = 0;
    for(int i = a; i <=b ; i++){
        if (c % i == 0){
        count++;
        }
    }
System.out.println(count);
}catch(IOException e){
System.out.println(e);
}
}
}

Measured memory_bytes: 24456
# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!

import sys

n,m,k = [int(i) for i in input().split()]
MOD=10**9+7
SIZE = 2*(10**5)
inv = [0]*(SIZE+1)# inv[j] = j^{-1} mod MOD
fac = [0]*(SIZE+1)# fac[j] = j! mod MOD
finv = [0]*(SIZE+1)# finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE+1):
    inv[i] = MOD -(MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD

def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0


ans0 = 0
ans1 = 0
for i in range(n):
    ans0 += i*(n-i)
    ans0 %= MOD
ans0 *= m
ans0 %= MOD
ans0 *= m
ans0 %= MOD

for i in range(m):
    ans1 += i*(m-i)
    ans1 %= MOD
ans1 *= n
ans1 %= MOD
ans1 *= n
ans1 %= MOD

ans = (ans0+ans1)%MOD


print(ans*choose(n*m-2,k-2)%MOD)



Measured memory_bytes: 26740
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{
    int n;
    cin>>n;
    while(n!=0){
        int r=n%10;
        n/=10;
        if(r==7){
            cout<<"Yes"<<"\n";
            return 0;
        }
    }
        cout<<"No"<<"\n";
	return 0; 
} 


Measured memory_bytes: 3624
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    PriorityQueue pq = new PriorityQueue<Long>(Collections.reverseOrder());
    for(int i = 0; i < n; i++) {
      long a = sc.nextLong();
      pq.add(a);
    }
    for(int i = 0; i < m; i++) {
      long t = (long)pq.poll();
      t /= 2;
      pq.add(t);
    }
    long ans = 0;
    while(pq.size() > 0) {
      long t = (long)pq.poll();
      ans += t;
    }
    System.out.println(ans);
  }
}

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

#define print cout <<
#define printl(s) cout << s << endl;
#define rep(i,n) for (int i = 0; i < (n); ++i)

template <typename T>
vector<T> getValues(int num){
    vector<T> values(num);
    for(int i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

int main(){
    string S;
    cin >> S;
    string ans = "ABC";
    if(S==ans){
      ans = "ARC";
    }
    printl(ans);
}


Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<functional>
using namespace std;
int main(void) {
    
   int n;
   cin>>n;
   int a[100];
   for(int i=0;i<n;i++){
       cin>>a[i];
   }
   int sum=0;
   int over=0;
   int min,max;

   int color[8]={0};

   for(int i=0;i<n;i++){
       if(a[i]/400 >=8){
           over++;
       }else{
           color[a[i]/400]++;
       }
   }
   for(int i=0;i<8;i++){
       if(color[i]!=0)sum++;
   }
   if(sum==0){
       cout<<"1"<<" "<<over<<endl;
//           cout<<over<<endl;
           return 0;
  //     }
   }else{ 
       min=sum;
       /*max=sum+over;
       if(max>8)max=8;*/
       cout<<min<<" "<<sum+over<<endl;
   }
   

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   int a,b,n,s=0;
   int i;

   scanf("%d%d",&a,&b);

   n = b - a;

   for(i=1;i<n;i++)
     s +=i;

   printf("%d\n",s-a);
   return 0;
}


Measured memory_bytes: 128
# https://abc085.contest.atcoder.jp/tasks/abc085_c
n, y = [int(x) for x in input().split()]
for i in range(n + 1):
    for g in range(n + 1 - i):
        if 10000 * i + 5000 * g + 1000 * (n - i - g) == y:
            print(i, g, n - i - g)
            exit()
print(-1, -1, -1)


Measured memory_bytes: 3060