akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 111111111;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int DIV = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;


int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================

	ll N, M;
	cin >> N >> M;

	vector<ll> A(M + 2);
	for (int i = 1; i < M + 1; i++) {
		cin >> A[i];
	}

	A[0] = -1;
	A[M + 1] = N + 1;

	for (int i = 0; i < M - 1; i++) {
		if (A[i] + 1 == A[i + 1]) {
			cout << 0 << endl;
			return 0;
		}
	}


	vector<ll> kumi(200005);
	kumi[0] = 0;
	for (int i = 1; i < 200005; i++) {
		if (i == 1) {
			kumi[i] = 1;
		}
		else if (i == 2) {
			kumi[i] = 1;
		}
		else {
			kumi[i] = (kumi[i - 1] % DIV + kumi[i - 2] % DIV) % DIV;
		}
	}


	ll ans = 1;
	for (int i = 0; i < M + 1; i++) {
		ans *= kumi[A[i + 1] - A[i] - 1] %DIV;
		ans %= DIV;
		//cout << "stairs" << A[i + 1] - A[i] - 1 << endl;
	}
	cout << ans % DIV << endl;

	//for (int i = 1; i < 10; i++) {
	//	cout << i << ":" << kumi[i] << endl;
	//}


}




Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int INF = 1e+8;
const int LIM = 10001;
int main(){
    int h, n;
    cin >> h >> n;
    vector<P> v(n);
    for(int i=0;i<n;i++){
        cin >> v[i].first >> v[i].second;
    }
    int dp[LIM];
    for(int i=0;i<LIM;i++){
        dp[i] = INF;
    }
    dp[0] = 0;
    for(int i=0;i<n;i++){
        int j;
        for(j=0;j<LIM;j++){
            if(j < v[i].first) dp[j] = min(dp[j], v[i].second);
            else dp[j] = min(dp[j], dp[j-v[i].first] + v[i].second);
        }
    }
    cout << dp[h] << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> odd;
    vector<int> even;
    for(int i=0;i<n;i++){
        int tmp;
        cin >> tmp;
        if(i%2 == 0){
            odd.push_back(tmp);
        }
        else{
            even.push_back(tmp);
        }
    }
    if(n%2 == 0){
        reverse(even.begin(),even.end());
        even.insert(even.end(),odd.begin(),odd.end());
        for(int i=0;i<even.size();i++){
            cout << even[i] << " ";
        }
        cout << endl;
        return 0;
    }
    else{
        reverse(odd.begin(),odd.end());
        odd.insert(odd.end(),even.begin(),even.end());
        for(int i=0;i<odd.size();i++){
            cout << odd[i] << " ";
        }
        cout << endl;
        return 0;
    }
}

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

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

	for(int i = 0; i < a.length(); i++){
		a.push_back(a[0]);
		a.erase(a.begin());
		if(a==b){cout<<"Yes";return 0;}
	}
	cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque> 
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype> 
using namespace std;

int main(){
    int H, W;
    cin >> H >> W;
    vector<vector<char> > a(H,vector<char> (W));
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            cin >> a.at(i).at(j);
        }
    }
    for (int i=0; i<W+2; i++) {
        cout << "#";
    }
    cout << endl;
    for (int i=0; i<H; i++) {
        cout << "#";
        for (int j=0; j<W; j++) {
            cout << a.at(i).at(j);
        }
        cout << "#" << endl;;
    }
    for (int i=0; i<W+2; i++) {
        cout << "#";
    }
    cout << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define vv(type)		vector<vector<type>>
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define db(x) 			cout<<x<<" "
#define db1(x) 			cout<<x<<'\n'
#define db2(x,y) 		cout<<x<<" "<<y<<'\n'
#define db3(x,y,z) 		cout<<x<<" "<<y<<" "<<z<<'\n'
#define rep(i,n) 		for(int i=0;i<(n);++i)
#define repA(i,a,n) 	for(int i=a;i<=(n);++i)
#define repD(i,a,n) 	for(int i=a;i>=(n);--i)
#define so(a) 			sort(a.begin(),a.end())
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
// to find all local maximaa and minima in O(n)
//	 for (int i=1;i<=n;i++)
//        {
//            if (i==1 || i==n || (p[i-1]<p[i])!=(p[i]<p[i+1]))
//           ans.push_back(p[i]);
//        }
int dx[] = { -1, 1, -1, 0, 0, -1, 1, 1 };
int dy[] = { -1, -1, 1, -1, 1, 0, 0, 1 };
int gcd(int a, int b)
{
	if (!b)
		return a;
	return gcd(b, a % b);
}
int modular_expo(int x, int y, int m)
{
	int ans = 1;
	while (y)
	{
		if (y & 1)
			ans = (ans % m * x % m) % m;
		x = (x % m * x % m) % m;
		y /= 2;
	}
	return ans % m ;
}
int power(int x, int y)
{
	int ans = 1;
	while (y)
	{
		if (y & 1)
			ans = (ans * x);
		x *= x;
		y /= 2;
	}
	return ans;
}
double dp[301][301][301];
double solve(int x, int y, int z, int &n)
{
	if (x < 0 || y < 0 || z < 0) return 0;
	if (x == 0 && y == 0 && z == 0) return 0;
	if (dp[x][y][z] > -0.9)
		return dp[x][y][z];
	return dp[x][y][z] = (n + x * solve(x - 1, y, z, n) + y * solve(x + 1, y - 1, z, n) + z * solve(x, y + 1, z - 1, n)) / (x + y + z);
}

void solve()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, x;
	cin >> n;
	memset(dp, -1, sizeof(dp));
	int cnt[3] = {0};
	repA(i, 1, n)
	{
		cin >> x;
		cnt[x - 1]++;
	}
	cout << ps(solve(cnt[0], cnt[1], cnt[2], n), 10);
}

int32_t main()
{
	solve();
	return 0;
}


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

using namespace std;

int main()

{

    int i,j,k,N,visit[10005],sum;

    memset(visit,0,sizeof(visit));

    for(i=1; i<=100; i++)

        for(j=1; j<=100; j++)

            for(k=1; k<=100; k++)

            {

                sum=i*i+j*j+k*k+i*j+j*k+i*k;

                if(sum<=10000)

                    visit[sum]++;

            }

    cin>>N;

    for(i=1; i<=N; i++)

        printf("%d\n",visit[i]);

    return 0;

}

Measured memory_bytes: 3800
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int a, b, c, i, j, min;
    scanf("%lld %lld %lld", &a, &b, &c);
    if(a-b>=c) printf("0");
    else printf("%lld", c+b-a);
    
    
}

Measured memory_bytes: 128
#include <stdio.h>

int main() {
  int W, A, B;
  scanf("%d %d %d", &W, &A, &B);
  int distA = (W > A) ? W - A : A - W;
  int distB = (W > B) ? W - B : B - W;
  (distA < distB) ? puts("A") : puts("B");
  return 0;
}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, m;
    cin >> n >> m;
    vector<pair<pair<ll, ll>, ll>> a;
    vector<string> ans(m);
    rep(i, m) {
        ll p, y;
        cin >> p >> y;
        a.push_back(make_pair(make_pair(p, y), i));
    }
    sort(ALL(a));
    ll index = 0, num = 0;
    rep(i, m) {
        if(index == a[i].first.first) {
            num++;
            string f, l;
            rep(j, 6-to_string(a[i].first.first).size()) f = f + "0";
            f = f + to_string(a[i].first.first);
            rep(i, 6-to_string(num).size()) l = l + "0";
            l = l + to_string(num);
            ans[a[i].second] = f+l;
        }
        else {
            index = a[i].first.first;
            num = 1;
            string f, l;
            rep(j, 6-to_string(a[i].first.first).size()) f = f + "0";
            f = f + to_string(a[i].first.first);
            rep(i, 6-to_string(num).size()) l = l + "0";
            l = l + to_string(num);
            ans[a[i].second] = f+l;
        }
    }
    rep(i, m) cout << ans[i] << endl;


    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 11376
n = int(input())
a = list(map(int, input().split()))
num_sum = 0
num_min = abs(a[1])
num_minus = 0

for i in range(n):
    if (a[i] <= 0):
        num_minus += 1
    num_min = min(num_min, abs(a[i]))
    num_sum += abs(a[i])

if (num_minus % 2 == 0):
    print (num_sum)
else:
    print(num_sum-num_min*2)


Measured memory_bytes: 14412
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll x; cin >> x;
    int koyaku = 1;
    for(int i=1; i<=360; i++){
        if ((x%i==0) && (360%i==0)){
            koyaku = i;
        }
    }
    cout << 360 / koyaku << endl;
    return 0;
}

Measured memory_bytes: 3620
object Main{
  def main(args: Array[String]): Unit = {
    val input = io.StdIn.readLine.toString

    @annotation.tailrec
    def go(s: String, sumVal: Int, sumValStorage: List[Int], n: Int): List[Int] ={
      if (n < 0) {
        sumValStorage :+ sumVal
      }
      else {
        if (Set("A", "C", "G", "T").contains(s(n).toString)) {
          go(s, sumVal + 1, sumValStorage, n-1)
        }
        else {
          go(s, 0, sumValStorage :+ sumVal, n-1)
        }
        
      }
    }

    println(go(input, 0, List[Int](), input.length-1).max)
  }
}

Measured memory_bytes: 25284
#include <bits/stdc++.h>
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));
#define check cout<<"?\n";

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
    io();
    string s; cin >> s;
    int n = (int)s.size();
    vector<int> ans(n, 1);
    for(int i = 0; i < n; ++i){
        int cur = 1, aux = i;
        if(s[i] == 'R'){
            while(s[aux + 1] == 'R'){
                ++aux;
                ++cur;
            }
            if(cur > 1){
                if(cur & 1){
                    ++ans[cur + i - 1];
                }else{
                    ++ans[cur + i];
                }
            }
        }else{
            while(s[aux - 1] == 'L'){
                --aux;
                ++cur;
            }
            if(cur > 1){
                if(cur & 1){
                    ++ans[i - cur + 1];
                }else{
                    ++ans[i - cur];
                }
            }
        }
        if(cur > 1) --ans[i];
        //cout << i << ' ' << s[i] << " mov: " << cur << '\n';
    }
    for(auto &i: ans){
        cout << i << ' ';
    }
    return 0;
}

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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll l, r, d;
  cin >> l >> r >> d;

  ll ans = r / d;
  ans -= (l - 1) / d;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3644
#include<stdio.h>
#define LL long long
int main(){
	LL a,b,sum=0,t;
	scanf("%lld%lld",&a,&b);
	t=a;
	for(LL i=a;i<=b;i*=2){
		if(i%t==0){
			sum++;
			t=i;
		}
	}
	printf("%d\n",sum);
	return 0;
}

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

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  
  int t = (c+b-1)/b;
  int s = (a+d-1)/d;

  if(t <= s){
    cout << "Yes" << "\n";
  }else
  {
    cout << "No" << "\n";
  }
  
}




Measured memory_bytes: 3640
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

long n;
long a[100005];

int main(){
	scanf("%ld", &n);
	for(int i = 0; i < n; i++){
		scanf("%ld", &a[i]);
		if(a[i] % 2 == 1){
			printf("first\n");
			return 0;
		}
	}
	printf("second\n");
	return 0;
}


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

using namespace std;

int main() {
	int N, M;
	int height[100010];
	int flag[100010] = { 0 };

	cin >> N >> M;

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

	int a, b;
	for (int i = 0; i < M; ++i) {
		cin >> a >> b;
			if (height[a-1] < height[b-1]) {
				++flag[a - 1];
			}
			else if (height[a - 1] == height[b - 1]) {
				++flag[a - 1];
				++flag[b - 1];
			}
			else {
				++flag[b - 1];
			}
	}

	int ans = 0;

	for (int i = 0; i < N; ++i) {
		if (flag[i] >= 1) {
			++ans;
		}
	}

	cout << N - ans;
	return 0;

}

Measured memory_bytes: 4376
#include<iostream>
using namespace std;
 
int main()
{
    int N, W;
    cin >> N >> W;
  
    int v[N],w[N];
     
    for(int i=0; i<N; i++){
        cin >> v[i] >> w[i];
    }
  
    int DP[N+1][W+1];
 
    for(int j=0; j<=W; j++)
        DP[N][j] = 0;
  
    for(int i=N-1; i>=0; i--){
        for(int j=0; j<=W; j++){
            if(j<w[i])
                DP[i][j] = DP[i+1][j];
            else{
                if(DP[i+1][j]>DP[i+1][j-w[i]]+v[i])
                    DP[i][j] = DP[i+1][j];
                else   
                    DP[i][j]=DP[i+1][j-w[i]]+v[i];         
             }
        }
   } 
    cout << DP[0][W] << endl;
  
    return 0;
}

Measured memory_bytes: 6996
#include <stdio.h>
#include <math.h>
int main(void) {
    int a, b, tmp, i;
    scanf("%d %d", &a, &b);
    
    if(b<=9)
        tmp = a*10+b;
    else if(b==100)
        tmp = a*1000+b;
    else
        tmp = a*100+b;
    
    for(i=1; i<=sqrt(tmp); i++) {
        if(tmp==i*i) {
            printf("Yes");
            return 0;
        }
    }
    
    printf("No");
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
	
	int i,n;
	int k[1000];

	scanf("%d",&n);	
	
	for(i=1;i<=n;i++){
		scanf("%d",&k[i]);
	}
	
	for(i=n;i>=1;i--){
		printf("%d",k[i]);
		
		if(i == 1)
			break;
		printf(" ");
	}
	putchar('\n');
	
	
	return 0;
}


Measured memory_bytes: 2040
import java.util.*;

class Main{

  static int answer(int n){
    int power = 1;
    for(int i=0;i<7;i++){
      if(power <= n && n < power*2){
        return power;
      }else{
        power = power*2;
      }
    }
    return 0;
  }

  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    System.out.println(answer(n));
  }
}

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



int main (){
    string S;
    cin>>S;
    int Size=S.size();
    vector<int> Vec(Size);
    int SameC=0;
    int LoR=1;//右１左−１
    int Kijun=0;//基準のマス
    for(int i=0; i<Size-1; i++){
        if(S.at(i)==S.at(i+1)){
            SameC ++;
        }
        else{
            if(LoR==1){
                Vec.at(Kijun+SameC) += SameC/2 + 1;
                Vec.at(Kijun+SameC+1) += (SameC+1)/2;
            }
            else{
                Vec.at(Kijun-1) += (SameC+1)/2;
                Vec.at(Kijun) += SameC/2 + 1;
            }
            Kijun += 1 + SameC ;
            SameC = 0;
          	LoR *= -1;
        }
    }
    Vec.at(Kijun-1) += (SameC+1)/2;
    Vec.at(Kijun) += SameC/2 + 1;

    for(int i=0; i<Size; i++){
        if(i>0){
            cout<<" ";
        }
        cout<<Vec.at(i);
    }


}

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

using namespace std;

const int N=1e5+10;
int p[N],dst[N];

void init(int n)
{
    for(int i=0;i<=n;i++) p[i]=i,dst[i]=0;
}

int fnd(int x)
{
    if(p[x]!=x)
    {
        int tmp=fnd(p[x]);
        dst[x]+=dst[p[x]];
        return p[x]=tmp;
    }else
    {
        dst[x]=0;
        return x;
    }
}

bool same(int x,int y)
{
    return fnd(x)==fnd(y);
}

bool unite(int x,int y,int z)
{
    if(same(x,y)) return false;

    int px=fnd(x),py=fnd(y);

    p[px]=py;
    dst[px]=dst[y]-z-dst[x];

    return true;
}

int dif(int x,int y)
{
    fnd(x),fnd(y);

    return dst[y]-dst[x];
}

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

    init(n);

    while(q--)
    {
        int op,x,y;
        cin>>op>>x>>y;

        if(!op)
        {
            int z;
            cin>>z;

            unite(x,y,z);
        }else
        {
            if(same(x,y))
                cout<<dif(x,y)<<endl;
            else
                cout<<"?"<<endl;
        }
    }

    return 0;
}



Measured memory_bytes: 4456
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int N,a[200];
  cin>>N;
  for (int i(0);i<N;i++) cin>>a[i];
  int cnt(0);
  while (true){
    for (int i(0);i<N;i++){
      if (a[i]%2==1){
        cout << cnt << endl;
        return 0;
      }
      a[i]/=2;
    }
    cnt++;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

char s[110];
bool chk[110][110][26];

int main()
{
	scanf("%s", s+1);
	int n = strlen(s+1);
	int ans = n;
	for(int i=0; i<26; ++i){
		bool ao=1;
		for(int k=1; k<=n; ++k){
			if(s[k] == 'a'+i) chk[1][k][i]=1;
			else ao=0;
		}
		if(ao){
			puts("0");
			return 0;
		}
		for(int j=2; j<=n; ++j){
			bool ao=1;
			for(int k=1; k<=n+1-j; ++k){
				if(chk[j-1][k][i] || chk[j-1][k+1][i]) chk[j][k][i]=1;
				else ao=0;
			}
			if(ao) ans=min(ans, j-1);
		}
	}
	printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 512
package main

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

const (
	mod            = 1e9 + 7
	initialBufSize = 1e4
	maxBufSize     = 1e8
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func modPow(x int64, y int) int64 {
	m := x % mod
	for i := 1; i < y; i++ {
		m = (m * x) % mod
	}
	return m
}

func main() {
	N := nextInt()
	result := modPow(10, N)
	result = (result + mod - modPow(9, N)) % mod
	result = (result + mod - modPow(9, N)) % mod
	result = (result + modPow(8, N)) % mod
	fmt.Println(result)
}


Measured memory_bytes: 1788
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, res = 0;
  string s;
  cin >> n >> s;
  REP(i,n-2) if(s.substr(i,3) == "ABC") res++;
  cout << res << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>n>>m;
 
  for (ll i = 1; i <= N; ++i)
  {
  	x = (i*8)/100;
  	y = (i*10)/100;
  	
  	if(x==n and y==m){
  		c(i);
  		return;
  	}
  }
  
  c(-1);
  
  
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  ll T=1;
  //cin>>T;
  while(T--){
  solve();
  }
  return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())

list = []
list.append(a)
list.append(b)

if 1 in list and 2 in list:
    print(3)
elif 1 in list and 3 in list:
    print(2)
elif 2 in list and 3 in list:
    print(1)

Measured memory_bytes: 3060
/*4_2 hightierra*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define PI 3.141592653589793
 
int main(void){
    int hhand,mhand,hour,minute;
    scanf("%d %d %d %d",&hhand,&mhand,&hour,&minute);

    double hhandangle,mhandangle,angledif,distance;
    
    // 短針と長針の角度から角度の差（ラジアン）を出す
    hhandangle = hour * 30 + minute * 0.5;
    mhandangle = minute * 6;
    angledif = fabs(hhandangle-mhandangle) * PI / 180.0;

    // 余弦定理
    distance = sqrt(pow((double)hhand,2.0) + pow((double)mhand,2.0) - 2.0*(double)hhand*(double)mhand*cos(angledif));

    printf("%.9lf\n",distance);

    return 0;

}

Measured memory_bytes: 2484
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> graph[N]; // 0-indexed
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vector<int> dir(N, -1);
    dir[0] = 0;
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int cur = que.front(); que.pop();
        for (int next : graph[cur]) {
            if (dir[next] != -1) continue;
            dir[next] = cur;
            que.push(next);
        }
    }
    puts("Yes");
    for (int i = 1; i < N; i++) {
        cout << dir[i] + 1 << '\n';
    }
    return 0;
}

Measured memory_bytes: 10228
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
    input[1] = input[1].split(" ");
	var n = parseInt(input[0], 10);
    var b = new Array(n);
    for(var i=0; i<n; i++){
      input[1][i] = parseInt(input[1][i], 10);
    }
    var count = 1;
    var anser = 0;
  	for(var i=0; i<n; i++){
      if(count == input[1][i]){
        count++;
      }else{
        anser++;
      }
    }
  if(count == 1){
  console.log(-1);
  }else{
    console.log(anser);
}
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22328
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main()
{
    string fifty;
    map<char,int> kinds;
    cin>>fifty;
    for(int i = 0; i<4; i++){
        kinds[fifty[i]]++;
    }
    if(kinds.size()==2) cout<<"Yes";
    else cout<<"No";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
  char s[1000];
  scanf("%s",s);
  int a=strlen(s);

  if(s[a-1]=='s'){
    printf("%ses",s);
  }else{
    printf("%ss",s);
  }
 return 0;
}

Measured memory_bytes: 1736
#include<iostream>
#include<string>
int main(int argc, char const* argv[])
{
	using namespace std;
	
	char weather[3];
	cin >> weather;
	
	bool start=false;
	int count=0;
	for (auto&& d : weather) {
		if(d=='R'&&!start){
			count =1;
			start=true;
		}
		else if(d=='R'&&start){
			count++;
		}else if(d=='S'){
			start=false;
		}
	}
	cout << count << endl;
	
	
	return 0;
}

Measured memory_bytes: 3620
import sys
input=sys.stdin.readline

H,W = map(int, input().split())
check = []
b = [[True]*(W+2)]

for i in range(H):
    s = input().strip()
    b.append([True] + [False]*W + [True])
    for j,c in enumerate(s):
        if c == '#':
            check.append((i+1,j+1))
            b[i+1][j+1] = True
b.append([True]*(W+2))

t = 0
while check:
    tmp = []
    for i,j in check:
        if not b[i-1][j]:
            b[i-1][j] = True
            tmp.append((i-1,j))
        if not b[i][j-1]:
            b[i][j-1] = True
            tmp.append((i,j-1))
        if not b[i][j+1]:
            b[i][j+1] = True
            tmp.append((i,j+1))
        if not b[i+1][j]:
            b[i+1][j] = True
            tmp.append((i+1,j))
    check = tmp
    t += 1

print(t-1)


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

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

int main(){
    int A=read(),B=read();
    if(B%A==0) printf("%d",A+B);
    else printf("%d",B-A);
}


Measured memory_bytes: 128
n, a, b, c = map(int, input().split())
index=0
listL = []
while index < n:
    l = int(input())
    listL.append(l)
    index+=1
stateL  = [0]*n

def calculater(listL, stateL, a, b, c):
    oneL = [0, 0, 0]  # oneCount, Length, MP
    twowL = [0, 0, 0]
    threeL = [0, 0, 0]
    index = 0
    while index < len(stateL):
        if stateL[index] == 1:
            oneL[0] += 1
            oneL[1] += listL[index]
        elif stateL[index] == 2:
            twowL[0] += 1
            twowL[1] += listL[index]
        elif stateL[index] == 3:
            threeL[0] += 1
            threeL[1] += listL[index]
        index += 1
    oneL[2] += 10*(oneL[0]-1)+abs(a-oneL[1])
    twowL[2] += 10*(twowL[0]-1)+abs(b-twowL[1])
    threeL[2] += 10*(threeL[0]-1)+abs(c-threeL[1])
    return oneL[2]+twowL[2]+threeL[2]

def loopMaker(n, stateL, minMP):
    if n >= len(listL):
        return minMP
    else:
        index=0
        while index < 4:
            stateL[n] = index
            if n == len(stateL)-1:
                if 1 in stateL and 2 in stateL and 3 in stateL:
                    mp = calculater(listL, stateL, a, b, c)
                else:
                    mp = 10000
                if mp < minMP:
                    minMP = mp
            minMP = loopMaker(n+1, stateL, minMP)
            index+=1
        return minMP

minMP = loopMaker(0, stateL, 10000)
print(minMP)

Measured memory_bytes: 3188
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (int)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
vector<vector<int>>	G;
vector<bool>		isVisited;
vector<int>			depth;
int dfs(int from, int to)
{
	if (isVisited[to]) {
		return depth[to];
	}

	int depthRes = 1;
	isVisited[to] = true;
	for (auto nextTo : G[to]) {
		if (from != nextTo) {
			int depthOne = dfs(to, nextTo);
			if (depthOne == -1) {
				// 閉路あり
				return -1;
			}
			depthRes = max(depthOne + 1, depthRes);
		}
	}

	depth[to] = depthRes;
	return depthRes;
}

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

	vector<vector<int>> A(N, vector<int>(N - 1));
	REP(i, N) {
		REP(j, N - 1) {
			cin >> A[i][j];
			A[i][j]--;
		}
	}

	int id = 0;
	vector<vector<int>> path(N, vector<int>(N, -1));
	REP(from, N) {
		REP(to, N) {
			if (from != to) {
				if (path[from][to] == -1) {
					path[from][to] = id;
					path[to][from] = id;
					id++;
				}
			}
		}
	}

	int totalV = N * (N - 1) / 2;
	G.resize(totalV);
	REP(from, N) {
		REP(j, N - 2) {
			int prev = path[from][A[from][j]];
			int next = path[from][A[from][j + 1]];
			G[prev].emplace_back(next);
		}
	}

	int ans = 0;
	isVisited.resize(totalV, false);
	depth.resize(totalV, -1);
	REP(i, totalV) {
		int ansOne = dfs(-1, i);
		if (ansOne == -1) {
			ans = -1;
			break;
		} else {
			ans = max(ans, ansOne);
		}
	}

	cout << ans << endl;
	return 0;
}


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

int K, N, R = 1 << 30;
int ceildiv(int n, int m) {
  return (n + m - 1) / m;
}
int main() {
  cin >> N >> K;
  for(int i = 0; i < N; ++i) {
    int a; cin >> a;
    if(a == 1) {
      for(int k = 0; k < K; ++k) {
        R = min(R,
          1 + ceildiv(max(i - k, 0), K - 1)
          + ceildiv(max(N - K - (i - k), 0), K - 1));
      }
      cout << R << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  std::cin >> N;
  std::vector<int> dp(N+1, 0);
  dp[0] = 1;
  for(int i=1;i<=N;i++){
    if(((i >=4) && (dp[i-4] == 1))|| ((i >=7) &&(dp[i-7] == 1))){
      dp[i] = 1;
    }else dp[i] = 0;
  }
  std::cout << (dp[N]==1?"Yes":"No") << '\n';
  return 0;
}


Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  r <- unsafeTextToDouble <$> T.getLine :: IO Double
  print $ 2 * pi * r

unsafeTextToDouble :: T.Text -> Double
unsafeTextToDouble s = case T.double s of
  Right (x, _) -> x


Measured memory_bytes: 3836
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int v, e;
const int MAX_N = 100010;
// 隣接リスト
vector<int> g[MAX_N];
bool used[MAX_N];
// トポロジカルソートされた数列
vector<int> ans;
bool head[MAX_N];
void dfs(int u) {
  if(used[u]) return;
  used[u] = true;
  for(auto& i: g[u]) dfs(i);
  // 帰りがけ順で追加
  ans.push_back(u);
}

void tsort() {
  for(int i=0; i<v; ++i) dfs(i);
  reverse(ans.begin(), ans.end());
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> v >> e;
    e += v - 1;
    rep(i, v) head[i] = true;
    for(int i=0; i<e; ++i) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        g[s].push_back(t);
    }
    tsort();
    //for(int i: ans) cout << i + 1 << endl;
    vector<pair<int, int>> p;
    rep(i, v) p.push_back({i, ans[i]});
    rep(i, v) ans[i] = -1;
    sort(p.begin(), p.end());
    for(auto& e: p) {
        int u = e.second;
        //cerr << "*" << e.first << " " << e.second << endl;
        for(auto to: g[u]) {
            ans[to] = u;
        }
    }
    for(int i: ans) cout << i + 1 << endl;

    return 0;
}


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

int main(){

   int n;
   cin >> n;
   double m = 1.0 / (2*n);
   if(n % 2 == 0)
      cout << fixed << setprecision(10) << 0.5;
   else
      cout << fixed << setprecision(10) << 0.5 + m;

  return 0;
}


Measured memory_bytes: 256
import math
import sys
from collections import defaultdict



MOD = 1000000007

def get_pair(val):
    a, b = val
    paired_a = -b
    paired_b = a
    if paired_a < 0 or (paired_a == 0 and paired_b < 0):
        paired_a = -paired_a
        paired_b = -paired_b
    return (paired_a, paired_b)


def main():
    N = int(input())
    lines = sys.stdin.read().split('\n')
    vals = [0] * N
    zero_count = 0
    for ix, line in enumerate(lines):
        if not line:
            continue
        a, b = map(int, line.split(' '))
        if a == 0 and b == 0:
            zero_count += 1
            vals[ix] = (0, 0)
            continue
        gcd = math.gcd(a, b)
        if (a < 0 or (a == 0 and b < 0)):
            gcd = -gcd
        a //= gcd
        b //= gcd
        vals[ix] = (a,b)

    vals_set = defaultdict(int)
    for val in vals:
        if val == (0, 0):
            continue
        vals_set[val] += 1

    processed_set = set()
    result = 1
    for val, count in vals_set.items():
        if val in processed_set:
            continue
        # print(f'processing val: {val}')
        processed_set.add(val)
        # print(f'val: {val}')
        pair = get_pair(val)
        mult = pow(2, count, MOD)
        if pair in vals_set:
            # print(f'processing pair: {pair}')
            processed_set.add(pair)
            mult += pow(2, vals_set[pair], MOD) - 1 # don't double count 0 of each
        # print(f"mult: {mult}")
        result = (result * mult) % MOD

    result = (result - 1 + zero_count + MOD) % MOD
    # print(f'zero_count: {zero_count}')
    print(result)




if __name__ == '__main__':
    main()


Measured memory_bytes: 85224
import java.io.IOException;
import java.util.Scanner;
public class Main {

	private static String q[]; // pueue
	private static int num; // カードの枚数
	private static int times; // シャッフルの回数
	private static String result; // 結果
	private static int front;
	private static int rear;

	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		while(true) {
			String s = sc.next();
			if(s.equals("-")) {
				break;
			}

			String[] array = s.split("");
			num = array.length;
			q = new String[num+1];
			result = "";
			front = 0;
			rear = num;

			for(int i=0;i<num;i++) {
				q[i] = array[i];
			}
			times = sc.nextInt();
			for(int i=0;i<times;i++) {
				int tmp = sc.nextInt();
				for(int j=0;j<tmp;j++) {
					enqueue(dequeue());
				}
			}

			for(int i=front;i!=rear;i=next(i)) {
				result += q[i];
			}
			System.out.println(result);
		}

		sc.close();
	}

	public static int next(int a) {
		return (a + 1) % (num+1);
	}

	public static void enqueue(String x) {
		q[rear] = x;
		rear = next(rear);
	}

	public static String dequeue() {
		String x = q[front];
		q[front] = null;
		front = next(front);
		return x;
	}
}


Measured memory_bytes: 26340
a, b, c = map(int, input().split())
if a < b:
    if b < c: print("{} {} {}".format(a, b, c))
    else: print("{} {} {}".format(a, c, b))
else:
    if a > c:
        if b > c: print("{} {} {}".format(c, b, a))
        else: print("{} {} {}".format(b, c, a))
    else:print("{} {} {}".format(b, a, c))




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

vector<bool> iP;
string S;
int sz;

ll solve(){
  ll t=0,ans=0;
  for(int i=0;i<sz;i++){
    if(iP[i]){
      t+=(S[i]-48);
      ans+=t;
      t=0;
    }else{
      t+=(S[i]-48);
      t*=10;
    }
  }
  return ans;
}

int main(){
  cin>>S;
  sz=S.size();
  for(int i=0;i<sz-1;i++){
    iP.push_back(false);
  }
  iP.push_back(true);
  int itp=0;
  ll fa=0;
  while(1){
    fa+=solve();
    while(iP[itp]){
      iP[itp]=false;
      itp++;
      if(itp==sz){
        cout<<fa<<endl;
        return 0;
      }
    }
    iP[itp]=true;
    itp=0;
  }
}

Measured memory_bytes: 256
N=int(input())

N4=N
N7=N
while(N4>=0):
  if N4%7==0:
    print('Yes')
    exit()
  N4-=4
while(N7>=0):
  if N7%4==0:
    print('Yes')
    exit()
  N7-=7
print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a[100000];
    int i,j,k=0,l,r,c=0,n;
    cin>>n;
  for(i=0;i<n;i++){cin>>a[i];}
    r=0;
for(j=k;j<n-1;j++){
        
    if(a[j]<a[j+1]){k=j+1;c=max(c,r);r=0;}
            else{r++;}
   }
        c=max(c,r);
   
    cout<<c<<endl;

}

Measured memory_bytes: 640
fun main(args:Array<String>) {
	val n=readLine()!!.toInt()
	var cards=n
	val a=readLine()!!.split(" ").map {it.toInt()}
			.groupBy {it}.map {it.value.size}
			.filter {it>=2}
	a.map {
		if(it%2==0){ cards-= (it-2); return@map 2}
		else       { cards-= (it-1); return@map 1}
	}.count{ it==2 }.let {
		cards-=(it+1)/2*2
		println(cards)
	}
	
	
}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		
		int n = stdIn.nextInt();
		long[] a = new long[n];
		int ans = 0;
		
		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextLong();
			ans ^= a[i];
		}
		
		
		for(int i = 0; i < n; i++) {
			System.out.print((ans ^ a[i])+" ");
		}
		
		
	}

}


Measured memory_bytes: 64212
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <string>
#include <climits>
#include <sstream>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

namespace patch
{
    template < typename T > std::string to_string( const T& n )
    {
        std::ostringstream stm ;
        stm << n ;
        return stm.str() ;
    }
}


//// gcd
ll gcd(ll a,ll b){
	ll r=a%b;
	while(r>0){
		a=b;b=r;r=a%b;
	}
	return b;
}

//// lcm
ll lcm(ll a,ll b){
	return a*b/gcd(a,b);
}

int main(){
	cin.sync_with_stdio(false);
	int n;
	int a[1000];
	cin>>n;
	rep(i,n)cin>>a[i];
	ll res=1;
	rep(i,n)res=lcm(res,a[i]);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#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 downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int> > Matrix;
const int MOD = 1e9+7;
const int MAX=1e7;

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

int main() {
    // 前処理
    COMinit();

  int x,y; cin>>x>>y;
  int m=(2*x-y)/3,n=((2*y-x)/3);
  if((x+y)%3!=0) cout<<0<<endl;
  else  if(n<0||m<0)cout<<0<<endl;
  else{
    cout<<COM(n+m,n)<<endl;
  }
}

Measured memory_bytes: 234624
n = int(input())
s = input()


ans = []
for i in range(1, n):
  a = s[0:i]
  b = s[i:n]
  res = []
  for j in a:
    if j in b and j not in res:
      res.append(j)
    ans.append(len(res))
    
print(max(ans))

Measured memory_bytes: 9184
#include <stdio.h>
#include <vector>

int main() {
  int i;
  int cnt = 0;
  std::vector<int> vec;
  while(cnt < 50) {
    scanf("%d", &i);
    if(i == 0){
      printf("%d\n", vec.back());
      vec.pop_back();
    }else{
      vec.push_back(i);
    }
    cnt++;
  }
  return 0;
}
       

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

using namespace std;
using ll = long long;


int main() {
    ll n,c;
    cin>>n>>c;
    vector<ll> x,v;
    for(int i=0;i<n;i++){
        ll x_,v_;
        cin>>x_>>v_;
        x.push_back(x_);
        v.push_back(v_);
    }
    vector<ll> r,l;
    for(int i=0;i<n;i++){
        static ll cc=0;
        cc+=v[i];
        if(i==0){
            cc-=x[i];
        }else{
            cc-=x[i]-x[i-1];
        }
        r.push_back(cc);
    }
    for(int i=0;i<n;i++){
        static ll cc=0;
        cc+=v[n-1-i];
        if(i==0){
            cc-=c-x[n-1-i];
        }else{
            cc-=x[n-i]-x[n-1-i];
        }
        l.push_back(cc);
    }
    vector<ll> rmax;
    vector<ll> lmax;
    {
        ll max=0;
        for(auto rr:r){
            if(rr>max) max=rr;
            rmax.push_back(max);
        }
    }
    {
        ll max=0;
        for(auto ll:l){
            if(ll>max) max=ll;
            lmax.push_back(max);
        }
    }
    vector<ll> ans;
    ans.push_back(lmax.back());
    ans.push_back(rmax.back());
    for(int i=0;i<n-1;i++){
        ans.push_back(r[i]-x[i]+lmax[n-2-i]);
    }
    for(int i=0;i<n-1;i++){
        ans.push_back(l[i]-(c-x[n-1-i])+rmax[n-2-i]);
    }
    cout<<*max_element(ans.begin(),ans.end())<<endl;

    return 0;
}


Measured memory_bytes: 7148
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var N string
	var i int
	fmt.Scan(&N)

	l := len(N)
	if (l > 3) {
		l = l - 3
	} else {
		l = 0
	}
	i, _ = strconv.Atoi(N[l:])
	if (i == 0) {
		i = 1000
	}
	r := 1000 - i
	fmt.Println(r)
}

Measured memory_bytes: 1772
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

ll N;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> N;
    solve();
}

// 1 <= N <= 10000
// N は整数

// ll N
// お釣りの金額を整数で出力せよ。
void solve(){
    ll ans=(N+999)/1000*1000-N;
    cout<<ans<<endl;
}


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

class A
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        int c = int.Parse(str[2]);

        Console.WriteLine(a < b && b < c ? "Yes" : "No");
    }
}

Measured memory_bytes: 5296
import java.util.Scanner;

public class Main {
    static public void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 0;
        
        for(int B = 1 ; B < N ; B++){
            ans += (N-1)/B;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 35708
#include<iostream>
using namespace std;
int main(void)
{
  int w,h,x,y,r;
  
  cin>>w>>h>>x>>y>>r;
  
  if(x-r<0 || y-r<0 || x+r>w || y+r>h)cout<<"No\n";
  else cout<<"Yes\n";
}

Measured memory_bytes: 3080