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

int selectionSort(int a[], int n){
    int sw = 0, minj, i, j;
    for (i=0; i<n-1; i++){
        minj = i;
        for (j=i; j<n; j++){
            if (a[j] < a[minj])
                minj = j;
        }
        swap(a[i], a[minj]);
        if (i != minj) sw++;
    }
    return sw;
}

int main(void){
    int i, n, sw;
    cin >> n;
    int a[n];
    for (i=0; i<n; i++) cin >> a[i];
    
    sw = selectionSort(a, n);
    
    for (i=0; i<n; i++){
        if (i) cout << ' ';
        cout << a[i];
    }
    cout << endl;
    cout << sw << endl;
    
    return 0;
}



Measured memory_bytes: 3096
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>

typedef long long i64;

using namespace std;

int main(){
    int A,B,C,D;
    cin>>A>>B>>C>>D;


    if((abs(A-B) <= D && abs(B-C) <= D) || abs(A-C) <= D){
        cout<<"Yes\n";
        return 0;
    }  

    cout<<"No\n";
    

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int main(void) {
  float n,odd = 0;
  cin >> n;

  for(int i = 1;i <= (int)n;i++){
    if(i % 2) odd++;
  }

  cout << setprecision(6);
  cout << odd / n;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int H, W, i, j;

    while (1) {
        scanf("%d %d", &H, &W);

        if (H == 0 && W == 0)
            break;

        for (i = 0; i < H; i++) {
            for (j = 0; j < W; j++) {
                if ((i + j) % 2 == 0)
                    putchar('#');
                else
                    putchar('.');
            }
            putchar('\n');
        }
        putchar('\n');
    }

    return 0;
}


Measured memory_bytes: 2076
program prob4
    implicit none
    integer(8) :: n, t, ans, i
    read(*,*) n, ans 

    do i = 2, n
        read(*,*) t
        ans = lcm(ans, t)
    end do

    write(*,*) ans

    stop
contains

integer(8) function gcd(a, b)
    implicit none
    integer(8) :: a, b
    integer(8) :: l, m, n

    m = a
    n = b

    do
    l = mod(m, n)
    if (l == 0) exit
    m = n
    n = l
    end do

    gcd = n

    return
end function gcd

integer(8) function lcm(a, b)
implicit none
    integer(8) :: a, b

    lcm = a / gcd(a, b)
    lcm = lcm * b

end function lcm
end program prob4

Measured memory_bytes: 2804
from sys import stdin

dic = dict()


def main() -> None:
    n = next_int()
    d, x = [int(s) for s in input().split()]

    for i in range(n):
        a = next_int()
        x += 1 + (d - 1) // a

    print(x)


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
# include <bits/stdc++.h>
using namespace std;
namespace fastio{
	template<typename tn> void read(tn &a){
	    tn x=0,f=1;char c=' ';
	    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	    for(;isdigit(c);c=getchar() ) x=x*10+c-'0';
	    a=x*f;
	}
	template<typename tn> void print(tn a){
	    if(a<0) putchar('-'),a=-a;
	    if(a>9) print(a/10);
	    putchar(a%10+'0');
	}
};
using namespace fastio;
long long x;
int main(){
	read(x);
	long long n=100;
	long long ans=0;
	while(n<x){
		n=1.01*n;
		ans++;
	}
	print(ans);
	puts("");
	return 0;
}

Measured memory_bytes: 3632
calc:: Int -> Int
calc n
  | n == 0 || n `mod` 2 /= 0 = 0
  | otherwise = succ $ calc (n `div` 2)

main = do
  _ <- getLine
  line <- getLine
  let
    ans = minimum $ map calc (map read $ words line :: [Int])
  putStrLn $ show ans


Measured memory_bytes: 1020
N, M = gets.split.map(&:to_i)
l = 0
r = N
M.times do
  li, ri = gets.split.map(&:to_i)
  l = li if l < li
  r = ri if r > ri
end

if r - l > 0
  puts r - l + 1
elsif r == l
  puts 1
else
  puts 0
end

Measured memory_bytes: 1788
import java.util.Scanner;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int ab = a * b;
		int cd = c * d;
		if (ab > cd) {
			System.out.println(ab);
		} else if (ab == cd) {
			System.out.println(ab);
		} else if (ab < cd) {
			System.out.println(cd);
		}

	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define all( x ) x.begin(), x.end()
#define rev_all( x ) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef unsigned long long ull;

const int mod = 1e9 + 7;
const int inf = 1e12 + 5;
const long double PI = 3.141592653589793;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  int ans = 0;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    if(i%2==0 && a[i] % 2 == 1)ans++;
  }
  cout << ans << endl;
  return;
}
signed main(){
  fast;
  int t;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}

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

#define ll long long

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for(int i=0; i<s.length(); i++) cout << 'x';
    cout << "\n";
    return 0;
}

Measured memory_bytes: 256
a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())

towns = [a1, b1, a2, b2, a3, b3]
res = True
for i in range(4):
    if towns.count(i+1) == 3:
        res = False

if res:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n, k; cin>>n>>k;
    string s; cin>>s;

    int same = 0;
    for(int i=0; i+1<n; i++){
        if(s[i] == s[i+1]) same++;
    }

    cout << min(n - 1, same + k * 2) << endl;
}

Measured memory_bytes: 512
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

typedef pair<long long, long long> pl;

long long N, M, k, a, b, c, d, e, H, W, X;
long long A[200000] = {};
long long B[200002] = {};
long long tt[20000] = {};
bool f;
bool ff;
string S, SS;
set <long long>sll;
pl buf;
vector <long long>vpl[100002];
vector <long long>vl;


int main() {
	cin >> N >> S;
	a = 0;
	b= 0;
	f = false;
	ff = false;

	for (int i = 0; i < S.size(); i++) {
		if (S[i] == '#') {
			a++;
		}

		if (S[i] == '.') {
			b++;
		}

		A[i] = a;
		B[i] = b;

	}

	c =min((int)A[S.size()-1],(int)B[S.size()-1]);

	for (int i = 0; i < S.size()-1; i++) {
		if (c > A[i] + b - B[i]) {
			c = A[i] + b - B[i];
		}
	}

	cout<<c<<endl;

	return 0;
}


Measured memory_bytes: 6148
#include<iostream>
using namespace std;
int main()
{
	int A,B,C;
	cin>>A>>B>>C;
	  if(A==B && B==C)
	    cout<<"No";
    else if(A==B || B == C || A==C)
	 {
	 	cout<<"Yes";
	 	
	 }

     else
         cout<<"No";
}

Measured memory_bytes: 256
#include<stdio.h>

int A[1000000], n;

int binarySearch(int key) {
	int left = 0;
	int right = n - 1;
	int mid;
	while(left <= right) {
		mid = left + (right - left) / 2;
		if(A[mid] == key) return 1;
		if(key < A[mid]) right = mid - 1;
		else if(key > A[mid]) left = mid + 1; 
	}
	return 0;	
}

int main() {
	int i, q, key, sum = 0;
	
	scanf("%d", &n);
    for(int i = 0; i < n; i++) { 
        scanf("%d", &A[i]);
    }
    
    scanf("%d", &q);
    for(int i = 0; i < q; i++) {
	    scanf("%d", &key);
		if( binarySearch(key)) sum++; 
	}
	printf("%d\n", sum);
	
	return 0;    
}

Measured memory_bytes: 2956
N,M = map(int,input().split())
H = list(map(int,input().split())) #標高の高さ
best_list = [True]*N

A=0
B=0
for k in range(0,M):
    A,B=map(int,input().split())
    if(H[A-1]-H[B-1]<=0):
        best_list[A-1]=False
    if(H[B-1]-H[A-1]<=0):
        best_list[B-1]=False
print(best_list.count(True))


Measured memory_bytes: 20116
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,K = MI()

ans = 0
if K == 0:
    ans = N**2
else:
    for b in range(K+1,N+1):  # b を固定
        ans += N//b*(b-K) + max(0,N % b - (K-1))
print(ans)


Measured memory_bytes: 64304
#include<bits/stdc++.h>
using namespace std;
stack<char> sta;
int main(){
    string s;
    cin>>s;
    int l=s.length();
    for(int i=0;i<l;i++){
        if(sta.empty()){
            sta.push(s[i]);
        }
        else{
            if(sta.top()!=s[i]){
                sta.pop();
            }
            else{
                sta.push(s[i]);
            }
        }
    }
    cout<<l-sta.size()<<endl;
    return 0;
}


Measured memory_bytes: 512
(let* ((a (read-line))
       (first (position #\Space a))
       (second (position #\Space a :start (1+ first))))
  (princ (if (and (char= (aref a (1+ first)) (aref a (1- first)))
		  (char= (aref a (1- second)) (aref a (1+ second))))
	     "YES"
	     "NO")))

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

const int N = 1e6 + 100;

int n, a, k, cnt[N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	while(n--) {
		cin >> a;
		cnt[a]++;
	}
	for (int i = N - 1; i >= 0; i--)
		if(cnt[i]) {
			k = i;
			break;
		}
	
	if(k & 1) {
		for (int i = k; i > k / 2; i--)
			if(cnt[i] < 2) {
				cout << "Impossible";
				return 0;
			}
		if(cnt[k / 2 + 1] == 2)
			cout << "Possible";
		else
			cout << "Impossible";
	}
	else {
		for (int i = k; i > k / 2; i--)
			if(cnt[i] < 2) {
				cout << "Impossible";
				return 0;
			}
		if(cnt[k / 2] == 1)
			cout << "Possible";
		else
			cout << "Impossible";
	}
	return 0;
}

Measured memory_bytes: 256
import math

N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int,input().split())

S = 0
for i in range(N):
    for j in range(N):
        S += math.sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2)

ans = S / N
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

//拡張ユークリッド
//ax+by=gcd(a,b)の解
ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d=a;
	if(b){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1,y=0;
	}
	return d;
}

//中国剰余定理
//https://qiita.com/drken/items/ae02240cd1f8edfc86fd
//リターン値 (r,m) x¥equiv r (mod m)
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2, long long m2) {
  long long p, q;
  long long d = extgcd(m1, m2, p, q); // p is inv of m1/d (mod. m2/d)
  if ((b2 - b1) % d != 0) return make_pair(0, -1);
  long long m = m1 * (m2/d); // lcm of (m1, m2)
  long long tmp = (b2 - b1) / d * p % (m2/d);
  long long r = ((b1 + m1 * tmp)%m+m)%m;
  return make_pair(r, m);
}

//約数列挙
template <class T>
vector<T> divisor(T x){
    vector<T> res;
    for(T i=1;i*i<=x;i++){
        if(x%i==0){
            res.push_back(i);
            if(i!=x/i){
                res.push_back(x/i);
            }
        }
    }
    return res;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    n*=2;
    ll ans=inf;
    for(auto x:divisor(n)){
        vector<ll> b={0,-1},m={x,n/x};
        P ret=ChineseRem(0,x,-1,n/x);
        if(ret.se==-1) continue;
        if(ret.fi==0) ret.fi+=ret.se;
        chmin(ans,ret.fi);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3760
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=10;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int arr[MAXN],brr[MAXN],crr[MAXN];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>arr[i];
    for(int i=1;i<=n;i++)cin>>brr[i];
    for(int i=1;i<=n;i++)crr[i]=i;
    int a=0,b=0;
    int num=1;
    do{
        bool flag1=true;
        for(int i=1;i<=n;i++)
        {
            if(crr[i]!=arr[i])
            {
                flag1=false;break;
            }
        }
        if(flag1==true)
        {
            a=num;
        }
        bool flag2=true;
        for(int i=1;i<=n;i++)
        {
            if(crr[i]!=brr[i])
            {
                flag2=false;break;
            }
        }
        if(flag2==true)
        {
            b=num;
        }
        num++;
    }while(next_permutation(crr+1,crr+n+1));
    cout<<abs(a-b)<<endl;
    return 0;
}


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

int main(){
  int a,b,m;
  cin>>a>>b>>m;
vector<int> renzi(a);
vector<int> ref(b);

vector<int> total(m);
int saisyo=300000;
  for(int i=0;i<a;i++){
   cin>>renzi[i]; 
  }
  for(int i=0;i<b;i++){
   cin>>ref[i]; 
  }

  for(int j=0;j<m;j++){
   int x,y,c;
    cin>>x>>y>>c;
    total[j]=renzi[x-1]+ref[y-1]-c;
    if(saisyo>total[j])saisyo=total[j];
  }
    sort(renzi.begin(),renzi.end());
  sort(ref.begin(),ref.end());
       if(renzi[0]+ref[0]<saisyo)saisyo=renzi[0]+ref[0];
      cout<<saisyo<<endl;
  
}

Measured memory_bytes: 1408
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (n)-1; i > -1; i--)
#define reps(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define sper(i, s, n) for (int i = (s); i >= (int)(n); i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve()
{
    int r;
    cin >> r;
    int ans = 3 * r * r;
    cout << ans << endl;
}

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

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

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine()
            .Split(' ')
            .Select(txt => int.Parse(txt))
            .ToList();
        var N = inputs[0]; //展望台の数
        var M = inputs[1]; //道の数
        var heights = Console.ReadLine()
            .Split(' ')
            .Select(txt => int.Parse(txt))
            .ToList();

        var tenboudaiDict = new Dictionary<int, Tenboudai>();
        foreach (var h in heights)
        {
            var id = tenboudaiDict.Count + 1;
            tenboudaiDict.Add(id, new Tenboudai(id, h));
        }

        for (int i = 0; i < M; i++)
        {
            var nums = Console.ReadLine()
                .Split(' ')
                .Select(txt => int.Parse(txt))
                .ToList();

            var t1 = tenboudaiDict[nums[0]];
            var t2 = tenboudaiDict[nums[1]];

            t1.AddRoute(t2);
            t2.AddRoute(t1);
        }

        Console.WriteLine(tenboudaiDict.Values.Count(t => t.Is良い));
    }

    class Tenboudai
    {
        public int Id { get; }
        public int Height { get; }

        public List<Tenboudai> Routes = new List<Tenboudai>();

        public Tenboudai(int id, int height)
        {
            Id = id;
            Height = height;
        }

        public void AddRoute(Tenboudai t)
        {
            Routes.Add(t);
        }

        public bool Is良い => !Routes.Any() || Routes.All(r => r.Height < this.Height);
    }
}

Measured memory_bytes: 72472
#!/usr/bin/env python3

from itertools import accumulate


def main():
    n, k = map(int, input().split())
    s = input()

    # 配列を下記で変換
    # '11000' = [2, 3, 0]
    # '1'の長さで始まり、'1'の長さで終わるようにする
    s = s.replace('01', '0,1').replace('10', '1,0')
    len_list = [len(string) for string in s.split(',')]
    if s[0] == '0':
        len_list = [0] + len_list
    if s[-1] == '0':
        len_list = len_list + [0]

    if 2 * k + 1 >= len(len_list):
        print(n)
        return

    sum_list = [0] + list(accumulate(len_list))
    max_len = 0
    for i in range(0, len(len_list) - (2 * k + 1) + 1, 2):
        handstand_len = sum_list[i + (2 * k + 1)] - sum_list[i]
        if max_len < handstand_len:
            max_len = handstand_len
    print(max_len)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9408
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;


int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    int sum = 0;
    rep(i, n) {
        cin >> x[i];
        sum += x[i];
    }
    int p = round((double)sum/n);
    //cout << sum << " " << p << endl;
    int hp = 0;
    rep(i, n){
        hp += (x[i] - p) * (x[i] - p);
    }
    cout << hp << "\n";
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n, w[202000], chk[2020], sz;
char p[202000];
long long D[202000], po[202000], Mod = 998244353;
vector<int>T;
int main() {
	int i, j, k;
	scanf("%d", &n);
	po[0] = 1;
	for (i = 1; i <= n; i++)po[i] = po[i - 1] * 2 % Mod;
	scanf("%s", p);
	for (i = 0; i < n; i++) {
		w[n - i - 1] = p[i] - '0';
	}
	for (i = 1; i <= n; i+=2) {
		if (n%i == 0) {
			T.push_back(i);
		}
	}
	sz = T.size();
	for (i = n - 1; i >= 0; i--) {
		if (w[i] == 1) {
			for (j = 0; j < sz; j++) {
				if (chk[j])continue;
				int l = n / T[j];
				if (n - 1 >= i + l && w[i + l] == 0)continue;
				long long t = 1;
				if (n - i < l) t = po[l-(n-i)];
				D[j] = (D[j] + t) % Mod;
			}
		}
		for (j = 0; j < sz; j++) {
			int l = n / T[j];
			if (n - 1 >= i + l && w[i + l] == w[i]) chk[j] = 1;
		}
	}
	for (j = 0; j < sz; j++) {
		if (chk[j])continue;
		long long t = 1;
		D[j] = (D[j] + t) % Mod;
	}
	long long res = 0;
	for (j = sz - 1; j >= 0; j--) {
		for (k = sz - 1; k > j; k--) {
			if (T[k] % T[j] == 0) {
				D[j] = (D[j] - D[k] + Mod) % Mod;
			}
		}
		res = (res + (n / T[j]) * 2 * D[j]) % Mod;
	}
	printf("%lld\n", res);
}

Measured memory_bytes: 3968
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
  int H,W,h,w,n,i;
  char str[101000];
  scanf("%d%d",&H,&W);
  scanf("%d%d",&h,&w);
  int div=H*W;
  printf("%d",(H-h)*(W-w));
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
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 main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int B[110];
    rep(i ,N - 1) cin >> B[i];
    int ans = B[0] + B[N - 2];
    rep(i, N - 2) {
        ans +=min(B[i], B[i + 1]); 
    }
    cout << ans << endl;

    return 0;
}


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

int a[4],b[4];
int hit, blow;

int main(){
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		hit = 0; blow = 0;

		for(int i=0; i < 4; i++){
				for(int j=0; j < 4; j++){
					if(a[i] == b[j] && i == j) hit++;
					if(a[i] == b[j] && i != j) blow++;
				}
		}
		cout << hit << ' ' << blow << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

int main() {

    int a, b, c;
    cin >> a >> b >> c;
    
    if (a + b >= c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    return 0;

}

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

int main() {
  int n;
  cin >> n;
  int skip;
  if (n & 1)
    skip = n;
  else
    skip = n + 1;
  int ans = n * (n - 1) / 2 - n / 2;
  cout << ans << endl;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      if (i + j == skip) continue;
      printf("%d %d\n", i, j);
    }
}


Measured memory_bytes: 3672
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
using namespace std;
int v[100005] = {};

int main() {
	int n; cin >> n;
	map<int, int> mp1, mp2;
	for (int i = 0; i < n; i++) {
		int v; 
		cin >> v;
		(i % 2 == 0 ? mp1[v]++ : mp2[v]++);
	}
	int a = 0, b = 0, c = 0, d = 0;
	int mx1 = 0, mx2 = 0;
	for (int i = 1; i <= 100000; i++) {
		if (mp1[i] >= a) {
			b = a;
			a = mp1[i];
			mx1 = i;
		}
		if (mp2[100000 - i] >= c) {
			d = c;
			c = mp2[100000 - i];
			mx2 = 100000 - i;
		}
	}
	if (mx1 != mx2) cout << n - a - c << endl;
	else {
		cout << min(n - a - d, n - b - c) << endl;
	}
	return 0;
	
}

Measured memory_bytes: 9600
import java.util.*;

class Main{
    public static final int MOD = 1000000007;

    long[] fac,finv,inv;

    Main(){
        int N, K;
        Scanner SC = new Scanner(System.in);
        N = SC.nextInt();
        K = SC.nextInt();

        init(N+1);

        long R = 0;
        int L;
        if(N-1 <= K)
            L = N-1;
        else{
            L = K;
        }
        
        for(int i=0;i<=L;i++){
            R = (R + COM(N,i) * COM(N-1,N-i-1) % MOD) % MOD;
        }

        System.out.println(R);
    }

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


    void init(int max){
        fac  = new long[max];
        finv = new long[max];
        inv  = new long[max];

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


Measured memory_bytes: 25684
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0, num1 = 0, num2 = 0;

    ll cnt = 0, now1 = a[0], now2 = a[0], check = 0;
    while (check != n - 1) {
        if (n % 2 == 0 && check == n - 2) {
            // cout << num1 << "\n";
            // cout << a[n - 1 - cnt] << endl;
            num1 += max(abs(now1 - a[n - 1 - cnt]), abs(now2 - a[n - 1 - cnt]));
            break;
        }
        num1 += abs(now1 - a[n - 1 - cnt]);
        now1 = a[n - 1 - cnt];
        cnt++;
        check++;
        num1 += abs(now2 - a[n - 1 - cnt]);
        now2 = a[n - 1 - cnt];
        cnt++;
        check++;

        if (check == n - 1) break;

        cnt -= 2;
        if (n % 2 == 0 && check == n - 2) {
            // cout << num1 << "\n";
            // cout << a[cnt + 1] << endl;
            num1 += max(abs(now1 - a[cnt + 1]), abs(now2 - a[cnt + 1]));
            break;
        }
        num1 += abs(now1 - a[cnt + 1]);
        now1 = a[cnt + 1];
        cnt++;
        check++;
        num1 += abs(now2 - a[cnt + 1]);
        now2 = a[cnt + 1];
        cnt++;
        check++;
    }
    cnt = 0;
    check = 0;
    ll Now1 = a[n - 1], Now2 = a[n - 1];
    while (check != n - 1) {
        if (n % 2 == 0 && check == n - 2) {
            // cout << num2 << "\n";
            num2 += max(abs(Now1 - a[cnt]), abs(Now2 - a[cnt]));
            break;
        }
        num2 += abs(Now1 - a[cnt]);
        Now1 = a[cnt];
        cnt++;
        check++;
        num2 += abs(Now2 - a[cnt]);
        Now2 = a[cnt];
        cnt++;
        check++;

        if (check == n - 1) break;

        cnt -= 2;
        if (n % 2 == 0 && check == n - 2) {
            // cout << num2 << "\n";
            num2 += max(abs(Now1 - a[n - 2 - cnt]), abs(Now2 - a[n - 2 - cnt]));
            break;
        }
        num2 += abs(Now1 - a[n - 2 - cnt]);
        Now1 = a[n - 2 - cnt];
        cnt++;
        check++;
        num2 += abs(Now2 - a[n - 2 - cnt]);
        Now2 = a[n - 2 - cnt];
        cnt++;
        check++;
    }

    // cout << num1 << " " << num2 << "\n";

    ans = max(num1, num2);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3940
#include<stdio.h>

void show(int a[], int n){
  int i;
  for(i=0; i<n-1; i++){
    printf("%d ", a[i]);
  }
  printf("%d", a[n-1]);
  printf("\n");
  return ;
}

void insertion(int a[], int n){
  int i, j, temp;
  for(i=1; i<n; i++){
    temp = a[i];
    j = i - 1;
    while(j>=0 && a[j]>temp){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = temp;
    show(a, n);
  }
}

int main(){
  int n, i;
  int a[101];
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &a[i]);
  }
  show(a, n);
  insertion(a, n);
  return 0;
}

Measured memory_bytes: 1808
#include<iostream> //cinなど
#include<string> //文字列
#include<algorithm> //sort など
#include<math.h> //paw(冪乗など)
#include<set> // 集合
#include<map> //写像
#include<stdio.h> //printf
#include<stack>

using namespace std;
int main(){
  string a,b;
  cin>> a >> b;
  if(a == "H"){
    if(b == "H"){
      cout<<"H"<<endl;
    }else{
      cout<<"D"<<endl;
    }
  }else if(a == "D"){
    if(b == "H"){
      cout<<"D"<<endl;
    }else{
      cout<<"H"<<endl;
    }
  }
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int d;
  	scanf("%d",&d);
  	if (d==25) printf("Christmas");
    if (d==24) printf("Christmas Eve");
  	if (d==23) printf("Christmas Eve Eve");
  	if (d==22) printf("Christmas Eve Eve Eve");
  
  	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const int MAXN = 100500;

struct Point 
{
	int x, y;

	Point () {}

	Point (int _x, int _y): x(_x), y(_y) {}

	void Scan()
	{
		cin >> x >> y;
	}

	Point operator-(Point b)
	{
		return Point(x - b.x, y - b.y);
	}

	Point operator+(Point b)
	{
		return Point(x + b.x, y + b.y);
	}

	int operator%(Point b)
	{
		return x * b.x + y * b.y;
	}

	int operator*(Point b)
	{
		return x * b.y - y * b.x;
	}
};

Point pt[MAXN];
int n;
int cnt[MAXN];

ll sum(ll a, ll b)
{
	return (a + b) % MOD;
}

ll sub(ll a, ll b)
{
	return (a - b + MOD) % MOD;
}

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

long long bin_pow(ll a, ll n)
{
	ll res = 1;
	while (n)
	{
		if (n & 1)
			res = mul(res, a);
		a = mul(a, a);
		n /= 2;
	}
	return res;
}

int main()
{                                                     
	ios_base::sync_with_stdio(0);

	cin >> n;

	for (int i = 0; i < n; i++)
		pt[i].Scan();
	

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
		{
			if (i != j)
			{
				int count = 0;
				for (int k = 0; k < n; k++)
				{
					if ((pt[i] - pt[j]) * (pt[i] - pt[k]) == 0)
						count++;
				}
				cnt[count]++;
			}
		}


	assert(cnt[0] == 0 && cnt[1] == 0);


	long long dif = 1 + n;
	
	for (int i = 2; i <= n; i++)
	{
		int kek = i * (i - 1);
		assert(cnt[i] % kek == 0);
		cnt[i] /= kek;

		dif = sum(dif, mul(cnt[i],sub(bin_pow(2, i), i + 1)));
	}

	long long ans = sub(bin_pow(2, n), dif);

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <mylib.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_EQ(i,a,b) for(int i = (a); i <= (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)
#define rep_eq(i,n) FOR_EQ(i,0,n)
#define rep_re(i,n) FOR_RE(i,n,0)
//1個上から時計周り
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//上右下左
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
static const int NIL = -1;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
int n;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll x, y;
    cin >> x >> y;
    int cnt = 0;
    ll tmp = x;
    while(tmp <= y){
        cnt++;
        //cout << tmp << endl;
        tmp = tmp * 2;
        //if(cnt == 10)   break;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

def getNumOfDigits(num: int):
    count = 1
    while True:
        count += 1
        num /= 10
        if num < 10:
            break
    return count

def solve(N: int):
    num = getNumOfDigits(N)
    if num in {1,2}:
        print(min(N,9))
    elif num in {3,4}:
        print(9 + min(N -100 + 1, 900))
    elif num in {5,6}:
        print(909 + min(N - 10000 + 1, 90000))
    else :
        print('none')
    
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  string s; cin >> s;
  ll k; cin >> k;
  REP(i, s.size()) {
    if (s[i] == 'a') continue;
    if ('z'-s[i]+1 <= k) {k -= ('z'-s[i]+1); s[i] = 'a';}
  }
  if (k != 0) s[s.size()-1] = ((s[s.size()-1] - 'a' + k) % 26) + 'a';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 512
let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map (fun x -> int x)

readStringArray() |> Array.map (fun x -> x.ToUpper().[0].ToString()) |> Array.fold (fun s acc -> s + acc) ""
|> printfn "%s"

Measured memory_bytes: 14040
#include <iostream>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

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

    vector<int> h(N);
    vector<int> dp(N);
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
        dp[i] = INF;
    }

    dp[0] = 0;
    dp[1] = dp[0] + abs(h[0] - h[1]);
    for (int i = 2; i < N; i++)
    {
        dp[i] = dp[i - 1] + abs(h[i - 1] - h[i]);
        chmin(dp[i], dp[i - 2] + abs(h[i - 2] - h[i]));
    }

    cout << dp[N - 1] << endl;
}


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

bool isPrime(int x); 
int gcd(int a, int b); 
vector<int> primeFactorization(int x); 
void printVector(vector<long> list, string str); 
void setPrecision(int n);

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

  int M = max(a, max(b, c));
  int sum = a+b+c;
  if (M*3%2 == sum %2) {
    int result = (M*3 - sum) / 2;
    cout << result << endl;
  } else {
    M++;
    int result = (M*3 - sum) / 2;
    cout << result << endl;
  }
}

int gcd(int a, int b) {
  if (a%b == 0) {
    return b;
  } else return gcd(b, a%b);
}

bool isPrime(int x) {
  if (x < 2) return false;
  if (x == 2) return true;
  if (x % 2 == 0) return false;

  double num = sqrt(x);
  for (int i = 3; i <= num; i+=2) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}

// 素因数分解
// example: primeFactorization(12) = vector<int>{2, 2, 3}
vector<int> primeFactorization(int x) {
  vector<int> ans;
  int i = 2;
  while (i*i <= x) {
    if (x % i == 0) {
      ans.push_back(i);
      x /= i;
    } else {
      i++;
    }
  }
  ans.push_back(x);
  return ans;
}

void printVector(vector<long> list, string str) {
  for (int i = 0; i < list.size(); i++) {
    cout << str << ": " << list[i] << endl;
  }
}

void setPrecision(int n) {
  cout << fixed << setprecision(n);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// #include "boost/math/common_factor.hpp" // gcd, lcm
using namespace std;

// #define int long long

signed main(void) {
  int num; // num
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  bool flag = false;
  int n;

  string s;
  cin >> s;

  if (s == "keyence") flag = true;
  else {
  for (auto it0 = s.begin(); it0 < s.end(); ++it0) {
    if (flag) break;
    for (auto it1 = it0 + 1; it1 < s.end(); ++it1) {
      string s1 = s.substr(0, it0 - s.begin());
      string s2 = s.substr(it1 - s.begin(), s.end() - s.begin());
      string s3 = s1 + s2;
      if (s3.size() < 7) break;
      if (s3 == "keyence") {
        flag = true;
        break;
      }
      // cout << s1 << s2 << endl;
    }
  }
  }

  if (flag) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  // cout << num << endl;
  return 0;
}


Measured memory_bytes: 256
// fakuto.cpp
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
	int n;
	double s;
	cin >> n;
	
	s=sqrt(n);
	cout << n << ":";
	while(true){
		for(int i=2;i<s;i++){
			if(n%i==0){
				cout << " " << i;
				n = n/i;
				i=1;
				continue;
			}
		}
		if(n==1){break;}
		cout << " " << n;
		break;
	}
	cout << endl;
	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    int a[n],h[n];
    for(int i=0;i<n;i++){
        a[i]=1;cin>>h[i];}
    int x,y;
    while(m--){
        cin>>x;
        cin>>y;
        if(h[x-1]>h[y-1])a[y-1]=0;
        else if(h[x-1]<h[y-1])a[x-1]=0;
        else{
            a[y-1]=0;
            a[x-1]=0;
        }
    }
    int count=0;
    while(n--){
        if(a[n])count++;
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 4424
import math

N = int(input())
P = [int(x) for x in input().split()]
Q = [int(x) for x in input().split()]
sort_P = []
sort_Q = []
count_A = 1
count_B = 1
count_sum = 1

for i in range(len(P) - 1):
    x = P.pop(0)
    y = Q.pop(0)
    sort_P.append(x)
    sort_Q.append(y)
    sort_P.sort()
    sort_Q.sort()
    count_A += (x - sort_P.index(x) - 1) * math.factorial(N - 1 - i)
    count_B += (y - sort_Q.index(y) - 1) * math.factorial(N - 1 - i)

print(abs(count_A - count_B))

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  while(1)
  {
    int c=0;
    for(int j=2;j<n;j++)
    {
       if(n%j==0)
       {
         c++;
       }
    }
    if(c==0)
    {
      cout<<n;
      break;
    }
    n++;
  }
  return 0;
}

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

int d(int a){
    return a*a;
}

int s (int a){
    int n = 1;
    while(a > 1){
        n *= a;
        a--;
    }
  	return n;
}

int main(){
    int n;
    cin >> n;
    vector<pii> x(n);
    rep(i,n){
        int a,b;
        cin >> a >> b;
        x[i].first = a;
        x[i].second = b;
    }
    double ans = 0;
    rep(i,n){
        rep(j,n){
            int t = d(x[i].first - x[j].first) + d(x[i].second - x[j].second);
            ans += pow(t,0.5);
        }
    }
    int t = s(n);
    cout << fixed << setprecision(10) << ans*(t/n)/t << endl;
}

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

ll calc(ll a){
    if(a == 0) return 1;
    else return (a*calc(a-1))%1000000007;
}

int main(){
    int n,m; cin >> n >> m;
    ll mod = 1000000007,ans=0;
    if(abs(n-m)>1) ans = 0;
    else if(n == m){
        ans = (((calc(n)*calc(n))%mod)*2)%mod;
    }
    else{
        ans = (calc(max(n,m))*calc(min(n,m)))%mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5096
d=list(map(int,input().split()))
q=int(input())

def Check(Dice,P):
    if P == [3,1] or P ==[4,3] or P ==[2,4] or P ==[1,2]:
        a=0
    elif P == [2,0] or P ==[5,2] or P ==[3,5] or P ==[0,3]:
        a=1
    elif P == [0,1] or P ==[1,5] or P ==[5,4] or P ==[4,0]:
        a=2
    elif P == [1,0] or P ==[5,1] or P ==[4,5] or P ==[0,4]:
        a=3
    elif P == [0,2] or P ==[2,5] or P ==[5,3] or P ==[3,0]:
        a=4
    elif P == [1,3] or P ==[3,4] or P ==[4,2] or P ==[2,1]:
        a=5
    return a

for i in range(q):
    l1=list(map(int,input().split()))
    l2=[d.index(l1[0]),d.index(l1[1])]
    print(d[Check(d,l2)])


Measured memory_bytes: 5600
N = int(input())
A = list(map(int,input().split()))
def f(A):
    B = {0 if a%2==0 else 1 for a in A}
    if 1 in B:
        return 1
    else:
        return 0
i = 0

while f(A) == 0:
    A = [a/2 for a in A]
    i += 1
print(i)


Measured memory_bytes: 2940
#include<stdio.h>
#define NILL -1

int main()
{
  int i,j,k,m=0,n,parent[100000],L[100000],R[100000],id, child; 
  for(i=0; i<100000; i++){
      parent[i]=NILL;
      L[i]=NILL;
      R[i]=NILL;
    }
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
      for(j=0;j<k;j++){
        scanf("%d",&child);
        parent[child]=id;
	  if(j==0)L[id]=child;
	  else R[m]=child;
	  m=child;
    }
  }for(i=0; i<n; i++){
      printf("node %d: ", i);
      printf("parent = %d, ", parent[i]);
      for(j=parent[i], k=0; j!=NILL; j=parent[j], k++);
      printf("depth = %d, ", k);
      if(parent[i]==NILL)printf("root, [");
      else if(parent[i]!=NILL && L[i]!=NILL)printf("internal node, [");
      else printf("leaf, [");
      for(j=L[i]; j!=NILL; j=R[j]){
	    if(R[j]!=NILL)printf("%d, ", j);
	    else printf("%d", j);
	}
      printf("]\n");
    }
  return 0;
}


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

int main(){
    string s;
    string ans = "";
    int t = 0;

    cin >> s;
    for(int i = 0;i < s.size();i++){
        if(s[i]=='0'){
            ans[t++] = '0';
        }
        else if(s[i]=='1'){
            ans[t++] = '1';
        }
        else if(s[i]=='B'&&t > 0){
            t--;
        }
    }

    for(int i = 0;i < t;i++){
        cout << ans[i];
    }
}


Measured memory_bytes: 256
#include<iostream>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;

const int mod = 1000000007;
struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const{return mint(-x);}
    mint& operator+=(const mint a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a){
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    mint& operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if(!t) return 1;//t == 0
        mint a = pow(t>>1);
        a *= a;
        if(t&1) a *= *this;
        return a;
    }

    //for prime mod
    mint inv() const{
        return pow(mod-2);
    }
    mint& operator/=(const mint a){
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }

};

mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i, a){
        x *= n-i;
        y *= i+1;
    }
    return x / y;
}

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    mint ans = mint(2).pow(n);
    ans -= 1;
    ans -= choose(n,a);
    ans -= choose(n,b);
    cout << ans.x << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define XBY10 0x1999999Aul

int main(int argc, const char * argv[]) {

    unsigned long quotient;
    unsigned long remainder;
    unsigned long mult;
    
    int i;
    
    for (i = 10; i < 100; i++)
    {
        quotient = i * XBY10;
        quotient >>= 32;
        remainder = i - quotient * 10;
        if (remainder == 0) continue;
        
        mult = quotient * remainder;
        printf("%lux%lu=%lu\n", quotient, remainder, mult);
    }
    
    return 0;
}

Measured memory_bytes: 524
#include<stdio.h>  
#include<math.h>
int main()
{
    int n,i,t=1,j;
    scanf("%d",&n);
    if(n==1)
    printf("%d\n",n);
    for(j=sqrt(n);j>=1;j--)
    {i=j;
    while(i)
    {t*=2;
    i--;}
    if(t<=n)
    {printf("%d\n",t);
    break;}
    else
    t=1;}
    return 0;  
}  

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()


int main() {
    string s;
    cin >>s;
    if(s=="AAA"||s=="BBB") dunk("No");
    else dunk("Yes");
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")

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

#define pii pair<int,int>
#define pll pair<ll,ll>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define deb(x) cerr<<#x" = "<<x<<nl
#define in() ( { int a ; scanf("%d",&a); a; } )

const int N = 3e5 + 9;
const int mod = 1e9 + 7;

int a[N], cnt[16], dp[1<<16], pos[1<<16];
int32_t main()
{
    int n=in();
    for(int i=1; i<n; i++){
        int u=in(), v=in(), k=in();
        u++; v++;
        a[u]^=k; a[v]^=k;
    }
    int ans=0;
    for(int i=1; i<=n; i++) cnt[a[i]]++;
    ans+=cnt[0];
    for(int i=1; i<16; i++) ans+=cnt[i]>>1, cnt[i]%=2;
    cnt[0]=0;
    dp[0]=0;
    vector<int> v;
    for(int i=0; i<16; i++) if(cnt[i]) v.eb(i);
    int m=v.size();
    for(int mask=1; mask<(1<<m); mask++){
        int nw=0;
        for(int i=0; i<m; i++) if((mask>>i)&1) nw^=v[i];
        if(nw==0) pos[mask]=1;
    }
    for(int mask=1; mask<(1<<m); mask++){
        for(int sub=mask; sub; sub=(sub-1)&mask){
            if(pos[sub]) dp[mask]=max(dp[mask], dp[mask^sub]+1);
        }
    }
    ans+=dp[(1<<m)-1];
    cout<<n-ans<<nl;
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

ll N;

void solve() {
	ll A, B;
	cin >> A >> B;

	if ((A - B) % 2 == 0) {
		cout << (A + B) / 2;
	}
	else {
		cout << "IMPOSSIBLE";
	}

}

int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 888
e1,e2,e3,e4=map(int,input().split())

if e1==e2 and e3==e4:
    print("yes")
elif e1==e3 and e2==e4:
    print("yes")
elif e1==e4 and e2==e3:
    print("yes")
elif e1==e2==e3==e4:
    print("yes")
else :
    print("no")


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int main()
{
	double n;
	cin>>n;
	double ans=(n/3.0)*(n/3.0)*(n/3.0);
	printf("%.10lf\n",ans);
	return 0;
}

Measured memory_bytes: 256