akhauriyash/Code-Regression huggingface dataset:
L, R = map(int, input().split())
U = [0]*2019
for i in range(L, min(L+2019, R)+1):
    U[i % 2019] = 1
ans = 10**18
for i in range(2019):
    if not U[i]:
        continue
    for j in range(i+1, 2019):
        if not U[j]:
            continue
        ans = min(ans, (i*j) % 2019)
print(ans)


Measured memory_bytes: 41964
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,x;
	cin>>a>>b>>x;
	double depth;
	depth=x*1.0000000000/(a*a*1.0000000000);
	double degree;
	if(depth>=b*1.0000000000/2)
	degree=180*(atan((2*(x-(b-(a*a*b*1.0000000000-a*a*depth*1.0000000000)/(a*a*1.0000000000)*2.0000000000)*a*1.0000000000*a)/(a*1.0000000000*a))/(a*1.0000000000))/3.1415926535897);
	else
	{
		double c=x*1.0000000000*2/(b*1.0000000000)/a;
		degree=180*(atan(b*1.0000000000/c)/3.1415926535897);
	}
	printf("%.10f",degree);
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

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

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	a := scanInts(n)

	const M = 1000001
	var e [M]bool
	for i := range e {
		e[i] = true
	}
	sort.Ints(a)

	for i := 0; i < n; i++ {
		if i > 0 && a[i] == a[i-1] {
			continue
		}
		for j := 2 * a[i]; j < M; j += a[i] {
			e[j] = false
		}
	}

	var cnt int
	for i := 0; i < n; i++ {
		if i > 0 && a[i] == a[i-1] {
			continue
		}
		if i < n-1 && a[i] == a[i+1] {
			continue
		}
		if e[a[i]] {
			cnt++
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 6096
#include <stdio.h>

int main() {
	double w;

	while(scanf("%lf", &w) != EOF) {
		if(w > 91.00)
			printf("heavy\n");
		else if(w > 81.00)
			printf("light heavy\n");
		else if(w > 75.00)
			printf("middle\n");
		else if(w > 69.00)
			printf("light middle\n");
		else if(w > 64.00)
			printf("welter\n");
		else if(w > 60.00)
			printf("light welter\n");
		else if(w > 57.00)
			printf("light\n");
		else if(w > 54.00)
			printf("feather\n");
		else if(w > 51.00)
			printf("bantam\n");
		else if(w > 48.00)
			printf("fly\n");
		else
			printf("light fly\n");
	}

	return 0;
}

Measured memory_bytes: 608
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define MOD 1000000007;

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> x(n);
	for(int i=0; i<n; i++)
		cin >> x[i];
	int ans=x[k-1]-x[0]+min(abs(x[0]),abs(x[k-1]));
	for(int i=1; k-1+i<x.size(); i++)
		ans=min(ans, x[k-1+i]-x[i]+min(abs(x[i]),abs(x[k-1+i])));
	cout << ans << endl;
	return 0;
}

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

using namespace std;

unsigned int parent(unsigned int it){ return it/2; }
unsigned int left(unsigned int it){ return it * 2; }
unsigned int right(unsigned int it){ return it * 2 + 1; }

int main(){
    unsigned int n;
    scanf("%d", &n);
    vector<int> bin_heap(n + 1);

    for(unsigned int i = 1; i <= n; i++){
        scanf("%d", &bin_heap[i]);
    }

    for(unsigned int i = 1; i <= n; i++){
        printf("node %d: key = %d, ", i, bin_heap[i]);
        if(i != 1){
            printf("parent key = %d, ", bin_heap[parent(i)]);
        }
        if(left(i) <= bin_heap.size() - 1){
            printf("left key = %d, ", bin_heap[left(i)]);
        }
        if(right(i) <= bin_heap.size() - 1){
            printf("right key = %d, ", bin_heap[right(i)]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 3236
while (n=gets.to_i) != 0 do
  puts n
  a = Array.new(n) {0}
  a[0] = n
  while a.last == 0 do
    i = a.index {|k| k == 1 || k == 0} - 1
    j = a.index {|k| k == 0} - 1
    a[i] -= 1
    if i == j
      a[i+1] += 1
    else
      l = j - i + 1
      m = 1
      a.fill(0,i+m)
      while l > 0 do
        a[i+m] = l > a[i] ? a[i] : l
        l -= a[i+m]
        m += 1
      end
    end
    puts (a.select {|k| k > 0}).join(" ")
  end
end

Measured memory_bytes: 9228
from collections import deque, defaultdict


def main():
    N, X, Y = map(int, input().split())
    g = [[] for _ in range(N)]
    for i in range(N-1):
        g[i].append(i+1)
        g[i+1].append(i)
    g[X-1].append(Y-1)
    g[Y-1].append(X-1)
    ans = defaultdict(int)

    for i in range(N):
        q = deque()
        q.append(i)
        visit_time = [0 for _ in range(N)]
        while len(q):
            v = q.popleft()
            time = visit_time[v]
            for j in g[v]:
                if visit_time[j] == 0 and j != i:
                    q.append(j)
                    visit_time[j] = time + 1
                else:
                    visit_time[j] = min(time + 1, visit_time[j])

        for v in visit_time:
            ans[v] += 1

    for i in range(1, N):
        print(ans[i] // 2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 54620
<?php
  $A = [];
  for ($i = 0; $i < 3; $i++) {
    $tmp = trim(fgets(STDIN));
    array_push($A, explode(' ', $tmp));
  }

  $N = trim(fgets(STDIN));

  for ($i = 0; $i < $N; $i++) {
    $tmp = trim(fgets(STDIN));
    for ($j = 0; $j < 3; $j++) {
      $idx = array_search($tmp, $A[$j]);
      if ($idx !== false) {
        $A[$j][$idx] = '-';
      }
    }
  }

  $out = 'No';
  // 横
  for ($i = 0; $i < 3; $i++) {
    if (implode($A[$i], '') === '---') {
      $out = 'Yes';
      break;
    }
  }
  if ($out === 'Yes') {
    echo $out;
    return;
  }
  // 縦
  for ($i = 0; $i < 3; $i++) {
    $tmp = '';
    for ($j = 0; $j < 3; $j++) {
      $tmp .= $A[$j][$i];
    }
    if ($tmp === '---') {
      $out = 'Yes';
      break;
    }
  }
  if ($out === 'Yes') {
    echo $out;
    return;
  }
  
  // 斜め
  $tmp = '';
  for ($i = 0; $i < $N; $i++) {
    $tmp .= $A[$i][$i];
    if ($tmp === '---') {
      $out = 'Yes';
      break;
    }
  }
  if ($out === 'Yes') {
    echo $out;
    return;
  }
  $tmp = '';
  for ($i = 0; $i < $N; $i++) {
    $tmp .= $A[$i][2-$i];
    if ($tmp === '---') {
      $out = 'Yes';
      break;
    }
  }
  
  echo $out;
  

Measured memory_bytes: 3828
#include <stdio.h>

int main() {
  int a;
  scanf("%d",&a);
  if(a <=3) {
    printf("1\n");
    return 0;
  }
  int ans = 4;
  for(int i = 2; i <= a; i++) {
    int tmp = i*i;
    while(tmp <= a) {
      tmp *= i;
    }
    if(tmp/i != i) ans = ans > tmp/i ? ans : tmp/i;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
    int N, K;
    cin >> N >> K;
    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = K + 1; i <= N; i++){
        if(A[i - 1] > A[i - K - 1]){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 4412
function main(input) {
  input = input.split(' ');
  var n = parseInt(input[0]);
  var m = parseInt(input[1]);
  for(var x = 0; x <= m; x += 10000) {
    for(var y = 0; y <= m - x; y += 5000) {
      var z = (m - x - y) / 1000;
      if (0 <= z && (x + y + (z * 1000 )) == m && ((x / 10000) + (y / 5000) + z) == n) {
        console.log(x / 10000 + ' ' + y / 5000 + ' ' + z);
        return;
      }
    }
  }
  console.log('-1 -1 -1');
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 9420
#include<iostream>
#include<math.h>
#include<string>
using namespace std;


int main(){
  string x, y;
  cin>>x>>y;
  bool state= true;
  if(x.length()==y.length()-1){
      for(int i=0; i<x.length(); i++){
          if(x[i]!=y[i]){
              state=false;
          }
          
      }
      if(state==true){
          cout<<"Yes\n";
      }
      else{
          cout<<"No\n";
      }
  }
  else{
      cout<<"No\n";
  }
  
  return 0;
}

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

void dfs(vector<int>*v, int start, bool *visited, vector<int> &vals)
{
    visited[start] = true;
    for(int i=0; i<v[start].size(); i++)
    {
        int des = v[start][i];
        if(!visited[des])
        {
            vals[des] += vals[start];
            dfs(v, des, visited, vals);
        }
    }
}

int main() {
	// your code goes here
	int n, q, src,des;
	cin>>n>>q;
	vector<int>v[n+1];
	vector<int>vals(n+1, 0);
	for(int i=0; i<n-1; i++)
	{
	    cin>>src>>des;
	    v[src].push_back(des);
	    v[des].push_back(src);
	}
	for(int i=0; i<q; i++)
	{
	    cin>>src>>des;
	    vals[src] += des;
	}
	bool visited[n+1];
	for(int i=0; i<=n; i++)
	    visited[i] = false;
	dfs(v, 1, visited, vals);
	for(int i=1; i<=n; i++)
	    cout<<vals[i]<<" ";
	return 0;
}


Measured memory_bytes: 26752
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
void solve(){
    ll x,y;
    cin>>x>>y;
    if(x==1 or y==1){
        cout<<1;
        return;
    }
    cout<<((x*y)+1)/2;
}
    
int main(){
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
n = int(input())
min_r = int(input())
max_r = -1e10
for _ in range(n - 1):
    r = int(readline())
    if max_r < r - min_r:
        max_r = r - min_r
    if min_r > r:
        min_r = r
print(max_r)



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

#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
const int mod = 1e9 + 7, size = 1e6 + 1;

int main()
{
    fast

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

    int ans = t;
    while (n > 0) {
        n -= x;
        ans += t;
    }

    cout << ans - t << endl;
}
// () ! # &


Measured memory_bytes: 3644
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		scan.close();
		if(a < b && b < c && a < c) {
			System.out.println("Yes");
			
		}else {
			System.out.println("No");
		}
		
		// TODO 自動生成されたメソッド・スタブ

	}

}



Measured memory_bytes: 26168
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a,b;
    cin >> a >> b;
    vector<vector<char>> v(a,vector<char>(b));
    rep(i,a){
        rep(j,b){
            cin>>v[i][j];
        }
    }
    bool w;
    int dx[4]={-1,0,1,0};
    int dy[4]={0,-1,0,1};
    rep(i,a){
        rep(j,b){
            if(v[i][j]=='#'){
                w=false;
                rep(k,4){
                    if(i+dy[k]>=0&&i+dy[k]<a&&j+dx[k]>=0&&j+dx[k]<b){
                        if(v[i+dy[k]][j+dx[k]]=='#'){
                            w = true;
                        }
                    }
                }
                if(!w){
                    cout << "No";
                    return 0;
                }
            }
        }
    }

    cout << "Yes";

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

 public static void main(String args[]) {

  Scanner sc = new Scanner(System.in);
  String s = sc.next();
  String[] a = s.split("");
  long k = sc.nextInt();
   
   int len = a.length;

   
   long result = 0;

   
   if(len == 1){
     result = k/2;
   }
   else
   {
     
     boolean flg = true;
     boolean firstFlg = true;
     int firstCount = 0;
     int count = 1;
     for (int i = 1; i < len;){
       count = 1;
       flg = true;
         
       while(flg){
       
         if(a[i - 1].equals(a[i])){
           count++;
           if(len - 1 == i){
             result += (count/2) * k;
             flg = false;
           }
         }else{
           result += (count/2) * k;
           flg = false;
         }
         
         i++;
       } 
       
       if(firstFlg){
         firstCount = count;
         firstFlg = false;
       }
     }
     
       
     if(count % 2 == 1 && firstCount % 2 == 1)
     {  
       
       if(firstCount == len)
       {
         
         result += k/2;
       }else{
       
       String f = a[0];
       String l = a[len - 1];
     
       if (f.equals(l)){
         result += k - 1;
       }
       }
       
     }
     
   }
     System.out.println(result);
 }
}

Measured memory_bytes: 23764
# -*- coding: utf-8 -*-

# input
A, B = map(int, input().split())
S = input()

# solve
ans = True
for i in range(A + B + 1):
    if i == A:
        if S[A] != '-':
            ans = False
            break
    else:
        if not S[i].isdigit():
            ans = False
            break

# output
print('Yes' if ans else 'No')


Measured memory_bytes: 2940
n = gets.to_s.to_i
a = [0] + gets.to_s.split.map{|i| i.to_i }

(n/2).downto(1) do |i|
  s = 0
  i.step(n,i).each{|j| s += a[j] }
  a[i] = s % 2
end

ans = (1..n).select{ |i| a[i] == 1 }
puts ans.size, ans * " "

Measured memory_bytes: 24316
/* ~ Programmer >> Tushar Mahajan */
#include <iostream>
#include <bits/stdc++.h> 
using namespace std;
#define ll long long int
#define ld long double
#define MOD 1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL); 

int main() {
	ios;
	ll n;
	cin>>n;
	if(n%1000==0)
	{
	    cout<<0<<endl;
	}
	else
	{
	    n = n%1000;
	    cout<<abs(1000-n)<<endl;
	}
	return 0;
}


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

using namespace std;

void elem_swap(int& a, int& b) {
	int temp = a;
	a = b;
	b = temp;
}

inline bool isParent(int idx) { if (idx == 0) return false; else return true; }
inline bool isLeft_child(int size, int idx) { if ((idx + 1) * 2 > size) return false; else return true; }
inline bool isRight_child(int size, int idx) { if ((idx + 1) * 2 + 1 > size) return false; else return true; }

inline int get_nodekey(vector<int> & vec, int idx) { return vec.at(idx); }
inline int idx_parent(int node_num) { return node_num / 2 - 1; }
inline int get_parent(vector<int> & vec, int idx) { return vec.at(idx_parent(idx + 1)); }
inline int idx_left_child(int node_num) { return node_num * 2 - 1; }
inline int get_left_child(vector<int> & vec, int idx) { return vec.at(idx_left_child(idx + 1)); }
inline int idx_right_child(int node_num) { return node_num * 2; }
inline int get_right_child(vector<int> & vec, int idx) { return vec.at(idx_right_child(idx + 1)); }
//ヒープを操作する関数に入れる前にindexを変換する
inline int idxToheap(int index) { return index + 1; }
//実際の配列を操作するときにindexに変換
inline int heapToidx(int hnum) { return hnum - 1; }


void maxHeapify(vector<int> & vec, int idx) {
	if (isRight_child(vec.size(), idx)) {
		int left = vec.at(idx_left_child(idx + 1));
		int right = vec.at(idx_right_child(idx + 1));
		if (left <= vec.at(idx) && right <= vec.at(idx)) return;
		else if (left > vec.at(idx) && left > right) {
			elem_swap(vec.at(idx), vec.at(idx_left_child(idx + 1)));
			maxHeapify(vec, idx_left_child(idx + 1));
		}
		else {
			elem_swap(vec.at(idx), vec.at(idx_right_child(idx + 1)));
			maxHeapify(vec, idx_right_child(idx + 1));
		}
	}
	else if (isLeft_child(vec.size(), idx)) {
		if (vec.at(idx) < vec.at(idx_left_child(idx + 1))) elem_swap(vec.at(idx), vec.at(idx_left_child(idx + 1)));
	}
	else return;

}

void buildMaxHeap(vector<int> & vec) {
	for (int i = vec.size() / 2; i >= 0; i--) maxHeapify(vec, i);
}


int main(void) {

	int size;
	cin >> size;
	vector<int> vec(size);
	for (int i = 0; i < size; i++) cin >> vec.at(i);
	buildMaxHeap(vec);
	for (int i = 0; i < size; i++) cout << " " << vec.at(i);
	cout << endl;
	return 0;
}



Measured memory_bytes: 4596
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef pair<int ,int > P;
typedef long long ll;

int A,B,C,N,W,H,ans,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){

}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> A >> B >> C;
	if(B-A == C-B){
		cout << "YES\n";
	}else{
		cout << "NO\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n,m,k;
  cin>>n>>m>>k;

  for (int i = 0; i <= n; ++i)
  {
    for (int j = 0; j <= m; ++j)
    {
      int tmp=m*i+n*j-2*i*j;
      if(k==tmp){
        cout<<"Yes";
        return 0;
      }
    }
  }
  cout<<"No";
  return 0;
}

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

int main(){
    while (1){
        int n, nmn, nmx;
        cin >> n >> nmn >> nmx;
        if (n == 0) break;
        vector<int> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];
        int ans = - 1;
        int tmp = - 1;
        for (int i = nmn - 1; i < nmx; i++){
            if (a[i] - a[i + 1] >= tmp) {
                tmp = a[i] - a[i + 1];
                ans = i + 1;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3056
#include <stdio.h>

int main(){
    int n, k, s;
    scanf("%d%d%d", &n,&k,&s);
    for(int i = 0; i < k; i++){
        printf("%d ", s);
    }
    for(int i = k; i < n; i++){
        if(s == 1000000000) printf("%d ", s-1);
        else printf("%d ", s+1);
    }
    return 0;
    
}

Measured memory_bytes: 1280
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_C
// Dynamic Programming - Longest Common Subsequence

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>
#include <memory>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const ui64 MAX_N = 1000;
ui64 dp[MAX_N + 1][MAX_N + 1];

ui64 compute_lcs(string x, string y) {
    memset(dp, 0, sizeof(dp));

    for (int i = 0; i < x.length(); ++i) {
        for (int j = 0; j < y.length(); ++j) {
            if (x[i] == y[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
            else dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
        }
    }

    return dp[x.length()][y.length()];
}

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

    string x, y;
    for (int i = 0; i < n; ++i) {
        cin >> x >> y;
        cout << compute_lcs(x, y) << endl;
    }

    return 0;
}


Measured memory_bytes: 11000
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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 main() {
	//sc.Split(bufio.ScanWords)

	reader := bufio.NewReaderSize(os.Stdin, 100000)
	s, _, _ := reader.ReadLine()

	c := s[0]
	cnt := 0
	for i := 1; i < len(s); i++ {
		if c != s[i] {
			cnt++
		}
		c = s[i]
	}

	out(cnt)
}


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

using namespace std;

int main() {
	static bool cmp[1000000] = { true };
	static int npr[1000000];
	for (int i = 2; i<1000000; i++) {
		if (!cmp[i]) {
			for (int j = 2; j*i<1000000; j++) {
				cmp[i*j] = true;
			}
		}
		npr[i] = npr[i - 1] + !cmp[i];
	}
	for (int n; cin >> n; n++) {
		cout << npr[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 6044
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int n;
		cin>>n;
		vector<pair<int,int>> a[n];
		rep(i,0,n){
			int p;
			cin>>p;
			rep(j,0,p){
				int x,y;
				cin>>x>>y;
				a[i].pb({x,y});
			}
		}
		int ans = 0;
		int honest[n];
		rep(i,0,power(2,n,INF)){
			rep(j,0,n) honest[j] = -1;
			bool wrong=0;
			int r=0;
			rep(j,0,n){
				if((i&(1<<j))){
					r++;
					for(auto k:a[j]){
						if(honest[k.fr-1]==-1){
							honest[k.fr-1]=k.sc;
						}
						else{
							if(honest[k.fr-1]!=k.sc){
								wrong = 1;
							}
						}
					}
				}
			}	
			// trace(wrong);
			// trace(1,i);
			rep(j,0,n){
				if(honest[j]==-1) continue;
				if(honest[j]!=__builtin_popcount((i&(1<<j)))){
					// trace(honest[j],(i&(1<<j)), i);
					wrong=1;
				}
			}
			if(wrong==0){
				ans = max(ans, r);
			}
		}
		cout<<ans;
	}   
}     

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int Q; cin >> Q;
	rep(i, 0, Q) {
		int c, a, n; cin >> c >> a >> n;
		int cnt = 0;
		while (true) {
			if (c&&a&&n) {
				c--; a--; n--;
			}
			else if (c >= 2 && a) {
				c -= 2; a--;
			}
			else if (c >= 3) {
				c -= 3;
			}
			else {
				break;
			}
			cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> l(q), r(q);
    rep(i,q) {
        cin >> l[i] >> r[i];
        l[i] --; r[i] --;
    }
    vector<int> mp;
    rep(i,n-1) {
        if (s[i] == 'A' && s[i+1] == 'C') {
            mp.push_back(i);
        }
    }
    rep(i,q) {
        int li = lower_bound(mp.begin(), mp.end(), l[i]) - mp.begin();
        int ri = upper_bound(mp.begin(), mp.end(), r[i]-1) - mp.begin();
        cout << ri - li << "\n";
    }
    return 0;
}


Measured memory_bytes: 4524
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

const int mod = 1000000007;
//const int mod = 998244353;

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

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

mint fn(int n)
{
	if (n == 0) return 1;

	mint ret;
	ret = fn(n / 2);
	if (n == 1) {
		ret *= 2;
	}
	else {
		ret *= ret;
		if (n % 2 == 1) ret *= 2;
	}

	return ret;
}

mint choose (ll n, int a){
	mint up = 1;
	mint lw = 1;
	for (int i = 0; i < a; ++i) {
		up *= (n - i);
		lw *= (a - i);
	}
	return up /= lw;
}

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

	mint ans = fn(n);
	ans -= 1;
	ans -= choose(n, a);
	ans -= choose(n, b);

	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 3648
S=input()
N=len(S)
M=(N-1)//2
def iskaibun(T):
    K=len(T)
    for i in range(K):
        if T[i]==T[-i-1]:
            pass
        else:
            return False
    return True

if iskaibun(S) and iskaibun(S[:M]) and iskaibun(S[M+1:]):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 61964
#include <iostream>
#include <cstring>
#include <vector>
#define MAX 20

using namespace std;

int main(){
  int N,M,T = 1;

  while(cin >> N >> M , N | M){
    int cnt = 0;
    vector<int> res(M+1,0);
    res[0] = N;

    while(true){
      vector<int> tmp(M+1,0);

      if(res[M]) break;  
      cnt++;      

      for(int i = 0 ; i < M ; i++){
	if(res[i] >= 2){
	  tmp[i+1] += res[i] / 2;
	  tmp[0] += res[i] / 2;
	  if(res[i] % 2) tmp[i]++;
	}
	else
	  tmp[i] += res[i];
      }

      res = tmp;
    }

    cout << "Case " << T++ << ": ";
    cout << cnt << endl;
  }

  return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a[3][3], n, bingo = 0;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }
    cin >> n;
    int b[n];
    for (int l = 0; l < n; l++) {
        cin >> b[l];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (a[i][j] == b[l]) a[i][j] = 0;
            }
        }
    }
    for (int i = 0; i < 3; i++) {
        if (a[i][0] == a[i][1] && a[i][0] == a[i][2]) bingo++;
    }
    for (int i = 0; i < 3; i++) {
        if (a[0][i] == a[1][i] && a[0][i] == a[2][i]) bingo++;
    }
    if (a[0][0] == a[1][1] && a[0][0] == a[2][2]) bingo++;
    if (a[0][2] == a[1][1] && a[0][2] == a[2][0]) bingo++;
    cout << (bingo == 0 ? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
a=[-1]*n
v=[0]*n
f=0
for _ in range(m):
	s,c=map(int,input().split())
	if(v[s-1]==0 or a[s-1]==c):
		v[s-1]=1
		a[s-1]=c
	else:
		f=1
s1='a'
if n!=1 and a[0]==-1:
	a[0]=1
for x in a:
	if x==-1:
		x=0
	s1+=str(x)
if f==1 or (n!=1 and s1[1]=='0'):
	print(-1)
else:
	print(s1[1:])


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

int main() {
  string S;
  cin >> S;
  if(S == "Sunny") {
    cout << "Cloudy" << endl;
  }
  else if(S == "Cloudy") {
    cout << "Rainy" << endl;
  }
  else {
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> H(N);
  for (int i = 0; i < N; i++){
    cin >> H[i];
  }
  vector<bool> good(N, true);
  for (int i = 0; i < M; i++){
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    if (H[A] >= H[B]){
      good[B] = false;
    }
    if (H[B] >= H[A]){
      good[A] = false;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++){
    if (good[i]){
      ans++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    for(int i = 0; i < N; i++) {
        cin >> P.at(i);
    }
    int count = 1;
    int last = 0;
    for(int i = 1; i < N; i++) {
        if(P.at(i) < P.at(last)) {
            count++;
            last = i;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

#define mod 1000000007LL
#define eps 0.0001
#define pi acos(-1)
#define INF 10000000000000000

#define rep(i, n) for(int i = 0;i < n;++i)
#define rep1(i, n) for(int i = 1;i < n;++i)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define chmin

#define lset(h, n) memset(h, n, sizeof(h));
    

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // ---------------------
    // コーディング開始
    // ---------------------
    int d,g;
    cin >> d >> g;

    int p[d];
    int c[d];
    rep(i,d){
        cin >> p[i] >> c[i];
    }
    
    int ans = 100000;
    for(int i=0;i < (1<<d);i++){
        int point =0;
        int count =0;
        int nuse = 0;
        for(int j=0;j<d;j++){
            if(i&(1<<j)){
                point += p[j]*(j+1)*100;
                point += c[j];
                count += p[j];
            } else {
                nuse = j;
            }
        }
        if(point < g){
            int plusans = ((g - point)+((nuse+1)*100)-1)/((nuse+1)*100);
            if (plusans<p[nuse]){
                count += plusans;
                ans = min(ans,count);
            }
        } else {
            ans = min(ans,count);
        }
    }
    pri(ans);
}











Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
const int N=10000010;
int n;
int fac[N],inv[N],ci[N];
const long long mod=998244353;
 
long long ksm(long long x,long long t){
	long long tot=1;
	while(t){
		if(t&1) (tot*=x)%=mod;
		(x*=x)%=mod;
		t/=2;
	}
	return tot;
}
 
long long C(int x,int y){
	return 1ll*fac[x]*inv[y]%mod*inv[x-y]%mod;
}
 
int main(){
	scanf("%d",&n);
	long long tot=0;
	fac[0]=ci[0]=1;for(int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod,ci[i]=ci[i-1]*2%mod;
	inv[n]=ksm(fac[n],mod-2);for(int i=n-1;i>=0;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;
	for(int i=n/2+1;i<=n;i++) tot+=C(n,i)*ci[n-i]%mod;
	printf("%lld\n",(ksm(3,n)-tot*2%mod+mod)%mod);
}
/*
————————————————
版权声明：本文为CSDN博主「Deep_Kevin」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
原文链接：https://blog.csdn.net/Deep_Kevin/java/article/details/102900391
*/

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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define int long long

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;

/* main */
signed main(void)
{
    int n;
    cin >> n;
    vector<int> b;
    int a;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        b.emplace_back(a);
    }
    int pos = 0, ans = 0;
    for (int i = 0; i <= n * 2; i++)
    {
        ans++;
        if (b[pos] == 2)
        {
            break;
        }
        pos = b[pos] - 1;
    }
    if (ans >= n * 2)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1400
n, p = map(int, input().split())
even = 0
odd = 0
l = list(map(int, input().split()))
for i in l:
    if i%2 == 0: even+=1
    else: odd+=1

ans = 0
if p == 1 and odd == 0:
    print(ans)
elif p == 0 and even == 0 and odd < 2:
    print(ans)
else:
    f = [1 for i in range(51)]
    f[0] = 1
    f[1] = 1
    for i in range(2, 51):
        f[i] = i*f[i-1]
    partieO = [1 for i in range(51)]
    partieE = [1 for i in range(51)]
    partieO[0] = 1
    partieE[0] = 1
    for i in range(1, odd+1):
        partieO[i] = f[odd]/(f[i]*f[odd-i])
    for i in range(1, even+1):
        partieE[i] = f[even]/(f[i]*f[even-i])
    if p == 0:
        t = 0
        for i in range(even+1):
            for j in range(0, odd+1, 2):
                t += partieE[i]*partieO[j]
        print(int(t))
    else:
        t = 0
        for i in range(even+1):
            for j in range(1, odd+1, 2):
                t += partieE[i]*partieO[j]
        print(int(t))


Measured memory_bytes: 3064
/********   All Required Header Files ********/
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
 
using namespace std;
 
//All the Loops and defines required
typedef long long int ll;
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
// #define INFI 100000000000000
 
//All the declarations using typedef
typedef pair<ll, ll> PII;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<ll, ll> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int l;
typedef unsigned long int ul;
typedef unsigned long long int  ull;
 
const ll INFI = 1e18 + 7;


ll knapsack(ll n,ll w, ll weights[], ll values[],ll sum_values){
	
    ll dp[n+1][sum_values+1];
	
    for(ll i=0;i<=n;i++){
		for(ll j=0;j<=sum_values;j++)
			dp[i][j]=INFI;
	}
	
  for(ll i=0;i<n+1;i++)
		dp[i][0]=0;
	
    for(ll i=1;i<n+1;i++){
		for(ll j=sum_values;j>=0;j--){
                dp[i][j]=min(dp[i-1][j],dp[i-1][j-values[i]]+weights[i]);
		}
	}
  
	ll max_value;
	for(ll i=0;i<=sum_values;i++){
        if(dp[n][i]<=w)
            max_value=i;
	}
	return max_value;
}
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,w;
	cin>>n>>w;
	ll weights[n+1];
	ll values[n+1];
	for(ll i=1;i<=n;i++)
		cin>>weights[i]>>values[i];
	ll sum_values=0;
	for(ll i=1;i<=n;i++)
		sum_values+=values[i];
	ll res = knapsack(n,w,weights,values,sum_values);
	cout<<res;
	return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n];

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

    int min=1000000000;
    int count = 0;

    for(int i = 0; i < n; i++) {
        if(min > a[i]) {
            min = a[i];
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1024
from functools import reduce

g=lambda x,y:x*y
cv=lambda s:str(max([reduce(g,list(map(int,[s[:i],s[i:]]))) for i in range(1,len(s))]))

for _ in range(int(input())):
	c=0
	n=input()
	s=set()
	while 1:
		if len(n)==1:break
		if n in s:
			c=-1
			break
		s.add(n)
		n=cv(n)
		c+=1
	print(c)



Measured memory_bytes: 6284
import sys
input = sys.stdin.readline

S = input().rstrip()

if len(S) == 1:
    print(0)
else :
    S1 = S[0::2]
    S2 = S[1::2]

    p1 = len(S) - S1.count('1') - S2.count('0')
    p2 = len(S) - S1.count('0') - S2.count('1')

    if p1 > p2:
        print(p2)
    else:
        print(p1)


Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		int cnt = 0;
		for(int i = 0; i < 3; i++) {
			if(s.charAt(i) == '1')cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 21716
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    string s;
    cin >> n >> q >> s;
    s += "!";
    vector<int> cnt(n+2, 0);
    rep(i,n){
        cnt[i+1] = cnt[i];
        if(s[i] == 'A' && s[i+1] == 'C') cnt[i+1]++;
    }
    rep(i,q){
        int l, r;
        cin >> l >> r;
        --l; --r;
        int ans = cnt[r] - cnt[l];
        cout << ans << endl;
    }
	return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  vll l, r;
  rep(i,n){
    ll a; cin>>a;
    if(a<0){
      l.push_back(-a);
    }else{
      r.push_back(a);
    }
  }
  while(l.size()<n) l.push_back(INF);
  while(r.size()<n) r.push_back(INF);
  vsort(l);
  
  ll ans=INF;
  chmin(ans,l[k-1]);
  chmin(ans,r[k-1]);
  
  rep(i,k-1){
    chmin(ans,l[i]*2+r[k-i-2]);
  }
  rep(i,k-1){
    chmin(ans,r[i]*2+l[k-i-2]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2548
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
int main() {
	ll x;
	ll s(100);
	cin >> x;
	ll c = 0;
	while (x > s) {
		s *= 1.01;
		++c;
	}
	cout << c;
	return 0;
}

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

//英語を漢字に翻訳
#define 中心() main()
#define 返 return
#define 入力(a) cin >> a
#define 出力(a) cout << a << endl
#define 如果(a) if(a)
#define 他 else
#define 再帰(s,t) for(整数 s = 0; s < 整数(t); s += 1)
#define 場合(a) while(a)
#define 脱出 break
#define 絶対値(a) abs(a)

typedef int 整;
typedef long long 整数;
typedef string 文字;

整数 s;
文字 m;

整 中心(){
    入力(s);
    m = "";
    場合(s != 0){
        如果(s % 2 != 0){
            s -= 1;
            m = '1'+m;
        }
        他{
            m = '0'+m;
        }
        s /= -2;
    }
    如果(m == "") m = "0";
    出力(m);
    返 0;
}    

Measured memory_bytes: 632
#include<stdio.h>
int main()
{
	long long int i,n,sum=0,r,ara[3000];
    scanf("%lld",&n);
    
    for(i=0;i<n;i++){
    	scanf("%lld",&ara[i]);
    	sum=sum+ara[i];
    }
    
    r=sum-n;
    printf("%lld\n",r);
	
	return 0;
}

Measured memory_bytes: 2136
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    # 例えば、(A,B,C,D,E) = (5,3,4,2,6) だったら、D = 2の部分で絶対に人が詰まる
    # Dはボトルネック(一番処理がﾀﾞﾒ)
    # N = 100だとすると、最初にDに来てからはずっと2人ずつのせていく
    # 時間で言うと N // 2 = 50 分 かかる計算になる
    # しかし、全員ぴったりくるわけではないので、 (N + bottleneck - 1) // bottleneckにする
    # Dが一番小さいのだから、
    # Dにくるまでは、A,B,C の　3分
    # Dを過ぎてからはE の　1分
    # これは、ボトルネックがDの場合に限らない 合計で 4分
    n = int(input())
    bottleneck = float('inf')
    A = []
    for i in range(5):
        a = int(input())
        A.append(a)
    for i in range(5):
        bottleneck = min(bottleneck,A[i])
    #print(bottleneck)
    print((n + bottleneck - 1) // bottleneck + 4) # ボトネで処理するもの　と　来るまでと来た後　の合計

if __name__ == '__main__':
  main()


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

int h(int x) {
	int sum = 0;
	for (int i = x; i != 0; i--) {
		sum += i; 
	}
	return sum;
}

int main() {
	int a, b;
	cin >> a >> b;
	h(b - a);
	cout << h(b - a) - b << endl;
}

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


int main()
{
    int x;
    cin>>x;
    bool * dp = new bool[x+1]();
    dp[0] = true;
    for(int i=100;i<=x;i++)
    {
        if( i-100 >=0 )
            dp[i ] = dp[i ] || dp[i-100];
        if( i-101 >=0 )
            dp[i ] = dp[i ] || dp[i-101];
        if( i-102 >=0 )
            dp[i ] = dp[i ] || dp[i-102];
        if( i-103 >=0 )
            dp[i ] = dp[i ] || dp[i-103];
        if( i-104 >=0 )
            dp[i ] = dp[i ] || dp[i-104];
        if( i-105 >=0 )
            dp[i ] = dp[i ] || dp[i-105];
    }
    if( dp[x] )
        cout<<1;
    else cout<<0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

int main(){
    ll n, t;
    cin >> n >> t;

    ll a[n];
    rep(i, n)cin >> a[i];

    ll max_a[n];
    max_a[n-1] = a[n-1];

    for(ll i = n-2; i >= 0; --i){
        max_a[i] = max(max_a[i+1], a[i]);
    }

    ll ans = 0;
    ll mx = 0;
    rep(i, n-1){
        ll v = max_a[i+1] - a[i];

        if(mx < v)mx = v, ans = 1;
        else if(mx == v)ans++;
    }

    cout << ans << endl;
}

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

int main() {
    string odd, even;
    cin >> odd >> even;
    string pass;
    for (int i = 0; i < even.size(); i++){
        pass += odd.at(i);
        pass += even.at(i);
    }
    if (odd.size() > even.size()){
        pass += odd.at(odd.size() - 1);
    }

    cout << pass << endl;
}

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

typedef long long ll;

ll n, a, b;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> a >> b;

    cout << n / (a + b) * a  + min(n % (a + b), a) << endl;

    return 0;
}



Measured memory_bytes: 256