akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] info = Console.ReadLine().Split().Select(x => Convert.ToInt64(x)).ToArray();
            long[] infotwo = Console.ReadLine().Split().Select(x => Convert.ToInt64(x)).ToArray();
            if(info[0]!= infotwo[0])
            {
                Console.WriteLine(1);
            }
            else
            {
                Console.WriteLine(0);
            }

        }
        public static long Digit(long num)
        {
            // Mathf.Log10(0)はNegativeInfinityを返すため、別途処理する。
            return (num == 0) ? 1 : ((long)Math.Log10(num) + 1);
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/
#include<vector>/*可変長配列vectorのインクルード*/

const int MOD=1000000007;/* 1,000,000,007 で割った余りを出力する　のとき使う*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

string S;
string T;
int ans=0;

int main(void) {
  cin >> S;
  cin >> T;
  
  if(S[0]==T[0]) ans++;  
  if(S[1]==T[1]) ans++;    
  if(S[2]==T[2]) ans++;  
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#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;

long long N, M, H,K,W,re;
long long A[200001];
long long so[200000];
string S[100];
bool OK = true;
bool f;
vector <long long>vl;

int main() {
	cin >>N>>M>>H>>K;
	
	re = N + M + H;

	if (K%2==1) {
		re=M - N;
	}
	else {
		re = N - M;
	}


		if (re > 1000000000000000000) {
			cout << "Unfair" << endl;
		}
		else{
			cout << re << endl;
		}
	

	
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#define ALL(a) (a).begin(),(a).end()

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>que;

int main() {
  ll N,M;
  cin>>N>>M;
  ll x[M],y[M],A[N];
  UnionFind tree(N+1);
  FOR(i,0,N-1){
    cin>>A[i];
    
  }
  //cout<<"1"<<endl;
  FOR(i,0,M-1){
    cin>>x[i]>>y[i];
    tree.unite(x[i],y[i]);
  }
  //cout<<"2"<<endl;
  ll ans=0;

  FOR(i,0,N-1){
  //cout<<A[i]<<" "<<A[ A[i] -1]<<endl;
    if(tree.same(A[i],A[ A[i] -1]))ans++;
    //cout<<i<<endl;
  }
  cout<<ans<<endl;

return 0;
 
}

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

int main(){
    int N;
    cin >> N;
    int A[N];
    for(int n=0; n<N; n++){
        cin >> A[n];
    }
    int sum = 0;
    for(int n=0; n<N; n++){
        sum += A[n];
    }
    sum /= 2;
    int n=0;
    while(1){
        sum -= A[n];
        n+=2;
        if(n >= N-1)break;
    }
    int res[N];
    res[N-1] = sum; res[0] = A[N-1] - res[N-1];
    for(int n=0; n<N-1; n++){
        res[n+1] = A[n] - res[n];
    }
    for(int n=0; n<N; n++){
        cout << res[n]*2;
        if(n != N-1){
            cout << " ";
        }
        else{
            cout << endl;
        }
    }
}


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

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }

        static void SolveA(string[] args)
        {
            int x = ReadAndParseInt();
            // 素数テーブル

            // 1000以下のべき乗を事前計算
            var list = new List<int>() { 1 };
            //list.AddRange(primes);
            for(int i=2;i<=31;++i)
            {
                int b = i;
                int tmp = b;
                while (true)
                {
                    tmp *= b;
                    if (tmp <= 1000)
                    {
                        list.Add(tmp);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            list.Sort();
            int max = 0;
            for(int i=list.Count-1;i>=0;--i)
            {
                if( list[i] <= x)
                {
                    max = list[i];
                    break;
                }
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main()
{
 long long  int n;
  cin>>n;
  long long int sum=0;
  unordered_map<long long int,long long int>m;
   long long int mod=1000000007;
  for(long long int i=0;i<n;i++)
  {
   long long  int temp;
    cin>>temp;
    sum=sum+temp;
    m[temp]++;
  }
  long long int t;
  cin>>t;
 
  while(t--)
  {
    long long int a,b;
    cin>>a>>b;
    if(m[a]!=0)
    {
      sum=(sum-(a*m[a])+(b*m[a]));
      m[b]=m[b]+m[a];
      m[a]=0;
      cout<<sum<<endl;
    }
    else
    {
      cout<<(sum)<<endl;
    }
  }
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

class UnionFind{
private:
	::std::vector<int_fast32_t> par;
	::std::vector<int64> sz;
	::std::vector<int64> ok, alle;
	size_t n;

public:
	UnionFind(){}
	UnionFind(size_t n):n(n){
		par.resize(n, -1);
		sz.resize(n);
		ok.resize(n, 0);
		alle.resize(n, 0);
	}

	void set_sz(vector<int64>& a){
		REP(i, sz.size()) sz[i] = a[i];
	}

	uint_fast32_t find(uint_fast32_t x){
		return par[x] < 0 ? x : par[x] = find(par[x]);
	}

	size_t size(uint_fast32_t x){
		return -par[find(x)];
	}

	int64 get_sum(int32 x){
		return sz[find(x)];
	}

	void make_ok(int32 x){
		x = find(x);
		ok[x] = alle[x];
	}

	bool unite(uint_fast32_t x, uint_fast32_t y){
		x = find(x);
		y = find(y);
		if(x == y) { alle[x]++; return false; }
		if(size(x) < size(y)) std::swap(x, y);
		par[x] += par[y];
		sz[x] += sz[y];
		alle[x] += alle[y]+1;
		ok[x] += ok[y];
		par[y] = x;
		return true;
	}

	int64 get_ok(int32 x){
		return ok[find(x)];
	}

	bool same(uint_fast32_t x, uint_fast32_t y){
		return find(x) == find(y);
	}
};

using T = tuple<int64, int64, int64>;

vector<int64> X;
vector<T> edge;
int32 N, M;

int main(void){
	cin >> N >> M;
	X.resize(N);
	edge.resize(M);
	REP(i, N) cin >> X[i];
	REP(i, M){
		int64 a, b, c;
		cin >> a >> b >> c; a--; b--;
		edge[i] = T(c, a, b);
	}
	sort(all(edge));
	UnionFind uf(N);
	uf.set_sz(X);
	REP(i, M){
		int64 u, v, c;
		tie(c, u, v) = edge[i];
		uf.unite(u, v);
		if (c <= uf.get_sum(u)){
			uf.make_ok(u);
		}
	}
	int64 res = 0;
	REP(i, N){
		if(uf.find(i) == i)
			res += uf.get_ok(i);
	}
	cout << M-res << endl;
}


Measured memory_bytes: 6528
import Data.List
main = do
  s <- getLine
  putStrLn $ if ((`mod`9) . sum . conv) s ==0 then "Yes" else "No"

conv [] = []
conv (x:xs) = (read' x) : conv xs

read' x
  |x=='0' = 0
  |x=='1' = 1
  |x=='2' = 2
  |x=='3' = 3
  |x=='4' = 4
  |x=='5' = 5
  |x=='6' = 6
  |x=='7' = 7
  |x=='8' = 8
  |x=='9' = 9

Measured memory_bytes: 11776
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let vertices: usize = sc.read();
    let edges: usize = sc.read();
    let mut graph = vec![vec![]; vertices];
    for _ in 0..edges {
        let a = sc.read::<usize>() - 1;
        let b = sc.read::<usize>() - 1;
        graph[a].push(b);
        graph[b].push(a);
    }

    let mut c = vec![0; vertices];
    c[0] = 1;
    if color(0, &graph, &mut c) {
        let one = c.iter().filter(|&&a| a == 1).count();
        let two = vertices - one;
        let total = one * two;
        println!("{}", total - edges);
    } else {
        let total = vertices * (vertices - 1) / 2;
        println!("{}", total - edges);
    }
}

fn color(v: usize, graph: &Vec<Vec<usize>>, c: &mut Vec<usize>) -> bool {
    for &next in graph[v].iter() {
        if c[next] == 0 {
            c[next] = if c[v] == 1 { 2 } else { 1 };
            if !color(next, graph, c) {
                return false;
            }
        } else if c[next] == c[v] {
            return false;
        }
    }
    true
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 12924
#include<iostream>
#include<vector>
#include<string>

const std::string MARCH = "MARCH";

int main(){
    int n;
    std::cin >> n;
    std::vector<std::vector<std::string>> list(6);
    for(int i = 0; i < n; i++){
        std::string input;
        std::cin >> input;
        for(int j = 0; j < MARCH.size(); j++){
            if(input[0] == MARCH[j]){
                list[j].push_back(input);
                break;
            }
        }
    }

    long long sum = 0;
    for(int i = 0; i < 6; i++){
        for(int j = i + 1; j < 6; j++){
            for(int k = j + 1; k < 6; k++){
                sum += list[i].size() * list[j].size() * list[k].size();
            }
        }
    }

    std::cout << sum << std::endl;

    return 0;
}


Measured memory_bytes: 5748
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
	typedef map<string , int> IM;
	IM CounterMap;
	string s;
	string maxLengthSt;
	string maxCountSt;
	int c = 0;
	while(cin >> s){
		IM::iterator it = CounterMap.find(s);
		if(it == CounterMap.end())	CounterMap[s] = 1;
		else{
			++it->second;
			if(it->second > c){
				maxCountSt = s;
				c = it->second;
			}
		}
		if(maxLengthSt.size() < s.size() )
			maxLengthSt= s;
	}
	cout << maxCountSt << " " << maxLengthSt << "\n";
	return 0;
}

Measured memory_bytes: 1188
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner tan = new Scanner(System.in);
        int a,b,c,d=0,e=0;
        a=tan.nextInt();
        b=tan.nextInt();
        c=tan.nextInt();
        d=a;
        a=b;
        b=d;
        d=a;
        a=c;
        c=d;
        System.out.println(a+" "+b+" "+c);
    }
   
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b) cout<<"a > b"<<endl;
	else if(a==b) cout<<"a == b"<<endl;
	else if(a<b) cout<<"a < b"<<endl;
	return 0;
}


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

const int N_MAX=100, M_MAX=100;
char p[N_MAX+1][M_MAX+1];

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if(a + b > c + d){
		cout << "Left" << endl;
	}else if(a + b < c + d){
		cout << "Right" << endl;
	}else{
		cout << "Balanced" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
import math
N=int(input())
S=[0]*100010
n=110000
count=0
isprime=[True]*(n+1)
isprime[0]=False
isprime[1]=False
for i in range(2,int(math.sqrt(n))+1):
    if isprime[i]==True:
        j=i+i
        while j<=n:
            isprime[j] =False
            j=j+i

for i in range(2,100010):
    if isprime[i]==True:
        if isprime[(i+1)//2]==True:
            count+=1
    
    S[i]=count
        
                
    

    
for k in range(N):
    l,r=map(int,input().split())
    
    print(S[r]-S[l-1])
    

Measured memory_bytes: 78632
#include<stdio.h>

int main(void)
{
 int S,h,m,s;
 scanf("%d",&S);


 h = S /3600;
 m = (S-3600*h)/60;
 s = S % 60; 

 printf("%d:%d:%d\n",h,m,s);
 return 0;
}

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



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


Measured memory_bytes: 256
// A - Day of Takahashi O(1)
#include <iostream>
using namespace std;

int main() {
    std::ios::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<(a<=b?a:a-1)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define fi first
#define se second
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int A,B,C,D,E,F;
    cin >> A >> B >> C >> D >> E >> F;
    int water = 0,sugar = 0,answ = 0,anss = 0;
    double sa = 0.0;
    for(int i = 0; 100*A*i < F;++i){
        for(int j = 0; (A*i+B*j)*100 < F;++j){
            water = (A*i+B*j)*100;
            if(water == 0) continue;
            for(int k = 0;(A*i+B*j)*100+C*k <= F;++k){
                int l = ((water/100)*E - C*k)/D;
                sugar = C*k+D*l;
                while(water + sugar > F){
                    l--;
                    sugar = C*k+D*l;
                }
                if(l < 0) break;
                if((water/100)*E - sugar < 0) continue;
                if((double)(sugar*100)/(water+sugar) >= sa){
                    answ = water;
                    anss = sugar;
                    sa = (double)(sugar*100)/(water+sugar);
                  //cout << (double)(sugar*100)/(water+sugar) << endl;
                }
            }
        }
    }
    cout << answ+anss << ' ' << anss << endl;
}


Measured memory_bytes: 256
#include <map>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
int a[5];
int main(){
	cin>>a[1]>>a[2]>>a[3];
	sort(a+1,a+4);
	int k;
	cin>>k;
	for(int i = 1; i <= k; i++) a[3] *= 2;
	cout<<a[1]+a[2]+a[3]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;
int main(){
  int n;
  cin >> n;
  if(n % 2 == 0){
    cout << 0.5 << endl;
  }else{
    int c = n/2;
    double a = n;
    double b = c;
    cout << 1-b/a << endl;
  }
}

Measured memory_bytes: 256
#include"iostream"
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<list>
#include<map>
#include<string>
#include<algorithm> 
#include <queue> 
#include <sstream>
#include <fstream>
#include<cmath>
#define INF 1000000000
#define LL long long
using namespace std;

vector<LL> v;

long long N, M, ans, A[100000],use[10],B;
string s;



int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		B = max(B, A[i]);
		ans += A[i];
	}
	ans = ans - (B / 2);
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <bits/stdc++.h>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

vector<ll> dp;

int main(){
  ll x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int flg = 1; 
  if((x1 < x2 && y1 > y2) || (x1 > x2 && y1 < y2))flg = -1; 
  int n;
  cin >> n;
  vector<P> fountain;
  for(int i = 0; i < n; ++i){
    ll x, y;
    cin >> x >> y;
    if(min(x1, x2) <= x && x <= max(x1, x2) && min(y1, y2) <= y && y <= max(y1, y2)){
      fountain.push_back(P(x, y * flg));
    }
  }

  sort(fountain.begin(), fountain.end());

  int fs = fountain.size();
  dp.assign(fs, LINF);
  for(int i = 0; i < fs; ++i){
    *lower_bound(dp.begin(), dp.end(), fountain[i].second) = fountain[i].second;
  }

  int cnt = lower_bound(dp.begin(), dp.end(), LINF) - dp.begin();
  double ans = abs(x2 - x1) + abs(y2 - y1);
  ans *= 100.0;
  ans -= (double)cnt * (20.0 - 5.0 * M_PI);
  if(cnt == min(abs(x2 - x1), abs(y2 - y1)) + 1)ans += 5.0 * M_PI; // 噴水を横切る場合
  printf("%.15f\n", ans);

  return 0;
}


Measured memory_bytes: 3440
/*
** author:mahmoud magdy
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

inline int D()
{
    int m ;
    cin>>m;
    return m ;
}
inline ll lD()
{
    ll m ;
    cin>>m;
    return m ;
}
inline double dD()
{
    double m;
    cin>>m;
    return m;
}
void fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
int main()
{
    fast();
    int n =D(),k=D();
      int ans=0;
      while(n>0){
        n/=k;
        ans++;
      }
      cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int r = sc.nextInt();
		
		// 計算
		int result = 3*r*r;

		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; 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);
	while (true) {
		int n; cin >> n;
		if (n == 0) break;
		int score[100];
		rep(i, n) {
			cin >> score[i];
		}
		sort(score, score + n);
		int sum = 0;
		rep(i, n - 2) {
			sum += score[i + 1];
		}
		cout << sum / (n - 2) << endl;
	}

    return 0;
}



Measured memory_bytes: 3000
#include <iostream>
#include <string>

using namespace std;

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


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

int main() {
  int cou;
  string w, ans;
  cin >> w;
  ans = "Yes";
  
  for(int i = 0; i < w.size(); i++){
    cou = 0;
    for(int j = 0; j < w.size(); j++){
      if(w.at(i) == w.at(j)){
        cou += 1;
      }
    }
    if(cou % 2 == 1){
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    N,=pin()
    v=lispin()
    V=[v_*2 for v_ in v]
    V.sort()
    ans=V[0]
    for i in range(1,N):
        ans=(ans+V[i])/2
    print(ans/2)

#%%submit!    
resolve()


Measured memory_bytes: 38384
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = 'APPROVED'
no = 'DENIED'

def main():
    n = ii()
    a = li()
    for i in range(n):
        flag = False
        if not a[i] %2:
            if not a[i] %3:
                flag = True
            if not a[i] %5:
                flag = True
        else:
            flag = True
        if not flag:
            print(no)
            exit()
    print(yes)
    
main()



Measured memory_bytes: 5076
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
  char b;
  cin >> b;
  switch(b) {
    case 'A': cout << 'T' << endl; break;
    case 'T': cout << 'A' << endl; break;
    case 'C': cout << 'G' << endl; break;
    case 'G': cout << 'C' << endl; break;
  }
}

Measured memory_bytes: 256
local n, m = io.read("*n", "*n")
local t = {}
local as, bs = {}, {}
for i = 1, n do t[i] = {} end
for i = 1, m do
  local a, b = io.read("*n", "*n")
  as[i], bs[i] = a, b
  t[a][b], t[b][a] = true, true
end

local function check(tbl)
  local reached = {true}
  for i = 2, n do reached[i] = false end
  local reachnum = 1
  local tasks = {1}
  local tasknum, done = 1, 0
  while done < tasknum do
    done = done + 1
    local idx = tasks[done]
    for k, v in pairs(tbl[idx]) do
      if v and not reached[k] then
        table.insert(tasks, k)
        reached[k] = true
        reachnum = reachnum + 1
        tasknum = tasknum + 1
      end
    end
  end
  return n == reachnum
end
local ret = 0
for i = 1, m do
  t[as[i]][bs[i]], t[bs[i]][as[i]] = false, false
  if not check(t) then ret = ret + 1 end
  t[as[i]][bs[i]], t[bs[i]][as[i]] = true, true
end
print(ret)


Measured memory_bytes: 376
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int a,b,c,d,e,k;
 int x,y,z,t,r,f,o,p,i,v;
 cin>>a>>b>>c>>d>>e>>k;
 x=b-a;
 y=c-a;
 z=d-a;
 t=e-a;
 r=c-b;
 f=d-b;
 o=e-b;
 p=d-c;
 i=e-c;
 v=e-d;
 if(x>k||y>k||z>k||t>k||r>k||f>k||o>k||p>k||i>k||v>k)
 {
     cout<<":(";
 }
 else
    cout<<"Yay!";


     return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int cake,donut,n,count;
    
    scanf("%d",&n);

    for(cake=0;cake<26;cake++){
        for(donut=0;donut<15;donut++){
            if(4*cake+7*donut==n){
                count++;
            };
        };
    };

    if(count==0){
        printf("No");
    }else{
        printf("Yes");
    };
    return 0;
}

Measured memory_bytes: 128
//C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

//ここまで毎回include
//以下プログラム

using namespace std;

int main() {
	int x, y;
	cin >> x >> y;
	int result = 0;
	if (0 <= x && 0 <= y) {
		if (x <= y) {
			result += y - x;
		}
		else {
			result++;
			result += (y * (-1)) - (x * (-1));
			if (y != 0) {
				result++;
			}
		}
	}
	else if (x < 0 && 0 <= y) {
		if (x * (-1) <= y) {
			result++;
			result += y - (x * (-1));
		}
		else {
			result += (y * (-1)) - x;
			if (y != 0) {
				result++;
		}
		}
	}
	else if (0 <= x && y < 0) {
		if (x * (-1) <= y) {
			result++;
			result += y - (x * (-1));
		}
		else {
			result += (y * (-1)) - x;
			if (y != 0) {
				result++;
			}
		}
	}
	else {
		if (x <= y) {
			result += y - x;
		}
		else {
			result++;
			result += (y * (-1)) - (x * (-1));
			if (y != 0) {
				result++;
			}
		}
	}
	cout << result << endl;
}

Measured memory_bytes: 256
n, k, q = gets.chomp.split(" ").map(&:to_i)
point = Array.new(n, 0)

q.times do
    a = gets.chomp.to_i
    point[a-1] += 1
end

n.times do |i|
    puts k-(q-point[i]) > 0 ? "Yes" : "No"
end

Measured memory_bytes: 3196
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    string S;
    cin >> S;

    ll hash[S.size() + 1];
    hash[0] = 0;
    REP(i, S.size()){
        hash[i] = hash[i - 1] + S[i - 1] * S[i - 1];
    }

    ll ans = (S.size() - 1) / 2;
    bool searching = true;
    while(searching && ans > 0){
        if(hash[ans] - hash[0] == hash[2 * ans] - hash[ans]){
            REP(i, ans){
                if(S[ans - i] != S[2 * ans - i]){
                    break;
                }
                if(i == ans){
                    searching = false;
                }
            }
        }
        if(searching){
            ans--;
        }
    }

    cout << ans * 2 << endl;

    return 0;
}

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

int main(){
  int A,B,C,max;
  vector<int> num;
  cin >>A>>B>>C;
  
  num.push_back(A);
  num.push_back(B);
  num.push_back(C);
  
  max=A;
  for(int i=0;i<3;i++){
    if(max<num[i]){
      max=num[i];
    }
  }
  cout << A+B+C+max*9;
}

Measured memory_bytes: 256
x, k, d = map(int, input().split())
x = abs(x)
if k % 2 == 0:
    y = x // (2*d)
    if 2*y >= k:
        print(abs(x - k*d))
    else:
        print(min(abs(x-y*2*d), abs(x-y*2*d-2*d)))
else:
    y = (x-d) // (2*d)
    if 2*y >= k-1:
        print(abs(x - k*d))
    else:
        print(min(abs(x-d-y*2*d), abs(x-3*d-y*2*d)))

Measured memory_bytes: 61744
loop{
a,op,b=gets.chomp.split(" ")

     a=a.to_i
     b=b.to_i 

     break if op=='?'
     c=a+b if op=='+'
     c=a-b if op=='-'
     c=a*b if op=='*'
     c=a/b if op=='/'
     puts c
 }


Measured memory_bytes: 6872
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

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

  lol a, i = 0, na;
  cin >> a;
  na = 100;
  while(na < a){
    i ++;
    na = na + na * 0.01;
  }
  cout << i << '\n';
  return 0;
}


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

int main(){
	int n;
	cin >> n;
	int x = 1;
	while(x*2<=n){
		x *= 2;
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define eb emplace_back
#define close std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c) (sort(c.begin(), c.end()), c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define CASET           \
    int ___T;           \
    scanf("%d", &___T); \
    for (int __CS = 1; __CS <= ___T; __CS++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count());
int rnd(int x) { return mrand() % x; }
LL bin(LL x, LL n, LL MOD)
{
    LL ret = MOD != 1;
    for (x %= MOD; n; n >>= 1, x = x * x % MOD)
        if (n & 1)
            ret = ret * x % MOD;
    return ret;
}
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
const int maxn = 1e6 + 10;
const int INF = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
ll mod = 1e9 + 7;
int w[maxn], e[maxn];
int main()
{
    int n;
    char s[maxn];
    cin >> n >> s + 1;
    int mn = INF;
    for (int i = 1; i <= n; i++)
    {
        if (s[i] == 'E')
            e[i] = e[i - 1] + 1, w[i] = w[i - 1];
        else
            w[i] = w[i - 1] + 1, e[i] = e[i - 1];
    }
    e[n + 1] = e[n];
    for (int i = 1; i <= n; i++)
    {
        //if(i == 1){mn = min(mn , )}
        mn = min(mn, w[i - 1] + e[n] - e[i]);
    }
    cout << mn << endl;
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<int, int> P;

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    REP(i, n) cin >> p[i];

    int min_ = INF;
    int ans = 0;

    REP(i, n) {
        if(min_ >= p[i]) ans++;
        min_ = min(min_, p[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int max(int x,int y)
{
	if(x>y) return x;
	else return y;
}
int gcd (int a,int b){
    while(b){
        int t=a%b;
        a=b;
        b=t;
    }
    return a;
}
int main()
{
	int sum=0;
	int n,a[10005],b[10005],c[100005];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	b[0]=a[0];
	for(int i=1;i<n;i++)
	{
		b[i]=gcd(b[i-1],a[i]);
	}
	c[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--)
	{
		c[i]=gcd(c[i+1],a[i]);
	}
	for(int i=1;i<n-1;i++)
	{
		sum=max(gcd(b[i-1],c[i+1]),sum);
	}
	cout<<max(sum,max(c[1],b[n-2]))<<endl;
}

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

int main() {
  int N,K;
  int ans = 0;

  cin >> N >> K;
  vector<int> vec(N);
  for(int i=0;i<N;++i){
    cin >> vec.at(i);
  }

  sort(vec.begin(),vec.end());
  for(int i=0;i<K;++i){
    ans += vec.at(i);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
package main

import (
	"fmt"
	"sort"
)

func nextInt() int {
	var x int
	fmt.Scan(&x)
	return x
}

func sum(L []int) (result int) {
	for _, v := range L {
		result += v
	}
	return result
}

func main() {
	n := nextInt()
	L := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&L[i])
	}

	sort.Ints(L)
	longest := L[len(L)-1]

	if longest < sum(L[:len(L)-1]) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int N = input();
    int T = input(), A = input();

    vector< int > H(N);
    cin >> H;

    double diff = inf;
    int ans = -1;
    for (int i = 0; i < N; ++i) {
        int h = H[i];
        if (chmin(diff, abs(A - (T - h * 0.006)))) {
            ans = i + 1;
        }
    }

    cout << ans << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}



int32_t main(){
  fastio;
  string s,t;
cin>>s;
cin>>t;
int ok=1;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i])ok=0;
  }
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n, a[212345], s[212345][25];

    memset(s, 0, sizeof(s));

    cin >> n;
    REP(i, n)
    cin >> a[i + 1];

    REP(i, n)
    {
        REP(j, 20)
        s[i + 1][j] = ((a[i + 1] & (1 << j)) > 0) + s[i][j];
    }

    ll res = 0;

    for (int i = 1; i <= n; i++)
    {
        int l = i;
        int r = n + 1;

        while (r - l > 1)
        {
            int mid = (r + l) / 2;

            bool check = true;

            REP(j, 20)
            {
                if (s[mid][j] - s[i - 1][j] > 1)
                    check = false;
            }

            if (check)
                l = mid;
            else
                r = mid;
        }

        res += l - i + 1;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 21888
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s,ss;
vector<int> v;

int main(void){
	fio();
	cin>>s>>ss;
	for(int i=0;i<(int)s.size();i++){
		if(s[i]!=ss[i])cev++;
	}
	cout<<cev<<endl;
	return 0;
}



Measured memory_bytes: 3812
import sys
sys.setrecursionlimit(10**9)

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()

cnt=1
while (a[0]%(2**cnt))==0:
    cnt+=1

cnt-=1
for item in a[1:]:
    if item%(2**cnt)!=0:
        print(0)
        exit()
    if (item//(2**cnt))%2==0:
        print(0)
        exit()


import fractions
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] //fractions.gcd(ans, a[i])

if ans%2==1:
    print(0)
    exit()

if ans//2>m:
    print(0)
    exit()

ans=ans//2

print((((m//ans)*(-1))//2)*(-1))





Measured memory_bytes: 84448
// Mon Aug 24 16:24:09 IST 2020        
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)       for(int ii = (int)a ; ii < (int)b  ; ii++ )
#define scan(any)          for(auto &i:any) cin>>i;
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define ff                 first
#define ss                 second
#define pppp               pair <int,int> 
#define flushOff           fflush(stdout) 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const double pi = 3.141592653589793238;
const int INF = 2e9+7; 
// const int N = 2e5+7;
struct compare{
    bool operator()(pair <int,int> A, pair <int,int> B){
        if(A.first == B.first)
            return A.second > B.second;
        return A.first > B.first;
    }
}; 
void print(vector <int>v){
    for(int t : v){
        cout << t << ' ';
    }
    cout << '\n';
} 
int tests(){
    int n;
    cin >> n;
    vector <int> v(n);
    for(auto &x : v)
        cin >> x;
    vector <int> res;
    forn(i,0,n)
        if(i+1 != v[i])
            res.push_back(i);
    if(res.size() == 2 || res.size() == 0)
        return cout << "YES",0;
    cout << "NO";
    return 0;
}    
int main(){
    I__O ;      
    int cases = 1 ;  
    // cin >> cases ;
    while(cases--)
        tests(); 
    return 0 ; 
}
 


Measured memory_bytes: 3660
x,n=map(int,input().split())
p=list(map(int,input().split()))

for i in range(n+1):
    count=0
    for j in range(n):
        if p[j]==x-i:
            count+=1
    if count==0:
        print(x-i)
        break
    count=0
    for j in range(n):
        if p[j]==x+i:
           count+=1
    if count==0:
        print(x+i)
        break
        


Measured memory_bytes: 9192
#include <cstdio>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

char s[19];

int main() {
  int n;
  scanf("%d", &n);
  map<string, int> cnt;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    sort(s, s + 10);
    ans += cnt[string(s)];
    ++cnt[string(s)];
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 11136
#include <iostream>
#include <string>
using namespace std;
typedef long long int ll;
int main(){
  string s;
  cin>>s;
  ll k;
  cin >>k;
  if(s[0]!='1') cout <<s[0]<<endl;
  else{
    for(ll i=0;i<k;i++){
    if(s[i]!='1') {
      cout <<s[i]<<endl;
      return 0;
    }
    }
    cout <<'1'<<endl;
 }
}


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

int main(void)
{
	int H, W;
	cin >> H >> W;

	vector<vector<int>> c(10, vector<int>(10));
	for(int i=0; i<10; i++)
		for(int j=0; j<10; j++)
			cin >> c[i][j];

	for(int i=0; i<10; i++)
		for(int j=0; j<10; j++)
			for(int k=0; k<10; k++)
				c[j][k] = min(c[j][k], c[j][i]+c[i][k]);

	int ret = 0;
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			int A;
			cin >> A;

			if(A == -1)
				continue;

			ret += c[A][1];
		}
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main ()
{
	int x,a,b;
	while (scanf("%d%d%d",&x,&a,&b)!=EOF)
	{
		if(abs(x-a)>abs(x-b)) printf("B\n");
	else printf("A\n");
	}
	
	
	return 0;
}

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

using namespace std;

vector<string> str = {"dream", "dreamer", "erase", "eraser"};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  reverse(S.begin(), S.end());
  for (int i = 0; i < str.size(); i++) {
    reverse(str[i].begin(), str[i].end());
  }
  bool flag = true;
  while (flag) {
    flag = false;
    for (int i = 0; i < str.size(); i++) {
      auto it = S.find(str[i]);
      if (it == 0) {
        S.erase(it, str[i].size());
        flag = true;
      }
    }
  }
  cout << (S.size() == 0 ? "YES" : "NO") << '\n';
  return 0;
}


Measured memory_bytes: 512
import sys

def visit(x, y, area):
    area[y][x] = 0
    move = [(-1, 0), (0, 1), (1, 0), (0, -1), (1, -1), (1, 1), (-1, 1), (-1, -1)]
    #print '(' + str(x) + ',' + str(y) + ')'

    for i in move:
        if 0 <= (x + i[0]) < w and  0 <= (y + i[1]) < h and area[y + i[1]][x + i[0]] == 1:
            visit(x + i[0], y + i[1], area)

def solve():
    area = []
    ans = 0
    for i in range(h):
        area.append(map(int, raw_input().split()))

    #print 'w: ' + str(w) + ',h: ' + str(h)

    for i in range(h):
        for j in range(w):
            if area[i][j] == 1:
                ans += 1
                visit(j, i, area)

    print ans

if __name__ == "__main__":
    sys.setrecursionlimit(100000)
    while True:
        w , h = 0, 0
        w, h = map(int, raw_input().split())

        if w == 0 and h == 0:
            break

        solve()

Measured memory_bytes: 8460