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

int main() {
  int N;
  cin >> N;
  int f = 500000000;
  for (int i=0; i<N; i++){
    int A;
    cin >> A;
    int a;
    a = A;
    int n =0;
    for(int j=0; j<A; j++){
      if (a%2 == 0){
        n++;
        a = a/2;
        continue;
      }
      else
        break;
    }
    if (n < f){
      f = n;
      continue;
    }
    else
      continue;
  }
  cout << f << endl;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
A = S.count("R") * S.count("G") * S.count("B")

for i in range(N):
  for j in range(i+1, N):
    k = j-i+j
    if k<N and S[k] != S[j] and S[k] != S[i] and S[i] !=S[j]:
      A -= 1    

print(A)


Measured memory_bytes: 9112
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef char chr;
typedef double  dbl;
typedef long long int lld;
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
      FastIO
      lld n, k;
      cin >> n;
      cin >> k;
      lld r, s;
      lld p, i;
      cin >> r;
      cin >> s;
      cin >> p;
      string t;
      cin >> t;
      chr c[n];
      foi(i, n)
      {
      	if (t[i] == 'r')
      		c[i]= 'p';
      	if (t[i] == 'p')
      		c[i]= 's';
      	if (t[i] == 's')
      		c[i]= 'r';
      }
      for(i = k; i < n; i++)
      {
      	if (c[i] == c[i-k])
      	{
      		if (t[i] == t[i-k])
      		{
      			c[i] = t[i];
      		}
      		else
      		{
      			if (t[i-k] == 'r')
      				c[i-k]= 's';
      			if (t[i-k] == 's')
      				c[i-k]= 'p';
      			if (t[i-k] == 'p')
      				c[i-k]= 'r';
      		}
      	}
      }
      lld  sum;
      sum  = 0;
      foi(i, n)
      {
      	if (t[i] == 'r' && c[i] == 'p')
      		sum+= p;
      	if (t[i] == 'p' && c[i] == 's')
      		sum+= s;
      	if (t[i] == 's' && c[i] == 'r')
      		sum+= r;
      }
      cout << sum << "\n";
      return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int K;
    cin>>K;
    long long sum=0;
    for(int i=1;i<=K;i++)
    {
        for(int j=1;j<=K;j++)
        {
            for(int k=1;k<=K;k++)
            {
                int temp = __gcd(i,j);
                temp = __gcd(temp , k);
                sum+=temp;
            }
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3624
from collections import deque
ls = deque()
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    if i%2==0:
        ls.appendleft(a[i])
    else:
        ls.append(a[i])
if n%2 == 0:
    print(*reversed(ls))
else:
    print(*ls)

Measured memory_bytes: 32436
# -*- coding: utf-8 -*-
"""
Created on Fri May  8 01:14:23 2020

@author: Kanaru Sato
"""
import math

N = int(input())
ans = 0

for n in range(1,N+1):
    if n%2 != 0:
        count = 0
        for i in range(1,n+1):
            if n % i == 0:
                count += 1
        if count == 8:
            ans += 1

print(ans)

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

using namespace std;

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

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

vector<int> eratosthenes(int n) {
	vector<int> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;

	for (int i = 2; i <= n; i++) {
		if (!isPrime[i]) {
			continue;
		}

		for (int j = 2 * i; j <= n; j += i) {
			isPrime[j] = false;
		}
	}

	return isPrime;
}

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

	vector<int> isPrime = eratosthenes(60000);

	int n;
	cin >> n;

	vector<int> ans;
	for (int i = 2; ans.size() != n; i++) {
		if (!isPrime[i]) {
			continue;
		}

		if (i % 5 == 1 && i >= 10) {
			ans.emplace_back(i);
		}
	}

	for (int i = 0; i < ans.size(); i++) {
		if (i) cout << " ";
		cout << ans[i];
	}
	cout << endl;
	return 0;
}


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

int main() {
  string S;
  cin >> S;
  int cnt_zero = 0;
  for (int i = 0; i < S.size(); i++) if (S.at(i) == '0') cnt_zero++;
  int cnt_one = S.size() - cnt_zero;
  cout << 2 * min(cnt_zero, cnt_one) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  int n, ans = 0;
  cin >> n;

  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];

  for (int i = 1; i < n + 1; i++) {
    if (i % 2 == 1 && a[i] % 2 == 1) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoderBC044 {
  class AtCoderBC044 {
    static void Main(string[] args) {
      new AtCoderBC044().solveA();
    }
    private void solveA() {
      int n = int.Parse(Console.ReadLine());
      int k = int.Parse(Console.ReadLine());
      int x = int.Parse(Console.ReadLine());
      int y = int.Parse(Console.ReadLine());      
      int res = 0;
      if (n > k)
        res = (k * x) + y * (n - k);
      else
        res = x * n;
      Console.WriteLine(res);
    }//end M.
  }
}


Measured memory_bytes: 2648
/*Code by Codercjh*/
#include<bits/stdc++.h>
#define fr(i,a,b) for(int i=(a);i<=(b);++i)
#define rf(i,a,b) for(int i=(a);i>=(b);--i)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
using namespace std;
typedef long long ll;
template<typename T>
inline void read(T &x){
	char c=getchar();T fh=0;bool f=false;
	while(!isdigit(c))f|=(c=='-'),c=getchar();
	while(isdigit(c))fh=(fh<<1)+(fh<<3)+(c^48),c=getchar();
	x=f?-fh:fh;
	return;
}
int r;
int main(){
    cin>>r;
	printf("%lf\n",2*3.1415926*r); 
	return 0;
}


Measured memory_bytes: 3764
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#define r(i,n) for(int i=0;i<n;i++)
#define R(i,c,n) for(int i=c;i<n;i++)
#define debug(x) cerr << #x << ": " << x << endl;
using namespace std;

int main(){
  int n;
  cin >> n;
  int t,a;
  cin >> t >> a;
  double h[n];
  double min = 999999;
  int minIndex = 0;
  r(i,n){
    cin >> h[i];
    h[i] = abs(t - h[i]*0.006 - a);
    // cout << h[i] << endl;
    if(h[i] < min){
      min = h[i];
      minIndex = i;
    }
  }
  cout << minIndex + 1 << endl;
  return 0;
}

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

using namespace std;

const int MOD = 1e9 + 21;

void solve()
{

}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);


    int k, a, b;
    cin >> k >> a >> b;

    if(k < a)
        cout << k + 1 << '\n';
    else
    {
        long long c = a;
        k -= a - 1;

        int d = b - a;

        if(d > 2)
        {
            c += (k / 2) * 1ll * d;
            if(k & 1)
                ++c;
            cout << c << '\n';
        }else
        {
            c += k;
            cout << c << '\n';
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main()
{
	int keta=1;
	int n;
	int count=0;
	cin >> n;
	int l;
	l = n;
	while (l > 9)
	{
		l /= 10;
		keta++;
	}
	//cout<<keta<<endl;

	if(keta%2==1){
		if(keta==1)
			count += n;
		else
			count += n - pow(10,keta - 1) + 1;
		keta -= 2;
		while (keta > 0)
		{
			count += pow(10, keta) - pow(10, keta - 1);
			keta -= 2;
		}
	}
	else{
		keta -= 1;
		while (keta > 0)
		{
			count += pow(10,keta)-pow(10, keta - 1);
			keta -= 2;
		}
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::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()
{
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    bool flag = true;
    rep(i, s.length())
    {
        if (i != a )
        {
            if ('0' <= s[i] && s[i] <= '9')
            {
                flag = true;
            }
            else
            {
                cout << "No" << endl;
                return 0;
            }
        }
        else
        {
            if (s[i] == '-')
                flag = true;
            else
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << ((flag) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll a,b;
    cin >> a >> b;
    ll ans=0;
    while(a<=b){
      a=2*a;
      ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    #l,r,d=map(int,input().split())
    n,m = map(int, input().split())
    tomo=[[] for i in range(n)]
    for i in range(m):
        a,b=map(int,input().split())
        tomo[a-1].append(b-1)
        tomo[b-1].append(a-1)
    visited=[0 for i in range(n)]
    stack=[]
    group=0
    temp=0
    for i in range(n):
        visited[i]=1
        temp=1
        for j in tomo[i]:
            if visited[j]==0:
                stack.append(j)
                visited[j]=1
                temp+=1
        while len(stack)>=1:
            v = stack.pop(-1)
            for j in tomo[v]:
                if visited[j]==0:
                    stack.append(j)
                    visited[j]=1
                    temp+=1
        group=max(group,temp)
    print(group)






if __name__ == "__main__":

    main()


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

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};

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

    Sieve s(10000005);
    ll ans = 1;
    for(int k=2; k<=n; k++){
        if(s.isPrime(k)){
            ans += k*2;
        }else{
            auto fs = s.factor(k);
            ll m = 1;
            for (auto p : fs) {
                m*=p.second+1;
            }
            ans += k*m;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 46520
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    long long n,k;
    long long i,j;
    long long ans;
    while (scanf("%lld%lld",&n,&k)!=EOF)
    {
        ans=0;
        for (i=1;i<=n-k;i++)
        {
            j=i+k;
            ans+=(n/j)*i;
            if(n%j-k>=0)
                ans+=n%j-k+1;
        }
        if (k==0)
            ans=n*n;
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] s = scanner.next().toCharArray();
		ArrayList<Character> list = new ArrayList<>();

		for(int i = 0; i < s.length; i++){
			if(s[i] == 'B'){
				if(list.size() != 0){
					list.remove(list.size()-1);
				}
			}else {
				list.add(s[i]);
			}
		}

		for(int i = 0; i < list.size(); i++){
			System.out.print(list.get(i));
		}
		System.out.println();
	}
}

Measured memory_bytes: 21844
dic = {}
while True:
    try:
        line = raw_input()
    except:
        break
    for i in line.lower():
        if i in dic:
            dic[i] += 1
        else:
            dic[i] = 1

for i in xrange(97, 123):
    output = 0
    if chr(i) in dic:
        output = dic[chr(i)]
    print "%s : %d" % (chr(i), output)

Measured memory_bytes: 6428
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll oddxor(ll a){
   return ((a+1)/2)%2 ;
}
ll funcxor(ll b){
   if(b%2) return oddxor(b);
   else return oddxor(b+1)^(b+1);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i<n;i++){
   cin >> a[i];
  }
  //ある要素とその後ろが同じ色なら、後ろの色を変える
  //隣り合う色が同じとき、後ろの色を変え、後ろの二個先を見る
  int ans = 0;
  for(int i = 0;i<n-1;){
   if(a[i]==a[i+1]){
     ans++;
     i += 2;
   }
    else i++;
  }
  cout << ans << endl;
}


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

#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define mod 1000000007
#define inf 1e18
#define endl "\n"

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main()
{
    fastio
    int test,i;
    string s;

    cin >> test;

    map <string,int> m ; 

    for(i=0; i<test; i++)
    {
        cin >> s ;
        m[s]++;
    }

    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
    
    return 0;
}

Measured memory_bytes: 3652
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,j,x,fx=0,sx;
    scanf("%d",&x);sx=x;
    while(x){
        fx+=(x%10);
        x/=10;
    }
    if(sx%fx == 0){printf("Yes\n");}else{printf("No\n");}
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
  int a,v1,v2,sum[10];
  char c;
  while(cin >> a >> c){
    sum[0] = a;
    for(int i = 1 ; i < 10 ; i++ ){
      cin >> a >> c;
      sum[i] = a + sum[i - 1];
    }
    cin >> v1 >> c >> v2;
     
    double t = ((double)v1/(v1 + v2))*sum[9];
    for(int i = 0 ; i < 10 ; i++ ){
      if(t <= sum[i] ){
    cout << i + 1 << endl;
    break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1160
def main():
    top = list(map(int, input().split()))
    middle = list(map(int, input().split()))
    bottom = list(map(int, input().split()))
    N = int(input())
    taken = []
    for i in range(N):
        taken.append(int(input()))
    
    bingo = []
    bingo.append(top)
    bingo.append(middle)
    bingo.append(bottom)
    temp = [top[0], middle[0], bottom[0]]
    bingo.append(temp)
    temp = [top[1], middle[1], bottom[1]]
    bingo.append(temp)
    temp = [top[2], middle[2], bottom[2]]
    bingo.append(temp)
    temp = [top[0], middle[1], bottom[2]]
    bingo.append(temp)
    temp = [top[2], middle[1], bottom[0]]
    bingo.append(temp)
 
 
    cnt = 0
    flag = 0
    for i in range(len(bingo)):
        cnt = 0
        for j in range(len(bingo[i])):
            if bingo[i][j] in taken:
                cnt += 1
        if cnt == 3:
            flag += 1
    
    if flag > 0:
        print('Yes')
    else:
        print('No')
main()

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

using namespace std;

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

int a[200020];
int b[200020];

int main(){
  int n;
  scanf("%d", &n);
  REP(i, n){
    scanf("%d", &a[i + 1]);
  }
  vector<int> c;
  for(int d = n; d; --d){
    int p = a[d];
    for(int m = d * 2; m <= n; m += d){
      p ^= b[m];
    }
    b[d] = p;
    if(p != 0) c.push_back(d);
  }
  printf("%lu\n", c.size());
  REP(i, c.size()){
    if(i > 0) putchar(32);
    printf("%d", c[i]);
  }
  puts("");
  return 0;
}

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
    int n, m;

    cin>>n>>m;

    vll dp(n+1);

    vb ng(n+1, true);

    rep(i, m){
        int a;
        cin>>a;
        ng[a]=false;
    }

    dp[0]=1;
    if(ng[1]){
        dp[1]=1;
    }else{
        dp[1]=0;
    }
    repr(i, 2, n+1){
        if(ng[i]){
            dp[i]=(dp[i-1]+dp[i-2])%MOD;
        }else{
            dp[i]=0;
        }
    }
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
int main() {
  int n;
  cin >> n;
  double ans = 0;
  double a;
  REP(i, n) {
    cin >> a;
    ans += 1 / a;
  }
  ans = 1 / ans;
  cout << setprecision(16) << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define MAX 100000
#define INFTY (1 << 30)

class Edge{
public:
	int t, w;
	Edge(){}
	Edge(int t, int w): t(t), w(w){}
};

vector<Edge> G[MAX];
int n, d[MAX];

bool vis[MAX];
int cnt;

void bfs(int s){
	for(int i = 0; i < n; i++) d[i] = INFTY;
	queue<int> Q;
	Q.push(s);
	d[s] = 0;
	int u;
	while(!Q.empty()){
		u = Q.front(); Q.pop();
		for(int i = 0; i < G[u].size(); i++){
			Edge e = G[u][i];
			if(d[e.t] == INFTY){
				d[e.t] = d[u] + e.w;
				Q.push(e.t);
			}
		}
	}
}

void solve(){

	bfs(0);
	int maxv = 0;
	int tgt = 0;
	for(int i = 0; i < n; i++){
		if(d[i] == INFTY) continue;
		if(maxv < d[i]){
			maxv = d[i];
			tgt = i;
		}
	}


	bfs(tgt);
	maxv = 0;
	for(int i = 0; i < n; i++){
		if(d[i] == INFTY) continue;
		maxv = max(maxv, d[i]);
	}

	cout << maxv << endl;
}

main(){
	int s, t, w;
	cin >> n;

	for(int i = 0; i < n - 1; i++){
		cin >> s >> t >> w;

		G[s].push_back(Edge(t, w));
		G[t].push_back(Edge(s, w));
	}
	solve();
}

Measured memory_bytes: 9856
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

int main()
{
    std::map<std::string, std::vector<int> > BookIndex;
    std::string word;
    int page;

    while (std::cin >> word >> page) {
        if (BookIndex.count(word)) {
            BookIndex[word].push_back(page);
        } else {
            BookIndex[word] = std::vector<int>(1, page);
        }
    }

    for (std::map<std::string, std::vector<int> >::iterator bookindex = BookIndex.begin(); bookindex != BookIndex.end(); ++bookindex) {
        std::cout << (*bookindex).first << std::endl;
        std::sort((*bookindex).second.begin(), (*bookindex).second.end());
        
        for (int i = 0; i < static_cast<int>((*bookindex).second.size()); ++i) {
            std::cout << (i == 0 ? "" : " " ) <<(* bookindex).second[i];
        }
        
        std::cout << std::endl;
        
    }

    return 0;
}

    
        

Measured memory_bytes: 1244
#include <iostream>
#include <vector>
#include <cmath>

#define ll long long int

using namespace std;

int main() {
  ll l;
  cin >> l;
  vector<int> bin_rep;
  int count = 0;
  while (l) {
    if (l & 1) {
      count++;
      bin_rep.push_back(1);
    }
    else {
      bin_rep.push_back(0);
    }
    l >>= 1;
  }

  ll mul = 1;
  cout << bin_rep.size() << ' ' << (bin_rep.size() - 1) * 2 + count - 1 << endl;
  for (int i = 1; i < bin_rep.size(); i++) {
    cout << i << ' ' << i + 1 << ' ' << 0 << endl;
    cout << i << ' ' << i + 1 << ' ' << mul << endl;
    mul *= 2;
  }

  for (int i = 0; i < bin_rep.size() - 1; i++) {
    if (bin_rep[i]) {
      cout << i + 1 << ' ' << bin_rep.size() << ' ' << mul << endl;
      mul += pow(2, i);
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int k, x; cin >> k >> x;
	for( int i = x-(k-1); i <= x+(k-1); ++i ) cout << i << ' '; 
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
out = []
str_n = input()
n = int(str_n)
save = n
out.append(str_n+':')

i = 2
while i*i <= save:
  if n % i == 0:
    while n % i == 0:
      n //= i
      out.append(i)
  i += 1
if n > 1:
  out.append(n)

print(" ".join(map(str,out)))

Measured memory_bytes: 7660
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;

public class Main {

    public static void main(String[] args) throws NumberFormatException, IOException {
        Stdin stdin = new Stdin();
        
        char[] l = stdin.nextToken().toCharArray();
        int n = l.length;
        long m = 1000000007;
        long[][] dp = new long[n + 1][2];
        dp[0][1] = 1;
        for (int i = 0; i < n; i++) {
            dp[i + 1][0] += dp[i][0] * 3;
            if (l[i] == '0') {
                dp[i + 1][1] += dp[i][1];
            } else {
                dp[i + 1][0] += dp[i][1];
                dp[i + 1][1] += dp[i][1] * 2;
            }
            
            dp[i + 1][0] %= m;
            dp[i + 1][1] %= m;
        }
        
        long ans = (dp[n][0] + dp[n][1]) % m;
        System.out.println(ans);
    }
    
    private static final class Stdin {
        private BufferedReader stdin;
        private ArrayDeque<String> tokens;
        
        public Stdin() {
            this.stdin = new BufferedReader(new InputStreamReader(System.in));
            this.tokens = new ArrayDeque<>();
        }
        
        public String nextToken() throws IOException {
            if (tokens.isEmpty()) {
                for (String token : stdin.readLine().split(" ")) {
                    tokens.add(token);
                }
            }
            return tokens.poll();
        }
        
        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(nextToken());
        }
        
        public int nextLong() throws NumberFormatException, IOException {
            return Integer.parseInt(nextToken());
        }
    }
}


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

int main() {
  int n;
  string c;
  int i=0;
  
  cin >> n;
  
  while (i < n){
    
    cin >> c;
    
    if(c=="Y"){
      cout << "Four"<< endl;
      break;
    }
    i++;
  }
  
  if(i==n)
    cout << "Three" << endl;

}



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

int main(void) {
    int N, ans=0;
    int R;

    cin >> N>> R;

    if(N>=10)
      ans = R;
    else
      ans = R + 100*(10-N);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			while (true) {
				int m = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();

				if (m < 0 && f < 0 && r < 0) {
					break;
				}
				if (m < 0 || f < 0) {
					System.out.println("F");
					continue;
				}

				int score = m + f;
				if (score >= 80) {
					System.out.println("A");
				} else if (score >= 65) {
					System.out.println("B");
				} else if (score >= 50) {
					System.out.println("C");
				} else if (score >= 30) {
					System.out.println((r >= 50) ? "C" : "D");
				} else {
					System.out.println("F");
				}
			}
		}
	}
}


Measured memory_bytes: 26288
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    if(a+b*5+c*10+d*50+e*100+f*500 >= 1000) puts("1");
    else puts("0");
    return 0;
}


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

int main(){
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++){
        if (s[i] - '0' == 9){
            cout << 1;
        }else{
            cout << 9;
        }
    }
    cout << endl;
    return 0;
}

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

int main(){
    int N,K;
    cin>>N>>K;
    ll height[N];
    ll dp[N];
    for(int i=0;i<N;i++){
        dp[i]=INT_MAX;
    }
    for(int i=0;i<N;i++){
        cin>>height[i];
    }
    dp[0]=0;
    for(int i=1;i<N;i++){
        for(int j=1;j<=K;j++){
            if(i-j<0){
                break;
            }
            //cout<<dp[i]<<"\n";
            dp[i]=min(dp[i],dp[i-j]+abs(height[i-j]-height[i]));
        }
    }
    cout<<dp[N-1];
}

Measured memory_bytes: 1792
s = str(input())
t = str(input())
N = len(s)
S = [0] * N
T = [0] * N

for i in range(N):
  S[i] = s[i]
  T[i] = t[i]
  
for i in range(N):
  for j in range(N):
    if j == 0:
      x = S[j]
      S[j] = S[j + 1]
    elif 1 <= j < N - 1:
      S[j] = S[j + 1]
    else:
      S[j] = x
  #print(S)    
  if S == T:
    print("Yes")
    quit()
    
print("No")    
      
      


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

int main(){
   string s;
   cin >> s;
   string x = " ";
   rep(i,s.size()){
   	x += "x";
   }
   cout << x << endl;
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,x,start,end;
	cin>>a>>b>>x;
    if(a%x==0) start=a/x;
    else start=a/x+1;
    end=b/x;
    cout<<end-start+1<<endl;
    return 0;
}

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(LL i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}

LL ceil(LL a,LL b){return (a+b-1)/b;}
int main(){
    LL R,C;
    cin>>R>>C;
    LL res=1e18;
    if(R>=3)chmin(res,C*(ceil(R,3)-R/3));
    if(C>=3)chmin(res,R*(ceil(C,3)-C/3));
    FOR(i,1,R){
        LL a=C*(R-i);
        LL b=(C/2)*i;
        LL c=ceil(C,2)*i;
        LL x=max({a,b,c})-min({a,b,c});
        chmin(res,x);
    }
    FOR(i,1,C){
        LL a=R*(C-i);
        LL b=(R/2)*i;
        LL c=ceil(R,2)*i;
        LL x=max({a,b,c})-min({a,b,c});
        chmin(res,x);
    }
    cout<<res<<endl;
    return 0;
}


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

int main(void) {
	string S;
	cin >> S;
	bool ans = true;
	if (S[2] != S[3]) ans = false;
	if (S[4] != S[5]) ans = false;
	printf(ans ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 3708
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#define mod 1000000007
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=a*b%mod

ll po(ll x,ll y){
    ll res=1;
    for(;y;y>>=1){
	if(y&1)mul(res,x);
	mul(x,x);
    }
    return res;
}
ll invs(ll x){
    return po(x,mod-2);
}
#define N 100010
ll fac[N],inv[N],ivf[N];
ll P(ll n,ll k){
    return fac[n]*ivf[n-k]%mod;
}
int main(){
    fac[0]=ivf[0]=inv[1]=1;
    for(ll i=1;i<N;i++){
	if(i>1)inv[i]=(mod-(mod/i*inv[mod%i]%mod))%mod;
	fac[i]=fac[i-1]*i%mod;
	ivf[i]=ivf[i-1]*inv[i]%mod;
    }
    ll n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    
    ll f[1010][1010];
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)f[i][j]=0;
    f[a-1][n]=1;
    for(int i=a;i<=b;i++){
	for(int j=0;j<=n;j++){
	    mad(f[i][j],f[i-1][j]);
	    for(int k=c;k<=d&&j-i*k>=0;k++){
		ll res=f[i-1][j];
		mul(res,P(j,i*k));
        mul(res,invs(fac[k]));
		mul(res,po(invs(fac[i]),k));
		mad(f[i][j-i*k],res);
	    }
	}
    }
    cout<<f[b][0]<<endl;
}




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

int main() {
    int N, K; cin >> N >> K;
    int ans = 1000;
    for (int i = 0; i <= N; i++) {
        int num = 1;
        for (int k = 0; k < i; k++) {
            num *= 2;
        }
        for (int k = 0; k < N - i; k++) {
            num += K;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<ctime>
#include<cassert>
using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef unsigned long long ull;
//////////////////////

int const N = 2e5 + 41;

int n, q[N], k;
int ans;

void solve(){
	vector<int> a;
	fi(0, N){
		if(q[i] > 0) a.pb(q[i]);
	}
	sort(a.begin(), a.end());
	int m = max(0, sz(a) - k);
	fi(0, m){
		ans += a[i];
	}
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d %d",&n,&k);
	fi(0, n){
		int v;
		scanf("%d",&v);
		++q[v];
	}

	solve();
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 2168
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;

int main(){
	
	string key;
	string ring;
	int N,total;

	cin >> key;
	scanf("%d",&N);
	total = 0;
	for(int i = 0; i < N; i++){
		cin >> ring;
		ring = ring + ring;
		if(ring.find(key) <= 200){
			total++;
		}
		ring.erase(0,ring.length());
	}

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

	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 repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define out(x) cout << (x) << endl

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */

int main(){
    int a, b; cin >> a >> b;
    if(a <= b) out(a);
    else out(a-1);
}

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

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

Measured memory_bytes: 256
<?php
$a = trim(fgets(STDIN));
$b = str_split(trim(fgets(STDIN)));
$red = 0;
$blue = 0;
foreach($b as $value){
if($value == 'R'){
$red++;
}else{
$blue++;
}
}

if($red>$blue){
echo 'Yes';
}else{
echo 'No';
}

Measured memory_bytes: 4728
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0003&lang=jp

#include <algorithm>
#include <iostream>
#include <vector>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

//テ」ツδ榲」ツつッテ」ツδュテ・ツョツ堙ァツセツゥ
#define ALL(v) (v).begin(),(v).end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define REP(i,a,b) for(int i=(int)(a); i<(int)(b); ++i)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define SORT(x) sort(begin(x),end(x))
#define SELECT_SORT(x, n) sort(begin(x),begin(x)+n)
#define SWAP(type, a, b) do {type tmp = a; a = b; b = tmp;} while (0)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))

//テ・ツョツ堙ヲツ閉ー
#define INF 2000000000000
#define MAX 10

//DEBUGテァツ板ィ
#define BAR() cout << "----------------------------" << endl;
#define DUMP(v) (cerr << #v << ": " << v << endl)
#define PRINT(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;


int main()
{
	//テ」ツδ療」ツδュテ」ツつーテ」ツδゥテ」ツδ?ヲツ崢クテ」ツ??
	int n;
	int a, b, c;
	bool flag=false;
	
	cin >> n;
	while(n)
	{
		cin >> a >> b >> c;
		flag=false;
		
		if(a*a + b*b == c*c){
			flag=true;
		}else if(a*a + c*c == b*b){
			flag=true;
		}else if(b*b + c*c == a*a){
			flag=true;
		}
	
		if(flag){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
		n--;
	}
}

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

int main(){
  string T[4]={"dream","dreamer","erase","eraser"};
  string S;
  cin>>S;
  reverse(S.begin(),S.end());
  for(int i=0;i<4;i++){
    reverse(T[i].begin(),T[i].end());
  }
  bool ans2 =true;
  for(int i=0;i<S.size();){
    bool ans=false;
    for(int j =0;j<4;j++){
      string tmp=T[j];
      if(S.substr(i,tmp.size())==tmp){
        ans=true;
        i+=tmp.size();
      }
    }
    if(!ans){
      ans2=false;
      break;
    }
  }
  
  if(ans2) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

  
  

Measured memory_bytes: 512
using System;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

        int xorall = 0;
        for (int i = 0; i < N; i++)
        {
            xorall ^= a[i];
        }
        for (int i = 0; i < N; i++)
        {
            Console.WriteLine(xorall^a[i]);
        }
    }
}

Measured memory_bytes: 53288
n = int(input())

ans = ''
while n > 0:
    if n % 26 == 0:
        ans = chr(ord('a') + 25) + ans
    else:
        ans = chr(ord('a') + (n % 26) - 1) + ans
    if n % 26 == 0:
        n = n // 26 - 1
    else:
        n //= 26
print(ans)


Measured memory_bytes: 8932
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {
	int s;
	scanf("%d", &s);

	for(int data = 0; data < s; ++data) {
		unsigned int n[9];
		for(int i = 0; i < 9; ++i)
			scanf("%x", n + i);

		int carry = 0;
		unsigned int k = 0;
		for(int i = 0; i < 32; ++i) {
			int cnt = 0;
			for(int j = 0; j < 8; ++j)
				if(n[j] & (1 << i))
					++cnt;

			if(((cnt + carry) & 1) != ((n[8] >> i) & 1)) {
				k |= (1 << i);
				cnt = 8 - cnt;
			}

			carry = ((cnt + carry) >> 1);
		}

		printf("%x\n", k);
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1032
import java.util.Scanner;
import java.util.*;


public class Main {
    public static void main(String args[]){
        Set<Integer> set = new HashSet<Integer>();

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        int dCount = 0;

        while(dCount < k) {
            int d = sc.nextInt();
            for(int i = 0;i < d;i++){
                set.add(sc.nextInt());
            }
            dCount++;
        }

        System.out.print(n - set.size());
    }

}


Measured memory_bytes: 46732
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout<< name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define end_time()
#endif


#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007


void solve(){
	int n;
	cin>>n;
	string s,t,ans;
	cin>>s>>t;
	for(int i = 0; i<n; i++){
		ans.pb(s[i]);
		ans.pb(t[i]);
	}
	cout<<ans;
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	end_time();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007

    using namespace std;
     //int g[105][105];
    //vector < int > wt(100004);
   // vector < int > a;
    //vector < int > v(30500);
    //int cst[102][100005];
    //int ansr[100005];
 //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;
    //vector < vector < int > > adj(5000, vector < int > (5000));
 //int  dp[1000006];
   // int level[500];


    void solve()
    {
         ll int i,j=0,r=200,p,q,y=0,l,k=0,ans=0,d,h,flag=0,n,m,a;
         cin>>n;
         vector < int > v(n);
         rep(i,0,n) cin>>v[i];
         rep(i,1,n-1)
           {
               r=v[i]-v[i-1];
               k=v[i+1]-v[i];
               if((r<0 and k<0) or (r>0 and k>0)) y++;

           }cout<<y;




    }



    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t=1;
       // cin>>t;
        while(t--)
        solve();
    }

       /*
       int power(int x, unsigned int y, int p)
{
    int res = 1;      // Initialize result

    x = x % p;

    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

    =
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

  void bfs( int i , int j)
       {
           vis[i][j]= true;
         queue < int > que;
         que.push(k);
         while(!que.empty())
         {
            int x= que.front();
            que.pop();
             for ( int i=1;i<=n;i++)
             {
                 if((!g[1][n] and g[x][i] ) or (g[1][n] and ! g[x][i]))
                 {
                   if(!vis[i])
                   {
                       que.push(i);
                       level[i]=level[x]+1;
                       vis[i]= true;
                   }
                 }
             }
         }
       }

      ll int por(ll int a,ll int b)
         {
            ll int k=1;
            while(b>0)
            {
                if(b%2) k=k*a,k%=hell;
                b/=2;
                a*=a; a%=hell;
            }
            return k;
         } */


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pl pair<ll, ll>
#define vl vector<ll>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define N 100005


int main()
{
    ll n;cin>>n;
    ll k=1000;
    while(n>k)
    {
        k+=1000;
    }
    cout<<k-n<<"\n";
}


Measured memory_bytes: 3628
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include <assert.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
#include<set>
#include <climits>
using namespace std;
typedef unsigned long long ull;
#define ll long long int
ll mod = 1000000007;
//typedef vector<int> V;
//typedef vector<V> VV;
//typedef vector<VV> VVV;


int main() {
	ll n, m,a,b;
	cin >> n >> m;
	vector<pair<ll, ll> > pairs(n);

	for (ll i = 0; i < n; i++) {
		cin >> a >> b;
		pairs[i] = make_pair(a,b);
	}
	priority_queue<ll> que;
	// firstが小さい順、secondが小さい順にソート
	sort(pairs.begin(), pairs.end());

	ll ind = 0, y = 0;
	for (ll i = 1; i <=m; i++) {
		if (ind < n) {
			while (i >= pairs[ind].first) {
				que.push(pairs[ind].second);
				ind++;
				if (ind >= n)break;
			}
		}

		if (!que.empty()) {
			y += que.top();
			que.pop();
		}
	}
	cout << y << endl;
	return 0;
}

Measured memory_bytes: 2936
//use std::convert::TryInto;
#![allow(dead_code)]

fn main(){
    let args: Vec<i32> = input_vec();
    let x = args[0];
    let y = args[1];
    // end input

    let crane = 2*x - y/2;
    let turtle = y/2 - x;
    if (crane<0 || turtle<0 || crane+turtle!=x || crane*2+turtle*4!=y){
        println!("No");
    }else{
        println!("Yes");
    }
}



/*
 * input function
 */
fn input<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


fn input_vec<T: std::str::FromStr>() -> Vec<T> {
    input::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
vector<int> factor(int n){
    vector<int> fac;
    for (int i=1; i<=sqrt(n); i++){
        if (n%i==0){
            if (i == n/i)fac.push_back(i);
            else{
                fac.push_back(i);
                fac.push_back(n/i);
            }
        }
    }
    return fac;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    map<int, int> m;
    for (int i=0; i<n; i++){
        cin>>a[i];
        m[a[i]]++;
    }
    int res = 0;
    for (int i=0; i<n; i++){
        int f = a[i], s = m[a[i]];
        if (s>1)continue;
        m.erase(f);
        vector<int> fac = factor(f);
        int flag = 0;
        for (int i=0; i<fac.size(); i++){
            if (m.find(fac[i])!=m.end()){
                flag = 1;
                break;
            }
        }
        m[f]=s;
        if (flag == 0){
            res++;
            // cout<<f<<endl;
        }

    }
    cout<<res<<endl;

}

Measured memory_bytes: 13648