akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE UndecidableInstances #-}

module Main where

import Control.Category hiding (id, (.))
import Control.Exception (assert)
import Control.Monad
import Control.Monad.ST
import Control.Monad.State.Strict
import qualified Data.ByteString.Char8 as BS
import Data.List as List
import Data.Maybe
import Data.Set as Set
import qualified Data.Vector.Unboxing as U
import qualified Data.Vector.Unboxing.Mutable as UM
import Debug.Trace
import GHC.Generics

readInt = fst . fromJust . BS.readInt

readIntList = Prelude.map readInt . BS.words

getInt = readInt <$> BS.getLine

getIntList = readIntList <$> BS.getLine

range begin end = [begin .. (end - 1)]

partitionIdx vec pred =
  assert (U.length vec >= 0) $
    if pred (vec U.! 0) == False
      then 0
      else loop 0 (U.length vec)
  where
    loop begin end =
      if end == begin + 1
        then end
        else
          let !mid = (begin + end) `div` 2
           in if pred (vec U.! mid) then loop mid end else loop begin mid

-- data Point = Pt {-# UNPACK #-} Int {-# UNPACK #-} Int
--   deriving (Generic)
--   deriving (U.Unboxable) via U.Generics Point

-- ptX :: Point -> Int
-- ptX (Pt x y) = x

-- ptY :: Point -> Int
-- ptY (Pt x y) = y

main :: IO ()
main = do
  n <- getInt
  as <- fmap U.fromList getIntList
  let cntTable = runST $ do
        ans <- UM.replicate (U.maximum as + 1) (0 :: Int)
        forM_ (range 0 n) $ \i -> do
          let val = as U.! i
          UM.modify ans (+ 1) val
        U.freeze ans
      evenCnt = U.foldl' (\a b -> a + if b > 0 && b `mod` 2 == 0 then 1 else 0) 0 cntTable
      oddCnt = U.foldl' (\a b -> a + if b `mod` 2 == 1 then 1 else 0) 0 cntTable
  print $ oddCnt + (evenCnt `div` 2) * 2

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

int main() {
  int A,B,C;
  cin>>A>>B>>C;
  vector<int> vec ={A,B,C};
  vector<int> vec2 ={5,5,7};
  sort(vec.begin(),vec.end());
  if(vec == vec2)
    cout << "YES" <<endl;
  else cout << "NO" <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
int main(){
	string S;
	cin >> S;
	vector<char> alphabets{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
	for(int i = 0; i < S.size(); i++){
		for(int j = 0; j < alphabets.size(); j++){
			if(S[i] == alphabets[j]){
				alphabets.erase(alphabets.begin() + j);
			}
		}
	}
	if(!alphabets.size()){
		cout << "None" << endl;
	}else{
		cout << alphabets[0] << endl;
	}
}

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

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

using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, pre, result = 0, tmp = 0;
	cin >> n;
	cin >> pre;
	for (int i = 0;i < n -1 ; i++ ){
		int pos;
		cin >> pos;
		if (pos > pre) {
		  if (tmp > result) {
			  result = tmp;
		  }
		  tmp = 0;
		} else {
		  tmp++;
		}
		pre = pos;
	}
	if (tmp > result) {
	  result = tmp;
	} 
	cout << result << endl;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());
		ArrayList<String> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		sc.close();
		for(int i = 0; i < N; i++) {
			System.out.print(list.get(i));
		}
	}

}


Measured memory_bytes: 21716
#include <stdio.h>

int main(){
   char a[200000];
   int sum=0;
   int i=0;
   gets(a);
   while(a[i]!=NULL)
   {
     sum=sum+a[i]-48;
     i++;
   }
  if(sum%9==0) printf("Yes");
  else printf("No");
}

Measured memory_bytes: 1796
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
n =  int(sys.stdin.readline())
b =  list(map(int, sys.stdin.readline().split()))

a = [0]*n
a[0]=b[0]

for i in range(1,n):
    if i !=n-1:
        a[i] = min(b[i],b[i-1])
    else:
        a[i] = b[i-1]
print(sum(a))


Measured memory_bytes: 5304
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = sc.nextInt();
        int A = sc.nextInt();
        double minDiff = 1000000;
        int minH = 0;
        for(int i = 0; i < N; i++){
            double diff = Math.abs(A - (T - sc.nextInt() * 0.006)) ;
            if(diff < minDiff) {
                minH = i;
                minDiff = diff;
            }
        }
        sc.close();

        System.out.println(minH + 1);
    }

}

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif

const int N = 105;
int  n , ara[N];
int main()
{
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin >> n;
    FOR(i,1,n)cin >> ara[i];
    sort(ara + 1,ara + n + 1);
    int cnt = 0;
    for(int i = 1;i <= n;i++){
        for(int j = i + 1;j <= n;j++){
            for(int k = j + 1;k <= n;k++){
                if(ara[i] == ara[j] || ara[i] == ara[k] || ara[j] == ara[k])continue;
                if(ara[i] + ara[j] > ara[k]){
                    cnt++;
                }
            }
        }
    }
    cout << cnt << "\n";
    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


Measured memory_bytes: 3636
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();

        char data[][] = new char[100][100];
        for (int i = 0; i < 100; i++) {
            for (int j = 0; j < 100; j++) {
                data[i][j] = (i / 50 == 0 ? '#' : '.');
            }
        }

        for (int i = 0; i < a - 1; i++) {
            data[2 * (i / 50)][2 * (i % 50)] = '.';
        }
        for (int i = 0; i < b - 1; i++) {
            data[2 * (i / 50) + 51][2 * (i % 50)] = '#';
        }

        System.out.println("100 100");
        for (int i = 0; i < 100; i++) {
            System.out.println(new String(data[i]));
        }
    }

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


Measured memory_bytes: 23124
#include <stdio.h>
#include <math.h>

void renritsu(double x[],double y[],double p[]){
	double A,B,C,D,E,F;
	A=2*(x[1]-x[0]);
	B=2*(y[1]-y[0]);
	C=x[1]*x[1]-x[0]*x[0]+y[1]*y[1]-y[0]*y[0];
	D=2*(x[0]-x[2]);
	E=2*(y[0]-y[2]);
	F=x[0]*x[0]-x[2]*x[2]+y[0]*y[0]-y[2]*y[2];
	p[0]=(C*E-B*F)/(A*E-D*B);
	p[1]=(C*D-A*F)/(B*D-A*E);
}

int main(){
	double x[3],y[3],p[2],r;
	int i,j,n;
	scanf("%d",&n);
	for(j=0; j<n; j++){
		for(i=0; i<3; i++)scanf("%lf %lf",&x[i],&y[i]);
		renritsu(x,y,p);
		r=sqrt((p[0]-x[0])*(p[0]-x[0])+(p[1]-y[0])*(p[1]-y[0]));
		printf("%.3lf %.3lf %.3lf\n",p[0],p[1],r);
	}
	return 0;
}

Measured memory_bytes: 664
import sys

N, M = (int(i) for i in raw_input().split())
ab_list = [[int(i) for i in raw_input().split()] for i in range(M)]

road_list = [0] * N
for ab in ab_list:
    a, b = ab
    road_list[a-1] += 1
    road_list[b-1] += 1

for road_num in road_list:
    print road_num


Measured memory_bytes: 2568
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int train, bus;
    if(A > B)
        train = B;
    else
        train = A;
    
    if(C > D)
        bus = D;
    else
        bus = C;
    cout << train + bus << '\n';
    return 0;
}

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

using namespace std;

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b, ans = -1;
    cin >> a >> b;
    for (int i = 1; i <= 10000; ++i) {
        if ((int) (i * 0.08) == a && (int) (i * 0.1) == b) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define mod 1000000007
#define pb push_back
#define mz map<ll,ll>
bool prime[100005];
vector<ll> v;
bool solve()
{
  memset(prime,true,100005);
  for(ll i=2;i*i<=100004;i++)
  {
    if(prime[i])
    {
      for(ll j=i*i;j<=100004;j+=i)
      prime[j]=false;
    }
  }
  for(ll i=2;i<100004;i++)
  {
    if(prime[i])
    v.pb(i);
  }
}
int main()
{
  solve();
  //for(ll i=0;i<v.size()-1000;i++)cout<<v[i]<<endl;
  ll a;
  cin>>a;
  for(ll i=0;i<v.size();i++)
  {
    if(v[i]>=a)
    {
      cout<<v[i];
      break;
    }
  }

}


Measured memory_bytes: 512
#include<stdio.h>

int main(void)
{
	int x,y,change;

	for (;;)
	{
		scanf("%d %d", &x, &y);
		if ((x == 0) && (y == 0))break;
		if (x > y)
		{
			change = x; x = y; y = change;
		}
		printf("%d %d\n", x, y);
	}

	return 0;
}


Measured memory_bytes: 2024
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}
/********************************************************/
//	d.erase(unique(all(d)), d.end());



int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		cin>>n;
		// ll a[n];
		rep(i,n)
		{
			m=i+1;
			c+=(m%3!=0&&m%5!=0?m:0);
		}
		
		cout<<(c);

		
		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3624
n,m = map(int,input().split())
#a_to = []
#a_from = []
dic = {}
isOK = False
for i in range(m):
    a,b = map(int,input().split())
    if a in [1,n]:
        dic.setdefault(b,0)
        dic[b] += 1
        if dic[b]==2:
            isOK = True
            break
    elif b in [1,n]:
        dic.setdefault(a,0)
        dic[a] += 1
        if dic[a]==2:
            isOK = True
            break
#    if a==1:
#        a_to.append(b)
#    if b==1:
#        a_to.append(a)
#    if a==n:
#        a_from.append(b)
#    if b==n:
#        a_from.append(a)

#for j in range(len(a_to)):
#    if a_to[j] in a_from:
#        isOK = True
#        break
#print(a_to)
#print(a_from)
if isOK:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 29720
#include"bits/stdc++.h"
using namespace std;
int a[100000+5];
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		int num;
		scanf("%d",&num);
	//	num+=1;
		a[num]++;
		a[num+1]++;
		a[num-1]++;
	}
	int max=0;
	for(int i=0;i<100000+4;i++){
		if(a[i]>max){
			max=a[i];
		}
	}
	printf("%d\n",max);
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
#define MAX_N 1000
int A[3];//三辺の長さの情報
bool Tri[MAX_N];//その三角形が直角三角形かどうか
int N;//データの個数

int main(){
  scanf("%d",&N);
  for(int j = 0;j < N;j++){
    for(int i = 0;i < 3;i++){
      cin >>A[i];
    }
    sort(A,A+3);
     Tri[j] = false;
     if(pow(A[2],2) ==pow(A[1],2) + pow(A[0],2)) {
      Tri[j] =true;
    }
    if(Tri[j])
      cout <<"YES"<<endl;
    else
      cout <<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PA;
int main(){
  int n,l;
  int a[100002];
  priority_queue<PA,vector<PA>,greater<PA> > pq;
  cin >> n >> l;
  for(int i=1;i<=n;i++) cin >> a[i];
  for(int i=1;i<=n;i++){
    if(a[i] > a[i-1] && a[i] > a[i+1]) pq.push(PA(l-a[i],i));
  }
  int keika = 0,ans = 0;
  PA p;
  while(!pq.empty()){
    p = pq.top();
    pq.pop();
    ans = max(ans,p.first);
    a[p.second] = 0;
    if(a[p.second-1] > a[p.second-2]){
      pq.push(PA(l-a[p.second-1]+p.first,p.second-1));
    }
    if(a[p.second+1] > a[p.second+2]){
      pq.push(PA(l-a[p.second+1]+p.first,p.second+1));
    }
  }
  cout << ans << endl;
  return (0);
}

Measured memory_bytes: 3824
H,W = map(int,input().split())
dic = {}
for h in range(H):
  s = list(input())
  for x in s:
    dic[x] = dic.get(x,0) + 1

c1 = 0
c2 = 0
for x in dic.values():
  if x%2 == 1:
    c1 += 1
    x -= 1
  if x%4 == 2:
    c2 += 1
if c1>(H%2)*(W%2):
  print("No")
elif c2>((W*(H%2))//2)+((H*(W%2))//2):
  print("No")
else:
  print("Yes")


Measured memory_bytes: 38640
S = input()

def div_plus(i, s):
    if i == len(S):
        s_list = [int(i) for i in s.split("+")]
        return sum(s_list)
    
    pos = i - len(S)
    # プラスを挿入しない場合
    d1 = div_plus(i+1, s)
    
    # プラスを挿入する場合
    d2 = div_plus(i+1, s[:pos]+"+"+s[pos:])
    return d1 + d2

print(div_plus(1, S))


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

template<class T = int> struct SegmentTree {
using Func = function<T(T, T)>;
private:
    int n = 1;
    T def;
    vector<T> node;
    const Func f;
public:
    SegmentTree(int sz, T _def, Func _f) : def(_def), f(_f) {
        while (n < sz) n *= 2;
        node.resize(2 * n - 1, def);
    }
    void update(int x, T val) {
        x += n - 1;
        node[x] = val;
        while (x > 0) {
            x = (x - 1) / 2;
            node[x] = f(node[2 * x + 1], node[2 * x + 2]);
        }
    }
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (r <= a || b <= l) return def;
        if (a <= l && r <= b) return node[k];
        T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
};

int main() {
    int N, Q; string S;
    cin >> N >> S >> Q;
    SegmentTree<int> seg(N, 0, [](int a, int b) { return a | b; });
    for(int i = 0; i < N; ++i) seg.update(i, 1 << (S[i] - 'a'));
    while(Q--) {
        int t; cin >> t;
        if(t == 1) {
            int i; char c;
            cin >> i >> c; i--;
            seg.update(i, 1 << (c - 'a'));
        } else {
            int l, r; cin >> l >> r; l--;
            cout << __builtin_popcount(seg.query(l, r)) << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 4996
import java.util.Scanner;

public class Main{ 
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
            double r = scanner.nextDouble();
            double a = r*r*Math.PI;
            double b = 2*r*Math.PI;
            System.out.printf("%.6f %.6f", a,b);
    }
}


Measured memory_bytes: 28288
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;

long Cx,Cy;

long max(long a, long b){
	if (a > b){
		return a;
	}else{
		return b;
	}
}



using namespace std;

int main(){
	int N;
	vector<long> x,y,h;
	long tx, ty, th;

	bool check;

	cin >> N;

	for(int i=0; i<N; i++){
		cin >> tx >> ty >> th;
		x.push_back(tx);
		y.push_back(ty);
		h.push_back(th);
	}


		for(Cx = 0; Cx <= 100; Cx++){
			for(Cy = 0; Cy <= 100; Cy++){
				check = true;
				int tH;
				for(int i=0;i<N && check;i++){
					if(h[i] > 0){
						tH = h[i] + abs(x[i] - Cx) + abs(y[i] - Cy);
						check = false;
					}
				}
				check = true;

				for(int i=0;i<N && check;i++){
					if(h[i] > 0 && h[i] != tH - abs(x[i] - Cx) - abs(y[i] - Cy)){
						check = false;
					}else if(h[i] == 0 && 0 < tH - abs(x[i] - Cx) - abs(y[i] - Cy)){
							check = false;
						}
					}
				if(check){
					cout << Cx << " " << Cy << " " << tH << endl;
					return 0;
					}
				}
			}
		cout << "Error" << endl;
}



Measured memory_bytes: 256
#include <iostream>
typedef long long ll;
#define mod 1000000007
using namespace std;

// n!がaを何個因数としてもつか
ll find (int n, int a) {
	   if (n < a) return 0;
	return (find(n / a, a) + n / a) % mod;
}

// エラトステネス
bool num[120];
int pri[120];
int prime(int n) {
		for (int i = 2; i * i <= n; i++) {
				if (!num[i]) {
						for (int j = i + 1; j <= n; j++) {
								if (j % i == 0) {
										num[j] = 1;
								}
						}
				}
		}
		int k = 0;
		for (int i = 2; i <= n; i++) {
				if (!num[i]) {
						pri[k] = i;
						k++;
				}
		}
		return k;
}

int main() {
		int n;
		cin >> n;
		int k = prime(n);

		ll ans = 1;
		for (int i = 0; i < k; i++) {
				ans = (find(n, pri[i]) + 1) * ans % mod;
		}
			cout << ans << endl;

			return 0;
}
				


Measured memory_bytes: 256
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <list>
#include <stack>
#include <set>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
using namespace std;
int main() {
	string s;
	ll ca = 0, cb = 0, aa = 0, ab = 0;
	cin >> s;
	for (int i = 1; i < s.size(); i++) {
		if (s[i] != s[i - 1]) {
			ca++;
		}
	}
	cout << ca << endl;
	return 0;
}

Measured memory_bytes: 512
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	dList := make(map[int]int)
	for i := 0; i < n; i++ {
		var d int
		fmt.Scan(&d)
		dList[d]++
	}

	fmt.Println(len(dList))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
typedef long long ll;
void read(ll &x)
{
	scanf("%lld",&x);
}
void print(ll x)
{
	printf("%lld ",x);
}
void println(double x)
{
	printf("%.9f\n",x);
}
ll n,m,a[211111]={1},ans;
int main()
{
	cin>>n>>m;
	for(ll i=1;i<=n+m;i++)
		a[i]=a[i-1]*i%mod;
	if(abs(n-m)>1)
	{
		cout<<0;
		return 0;
	}
	ans=a[n]*a[m]%mod;
	if(n==m)
		(ans*=2)%=mod;
	cout<<ans;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    double a,b,x,ana,anb; cin >> a >> b >> x;
    if(a*b*a/2>=x) {
        ana = 2*x/(a*b);
        anb = b;
    }else {
        double h = x/a/a;
        anb = 2*(b-h);
        ana = a;
    }
    double ans = 90.0 - atan(ana/anb)*57.2957795131;
    cout << setprecision(12) << ans << endl;

    return 0;
}

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

int main() {
  int N;
  int K;
  cin >> N >> K;
  set<char> num;
  for(int i=0;i<K;i++){
    char L;
    cin >> L;
    num.insert(L);
  }
  for(int j=N;j<=1000000;j++){
    string s=to_string(j);
    int c=0;
    for(int m=0;m<s.size();m++){
      if(num.count(s.at(m)))
        c++;
    }
    if(c==0){
      cout << j << endl;
      break;
    }
  }
    
    
  
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        int pivot = partition(a, 0, n-1);
        System.out.println(printArray(a, pivot));
    }

    private static int partition(int[] a, int l, int r) {
        int x = a[r];
        int i = l - 1;
        for (int j = l; j < r; j++) {
            if (a[j] <= x) {
                i++;
                int temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
        }
        a[r] = a[i+1];
        a[i+1] = x;
        return i+1;
    }

    static String printArray(int[] a, int pivot) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < a.length; i++) {
            if (i == pivot) {
                sb.append("[").append(a[i]).append("]");
            } else {
                sb.append(a[i]);
            }
            sb.append(" ");
        }
        return sb.toString().trim();
    }
}



Measured memory_bytes: 68740
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#include<ext/rope>
#define int long long
using namespace std;
using namespace __gnu_cxx;
typedef long long LL;
const int MAXN = 2e6+10;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
signed main(){
	int n; cin>>n;
	string s,t,res; cin>>s>>t;
	for(int i=0;i<n;i++) res += s[i],res += t[i];
	cout<<res<<endl;
    return 0;
}



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

int main() {
    int x;
    scanf("%d", &x);
    if (x>=30) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1660
#include<iostream>

using namespace std;

int main(){

	unsigned long long N,n,sum ,temp,amari;

	cin >> N;
	temp=sum=amari=0;
	for(int i=0; i<N; i++){

	

		cin >>n;

		sum += (n+amari)/2;

		if(n==0)amari =0;

		else if(amari == 1 && n%2 == 0) amari =1;
		else if(amari == 1 && n%2 == 1) amari =0;

		else if(amari == 0 && n%2 == 0)amari =0;

		else if(amari == 0 && n%2 == 1) amari =1;
	}


	cout <<sum<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.C
{
    internal static class CR
    {
        public static string GetText() { return Console.ReadLine(); }
        public static List<string> GetTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long GetLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> GetLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }
    }

    public class Program
    {
        public static long N { get; private set; }
        public static long K { get; private set; }

        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var inputs = CR.GetLongs();
            N = inputs[0];
            K = inputs[1];

            var x = N % K;
            while (true)
            {
                var maybeX = Math.Abs(x - K);
                if (maybeX > x)
                {
                    break;
                }
                x = Math.Min(x, maybeX);
            }

            return x;
        }
    }
}


Measured memory_bytes: 13396
text=input()
n=int(input())
for i in range(n):
    order=input().split()
    a,b=map(int,order[1:3])
    if order[0]=="print":
        print(text[a:b+1])
    elif order[0]=="reverse":
        re_text=text[a:b+1]
        text=text[:a]+re_text[::-1]+text[b+1:]
    else :
        text=text[:a]+order[3]+text[b+1:]



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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 110, M = 110;

int n, m;
char g[N][N];

int main()
{	
	cin >> n >> m;
	for (int i = 0; i < 50; i ++ )
		for (int j = 0; j < 100; j ++ )
			g[i][j] = '#';
	for (int i = 50; i < 100; i ++ )
		for (int j = 0; j < 100; j ++ )
			g[i][j] = '.';
			
	n -- , m -- ;
	for (int i = 0; i < 49 && n; i += 2)
		for (int j = (i & 1); j < 100 && n; j += 2)
			g[i][j] = '.', n -- ;
			
	for (int i = 51; i < 100 && m; i += 2)
		for (int j = (i & 1); j < 100 && m; j += 2)
			g[i][j] = '#', m -- ;
			
	puts("100 100");
	for (int i = 0; i < 100; i ++ ) puts(g[i]);
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int n, x;
	cin >> n >> x;

	int ans = 1;
	int cur = 0;
	rep(i,n) {
		int l;
		cin >> l;
		cur += l;
		if (cur <= x)ans++;
	}
	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>

using namespace std;

#define INF 999999999

int main(){
	int i, j, n, m, k, v;
	bool know[101][101], l[101];
	int ans, sus;
	while(1){
		cin >> n;
		if(!n) break;
		ans = -1;
		sus = 0;
		for(i=0;i<=100;i++){
			l[i] = false;
			for(j=0;j<=100;j++){
				know[i][j]=false;
			}
		}
		for(i=1;i<=n;i++){
			cin >> m;
			for(j=0;j<m;j++){
				cin >> v;
				know[i][v] = true;
			}
		}
		cin >> k;
		for(i=0;i<k;i++){
			cin >> v;
			l[v] = true;
		}
		for(i=1;i<=n;i++){
			bool white = false;
			for(j=1;j<=n;j++){
				if(l[j] && !know[i][j]){
					white = true;
					break;
				}
			}
			if(!white){
				if(!sus){
					ans = i;
					sus++;
				}
				else{
					ans = -1;
					break;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1168
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    E=[[] for _ in range(n)]
    idx={}
    for i in range(n-1):
        a,b=map(int,input().split())
        a-=1; b-=1
        E[a].append(b)
        E[b].append(a)
        idx[(min(a,b),max(a,b))]=i
    ans=[None]*(n-1)

    def dfs(v=0,p=-1,c=0):
        col=1
        for nv in E[v]:
            col+=col==c
            if(nv==p): continue
            ans[idx[(min(v,nv),max(v,nv))]]=col
            dfs(nv,v,col)
            col+=1
    dfs()
    print(max(ans))
    print(*ans,sep='\n')
resolve()

Measured memory_bytes: 107292
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;


namespace AOJ
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static void Main(string[] args)
        {
            var NM = Sarray();
            var n = NM[0];
            var m = NM[1];
            var ci = Sarray();
            var dp = new uint[n + 1];
            for (var i = 1; i <= n; ++i)
            {
                dp[i] = int.MaxValue - 1;
                for (var j = 0; j < m; ++j)
                {
                    var pre = i - ci[j];
                    if (0 <= pre)
                    { dp[i] = Math.Min(dp[i], dp[pre] + 1); }
                }
            }
            WriteLine(dp[n]);
        }
    }
}


Measured memory_bytes: 18464
n,m = list(map(int, input().split()))
aclist=[0 for i in range(n)]
ac=0
wa=[0 for i in range(n)]
for i in range(m):
    j = list(input().split())
    j[0]=int(j[0])
    if aclist[j[0]-1]==0:
        if j[1]=='AC':
            ac+=1
            aclist[j[0]-1]=1
        elif j[1]=='WA':
            wa[j[0]-1]+=1
ans=0
for i,j in enumerate(aclist):
    if j==1:
        ans+=wa[i]
print(ac,ans)

Measured memory_bytes: 51120
#include <cstdio>

int main(){
   int a1, a2, a3, t;
   scanf("%d %d %d", &a1, &a2, &a3);
   if(!(a1 < a2)){
     t = a1;
     a1 = a2;
     a2 = t;
   }
   if(!(a2 < a3)){
     t = a2;
     a2 = a3;
     a3 = t;
   }
   if(!(a1 < a2)){
     t = a1;
     a1 = a2;
     a2 = t;
   }
   printf("%d %d %d\n", a1, a2, a3);
   return 0;
 }

Measured memory_bytes: 2756
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
    a[i]--;
  }
  vector<bool> check(n);
  check[0] = true;
  
  int now = 0;
  int cnt = 0;
  
  while(true){
    now = a[now];
    if(check[now] == true){
      cnt = -1;
      break;
    }
    cnt++;
    check[now] = true;
    if(now == 1)
      break;
  }
  
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 640
import java.util.*;
class Main {
        static Scanner sc = new Scanner(System.in);
  		static void myout(Object t){System.out.println(t);}
        static void myerr(Object t){System.err.println(t);}
        static String getStr(){return sc.next();}
        static int getInt(){return sc.nextInt();}
        static Long getLong(){return sc.nextLong();}
        static boolean isNext(){return sc.hasNext();}
        public static void main(String[] args){
          int D = sc.nextInt();
      int N = sc.nextInt();
          if(N == 100){
            N++;
          }
      int output = (int)Math.pow(100,D);
      myout(output * N);
        }
        //便利メソッド追加枠ここから

        //便利メソッド追加枠ここまで
}


Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <climits>
using namespace std;

int main() {
	// your code goes here
	string s;
	cin >> s;
	
	int ans = INT_MIN,tmp = 0;
	for(int i = 0; i < s.length(); i++){
		if(s[i] == 'R')
			tmp++;
		else{
			ans = max(ans,tmp);
			tmp = 0;
		}
	}
	ans = max(ans,tmp);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int main(){

    int N;
    cin >> N;

    string S;
    cin >> S;

    int cnt = 0;
    for(int i=0; i < N-2; i++){
        if(S.substr(i, 3) == "ABC") cnt++;
    }

    cout << cnt;
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>
#include<cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

int durationof_contests = 365;
const int typeof_contests = 26;

vector<int> penalty(typeof_contests);
vector<vector<int>> prize(durationof_contests, vector<int>(typeof_contests));

vector<int> solvefor(int i, int j, const vector<int> &last_occured) {
  int days = j-i+1;
  // debug(days);
  int possibilities = pow(typeof_contests, days);
  int maxm = INT_MIN;vector<int> ans;
  for(int mask = 0; mask < possibilities;mask++) {
    vector<int> tans;
    int maskc = mask;
    rep(abra, days) {
      tans.pb(maskc % typeof_contests);
      maskc /= typeof_contests;
    }
    // calculate score
    vector<int> last_occured_cpy = last_occured;
    int score = 0;
    rep(day, days) {
      int ctype = tans[day];
      int wday = i + day;
      score += prize[wday][ctype];
      last_occured_cpy[ctype] = wday;
      rep(k, typeof_contests) {
        score -= penalty[k] * (wday - last_occured_cpy[k]);
      }
    }

    // update maximum
    if(score > maxm) {
      maxm = score;
      ans = tans;
    }
  }

  return ans;
}

vector<int> consecutive_days_tolook(int days) {
  // 26^days * 365 * 26
  // debug(days);
  vector<int> ans;
  vector<int> last_occured(typeof_contests, -1);
  for(int i = 0;i - 1 + days < durationof_contests;i++) {
    vector<int> tans = solvefor(i, i+days-1, last_occured); // tans.size() == days
    if(i+days == durationof_contests) {
      for(auto x: tans) ans.pb(x);
      break;
    }

    last_occured[tans[0]] = i;
    ans.pb(tans[0]);
  }
  return ans;
}

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 ios_base::sync_with_stdio(false);
 cin.tie(NULL);

 cin>>durationof_contests;
 rep(i, typeof_contests) cin>>penalty[i];
 rep(i, durationof_contests) {
   rep(j, typeof_contests) {
     cin >> prize[i][j];
   }
 }

 auto ans = consecutive_days_tolook(1);
 for(auto x: ans) cout << x + 1 << endl;

 return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
int d,n;
int t[210];
int a[210],b[210],c[210];
int dp[210][210];

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

	for(int i=0; i<d; i++){
		for(int j=0; j<n; j++){
			if(a[j] <= t[i] && t[i] <= b[j]){
				dp[i][j] = 0;
			}
			else{
				dp[i][j] = -INF;
			}
		}
	}
	//????????????????????§?????????????????\???????????¨??§?????????????????¨?????¨????????????


	for(int i=d-2; i >= 0; i--){
		for(int j=0; j < n; j++){
			for(int k=0; k < n;  k++){
				if(dp[i][j] >= 0){
					dp[i][j] = max(dp[i][j],
					dp[i+1][k] + abs(c[j] - c[k]));
				}
			}
		}
	}

	int max = 0;

	for(int i=0; i < n; i++){
		if(dp[0][i] > max){
			max = dp[0][i];
		}
	}

	cout << max << endl;

}

Measured memory_bytes: 3232
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
namespace mp = boost::multiprecision;

template<typename T>
constexpr std::vector<std::pair<T, T>> primeFactorization(T number) noexcept {
	std::vector<std::pair<T, T>> primeFactors;
	T quotient = number;
	for (T i = 2; i*i <= quotient; ++i) {
		if (quotient%i == 0) {
			T prime = i, power = 1;

			quotient /= i;
			while (quotient%i == 0) {
				++power;
				quotient /= i;
			}

			primeFactors.push_back(std::pair<T, T>(prime, power));
		}
	}
	if (quotient != 1) primeFactors.push_back(std::pair<T, T>(quotient, 1));

	return primeFactors;
}

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

	ll n;
	cin >> n;
	vector<pll> primes = primeFactorization(n);

	ll ans = 0;
	rep(i, primes.size()) {
		rep(j, primes[i].second) {
			if (primes[i].second - (j + 1) > (j + 1)) {
				++ans;
				primes[i].second -= (j + 1);
			}
			else {
				++ans;
				break;
			}
		}
	}

	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 3664
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	mod int = 1e9 + 7
)

func main() {
	N := getInt()
	A := make([]int, N)

	impossible := true
	for i := 0; i < N; i++ {
		A[i] = getInt()
		if A[i] == 1 {
			impossible = false
		}
	}

	if impossible {
		fmt.Println(-1)
		return
	}

	var results []int
	cnt := 0
	for i := 0; i < N; i++ {
		before := 0
		if len(results) != 0 {
			before = results[len(results)-1]
		}

		if A[i] == before + 1 {
			results = append(results, A[i])
		} else {
			cnt++
		}
	}

	fmt.Println(cnt)
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 8960
import java.util.* ;
public class Main{
       public static void main( String args[] ){
             Scanner cin = new Scanner( System.in ) ;
             int n = cin.nextInt() ;
             int x = cin.nextInt() ;
             int a[] = new int[100010] ;
             for( int i = 1 ; i <= n ; i++ )
                 a[i] = cin.nextInt() ;
             int ans = abs( a[1] - x ) ;
             for( int i = 2 ; i <= n ; i++ )
                 ans = gcd( ans , abs( a[1] - a[i] ) ) ;
             System.out.println( ans ) ;
       }
       public static int abs( int x ){
             return x >= 0 ? x : -x ;
       }
       public static int gcd( int a , int b ){
             return b == 0 ? a : gcd( b , a % b ) ;
       }
} 

Measured memory_bytes: 50028
/*author: hyperion_1724
  date: 
*/

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

	cout<<fixed<<setprecision(9);
	READV(N);
	ld A[N];
	FORI(i,0,N)
	{
		READ(A[i]);
	}
	sort(A,A+N);
	ld ans=A[0];
	FORI(i,1,N)
	{
		ans=(A[i]+ans)/2;
	}
	cout<<ans<<endl;

	return 0;
}

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

using namespace std;

const long long M = 1e9+7;
long long f[1111111];

long long exp(long long a, long long e) {
    if(e == 1) return a;
    if(e%2) return (a*exp(a,e-1))%M;
    return exp((a*a)%M,e/2);
}

long long inv(long long a) { return exp(a,M-2); }

int main() {
    f[0] = 1;
    for(int i=1;i<1e6;i++) f[i] = (f[i-1]*i)%M;
    srand(time(NULL));
    int a, b;
    cin >> a >> b;
    /*while(1) {
        a = rand()%1000000;
        b = rand()%1000000;
        cout << a << " " << b << endl;
        */
        int a3 = 2*a-b, b3 = 2*b-a;
        if(a3%3 || b3%3 || a3 < 0 || b3 < 0) cout << 0 << endl;
        else {
            long long r = (f[(a3+b3)/3]*inv(f[a3/3]))%M;
            cout <<  (r*inv(f[b3/3]))%M<< endl;
        }
    //}
    return 0;
}


Measured memory_bytes: 8448
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define UNIQUE(a) unique(a.begin(), a.end())
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>
#include <sstream>
#include <map>

using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

const ll mod = 1e9+7;

int main() {
	string s;
	cin >> s;
	int c[26] = { 0 };

	REP(i, s.length()) {
		c[s[i] - 'a']++;
	}

	int min = 100;
	REP(i, 26) {
		int tmp = 0;
		string st,st2;
		st = s;
		bool ok = true;
		REP(j, s.length()) {
			if (s[j] != s[0]) {
				ok = false;
			}
		}

		while (!ok) {
			st2 = "";
			REP(j, st.length() - 1) {
				if (st[j] == (char)(i + 'a') || st[j + 1] == (char)(i + 'a') ) {
					st2 += (char)(i + 'a');
				}else{
					st2 += st[j];
				}
			}
			ok = true;
			REP(j, st2.length()) {
				if (st2[j] != st2[0]) {
					ok = false;
				}
			}
			tmp++;
			st = st2;
		}
		if (tmp < min) {
			min = tmp;
		}
	}

	cout << min << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;


int main(){
	int n;
	ll x;cin >> n >> x;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	ll ans = 0;
	if(a[0]>x) {
		ans += a[0]-x;
		a[0] = x;
	}
	rep(i,n-1){
		//cout << " " << ans << endl;
		if(a[i]+a[i+1]>x){
			ans += a[i+1] - (x-a[i]);
			a[i+1] = x-a[i];
		}
	}
	//rep(i,n) cout << a[i] << endl;
	cout << ans << endl;
} 


Measured memory_bytes: 4052
from collections import defaultdict

N = int(input())
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,
        43,47,53,59,61,67,71,73,79,83,89,97]
ans = 0
factor = defaultdict(int)
for i in range(1,N+1):
    for j in prime:
        while i != 1:
            if i % j == 0:
                factor[j] += 1
                i = i // j
            else:
                break

fact_l = list(dict(factor).items())
fact_l.sort()
n_74 = 0
n_24 = 0
n_14 = 0
n_4 = 0
n_2 = 0
for i, x in enumerate(fact_l):
    if x[1] >= 74:
        n_74 = i + 1
    if x[1] >= 24:
        n_24 = i + 1
    if x[1] >= 14:
        n_14 = i + 1
    if x[1] >= 4:
        n_4 = i + 1
    if x[1] >= 2:
        n_2 = i + 1

print(n_74+(n_24*(n_2-1))+(n_14*(n_4-1))+(n_4*(n_4-1)*(n_2-2)//2))

Measured memory_bytes: 3316