akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<bitset>
#include<functional>
#include<iterator>
#include<complex>
#include<fstream>
#include<random>
#include<ctype.h>
#include<stdio.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using PII = pair<ll, ll>;
using piii = pair<pii, pii>;
using Pi = pair<int, pii>;
using Graph = vector<vector<int>>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
bool check(int x, int y) {
	if (0 <= x && x<55 && 0 <= y && y<55)return true;
	else return false;
}
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;

//iの逆元mod inf
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const double PI = 3.14159265358979323846;
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
double Euclidean_distance(double x1, double y1, double x2, double y2) {
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

//素因数分解
map<int, int>prime_factor(int n) {
	map<int, int>res;
	for (int i = 2; i*i <= n; ++i) {
		while (n%i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1)res[n] = 1;
	return res;
}


ll powmod(ll a, ll k, ll mod) {
	ll ap = a, ans = 1;
	while (k) {
		if (k & 1) {
			ans *= ap;
			ans %= mod;
		}
		ap = ap * ap;
		ap %= mod;
		k >>= 1;
	}
	return ans;
}
ll invi(ll a, ll mod) {
	return powmod(a, mod - 2, mod);
}
#define PI 3.14159265358979323846  // 円周率
//逆元Aを足したときのmodで割った余りは
//+=invi(A)
//Yで割ることはY^(10^9+7)-2を掛けることは同値
///////////////////////////////////////

int main() {
	int n; cin >> n;
	ll a[100];
	vector<ll>v;
	int No = -1;
	REP(i, n) {
		cin >> a[i];
		if (a[i] == No)continue;
		No = a[i];
		v.push_back(a[i]);
	}
	ll ans = 1000;
	ll cnt = 0;
	int i = 0;
	int N = v.size();
	while (true) {
		if (i == N - 1) {
			ans += cnt * v[i];
			break;
		}
		else {
			if (v[i] < v[i + 1]) {
				cnt += (ans / v[i]);
				ans -= v[i] * (ans / v[i]);
				i++;
			}
			else {
				ans += v[i] * cnt;
				cnt = 0;
				i++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
	int n, k;

	scanf("%d%d", &n, &k);

	if (k == 1) {
		cout << 0 << endl;
	} else if (n < k) {
		cout << 1 << endl;
	} else {
		cout << n - k << endl;
	}

	return 0;
}

Measured memory_bytes: 256
<?php
$n = intval(fgets(STDIN));
$A = array_map("intval", explode(" ", trim(fgets(STDIN))));
$sum = 0;
foreach($A as $a){
  $sum^=$a;
}
foreach($A as $a){
  $ans[] = $sum^$a;
}
echo implode(" ", $ans);


Measured memory_bytes: 43080
//
// Created by yamunaku on 2019/10/19.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int a,b;
    cin >> a >> b;
    cout << max(0,a-2*b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Graph{
	private:
	int n;
	vvp g;
	public:
	vi DIJ(int s){
		priority_queue<P> q;
		vi d(n,inf);
		d[s]=0;
		q.push({0,s});
		while(!q.empty()){
			P p=q.top();
			q.pop();
			int v=p.second;
			if(d[v]<-p.first) continue;
			for(auto i:g[v]){
				int u=i.first,D=d[v]+i.second;
				if(d[u]>D){
					d[u]=D;
					q.push({-D,u});
				}
			}
		}
		return d;
	}
	Graph(int v){
		n=v;
		g=vvp(v);
	}
	void add_edge(int s,int t,int c){
		g[s].push_back({t,c});
		g[t].push_back({s,c});
	}
};

int n;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	while(1){
		int n,m;
		cin>>n;
		if(n==0) break;
		vi a(n);
		for(auto &i:a) cin>>i;
		cin>>m;
		const int M=101;
		vi b(M,inf);
		for(int i=0;i<m;i++){
			int x,y;
			cin>>x>>y;
			b[x-1]=min(b[x-1],y);
		}
		vi dp(n,inf);
		dp[n-1]=0;
		for(int i=0;i<M;i++){
			vi DP(n,inf);
			for(int j=0;j<n;j++) if(dp[j]<inf){
				int I=(j+1)%n;
				if(a[I]<=b[i]) DP[I]=min(DP[I],dp[j]);
				DP[0]=min(DP[0],dp[j]+1);
			}
			dp=DP;
//			for(auto j:dp) cout<<j<<' ';cout<<endl;
		}
		int res=inf;
		for(auto i:dp) res=min(res,i);
		cout<<res<<endl;
	}
}


Measured memory_bytes: 3220
package main

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

const MAX = 100000

type Queue struct {
	head      int
	tail      int
	container [MAX]int
}

func (q *Queue) push(n int) {
	q.container[q.tail] = n
	q.tail = (q.tail + 1) % MAX
}

func (q *Queue) pop() int {
	res := q.container[q.head]
	q.head = (q.head + 1) % MAX
	return res
}

func (q *Queue) isEmpty() bool {
	return q.head == q.tail
}

var sc = bufio.NewScanner(os.Stdin)
var route [][]int
var SEEN [MAX]bool
var GROUP [MAX]int

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

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

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

func bfs(start, group int) {
	que := Queue{}
	que.push(start)

	for !que.isEmpty() {
		id := que.pop()

		if SEEN[id] {
			continue
		}
		SEEN[id] = true
		GROUP[id] = group

		for _, next := range route[id] {
			que.push(next)
		}
	}
}

func main() {
	n, m := scanInt(), scanInt()
	route = make([][]int, n)
	for i := 0; i < m; i++ {
		s, t := scanInt(), scanInt()
		route[s] = append(route[s], t)
		route[t] = append(route[t], s)
	}

	for i := 0; i < n; i++ {
		if !SEEN[i] {
			bfs(i, i+1)
		}
	}

	w := bufio.NewWriter(os.Stdout)
	q := scanInt()
	for i := 0; i < q; i++ {
		s, t := scanInt(), scanInt()
		if GROUP[s] == GROUP[t] {
			fmt.Fprintln(w, "yes")
		} else {
			fmt.Fprintln(w, "no")
		}
	}
	w.Flush()
}



Measured memory_bytes: 9532
// AOJ 0600 Baumkuchen
// 2017.12.5 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

int a[100002], p[100002];
long long s[100002];

char buf[15], *bp;
int getint()
{
	int n = 0;
	while (*bp >= '0') n = (n<<3) + (n<<1) + (*bp++ & 0xf);
	return n;
}

int main()
{
	int n, i, ii, f;
	long long sum, l, m, r;

	fgets(bp=buf, 15, stdin), n = getint();
	for (sum = 0, i = 0; i < n; i++) {
		fgets(bp=buf, 15, stdin);
		sum += a[i] = getint();
	}
	
	l = 0, r = sum + 1;
	while (l + 1 < r) {
		m = (l+r) >> 1;
		for (i = 0; i < n; i++) {
			if (!i) s[i] = p[i] = 0;
			else p[i] = p[i-1] - 1, s[i] = s[i-1] - a[i-1];
			
			while (s[i] < m) {
				ii = i + p[i];
				if (ii >= n) ii -= n;
				s[i] += a[ii], p[i]++;
			}
		}
	
		for (f = 0, i = 0; i < n; i++) {
			ii = i + p[i];
			if (ii >= n) ii -= n;
			if (sum - s[i] - s[ii] >= m) { f = 1; break; }
		}
		if (f) l = m; else r = m;
    }
	printf("%lld\n", l);
	return 0;
}

Measured memory_bytes: 3384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int from = scanner.nextInt();
        int to = scanner.nextInt();

        if (from == 0 || to == 0 || from < 0 && to > 0) {
            System.out.println("Zero");
            return;
        }

        if (from > 0) {
            System.out.println("Positive");
            return;
        }
        int count = to - from;
        if (count % 2 == 0) {
            System.out.println("Negative");
        } else {
            System.out.println("Positive");
        }
    }
}

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

using namespace std;
#define all(a)a.begin(),a.end()
//using ll=long long;
//const int INF = 1<<30;
//const ll INFll =1LL<<62;
//const int mod= int(1e9)+7;
//using P = pair<ll,ll>;
//using ld=long double;

int main(){
    priority_queue<pair<int,int>>que;
    int n,k;cin >>n>>k;
    vector<int>a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    for (int i = 0; i <=k; ++i) {
        que.push({a[i], -i});
    }
    int now=1;
    vector<int>ans;
    while(ans.size()!=n-k){
        auto p=que.top();que.pop();
//        cout <<p.second<<endl;
        if(p.second<now){
            ans.push_back(p.first);
            now=p.second;
            que.push({a[k+ans.size()],-(k+ans.size())});
        }
    }
//    cout <<ans.size()<<endl;
    for (int i = 0; i < ans.size(); ++i) {
        cout <<ans[i];
    }
    cout <<endl;
    return 0;
}



Measured memory_bytes: 5656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    ll n,a,b;cin>>n>>a>>b;
    ll ans = 0;
    ll c = a+b;
    ll div = n / c;
    ll amari = n % c;
    ans = div * a;
    if(amari > a) ans+=a;
    else ans += amari;
    cout << ans <<endl;

    return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final int K = sc.nextInt();
		final int S = sc.nextInt();
		
		long count = 0;
		for(int i = 0; i <= K; i++){
			for(int j = 0; j <= K; j++){
				final int k = S - (i + j);
				
				if(0 <= k && k <= K){
					count++;
				}
			}
		}
		
		System.out.println(count);
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 8532
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 
   
int main(){
   int a,b;
   cin >> a >> b;
   if(a<=0 && b>=0)cout << "Zero" << endl;
   else if(a>0) cout << "Positive" << endl;
   else{
       if((b-a)%2==0)cout << "Negative"<< endl;
       else cout << "Positive" << endl;
   }
} 

Measured memory_bytes: 3624
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <map>

using namespace std;


int main(int argc, const char * argv[]) {

    int n;
    string s, a, b;
    
    cin >> n >> s;
    
    if(n % 2 == 1)
    {
        cout << "No" << endl;
        return 0;
    }
    
    for(int i=0; i<n/2; i++)
    {
        a += s[i];
    }
    
    for(int i=n/2; i<n; i++)
    {
        b += s[i];
    }
    
    if (a == b) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  VV<> s(m, V<>(n));
  for (int i = 0; i < m; ++i) {
    int k; cin >> k;
    while (k--) {
      int x; cin >> x, --x;
      s[i][x] = 1;
    }
  }
  V<> p(m); for (auto&& e : p) cin >> e;
  int res = 0;
  for (int bit = 0; bit < 1 << n; ++bit) {
    bool ok = true;
    for (int i = 0; i < m; ++i) {
      int c = 0;
      for (int j = 0; j < n; ++j) if (bit >> j & 1) {
        c += s[i][j];
      }
      if ((c & 1) != (p[i] & 1)){
        ok = false;
        break;
      }
    }
    res += ok;
  }
  cout << res << '\n';
}

Measured memory_bytes: 3676
#include <iostream>

using namespace std;

int main( void )
{
  int a, b;
  cin >> a >> b;
  if( a < b ){
    cout << "a < b" << endl;
  }else if( a > b ){
    cout << "a > b" << endl;
  }else{
    cout << "a == b" << endl;
  }
  return( 0 );
}

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

int main(){
    int A, B, C; cin >> A  >> B >> C;
    int M = max(A, max(B, C));
    if((3 * M - A - B - C)% 2 == 0){
        cout << (3 * M - A - B - C) / 2 << endl; 
    }else{
        cout << (3 * (M + 1) - A - B - C) / 2 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb(x) push_back((x))
#define line() cerr << "DEBUG @" << __LINE__ << endl;
#define debug(x) \
    cerr << "DEBUG @" << __LINE__ << " -> " << #x << " = " << x << endl;
using namespace std;

vector<int> m[(int) 1e6 + 1];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> v(n);
    for (int &x : v) cin >> x;
    const int mx = 1e6;
    vector<int> divisors(mx + 1);
    for (int i = 2; i <= 1000000; i++) {
        if (!divisors[i]) {
            for (int j = i; j <= 1000000; j += i) {
                divisors[j] = i;
            }
        }
    }
    bool pair_wise_coprime = true;
    bool gcd_is_one = true;

    for (int x : v) {
        int cur = x;
        set<int> q;
        while (cur != 1) {
            q.insert(divisors[cur]);
            cur /= divisors[cur];
        }
        for (int div : q) {
            auto &curr_map = m[div];
            curr_map.push_back(x);
            if (curr_map.size() > 1) pair_wise_coprime = false;
            if (curr_map.size() == n) gcd_is_one = false;
        }
    }
    if (pair_wise_coprime) {
        cout << "pairwise coprime\n";
        return 0;
    }
    if (gcd_is_one) {
        cout << "setwise coprime\n";
        return 0;
    }
    cout << "not coprime\n";
}


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

int main()
{
  int n;
  cin >> n;
  int x[n];
  double ave = 0.0;
  for (int i=0; i<n; i++) {
    cin >> x[i];
    ave += x[i];
  }
  ave /= n;
  int p;
  p = (int)ave;
  ave -= p;
  if (ave>0.5) p++;
  int sum = 0;
  for (int i=0; i<n; i++) {
    sum += (x[i] - p) * (x[i] - p);
  }
  cout << sum;
  return 0;
}


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

typedef struct{
    string S;
    int order;
}player;

// a->0 / b->1 / c->2
int CharToNum(char a){
  if(a=='a'){return 0;}
  else if(a=='b'){return 1;}
  else if(a=='c'){return 2;}
  return 4;
}

int main(){
  string Sa,Sb,Sc;
  cin >> Sa >> Sb >> Sc;
  player players[3] = {{Sa,0},{Sb,0},{Sc,0}};
  int next = 0;
  
  for(;;){
    if(players[next].order == players[next].S.length())break;
    players[next].order ++;
    next=CharToNum(players[next].S[players[next].order-1]);    
  }
  
  // result
  if(next==0){
    cout << "A" << endl;
  }else if(next==1){
    cout << "B" << endl;
  }else if(next==2){
    cout << "C" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>

void handan(int a, int b, int c)
{
	if (a*a == b*b + c*c)
		printf("YES\n");
	else
		printf("NO\n");
}
int main()
{
	int n;
	int a, b, c;

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d %d %d", &a, &b, &c);
		if (a > b&&a > c)
			handan(a, b, c);
		else if (b > a&&b > c)
			handan(b, c, a);
		else
			handan(c, a, b);
	}
	return 0;
}

Measured memory_bytes: 2472
#!/usr/bin/env python3

import sys


def LI():
    return list(map(int, sys.stdin.buffer.readline().split()))


def I():
    return int(sys.stdin.buffer.readline())


def LS():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()


def S():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8')


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


def SRL(n):
    return [list(S()) for i in range(n)]


def MSRL(n):
    return [[int(j) for j in list(S())] for i in range(n)]

# ----------------------------------------------------------------


def main():
    s = S()

    n = len(s)
    a1 = int((n - 1) / 2)
    a2 = int((n + 3) / 2 - 1)
    pow1 = s[:a1]
    pow2 = s[a2:]

    if s == s[::-1] and pow1 == pow1[::-1] and pow2 == pow2[::-1]:
        print("Yes")

    else:
        print("No")


main()


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


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    while( n>0){
        int t;
        cin >> t;
        a.at(n-1) = t ;
        n--;
    }
    double d =0;
    for( auto p : a)
    {
        d+= 1.0/ p;
    }
    cout << fixed << setprecision(10) << 1.0/d << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int n,k;

int main()
{
//fuck
	int n,k;
        cin>>n>>k;
	int ans=k;
	for (int i=1;i<n;i++)
	{
		ans*=k-1;
	} 
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = std::vector<int>;
using VI2D = std::vector<vector<int>>;
using VLL = std::vector<long long>;
using VLL2D = std::vector<vector<long long>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T, std::size_t N>
struct make_vector_type {
	using type =
		typename std::vector<typename make_vector_type<T, (N - 1)>::type>;
};

template <typename T>
struct make_vector_type<T, 0> {
	using type = typename std::vector<T>;
};

template <typename T, size_t N>
auto make_vector_impl(const std::vector<std::size_t>& ls, T init_value) {
	if constexpr(N == 0) {
		return std::vector<T>(ls[N], init_value);
	} else {
		return typename make_vector_type<T, N>::type(
			ls[N], make_vector_impl<T, (N - 1)>(ls, init_value));
	}
}

template <typename T, std::size_t N>
auto make_vector(const std::size_t (&ls)[N], T init_value) {
	std::vector<std::size_t> dimensions(N);
	for(int i = 0; i < N; i++) {
		dimensions[N - i - 1] = ls[i];
	}
	return make_vector_impl<T, N - 1>(dimensions, init_value);
}

template <typename T>
std::vector<T> make_vector(std::size_t size, T init_value) {
	return std::vector<T>(size, init_value);
}

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max<T>(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min<T>(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

template <typename T>
constexpr T cube(T x) {
	return x * x * x;
}

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

	ll result = 0;
	if(k % 2 == 0) {
		result += cube<ll>((n + (k / 2)) / k);
	}
	result += cube<ll>(n / k);
	cout << result << endl;
	return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip> // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <bits/stdc++.h>
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;

int main(void){

    int n;
    
    cin >> n;

    cout << n * (n+1) / 2 << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define lowbit(x) (x)&(-x)
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=a;i>=b;i--)
#define maxd 998244353
typedef long long ll;
const int N=3000;
const double pi=acos(-1.0);
int n,x;
ll c[3030][3030];

int read()
{
	int x=0,f=1;char ch=getchar();
	while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
	while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
	return x*f;
}

void init()
{
	rep(i,0,N)
	{
		c[i][0]=1;
		rep(j,1,i) c[i][j]=(c[i-1][j-1]+c[i-1][j])%maxd;
	}
}

ll solve(int n,int x)
{
	ll ans=0;
	if ((x%2==1) || (2*n<x)) ans=1;
	rep(s,n,2*n-1)
	{
		if (s<x) ans=(ans+c[n][s-n])%maxd;
		else
		{
			if ((s-x)%2==0) continue;
			int lft=(s-x+1)/2;
			if (lft*2<n)
			{
				ll restn=n-2*lft,rests=s-4*lft;
				if ((restn<=rests) && (rests<=2*restn)) ans=(ans+c[restn][rests-restn])%maxd;
			}
		}
	}
	return ans;
}

int main()
{
	init();ll ans=0;
	n=read();x=read();
	rep(i,0,n) ans=(ans+c[n][i]*solve(n-i,x))%maxd;
	printf("%lld",ans);
	return 0;
}
	

Measured memory_bytes: 70272
#include <iostream>
#include <unordered_set>

int N;
std::unordered_set<int> hon {2,4,5,7,9};
std::unordered_set<int> pon {0,1,6,8};
std::unordered_set<int> bon {3};

int main() {
    std::cin >> N;
    int fd = N % 10;
    if (hon.find(fd) != hon.end()){
        std::cout << "hon" << std::endl;
    }
    else if (pon.find(fd) != pon.end()){
        std::cout << "pon" << std::endl;
    }
    else if (bon.find(fd) != bon.end()){
        std::cout << "bon" << std::endl;
    }
}


Measured memory_bytes: 3160
#include <iostream>

using namespace std;

int main()
{
    int h, w;
    while (true)
    {
        cin >> h >> w;
        if (h == 0)
        {
            break;
        }

        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                char c;
                if (i == 0 || i == h - 1)
                {
                    c = '#';
                }
                else if (j == 0 || j == w - 1)
                {
                    c = '#';
                }
                else
                {
                    c = '.';
                }
                cout << c;
            }
            cout << '\n';
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3008
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007

ll buc[50]={0};
ll dp[100]={0};


int main(){
  ll a,b,c,n;
  string s;
  cin >>n;
  cin >> s;
  ll ans=1;
  rep(i,n){
    buc[(int)s[i]-(int)'a']++;
  }
  rep(i,50){
    if(buc[i]!=0)ans*=buc[i]+1;
    ans%=mod;
  }
  cout << ans-1 << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(x) x.begin(), x.end()
#define sorn(i, n) char((i == n-1)?'\n':' ')
using namespace std;

constexpr int LEN = 10;
bool g[LEN][LEN];
bool vis[LEN];

bool check(const vector<int>& s, const int n){
    rep(i, n-1) if(!g[s[i]][s[i+1]]) return false;
    return true;
}

int main(){
    memset(g, 0, sizeof(g));
    int n, m; cin >> n >> m;
    rep(i, m) {
        int a, b; cin >> a >> b;
        g[--a][--b] = true;
        g[b][a] = true;
    }

    vector<int> s;
    rep(i, n) s.push_back(i);
    int ans = 0;
    do{
        if(check(s, n)) ans++;
    } while(next_permutation(s.begin()+1, s.end()));
    cout << ans << endl;

    return 0;
}

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

int main(){
    int bucket[101];
    for(int i=0;i<101;++i){
        bucket[i]=0;
    }

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

    int ans=0;
    for(int i=1;i<=100;++i){
        if(bucket[i]!=0) ++ans;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
INTEGER N,Q
CHARACTER(100002) S
INTEGER L,R
INTEGER,ALLOCATABLE,DIMENSION(:)::CNT
INTEGER LL,memo
READ*,N,Q
READ*,S
ALLOCATE(CNT(N+2))
CNT=0
LL=0
DO
  memo=INDEX(S(LL:),"AC")
  IF(memo==0)EXIT
  CNT(LL+memo)=CNT(LL+memo)+1
  LL=LL+memo
END DO
DO i=2,n+1
  CNT(i)=cnt(i-1) + cnt(i)
end do
DO I=1,Q
  READ*,L,R
  PRINT"(I0)",CNT(R)-CNT(L)
END DO
END

Measured memory_bytes: 1572
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ms(x, t) memset(x, t, sizeof(x))
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define rall(ar) ar.rbegin(), ar.rend()
#define endl "\n"
typedef pair<int, int> pll;
typedef pair<int, pll> plll;
typedef vector<int> vl;
typedef vector<vector<int>> vvl;
typedef vector<pll> vpll;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}

const int limit = 1e5 + 1;
const int inf = 1e7;
const int mod = 1e9 + 7;

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vl a(n);
  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;
    while (d--) {
      int x;
      cin >> x;
      x--;
      a[x]++;
    }
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (!a[i]) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3656
use proconio::input;

struct SeqIterator {
  stack : Vec<(usize, usize)>,
  n : usize,
  m : usize,
  seq : [usize; 11],
}

impl SeqIterator {
  fn new(n: usize, m : usize) -> SeqIterator {
    SeqIterator{ n, m, seq: [0; 11], stack : vec![(0,1)] }
  } 
}

impl Iterator for SeqIterator {
  type Item = Vec<usize>;
  fn next(&mut self) -> Option<Self::Item> {
    let n = self.n;
    let m = self.m;
    let stack = &mut self.stack;
    let seq = &mut self.seq;
    
    loop {
      let (i,j) = stack.pop()?;
      seq[i] = j;
      
      if i == n {
        break Some(seq[0 ..= n].to_vec());
      }
      
      for k in j ..= m {
        stack.push((i + 1, k));
      }
    }
  }
}

fn main() {
  input!{
      n: usize,
      m: usize,
      q: usize,
      qu: [(usize, usize, usize, i32); q]
  };
  let ans = SeqIterator::new(n, m).map(|seq| {
    qu.iter().fold(0,|s, q|{
      let (a,b,c,d) = *q;
      if seq[b] - seq[a] == c {
        s + d
      } else {
        s
      }
    })
  }).max().unwrap();
  println!("{}", ans);
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree< ll, null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll mod;

ll pwr(ll a, ll b){
  ll res = 1;
  while(b > 0){
    if(b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}

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

  string s;
  cin >> s;
  ll n = s.length();

  mod = 2019;

  vector < ll > dp(2019, 0);
  ll x = 0, ans = 0;
  dp[0] = 1;
  for(int i = 0; i < n; i++){
    x = (x * 10 + (s[i] - '0')) % 2019;
    ll val = x * pwr(10, n - i - 1);
    val %= 2019;
    ans += dp[val];
    dp[val]++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3748
import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    N, M = geta(int)
    g = [[] for _ in range(N + 1)]
    for _ in range(M):
        a, b = geta(int)
        g[a].append(b)
        g[b].append(a)

    g[0].append(1)

    ans = [-1] * (N + 1)
    que = deque()
    que.appendleft(0)

    while len(que) > 0:
        parent = que.pop()
        for child in g[parent]:
            if ans[child] == -1:
                ans[child] = parent
                que.appendleft(child)

    print("Yes", *ans[2:], sep="\n")


if __name__ == "__main__":
    main()

Measured memory_bytes: 94512
#include <iostream>

using namespace std;

int gcd(int a, int b){
    if(a < b) swap(a, b);
    while(b != 0){
        int tmp;
        tmp = b;
        b = a%b;
        a = tmp;
    }
    return a;
}

int main(){
    int N;
    int A[100000];
    int gcd_l[100000];
    int gcd_r[100000];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    gcd_l[0] = A[0];
    for(int i = 1; i < N; i++){
        gcd_l[i] = gcd(gcd_l[i-1], A[i]);
    }
    gcd_r[N-1] = A[N-1];
    for(int i = N-1; i >= 0; i--){
        gcd_r[i] = gcd(gcd_r[i+1], A[i]);
    }
    int ans = max(gcd_r[1], gcd_l[N-2]);
    for(int i = 1; i < N-1; i++){
        ans = max(gcd(gcd_l[i-1], gcd_r[i+1]), ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
// Created by SAMAN on ۷/۳۱/۲۰۲۰ م..

#include <iostream>
#include <algorithm>
#include <map>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <fstream>
#include <cstdlib>
#include <iterator>
#include <cmath>
#include <ctime>
#include <iomanip>

#define lint long long int
#define kill(x) return cout<<x<<'\n', 0;
#define debug(x) cout << #x << " : " << x << '\n'
#define pb push_back
#define ppb pop_back

using namespace std;

int n;
const int maxn = 1e5;
int a[maxn];
int dp[maxn];
int main(){
    cin >> n;
    for(int i = 1;i<=n;i++)
        cin >> a[i];
    dp[1] = 0;
    dp[2] = abs(a[2] - a[1]);
    for(int i = 3;i<=n;i++)
        dp[i] = min(abs(a[i-1]-a[i])+dp[i-1],abs(a[i-2]- a[i])+dp[i-2]);
    cout<<dp[n];    
}

Measured memory_bytes: 3948
#include <iostream>
#include <vector>
#include <algorithm>
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;

typedef long long ll;

int n, k;
ll a[200001];
ll b[200002];

void add(int i){
    while(i <= n){
        ++b[i];
        i += i & -i;
    }
}

ll sum(int i){
    ll s = 0;
    while(i > 0){
        s += b[i];
        i -= i & -i;
    }
    return s;
}

void compress(){
    vector<ll> v(a, a + n);
    sort(v.begin(), v.end());
    rep(i, n){
        a[i] = lower_bound(v.begin(), v.end(), a[i]) - v.begin();
    }
}

int main(){
    cin >> n >> k;
    rep(i, n){
        cin >> a[i + 1];
        a[i + 1] -= k;
    }

    ++n;
    rep(i, n - 1){
        a[i + 1] += a[i];
    }
    compress();

    ll ans = 0;
    for(int i = n - 1; i >= 0; --i){
        ans += sum(n) - sum(a[i]);
        add(a[i] + 1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3428
n,k,q = map(int,input().split(" "))
point = [k-q for i in range(n)]

for i in range(q):
    ans = int(input())
    point[ans-1] += 1

for i in range(n):
    if(point[i] <= 0):
        print("No")
    else:
        print("Yes")

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

namespace AirCondi
{
    class Class2
    {
      static void Main(string[] args)
        {
            int x=34;
       
        x= int.Parse(Console.ReadLine());
    
            if (x >= 30)
            {
                Console.WriteLine("Yes");
               
            }
            else
            {
                Console.WriteLine("No");
               
            }
        }
      
    }
}


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

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

    int N;
    cin >> N;

    set<int> S;

    for(int i=1; i<=N; i++)
    {
        int x;
        cin >> x;
        S.insert(x);
    }

    if(S.size() == N)
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n;
    cin >> n;
    vector<int> x(n);
    repeat(i, n) cin >> x[i];
    
    auto alleven = [](vector<int> &x) {
        bool ret = true;
        for (auto e: x) {
            if (e % 2 != 0) {
                ret = false;
                break;
            }
        }
        return ret;
    };
    
    int ans = 0;
    repeat(i, n) while (alleven(x)) {
        for (auto &e: x) {
            e /= 2;
        }
        ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(void){
  int n,ans=0;
  cin >> n;
  vi v(n);
  vi c(n);
  rep(i,0,n)cin>>v[i];
  rep(i,0,n)cin>>c[i];
  rep(i,0,n){
    if(v[i]-c[i]>0){
      ans+= v[i]-c[i];
    }
  }
  cout << ans;
  
  return 0;
}


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

int main(void)
{
  char *S=(char *)malloc(128);
  char *T=(char *)malloc(128);
  scanf("%s",S);
  scanf("%s",T);
  *(T+(strlen(S)))='\0';
  if(strcmp(S,T)){
    puts("No");
  }else{
    puts("Yes");
  }
  free(S);
  free(T);
}


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

signed main(void)
{
	int n, w_cnt;
	cin >> n;
	map<char, int> mp;
	string s;
	cin >> s;
	mp['R'] = mp['W'] = 0;
	rep(i, s.size())
		mp[s[i]]++;
	w_cnt = 0;
	for (int i = 0; i < mp['R']; i++)
	{
		if (s[i] == 'W')
			w_cnt++;
	}
	cout << w_cnt << endl;
	return 0;
}


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

def slove():
    x, n = map(int,input().split())
    p = list(map(int,input().split()))
    for i in range(101):
        if x-i not in p:
            print(x-i)
            break
        if x+i not in p:
            print(x+i)
            break

if __name__ == "__main__":
    slove()


Measured memory_bytes: 9180
#include <iostream>
#include <math.h>
#include <algorithm>
#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 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;

int main(void){
    int a;
    string s,ans;

    cin >> a >> s;

    if(a >= 3200) ans = s;
    else ans = "red";

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>
#include<cassert>

using namespace std;

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

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

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define rep(i,n) FOR(i,0,n)

struct edge{int to,cost;};

void dump_line(int *b,int n){
	for(int i=0;i<n;i++){
		cout << b[i] << " ";
	}
	cout << "\n";
}

ll mypow(ll x,ll n){
	if(n==0) return 1;
	ll res=mypow(x*x,n/2);
	if(n&1) res=res*x;
	return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int l,k;
	cin >> l >> k;

	ll dp[l]={};
	dp[0]=1;
	if(l>=k) dp[k-1]=1;
	ll ans=0;
	rep(i,l){
		if(dp[i]==0) continue;
		ans+=dp[i];
		if(i+2 <= l-1){
			dp[i+2]+=dp[i];
			if(i+k+1<=l-1) dp[i+k+1] += dp[i];
		}
	}
	cout << ans << "\n";

	return 0;
}


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

int main() {
    int n;
    cin>>n;
    int ans=0;
    for (int i=1;i<=n;i++) {
        int c=0;
        int t=i;
        while (t) {
            t/=10;
            c++;
        }
        if (c&1) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

#define INF 100000;

int main() {
  int N, C, p, sum = 0;
  std::cin >> N >> C;

  for(int i=0; i<C; ++i) {
    std::cin >> p;
    sum += p;
  }

  if(sum%(N+1)) {
    std::cout << sum/(N+1) + 1 << "\n";
  }
  else {
    std::cout << sum/(N+1) << "\n";
  }

  return 0;
}



Measured memory_bytes: 3124
def include_number?(array, key, length = nil)
  length ||= array.length
  left = 0
  right = length
  while left < right
    mid = (left + right) / 2
     if array[mid] == key
      return true
    elsif key < array[mid]
      right = mid
    else
      left = mid + 1
    end
  end
  false
end

length = gets.to_i
array = gets.split(" ").map(&:to_i)
gets  
keys =  gets.split(" ").map(&:to_i)
count = 0
keys.each do |key|
  count += 1 if include_number?(array, key)
end
puts count


Measured memory_bytes: 15348
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
  int n;
  cin>>n;
  map<string,ll>m;
  ll count=0;
  
  for(int i=0;i<n;i++)
  {
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    count+=m[s];
    m[s]++;
    
  }
  cout<<count<<endl;
  return 0;
}
  


Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;


int main(){
    int s;
    cin>>s;
  if(s==1||s==2){
    cout<<4<<endl;
    }else{
    int count4=0,count=0;
    while (count4!=2){
        if(s==4){
            count4++;
        }
        if(s%2==0){
            s/=2;
            count++;

        }else{
            s=(s*3)+1;
            count++;
        }

    }
    cout<<count<<endl;
  }
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string a,b;
    cin>>a>>b;
    int count=0;
    for(int i=0;i<int(a.length());i++){
        if(a[i]!=b[i]){count++;}
    }cout<<count;
}


Measured memory_bytes: 3780
A, B, C, D = map(int, list(input()))
op = {'+': 1, '-': -1}
for op1 in op:
    for op2 in op:
        for op3 in op:
            tmp = A + B * op[op1] + C * op[op2] + D * op[op3]
            if tmp == 7:
                A, B, C, D = map(str, [A, B, C, D])
                print(A + op1 + B + op2 + C + op3 + D + '=7')
                exit()


Measured memory_bytes: 3060
import math
n=int(input())
info=[list(map(int,input().split())) for i in range(n)]
ans=0

for i in range(n):
  x=info[i][0]
  y=info[i][1]
  info[i].append(x)
  info[i].append(y)
  info[i][0]=math.atan2(y,x)
  info[i][1]=(x**2+y**2)**0.5
info.sort()

allx=0
ally=0

for i in range(n):
  allx+=info[i][2]
  ally+=info[i][3]

for i in range(n):
  for j in range(i+1,n+1):
    ax=0
    ay=0
    for k in range(i,j):
      ax+=info[k][2]
      ay+=info[k][3]
    ans=max(ans,(ax**2+ay**2)**0.5,((allx-ax)**2+(ally-ay)**2)**0.5)
  
print(ans)




Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
int main(){
    int n,m;
    cin>>n;
    int t[n+1];
    rep(i,1,n+1)cin>>t[i];
    cin>>m;
    int p[m],x[m];
    rep(i,0,m)cin>>p[i]>>x[i];
    int sum=accumulate(t+1,t+n+1,0);
    rep(i,0,m)cout<<sum-t[p[i]]+x[i]<<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
using namespace std;

int main(void) {
	vector<int> r;
	while (true)
	{
		int n=0;
		int sum=0;
		scanf("%d",&n);
		if (n==0){
			break;
		}
		for (int i=0; i<n/4; i++)
		{
			int x;
			scanf("%d", &x);
			sum += x;
		}
		r.push_back(sum);
	}
	for(int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

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


int main() {
    ll x;
    cin >> x;
    
   for(int i=-118 ;i<120;i++){
       for(int j=-119;j<119;j++){
           if(pow(i,5)-pow(j,5)==x){
                 cout << i << " " << j <<  endl;
           return   0;
           }
       }
   }
    return 0;
}
    



Measured memory_bytes: 3988
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<bitset>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 16;
char cn[cm], * ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

//bitset使ったことほぼないなぁ
bitset<6500> dp1[81];

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


	fread(ci, 1, cm, stdin);
	int H, W;
	H = getint(), W = getint();
	char AB[80][80];
	rep(i, H) rep(j, W) {
		AB[i][j] = getint();
	}
	rep(i, H) rep(j, W) {
		AB[i][j] = abs(AB[i][j] - getint());
	}

	dp1[0][0] = true;
	for (int hw = 0; hw <= H + W - 2; hw++) {
		for (int w = min(hw, W - 1); w >= max(0, hw - H + 1); w--) {
			int h = hw - w;
			dp1[w] |= dp1[w] << AB[h][w] * 2;
			rep1(i, AB[h][w]) dp1[w][AB[h][w] + i] = (dp1[w][AB[h][w] + i] | dp1[w][AB[h][w] - i]);
			dp1[w] >>= AB[h][w];
			dp1[w + 1] |= dp1[w];
		}
	}


	rep(i, 81) {
		if (dp1[W - 1][i]) {
			printf("%d", i);
			return 0;
		}
	}

	Would you please return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main() {
    int N;
    string A, B, C;
    cin >> N >> A >> B >> C;

    int changeCount = 0;
    int same;
    for(int i = 0; i < N; i ++){
        same = 0;
        if (A[i] == B[i]){
            same ++;
        }
        if (B[i] == C[i]){
            same ++;
        }
        if (A[i] == C[i]){
            same ++;
        }

        if(same == 1){
            changeCount ++;
        }
        if(same == 0){
            changeCount += 2;
        }
    }

    cout << changeCount;

    return 0;
}

Measured memory_bytes: 256
MOD = 10**9 + 7

H, W = map(int, input().split())

grid = []
for h in range(H):
  grid.append(list(input()))


dp = [[0]*(W+1) for h in range(H+1)]
dp[0][1] = 1 
for h in range(1, H+1):
  for w in range(1, W+1):
    if grid[h-1][w-1] == '#':
      continue
    
    dp[h][w] = (dp[h][w-1] + dp[h-1][w]) % MOD

print(dp[H][W])

Measured memory_bytes: 51512
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int ans = 9, i = n, j =1, k;
	if(n/10==0){
		cout << n << endl;
		return 0;
	}
	while (i / 10){
		j++;
		i /= 10;
	}
	for (i = 2; i <= j;i++){
		if(i % 2) {
			if(i < j) {
				ans += pow(10, i)-pow(10,i-1);
			} else {
				ans += n - pow(10, i - 1) + 1;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long int ll;
int main(){
  ll n;
  cin >>n;
  ll a[n];
  for(ll i=0;i<n;i++) cin >> a[i];
  int ans=0;int c=1;
  for(int i=0;i<n-1;i++){
    if(a[i]==a[i+1]){
      c++;
      if(i==n-2){
         ans+=(c/2);
      }
    }
    else{
      ans+=(c/2);
      c=1;
    }
  }
  cout <<ans<<endl;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  int ans = INF;
  int a;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a);
    int cnt = 0;
    while (not (a & 1)) {
      a >>= 1;
      ++cnt;
    }
    ans = min(ans, cnt);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<limits.h>
int A[500005],N,c=0,i,tmp[2][250005];
void marge(int l,int m,int r)
{
	int i,j,c1=m-l,c2=r-m;
	for(i=0;i<c1;i++)tmp[0][i]=A[l+i];
	for(i=0;i<c2;i++)tmp[1][i]=A[m+i];
	tmp[0][c1]=tmp[1][c2]=INT_MAX;
	for(i=j=0;i<c1||j<c2;c++)
	{
		if(tmp[0][i]<tmp[1][j])
		{
			A[l+i+j]=tmp[0][i];
			i++;
		}
		else
		{
			A[l+i+j]=tmp[1][j];
			j++;
		}
	}
}

void margeSort(int l,int r)
{
	int m;
	if(l+1<r)
	{
		m=(l+r)/2;
		margeSort(l,m);
		margeSort(m,r);
		marge(l,m,r);
	}
}

int main()
{
	scanf("%d",&N);
	for(i=0;i<N;i++)
		scanf("%d",A+i);
	margeSort(0,N);
	for(i=0;i<N;i++)
		printf("%d%c",A[i],i==N-1?'\n':' ');
	printf("%d\n",c);
	return 0;
}


Measured memory_bytes: 5600