akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import static java.lang.System.*;
import java.io.*;
import java.math.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		//PrintWriter out = new PrintWriter(System.out);
		if (sc.nextInt() == sc.nextInt())
			out.println("Yes")
		;
		else
			out.println("No");

		//out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}

Measured memory_bytes: 21204
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<numeric>
#include<limits.h>
#include<utility>
#include<cstdlib>
#include<bitset>
#define LP(i,n) for(int i=0;i<n;i++)
#define LPIN(n,a) for(int i=0;i<n;i++)cin >> a[i]
using namespace std;

int main(){
    int n;
    cin >> n;
    long long int a[n+1];
    long long int b[n];
    long long int cnt =0;
    LP(i,n+1)cin >> a[i];
    LP(i,n)cin >> b[i];
    for(int i=0;i<n;i++){
        if(a[i] >= b[i]){
cnt += b[i];
b[i] = 0;
        }
else{
cnt += a[i];
b[i] -= a[i];
if(a[i+1] >b[i]){
cnt += b[i];
a[i+1] -= b[i];
}
else{
    cnt += a[i+1];
    a[i+1] = 0;
}
}
    }    
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1792
//	-*- mode: C++ -*-
//	Simple Calculator
//		Write a program which reads two integers a, b and an operator op, and then prints the value of a op b.
//
//		The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.
//
//	Input
//		The input consists of multiple datasets. Each dataset is given in the following format.
//
//		a op b
//		The input ends with a single '?'. Your program should not process for this terminal symbol.
//
//	Output
//		For each dataset, print the value in a line.
//
//	Constraints
//		0 ≤ a, b ≤ 20000
//		No divisions by zero are given.
//	Sample Input 1
//		1 + 2
//		56 - 18
//		13 * 2
//		100 / 10
//		27 + 81
//		0 ? 0
//	Sample Output 1
//		3
//		38
//		26
//		10
//		108

#include <iostream>
#include <functional>
#include <tuple>
#include <vector>

typedef std::function<int(unsigned int, unsigned int)>	f;
typedef std::tuple<unsigned int, f, unsigned int>	t;

int	add(unsigned int	a,
		unsigned int	b)
{
	return	a + b;
}

int	sub(unsigned int	a,
		unsigned int	b)
{
	return	a - b;
}

int	mul(unsigned int	a,
		unsigned int	b)
{
	return	a * b;
}

int	divi(unsigned int	a,
		 unsigned int	b)
{
	return	a / b;
}

std::function<unsigned int(unsigned int, unsigned int)> Func(char	op)
{
	switch(op){
	case '+':
		return add;
		break;
	case '-':
		return sub;
		break;
	case '*':
		return mul;
		break;
	case '/':
		return divi;
		break;
	default:
		return nullptr;
	}
}

int	main(int	argc,
		 char*	argv[])
{
	unsigned int	a	{0};
	unsigned int	b	{0};
	char			op	{'\0'};

	std::vector<t>	v	{};

	for(;;){
		std::cin >> a >> op >> b;

		f	func	= Func(op);

		if(func == nullptr){
			break;
		}

		v.push_back(std::make_tuple(a, func, b));
	}

	for(auto ele : v){
		std::cout << std::get<1>(ele)(std::get<0>(ele), std::get<2>(ele)) << '\n';
	}
}



Measured memory_bytes: 3112
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    long long A, B;
    cin >> A >> B;

    long long gcd = __gcd(A, B);

    int no_of_prime_diviors = 0;
    for(long long i = 2; i*i <= gcd; i++)
    {
        if(gcd%i == 0)
        {
            no_of_prime_diviors++;

            while(gcd%i == 0)
            {
                gcd /= i;
            }
        }
    }

    if(gcd > 1)
        no_of_prime_diviors++;

    int coprime_divisors = 1 + no_of_prime_diviors;

    cout << coprime_divisors << "\n";

    return 0;
}


Measured memory_bytes: 256
N = int(input())
g = [[] for _ in range(N+1)]

for _ in range(N-1):
        a,b = map(int,input().split())
        g[a].append(b)
        g[b].append(a)

def BFS(v):
        d = [N]*(N+1)
        d[v] = 0
        q = [v]

        while q:
                u = q.pop()
                for i in g[u]:
                        if d[i] == N:
                                d[i] = d[u] + 1
                                q.append(i)

        return d

db = BFS(1)
dw = BFS(N)

b = 0
w = 0

for i in range(1,N+1):
        if db[i] <= dw[i]:
                b += 1
        else:
                w += 1

if b > w:
        print("Fennec")
else:
        print("Snuke")

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

int main(){
    string s,t;
    cin>>s>>t; 


    bool flg=true;
    rep(i,s.size()){
        if(s[i]!=t[i]){
            flg=false;
            break;    
        }
    }

    if(s.size()+1 != t.size()){flg=false;}



    if(flg==true){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
  
  string ans;
  
  ans = "No";
  int count;
  count = 0;
  
  int stringlength;
  stringlength = N.size();
  //N.at(i) == 'R' ||  N.at(i) == 'U'||  N.at(i) == 'D'
  //N.at(i) == 'L' ||  N.at(i) == 'U'||  N.at(i) == 'D'
  for (int i = 0; i < stringlength; i++) {
    if(i%2 == 0){
    if(N.at(i) == 'R' ||  N.at(i) == 'U'||  N.at(i) == 'D'){
    count++;
    }
    }else{
    if(N.at(i) == 'L' ||  N.at(i) == 'U'||  N.at(i) == 'D'){
    count++;
    }
    }    
  }
    if(count==stringlength){
    ans = "Yes";
    }

    cout << ans << endl;
  
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    string a;
    cin >> a;
    reverse(a.begin(), a.end());
    cout << a << endl;
}

Measured memory_bytes: 1172
#include <stdio.h>
#include <stdlib.h>
#define ms_valtype int

//比較関数
int compare_ms(ms_valtype a, ms_valtype b){
	return a - b;
}

//昇順
void sort_sub(ms_valtype *origin, int left, int right, ms_valtype *tmp){
	if(right - left > 1){
		int i, j, k, half = (left + right) / 2;
		sort_sub(origin, left, half, tmp);
		sort_sub(origin, half, right, tmp);
		for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}
		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(compare_ms(tmp[j], tmp[k]) <= 0 && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	}
}

void sort(ms_valtype *origin, int N){
	ms_valtype *tmp = (ms_valtype *)malloc(sizeof(ms_valtype) * N);
	sort_sub(origin, 0, N, tmp);
	free(tmp);
}

int main(){
	int N, i;
	scanf("%d", &N);
	int *X = (int *)malloc(sizeof(int) * N);
	int *X_sub = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &X[i]);
		X_sub[i] = X[i];
	}
	sort(X_sub, N);
	for(i = 0; i < N; i++){
		if(X[i] <= X_sub[N / 2 - 1]){
			printf("%d\n", X_sub[N / 2]);
		}
		else{
			printf("%d\n", X_sub[N / 2 - 1]);
		}
	}
	return 0;
}

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

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

    return 0;
}

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

int main() {
  int N, tmp;
  vector<int> v;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    v.push_back(tmp);
  }
  sort(v.begin(), v.end(), greater<int>());

  int alice = 0;
  int bob = 0;
  for (int i = 0; i < (int)v.size(); i++) {
    if (i % 2 == 0) {
      alice += v[i];
    } else {
      bob += v[i];
    }
  }

  cout << alice - bob << endl;
  return 0;
}

Measured memory_bytes: 632
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0, p = 0, odd = 0, even = 0;
	cin >> n >> p;
	vector<int> a(n);
	for (auto &i : a)
	{
		cin >> i;
		if (i & 1)
			++odd;
		else
			++even;
	}
	if (odd == 0)
		cout << (p == 0 ? (1ll << n) : 0);
	else
		cout << (1ll << n - 1ll);
	cout << endl;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
vector<pair<int,int> >v[N+2];
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;
  for(int i=1;i<=n;i++)
  {
    int x;cin>>x;
    while(x--)
    {
      int a,b;cin>>a>>b;a--;
      v[i].push_back({a,b});
    }
  }
  int ans=0;
  for(int msk=0;msk<(1<<n);msk++)
  {
    int f=0;
    for(int i=1;i<=n;i++)
    {
      if(msk&(1<<(i-1)))
      {
        for(auto x:v[i])
        {
          if(((bool)(msk&(1<<x.first)))!=x.second)f=1;
        }
      }
    }
    if(!f)ans=max(ans,__builtin_popcount(msk));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)

int main(){
    int n; cin >> n;
    vector<tuple<string,int,int>> sp;
    rep(i,n){
        string s; int p;
        cin >> s >> p;
        p *= -1;
        sp.push_back(make_tuple(s,p,i+1));
    }
    sort(sp.begin(),sp.end());
    rep(i,n){
        cout << get<2>(sp[i]) << endl;
    }
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rstrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())

    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = ((ng//2)//2) * 2
    while ng - ok > 2:
        a = ask(mid)
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (((ok//2)+(ng//2))//2)*2
    ask((ok+ng)//2)
    ask(N-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38852
(defn input []
  (list
    (loop [n (Integer/parseInt (read-line)) Ss '()]
      (if (zero? n)
        Ss
        (recur (dec n) (cons (read-line) Ss))))
    (loop [m (Integer/parseInt (read-line)) Ts '()]
      (if (zero? m)
        Ts
        (recur (dec m) (cons (read-line) Ts))))))

(defn TwoColorsCardGame [[Ss Ts]]
  (let [dSs (distinct Ss)]
    (apply max
      (cons 0
        (map -
          (map #(->> Ss (filter (partial = %)) count) dSs)
          (map #(->> Ts (filter (partial = %)) count) dSs))))))


(-> (input)
  TwoColorsCardGame
  println)

Measured memory_bytes: 65368
line_num = int(input())
otoshidama_list = []
bitcoin_rate = 380000.0

for _ in range(line_num):
    line = input().split(' ')
    otoshidama = (float(line[0]), line[1])
    otoshidama_list.append(otoshidama)


def trans_otoshidama(otoshidama):
    if otoshidama[1] == "JPY":
        return otoshidama[0]
    else:
        return otoshidama[0] * bitcoin_rate


trans_list = list(map(trans_otoshidama, otoshidama_list))
print(sum(trans_list))


Measured memory_bytes: 3060
n = int(input())
xi = list(map(int, input().split()))

mi = min(xi)
ma = max(xi)
ans = 10**18
for i in range(mi, ma+1):
    num = 0
    for j in range(n):
        num += (xi[j]-i)**2
    ans = min(ans, num)
print(ans)


Measured memory_bytes: 38756
#include<bits/stdc++.h>
using namespace std;
string a;
int b,c;
int main(){
    cin>>a;
    for(int i=0;i<a.length();i++){
        if(a[i]=='C')b++;
        if(a[i]=='F'&&b>=1)c++;
    }
    if(c>=1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
long long int rec(long long int idx,long long int out,long long int val)
{
	if (idx==s.size()) return (out*(val==0));
	return (rec(idx+1,out,val*10+s[idx]-'0')+rec(idx+1,out+val*10+s[idx]-'0',0));
}
int main()
{
	cin>>s;
	cout<<(long long int)rec(0,0,0)<<endl;
}

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

using namespace std;
using llong = long long int;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

// const static int MOD = 1000000007;
const static int INF = 1000000000;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<vector<int> > G(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> signpost(n);
    vector<int> dist(n, -1);
    dist[0] = 0;
    queue<int> Q;
    Q.push(0);
    while (! Q.empty()) {
        int v = Q.front();
        Q.pop();
        rep(i, (int)G[v].size()) {
            if (dist[G[v][i]] != -1) continue;
            dist[G[v][i]] = dist[v] + 1;
            signpost[G[v][i]] = v;
            Q.push(G[v][i]);
        }
    }

    cout << "Yes" << endl;
    rep(i, n - 1) {
        cout << signpost[i + 1] + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 10708
// AOJ 2858: Prime-Factor Prime
// 2017.11.25 bal4u@uu

#include <stdio.h>
#include <string.h>
#include <math.h>

#define MAX  31623			// sqrt(1e9)
char tbl[MAX+3];

int sz;						// max sz = 3402, prime[0] = 2, prime[3401] = 31623
int prime[3500] = {  		// prime[40] = 179, 179^2 = 32041
  2, 3,  5,  7, 11, 13, 17, 19, 23, 29, 
 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 
 73, 79, 83, 89, 97,101,103,107,109,113, 
127,131,137,139,149,151,157,163,167,173, 
179 };

int sqp[41] = {				// squre of prime: sqp[i] = prime[i] * prime[i]
  4, 9,25,49,121,169,289,361,529,841,961,
1369,1681,1849,2209,2809,3481,3721,4489,5041,
5329,6241,6889,7921,9409,10201,10609,11449,11881,12769,
16129,17161,18769,19321,22201,22801,24649,26569,27889,29929,
32041 };

char ptbl[31] = { 0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0 };

void sieve()
{
	int i, j, k;

	for (i = 1; i < 41; i++) {
		k = prime[i];
		for (j = sqp[i]; j < MAX; j += k) tbl[j] = 1;
	}
	for (sz = 40, i = 179; i <= MAX; i += 2) if (!tbl[i]) prime[sz++] = i;
}

int a[1000002];
int b[1000002];

int bsch(int x)
{
	int m, l = 0, r = sz;

    while (l < r) {
        m = (l + r) >> 1;
		if (prime[m] == x) return m;
        if (prime[m] < x) l = m + 1; else r = m;
    }
	return l-1;
}

int main()
{
	int l, r, i, k, ll, p0, pp, ans;
	long long j;

	sieve();

	scanf("%d%d", &l, &r);
	if (r < 4) { puts("0"); return 0; }
	sz = bsch((int)sqrt(r));

	k = r-l; for (i = 0; i <= k; i++) b[i] = 1;
	for (i = 0; i <= sz; i++) {
		p0 = prime[i];
		for (j = p0; j <= r; j *= p0) {
			pp = (int)j;
			ll = pp*(1+(l-1)/pp);
			while (ll <= r) a[ll-l]++, b[ll-l] *= p0, ll += pp;
		}
	}

	ans = 0;
	for (k = l, i = 0; k <= r; i++, k++) {
		if (k != b[i]) a[i]++;
		if (ptbl[a[i]]) ans++;
	}
	printf("%d\n", ans);
	return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

ll dp[2002][2002];

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    ll N;
    cin >> N;
    vector<Pll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i].first;
        A[i].second = i;
    }

    sort(A.begin(), A.end(), greater<Pll>());

    for (ll i = 0; i < N; i++) {
        for (ll j = 0; j < N; j++) {
            ll p, idx;
            tie(p, idx) = A[i + j];
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + p * abs(idx - i));
            dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + p * abs(idx - (N - 1 - j)));
        }
    }

    ll ans = 0;
    for (ll i = 0; i <= N; i++) {
        ans = max(ans, dp[i][N - i]);
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 34988
class Union_Find():
    def __init__(self, num):
        self.par = [-1]*(num+1)
        self.siz = [1]*(num+1)

    def same_checker(self, x, y):
        return self.find(x) == self.find(y)

    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            x = self.par[x]
            return self.find(x)

    def union(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        if rx != ry:
            if self.par[rx] < self.par[ry]:
                self.par[ry] = rx
                self.siz[rx] += self.siz[ry]
            elif self.par[rx] > self.par[ry]:
                self.par[rx] = ry
                self.siz[ry] += self.siz[rx]
            else:
                self.par[rx] -= 1
                self.par[ry] = rx
                self.siz[rx] += self.siz[ry]
        return

    def size(self, x):
        return self.siz[self.find(x)]


n, m = map(int, input().split())
tree = Union_Find(n)
for i in range(m):
    x, y, z = map(int, input().split())
    tree.union(x, y)

ans = []
for i in range(1, n+1):
    ans.append(tree.find(i))

print(len(set(ans)))


Measured memory_bytes: 14760
// Created by sz on 2018/11/24
#include <cstdio>
#include <cmath>
#include<algorithm>
#include<vector>
using namespace std;
const int MAX = 105;

int main(){
//    freopen("./input.txt", "r", stdin);
    int N, a[MAX], sum = 0;
    scanf("%d", &N);
    for (int i = 0; i<N; i++){
        scanf("%d",&a[i]);
        sum += a[i];
    }
    
    int min = abs(N *a[0] - sum);
    int ans = 0;
    for (int i = 0; i< N; i++){
        if(abs(N *a[i] - sum) < min)
        {
            ans = i;
            min =abs(N *a[i] - sum);
        }
    }
    printf("%d\n", ans);
    return 0;
}




Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int h, w;
vector<vector<char>> a;
vector<vector<int>> dp;

int main() {
    cin >> h >> w;
    a = vector<vector<char>>(h, vector<char>(w, '.'));
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            cin >> a.at(i).at(j);
        }
    }

    dp = vector<vector<int>>(h+2, vector<int>(w+2, 0));
    dp.at(1).at(1) = 1;
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            if(!(i==0&&j==0)) {
                if(a.at(i).at(j) == '#') {
                    dp.at(i+1).at(j+1) = 0;
                }else {
                    dp.at(i+1).at(j+1) = (dp.at(i).at(j+1)+dp.at(i+1).at(j))%mod;
                }
            }
        }
    }

    cout << dp.at(h).at(w) << endl;
}

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)((n)-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    ll n; cin >> n;
    ll ans = n*(n+1)*(n+2)/6;
    rep(i,n-1){
        ll u,v; cin >> u >> v;
        if(u > v) swap(u,v);
        ans -= u * (n+1-v);
    }

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

Measured memory_bytes: 3568
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
    input! {
        s:Chars,
        t:Chars,
    }
    let mut ans = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

int main(){
    string o, e;
    cin >> o >> e;
    int leno=o.length();
    int lene=e.length();
    for(int i=0; i<leno; i++){
        cout << o[i];
        if(i<lene){
            cout << e[i];
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
r = 0
for i in range(1, 10):
  if i <= N:
    r += 1
for i in range(100, 1000):
  if i <= N:
    r += 1
for i in range(10000, 100000):
  if i <= N:
    r += 1
print(r)


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

#define int long long

#define REP(i, a) for(int i = 0; i < (a); i++)

using namespace std;

signed main()
{
    cout << fixed << setprecision(10);

    while(true)
    {
        int H, W; cin >> H >> W;
        if(H == 0 && W == 0) break;
        REP(i, H)
        {
            REP(j, W)
            {
                if((i+j) % 2 == 0) cout << '#';
                else cout << '.';
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3088
#include<iostream>
using namespace std;
int main(){
    int N;
    bool can = false;
    cin >> N;
    while(N >= 4){
        if(N % 4 == 0 || N % 7 == 0){
            can = true;
            break;
        }
        N -= 4;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3604
#include<stdio.h>
int main()
{
	int n,i,m=0;
	char s[51];
	scanf("%d\n%s",&n,s);
	i=2;
	do
	{
		if(s[i-2]=='A'&&s[i-1]=='B'&&s[i]=='C')
				m++;
		i++;
	}while(i<n);
	printf("%d",m);
	return 0;
}

Measured memory_bytes: 128
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();

    if n > m + 1 || m > n + 1 {
        return "0".to_string();
    }

    let f_n = fact(n);
    let f_m = fact(m);

    let mut ans = f_n * f_m % MOD;
    if n == m {
        ans = ans * 2 % MOD;
    }
    return ans.to_string();
}

const MOD: usize = 1_000_000_007;

fn fact(mut x: usize) -> usize {
    let mut result = 1;
    while x > 0 {
        result = result * x % MOD;
        x -= 1;
    }
    result
}


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

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

    ll a;cin>>a;
    string s;cin>>s;

    ll b=0;

    for(auto e: s)
    {
        if(e != '.')
        {
            b += (e-'0');

            b *= 10;
        }
    }

    b/=10;

    cout<<a*b/100<<endl;

    return 0;

}


Measured memory_bytes: 3640
N,M = map(int,input().split())
edge = []
node = [[]for i in range(N)]
for i in range(M):
    n = list(map(int,input().split()))
    n[0] -= 1
    n[1] -= 1
    node[n[0]].append(n[1])
    node[n[1]].append(n[0])
    edge.append(n)
for i in node:
    print(len(i))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,arr[10009]={},i,j,l;
    scanf("%lld",&a);
    for(i=0;i<a;i++)
        scanf("%lld",&arr[i]);
    l=0;
    for(i=0;i<a-1;i++){
        for(j=i+1;j<a;j++){
            c=arr[i]*arr[j];
            l+=c;
        }
    }
        printf("%lld\n",l);
}


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

        #define ll long long
        #define pb push_back
        #define printV(v) for(int i=0;i<(int)v.size();i++){cout << v[i]<< " ";} cout << endl
        #define printRev(v) for(int i=(int)v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
        #define sortV(v) sort(v.begin(),v.end())
        #define revV(v) reverse(v.begin(),v.end())
    

        ll a,b,c,d,e,f,g,n,m,k,t,x,h,w,p,q,y;
        string str = "";
        ll mod = 1e9 + 7;
        const int N = 3009;
       
    

        void solve(){
            cin >> n;
            ll arr[n];
            ll sum = 0;
            for(int i=0;i<n;i++){
                cin >> arr[i];
                sum += arr[i];
                sum %= mod;
            }
            ll answer = sum*sum;
            answer %= mod;
            sum = 0;
            for(int i=0;i<n;i++){
                sum += arr[i] * arr[i];
                sum %= mod;
            }
            answer = (answer + mod - sum) % mod;
            if(answer % 2){
                answer = answer + mod;
            }
            answer /= 2;
            cout << answer << endl;

        }  
        


        int main(){
            ios_base::sync_with_stdio(false);

            
          

            int cases = 1;
            //cin >> cases;

            while(cases--) solve();
            return 0;

        }


Measured memory_bytes: 5152
#include <iostream>
#include <algorithm>
#include <vector>
typedef int TInt;
typedef std::vector<TInt> TList;

TList Input()
{
    int Count;
    std::cin >> Count;
    TList List(Count);
    for(int i = 0; i < Count; ++i){
        std::cin >> List[i];
    }
    return List;
}
int insertionSort(TList& A, int g)
{
    int cnt = 0;
    for(int i = g; i < A.size(); ++i){
        TInt v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v){
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
    return cnt;
}
void Reverse(TList& List)
{
    TList R;
    for(TList::reverse_iterator It = List.rbegin();
        It != List.rend();
        ++It)
    {
        R.push_back(*It);
    }
    std::swap(R, List);
}
TList GetG(int Max)
{
    TList G;
    int h = 1;
    while(h <= Max){
        G.push_back(h);
        h = 3 * h + 1;
    }
    // Reverse(G);
    std::reverse(G.begin(), G.end());
    return G;
}
int shellSort(TList& A, const TList& G)
{
    int cnt = 0;
    for(TList::const_iterator It = G.begin();
        It != G.end();
        ++It){
        cnt += insertionSort(A, *It);
    }
    return cnt;
}
void OutputLine(const TList& List)
{
    TList::const_iterator It = List.begin();
    std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << " " << *It;
    }
    std::cout << std::endl;
}
void Output(const TList& List)
{
    TList::const_iterator It = List.begin();
    // std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << *It << std::endl;
    }
}
int main()
{
    TList A = Input();
    TList G = GetG(A.size());
    int cnt = shellSort(A, G);
    std::cout << G.size() << std::endl;
    OutputLine(G);
    std::cout << cnt << std::endl;
    Output(A);
    return 0;   
}

Measured memory_bytes: 4896
#人数と身長制限を取得
N,K  = map(int, input().split(" "))

#それぞれの身長を取得
h = list(map(int,input().split(" ")))

#乗れる人数を確認する

result = 0
for i in range(N):
    if h[i] >= K:
        result += 1

print(result)

    

Measured memory_bytes: 11916
import numpy as np
import math

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

N = int(input())
A = list(map(int, input().split()))


# Choose the largest element
largestA = max(A)
max_n = A.index(largestA)

min_dif = 10000000000
min_n = -1
for n in range(N):
    if n == max_n:
        continue
    dif = int(abs(A[n] - int(largestA / 2)))
    if dif < min_dif:
        min_dif = dif
        min_n = n
        # print(min_dif)
        # print(min_n)


# print(nCr(largestA, A[min_n]))
print(largestA, A[min_n])


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

int main(){
    string day_of_the_week;
    cin >> day_of_the_week;

    // 次の日曜日までの日数を返す
    if(day_of_the_week == "SUN"){
        cout << 7 << endl;
    } else if (day_of_the_week == "MON"){
        cout << 6 << endl;
    } else if (day_of_the_week == "TUE"){
        cout << 5 << endl;
    } else if (day_of_the_week == "WED"){
        cout << 4 << endl;
    } else if (day_of_the_week == "THU"){
        cout << 3 << endl;
    } else if (day_of_the_week == "FRI"){
        cout << 2 << endl;
    } else if (day_of_the_week == "SAT"){
        cout << 1 << endl;
    } else {
        cout << "入力を見直してください" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a + b > c + d)
    cout << "Left" << endl;
  else if (a + b == c + d)
    cout << "Balanced" << endl;
  else
    cout << "Right" << endl;
}


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

using namespace std;
typedef long long ll;
//#define int ll
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define FOR(i, a, b) for (int i = a; i < b; ++i)

typedef pair<int, int> pii;
typedef pair<double, int> pdi;

const int INF = 1000 * 1000 * 1000 + 10;

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

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    int n, l;
    cin >> n >> l;

    int sum = 0;

    for (int i = 0; i < n; ++i)
        sum += l + i;

    int bestval = INF, besti = 0;

    for (int i = 0; i < n; ++i)
        if (bestval > abs(sum - (sum - (l + i)))) {
            bestval = abs(sum - (sum - (l + i)));
            besti = i;
        }

    cout << sum - (l + besti);
}

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

int main()
{
	double *a = new double[8];
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>a[7])
	{
		if(a[6] < a[0] || a[2] < a[4] || a[7] < a[1] || a[3] < a[5])
		{
			cout << "NO" << endl;
		}
		else
		{
			cout << "YES" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1220
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define pai 3.1415926535897932384626433832795028841971693
#define ll long long
long long min(long long a, long long b){
    if(a < b) return a;
    else return b;
}
long long max(long long a, long long b){
    if(a < b) return b;
    else return a;
}
double fmod(double x, double y);

int main(){
  long double a,b,h,m,k;
  long double ans,deg,rad;
  scanf("%llf %llf %llf %llf",&a,&b,&h,&m);
  deg=5.5*(m+60*h);
  k=fmod(rad,360);
  rad = deg*(pai/180);
  ans=sqrt(a*a+b*b-2*a*b*cos(rad));

  printf("%.20Lf",ans);
  return 0;
}

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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			B();
		}

		public static void B()
		{
			Scanner cin = new Scanner();
			string s = cin.Next();
			int n = s.Length;
			char[] ss = new char[n];
			
			for (int i = 0; i < n; i++) {
				ss[i] = s[i];
			}

			long ans = 0;
			char temp = 'O';
			int index = 0;
			long acount = 0;
			while (index < n) {
				char c = ss[index];
				if (temp != 'A' && c == 'A') {
					temp = 'A';
					acount = 1;
					++index;
				} else if (temp == 'A' && c == 'A') {
					++acount;
					++index;
				} else if (temp == 'A' && c == 'B') {
					temp = 'B';
					++index;
				} else if (temp == 'B' && c == 'C') {
					temp = 'A';
					//ss[index - 2] = 'B';
					//ss[index - 1] = 'C';
					ss[index] = 'A';
					ans += acount;
					++index;
					//ABCABCABCABCABCABCABCABCABCABCABC
				} else {
					temp = 'O';
					++index;
				}
			}

			Console.WriteLine(ans);
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 14944
x, y = map(int, input().split())

a = (4 * x - y) // 2
b = (y - 2 * x) // 2
if 0 != y % 2:
    print("No")
    exit(0)
if 0 <= a and 0 <= b and 1 <= (a + b) and (a + b) <= 100 and (2 * a + 4 * b) <= 100:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 61716
import java.io.*;
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
// import java.io.BufferedReader;
// import java.io.IOException;
// import java.io.InputStreamReader;
// import java.util.ArrayList;
// import java.util.Arrays;
// import java.util.Collections;
// import java.util.List;
// import java.util.HashSet;
// import java.util.Set;
// import java.util.Map;
// import java.util.HashMap;

import java.math.*;

public class Main {
    private static Scanner sc;
    private static final long mod = 1000000007;

    public static void main(final String[] args) {
        final Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private static String getUpperAlpha(int i) {
        return String.valueOf((char) (i + 64));
    }

    /* i=1 return a */
    private static String getLowerAlpha(int i) {
        return String.valueOf((char) (i + 96));
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }

        public long[] nextLongArray(int n) throws NumberFormatException, IOException {
            long[] ret = new long[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextLong();
            }
            return ret;
        }

        public int[] nextIntArray(int n) throws NumberFormatException, IOException {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextInt();
            }
            return ret;
        }
    }

    private void solve() {
        try {
            int l = sc.nextInt();
            int r = sc.nextInt();
            int d = sc.nextInt();
            int count = 0;
            for (int i = l; i <= r; i++) {
                if (i % d == 0)
                    count++;
            }
            System.out.println(count);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}


Measured memory_bytes: 32556
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

const int K=10;
int n,k,d[K];
bool ban[K];

bool chk( int x ) {
    while ( x ) {
        if ( ban[x%10] ) return 0;
        x/=10;
    }
    return 1;
}

int main() {
    R(n,k);
    REP(i,k) R(d[i]);
    REP(i,k) ban[d[i]]=1;
    while ( !chk(n) ) n++;
    W(n);
    return 0;
}


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

long long GetDigit(ll num) {
	return floor(log10(num)+1);
}

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

	for(ll i=1; i<=floor(sqrt(N)); i++) {
		if(i==1) {
			minimum = GetDigit(N);
		}
		else {
			if(N%i == 0)
				minimum= min(minimum, max(GetDigit(i) , GetDigit(N/i)));
		}
	}
	cout << minimum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S; cin >> S;
  int L, R;
  L = S.size();
  R = 0;
  
  for(int i = 0;i < L / 2;i++){
    if(S.at(i) != S.at(L - 1 - i)){
    R++;
    }
  } 
  
  cout << R << endl;
 }

Measured memory_bytes: 256
quantity, basis = map(int, input().split())

totalTaste = 0
# 食べる予定のリンゴの味を保持
eatApple = basis

for i in range(1, quantity + 1):
  # リンゴの味を計算
  appleTaste = basis + i - 1
  # 全部のリンゴを使った場合のアップルパイの味を計算
  totalTaste += appleTaste
  # リンゴの味の絶対値を比較し、今のリンゴのほうが小さい場合、食べるリンゴを更新する。
  if (abs(appleTaste) < abs(eatApple)):
    eatApple = appleTaste

print(totalTaste - eatApple)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
void solve()
{
		
}
int main()
{
	int n;
	long long k;
	cin>>n>>k;
	vector<int> a(n+1);
	for(int i = 1;i<=n;i++)
		cin>>a[i];
	vector<int> path;
	path.push_back(1);
	bool b[n+1] = {};
	b[1] = true;
	for(int i = 0;i<n&&!b[a[path[i]]];i++)
	{
		path.push_back(a[path[i]]);
		b[a[path[i]]] = true;
	}
	int m = path.size();
	int end =  a[path[m-1]];
	int ind = -1;
	for(int i = 0;i<m;i++)
	{
		if(path[i]==end)
		{
			ind = i;
			break;
		}
	}
	if(k<m)
	{
		cout<<path[k]<<'\n';
		return 0;
	}
	k-=ind;
	k%= (m-ind);
	cout<<path[k+ind]<<'\n';
}


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

int main (void){
  int n = 0,ans = 0;
  cin >> n;
  vector<int> del(n,0);
  for(int i = 0;i < n;i++){
    cin >> del[i];
  }
  for(int i = 0;i < n - 1;i++){
    for(int k = i + 1;k < n;k++){
      ans = ans + del[i] * del[k];
    }
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

using int64 = long long;
const int mod = 1000003;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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 F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  cin >> A;
  sort(begin(A), end(A));
  A.erase(unique(begin(A), end(A)), end(A));
  if(A.size() == N) cout << "YES\n";
  else cout << "NO\n";
}


Measured memory_bytes: 1024