akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	int n,i,x,j,flag=0,cut=0,a;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x;
		a=sqrt(x);
		flag=0;
		for(j=a;j>1;j--){
			if(x%j==0){
				flag=1;
				break;
			}
		}
		if(flag==0)
			cut++;
	}
	cout<<cut<<endl;
	return 0;
}

Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i = 0;
        int ans = 0;
        String prev = "";
        while (i < s.length()) {
            String str;
            ans++;
            if (prev.length() == 1 && prev.equals(s.substring(i, i + 1))) {
                if (i + 2 > s.length()) {
                    ans--;
                    break;
                }
                str = s.substring(i, i + 2);
                i++;
            } else {
                str = s.substring(i, i + 1);
            }
            i++;
            prev = str;
        }
        System.out.println(ans);
    }

}



Measured memory_bytes: 39628
# 1 <= N <= 10**5
# N <= M <= 10**9
import sys
input = sys.stdin.buffer.readline
N, M = map(int, input().split())

V = M // N

ans = 1
for i in range(1, V + 1):
    if i * i > M:
        break
    if M % i == 0:
        j = M // i
        if j <= V:
            ans = max(ans, j)
        else:
            ans = max(ans, i)
print(ans)


Measured memory_bytes: 63060
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <algorithm>

using namespace std;
int main()
{
  string s ;
  cin >> s ;
  int Len = s.size();

  bool jd = true ;
  for(int i=0;i<(Len/2);i++){
          if(s[i]!=s[(Len-1-i)]){
              jd = false ;
              break;
          } 
  }
 
 bool jd2 = true ;
 if(jd){
  for(int i=0;i<((Len-1)/2);i++){
          if(s[i]!=s[((Len-1)/2)-1-i]){
              jd2 = false ;
              break;
          } 
  }
 }

 bool jd3 = true ;
 if(jd && jd2){
     for(int i=(((Len+3)/2)-1);i<Len;i++){
          if(s[i]!=s[(Len-1-i)]){
              jd3 = false ;
              break;
          } 
  }
}

 if(jd && jd2 && jd3)
   cout << "Yes" << endl;
 else
   cout << "No" << endl;
 
    return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
  n, err := SplitIntStdin(" ")
  if err != nil {
    fmt.Println(err)
  }

  ln := (n[0] + n[1]) * 2
  ar := n[0] * n[1]

  fmt.Printf("%d %d\n", ar, ln)
}

// ????????????1?????????
func StrStdin() (stringReturned string) {
  scanner := bufio.NewScanner(os.Stdin)

  scanner.Scan()
  stringInput := scanner.Text()

  stringReturned = strings.TrimSpace(stringInput)
  return
}

// ??´??°???1?????????
func IntStdin() (int, error) {
  stringInput := StrStdin()
  return strconv.Atoi(strings.TrimSpace(stringInput))
}

// ?????????????????????????????????????????????Split()
func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
  stringSplited := strings.Split(stringTargeted, delim)

  for _, str := range stringSplited {
    if str != "" {
      stringReturned = append(stringReturned, str)
    }
  }

  return
}

// ??????????????§??????????????????????????????????????????
func SplitStrStdin(delim string) (stringReturned []string) {
  // ???????????§1?????????
  stringInput := StrStdin()

  // ????????§??????
  // stringSplited := strings.Split(stringInput, delim)
  stringReturned = SplitWithoutEmpty(stringInput, delim)

  return
}

// ??????????????§??????????????´??°????????????????????????
func SplitIntStdin(delim string) (intSlices []int, err error) {
  // ??????????????????????????????
  stringSplited := SplitStrStdin(" ")

  // ??´??°?????????????????????
  for i := range stringSplited {
    var iparam int
    iparam, err = strconv.Atoi(stringSplited[i])
    if err != nil {
        return
    }
    intSlices = append(intSlices, iparam)
  }
  return
}

Measured memory_bytes: 1068
#include <set>
#include <array>
#include <iostream>

int main(){
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
    blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
      }
    }
    std::cout << num << " " << 8-(int)(blowing.size())-num << std::endl;
    blowing.clear();
  }
  return 0;
}

Measured memory_bytes: 3064
#include<cstdio>//https://vjudge.net/contest/215848#overview
#include<cmath>
#include<malloc.h>
#include<stdlib.h>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	int sx,sy,tx,ty;
	while(~scanf("%d %d %d %d",&sx,&sy,&tx,&ty))
	{
		int a,b,c,d,e,f,g,k;
		a=tx-sx;b=ty-sy;c=a+1;d=b+1;
		e=a;f=b;g=c;k=d;
		while(b--)
		{
			printf("U");
		}
		while(a--)
		{
			printf("R");
		}//第一次到达终点 
		while(f--)
		{
			printf("D");
		}
		while(e--)
		{
			printf("L");
		}//第一次回到起点 
		printf("L");
		while(d--)
		{
			printf("U");
		}
		while(c--)
		{
			printf("R");
		}
		printf("DR");//第二次到达终点 
		while(k--)
		{
			printf("D");
		}
		while(g--)
		{
			printf("L");
		}
		printf("U");//第二次回到起点 
		printf("\n");
	}
	return 0;
}

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

int main() {
	
	string S;
	cin>>S;
	
	if(S[0]==S[1]&&S[1]==S[2])
	{
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}
	
	
	
	
	
	
	return 0;
}

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

int main() {
    /*変数定義，入力*/
    string s;
    cin >> s;

    //ll A, B;cin >> A >> B;
    //vector<ll> a(N);  rep(i, N) cin >> a[i];
    
    /*演算*/
    switch(s[s.length()-1]){
        case '0': cout << "pon";
        break;
        case '1': cout << "pon";
        break;
        case '2': cout << "hon";
        break;
        case '3': cout << "bon";
        break;
        case '4': cout << "hon";
        break;
        case '5': cout << "hon";
        break;
        case '6': cout << "pon";
        break;
        case '7': cout << "hon";
        break;
        case '8': cout << "pon";
        break;
        case '9': cout << "hon";
        break;
    }
    cout << endl;
    /*出力*/
    //cout << "result" << endl;

    /*終了*/
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
	int w,h;
class tansa{
public:
	vector<pair<int,int> > childs;
	bool flag;
	bool built;
	int yoko;
	int tate;
	void set(int a,int b,int n);
};
void tansa::set(int a,int b,int n){
	tate = a;
	yoko = b;
	flag = false;
	built = true;
	if(n==0){
	if(tate%2==0){
		if(tate-1>=0){
			childs.push_back(make_pair(tate-1,yoko));
			if(yoko-1>=0)
				childs.push_back(make_pair(tate-1,yoko-1));
		}
		if(tate+1<=h+1){
			childs.push_back(make_pair(tate+1,yoko));
			if(yoko-1>=0)
				childs.push_back(make_pair(tate+1,yoko-1));
		}
		if(yoko-1>=0)
			childs.push_back(make_pair(tate,yoko-1));
		if(yoko+1<=w+1)
			childs.push_back(make_pair(tate,yoko+1));
	}else{
		if(tate-1>=0){
			childs.push_back(make_pair(tate-1,yoko));
			if(yoko+1<=w+1)
				childs.push_back(make_pair(tate-1,yoko+1));
		}
		if(tate+1<=h+1){
			childs.push_back(make_pair(tate+1,yoko));
			if(yoko+1<=w+1)
				childs.push_back(make_pair(tate+1,yoko+1));
		}
		if(yoko-1>=0)
			childs.push_back(make_pair(tate,yoko-1));
		if(yoko+1<=w+1)
			childs.push_back(make_pair(tate,yoko+1));
	}
	built = false;
	}
}
int main(){
	cin>>w>>h;
	tansa d[102][102];
	for(int g=1;g<=h;g++){
	for(int i=1;i<=w;i++){
		int n;
		cin>>n;
		d[g][i].set(g,i,n);
	}}
	for(int i=1;i<w+1;i++){
		d[0][i].set(0,i,0);
		d[h+1][i].set(h+1,i,0);
	}
	for(int g=0;g<h+2;g++){
		d[g][0].set(g,0,0);
		d[g][w+1].set(g,w+1,0);
	}
	int st=0;
	queue<pair<int,int> > q;
	q.push(make_pair(0,0));
	while(!q.empty()){
		pair<int,int> k = q.front();
		q.pop();
		vector<pair<int,int> > t = d[k.first][k.second].childs;
		for(int i=0;i<t.size();i++){
			if(d[t[i].first][t[i].second].built){
				st++;
			}else if(d[t[i].first][t[i].second].flag==false){
				d[t[i].first][t[i].second].flag=true;
				q.push(make_pair(t[i].first,t[i].second));
			}
		}
	}
	cout<<st<<endl;
}

Measured memory_bytes: 2304
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
const double pi = acos(-1) ;
signed main(){
    fastio
    int r ;
    cin >> r ;
    cout << fixed << setprecision(12) << r * pi * 2.0 << endl;
    return 0; 
}

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

const int INF = 1 << 28;

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	bool boin[256] = {false};
	boin['a'] = boin['i'] = boin['u'] = boin['e'] = boin['o'] = true;
	for(;;){
		int n = read();
		if(n == 0) break;
		vector<string> list;
		for(int i=0;i<n;++i){
			string atom;
			cin >> atom;
			stringstream ss;
			bool flag = false;
			for(int j = 0;j<atom.length();++j){
				if(j == 0 || flag){
					ss << atom[j];
				}
				flag = boin[atom[j]];
			}
			list.push_back(ss.str());
		}
		int max = 0;
		for(int i=0;i<n;++i){
			for(int j=0;j<n;++j){
			if(i==j) break;
			if(list[i] == list[j]){
				max = INF;
				continue;
			}
			bool flag = false;
			for(int k=0;k<min(list[i].length(),list[j].length());++k){
				if(list[i][k] != list[j][k]){
					max = std::max(max,k+1);
					flag = true;
					break;
				}
			}
				if(!flag){
					max = std::max(max,(int)min(list[i].length(),list[j].length())+1);
				}
			}
		}
		cout << (max == INF ? -1 : max) << endl;
	}
}

Measured memory_bytes: 3192
n,k=map(int,input().split())
A=list(map(int,input().split()))

cnt=0
a=0

if n==1:print(0)
else:
  for i in range(n-1):
    for j in range(i+1,n):
      if A[i]>A[j]:
        cnt+=1

  for i in range(n):
    for j in range(n):
      if A[i]>A[j]:
        a+=1

      
  print(int(cnt*k+a*(k*(k-1)//2))%(10**9+7))


Measured memory_bytes: 3188
#include <stdio.h>
int main(){
  long long int n,i,min,max,total=0;
  scanf("%lld",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
  }
  min=a[0];
  max=a[0];
  for(i=0;i<n;i++){
    if(min>a[i])min=a[i];
    if(max<a[i])max=a[i];
    total+=a[i];
  }
  printf("%lld %lld %lld\n",min,max,total);
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main()
{
    int H,W;
    while(1){
        scanf("%d %d",&H,&W);
        if (H+W==0) break;
        for (int i=0;i<H;i++){
            for (int j=0;j<W;j++){
                printf("#");
             }
             printf("\n");
        }
        printf("\n");
    }
    return 0;
}


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

int main() {
  vector<int> A(3);
  
  for (int i = 0; i < 3; i++) {
    cin >> A.at(i);
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  cout << A.at(0) * 10 + A.at(1) + A.at(2) << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

s=input().rstrip()
t=input().rstrip()
ans=""
for i in range(len(t)):
    ans+=s[i]
    ans+=t[i]
if len(s)>len(t):
    ans+=s[-1]
print(ans)

Measured memory_bytes: 3440
N = int(input().rstrip())
line = input().rstrip()
l = [int(v) for v in line.split()]
l.sort()
uniq_list = sorted(list(set(l)))
result = 0
start_at = 0
for i in range(len(uniq_list)):
    for j in range(start_at, len(l)):
        if uniq_list[i] == l[j]:
            if (N / 2) == j:
                result = uniq_list[i] - uniq_list[i - 1]
            else:
                start_at = j + 1
            
            break

print(result)

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

typedef long long ll;
typedef long long LL;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#ifdef DEBUG
    #define cek(x) cout<<x
#else
    #define cek(x) if(false){}
#endif // DEBUG

#define fi first
#define se second
#define INF 1000000000
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define PI acos(-1.0)
#define pb push_back
#define TC() while(tc--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORN(i,n) for(int i=0;i<=n;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define REPN(i,a,b) for(int i=a;i<=b;i++)
#define reset(a,b) memset(a,b,sizeof(a))
#define sc(x) scanf("%d",&x)

int main(void){
    #ifdef ccsnoopy
        freopen("D:/Code/in.txt","r",stdin);
    #endif

    int n;
    int x;
    int pos[200010];
    sc(n);
    FOR(i,n){
        sc(x);
        pos[x] = i+1;
    }

    set<int> smax, smin;
    ll tot = 0;
    REPN(i,1,n){
        int position = pos[i];
        set<int>::iterator it = smax.upper_bound(position);
        int poslo, poshi;
        if(it == smax.end()){
            poshi = n+1;
        }else{
            poshi = *it;
        }
        it = smin.upper_bound(-position);
        if(it == smin.end()){
            poslo = 0;
        }else{
            poslo = *it;
            poslo *= -1;
        }

        //cout << poslo << " " << poshi << endl;



        tot += 1LL * (abs(poshi-position)) * (abs(poslo-position)) * i;
        //cout << tot << endl;
        smax.insert(position);
        smin.insert(-position);
    }

    cout << tot;


    return 0;
}




Measured memory_bytes: 19712
#include<bits/stdc++.h> 
using namespace std; 
#define M 1e9+7
#define ll long long
#define lli long long int
#define I 10e5
 
int solve(vector<int> &v, int n)
{
   int dp[n];
   memset(dp, 0, sizeof(dp));
   dp[0] = 0;
   dp[1] = abs(v[0]-v[1]);
   for(int i=2;i<n;i++)
   {
      dp[i] = min(dp[i-1] + abs(v[i]-v[i-1]), dp[i-2] + abs(v[i]-v[i-2]));
   }
   return dp[n-1];
}
 

 
int main() 
{ 
   ios_base::sync_with_stdio(false);cin.tie(NULL); 
   
   #ifndef ONLINE_JUDGE 
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout); 
   #endif
   int n;
   cin>>n;
   vector<int> v(n);
   for(auto &i:v)
      cin>>i;
   cout<<solve(v, n);
   return 0;
}

Measured memory_bytes: 3932
#include <cstdio>
#include <vector>

using namespace std;

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

const int N_MAX = 8;
const int M_MAX = 30;

int N, M;
int a[M_MAX];
int b[M_MAX];
int S;
vector<int> G[N_MAX];

int dfs(int v, int s) {
  if (s == S) return 1;
  int ret = 0;
  REP(i, G[v].size()) {
    int u = G[v][i];
    if (s >> u & 1) continue;
    ret += dfs(u, s | 1 << u);
  }
  return ret;
}

void solve() {
  REP(i, M) {
    G[a[i] - 1].push_back(b[i] - 1);
    G[b[i] - 1].push_back(a[i] - 1);
  }
  S = (1 << N) - 1;
  printf("%d\n", dfs(0, 1));
}

void input() {
  scanf("%d%d", &N, &M);
  REP(i, M) scanf("%d%d", a + i, b + i);
}

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


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

#define rep(i,n) for (int i = 0; i < int(n); i++)
#define show(x) #x " = " << x

template <class T, size_t N, size_t M>
struct matrix {
    static matrix<T, N, N> one() {
        matrix<T, N, N> r;
        rep (i,N) r(i,i) = T::one();
        return r;
    }
    vector<vector<T>> a;
    matrix() : a(N, vector<T>(M)) { }
    int size1() const { return N; }
    int size2() const { return M; }
    T& operator()(int i, int j) { return a[i][j]; }
    T  operator()(int i, int j) const { return a[i][j]; }
    template <size_t K>
    matrix<T, N, K> operator*(matrix<T, M, K> const& rhs) {
        matrix<T, N, K> r;
        rep (i,N) rep (j,M) rep (k,K) {
            r(i,k) += a[i][j]*rhs(j,k);
        }
        return r;
    }
    template <size_t K>
    matrix<T, N, K>& operator*=(matrix<T, M, K> const& rhs) {
        return *this = operator*(rhs);
    }
};
    
struct bit {
    static bit one() { return 1; }
    int value;
    bit(int v = 0) : value(v) {}
    bit& operator+=(bit x) { value |= x.value; return *this; }
    bit& operator*=(bit x) { value &= x.value; return *this; }
    bit operator+(bit x) { return value | x.value; }
    bit operator*(bit x) { return value & x.value; }
};

template <class T>
T pow(T x, unsigned int n) {
    T r = T::one();
    while (n > 0) {
        if (n & 1) r *= x;
        x *= x;
        n >>= 1;
    }
    return r;
}    

int main() {
    int N, M, Z;
    int s[100], d[100];
    while (cin >> N >> M >> Z && N > 0) {
        rep (i,M) {
            cin >> s[i] >> d[i];            
            if (s[i] > d[i]) swap(s[i], d[i]);
            s[M+i] = d[i];
            d[M+i] = s[i];
        }

        matrix<bit,   1, 100> v;
        matrix<bit, 100, 100> A;
        matrix<bit, 100,   1> u;
        rep (i,2*M) {
            if (s[i] == 1) u(i,0) = 1;
            if (d[i] == N) v(0,i) = 1;
        }
        rep (i,2*M) rep (j,2*M) {
            if (d[i] == s[j] && s[i] != d[j]) A(j,i) = 1;
        }

   // rep (i,2*M) cout << v(0,i).value << " "; cout << endl;
   // rep (i,2*M) { rep (j,2*M) cout << A(i,j).value << " "; cout << endl; }
   // rep (i,2*M) { cout << u(i,0).value << " "; cout << endl; }

        auto r = v*pow(A,Z-1)*u;
        cout << (r(0,0).value > 0 ? "yes" : "no") << endl;
    }
}

Measured memory_bytes: 1372
#include <iostream>

using namespace std;

int main()
{

    string s;
    cin >> s;
    if(s[0] == 'A')
    {
        int C = 0;
        for(int i=2; i<s.size()-1; i++)
        {
            if(s[i] == 'C')
            {
                C++;
            }
        }
        if(C == 1)
        {
            int upper = 0;
            for(int i=1; i<s.size(); i++)
            {
                if(isupper(s[i]))
                {
                    upper++;
                }
            }
            if(upper == 1)
            {
                cout << "AC";
            }
            else
            {
                cout << "WA";
            }
        }
        else
        {
            cout << "WA";
        }
    }
    else
    {
        cout << "WA";
    }
    return 0;

}


Measured memory_bytes: 256
#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 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=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	double r;
	cin>>r;
	cout<<setprecision(10)<<2*PI*r<<endl;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int k, q;
  cin >> k >> q;
  vector<int> _d(k);
  for (auto&& e : _d) {
    cin >> e;
  }
  while (q--) {
    long long n, x, m;
    cin >> n >> x >> m;
    --n;
    auto _n = n;
    x %= m;
    vector<long long> d(k);
    for (int i = 0; i < k; ++i) {
      d[i] = _d[i] % m;
      if (d[i] == 0) {
        d[i] = m;
      }
    }
    x += (n / k) * accumulate(begin(d), end(d), 0LL);
    n %= k;
    while (n--) {
      x += d[n];
    }
    cout << _n - x / m << '\n';
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h> 
#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 REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
#define asn ans
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	int a, b; CI a >> b;
	if (a % 500 <= b) CO "Yes" EN;
	else CO "No" EN;
}

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

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
#define ld long double
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
const int N = 1e3 + 100;
int T;
char str[N][N];
int ans[N][N], vis[N][N], n, m, sx, sy, ex, ey;
int dir[4][2] = {1,
                 0,
                 -1,
                 0,
                 0,
                 1,
                 0,
                 -1};
struct node {
    int x, y, step;
};
deque<node> q;

int main() {
    scanf("%d%d%d%d%d%d", &n, &m, &sx, &sy, &ex, &ey);
    for (int i = 1; i <= n; i++)scanf("%s", str[i] + 1);
    for (int i = 1; i <= n; i++)for (int j = 1; j <= m; j++)ans[i][j] = -1;
//    node a;
//    a.x = sx, a.y = sy, a.step = 0;
    q.push_back(node{sx, sy, 0});
    while (!q.empty()) {
        node now = q.front();
        q.pop_front();
        int x = now.x, y = now.y, st = now.step;
        if (vis[x][y])continue;
        vis[x][y] = 1;
        ans[x][y] = st;
        for (int i = 0; i < 4; i++) {
            int xx = x + dir[i][0], yy = y + dir[i][1];
            if (xx > 0 && xx <= n && yy > 0 && yy <= m && !vis[xx][yy] && str[xx][yy] == '.') {
                q.push_front(node{xx, yy, st});
            }

        }
        for (int xx = x - 2; xx <= x + 2; xx++)
            for (int yy = y - 2; yy <= y + 2; yy++) {
                if (xx > 0 && xx <= n && yy > 0 && yy <= m && !vis[xx][yy] && str[xx][yy] == '.')
                    q.push_back((node) {xx, yy, st + 1});
            }
    }
    if (ans[ex][ey] < 0)puts("-1");
    else printf("%d\n", ans[ex][ey]);
    return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
  int n;
  cin >> n;
  int a = n / 111;
  if(n%111!=0)a++;
  cout << a * 111 << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: Vec<char> = iterator.next().unwrap().chars().collect();

    if s[2] == s[3] && s[4] == s[5] {
        return "Yes".to_string();
    }

    return "No".to_string();
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <set>

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int min = 0;
    int e = 0, w = 0;
    for (int i = 1; i < n; i++) {
        if (s[i] == 'E')
            e++;
    }
    min = e;
    for (int i = 1; i < n; i++) {
        if (s[i - 1] == 'W')
            w++;
        if (s[i] == 'E')
            e--;
        if (e + w < min)
            min = e + w;
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 900
n, m = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]

x.sort()

dist = [0] * (m-1)
for i in range(m-1):
    dist[i] = x[i+1] - x[i]
dist.sort(reverse=True)

if m <= n:
    print(0)
else:
    length = x[m-1]-x[0]
    for i in range(n-1):
        length -= dist[i]
    print(length)

Measured memory_bytes: 13840
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int N,M;
	const int INF=(1<<28);
	while(cin >> N >> M, (N|M)){
		int c[M];
		for(int i=0; i<M; ++i)	cin >> c[i];
		int x[N];
		for(int i=0; i<N; ++i)	cin >> x[i];
		vector<vector<int> > dp(N+1, vector<int>(256, INF));
		dp[0][128]=0;
		for(int i=0; i<N; ++i)for(int j=0; j<=255; ++j)for(int k=0; k<M; ++k){
			int next=max(0,min(255, j+c[k]));
			dp[i+1][next]=min(dp[i+1][next], dp[i][j]+((x[i]-next)*(x[i]-next)));
		}
		int ans=INF;
		for(int i=0; i<=255; ++i)	ans=min(ans, dp[N][i]);
		cout << ans << endl;
	}
}

Measured memory_bytes: 22000
N=input()
a=list(map(int,input().split()))
i=0
count=-1
b=[]
c=True
while c:
    i=0
    count+=1
    while i<int(N):
        if a[i]%2!=0:
            c=False
            break
        else:
            a[i]=a[i]/2
            i+=1
print(int(count))


Measured memory_bytes: 39792
mod = 998244353
rng = 4100
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
  finv.append(pow(fctr[i],mod-2,mod))
def cmb(n,k):
  if n<0 or k<0:
    return 0
  else:
    return fctr[n]*finv[n-k]*finv[k]%mod
def homo(n,k):
  if n<0 or k<=0:
    return 0
  else:
    return cmb(n+k-1,k-1)
k,n = map(int,input().split())
if k%2 == 0:
  flg = 0
else:
  flg = 1
ans = []
for i in range(3,k+2,2):
  ic = (i-1)//2
  anstmp = 0
  for j in range(ic+1):
    t = homo(n-j,(k-ic*2+j))*cmb(ic,j)*pow(2,j,mod)
    anstmp = (anstmp+t)%mod
  ans.append(anstmp)
  ans.append(anstmp)
if flg:
  anstmp = 0
  for j in range(1,k//2+1):
    t = (homo(n-j,j)+homo(n-j-1,j))*cmb(k//2,j)*pow(2,j,mod)
    anstmp = (anstmp+t)%mod
  ans.append(anstmp)
ans2 = ans[:-1]
ans2 = ans2[::-1]
print(*ans,sep="\n")
print(*ans2,sep="\n")

Measured memory_bytes: 46684
#include <cstdio>
#include <algorithm>

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

int N, K;

int main() {
  scanf("%d %d\n", &N, &K);
  if (N % 2 == 0) {
    if (K <= N / 2) printf("YES\n");
    else printf("NO\n");
  } else {
    if (K <= N / 2 + 1) printf("YES\n");
    else printf("NO\n");
  }

  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace C___Tax_Increase
{
    class Program
    {
        static void Main(string[] args)
        {
            var A_B = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = A_B[0], B = A_B[1];

            for (int i = 10; i <= 1250; i++)
            {
                if ((int)(i * 0.08) == A && (int)(i * 0.10) == B)
                {
                    Console.WriteLine(i);
                    return;
                }
            }

            Console.WriteLine(-1);
        }
    }
}


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

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

const ll maxn=100003;

ll pos,n,T,E,x[maxn],mn=0x3f3f3f3f3f3f3f3f,f[maxn];

int main(){
	scanf("%lld%lld%lld",&n,&E,&T);
	for(ll i=1;i<=n;++i){
		scanf("%d",&x[i]);
		while(pos<i&&2*(x[i]-x[pos+1])>T){
			mn=min(mn,f[pos]-2*x[pos+1]);
			++pos;
		}
//		printf("%lld %lld !\n",pos,f[pos]+T);
		f[i]=min(mn+2*x[i],f[pos]+T);
	}
	printf("%lld\n",f[n]+E);
	return 0;
}



Measured memory_bytes: 1792
#include <vector>
#include <algorithm>
#include <iostream>

typedef unsigned long long ULL;

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

ULL GCD(std::vector<ULL> &a) 
{ 
    ULL result = a[0]; 
    for (ULL i = 1; i < a.size(); i++)
        result = gcd(a[i], result); 
  
    return result; 
} 

int main()
{
    ULL N;
    std::cin >> N;
    std::vector<ULL> Monsters(N);
    for(ULL i = 0;i < Monsters.size();i++)
        std::cin >> Monsters[i];
    if(N == 2 && Monsters[0] > Monsters[1])
        std::swap(Monsters[0], Monsters[1]);
    else
        std::sort(Monsters.begin(), Monsters.end());
    std::cout << GCD(Monsters) << std::endl;
  	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

void trace(int A[],int N){
    int i;
    for(i = 0;i < N;i++){
        if(i > 0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

void insertionSort(int A[],int N){
    int j, i, v;
    for(i = 1;i < N;i++){
        v = A[i];
        j = i -1;
        while(j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A,N);
    }
}

int main(){
    int N, i, j;
    int A[100];

    scanf("%d",&N);
    for(i = 0;i < N;i++) scanf("%d",&A[i]);
    trace(A,N);
    insertionSort(A,N);

    return 0;
}


Measured memory_bytes: 2728
N, K = map(int, input().split())
A = list(map(int, input().split()))

visited = [0 for _ in range(N)]
first_visit = [0 for _ in range(N)]

now = 0
flag = True
for i in range(10 ** 5 * 5):
    if first_visit[now] == 0:
        first_visit[now] = i

    visited[A[now] - 1] += 1
    now = A[now] - 1

    if i == K - 1:
        print(now + 1)
        flag = False
        break

if flag:
    num = 0
    for i in range(N):
        if visited[i] > 2:
            num += 1

    for i in range(N):
        if visited[i] >= 2:
            if K % num == first_visit[i] % num:
                print(i + 1)
                break


Measured memory_bytes: 32372
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

vector<int> sieve(int n) {
	vector<int> res;
	vector<bool> is_prime(n + 1, true);
	
	is_prime[0] = is_prime[1] = false;
	
	for (ll i = 2; i * i <= n; i++) if (is_prime[i]) {
		res.push_back(i);
		for (ll j = 1; i * j <= n; j++) is_prime[i * j] = false;
	}
	
	REP(i, n + 1) if (is_prime[i]) res.push_back(i);
	sort(res.begin(), res.end());
	return res;
}

int main() {
	int X;
	cin >> X;
	vector<int> prime = sieve(212345);
	
	REP(i, prime.size()) {
		if (prime[i] >= X) {
			cout << prime[i] << endl;
			return 0;
		}
	}
	
	return 0;
}


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

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
    int n, m;
    string a[51], b[51];
    cin >> n >> m;

    REP(i, n) {
        cin >> a[i];
    }

    REP(i, m) {
        cin >> b[i];
    }

    for (int i = 0; i < n - m + 1; i++) {
        for (int j = 0; j < n - m + 1; j++) {
            bool ans = true;
            // i, j がスタートポイント
            for (int ii = i; ii < i + m; ii++) {
                for (int jj = j; jj < j + m; jj++) {
                    if (a[ii][jj] != b[ii - i][jj - j]) {
                        ans = false;
                        break;
                    }
                }
                if (!ans) {
                    break;
                }
            }
            if (ans) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;


int main() {
	int N, M, X, C[12], A[12][12];
	int ans = 10000000;
	cin >> N >> M >> X;
	for (int i = 0; i < N; i++) {
		cin >> C[i]; 
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
		}
	}

	for (int i = 0; i < (1 << N); i++) {
		int buy[12];
		int pt[12];
		int cost = 0;
		for (int j = 0; j < M; j++) {
			pt[j] = 0;
		}
		for (int j = 0; j < N; j++) {
			if ((i >> j) % 2 == 1) {
				for (int k = 0; k < M; k++) {
					pt[k] += A[j][k];
				}
				cost += C[j];
			}
		}
		bool ok = true;
		for (int j = 0; j < M; j++) {
			if (pt[j] < X) {
				ok = false;
			}
		}
		if (ok) {
			if (ans > cost) { ans = cost; }
		}
	}
	if (ans == 10000000) {
		cout << "-1";
	}
	else {
		cout << ans;
	}


}

Measured memory_bytes: 3632
#include<iostream>
#include<map>
#include<algorithm>
#include<cstring>
using namespace std;
string a;
bool judge(string s)
{
	int len=s.length();
	for(int i=0;i<len/2;i++)
	{
		if(s[i]!=s[len-1-i])
		  return false;
	}
	return true;
}
int main()
{
	int s;
	cin>>a;
	s=a.size();
		string c=a.substr(0,(s-1)/2);
		string d=a.substr((s+3)/2-1);
		//cout<<c<<endl;
		//cout<<d<<endl;
		if(judge(c)&&judge(d)&&c==d)
		  cout<<"Yes"<<endl;
		else
		  cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>

using namespace std;

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

    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int b[n];
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }

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

    int ai, bi;
    int x = 0;
    do {
        bool f = true;
        for (int i = 0; i < n; i++) {
            if (p[i] != a[i]) {
                f = false;
            }
        }
        if (f) {
            ai = x;
        }

        f = true;
        for (int i = 0; i < n; i++) {
            if (p[i] != b[i]) {
                f = false;
            }
        }
        if (f) {
            bi = x;
        }

        x++;
    } while (next_permutation(p, p+n));

    cout << abs(ai - bi) << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class ALDS1
{

    struct X
    {
        public string c;
        public int d;
    };

    static void Main()
    {
        int a = int.Parse(Console.ReadLine().Split(' ')[0]);
        int[] x = new int[a];
        int d = 0, f, g, h;
        for (int i = 0; i < a; i++)
        {
            string str1 = Console.ReadLine();
            string str2 = str1.Split(' ')[0];
            if (str2[0] == 'i')
            {
                int b = int.Parse(str1.Split(' ')[1]);
                x[i] = b;
            }
            else if (str2 == "deleteFirst")
            {
                i -= 2; a -= 2;
            }
            else if (str2 == "deleteLast")
            {
                i--; a--; d++;
            }
            else
            {
                int b = int.Parse(str1.Split(' ')[1]);
                i--; a--;
                f = 0;
                for (int j = i; j >= 0; j--)
                {
                    if (f > 0) break;
                    if (b == x[j])
                    {
                        g = i - j;
                        h = 0;
                        f++;
                        while (g != h++) x[j + h - 1] = x[j + 1 + h - 1];
                        i--; a--;
                    }
                }
            }
        }
        for (int i = 0; i < a - d; i++)
        {
            if (i == a - d - 1) Console.WriteLine(x[a - 1 - i]);
            else Console.Write(x[a - 1 - i] + " ");
        }
    }
}
               

Measured memory_bytes: 20000
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n),b(n),c(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  for(Int i=0;i<n;i++) cin>>b[i];
  for(Int i=0;i<n;i++) cin>>c[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  Int ans=0;
  vector<Int> t(n+1,0);
  for(Int i=0;i<n;i++)
    t[i]=c.end()-upper_bound(c.begin(),c.end(),b[i]);
  for(Int i=n;i>0;i--) t[i-1]+=t[i];
  for(Int i=0;i<n;i++){
    Int x=upper_bound(b.begin(),b.end(),a[i])-b.begin();
    ans+=t[x];
  }
  cout<<ans<<endl;
  return 0;
}


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

bool binarySearch(int a[], int n, int key){
    int l, r, m;
    l = 0; r = n;
    while(l < r){
        m = (l + r) / 2;
        if(a[m] == key) return true;
        else if(a[m] > key){
            r = m;
        } else {
            l = m + 1;
        }
    }
    return false;
}

int main(){
    int N; cin >> N;
    int a[N];
    for(int i = 0; i < N; i++) cin >> a[i];
    int q; cin >> q;
    int ans = 0;
    for(int i = 0; i < q; i++){
        int tmp; cin >> tmp;
        if(binarySearch(a, N, tmp)) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3464
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    double n; cin>>n;
    double a=n/3;
    a=a*a*a;
    cout<<fixed<<setprecision(10)<<a;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        int D = scan.nextInt();
        int answer = Math.max(A*B, C*D);
        System.out.println(answer);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


#define N 100005
class uf{
  private:
    int par[N]={},r[N]={},size[N]={};
  
  public:
    uf(int n){
      int i;
      for (i=0;i<n;i++){
        par[i]=i;
        size[i]=1;
      }
    }
    
    int root(int a){
      if (par[a]==a) return a;
      return par[a]=root(par[a]);
    }
    
    void unite(int a,int b){
      a=root(a);
      b=root(b);
      if (a==b) return;
      if (r[a]>r[b]){
        par[b]=a;
        r[a]++;
        size[a]+=size[b];
      }else{
        par[a]=b;
        r[b]++;
        size[b]+=size[a];
      }
    }
    
    int show_size(int a){
      return size[root(a)];
    }
    
    int group(int n){
      int i,t,res=0;
      bool u[N]={false};
      for (i=0;i<n;i++){
        t=root(i);
        if (!u[t]){
          res++;
          u[t]=true;
        }
      }
      return res;
    }
    
};


int main(void){
  int n,m,i,a,b;
  
  cin >> n >> m;
  
  uf is(n);
  
  for (i=0;i<m;i++){
    cin >> a >> b;
    is.unite(a-1,b-1);
  }
  
  ll t0,t1,k;
  t0=is.show_size(0);
  t1=is.show_size(1);
  
  if (t0<t1) swap(t0,t1);
  
  t0=n-t1;
  k=t0*(t0-1)/2+t1*(t1-1)/2;
  
  cout << k-m << endl;
  
  return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main(void)
{
	int numArr[201];
	int tmp;
	int num;
	int cnt = 0;
	int i;

	tmp = scanf("%d", &num);
	for(i=0; i<num; i++)
	{
		tmp = scanf("%d", numArr + i);
	}

	tmp = 0;
	for(i=0; i<num; i++)
	{
		tmp |= (*(numArr + i));
	}
	while(1)
	{
		if(tmp & 0x1)
		{
			break;
		}
		cnt++;
		tmp >>= 1;
	}
	printf("%d", cnt);

	return(0);
}

Measured memory_bytes: 128
package main

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

func binSearch(L []int, v int, start int, include bool) int {
	if L[start] >= v {
		return -1
	}

	l := start
	r := len(L)
	for r-l > 1 {
		c := (r + l) / 2
		if L[c] < v {
			l = c
		} else if L[c] > v {
			r = c
		} else {
			if include {
				return c
			} else {
				r = c
			}
		}
	}
	return l
}
func main() {
	sc := NewScanner()
	N, L := sc.NextInt(), sc.NextIntArray()

	sort.Ints(L)

	count := 0
	//fmt.Printf("%+v\n", L)
	for i := 0; i < N-1; i++ {
		for j := i + 1; j < N-1; j++ {
			r := binSearch(L, L[j]+L[i], j+1, false)
			if r == -1 {
				continue
			}

			count += r - j
			//fmt.Println(r, i, j)
		}
	}
	fmt.Println(count)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
const int maxn = 2000 + 10;
int n, a[3 * maxn];
int f[maxn][maxn], g[maxn], Max, delta;
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= 3 * n; ++i) scanf("%d", &a[i]);
	for(int i = 1; i <= n; ++i) for(int j = 1; j <= n; ++j) f[i][j] = f[j][i] = -INF;
	f[a[1]][a[2]] = f[a[2]][a[1]] = 0;
	for(int i = 1; i <= n; ++i) g[i] = -INF;
	g[a[1]] = g[a[2]] = 0;
	for(int i = 3; i < 3 * n; i += 3)
	{
		vector<piii> m;
		for(int j = 0; j < 8; ++j)
		{
			vector<int> b, c;
			for(int k = 0; k < 3; ++k)
			{
				if(j & (1 << k))
					b.push_back(a[i + k]);
				else
					c.push_back(a[i + k]);
			}
			if(b.size() == 0 && c[0] == c[1] && c[1] == c[2]) 
			{
				++delta;
				break;
			}
			else if(b.size() == 1)
			{
				if(c[0] == c[1]) for(int k = 1; k <= n; ++k) m.push_back(mp(mp(b[0], k), f[c[0]][k] + 1));
				for(int k = 1; k <= n; ++k) m.push_back(mp(mp(b[0], k), g[k]));
			}
			else if(b.size() == 2)
			{
				m.push_back(mp(mp(b[0], b[1]), f[c[0]][c[0]] + 1));
				m.push_back(mp(mp(b[0], b[1]), Max));
			}
		}
		for(auto v : m)
		{
			int x = v.first.first, y = v.first.second, val = v.second;
			f[x][y] = f[y][x] = max(f[x][y], val);
			g[x] = max(g[x], val);
			g[y] = max(g[y], val);
			Max = max(Max, val); 
		}
	}
	int ans = 0;
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= n; ++j)
			ans = max(ans, f[i][j] + delta);
	ans = max(ans, f[a[3 * n]][a[3 * n]] + delta + 1);
	cout << ans << endl;
	return 0;
}
	

Measured memory_bytes: 19504