akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef  long long ll;
typedef  unsigned long long ull;

template<typename T>
void fin (T a){
    cout<<a<<endl;
    exit(0);
}
/*
template<typename S>
void print(S a){
    cout<<a<<endl;
}
*/

stack<ull> p;
ull n;
stack<char> ans;

/*
void print(){
    ull tmp;
    tmp = n/p.top()-1;
    n %= p.top();
    p.pop();
    if(n==0){
        cout<< 'z';
    }else{
        char ans='a';
        ans += tmp;
        cout << ans;
    }
}
*/
/*
void print(){
    ull tmp;
    tmp = n/p.top()-1;
    if(n==0){
        cout<< 'z';
    }else{
        n %= p.top();
        p.pop();
    if(tmp>=26) {
        cout<<'z';
    }else{
        char ans='a';
        ans += tmp;
        cout << ans;

    }
    }
}
*/
void ireru(){
    char aaa = 'a'-1;
    int tmp = n%26;
    if(tmp==0){
        n-=26;
        aaa+=26;
    }else{
        aaa += tmp;
    }
    n/=26;
    ans.push(aaa);
}



int main(){
    cin>>n;
    int k=0;
    ull num=0;
    ull tmp;

    p.push(1);
    while(n>num){//イコール怪しい
        k++;
        tmp = pow(26,k);
        p.push(tmp);
        num+=pow(26,k);
    }
    p.pop();

    rep(i,k){
        ireru();
    }
    rep(i,k){
        char tmp= ans.top();
        ans.pop();
        cout<<tmp;
    }





    return 0;
}




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

inline long long read(){
	long long s = 0, w = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9'){
		if (ch == '-') w = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9'){
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * w;
}
const int N = 110, inf = 0x3f3f3f;
long long n, x[N], ans = inf, tot;

int main(){
	n = read();
	for (int i = 1; i <= n; i++){
		x[i] = read();
	}
	sort (x+1, x+n+1);
	for (int i = 1; i <= x[n]; i++){
		for (int j = 1; j <= n; j++){
			tot += abs(x[j] - i) * abs(x[j] - i);
			if (tot >= ans){
				continue;
			}
		}
		ans = min(ans, tot);
		tot = 0;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
double solved1(int r,int y);
double solved2(int r,int y);
int main(){
    int n;
    while(scanf("%d",&n),n){
        int ans = 0;
        double hi = 0;
        int y;
        scanf("%d",&y);
        for(int q = 0;q < n; q++){
            int b,r,t;
            scanf("%d%d%d",&b,&r,&t);
            double x = 0;
            (t == 1) ? x = 1+y*r/100.0 : x = pow(1+r/100.0,y);
            if(x > hi){
                //printf("b = %d\n",x);
                hi = x;
                ans = b;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

vll divisor(ll n){
	vll res;
	for(ll i=1; i*i<=n; i++){
		if(n%i) continue;
		res.push_back(i);
		if(i*i!=n) res.push_back(n/i);
	}
	SORT(res);
	return res;
}

int main(void) {
	ll n; cin >> n;
	vll divis = divisor(n);
	ll ans = 0;
	for(auto di: divis){
		if(di==1) continue;
		ll m = di-1;
		if((n/m)==(n%m)) ans += m;
	}
	cout << ans << endl;
}




Measured memory_bytes: 384
Enumerator.new {|y|
  until (n = gets.to_i).zero?
    y << n.times.map { gets.split(" ").map(&:to_i) }
  end
}
  .flat_map {|params|
    targets = params
      .each_with_object({}) {|(id, n, p), acc| acc[id] = (acc[id] || 0) + n * p }
      .select {|id, tp| tp >= 1000000 }
      .keys
    targets.empty? ? ['NA'] : targets
  }
  .each(&method(:puts))

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

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int A,B,X;
  cin>>A>>B>>X;
  cout<<(A<=X&&X<=A+B?"YES":"NO")<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			while(sc.hasNext()) {
				String str = sc.next();
				int joi = 0;
				int ioi = 0;
				
				if(str.indexOf("JOI") == -1 && str.indexOf("IOI") == -1) {
					break;
				}else {
					for(int i=0; i<str.length()-2; i++) {
						String ss = str.substring(i,i+3);
						if(ss.equals("JOI")) {
							joi++;
							i++;
						}else if(ss.equals("IOI")) {
							ioi++;
							i++;
						}
					}
						
				}


				System.out.println(joi);
				System.out.println(ioi);
				
			}
			
			

			
		}
	}
}






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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

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

  // if(400<=n && n<600){
  //   ANS(8);
  // }else if(600<=n && n<800){
  //   ANS(7);
  // }

  ANS(10 - n / 200);
  return 0;
}


Measured memory_bytes: 3632
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int x=sc.nextInt();
    double ok=0;
    double ng=90;
    for(int i=0;i<300;i++){
      double check=ok+(ng-ok)/2;
      if(calc(a,b,x,check)){
        ok=check;
      }else{
        ng=check;
      }
    }
    System.out.println(ok);
  }
  static boolean calc(double a,double b,double x,double c){
    double cc=Math.toRadians(c);
    if(cc>Math.atan2(b,a)){
      return (a*b*b/Math.tan(cc)/2>=x);
    }else{
      return (a*a*b-a*a*a*Math.tan(cc)/2>=x);
    }
  }
}

Measured memory_bytes: 23892
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

def dfs(v,c=-1):
    for i in graph[v]:
        if i==c:
            continue
        root[i]+=root[v]
        dfs(i,v)
n,q=map(int,input().split())
graph=[[] for _ in range(n)]
root=[0]*n
for i in range(n-1):
    a,b=map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

for i in range(q):
    p,x=map(int,input().split())
    root[p-1]+=x
dfs(0)
print(*root)

Measured memory_bytes: 268464
use whiteread::parse_line;

fn main() {
    let s: String = parse_line().unwrap();
    let s = s.as_str();
    let mut ans: i64 = std::i64::MAX;

    for i in 0..s.len() - 2 {
        let mut chunk = String::new();
        let mut iter = s.chars();
        chunk.push(iter.nth(i).unwrap());
        chunk.push(iter.next().unwrap());
        chunk.push(iter.next().unwrap());
        let num = chunk.parse::<i64>().unwrap();
        ans = ans.min((753 - num).abs());
    }
    println!("{}", ans);
}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

// Most important thing in CP - Have Fun :)

void solve(){
	//write here
    ll sm = 0;
    string s;
    cin>>s;
    rep(i,0,sz(s)){
        sm+=s[i]-'0';
    }
    if (sm%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return;
}

int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
		solve();
	return 0;
}

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

int main(){
	string c_input, c_output;
	vector<string> alphabet
	={"a","b","c","d","e","f","g","h","i","j","k","l",
	"m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	cin >> c_input;
	
	for(int i;i<26;i++){
		if(c_input==alphabet.at(i)){
			c_output = alphabet.at(i+1);
			break;
		}
	}
	cout << c_output << endl;
	return 0;
}

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


int main()
{
    string S;
    cin >> S;
    if (S[2]==S[3] && S[4]==S[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Random;

public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int a = sc.nextInt();
        int b = 1000;
        int c = 1;
        while(true){
            if(b*c>=a){
                System.out.println((b*c)-a);
                break;
            }else if(b*c<a){
                c++;
            }
        }
    }
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

using namespace std;

ll euclidean_algo(ll x, ll y)
{
	ll res;
	ll mod = x % y;

	if (mod == 0)
		res = y;
	else
		res = euclidean_algo(y, mod);

	return res;
}


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

	vector<ll> t(n);
	rep (i, 0, n)
		cin >> t[i];

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

	ll gcd = 0;
	ll lcm = t[0];
	rep (i, 1, n) {
		if (lcm > t[i])
			gcd = euclidean_algo(lcm, t[i]);
		else
			gcd = euclidean_algo(t[i], lcm);

		lcm = lcm / gcd * t[i];
	}

	cout << lcm << endl;

	return 0;
}


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

int main() {

    int a, b;
    cin >> a >> b;

    if ((a * b) % 2 == 1) {
        cout << "Odd" << endl;
    }

    else if ((a * b) % 2 == 0) {
        cout << "Even" << endl;
    }

    else {
        cout << "error" << endl;
    }
}

Measured memory_bytes: 256
import std.stdio, std.string, std.array, std.conv, std.algorithm;

long lcm(long x, long y) {
    import std.numeric;
    return x * y / gcd(x, y);
}

void main() {
    long[] tmp = readln.split.to!(long[]);
    long a = tmp[0] - 1, b = tmp[1], c = tmp[2], d = tmp[3];
    long l = lcm(c, d);
    long n = b - b / c - b / d + b / l;
    long m = a - a / c - a / d + a / l;
    writeln(n - m);
}

Measured memory_bytes: 256
use std::io::*;

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

    let mut four = 0;
    let mut two = 0;
    let mut other = 0;
    for i in 0..n {
        if a[i] % 4 == 0 {
            four += 1;
        } else if a[i] % 2 == 0 {
            two += 1;
        } else {
            other += 1;
        }
    }

    two = std::cmp::min(two, 1);
    if four + 1 < two + other {
        println!("No");
    } else {
        println!("Yes");
    }
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int inf = 1e9;
int h1, m1, h2, m2, k;

int main(){
	cin>>h1>>m1>>h2>>m2>>k;
	int x = h1 * 60 + m1;
	int y = h2 * 60 + m2;
	y -= k;
	if(y - x < 0)cout<<0<<endl;
	else cout<<y - x<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
#include<list>
using namespace std;

#define MAX 1000

bool isPrime(int n){
    int i, r, res;
    if(n==1) return false;
    else if(n==2) return true;
    r = sqrt(n);
    bool flg;
    for(i=3; i<n; i+=2){
        res = n % i;
        if(res == 0) return false;
    }
    return true;

}

int main(){
    int i, n;
    cin >> n;
    bool p = isPrime(n);
    while(!p){
        n++;
        p = isPrime(n);
    }
    cout << n << endl;
}

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

struct AB
{
	long long int A;
	long long int B;
};

long long int asc(const void *a, const void *b) {
	struct AB *X = (struct AB *)a;
	struct AB *Y = (struct AB *)b;
	return X->B - Y->B;
}


int main() {
	long long int N, i, j, sum = 0;
	struct AB ab[200000];

	scanf("%lld", &N);
	for (i = 0; i < N; i++) {
		scanf("%lld %lld", &ab[i].A, &ab[i].B);
		
	}

	qsort(ab, N, sizeof(struct AB), asc);

	for (i = 0; i < N; i++) {
		sum = sum + ab[i].A;
		if (sum > ab[i].B) {
			printf("No");
			return 0;
		}
	}

	printf("Yes");

	return 0;
}

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

int main(){
    int x, y;

    cin >> x >> y;

    if(y < (x * 2) || y > (x * 4)){
        cout << "No\n";
    }
    else if(y % 2 == 0){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>
char sig[3]={'-','+','*'};
char g[50],a[50],b[50],c[50],d[50];
char* sign(char *x,char *y,int c){
	if(c<3)sprintf(g,"(%s %c %s)",x,sig[c%3],y);
	else sprintf(g,"(%s %c %s)",y,sig[c%3],x);
	return g;
}
int calc(int x,int y,int c){
	switch(c){
	case 0:return x-y;
	case 1:return x+y;
	case 2:return x*y;
	case 3:return y-x;
	}
	return 0;
}
int check(char *a,char *b,char *c,char *d,int o){
	int i,j,k;
	for(i=0;i<4;i++){
		for(j=0;j<4;j++){
			for(k=0;k<4;k++){
				if(o){
					if(calc(calc(a[0]-'0',b[0]-'0',i),calc(c[0]-'0',d[0]-'0',j),k)==10){
						strcpy(a,sign(a,b,i));
						strcpy(c,sign(c,d,j));
						strcpy(a,sign(a,c,k));
						printf("%s\n",a);return 1;}
				}

				if(calc(calc(calc(a[0]-'0',b[0]-'0',i),c[0]-'0',j),d[0]-'0',k)==10){
					strcpy(a,sign(a,b,i));
					strcpy(a,sign(a,c,j));
					strcpy(a,sign(a,d,k));
					printf("%s\n",a);return 1;}
			}
		}
	}
	return 0;
}
int main(void){
	while(scanf("%s %s %s %s",a,b,c,d)!=EOF){
		if(a[0]=='0' && b[0]=='0' && c[0]=='0' && d[0]=='0')break;
		if(check(a,b,c,d,1))continue;
		if(check(a,c,b,d,1))continue;
		if(check(a,d,c,b,1))continue;
		if(check(c,d,a,b,0))continue;
		if(check(b,d,a,c,0))continue;
		if(check(b,c,a,d,0))continue;
		if(check(a,b,d,c,0))continue;
		if(check(a,c,d,b,0))continue;
		if(check(a,d,b,c,0))continue;
		if(check(c,d,b,a,0))continue;
		if(check(b,d,c,a,0))continue;
		if(check(b,c,d,a,0))continue;
		printf("0\n");
	}
	return 0;
}

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

int main(){
	int N, M, C;
	cin >> N >> M >> C;
	vector<int> B(M);
	for(int i = 0; i < M; i++) cin >> B.at(i);
	vector<vector<int>> A(N, vector<int>(M));
	for(int i = 0; i < N; i++){
		for(int j = 0; j < M; j++){
			cin >> A.at(i).at(j);
		}
	}
	
	int cnt = 0;
	for(int i = 0; i < N; i++){
		int Code = C;
		for(int j = 0; j < M; j++){
			Code += A.at(i).at(j) * B.at(j);
		}
		if(Code > 0) cnt++;
	}
	 cout << cnt << endl;
}

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

using namespace std;
typedef pair<int, int> p;
int dx[12] = {-1,  0,  1,  2, 2, 2, 1, 0, -1, -2, -2, -2};
int dy[12] = {-2, -2, -2, -1, 0, 1, 2, 2,  2,  1,  0, -1};

void solve()
{
	p pos;
	while(cin >> pos.first >> pos.second, pos.first || pos.second)
	{
		queue<p> states;
		states.push(pos);
		int n;
		cin >> n;
		vector<p> sp(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> sp[i].first >> sp[i].second;
		}
		bool flag = true;
		for(int i = 0; i < n; ++i)
		{
			queue<p> next_states;
			while(states.size())
			{
				pos.first = states.front().first;
				pos.second = states.front().second;
				states.pop();
				p np;
				for(int j = 0; j < 12; ++j)
				{
					np.first = pos.first + dx[j];
					np.second = pos.second + dy[j];
					if((0 <= np.first && np.first <= 9 && 0 <= np.second && np.second <= 9) &&
					   (sp[i].first - 1 <= np.first && np.first <= sp[i].first + 1) &&
					   (sp[i].second - 1 <= np.second && np.second <= sp[i].second + 1))
					{
						next_states.push(p(np.first, np.second));
					}
				}
			}
			while(next_states.size())
			{
				states.push(next_states.front());
				next_states.pop();
			}
			if(states.size() == 0)
			{
				flag = false;
				break;
			}
		}
		if(!flag)
		{
			cout << "NA" << endl;
		}
		else
		{
			cout << "OK" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1208
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int d = sc.nextInt();
        int[][] g = new int[h*w+1][2];
        for (int i = 0; i < h; i++) {
            int y = i+1;
            for (int j = 0; j < w; j++) {
                int x = j+1;
                int a = sc.nextInt();
                g[a][0] = x;
                g[a][1] = y;
            }
        }
        int q = sc.nextInt();
        int[] L = new int[q], R = new int[q];
        for (int i = 0; i < q; i++) {
            L[i] = sc.nextInt();
            R[i] = sc.nextInt();
        }
        long[] s = new long[h*w+1];
        for (int i = d+1; i <= h*w; i++) {
            long b = Math.abs(g[i][0] - g[i-d][0]) + Math.abs(g[i][1] - g[i-d][1]);
            s[i] = s[i-d] + b;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < q; i++) {
            long t = s[R[i]] - s[L[i]];
            sb.append(t + "\n");
        }
        System.out.print(sb.toString());
        sc.close();

    }

}


Measured memory_bytes: 99868
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
using ll=long long;

#define PRI(n) cout << n <<endl;
#define PRI2(n, m) cout << n << " " << m << endl;
#define PRI3(n, m, o) cout << n << " " << m<< " " << o << endl;

#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REPInv(i, n)  for(int i = n-1; i >= 0; --i)

#define FOR(i, t, n)  for(int i = t; i <= (int)n; ++i)
#define FORInv(i, t, n)  for(int i = t; i >= (int)n; --i)

const char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                           's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
const ll MOD = 1e9 + 7;

ll GCD(ll a, ll b) {
    if (b == 0)return a;
    return GCD(b, a % b);
}

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll nCr(int n, int r) {
    vector<ll> C(r + 1);
    C[0] = 1;
    FOR(i, 1, n) FORInv (j, min(i, r), 1)C[j] = (C[j] + C[j - 1]) % MOD;
    return C[r];
}

int N;
string S;

int main() {
    cin >> S;
    int a = 0, b = 0;
    REP(i, S.length()) {
        if (S[i] == '0')a++;
        else b++;
    }
    cout << min(a, b) * 2 << endl;
    return 0;
}

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

bool odd(string s){
    int n=s.size();
    string x = s.substr(0,n/2);
    string y = s.substr(n/2,n);
    return (x==y?0:1);
}

void solve(){
    string s;cin>>s;
    s.pop_back();s.pop_back();
    while(odd(s)){
        s.pop_back();s.pop_back();
    }
    cout << s.size() <<endl;
}

int main(){
    solve();
    return 0;
}


Measured memory_bytes: 256
let readInt () = stdin.ReadLine() |> int

let readMoney () =
    stdin.ReadLine().Split(" ")
    |> fun [| x; y |] -> (float x, y)

[ 1 .. (readInt ()) ]
|> List.map (fun _ -> readMoney ())
|> List.sumBy (fun (money, unit) -> if unit = "JPY" then money else money * 380000.0)
|> printfn "%f"


Measured memory_bytes: 30252
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string s[50];
int h,w;
bool f=true;

int main(){
	cin>>h>>w;
	for(int i=0;i<h;i++){
		cin>>s[i];
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(s[i][j]=='#'){
				if((j==0||s[i][j-1]!='#')&&(i==h-1||s[i+1][j]!='#')&&(i==0||s[i-1][j]!='#')&&(j==w-1||s[i][j+1]!='#')){
					f=false;
					break;
				}
			}
		}
		if(!f){
			break;
		}
	}
	if(f){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<long> l(n+1);
  if(n==1){
    cout << 1 << endl;
  }
  else {
    l.at(0) = 2;
    l.at(1) = 1;
    for(int i=2;i<=n;i++){
      l.at(i) = l.at(i-2) + l.at(i-1);
    }
    cout << l.at(n) << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define PB push_back
#define MP make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<29)
#define LLINF (1LL<<60)
#define MOD 1000000007
#define REP(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
typedef pair<int, int> P;

int main() {
    int n, a[100], ans = 0;
    for (int i = 0; i < 100; i++)a[i] = 100000;
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int b;
        cin >> b;
        a[i] = min(a[i], b);
        a[i+1] = min(a[i+1], b);
    }
    for (int i = 0; i < n; i++) {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// In the name of God

#include <bits/stdc++.h>

using namespace std;

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

	int l;
	cin >> l;

	double x = 1.0*l/3;

	cout << fixed << setprecision(10) <<  x*x*x;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const ll MOD = 1000000007;
const double pi = acos(-1);

ll modpow(ll a, ll n) {
    ll ans = 1;
    REP(i,n) {
        ans *= a;
        ans %= MOD;
    }
    return ans;
}

int main() {
    ll N; cin >> N;
    ll ans = 0;
    ans += modpow(10,N) - modpow(9,N) - modpow(9,N) + modpow(8,N);
    ans %= MOD;
    ans=(ans+MOD)%MOD;
    cout << ans << endl;
}

Measured memory_bytes: 3632
using namespace std; 
#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define vect vector<ll>
#define maap map<ll,ll>  
#define MOD 998244353
#define mit map::iterator
#define MOD1 1000000007 
#define pii pair<ll,ll>
#define rep(i,a,b)	for(ll i=a;i< b;i++)
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
typedef  long long   int  ll;
//stringstream convert; 
  //  convert << number; 
  //  string s = convert.str(); 
ll  C(ll n,ll k) {
      ll res = 1;
    for (ll i = 1; i <= k; ++i)
    {
        res = res * (n - k + i) / i;
        res=res%MOD;
    }
    return (ll)(res);
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
bool isPrime(int n) {
 
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
} 
ll power( ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       exp/=2;
    }
    return res%MOD;
}
ll fact[200005],invfact[200005];
void init(){
	ll p=MOD;
	fact[0]=1;
	ll i;
	for(i=1;i<200005;i++){
		fact[i]=(i*fact[i-1])%p;
	}
	i--;
	invfact[i]=power(fact[i],p-2);
	for(i--;i>=0;i--){
		invfact[i]=(invfact[i+1]*(i+1))%p;
	}
}
ll ncr(ll n,ll r){
	return (((fact[n]*invfact[r])%MOD)*invfact[n-r])%MOD;
}
priority_queue < pair<ll,ll> , vector<pair<ll,ll> >,greater<pair<ll,ll> > > gq;
void ghost()
{  
 ll i,j,k=0,n,l=0,q=0,t=0;
  cin>>n;
  map<ll,ll>mp;
  k=n;
  for(i=2;i*i<=n;i++)
  {
    if(n%i==0)
    {
    	while(n%i==0)
    	{
    		n=n/i;
    		mp[i]++;
		}
	}
}
if(n!=1)
l=1;
   for(i=2;i<=1000002;i++)
   {
   	 	t=sqrt(2*mp[i]);
   	 	if((t*(t+1))<=2*mp[i])
   	 	l=l+t;
   	 	else
   	 	l=l+t-1;
   }
   cout<<l<<endl;
}
signed main()
{int test=1;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
fast
//cin>>test;
while(test--)
ghost();
return 0;
}

  

Measured memory_bytes: 66156
N,M = map(int,input().split())
Alist = list(map(int,input().split()))

cond = sum(Alist) * (1 / (4 * M))
count = 0

for A in Alist:
    if A >= cond:
        count += 1

if count >= M:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <stdio.h>
//#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;


int main(void)
{
	string S; cin >> S;
	vector<vector<int>> dp(S.size() + 1, vector<int>(2, 0));
	dp[1][0] = 1; 
	rep(i, 2, S.size() + 1) {
		if (S[i - 1] != S[i - 2])dp[i][0] = dp[i - 1][0] + 1;
		if (i >= 3 && (S[i - 3] != S[i - 1] || S[i - 2] != S[i]))
			dp[i][1] = dp[i - 2][1] + 1;
		dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1);
		dp[i][1] = max(dp[i][1], dp[i - 2][0] + 1);
	}

	cout << (max(dp[S.size()][0], dp[S.size()][1])) << endl;

	return 0;
}

Measured memory_bytes: 11524
#include <bits/stdc++.h>
using namespace std;
bool Grid[55][55];

int main()
{
  int n;
  cin >> n;
  vector<int> ls(n);
  for (int i = 0; i < n; i++)
  {
    cin >> ls[i];
  }
  sort(ls.begin(), ls.end());
  int64_t ans = 0;
  for (int i = 0; i < n - 2; i++)
  {
    for (int j = i + 1; j < n - 1; j++)
    {
      int a = ls[i], b = ls[j];
      int x = upper_bound(ls.begin() + (j + 1), ls.end(), b - a) - ls.begin();
      int y = lower_bound(ls.begin() + (j + 1), ls.end(), a + b) - ls.begin();
      ans += (y - x);
    }
  }
  cout << ans << endl;
}

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

typedef long long   ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> x(3);
    cin >> x[0] >> x[1] >> x[2];

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

    int b=x[2]-x[0];
    int l=x[2]-x[1];
    int ans;

    if(b%2==0 && l%2==0)      ans=b/2+l/2;
    else if(b%2==1 && l%2==1) ans=b/2+l/2+1;
    else                      ans=b/2+l/2+2;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn = 5100;
i64 dp[maxn][maxn];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n;
    cin >> n;
    vector<pii> a(n);
    forn(i, n) cin >> a[i].fi >> a[i].se;
    sort(all(a), [](pii p, pii q){return p.fi + p.se < q.fi + q.se;});
    forn(i, n + 1) forn(j, n + 1) dp[i][j] = 1e18;
    dp[0][0] = 0;
    forn(i, n) forn(j, i + 1) {
        uin(dp[i + 1][j], dp[i][j]);
        if (a[i].fi >= dp[i][j]) uin(dp[i + 1][j + 1], dp[i][j] + a[i].se);
    }
    int ans = n;
    while (dp[n][ans] > 1e17) --ans;
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 200960
# -- coding: utf-8 --
n = int(input())
masu = []
for i in range(2):
    masu.append(list(map(int, input().split(' '))))

result = []
if len(masu[0]) == 1:
    result.append(masu[0][0] + masu[1][0])
else:
    for i in range(1, len(masu[0])):
        result.append(sum(masu[0][:i]) + sum(masu[1][i-1:]))

print(max(result))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<iomanip>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>
i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

//メモリ置き場
int n;
vector<int> a;

//inputします
void input() {
	cin >> n;
	a.resize(n + 1);
	ff(i, 1, n + 1) {
		cin >> a[i];
	}
}

//ライブラリ置き場



//main
int main() {
    input();
	int ans = 0;
	ff(i, 1, n) {
		if (i == a[i]) {
			swap(a[i], a[i + 1]);
			ans++;
		}
	}
	if (a[n] == n)ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
MODE = "stdio"

line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = "\
  3 2
  ".split("\n")
  tmp.each{|s|
    line << s.strip
  }
end



a,b = line[0].split(" ").map(&:to_i)


printf("%d %d %.10f", a/b,a%b,a.to_f/b)

Measured memory_bytes: 8672
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>

#define MOD 1000000007

using namespace std;

int main(void){
    // Your code here!
    long long a, b;
    
    cin >> a >> b;
    cout << max(a+b, max(a-b, a*b)) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int dist(int x1, int y1, int x2, int y2){
    return abs(x1-x2) + abs(y1-y2);
}
 
int main(){
    int n, a, b, c, d, ans = INT_MAX;
 
    cin >> n >> a >> b >> c >> d;
    a--, b--, c--, d--;
    for(int i = 1 ; i < n ; i++){
	ans = min(ans, dist(a%i,a/i,b%i,b/i)+dist(c%i,c/i,d%i,d/i));
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int A, B;
  char op;
  cin >> A >> op >> B;

  // ここにプログラムを追記
  if(op == '+'){
    cout << A+B << endl;
  }else{
    cout << A-B << endl;
  }
  
}

Measured memory_bytes: 256
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int MAX_N = 200000;
int N;
ll a[MAX_N];

int main() {
  cin >> N;
  rep(i,N) cin >> a[i];

  ll sum = 0;
  rep(i,N) sum += a[i];

  ll ans = 1e18;
  ll t = 0;
  for (int i = 0; i < N-1; ++i) {
    t += a[i];
    ans = min(ans, abs((sum-t) - t));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
from decimal import Decimal
from bisect import bisect
n,m=map(int,input().split())
lst=sorted(map(Decimal, input().split()))

while m>0:
    p=lst[-1]
    index=bisect(lst,p/2)
    for i in range(n-1,index-1,-1):
        if m>0:
            lst[i]=lst[i]/2
            m-=1
    lst=sorted(lst)
    if lst[-1]<1:
        break

ans=0
for i in lst:
    ans+=i//1
print(ans)

Measured memory_bytes: 288120
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int n,mi=10000000,ma=-10000000;
    long long sum=0;
  cin >> n;
  int i,b;
  for(i=0;i<n;i++){
    cin >> b;
    mi=min(mi,b);
    ma=max(ma,b);
    sum+=b;
  }
  cout << mi <<  " " << ma << " " << sum << endl;
  return 0;
}


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

int main()
{
	string s;
	cin >> s;
	ll ans = 0, acount = 0;
	bool bflag = false, cflag = false;

	for(int i=0;i<s.size();i++) {
		if(s[i]=='A'){
			if(bflag) acount = 0;
			bflag = false;
			cflag = false;
			acount++;
		}
		if(s[i]=='B'){
			if(bflag) acount = 0;
			bflag = true;
			cflag = false;
		}
		if(s[i]=='C'){
			if(bflag) ans += acount;
			else acount = 0;
			bflag = false;
			cflag = true;
		}
	}


	cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int num[n];
    int ans = 0;
    for(int i = 0; i < n; i++){
        cin >> num[i];
        ans += (num[i]-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
        import java.io.*;
        import java.lang.*;
public class Main{
    private static void Solve(){
        Scanner in = new Scanner(System.in);
        int n; n = in.nextInt();
        String ss = in.next();
        StringBuilder str = new StringBuilder(ss);
        //System.out.println(str);
        int count = 1;
        for(int i=1;i<str.length();i++){
           // System.out.println("Hello");
            if(str.charAt(i) != str.charAt(i-1))
                count++;
        }
        System.out.println(count);
    }
    public static void main(String []args){
        Solve();
    }
}

Measured memory_bytes: 26136
#include <iostream>
#include <string>
#include <iostream>
#include <fstream>


using namespace std;

int main(void){
	string str;
	int a;
	int ans=0;
	int j=0,o=0,i=0; 
	cin >> str;
	for(a=0;a<str.size();a++){
		if(str[a]=='J'){
			j++,o=0,i=0;
			if(a>=1)if(str[a-1]!='J')j=1;
		}
		if(str[a]=='O'){
			o++;
			i=0;
			if(a>=1)if(str[a-1]=='I')j=0,o=1;
		}
		if(str[a]=='I')i++;
		if(j>=o && i>=o)ans=max(ans,o);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1984
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }
// }}} End

inline bool inside(int x, int y, int w, int h) {
  return (x >= 0 && y >= 0 && x < w && y < h);
}

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

int h, w;

vector<string> mat(1005);
vector<vector<int>> dist(1005, vector<int>(1005, INF));

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  IN(h, w);
  rep(i, h) IN(mat[i]);

  queue<pii> que;

  rep(i, h) rep(j, w) {
    if (mat[i][j] == '#') {
      que.push(make_pair(i, j));
      dist[i][j] = 0;
    }
  }

  i64 res = 0;
  while (!que.empty()) {
    int y = que.front().first;
    int x = que.front().second;
    que.pop();

    for (int i = 0; i < 4; ++i) {
      int ny = y + dy[i];
      int nx = x + dx[i];
      if (inside(nx, ny, w, h) &&
          dist[ny][nx] > dist[y][x] + 1 &&
          mat[ny][nx] != '#') {

        int norm = dist[y][x] + 1;
        mat[ny][nx] = '#';
        chmin(dist[ny][nx], norm);
        chmax(res, dist[ny][nx]);
        que.push(make_pair(ny,nx));
      }
    }
  }

  OUTL(res);

  return 0;
}


Measured memory_bytes: 21684
N,K = map(int,input().split())
A = list(map(int,input().split()))

P = 10**9+7

ans1 = 0
ans2 = 0
for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            if i < j:
                ans1 += 1
            elif i > j:
                ans2 += 1

K1 = (K*(K+1)//2)%P
K2 = (K*(K-1)//2)%P

ans = (ans1*K1+ans2*K2)%P

print(ans)


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

using namespace std;
typedef long long LL;
typedef pair<LL,LL>  PII;

string solve(vector<string> data, vector<int> cnt) {
	if(data.size() == 1) {
		string s;
		for(int i=0; i<cnt[0]; i++)
			s += data[0];
		return s;
	}
	vector<string> base;
	for(int i=0; i<cnt[0]; i++) {
		base.push_back(data[0]);
	}
	int pos = 0;
	if(data.size() == 3) {
		for(int i=0; i<cnt[2]; i++)	{
			base[i%cnt[0]] += data[2];
		}
		pos = cnt[2] % cnt[0];
			
	}
	for(int i=0; i<cnt[1]; i++) {
		base[pos + i % (cnt[0] - pos)] += data[1];
	}
	
	vector<string> nextd;
	vector<int> nextc;
	for(int i=base.size()-1; i>=0; i--) {
		if(nextd.size() == 0) {
			nextd.push_back(base[i]);
			nextc.push_back(1);
			continue;
		}
		if(nextd.back() == base[i]) {
			nextc[nextc.size()-1]++;
		}
		else {
			nextd.push_back(base[i]);
			nextc.push_back(1);
		}
	}
	
	return solve(nextd, nextc);
	
	
}



int main() {
	int a,b,c;
	cin >> a >> b >> c;
	
	vector<string> data;
	vector<int> val;
	if(a!=0) {
		data.push_back("a");
		val.push_back(a);
	}
	if(b!=0) {
		data.push_back("b");
		val.push_back(b);
	}
	if(c!=0) {
		data.push_back("c");
		val.push_back(c);
	}
	string ans = solve(data, val);
	cout << ans << endl;
	return 0;	
}

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



int main() {
    FILE * fi, * fout;
    int n;
    //fi = fopen("A.in" ,"r");
    //fout = fopen("A.out" ,"w");
    fi=stdin;
    fout=stdout;
    fscanf(fi,"%d" ,&n);
    if(n / 100 == n % 10)
       fprintf(fout,"Yes");
    else
       fprintf(fout,"No");
    //fclose(fi);
    //fclose(fout);
    return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K; cin >> N >> K;
    int D[K]; rep(i, K) cin >> D[i];
    for(int i = N;;i++){
        int val = i;
        bool ok = true;
        int len = to_string(val).length();
        rep(d, len){
            int dig = val % 10;
            val /= 10;
            rep(j, K){
                if(dig == D[j]) ok = false;
            }
        }
        if(ok){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

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

using namespace std;

#define ll long long int
#define inf 0x3f3f3f3f
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ii pair<int, int>
#define all(x) (x).begin(), (x).end()
#define N 1000007 // 10e6 + 7

int dp[N];

int n, k;
int h[N];


int go(int curr){
 	int &ret = dp[curr];
 	if(ret!=-1)return ret;
 	if(curr==n-1)return ret=0;
 	ret=inf;
 	for(int i=curr+1; i<min(n, curr+k+1); i++){
 		ret=min(ret, go(i)+abs(h[i]-h[curr]));
 	}
 	return ret;
}

int main(int argc, char const *argv[]){
	cin >> n >> k;
	memset(dp, -1, sizeof dp);

	for(int i=0; i<n; i++){
		cin >> h[i];
	}
	cout << go(0) << endl;
	return 0;
}

Measured memory_bytes: 9472
#include<stdio.h>
#include<iostream>
using namespace std;
int main() {
	int a;
	while (cin >> a, a) {
		int sum=0; 
		int d;
		int f;
		int e = 0;
		for (int i = 0; i < a; i++) {
			cin >> d;
			if (i == 0) {
				f = d;
				e = d;
			}
			if (d > e) {
				e = d;
			}
			if (f > d) {
				f = d;
			}
			sum += d;
		}
		sum = sum - (e + f);
		sum = sum / (a-2);
		cout << sum << endl;
	}
}




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

#define ll long long
#define ull unsigned long long int
#define INF 0x3f3f3f3f
#define pb push_back
#define pii pair<int, int>

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    const int t = 100005;
    int n, k;
    int v[t];
    int ans[t];
    
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    memset(ans, INF, sizeof ans);
    ans[0] = 0;
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= k; j++) {
            if (i - j >= 0)
                ans[i] = min(ans[i], ans[i - j] + abs(v[i] - v[i - j]));
        }
    }
    cout << ans[n - 1] << "\n";
    
    //cerr << "\n" << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N;
    cin >> N;
    vector<pair<i64, i64>> seg(N);
    vector<i64> X(N), L(N);
    rep(i, N){
        i64 X, L; cin >> X >> L;
        seg[i] = {X+L, X-L};
    }

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

    int ans = 0;
    i64 x = -2e9;
    rep(i, N){
        if(seg[i].second < x) continue;
        x = seg[i].first;
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3328
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double pi = acos(-1);
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
	for (auto &e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

//↑template↑

ll  gcd(ll  a, ll  b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

int main() {

	ll a, b, k[100005], ans;
	cin >> a >> b;
	for (int i = 0; i < a; ++i) {
		cin >> k[i];
		k[i] -= b;
		k[i] = abs(k[i]);
	}
	ans = k[0];
	for (int i = 1; i < a; ++i) {
		ans = gcd(ans, k[i]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    int N;
    cin >> N;
    int V[N], C[N];
    cins(V, V + N);
    cins(C, C + N);
    int ans = 0;
    for(int i = 0; i < N; i++){
        ans += max(0, V[i] - C[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256