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

using namespace std;

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

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

//#define INF (1e10)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x) { cout << x << endl; }
template<class T, class... A> void print(const T& first, const A& ... rest) { cout << first << " "; prll(rest...); }
struct PreMain { PreMain() { cin.tie(0); ios::sync_with_stdio(false); } } premain;

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

	vector<int> X(N), Y(N);
	vector<int> xary, yary;

	REP(i, N) {
		cin >> X[i] >> Y[i];

		xary.push_back(X[i]);
		yary.push_back(Y[i]);
	}

	sort(xary.begin(), xary.end());
	sort(yary.begin(), yary.end());

	ll ans = 1LL * (xary[N - 1] - xary[0]) * (yary[N - 1] - yary[0]);

	REP(xi, N) REPN(xj, (xi + 1), N) REP(yi, N) REPN(yj, (yi + 1), N) {
		int cnt = 0;
		ll lx = xary[xi];
		ll rx = xary[xj];
		ll by = yary[yi];
		ll uy = yary[yj];

		REP(i, N) {
			if ((lx <= X[i]) and (X[i] <= rx) and (by <= Y[i]) and (Y[i] <= uy)) {
				cnt++;
			}
		}

		if (K <= cnt) {
			ans = min(ans, 1LL * (rx - lx) * (uy - by));
		}
	}

	print(ans);

	return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n, l;
    cin >> n >> l;
    int s = 0;
    for(int i = 1; i <= n; ++i) {
        s += l + i - 1;

    }

    int res = INF;
    int r;
    for(int i = 1; i <= n; ++i) {
        int t = s - (l + i - 1);
        if(abs(s - t) < res) {
            r = t;
            res = abs(s - t);
        }
    }
    cout << r << endl;
    return 0;
}



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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int H, W;
vector<string> S;
vector<vector<bool>> homon;
ll black =0, white = 0;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};

void dfs(int y, int x){
  homon[y][x] = true;
  if(S[y][x] == '#'){
    black++;
  }
  else{
    white++;
  }
  REP(i, 4){
    int nx = x + dx[i], ny = y + dy[i];
    if(0> nx || W<=nx || 0 > ny || H <= ny || homon[ny][nx] || S[y][x] == S[ny][nx]) continue;
    dfs(ny, nx);
  }
}

int main(){ 
  cin >> H >> W;
  S.resize(H), homon.resize(H, vector<bool>(W, false));
  REP(i, H){
    cin >> S[i];
  }
  ll ans = 0;
  REP(i, H){
    REP(j, W){
      if(S[i][j] == '.' || homon[i][j]) continue;
      black = 0, white = 0;
      dfs(i, j);
      ans += black * white;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 15488
#include<iostream>

using namespace std;

int main(){
while(1){
 int n;
 cin>>n;

 if(n==0){break;}

 char c[1000];
 for(int i=0;i<n;i++){
	cin>>c[i];
 }

 int cnt[26]={0};

 for(int i=0;i<n;i++){
	cnt[(int)(c[i]-'A')]++;

	int max1=-1;
	int max2=-1;

	for(int j=0;j<26;j++){
		if(cnt[j]>max1){
			max2=max1;
			max1=cnt[j];
		}else if(cnt[j]>max2){
			max2=cnt[j];
		}
 	}

 	if(max1-max2>n-(i+1)){
		for(int j=0;j<26;j++){
			if(cnt[j]==max1){
				cout<<(char)(j+'A')<<' ';
				break;
			}
		}
		cout<<(i+1)<<endl;
		break;
	}
	if(i==n-1){
		cout<<"TIE"<<endl;
		break;
	}
 }
}
return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 1e9 + 7
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    int a, b, c;
    int x;
    cin >> a >> b >> c;
    cin >> x;
    REP(i, x)
    {
        if (a >= b)
        {
            b *= 2;
        }
        else if (b >= c)
        {
            c *= 2;
        }
    }
    if (a < b && b < c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3624
/*
AizuOnline A0126
Maximum Sum Sequence
*/
#include <stdio.h>

char suudoku[9][9];
char flags[9][9];
char *p;

void chkdbl()
{
  int i,j;
  int k,l;

  int flg;

  /*row*/
  /*colomn*/
  for(i=0;i<9;i++)
    for(j=0;j<9;j++)
      { flg = 0;
        for(k=0;k<9;k++)
          { flg |= ((j!=k) && (suudoku[i][j] == suudoku[i][k]))?1:0;
            flg |= ((i!=k) && (suudoku[i][j] == suudoku[k][j]))?1:0;
          }
      
        for(k=(i/3)*3;k<(i/3)*3+3;k++)
          for(l=(j/3)*3;l<(j/3)*3+3;l++)
            {
              /* printf("%d %d %d %d\n",i,j,k,l);*/
              flg |= ((i!=k) && (j!=l)&& (suudoku[i][j] == suudoku[k][l]))?1:0;
            }
        flags[i][j]=flg;
      }
}

main()
{
int i,j,cnt;


  for(i=0;i<9;i++)
    for(j=0;j<9;j++)
       flags[i][j]=0;

scanf("%d",&cnt);

  while(cnt--)
    {
      for(i=0;i<9;i++)
        for(j=0;j<9;j++)
        {
          scanf(" %c",&suudoku[i][j]);
        }

      chkdbl();

  
      for(i=0;i<9;i++)
        { 
          for(j=0;j<9;j++)
            printf("%c%c",(flags[i][j])?'*':' ',suudoku[i][j]);
          printf("\n");
        }
      if(cnt)
        printf("\n");
    }

return(0);
}

Measured memory_bytes: 0
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  const points = [0, 0];
  let [x1, y1, x2, y2] = content.trim().split(' ');
  const distance = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
  console.log(distance.toFixed(6));
});



Measured memory_bytes: 15288
#include<stdio.h>
#include<stdlib.h>

void swap (unsigned short  *A,int i,int j){
  int cmp;
  cmp=A[i];
  A[i]=A[j];
  A[j]=cmp;
}

int partition(unsigned short *A,int p,int r){
  int x = A[r];
  int j,i = p-1;

  for(j=p;j<r;j++){
    if(A[j] <= x){
      i++;
      swap(A,i,j);
    }
  }
  swap(A,i+1,r);

  return i+1;
}


int main(){
  unsigned short *A;
  int n,i,ren;

  scanf("%d",&n);

  A = malloc(sizeof(short)*n + 1 );

  for(i=1;i<=n;++i) scanf("%d",&A[i]);
  
  ren = partition(A,1,n);

  for(i=1;i<ren;i++)printf("%d ",A[i]);
 
  printf("[%d] ",A[ren]);
  for(i=ren+1;i<n;++i)printf("%d ",A[i]);
  printf("%d\n",A[n]);

  return 0;
  
}




Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long ll;
const int N = 66;
int F(ll a, ll b)
{
  return max(log10(1.0*a), log10(1.0*b)) + 1;
}
int main()
{
  // freopen("in.txt","r",stdin); 
   ll n;
   while (~scanf("%lld", &n))
   {
      int m = (int)sqrt(1.0*n) + 1;
      int ans = 10000;
      for (int i = 1; i <= m; i++)if (n % i == 0)
      {
        ans = min(ans, F((ll)i, n/i));
      }
      printf("%d\n", ans);
   }
   
   return 0;
}


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

const int MAX_N = 200000;

int n, r[MAX_N];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> r[i];

    int max_value = -1000000000;
    int min_value = r[0];

    for (int i = 1; i < n; i++) {
        max_value = max(max_value, r[i] - min_value);
        min_value = min(min_value, r[i]);
    }

    cout << max_value << endl;
}


Measured memory_bytes: 3900
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define int long long
#define MAX(a,b) ((a) > (b)) ? (a) : (b)
#define MIN(a,b) ((a) < (b)) ? (a) : (b)

using namespace std;


signed main()
{
	int x;
	cin >> x;
	int cnt = (x / 11) * 2;
	int mod = x % 11;
	if (mod == 0)
	{
	}
	else if (mod <= 6)
	{
		cnt += 1;
	}
	else
	{
		cnt += 2;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
// ALDS1_1_A Insertion sort

#include <vector>
#include <iostream>

using namespace std;

namespace alds1_1_a {

	void outputArray(ostream& os, const vector<int>& A)
	{
		int n = A.size();
		for (int i = 0; i < n - 1; ++i) {
			os << A[i] << " ";
		}
		os << A[n - 1] << endl;
	}

	void insertionSort(vector<int>& A, ostream& os)
	{
		int n = A.size();

		for (int i = 0; i < n; ++i) {
			int key = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > key) {
				if (A[j] > key)
					A[j + 1] = A[j];
				--j;
			}
			A[j + 1] = key;

			outputArray(os, A);
		}
	}

	void solve(istream &sin, ostream &sout)
	{
		int n;
		sin >> n;

		vector<int> A;
		for (int i = 0; i < n; ++i) {
			int val;
			sin >> val;
			A.push_back(val);
		}

		insertionSort(A, sout);
	}
}

int main()
{
	alds1_1_a::solve(cin, cout);
}


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

using namespace std;

int main(int argv, char** argc) {
 int N;
  cin >> N;
  cout << N*N*N << endl;

  return 0;

}


Measured memory_bytes: 256
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        long sum = 0;
        for(long i = 1; i<=n; i++){
            if(i%3==0 || i%5==0){

            }
            else{
                sum+=i;
            }
        }
        out.print(sum);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}



Measured memory_bytes: 33056
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  int n = sc.nextInt();
	  Set<String> set = new HashSet<>();
	  String word = sc.next();
	  char shiri = word.charAt(word.length()-1);
	  set.add(word);
	  
	  for (int i = 1; i < n; i++) {
		  String w = sc.next();
		  char sentou = w.charAt(0);
		  
		  if (sentou != shiri || set.contains(w)) {
			  System.out.println("No");
			  System.exit(0);
		  }
		  shiri = w.charAt(w.length()-1);
		  set.add(w);
	  }
	  
	  System.out.println("Yes");
	  System.exit(0);
  }
  
  private static void solveA() {
	  FastReader sc = new FastReader();
	  int a = sc.nextInt();
	  int b = sc.nextInt();
	  	  
	  if ((a*b) % 2 == 0) {
		  System.out.println("No");
		  System.exit(0);
	  }
	  
	  System.out.println("Yes");
	  System.exit(0);
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


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

int main() {
  int n,y;
  cin >> n >> y;
  
  int flg = 0;
  
  int p,q;
  
  for(int i=0; i<=y/10000; i++){
    if((y-10000*i-1000*(n-i)) % 4000 != 0 || (5000 * (n-i) - y + 10000 * i ) % 4000 != 0){
      continue;
    }
    p = (y - 10000 * i - 1000 * (n-i))/4000;
    q = (5000 * (n-i) - y + 10000 * i)/4000;
    if (p>=0 && q>=0){
      flg = 1;
      break;
    }
  }
  
  if (flg == 0){
    cout << -1 << " " << -1 << " " << -1 << endl;
  }else{
    cout << n-p-q << " " << p << " " << q << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
max_n = -1
semi_max_n = -1
max_idx = -1
for i in range(n):
    x = int(input())
    if x > max_n:
        max_n = x
        max_idx = i
    elif x >= semi_max_n:
        semi_max_n = x
for i in range(n):
    if i == max_idx:
        print(semi_max_n)
    else:
        print(max_n)

Measured memory_bytes: 9188
import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))

N, M = inpl()
P = 2**N
INF = 10**12
cost = [INF]*P
cost[0] = 0
for _ in range(M):
    a, b = inpl()
    c = inpl()
    k = 0
    for ci in c:
        k |= 1<<(ci-1)
    for i in range(P):
        new = i | k
        cost[new] = min(cost[new],cost[i]+a)

ans = cost[P-1]
if ans >= INF:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 43756
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

struct Job(usize, usize);

fn main() {
    input!{
        N: usize,
        AB: [(usize, usize); N],
    }
    let mut jobs = Vec::new();
    for (A, B) in AB {
        jobs.push(Job(A, B));
    }
    jobs.sort_by(|a, b| a.1.cmp(&b.1));
    let mut now = 0;
    for Job(cost, limit) in jobs {
        now += cost;
        if now > limit {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 17652
#include<stdio.h>

int rot[24][7]={
    {0,1,2,3,4,5,6},{0,1,3,5,2,4,6},{0,1,4,2,5,3,6},{0,1,5,4,3,2,6},
    {0,2,6,3,4,1,5},{0,2,3,1,6,4,5},{0,2,1,4,3,6,5},{0,2,4,6,1,3,5},
    {0,3,1,2,5,6,4},{0,3,2,6,1,5,4},{0,3,5,1,6,2,4},{0,3,6,5,2,1,4},
    {0,4,1,5,2,6,3},{0,4,2,1,6,5,3},{0,4,5,6,1,2,3},{0,4,6,2,5,1,3},
    {0,5,1,3,4,6,2},{0,5,3,6,1,4,2},{0,5,4,1,6,3,2},{0,5,6,4,3,1,2},
    {0,6,2,4,3,5,1},{0,6,3,2,5,4,1},{0,6,5,3,4,2,1},{0,6,4,5,2,3,1}
};

int assign[7];

int main(){
    int i,j;
    int a[7],b[7],dice[7];
    for(i=1;i<=6;i++) scanf("%d",assign+i);
    for(i=1;i<=6;i++) scanf("%d",a+i);
    for(j=0;j<24;j++){
        for(i=1;i<=6;i++) dice[i]=rot[j][i];
        for(i=1;i<=6;i++) b[i]=assign[dice[i]];
        for(i=1;;i++){
            if(i>6){ printf("Yes\n"); return 0; }
            if(a[i]!=b[i]) break;
        }
    }

    printf("No\n");


    return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

signed main(){
    int N; cin>>N;
    vec_int a(N+1); rep(i,N)cin>>a.at(i+1);

    vec_int b(N+1,0);

    vec_int pos;

    for(int i=N;i>0;i--){
        // i番目の場所にボールを入れるか判断する
        if (b.at(i)%2 == a.at(i)){
            //ボールを入れない
        }else{
            vec_int yakusuu = divisor(i);
            for(auto num : yakusuu){
                b.at(num) +=1;
            }
            pos.push_back(i);
        }
    }

    cout<<pos.size()<<endl;
    for(auto num : pos){
        cout<<num<<endl;
    }




    return 0;
}

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

int main()
{
	int N, K;
	cin >> N >> K;
	long long ans = 0;
	for (int i = max(1, K); i <= N; i++) {
		int last;
		for (int j = 1; j <= i; j = last+1) {
			last = i/(i/j);
			int R = (i-K)/(i/j);
			if (R >= j) {
				ans += min(R, last)-j+1;
				// cerr << i << " " << j << " " << R << " " << last << endl;
			}
		}
		ans += N-i;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define INF 1000000007
#define LLINF 2696969696969696969ll
#define MAXN 313

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

int N;
int freq[4];
ld dp[MAXN][MAXN][MAXN];

int32_t main()
{
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(10);
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N;
	FOR(i, 0, N)
	{
		int x; cin >> x; freq[x]++;
		if (N == 1)
		{
			cout << x << '\n';
			return 0;
		}
	}
	FOR(k, 0, N + 1)
	{
		FOR(j, 0, N - k + 1)
		{
			FOR(i, 0, N - j - k + 1)
			{
				if (i == 0 && j == 0 && k == 0)
				{
					dp[i][j][k] = 0.0;
					continue;
				}
				ld co = 1.0 + (i == 0 ? 0 : dp[i - 1][j][k] * i / N) + (j == 0 ? 0 : dp[i + 1][j - 1][k] * j / N) + (k == 0 ? 0 : dp[i][j + 1][k - 1] * k / N);
				//x = (N-i-j-k)/N * x +
				//(i+j+k)/N * x = co
				dp[i][j][k] = co * N / (i + j + k);
			}
		}
	}
	cout << dp[freq[1]][freq[2]][freq[3]] << '\n';
	return 0;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    char a; cin >> a;
    cout << char(a + 1) << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin>>n;
   vector<long long> arr(n);
   for(int i=0;i<n;i++){
             cin>>arr.at(i);
             if(arr.at(i)==0){
                cout<<0<<endl;
                return 0;
             }
   }
   long long sum=1;
   for(int i=0;i<n;i++){
        if(arr.at(i)<=1000000000000000000 / sum){
                   sum*=arr.at(i);
        }
        else{
            cout<<-1<<endl;
            return 0;
        }
   }
   cout<<sum<<endl;

}


Measured memory_bytes: 4028
import sys

k, t = map(int, input().split())
a = list(map(int, input().split()))

if t == 1:
    print(sum(a) - 1)
    sys.exit()

max_a = max(a)

if (sum(a) + 1) // 2 >= max_a:
    print(0)
else:
    print(2 * max_a - sum(a) - 1)

Measured memory_bytes: 3060
import java.util.Scanner;

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

        String[] moji;
        moji = new String[200];
        String[] copy;
        copy = new String[200];
        int[] m;
        m = new int[100];
        int[][] h;
        h = new int[100][100];

        int cnt=0;
        while(true){
            moji[cnt] = sc.next();
            if(moji[cnt].equals("-"))
                break;
            m[cnt] = sc.nextInt();
            for(int i=0;i<m[cnt];i++)
                h[cnt][i] = sc.nextInt();

            for(int i=0;i<m[cnt];i++){
                if(i==0)
                    copy[cnt] = moji[cnt].substring(h[cnt][i]) + moji[cnt].substring(0, h[cnt][i]);
                else
                    copy[cnt] = copy[cnt].substring(h[cnt][i]) + copy[cnt].substring(0, h[cnt][i]);
            }
            cnt++;        
        }

        for(int i=0; i<cnt; i++){
            System.out.println(copy[i]);
        }

        sc.close();

    }
}


Measured memory_bytes: 26424
n, m = map(int, input().split())

accepts = [False] * n
penalties = [0] * n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1

    if s == 'AC':
        accepts[p] = True
    elif not accepts[p]:
        penalties[p] += 1

num_accepts = 0
num_penalties = 0

for i in range(n):
    if accepts[i]:
        num_accepts += 1
        num_penalties += penalties[i]

print(num_accepts, num_penalties)


Measured memory_bytes: 4596
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>

#include <stdio.h>

using namespace std;

typedef long long ll;

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

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

ll solve(string S) {
    // {'<' or '>', how many}
    vector<pair<char, int> > areas;
    // if (S[0] == '<') {
    //     areas.push_back({'>', 0});
    // } else {
    //     areas.push_back({'<', 0});
    // }

    int count = 0;
    int slen = (int) S.size();
    char prev = S[0] == '<' ? '>' : '<';
    for (int i = 0; i < slen; i++) {
        if (S[i] != prev) {
            areas.push_back({prev, count});
            prev = S[i];
            count = 0;
        }
        count++;
    }
    areas.push_back({S[slen - 1], count});
    if (S[slen - 1] == '<') {
        areas.push_back({'>', 0});
    } else {
        areas.push_back({'<', 0});
    }

    // for (int i = 0; i < (int) areas.size(); i++) {
    //     printf("(%d, %d), ", areas[i].first, areas[i].second);
    // }
    // printf("\n");

    ll ans = 0;
    for (int i = 1; i < (int) areas.size(); i++) {
        ll n = areas[i].second;
        ans += (n * (n + 1)) / 2;
        // printf("min: %d\n", min(areas[i - 1].second, areas[i].second));
        if (areas[i].first == '>') {
            ans -= min(areas[i - 1].second, areas[i].second);
        }
        // printf("%lld\n", ans);
    }

    return ans;
}

// 14:38
int main(void) {
    string S;
    cin >> S;
    cout << solve(S) << endl;
    return 0;
}


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

//最大正方形
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_3_A
class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("4 5");
            WillReturn.Add("0 0 1 0 0");
            WillReturn.Add("1 0 0 0 0");
            WillReturn.Add("0 0 0 1 0");
            WillReturn.Add("0 0 0 1 0");
            //4
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static int UB_X;
    static int UB_Y;

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = { };
        Action<string> SplitAct = pStr =>
            wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray();
        SplitAct(InputList[0]);

        int H = wkArr[0];
        int W = wkArr[1];

        UB_X = W - 1;
        UB_Y = H - 1;
        int[,] BanArr = new int[UB_X + 1, UB_Y + 1];

        for (int LoopY = 0; LoopY <= UB_Y; LoopY++) {
            SplitAct(InputList[LoopY + 1]);
            for (int LoopX = 0; LoopX <= UB_X; LoopX++) {
                BanArr[LoopX, LoopY] = wkArr[LoopX];
            }
        }

        int[,] CntArr = new int[UB_X + 1, UB_Y + 1];

        Func<int, int, int> wkFunc = (pX, pY) =>
        {
            if (pX < 0 || UB_X < pX) return 0;
            if (pY < 0 || UB_Y < pY) return 0;

            return CntArr[pX, pY];
        };

        for (int LoopX = 0; LoopX <= UB_X; LoopX++) {
            for (int LoopY = 0; LoopY <= UB_Y; LoopY++) {
                if (BanArr[LoopX, LoopY] == 1) //汚れたタイルの場合
                    CntArr[LoopX, LoopY] = 0;
                else {
                    int Cnt1 = wkFunc(LoopX - 1, LoopY - 1);
                    int Cnt2 = wkFunc(LoopX, LoopY - 1);
                    int Cnt3 = wkFunc(LoopX - 1, LoopY);

                    int wkMin = Math.Min(Cnt1, Cnt2);
                    wkMin = Math.Min(wkMin, Cnt3);

                    CntArr[LoopX, LoopY] = wkMin + 1;
                }
            }
        }

        int MaxSeihoukeiLength = CntArr.Cast<int>().Max();
        Console.WriteLine(MaxSeihoukeiLength * MaxSeihoukeiLength);
    }
}

Measured memory_bytes: 54156
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int num=1e9+7;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n),b;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end(),greater<ll>());
    int cnt=1;
    bool flag=false;
    for(int i=0; i<n-1; i++){
        if(a[i]==a[i+1])cnt++;
        else cnt=1;
        if(cnt%2==0)b.push_back(a[i]);
        if(b.size()>=2){
            flag=true;
            break;
        }
    }
    if(flag){
        ll ans=b[1]*b[0];
        cout << ans << endl;
    }
    else cout << 0 << endl;
}


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

int tests(){ 
    int64 a,b,c,d;
    cin >>a  >> b >> c >> d;
    int64 ans = max({a*c,a*d,b*c,b*d});
    cout << ans << '\n';
    return 0;
}    
int main(){
    I__O ;      
    int cases = 1 ;  
    // cin >> cases ;
    while(cases--)
        tests(); 
    return 0 ; 
}
 


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
long F(long a){
  if(a==0)return 0;
  if(a%2){// 1 mod 2
    if(a%4==1)// 1 mod 4 -> 1
      return 1;
    else // 3 mod 4 -> 0
      return 0;
  }
  else{ // 0 mod 2
    if(a%4)// 2 mod 4 -> 
      return a+1;
    else // 0 mod 4 -> a
      return a;
  }
}
int main(){
  #define int long
  int A,B,res;
  cin>>A>>B;
  if(A==B)res=A;
  else if(!A)res=F(B);
  else res=F(B)^F(A-1);
  cout<<res;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2005;
const int mod=924844033;
int dp[maxn][maxn][2][2];
// 前i个  有j个位置是错的
long long fac[maxn];
void pre()
{
    fac[0]=fac[1]=1;
    for(int i=2;i<maxn;i++)
        fac[i]=i*fac[i-1]%mod;
    memset(dp,0,sizeof(dp));
    dp[1][0][0][0]=1;
    dp[1][0][0][1]=1;
    dp[1][0][1][0]=1;
    dp[1][0][1][1]=1;

    dp[1][1][0][0]=0;
    dp[1][1][0][1]=1;
    dp[1][1][1][0]=0;
    dp[1][1][1][1]=1;

    for(int i=2;i<maxn;i++)
    {
        for(int j=0;j<=i;j++)
        {
            for(int x=0;x<=1;x++)
            {
                for(int y=0;y<=1;y++)
                {
                    dp[i][j][x][y]=dp[i-1][j][1][x];
                    if(j){
                        if(y){
                            dp[i][j][x][y]+=dp[i-1][j-1][1][x];
                            if(dp[i][j][x][y]>=mod) dp[i][j][x][y]-=mod;
                        }
                        dp[i][j][x][y]+=dp[i-1][j-1][0][x];
                        if(dp[i][j][x][y]>=mod) dp[i][j][x][y]-=mod;
                    }
                    if(i<=3){
                        ;//printf("%d %d %d %d %d\n",i,j,x,y,dp[i][j][x][y]);
                    }
                }
            }
        }
    }
}
long long cuo[maxn];
int main()
{
    pre();
    int n,k;
    scanf("%d%d",&n,&k);
    memset(cuo,0,sizeof(cuo));
    cuo[0]=1;
    long long ans=fac[n];
    for(int i=1;i<=k;i++)
    {
        int t=(n-i)/k+1;
        for(int j=n;j>=0;j--)
        {
            int tmp=min(j,t);
            for(int k=1;k<=tmp;k++)
            {
                cuo[j]=(cuo[j]+cuo[j-k]*dp[t][k][1][0])%mod;
            }
        }
    }
//    for(int i=1;i<=n;i++)
//        printf("%lld\n",cuo[i]);
//    printf("\n");
    for(int i=1;i<=n;i++)
    {
        if(i&1) ans=ans-fac[n-i]*cuo[i]%mod;
        else ans=ans+fac[n-i]*cuo[i]%mod;
    }
    ans=(ans%mod+mod)%mod;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 63232
def examC():
    N= I()
    A = LI()
    cur = 0
    for i in A:
        while(True):
            if i % 2 == 0:
                i //= 2
                cur += 1
            else:
                break
    print(cur)



import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 40432
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        a: [i32; n],
    }
    let mut v = vec![];
    let mut tmp = 0;
    for i in 1..101 {
        for x in &a {
            tmp += (x - i) * (x - i)
        }
        v.push(tmp);
        tmp = 0;
    }

    let ans = v.iter().min().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x,y;
  bool operator < (const P &a )const{
    //if(y!=a.y)
    return y>a.y;
  };

};

int a,b,c,d,i,n,m,e,k,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
long long o[2][5010];
long long l[5010];
long long s[5010];
long long x,y,z,mod=1000000007,hf=(mod+1)/2;

//string r,r1;
char r[361];
vector<int> v[200101];
P u[1];
queue<int> q;
//set<int> s[2];
//stack<int> s;
map<int,int> p;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//rng()
bool as(P a,P b)
{
  return a.x<b.x;
}

long long g(int n)
{
  if(n<0) return 0;
  if(n==0) return 1;
  if(s[n]>=0) return s[n];
  long long k=g(n-1);
  for(int t=b+1;t<=n;t++)
    k=(k+g(n-t))%mod;
  return s[n]=k;
}

long long f(int i,int n)
{
  if(n<0) return 0;
  if(n==0) return 1;
  if(o[i][n]>=0) return o[i][n];
  long long k=0;
  if(i)
  {
    for(int t=1;t<b;t++)
      k=(k+f(0,n-t))%mod;
  }
  else
  {
    //k=f(1,n-1);
    for(int t=1;t<c;t++)
    {
      int e=1;
      if(n==a) e--;
      if(n-t==0) e--;
      k=(k+f(1,n-t)*g(t-e)%mod)%mod;
    }
    
  }
  return o[i][n]=k;
}

int main()
{
  memset(s,-1,sizeof(s));
  memset(o,-1,sizeof(o));
  l[1]=l[2]=1;
  scanf("%d %d %d",&a,&b,&c);
  if(b>c) swap(b,c);
  /*for(int t=3;t<c;t++)
  {
    l[t]=g(t-1);
    printf("%lld\n",l[t]);
  }*/
  x=1;
  for(int t=1;t<=a;t++)
    x*=2,x%=mod;
  printf("%lld",(x-f(0,a)-f(1,a)+mod*2)%mod);
}



Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    cout << u << endl;
    return u;
}

 
int main() {
   
    string s;
    int k;
    cin >> s >> k;
    vector<string> x;
    vector<string> y;
    REP(i, s.size()){
        FOR(j, 0, 5){
            if(i + j < s.size())
            x.push_back(s.substr(i, j+1));
        }
    }
    sort(x.begin(),x.end());
    // REP(i, x.size()){
    //     cout << x[i] << endl;
    // }

    REP(i, x.size()){
        if(i == 0) y.push_back(x[i]);
        else {
            if(x[i] != y[y.size()-1]){
                y.push_back(x[i]);
            }
        }
    }
    cout << y[k-1] << endl;
}



Measured memory_bytes: 5120
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Silviase
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

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

class

DPartition {
public:

    void solve(std::istream &in, std::ostream &out) {
        // ここで素数判定までしたければ√mまでやればいいことがわかるので十分間に合う
        // 相手がn以上である最大の数ならよい
        int n, m, k;
        in >> n >> m;
        k = 0;
        rep(i, sqrt(m) + 1) {
            if (i == 0) {
                continue;
            }
            if (m % i == 0) {
                int a = i;
                int b = m / i;
                if (a <= m / n) {
                    k = max(k, a);
                }
                if (b <= m / n) {
                    k = max(k, b);
                }
            }
        }
        out << k << endl;
    }

};


int main() {
    DPartition solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
n,*a=map(int,open(0).read().split())
c=0
def IS(a,n,g):
    for i in range(g,n):
        v=a[i]
        j=i-g
        while j>=0 and a[j]>v:
            a[j+g]=a[j]
            j=j-g
            global c
            c+=1
        a[j+g]=v
G=sorted(set([1+(3**i-3)//2 for i in range(1,100)if 1+(3**i-3)//2<n]+[1]))[::-1]
for i in range(len(G)):
    IS(a,n,G[i])
print(len(G))
print(*G)
print(c)
for i in range(n):
    print(a[i])


Measured memory_bytes: 120712
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports)]

use std::cmp::*;
use std::collections::*;

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        N : usize,
        Q : usize,
        S : chars,
        LR : [(usize1, usize1); Q]
    }
    let mut counts = vec![0];
    for n in 1..N {
        let temp = *counts.last().unwrap();
        if S[n - 1] == 'A' && S[n] == 'C' {
            counts.push(temp + 1);
        } else {
            counts.push(temp);
        }
    }
    //println!("{:?}", counts);
    for lr in LR {
        let (l, r) = lr;
        let mut count = counts[r] - counts[l];
        println!("{}", count);
    }
}


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

typedef long long ll;
typedef unsigned long long ull;

int idx(int c3, int c2, int c1){
    return c3 * 301*301 + c2 * 301 + c1;
}

int N;
unordered_map<int,double> mem;

double solve(int c3, int c2, int c1){
    if(c1<0 || c2<0 || c3<0) return 0;
    if(mem[idx(c3,c2,c1)] != 0) return mem[idx(c3,c2,c1)];
    double r = (double)N/(double)(c1+c2+c3) + solve(c3-1, c2+1, c1)*c3/(c1+c2+c3) + solve(c3, c2-1, c1+1)*c2/(c1+c2+c3) + solve(c3, c2, c1-1)*c1/(c1+c2+c3);
    mem[idx(c3,c2,c1)] = r;
    return r;
}

int main(){
    mem[idx(0,0,0)] = -1e-10;
    cin >> N;
    int a[300];
    for(int i=0;i<N;i++) cin >> a[i];
    int cnt[4] = {0,0,0,0};
    for(int i=0;i<N;i++) cnt[a[i]]++;

    printf("%.12f\n",solve(cnt[3], cnt[2], cnt[1]));
    
    return 0;
}

Measured memory_bytes: 239576
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
using namespace std;
int n,k,ans,m;
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1,j;i<=n;i++) scanf("%d",&j);
	k--;n--;
	if(n%k==0)printf("%d",n/k);
	else printf("%d",n/k+1);
	return 0;
} 

Measured memory_bytes: 128
import math
k = int(input())
ans = 0
list_gcd = [[0]*202 for _ in range(202)]

for i in range(1, 201):
    for j in range(i, 201):
        num = math.gcd(i, j)
        list_gcd[i][j] = num
        list_gcd[j][i] = num

ans = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        for l in range(1, k+1):
            num = list_gcd[i][j]
            ans += list_gcd[num][l]

print(ans)

Measured memory_bytes: 9488
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define first fi;
#define second se;
using namespace std;
typedef pair<int, int> P;

int r[16][16][16][260];
int mod = 256;

signed main(){
    int n;
    rep(s, 0, 16){
        rep(a, 0, 16){
            rep(c, 0, 16){
                r[s][a][c][0] = s;
                rep(i, 1, 260){
                    r[s][a][c][i] = (a * r[s][a][c][i - 1] + c) % mod;
                }
            }
        }
    }
    while(cin >> n, n){
        vector<int> d(n);
        rep(i, 0, n) cin >> d[i];
        int sa = -1, aa = -1, ca = -1;
        double MIN = 1e12;
        rep(s, 0, 16){
            rep(a, 0, 16){
                rep(c, 0, 16){
                    double h = 0.0;
                    vector<int> after(256, 0);
                    rep(i, 0, n){
                        int tmp = (d[i] + r[s][a][c][i + 1]) % mod;
                        after[tmp]++;
                    }
                    rep(i, 0, 256){
                        if(after[i] == 0) continue;
                        double tmp = (double)(after[i]) / (double)(n);
                        h -= tmp * log10(tmp);
                    }
                    if((h - MIN) < -1e-9){
                        MIN = h;
                        sa = s;
                        aa = a;
                        ca = c;
                    }
                }
            }
        }
        cout << sa << " " << aa << " " << ca << endl;
    }
}

Measured memory_bytes: 11592
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..1 << n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    // i, jはkの部分集合
    // 部分集合を二つ選び、和を最大化

    let mut ans = vec![0; 1 << n];
    for bit in 1..1 << n {
        let mut i = bit;
        let mut first = 0;
        let mut second = 0;
        loop {
            if a[i] > first {
                second = first;
                first = a[i];
            } else if a[i] > second {
                second = a[i];
            }
            if i == 0 {
                break;
            }
            i = (i - 1) & bit;
        }
        ans[bit] = first + second;
    }
    for i in 1..1 << n {
        ans[i] = max(ans[i], ans[i - 1]);
    }

    let mut out = Vec::new();
    for i in 1..1 << n {
        writeln!(out, "{}", ans[i]).ok();
    }
    stdout().write_all(&out).unwrap();
}


Measured memory_bytes: 12860
#include <bits/stdc++.h>
using namespace std;
#define md 1000000007
#define mem(arr, x) memset(arr, x, sizeof(arr))
#define fio()                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);
#define pb push_back
#define vi vector<lli>
#define vvi vi<vi>
typedef long long int lli;
typedef float fl;
int main()
{
	lli t;
	//cin >> t;
	//while (t--)
	{
		string s;
		cin >> s;
	lli n = s.length() - 1;
	cout << s;
	if ( s[n] == 's') 
	cout << "es";
	else cout << "s" ;
	

	}
}

Measured memory_bytes: 3628