akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;


public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        String str = s.next();
        
        int c = 0;
        int maxC = 0;
        
        for (int i = 0; i < str.length(); i ++) {
            if (str.charAt(i) == 'A' || str.charAt(i) == 'C' || str.charAt(i) == 'G' || str.charAt(i) == 'T') {
                c ++;
                if (c > maxC)
                    maxC = c;
            } else
                c = 0;
        }
        
        System.out.println(maxC);
        
    }
    
}


Measured memory_bytes: 21844
import java.util.*;

@SuppressWarnings("unchecked")
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int h = in.nextInt();
		int n = in.nextInt();
		int maX = 0;
		int miX = w;
		int maY = 0;
		int miY = h;
		for (int i = 0; i < n; ++i) {
			int x = in.nextInt();
			int y = in.nextInt();
			int a = in.nextInt();
			if (a == 1) maX = Math.max(maX, x);
			if (a == 2) miX = Math.min(miX, x);
			if (a == 3) maY = Math.max(maY, y);
			if (a == 4) miY = Math.min(miY, y);
		}
		int len = Math.max(0, miX - maX);
		int bre = Math.max(0, miY - maY);
		System.out.println(len * bre);
	}
}

Measured memory_bytes: 36368
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
typedef complex<double> xy_t;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    ll r, g, b, n; cin >> r >> g >> b >> n;
    ll c = 0;
    for (ll i = 0; i * r <= n; ++i) for (ll j = 0; j * g <= n; ++j) {
        int k = n - i * r - j * g;
        if (k < 0) continue;
        if (k % b == 0) {
            //cout << i << " " << j << " " << k << endl;
            c++;
        }
    }
    cout << c << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9


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

	int A1[N];
	int A2[N];

	for (int i = 0; i < N; i++) cin >> A1[i];
	for (int i = 0; i < N; i++) cin >> A2[i];

	int ans = 0;

	for (int i = 0; i < N; i++) { // iで下に移動
		int sum = 0;
		for (int j = 0; j <= i; j++) sum += A1[j];
		for (int j = i; j < N; j++) sum += A2[j];
		ans = max(ans, sum);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import numpy as np
from itertools import product

inf = int(1e20)
n, m, x = map(int, input().split())
_ = [[int(x) for x in input().split()] for _ in range(n)]
CA = np.array(_, dtype=int)
ans = inf
for indices in product([False, True], repeat=n):
    sums = np.sum(CA[np.array(indices)], axis=0)
    if min(sums[1:]) >= x:
        ans = min(ans, sums[0])
print(ans if ans != inf else '-1')


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

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

    vector<tuple<string, int, int>> a;

    for(int i = 1; i <= N; i++) {
        string s;
        int p;
        cin >> s >> p;

        a.push_back(make_tuple(s, -p, i));
    }

    sort(a.begin(), a.end());

    for(tuple<string, int, int> t : a) {
        string s;
        int p;
        int i;

        tie(s, p, i) = t;
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 3640
from operator import itemgetter


def main():
    N = int(input())
    ab = [[int(j) for j in input().split()] for i in range(N)]
    cd = [[int(j) for j in input().split()] for i in range(N)]
    # y 降順
    ab.sort(key=itemgetter(1), reverse=True)
    # x 昇順
    cd.sort(key=itemgetter(0))
    # ペアになった赤
    done = [False] * N
    for bx, by in cd:
        i = 0
        for rx, ry in ab:
            if not done[i] and rx < bx and ry < by:
                done[i] = True
                break
            i += 1
    print(sum(done))
    return


main()


Measured memory_bytes: 3064
from collections import deque

s = deque(list(input()))

ans = 0
while len(s) > 1:
    l = s.popleft()
    r = s.pop()
    if l == r:
        continue
    elif l == 'x':
        ans += 1
        s.append(r)
    elif r == 'x':
        ans += 1
        s.appendleft(l)
    else:
        print(-1)
        exit()

print(ans)
        

Measured memory_bytes: 10592
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv){
  // 受け取り
  long long A, B;
  cin >> A >> B;
  
  long long p = B - A + 1;
  int c = p%4;
  
  long long ans = 0LL;

  bool flag = false;
  if(A%2==0) flag = true;

  if(flag){
  	for(int cnt0=0; cnt0<c; cnt0++){
      ans ^= B-cnt0;
    }
  }else{
    if(c == 0){
      ans ^= A ^ B ^ (B-1) ^ (B-2);
    }else if(c == 1){
      ans ^= A;
    }else if(c == 2){
      ans ^= A ^ B;
    }else if(c == 3){
      ans ^= A ^ A+1 ^ A+2;
    }
  }
  printf("%lld", ans);
  return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string str;
cin>>str;
if(str[2]==str[3]&&str[4]==str[5])
{
    cout<<"Yes"<<endl;
}
else
{
    cout<<"No"<<endl;
}
    return 0;
}

Measured memory_bytes: 256
sx,sy,tx,ty=map(int,input().split())

ans=""
for i in range(tx-sx):
    ans+="R"
for i in range(ty-sy):
    ans+="U"
for i in range(tx-sx):
    ans+="L"
for i in range(ty-sy):
    ans+="D"
ans+="L"
for i in range(ty-sy+1):
    ans+="U"
for i in range(tx-sx+1):
    ans+="R"
ans+="D"
ans+="R"
for i in range(ty-sy+1):
    ans+="D"
for i in range(tx-sx+1):
    ans+="L"
ans+="U"
print(ans)

Measured memory_bytes: 3064
using System;

class Untitled
{
  static void Main(string[] args)
  {
	// ???????????´??° a, b ?????????????????§???a ??¨ b ?????§?°???¢??????????????????????????°?????????????????????????????????
    bool parsed = false;
    int a = 0, b = 0;
    string s = Console.ReadLine();
    if (!String.IsNullOrEmpty (s)) {
	  string[] strs = s.Split (' ');
	  if (strs.Length == 2) {
		parsed = Int32.TryParse (strs [0], out a);
		if (parsed) {
			parsed = Int32.TryParse (strs [1], out b);
		}
	  }
    }
    if (parsed) { 
	  if (a > b) {
		System.Console.WriteLine ("a > b");
	  } else if (a < b) {
		System.Console.WriteLine ("a < b");
	  } else {
		System.Console.WriteLine ("a == b");
	  }
    }
  }
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

signed main() {
    int a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    
    if (
       (a == 5 && b == 5 && c == 7) || 
       (a == 5 && b == 7 && c == 5) || 
       (a == 7 && b == 5 && c == 5) 
    ) {
        cout << "YES" << "\n" << endl;
    } else {
        cout << "NO" << "\n" << endl;
    }
    return 0;
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
typedef long long L;
using namespace std;
 
#define N 100005
#define U [N]={}
map<L,L> path[N];
L par U,dep U,siz U,hev U,cst U,add U,pos U,hl_par U,bit U,
k,n,q,a,b,c,cnt,i,p,r,ret;
void dfs(L a){
    siz[a]=1;
    for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){
        L d=I->first;
        if(d==par[a]) continue;
        par[d]=a;
        dep[d]=dep[a]+1;
        cst[d]=I->second;
        dfs(d);
        siz[a]+=siz[d];
        if(!hev[a] || siz[hev[a]]<siz[d])
            hev[a]=d;
    }
}
   
L edgecost(L a){
    L ret=add[a]+add[par[a]]+cst[a];
    return ret%k ? ret : 0;
}
   
L sum(L i){
    L ret=0;
    while(i){
        ret+=bit[i];
        i-=i&-i;
    }
    return ret;
}
void S(L i, L x){
    x-=sum(i+1)-sum(i);
    i++;
    while(i<N){
        bit[i]+=x;
        i+=i&-i;
    }
}
 
main(){
    cin >> n >> k;
    for(i=0; i<n-1; i++){
        cin >> a >> b >> c;
        path[a][b]=path[b][a]=c;
    }
    dfs(0);
   
    for(i=0; i<n; i++){
        if(i && hev[par[i]]==i) continue;
        L j=i;
        do{
            pos[j]=cnt++;
            hl_par[j]=i;
        }while(j=hev[j]);
    }
    
    for(i=0; i<n; i++)
        S(pos[i], edgecost(hev[i]));
    
    cin >> q;
    for(i=0; i<q; i++){
        string s;
        cin>>s>>a>>b;
        if(s[0]=='a'){
            add[a]+=b;
            S(pos[a], edgecost(hev[a]));
            if(a) S(pos[a]-1, edgecost(a));
        }else{
            for(ret=0;p=hl_par[a],r=hl_par[b],p-r;a=par[p]){
                if(dep[p]<dep[r])swap(p,r),swap(a,b);
                ret+=sum(pos[a])-sum(pos[p])+edgecost(p);
            }
            cout<<ret+abs(sum(pos[a])-sum(pos[b]))<<endl;
        }
    }
}

Measured memory_bytes: 32096
#include <stdio.h>

int main(void) {
  int a = 0;
  int b = 0;
  int c = 0;

  int i = 0;
  int count = 0;

  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);  

  for (i = a; i <= b; i++) {
    if ((c % i) == 0) {
      count++;
    }
  }

  printf("%d\n", count);
  
  return 0;
}

Measured memory_bytes: 596
//
// Created by hide on 2020/05/15.
//

//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード(アルファベット順,bits/stdc++.hは使わない派閥)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
//#define S second //pairの二つ目の要素


int main() {
    int K;
    string S;
    cin >> K;
    cin >> S;
    if(S.size()<=K)
        cout<<S<<endl;
    else{
        string tmp="";
        REP(i,K){
            tmp+=S[i];
        }
        tmp+="...";
        cout<<tmp<<endl;

    }
}

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

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

	int			n;
	int			max;
	int			second_max;
	cin >> n;
	vector<int>	A(n);
	vector<int>	B(n);

	rep(i, n)
		cin >> A.at(i);
	B = A;
	sort(B.begin(), B.end(), greater<>());
	max = B.at(0);
	second_max = B.at(1);
	rep(i, n)
	{
		if (A.at(i) != max)
			cout << max << "\n";
		else
			cout << second_max << "\n";
	}
}



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

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

ll dp[1010];
ll F[1010], FI[1010];
ll n, a, b, c, d;

ll pow(ll a, ll b) { return b? pow(a * a % mod, b >> 1) * (b & 1? a : 1) % mod : 1; }

int main()
{
	ll i, j, k;
	
	scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d);
	
	F[0] = FI[0] = 1;
	
	for(i=1; i<=n; i++){
		F[i] = F[i - 1] * i % mod;
		FI[i] = pow(F[i], mod - 2);
	}
	
	dp[0] = 1;
	
	for(i=a; i<=b; i++){
		for(j=n; j>=0; j--){
			for(k=c; k<=d && j-k*i>=0; k++){
				dp[j] = (dp[j] + dp[j - k * i] * pow(FI[i], k) % mod * FI[k]) % mod;
			}
		}
	}
	
	printf("%lld\n", dp[n] * F[n] % mod);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const int N=200;
const int W=1000000000;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	int x = 1;
	FOR(i,0,n){
		if(x<=k){
			x*=2;
		}else{
			x+=k;
		}
	}
	cout << x << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x)%M;
        y/=2;
    } 
    return ans;
}
int main()
{
     fast;
     ll n,k,d,x;
     cin>>n>>k;
     vector<int>v(n+1,0);
     repp(i,1,k)
     {
       cin>>d;
       rep(j,d)
       {
          cin>>x;
          v[x]++;
	   }
	 }
	 ll cnt=0;
	 repp(i,1,n)
	 {
	    if(!v[i])
	    cnt++;
	    
	 }
	 cout<<cnt;
	 
}   

Measured memory_bytes: 3620
def notfound(n):
    bucket = {i:False for i in 'abcdefghijklmnopqrstuvwxyz'}
    for i in S:
        bucket[i]=True
    box = [k for k, v in bucket.items() if v == False]
    if box == []:
        return 'None'
    else:
        return sorted(box)[0]
S = input()
print(notfound(S))


Measured memory_bytes: 3188
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum mod = 10L^^9 + 7;
enum inf = 10^^9;

void main() {
    int n, k;
    scan(n, k);

    auto a = readln.split.to!(long[]);

    auto b = new long[][](64, 0);

    auto ac = new long[](n + 1);
    foreach (i ; 0 .. n) {
        ac[i+1] = ac[i] + a[i];
    }

    foreach (i ; 0 .. n) {
        foreach (j ; i + 1 .. n + 1) {
            auto ss = ac[j] - ac[i];
            debug {
                writefln("(%d, %d) : %d", i, j, ss);
            }
            foreach (l ; 0 .. 64) {
                if (ss & (1L << l)) {
                    b[l] ~= ss;
                }
            }
        }
    }

    debug {
        writefln("%(%s\n%)", b);
    }

    long ans;

    for (int r = 63; r >= 0; r--) {
        if (b[r].length < k) {
            continue;
        }

        debug {
            writeln(r, " ", b[r]);
        }

        ans += (1L<<r);

        foreach (i ; 0 .. r) {
            b[i] = null;
        }

        foreach (bi ; b[r]) {
            foreach (i ; 0 .. r) {
                if (bi & (1L << i)) {
                    b[i] ~= bi;
                }
            }
        }
    }

    writeln(ans);
}





























void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 156284
#include<iostream>
main(){
    int N,M,a,b;
    std::cin >> N >> M;
    int *arr = new int[N];
    for(int i = 0; i < M; i++)
    {
        std::cin >> a >> b;
        arr[a-1]++;
        arr[b-1]++;
    }
    for(int i = 0; i < N; i++)
    {
        std::cout << arr[i] << std::endl;
    }
}

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

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
const int INF = 1e9;

using namespace std;

class node{
public:
    node(){
        key = 0;
        parent = NULL;
        left = NULL;
        right = NULL;
    }

    node(int i, node* p, node* l, node* r){
        key = i;
        parent = p;
        left = l;
        right = r;
    }

    int key;
    node* parent;
    node* left;
    node* right;
};

node* root = NULL;

void pre_search(node* v){
    cout << " " << v->key;
    if(v->left != NULL)
        pre_search(v->left);
    if(v->right != NULL)
        pre_search(v->right);
    return;
}

void in_search(node* v){
    if(v->left != NULL)
        in_search(v->left);
    cout << " " << v->key;
    if(v->right != NULL)
        in_search(v->right);
    return;
}

void search(int key, node* v){
    if(v == NULL){
        cout << "no" << endl;
        return;
    }
    if(v->key == key){
        cout << "yes" << endl;
        return;
    }
    if(v->key > key){
        search(key, v->left);
    } else
        search(key, v->right);
    return;
}

void insert(int key){
    if(root == NULL){
        root = new node(key, NULL, NULL, NULL);
        return;
    }
    node* y = NULL;
    node* x = root;
    while(x != NULL){
        y = x;
        if(key < x->key)
            x = x->left;
        else
            x = x->right;
    }
    node* add = new node(key, y, NULL, NULL);
    if(key < y->key)
        y->left = add;
    else
        y->right = add;
    return;
}

int main() {
    int k;
    string order;
    int num;
    cin >> k;
    REP(i, k){
        cin >> order;
        if(order == "insert"){
            cin >> num;
            insert(num);
        } else if (order == "print"){
            in_search(root);
            cout << endl;
            pre_search(root);
            cout << endl;
        } else if (order == "find"){
            cin >> num;
            search(num, root);
        }
    }
    return 0;
}

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

int nt[5010000];
bool bl[5010000];
int cnt;

int main(){
	string s;cin>>s;
	nt[0]=-1;
	int k=-1,j=0;
	int l=s.size();
	int xh;
	while(j<l){
		if(k==-1||s[j]==s[k]){
			j++;k++;xh=j-k;
			bl[j-1]=(xh!=j&&j%xh==0);
			if(s[j]!=s[k]) nt[j]=k;
			else nt[j]=nt[k];
		}
		else k=nt[k];
	}
	xh=l-nt[l];
	if(xh==1) 	cout<<l<<"\n"<<1<<"\n",exit(0);
	if(xh==l||l%xh!=0) cout<<1<<"\n"<<1<<"\n",exit(0);
	for(int i=0;i<l/2;++i){
		swap(s[i],s[l-1-i]);
	}
	memset(nt,-1,sizeof(nt));
	k=-1,j=0;
	while(j<l){
		if(k==-1||s[j]==s[k]){
			j++;k++;
			xh=j-k;
			bool B=(xh!=j&&j%xh==0);
			if(B==0&&bl[l-1-j]==0) cnt++;
			if(s[j]!=s[k]) nt[j]=k;
			else nt[j]=nt[k];
		}
		else k=nt[k];
	}
	cout<<2<<"\n"<<cnt<<"\n";
	return 0;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int N, A, B;
    cin >> N >> A >> B;

    vll vals(N);
    for (int i = 0; i < N; i++) {
        cin >> vals[i];
    }

    sort(all(vals), greater<ll>());

    const int MAXN = 51;
    vector<vll> ncr(MAXN, vll(MAXN));

    ncr[0][0] = 1;
    for (int n = 1; n < MAXN; n++) {
        for (int r = 0; r <= n; r++) {
            ncr[n][r] = ncr[n-1][r];
            if (r) ncr[n][r] += ncr[n-1][r-1];
        }
    }

    if (A == N || vals[A] < vals[0]) {
        int use = 0, tot = 0;
        for (int i = 0; i < N; i++) {
            if (vals[i] == vals[A]) {
                tot++;
                if (i < A) use++;
            }
        }

        double sum = 0;
        for (int i = 0; i < A; i++)
            sum += vals[i];

        printf("%.6f\n%lld\n", sum / A, ncr[tot][use]);
    }
    else {
        int ct = 0;
        while (ct < N && vals[ct] == vals[0])
            ct++;

        ll ways = 0;
        for (int r = A; r <= B; r++)
            ways += ncr[ct][r];

        printf("%.6f\n%lld\n", double(vals[0]), ways);
    }

    return 0;
}



Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll n=in();
    ll ans=0;
    for(ll p=2;n!=1&&p<=1000000;++p){
        ll e=0;
        for(;n%p==0;++e)n/=p;
        ans+=(-1+sqrt(1+8*e))/2;
    }
    cout<<ans+(n!=1?1:0)<<endl;
}


Measured memory_bytes: 3676
fun main(args: Array<String>) {
    val S = next()
    val first = mutableListOf<Char>()
    val last = mutableListOf<Char>()
    val Q = nextInt()
    var r = false
    repeat(Q) {
        val v = listOfString()
        when (v[0]) {
            "1" -> {
                r = !r
            }
            "2" -> {
                when (v[1]) {
                    "1" -> {
                        if (r)
                            last.add(v[2][0])
                        else
                            first.add(v[2][0])
                    }
                    "2" -> {
                        if (r)
                            first.add(v[2][0])
                        else
                            last.add(v[2][0])
                    }
                }
            }
        }
    }
    val ans = first.reversed().joinToString(separator = "") + S + last.joinToString(separator = "")
    println(if (r) ans.reversed() else ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta


Measured memory_bytes: 74408
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define s second
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
using namespace std;


bool solve(map<int,int> mp, int ans){
    while(ans){
        if(mp[ans%10] == 1) return false;
        ans/=10;
    }
    return true;
}


int main(){
    faster
    int T = 1;
    while(T--){
        int n,k;
        cin>>n>>k;
        
        map<int,int> dislike;
        
        rep(i,0,k-1){
            int a;
            cin>>a;
            dislike[a] = 1;
        }
        
        int ans = n;
        
        while(1){
            if(solve(dislike,ans)){
                break;
            }
            ans++;
        }
        
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <functional>
#define rep0(i,n) for (int i = 0; i < (n); ++i)  //0スタート
#define rep1(i,n) for (int i = 1; i < (n); ++i)  //1スタート
#define REP(i,a,b) for (int i = a; i < (b); ++i)  //aからb - 1まで
#define mREP(i,a,b) for (int i = a; i > (b); --i)  //aからb - 1まで
#define p(x) cout<<x<<endl  //xを改行付きで出力
const int INF = 1000000007;  //最大値兼MOD
//  cin.tie(0);
//  ios::sync_with_stdio(false);
typedef long long ll;
using namespace std;
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(){
  int n;
  cin>>n;
  cout<<((n - 2) * 180)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
  int N, i, j, count=0, kawari, minj, hantei=0;
  scanf("%d", &N);
  int A[N];
  for(i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }

  for(i = 0; i < N-1; i++) {
    hantei=0;
    minj = i;
    for(j = i; j <= N-1; j++) {
      if(A[j] < A[minj]) {
	minj = j;
	hantei = 1;
      }
    }
    if(hantei == 1) {
      kawari = A[i];
      A[i] = A[minj];
      A[minj] = kawari;
      count++;
    }
  }
  
  for(i = 0; i < N; i++) {
    if(i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n%d\n", count);
  return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a < b) {
    if (b < c)
      cout << a << " " << b << " " << c << endl;
    else if (a < c)
      cout << a << " " << c << " " << b << endl;
    else
      cout << c << " " << a << " " << b << endl;
  } else {
    if (a < c)
      cout << b << " " << a << " " << c << endl;
    else if (b < c)
      cout << b << " " << c << " " << a << endl;
    else
      cout << c << " " << b << " " << a << endl;
  }
}

Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <stack>
#include <queue>
typedef long long ll;
using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int ans[3];
    ans[0]=a+b;
    ans[1]=b+c;
    ans[2]=c+a;
    int min=10000000;
    for(int i=0;i<3;i++){
        if(ans[i]<min){
            min=ans[i];
        }
    }
    cout << min << endl;
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;

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

    int div = b - a;
    int sum = 0;
    FOR (i, 1, div + 1) sum += i;

    cout << sum - b << endl;

    return 0;
}


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

using namespace std;

const int N=1e6+3;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans,sz[N];

char s[N];

pair<int,int> p[N];

int main(){

	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;s[i];i++){
		if(s[i]!=s[i-1])
			ans++;
	}
	printf("%d\n",ans);
}


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1'000'000'000ll + 7;
const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 2 * 100'000 + 5;

i64 n, k;

i64 a[MAXN];
i64 b[MAXN];

struct segtree {
    typedef i32 type;
    const type zero = 0;

    vector<type> st;

    void init(i64 size) {
        i64 n = 1;
        while (n < size) {
            n *= 2;
        }
        st.assign(n * 2, zero);
    }

    void add(i64 l, i64 r, type v, i64 x, i64 lx, i64 rx) {
        if (r <= lx || rx <= l) {
            return;
        }

        if (l <= lx && rx <= r) {
            st[x] += v;
            return;
        }

        i64 mx = (lx + rx) / 2;
        add(l, r, v, 2 * x + 1, lx, mx);
        add(l, r, v, 2 * x + 2, mx, rx);
    }

    void add(i64 l, i64 r, type v) {
        add(l, r, v, 0, 0, st.size() / 2);
    }

    type get(i64 i, i64 x, i64 lx, i64 rx) {
        if (rx - lx == 1) {
            return st[x];
        }

        i64 mx = (lx + rx) / 2;
        if (i < mx) {
            return get(i, 2 * x + 1, lx, mx) + st[x];
        }
        else {
            return get(i, 2 * x + 2, mx, rx) + st[x];
        }
    }

    type get(i64 i) {
        return get(i, 0, 0, st.size() / 2);
    }
};

string out() {
    stringstream ss;
    for (i64 i = 0; i < n; i++) {
        ss << a[i] << " ";
    }

    return ss.str();
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

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

    for (i64 tt = 1; tt <= k; tt++) {
        segtree st;
        st.init(n);

        for (i64 i = 0; i < n; i++) {
            i64 l = max(i - a[i], 0ll);
            i64 r = min(i + a[i] + 1, n);
            st.add(l, r, 1);
        }

        for (i64 i = 0; i < n; i++) {
            a[i] = st.get(i);
        }

        bool f = true;
        for (i64 i = 0; i < n; i++) {
            if (a[i] != n) {
                f = false;
            }
        }
        if (f) {
            cerr << tt << endl;
            break;
        }
        //cerr << out() << endl;
    }

    cout << out() << endl;

    return 0;
}

Measured memory_bytes: 8172
n = int(input())
a = list(map(int,input().split()))
an = list(map(abs,a))
cnt=0
for x in range(n):
    if a[x] < 0:
        cnt += 1

if cnt%2 == 0:
    print(sum(map(abs,a)))
else:
    print(sum(map(abs,a)) - 2*min(an))
    

Measured memory_bytes: 14412
/*
    Author : zzugzx
    Lang : C++
    Blog : blog.csdn.net/qq_43756519
*/
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define SZ(x) (int)x.size()
#define mem(a, b) memset(a, b, sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int mod = 1e9 + 7;
//const int mod = 998244353;
const double eps = 1e-6;
const double pi = acos(-1.0);
const int maxn = 2e6 + 10;
const int N = 2e4 + 5;
const ll inf = 0x3f3f3f3f;
const int dir[][2]={{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
int aa[maxn], cnt[maxn], belong[maxn];
int n, m, sz, bnum, now, ans[maxn];
struct query {
    int l, r, id;
} q[maxn];

int cmp(query a, query b) {
    return (belong[a.l] ^ belong[b.l]) ? belong[a.l] < belong[b.l] : ((belong[a.l] & 1) ? a.r < b.r : a.r > b.r);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
    cin >> n >> m;
    sz = sqrt(n);
    bnum = ceil((double)n / sz);
    for(int i = 1; i <= bnum; ++i)
        for(int j = (i - 1) * sz + 1; j <= i * sz; ++j) {
            belong[j] = i;
        }
    for(int i = 1; i <= n; ++i) cin >> aa[i];
    for(int i = 1; i <= m; ++i) {
        cin >> q[i].l >> q[i].r;
        q[i].id = i;
    }
    sort(q + 1, q + m + 1, cmp);
    int l = 1, r = 0;
    for(int i = 1; i <= m; ++i) {
        int ql = q[i].l, qr = q[i].r;
        while(l < ql) now -= !--cnt[aa[l++]];
        while(l > ql) now += !cnt[aa[--l]]++;
        while(r < qr) now += !cnt[aa[++r]]++;
        while(r > qr) now -= !--cnt[aa[r--]];
        ans[q[i].id] = now;
    }
    for(int i = 1; i <= m; ++i) cout << ans[i] << endl;
    return 0;
}


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

int main() {
  int A, B, K;
  int cnt = 0;
  cin >> A >> B >> K;
  for (int i = max(A, B); i >= 1; --i) {
    if (A % i == 0 && B % i == 0) cnt++;
    if (cnt == K) {
      printf("%d\n", i);
      break;
    }
  }
  return 0;
}

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

int main(){
  int N;
  int a[110];
  cin >> N;
  for (int i=0; i < N; ++i)
    cin >> a[i];
  sort(a, a+N);
  cout << a[N-1] - a[0] << endl;
}


Measured memory_bytes: 256
/*
https://hiramekun.hatenablog.com/entry/2019/09/08/144443
勉強させていただいた記事
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)


int main(){
    int N,K;
    string S;
    cin>>N>>K>>S;
    int cnt=0;
    rep(i,N-1)if(S[i]==S[i+1])cnt++;
    cnt+=2*K;
    //cntの値がN-1より大きければそれは全てをひっくり返すことができたと言えるため、
    cout<<min(N-1,cnt)<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<cstdlib> 
#include<string>
#include<math.h>
#include<bitset>
#include<algorithm>
#include<vector>
#include<set>
#include<stack>
#include<queue>
using namespace std;

int main(){

	int n,a,b;

	cin >> n >> a >> b;

	string s;
	cin >> s;

	bool fa=1,fb=1,fc=1;
	int p=0,q=0;

	for(int i=0;i<n;i++){
		if(s[i]=='a'){
			if(p+q<a+b){
				cout << "Yes" << endl;
				p++;
			}else{
				cout << "No" << endl;
			}
		}else if(s[i]=='b'){
			if(p+q<a+b && q<b){
				cout << "Yes" << endl;
				q++;
			}else{
				cout << "No" << endl;
			}
		}else{
			cout << "No" << endl;
		}
	}




	//while(1);

	return 0;
}

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

const int N = 0;
int n,m;
int mat[10][10];

bool valid(int a[])
{
	for(int i=1;i<n;i++)
	{
		if(mat[a[i-1]][a[i]] == 1) continue;
		else return false;
	}
	return true;
}


int main()
{
	int a[8];
	cin >> n >> m;
	for(int i=0,x,y;i<m;i++)
	{
		scanf("%d%d",&x,&y);
		y--; x--;
		mat[x][y]++;
		mat[y][x]++;
	}
	
	for(int i=0;i<n;i++)
	{
		a[i] = i;
	}
	
	int ans = 0;
	do
	{
		if(valid(a))
		{
			ans++;
		}
	}while(next_permutation(a+1,a+n));
	
	cout << ans;
}



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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> ans(N);
    for(int i=2; i<=N; i++) {
        int A;
        cin >> A;
        ans[--A]++;
    }

    for(auto e: ans){
        cout << e << endl;
    }
    return 0;
}


Measured memory_bytes: 3972
import java.io.*
import java.util.*

const val A = 97
fun solve(s: String, t: String) {
    val indices = Array(26) { mutableListOf<Int>() }
    s.withIndex().forEach {
        indices[it.value.toInt() - A].add(it.index)
    }
    // println(indices)
    var ans = 0L
    var ret = 0
    for (chr in t) {
        // println(ans)
        val idx = indices[chr.toInt() - A]
        if (idx.size == 0) { println(-1); return }
        val M = idx.last()!!
        if (M < ret) {
            ans += s.length - ret + idx.first()!! +1
            ret = idx.first()!! + 1
        } else if ( M == ret) {
            ret++
            ans++
        }
        else{
            // retを超える最小のidx
            val insertPos = idx.binarySearch(ret)
            val pos = when {
                insertPos < 0 -> - insertPos - 1
                else -> insertPos
            }
            ans += idx[pos] - ret + 1
            ret = idx[pos] + 1
        }
    }
    println(ans)
    return
}

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val t = sc.next()
    solve(s, t)
}


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

struct StNumCnt
{
  StNumCnt() : m_nNum(0), m_nCnt(0) { }

  int m_nNum;
  int m_nCnt;

  bool operator<(const StNumCnt& rhs) const
  {
    return rhs.m_nCnt < m_nCnt;
  }
};

void fnInput(vector<int>& rvnNum)
{
  int nNumSiz;
  cin >> nNumSiz;
  rvnNum.resize(nNumSiz);

  for (int& rnNum : rvnNum)
    cin >> rnNum;
}

int fnMinChangeCnt(const vector<int>& cnrvnNum)
{
  map<int, int> mpNumCntEvn, mpNumCntOdd;

  for (int i = 0; i < cnrvnNum.size(); ++i)
    if ( i % 2 == 0 )
      mpNumCntEvn[ cnrvnNum[i] ]++;
    else
      mpNumCntOdd[ cnrvnNum[i] ]++;

  vector<StNumCnt> voNumCntEvn( mpNumCntEvn.size() ),
                   voNumCntOdd( mpNumCntOdd.size() );

  int n = 0;
  for (pair<int, int> PNumCnt : mpNumCntEvn)
  {
    voNumCntEvn[n].m_nNum   = PNumCnt.first;
    voNumCntEvn[n++].m_nCnt = PNumCnt.second;
  }

  n = 0;
  for (pair<int, int> PNumCnt : mpNumCntOdd)
  {
    voNumCntOdd[n].m_nNum   = PNumCnt.first;
    voNumCntOdd[n++].m_nCnt = PNumCnt.second;
  }

  sort(begin(voNumCntEvn), end(voNumCntEvn));
  sort(begin(voNumCntOdd), end(voNumCntOdd));

  int nMinChangeCnt = INT_MAX;

  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j)
      if (voNumCntEvn[i].m_nNum != voNumCntOdd[j].m_nNum)
        nMinChangeCnt = 
          min(nMinChangeCnt, (int)cnrvnNum.size() - voNumCntEvn[i].m_nCnt - voNumCntOdd[j].m_nCnt);

  return nMinChangeCnt;
}
  
int main()
{
  vector<int> vnNum;
  
  fnInput(vnNum);
  cout << fnMinChangeCnt(vnNum) << endl;

  return 0;
}

Measured memory_bytes: 8984
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define fi first
#define se second
#define MP make_pair

ll read()
{
    ll v = 0, f = 1;
    char c = getchar();
    while (c < 48 || 57 < c) {if (c == '-') f = -1; c = getchar();}
    while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
    return v * f;
}

const ll INF = 2e18;
const ll N = 1e5 + 10;

ll _n, n, m, a[N], b[N], ans[N];

int main()
{
    _n = a[0] = read();
    n = read();
    for (int i = 1; i <= n; i++) a[i] = read();
    m = -1;
    for (int i = n; i >= 0; )
    {
        int j;
        for (j = i; j >= 0; j--)
            if (a[j] < a[i]) break;
        b[++m] = a[i];
        i = j;
    }
    reverse(b, b + m + 1);
    for (int i = 0; i <= m; i++) a[i] = b[i];
    n = m;
    for (int i = 0; i <= n; i++) b[i] = 0;
    b[n] = 1;
    for (int i = n; i >= 1; i--)
        while (1)
        {
            int t = upper_bound(a, a + i, a[i]) - a - 1;
            if (t == -1)
            {
                ans[a[i]] += b[i];
                break;
            } else
            {
                b[t] += (a[i] / a[t]) * b[i];
                a[i] %= a[t];
            }
        }
    for (int i = a[0] - 1; i >= 1; i--)
        ans[i] += ans[i + 1];
    for (int i = 1; i <= a[0]; i++)
        printf("%lld ", ans[i] + b[0]);
    for (int i = a[0] + 1; i <= _n; i++)
        printf("0 ");
    puts("");
}


Measured memory_bytes: 4096
import sys
from math import ceil
input = lambda: sys.stdin.readline().rstrip()
tdlist = lambda i, j, value=0: [[value] * j for _ in range(i)]

n = int(input())
p = list(map(float, input().split()))
dp = tdlist(n+1, n+1)
dp[0][0] = 1

for i in range(1, n+1):
    for j in range(n+1):
        if j > 0: dp[i][j] += dp[i-1][j-1] * p[i-1]
        dp[i][j] += dp[i-1][j] * (1 - p[i-1])

print(sum(dp[n][ceil(n/2):]))


Measured memory_bytes: 252424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }





int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int n;
    cin >> n;
    vector<pii> v(n);
    rep(i, n) cin >> v[i].F >> v[i].S;
    sort(all(v));
    double sum = 0;
    do {
        rep(i, n - 1) sum += sqrt(pow(v[i].F - v[i + 1].F, 2) + pow(v[i].S - v[i + 1].S, 2));
    } while (next_permutation(all(v)));
    double kai = 1;
    rep3(i, 1, n + 1) kai *= i;
    cout << fixed << setprecision(7) << sum / kai << endl;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	for bit := 0; bit < (1 << uint(len(s))); bit++ { // bit全探索
		ans := string(s[0])
		sum := int(s[0] - '0')
		for j := 1; j < len(s); j++ {
			t := string(s[j])
			v := int(s[j] - '0')
			if bit&(1<<uint(j)) != 0 { // bitが立っていれば'+'を挟む
				ans += "+" + t
				sum += v
			} else { // '-'を挟む
				ans += "-" + t
				sum -= v
			}
			// fmt.Printf("bit[%04b] j %d, ans %s, sum %d\n", bit, j, ans, sum)
		}
		if sum == 7 {
			ans += "=7"
			fmt.Println(ans)
			break
		}
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n;cin>>n;
    set<ll>st;
    st.insert(n);
    for(int i=2;(ll)i*i<=n;i++){
        if(n%i==0){
            ll k=n;
            while(k%i==0)k/=i;
            if(k%i==1)st.insert(i);
        }
    }
    n--;
    if(n!=1)st.insert(n);
    for(int i=2;(ll)i*i<=n;i++){
        if(n%i==0){
            st.insert(n/i);
            st.insert(i);
        }
    }
    cout<<st.size()<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int z[205], b;
int main(void) {
	int n, i, x, m[2],t;
	while (1){
		cin >> n;
		if (n == 0){ break; }
		for (i = 1; i <= n*2; i++){
			z[i] = 1;
		}
		for (i = 1; i <= n; i++){
			cin >> t;
			z[t] = 0;
		}
		m[0] = m[1] = n;
		x = 0;
		b = 0;
		while (m[0] > 0 && m[1] > 0){
			for (i = b+1; i <=n*2; i++){
				if (x == z[i]){
					b = i;
					z[i] = 2;
					m[x]--;
					break;
				}
			}
			if (i > n * 2){
				b = 0;
			}
			x = !x;
		}
		cout << m[1] << endl << m[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int n, m;
	cin >> n >> m;
	
	int height[n+1];
	for(int i = 1; i <= n; i++)
		cin >> height[i];
	
	int h[n+1];
	memset(h,0,sizeof h);
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		h[a] = max(h[a],height[b]);
		h[b] = max(h[b],height[a]);
	}
	int ans = 0;
	
	for(int i = 1; i <= n; i++){
		if(h[i] < height[i]){
			ans++;
		}
	}
	cout << ans << endl;
	

	return 0;
}



Measured memory_bytes: 5172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int h,w;
  cin >> h >> w;
  vector<vector<char>> a(h+2,vector<char>(w+2,'#'));
  rep(i,h){
    rep(j,w){
      cin >> a.at(i+1).at(j+1);
    }
  }
  rep(i,h+2){
    rep(j,w+2){
      cout << a.at(i).at(j);
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b&&b==c&&c==a || a!=b&&b!=c&&c!=a){
		printf("No");
	}
	else {
		printf("Yes");
	}
	
	return 0;
}

Measured memory_bytes: 1704
#include <stdio.h>

void bomb(int x, int y);

char field[10][10];

int main(void)
{
	int n, m;
	int i, j;
	int x, y;
	
	
	scanf("%d", &n);
	for (m = 0; m < n; m++){
		for (i = 0; i < 8; i++){
			scanf("%s", field[i]);
		}
		
		scanf("%d %d", &x, &y);
		bomb(x - 1, y - 1);
		
		printf("Data %d:\n", m + 1);
		for (i = 0; i < 8; i++){
			printf("%s\n", field[i]);
		}
	}
	return (0);
}


void bomb(int x, int y)
{
	int i;
	
	field[y][x] = '0';
	for (i = 1; i <= 3; i++){
		if (field[y][x - i] == '1' && x - i >= 0){
			bomb(x - i, y);
		}
		if (field[y][x + i] == '1' && x + i <= 7){
			bomb(x + i, y);
		}
		if (field[y - i][x] == '1' && y - i >= 0){
			bomb(x, y - i);
		}
		if (field[y + i][x] == '1' && y + i <= 7){
			bomb(x, y + i);
		}
	}
}

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

int main() {
	// your code goes here
	int N;
	while(cin >> N && N!=-1){
	int sum=0;
		sum+=1150;
		if(N>10)
		sum+=(min(20,N)-10)*125;
		if(N>20)
		sum+=(min(30,N)-20)*140;
		if(N>30)
		sum+=(N-30)*160;
		cout << 4280-sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
s = input()
k = int(input())

L = []
for i in range(len(s)):
    L.append((ord("z")-ord(s[i])+1))

ans = ""
i = 0
while i < len(s):
    if s[i] == "a":
        ans +="a"
        i +=1
    elif k-L[i] >= 0:
        ans +="a"
        k -=L[i]
        i +=1
    else:
        ans +=s[i]
        i +=1
k = k%26
ans = ans[:-1] + chr(ord(ans[-1]) + k)
print(ans)

Measured memory_bytes: 10064