akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line=br.readLine();
		line = line.replace("apple","fujita-");
		line = line.replace("peach","ikeda-");
		line = line.replace("fujita-","peach");
		line = line.replace("ikeda-","apple");
		System.out.println(line);
	}
}

Measured memory_bytes: 15064
string = input()
start = len(string)
targets = set(string)
ans = float('inf')
for a in targets:
    prev = string
    while not all(c == a for c in prev):
        new = ''
        for idx in range(len(prev) - 1):
            if a in (prev[idx], prev[idx+1]):
                new += a
            else:
                new += prev[idx]
        prev = new
    score = start - len(prev)
    ans = min(ans, score)

print(ans)

Measured memory_bytes: 9080
def even_bit_maker(number_length):
    bit = ['0'] * number_length
    for i in range(number_length):
        if i % 2 == 0:
            bit[i] = '1'
    return int(''.join(bit), 2)


def odd_bit_maker(number_length):
    bit = ['0'] * number_length
    for i in range(number_length):
        if i % 2 == 1:
            bit[i] = '1'
    return int(''.join(bit), 2)


if __name__ == '__main__':
    init_tile = input()
    init_tile_bit = int(init_tile, 2)
    tile_len = len(init_tile)
    even_bit = init_tile_bit ^ even_bit_maker(tile_len)
    odd_bit = init_tile_bit ^ odd_bit_maker(tile_len)
    even_change_count = bin(even_bit).count('1')
    odd_change_count = bin(odd_bit).count('1')
    print(min(even_change_count, odd_change_count))


Measured memory_bytes: 4068
A = []
A.append(map(int, raw_input().split()))
A.append(map(int, raw_input().split()))
A.append(map(int, raw_input().split()))
N = int(raw_input())

for i in range(N):
     b = int(raw_input())
     for j in range(3):
         for k in range(3):
             if A[j][k] == b:
                 A[j][k] = 0

flag = False


if A[0][0] == 0 and A[1][1] == 0 and A[2][2] ==0:
     flag = True

if A[0][2] == 0 and A[1][1] == 0 and A[2][0] == 0:
     flag = True

for i in range(3):
     if A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0:
          flag = True
     if A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0:
          flag = True

if flag:
     print "Yes"
else:
     print "No"





Measured memory_bytes: 2696
#include<iostream>
#include<algorithm>
#include <string>
#include <stdlib.h>
#include <vector>
using namespace std;

int gcd(int x, int y){
	if (x < y){
		swap(x, y);
	}
	while (y > 0){
		int r = x % y;
		x = y;
		y = r;
	}
	return x;
}

int main(){
	int num1, num2;
	cin >> num1;
	cin >> num2;
	
	cout << gcd(num1, num2) << endl;
	
	return 0;
}

Measured memory_bytes: 1164
using System;
class main
{
    static void Main(string[] args)
    {
        for (int a = 1; a <= 9; ++a)
        {
            for (int b = 1; b <= 9; ++b)
            {
                Console.WriteLine(a+"x"+b+"="+(a * b));
            }
        }
        Console.ReadKey();
    }
}

Measured memory_bytes: 5552
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define PER(i, x, y) for(ll i = x; i > y; i--)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll dpup[200010][16];
ll dpdn[200010][16];

ll calc(ll a, ll b) {
    ll num = 0;
    while(a > b) {
        b *= 4;
        num++;
    }
    return num;
}

int main() {
    ll N;
    cin >> N;
    ll A[N];
    REP(i, 0, N) {
        cin >> A[i];
    }
    REP(i, 0, N) {
        fill(dpup[i], dpup[i] + 16, 0);
        fill(dpdn[i], dpdn[i] + 16, 0);
    }
    REP(i, 0, 16) {
        dpup[N - 1][i] = i;
    }
    PER(i, N - 2, -1) {
        ll num = A[i];
        REP(j, 0, 16) {
            ll p = calc(num, A[i + 1]);
            if (p <= 15) {
                dpup[i][j] = j + dpup[i + 1][p];
            } else {
                dpup[i][j] = j + dpup[i + 1][15] + (N - 1 - i) * (p - 15);
            }
            num *= 4;
        }
    }
    REP(i, 0, 16) {
        dpdn[0][i] = i;
    }
    REP(i, 1, N) {
        ll num = A[i];
        REP(j, 0, 16) {
            ll p = calc(num, A[i - 1]);
            if (p <= 15) {
                dpdn[i][j] = j + dpdn[i - 1][p];
            } else {
                dpdn[i][j] = j + dpdn[i - 1][15] + i * (p - 15);
            }
            num *= 4;
        }
    }
    // REP(i, 0, 16) {
    //     REP(j, 0, N) {
    //         cout << dpup[j][i] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;
    // REP(i, 0, 16) {
    //     REP(j, 0, N) {
    //         cout << dpdn[j][i] << " ";
    //     }
    //     cout << endl;
    // }
    ll ans = llmax;
    ans = min(ans, dpup[0][0] * 2);
    //cout << dpup[0][0] * 2 << endl;
    REP(i, 1, N) {
        ans = min(ans, dpdn[i - 1][0] * 2 + dpup[i][0] * 2 + i);
        //cout << dpdn[i - 1][0] * 2 + dpup[i][0] * 2 + i << " ";
    }
    cout << ans << endl;
}


Measured memory_bytes: 51840
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip> // for /* << std::fixed << std::setprecision(k) << */
using namespace std;

//defines

#define forn(n) for(int i = 0; i < n; i++)
#define pb push_back
#define int long long

int32_t main() {
	int n, k;
	
	cin >> n >> k;
	
	vector<int> a(n);
	
	for (int i = 0; i < n; i++)
		cin >> a[i];
	
	sort(a.begin(), a.end());
	
	if (k >= n) {
		cout << 0;
		
		return 0;
	}
	
	int ans = 0;
	
	for (int i = 0; i < n-k; i++)
		ans += a[i];
		
	cout << ans;
}



Measured memory_bytes: 4840
using System;
 
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
 
            int max = 0, now = 0, pre = int.Parse(str[0]), count = 0;
            for (int i = 1; i < str.Length; ++i)
            {
                now = int.Parse(str[i]);
                if (now <= pre)
                {
                    count++;
 
                }
                else
                {
                    if (max < count)
                        max = count;
                    count = 0;
                }
                pre = now;
            }
            if (max < count)
                max = count;
            Console.WriteLine("{0}", max);
        }
    }
}

Measured memory_bytes: 26588
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long H, W, DP[1000] = {};
	string S[1000];
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> S[i];
	}
	DP[0] = 1;
	for (int i = 1; i < W; i++) {
		if (S[0][i] == '.') DP[i] = DP[i - 1];
		else DP[i] = 0;
	}
	for (int i = 1; i < H; i++) {
		if (S[i][0] == '#') DP[0] = 0;
		for (int j = 1; j < W; j++) {
			if (S[i][j] == '.') DP[j] += DP[j - 1];
			else DP[j] = 0;
			DP[j] = DP[j] % 1000000007;
		}
	}
	cout << DP[W - 1];
}

Measured memory_bytes: 1280
/*
 * main.cpp
 *
 *  Created on: 2020/04/09
 *      Author: SkAaO
 */

#include <iostream>

using namespace std;

int main(){
	int H, W;
	cin >> H >> W;

	char S[H+1][W+1];

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

	for(int i = 0; i < H; i++){
		scanf("%s", S[i]);
	}

	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(S[i][j] == '#') continue;

			if(S[i][j] == '.'){
				int num = 0;
				for(int k = 0; k < 8; k++){
					int ni = i + dy[k];
					int nj = j + dx[k];

					if((ni >= 0 && ni < H) && (nj >= 0 && nj < W) && S[ni][nj] == '#'){
						num++;
					}
				}
				S[i][j] = (char)('0' + num);
			}
		}
	}

	for(int i = 0; i < H; i++){
		printf("%s\n", S[i]);
	}

	return 0;
}





Measured memory_bytes: 256
N, M, *sc = map(int, open(0).read().split())
s=[]
c=[]
for i in range(2*M):
  if i%2 == 0:
    s.append(sc[i])
  else:
    c.append(sc[i])

ans = 0
#ここから    
for j in range(M):
  if N == 2 and s[j] == 1 and c[j] == 0:
    ans = -1
    break
  elif N == 3 and s[j] == 1 and c[j] == 0:
    ans = -1
    break

for k in range(M):
  for l in range(M):
    if not k == l and s[k] == s[l] and c[k] != c[l]:
      ans = -1
      break
#ここまで解があるかどうかの判定

kotae = [0,0,0]
if ans == 0:
  for m in range(M):
    kotae[s[m]+(3-N)-1] = c[m]
  for n in range(N):
    if N-1 == n and kotae[2-n] == 0 and N != 1:
      kotae[2-n] = 1
  ans = kotae[0]*100 + kotae[1]*10 + kotae[2]
print(ans)

Measured memory_bytes: 3192
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		double res = 0;
		
		for(int i = 1; i <= n; i++) {
			int j = i;
			int cnt = 0;
			
			while(j < k) {
				j*=2;
				cnt++;
				
			}
			res+=1d/n * Math.pow(0.5, cnt);
		}
		
		out.println(res);
	}

	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 21588
n, m = map(int, input().rstrip().split())
x = [0] * n
if n > 1:
  x[0] = 1

buffer = [-1] * n
conflict = 0
head_zero = 0
for _ in range(m):
  s, c = map(int, input().rstrip().split())
  
  if buffer[s-1] > 0 and buffer[s-1] != c:
    conflict = 1
    break
  if s == 1 and c == 0 and n > 1:
    head_zero = 1
    break

  buffer[s-1] = c

if conflict or head_zero:
  print(-1)
else:
  for i in range(n):
    print(max(x[i], buffer[i]), end="")
  print()


Measured memory_bytes: 3064
#include <cstdio>

const int N = 2e5 + 5;
const long long MOD = 1e9 + 7;

int a[N];

int main() {
	int n;
	std::scanf("%d", &n);
	for(int i = 1; i <= n; i++) std::scanf("%d", &a[i]);
	long long sum = 0, ans = 0;
	for(int i = n; i >= 1; i--) {
		ans = (ans + a[i] * sum % MOD) % MOD;
		sum = (sum + a[i]) % MOD; 
	}
	std::printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 2492
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f

using namespace std;

char str[200005];
int sum1[200005],sum2[200005];

int main() {
  int n;
  scanf("%d%s",&n,str+1);
  for(int i=1;i<=n;i++) sum1[i]=sum1[i-1]+(str[i]=='#');
  for(int i=n;i>0;i--) sum2[i]=sum2[i+1]+(str[i]=='.');
  int ans=inf;
  for(int i=0;i<=n;i++) ans=min(ans,sum1[i]+sum2[i+1]);
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <iomanip>
#include <cctype>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

int main() {
	int n, d; cin >> n >> d;
	if (n % (2 * d+1) != 0) cout << n / (2 * d+1) + 1;
	else cout << n / (2 * d+1);

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
typedef pair<int, int> P;
const int MAX_N = 1000000000;
const int MAX_L = 100000000;
const int MAX_SQRT_B = 10000;
const int INF = 1000000000;
typedef int64_t ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int N;
int A[100005];
int B[100005];

int main() {
	cin >> N;
	rep(i, N + 1) {
		cin >> A[i];
	}
	rep(i, N) {
		cin >> B[i];
	}

	ll tmp = 0;
	for (int i = 0; i < N; i++)
	{
		if (A[i] - B[i] > 0)
		{
			tmp += B[i];
		}
		else {
			ll tt;
			tmp += A[i];
			tt = B[i] - A[i];
			if (A[i + 1] - tt > 0) {
				tmp += tt;
				A[i + 1] = A[i + 1] - tt;
			}
			else {
				tmp += A[i + 1];
				A[i + 1] = 0;
			}
		}
	}
	cout << tmp << endl;
}


Measured memory_bytes: 4408
#include <bits/stdc++.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <stdio.h>
#include <vector> 
#include <algorithm>
#include <functional>

using namespace std;
int main() {
  long long int A,B,C,D,N,M,K;
  vector<long long int> p_v;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    long long int p;
    cin >> p;
    p_v.push_back(p);
  }
  sort(p_v.begin(), p_v.end());
  long long int sum = 0;
  for (int i = 0; i < K; i++) {
    sum += p_v[i];
  }
  cout << sum << endl;
  return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x,t;cin >> x >> t;
	cout << max(x-t,0) << endl;
}

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

int main() {
	int n,t,c1,t1,res=1000000;
	
	cin>>n>>t;
	
	for(int i=0;i<n;i++){
		cin>>c1>>t1;
		if(t1<=t){
			if(res>c1){
				res=c1;
			}
		}
	}
	if(res==1000000) cout<<"TLE"<<endl;
	else cout<<res<<endl;	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

LL dp[210][112345] = {};

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,X; cin >> N >> X;
    VI S(N); REP(i,N) cin >> S[i];
    sort(S.begin(),S.end(),greater<int>());
    dp[0][X] = 1;
    REP(i,N){
        REP(j,112345){ //採用しない
            dp[i+1][j] = (dp[i+1][j] + dp[i][j] * (N-i-1)) % MOD;
        }
        REP(j,112345){ //採用する
            dp[i+1][j % S[i]] = (dp[i+1][j % S[i]] + dp[i][j]) % MOD;
        }
    }
    LL ans = 0;
    REP(i,112345){
        //dump(i)
        //dump(dp[N][i])
        ans += i * dp[N][i];
        ans %= MOD;
    }
    cout << ans << endl;

}


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

int main(){
  long long k,n,m;
  cin>>k>>n;
  long long a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  m=k-a[n-1]+a[0];
  for(int i=0;i<n-1;i++) m=max(m,a[i+1]-a[i]);
  cout<<k-m<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <string>
#include <algorithm>
#include <memory.h>
#include <unordered_map>
#include <assert.h>
#include <sstream>
#include <map>
#include <regex>

using namespace std;
int main()
{
	int n;
	cin >> n;
	if (n < 1200)
		cout << "ABC";
	else if (n < 2800)
		cout << "ARC";
	else
		cout << "AGC";
	return 0;
}

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

#define WHITE '.'
#define BLACK '#'
#define NONE ' '

int main(void)
{
	int H, W;
	cin >> H >> W;

	vector<string> a(H);
	for(int i=0; i<H; i++)
		cin >> a[i];

	vector<bool> h(H, true), w(W, true);
	for(int i=0; i<H; i++){
		int cnt = count(a[i].begin(), a[i].end(), BLACK);
		if(cnt == 0)
			h[i] = false;
	}
	for(int i=0; i<W; i++){
		int cnt = 0;
		for(int j=0; j<H; j++)
			cnt += (a[j][i] == BLACK);
		if(cnt == 0)
			w[i] = false;
	}

	for(int i=0; i<H; i++){
		if(h[i] == false)
			continue;

		for(int j=0; j<W; j++)
			if(w[j] == true) cout << a[i][j];

		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String ans;

        if(n % S(n) == 0)ans = "Yes";
        else ans = "No";

        System.out.println(ans);
    }

    public static int S(int n){
        int ans = 0;
        while(n > 0){
            ans += n % 10;
            n /= 10;
        }

        return ans;
    }
}

Measured memory_bytes: 21844
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)    (x).begin(),(x).end()
#define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
#define mp        make_pair
#define eb        emplace_back
#define REP(i, a) for (int i = 0; i < (a); i++)


int main() {
	string s;
	cin >> s;
	sort(ALL(s));

	string t;
	cin >> t;
	sort(ALL(t));
	reverse(ALL(t));

	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2000000000
#define MOD 2018012016
#define N 1005
#define M 1000005
#define LOG 1000000
#define KOK 32000
#define EPS 0.000000001
using namespace std;

ll ans=1;
ll n,p;

ll po(ll a,ll b) {

	ll res=1;

	for(ll i=1;i<=b;i++) res*=a;

	return res;

}

int main() {

	//freopen("input.txt","r",stdin);

	scanf("%lld %lld",&n,&p);

	for(int i=2;1ll*i*i<=p;i++) {

		int tot=0;

		while(p%i==0) {

			tot++;

			p/=i;

		}

		ans*=1ll*po(i,tot/n);

	}

	if(p) ans*=1ll*po(p,(1/n));

	printf("%lld",ans);

}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	static int EightDivsJudge(int k){
		int num = 0;
		for(int i=1; i<=((k+1)/2)*2 - 1; i+=2){
			int count = 0;
			for(int j=1; j<=i; j++){
				if(i%j==0)count++;
			}
			if(count==8)num++;
		}
		return num;
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		System.out.println(EightDivsJudge(n));
	}
}

Measured memory_bytes: 22740
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    public static int ReadInt()
    {
        return int.Parse(Console.ReadLine());
    }

    public static int[] ReadInts()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }

    public static void Main()
    {
        var A = ReadInt();
        var B = ReadInt();
        var C = ReadInt();
        var D = ReadInt();
        var P = ReadInt();
        var X = A * P;
        var Y = (P <= C) ? B : B + (P - C) * D;
        Console.WriteLine(Math.Min(X, Y));
    }
}


Measured memory_bytes: 17976
key_num = list(int(x) for x in input().split())
key_num.sort()
ans = 0

ans += (key_num[2] - key_num[1])//2
ans += (key_num[2] - key_num[0])//2

key = key_num[2]*2 - key_num[1] - key_num[0] - ans*2
if key == 2:
    ans += 1
elif key == 1:
    ans += 2

print(ans)

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

int main(){
    int A,B,K;
    cin>>K>>A>>B;
    if((A%K==0)||(B%K==0)){
        cout<<"OK"<<endl;
        return 0;
    }
    if(A/K<B/K){
        cout<<"OK"<<endl;
        return 0;
    }
    cout<<"NG"<<endl;
    return 0;
    
    
    
}


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

def main():
    H = int(input())
    A = [0] + list(map(int, input().split()))
    for k in range(1, H+1):
        pk = None
        lk = None
        rk = None
        if k // 2 > 0:
            pk = k // 2
        if 2 * k < H+1:
            lk = 2 * k
        if 2 * k + 1 < H+1:
            rk = 2 * k + 1
        print('node {}: key = {}, '.format(k, A[k]), end='')
        if pk:
            print('parent key = {}, '.format(A[pk]), end='')
        if lk:
            print('left key = {}, '.format(A[lk]), end='')
        if rk:
            print('right key = {}, '.format(A[rk]), end='')
        print()

if __name__=='__main__': main()


Measured memory_bytes: 5692
from collections import deque
h,w = map(int,input().split())
data = [input() for _ in range(h)]
pena = [[10**10]*w for _ in range(h)]
queue = deque()
if data[0][0] == ".":
    pena[0][0] = 0
else:
    pena[0][0] = 1
queue.append([0,0])
while queue:
    x,y = queue.popleft()
    if x+1<h:
        c = False
        if pena[x+1][y] == 10**10:
            c = True
        if data[x+1][y] == '#' and data[x][y] == '.':
            pena[x+1][y] = min(pena[x+1][y],pena[x][y] + 1)
        else:
            pena[x+1][y] = min(pena[x+1][y],pena[x][y])
        if c:
            queue.append([x+1,y])

    if y+1<w:
        c = False
        if pena[x][y+1] == 10 ** 10:
            c = True
        if data[x][y+1] == '#' and data[x][y] == '.':
            pena[x][y+1] = min(pena[x][y+1],pena[x][y] + 1)
        else:
            pena[x][y + 1] = min(pena[x][y+1], pena[x][y])
        if c:
            queue.append([x,y+1])

print(pena[-1][-1])

Measured memory_bytes: 3444
#include <iostream>

using namespace std;

void solve()
{
	int n;
	while(cin >> n)
	{
		cout << "3C";
		int ans = n % 39;
		if(ans < 10)
		{
			if(ans == 0)
			{
				cout << "39" << endl;
			}
			else
			{
				cout << "0" << ans << endl;
			}
		}
		else
		{
			cout << ans << endl;
		}
	}
}

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

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<iostream>
#include<fstream>
#include<iomanip>

using namespace std;

int N, M;
int data[1001][1001];
int check[1001];

int grp = 1;

int back(int cur) {
	int cnt = 1;
	for (int i = 1; i <= N; ++i) {
		if (data[cur][i] == -1) {
			if (!check[i]) {
				check[i] = true;
				data[cur][i] = data[i][cur] = grp;
				cnt += back(i);
			}
			data[cur][i] = data[i][cur] = grp;
		}
	}
	return cnt;
}

int main(){
	int a, b;
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; ++i){
		scanf("%d%d", &a, &b);
		data[a][b] = data[b][a] = -1;
	}
	int shi = 0;
	for (int i = 1; i <= N; ++i) {
		if (check[i]) continue;
		check[i] = 1;
		int res = back(i);
		if (res > 1) {
			grp++;
			shi += res;
		}
	}
	grp--;
	printf("%d\n", abs((N - shi) - grp));
	return 0;
}

Measured memory_bytes: 1892
using System;
using System.Linq;

class ALDS1
{
    static void Main()
    {
        int a = int.Parse(Console.ReadLine());
        int[] x = new int[a];
        int c, d = 0;
        string str = Console.ReadLine();
        for (int i = 0; i < a; i++)
        {
            x[i] = int.Parse(str.Split(' ')[i]);
        }
        for (int i = 0; i < a - 1; i++)
        {
            for (int j = a - 1; j > i; j--)
            {
                if (x[j - 1] > x[j])
                {
                    c = x[j - 1]; x[j - 1] = x[j]; x[j] = c;
                    d++;
                }
            }
        }
        for (int i = 0; i < a; i++)
        {
            if (i == a - 1) Console.WriteLine(x[i]);
            else Console.Write(x[i]+" ");
        }
        Console.WriteLine(d);
    }
}

Measured memory_bytes: 19932
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

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

  int N, M;
  cin >> N >> M;
  if(N == M){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N,0),b(N,0);
    rep(i,N){
        cin >> a[i];
    }
    rep(i,N){        
        ll s=N-i;
        ll r=0;
        while(s <= N){
            r += b[s-1];
            s += N-i;
        }
        r -= b[N-i-1];
        b[N-1-i] = ((r%2 == a[N-1-i])?0:1);
    }
    vector<ll> c;
    rep(i,N){
        if(b[i])c.push_back(i+1);
    }
    cout << c.size() << endl;
    rep(i,c.size()){
        cout << c[i] << " ";
    }
    if(c.size()) cout << endl;
}


Measured memory_bytes: 4980
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e16;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };


const int N=200001;

void solve()
{
    int k,n;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    int ans=k,sm=0;
    for(int i=1;i<n;i++)
    {
        ans=min(ans,k-a[i]+a[i-1]);
        sm+=a[i]-a[i-1];
    }
    ans=min(ans,sm);
    cout<<ans<<endl;
    
}



int32_t main()
{
    IOS;
    //FILE *fin = freopen("in","r",stdin);
    //FILE *fout = freopen("out","w",stdout);
    int t;
    t=1;
   // cin>>t;
    
    while(t--)
    {
        solve();
    }
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int pow_min = 10000;
  
  for (int i=0; i < N; i++) {
    int A, pow_tmp=0;
    cin >> A;
    
    while (A % 2 == 0) {
      pow_tmp += 1;
      A /= 2;
    }
    
    if (pow_tmp < pow_min) {
      pow_min = pow_tmp;
    }
  }
  
  cout << pow_min << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

#define N   50000
#define PN  5133

using namespace std;

static
int p[ PN ];
static
int furui[ N + 1 ] = { 0 };

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;
  int pn;

  pn = 0;
  for ( i = 2; i <= N; ++i )
  {
    if ( furui[ i ] ) continue ;

    p[ pn++ ] = i;
    for ( j = i; j <= N; j += i )
    {
      furui[ j ] = 1;
    }
  }

  for ( ; ; )
  {
    int res = 0;
    int n;

    scanf ( "%d", &n );
    if ( !n ) break ;

    for ( i = 0; p[ i ] <= n / 2; ++i )
    {
      res += !!( binary_search ( p, p + pn, n - p[ i ] ) );
    }

    printf ( "%d\n", res );
  }

  return ( 0 );
}

Measured memory_bytes: 0
A,B,K = map(int, input().split())
listA = []
listB = []
for i in range(1,A+1):
    if A%i == 0:
        listA.append(i)
for i in range(1,B+1):
    if B%i == 0:
        listB.append(i)
AB = []
for i in range(len(listA)):
    if listA[i] in listB:
        AB.append(listA[i])
print(AB[len(AB)-K])

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


using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define DOUBLE fixed << setprecision(10)
#define fi first
#define se second
const double pi = acos(-1.0);
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };
template <typename T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
};
template <typename T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
};
void Pvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void Pvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Ps(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void Pvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

void Yay(bool x) {
	if (x) cout << "Yay!\n";
	else cout << ":(\n";
}


ll  n, m, r, l, k, h, w, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s,t;

void INIT() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << DOUBLE;
}

int main() {
	INIT();
	cin >> n;
	vll v(n);
	rep(i, n) cin >> v[i];
	vll w = v;
	sort(all(w));
	rep(i, n) {
		if (v[i] == w[n - 1]) cout << w[n - 2] << endl;
		else cout << w[n - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

// 𝑂(𝑁*log(log 𝑁))
vector<int> eratosthenes(int N)
{
    vector<int> res;
    vector<bool> prime(N + 1, 1);
    prime[0] = prime[1] = false;
    for (int i = 2; i * i <= N; ++i)
    {
        if (prime[i] == true)
        {
            for (int j = 2 * i; j <= N; j += i)
            {
                prime[j] = false;
            }
        }
    }
    for (int i = 0; i <= N; ++i)
    {
        if (prime[i] == true)
            res.push_back(i);
    }
    return res;
}

int main()
{
    int N;
    auto prime = eratosthenes(400000);
    vector<int> cnt(423487);
    for (auto &p : prime)
    {
        cnt[p]++;
    }
    for (int i = 0; i <= 123456 * 3; i++)
    {
        cnt[i + 1] += cnt[i];
    }
    while (cin >> N)
    {
        if (N == 0)
            return 0;
        cout << cnt[2 * N] - cnt[N] << endl;
    }
}


Measured memory_bytes: 4680
function Main(input){
    var arr = [];
    arr = input.split(' ');

    if(parseInt(arr[0]) <= 8 && parseInt(arr[0]) >= 1 && parseInt(arr[1]) <= 8 && parseInt(arr[1]) >= 1){
        console.log('Yay!');
    } else {
        console.log(':('); 
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;

int main(){
  string s,t;
  cin >> s >> t;
  if(s.length()<t.length()){
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
  for(int i = s.length()-t.length(); i >= 0; i--){
    for(int j = 0; j < t.length(); j++){
      if(s[i+j]!=t[j]&&s[i+j]!='?') goto next;
    }
    for(int j = 0; j < s.length(); j++){
      if(j<i||j>=i+t.length()){
        if(s[j]=='?'){
          cout << 'a';
        }else{
          cout << s[j];
        }
      }else{
        cout << t[j-i];
      }
    }
    cout << endl;
    return 0;
    next:;
  }
  cout << "UNRESTORABLE" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i, N, x, a[101];
	scanf("%d %d", &N, &x);
	for (i = 1; i <= N; i++) scanf("%d", &(a[i]));
	
	int count = 0, min, argmin, flag[101] = {};
	while (1) {
		min = 1000000001;
		argmin = 0;
		for (i = 1; i <= N; i++) {
			if (flag[i] == 0 && a[i] < min) {
				min = a[i];
				argmin = i;
			}
		}
		if (argmin == 0) {
			if (x > 0) count--;
			break;
		} else if (x < min) {
			break;
		} else {
			x -= min;
			flag[argmin] = 1;
			count++;
		}
	}

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;


const int mod = 998244353;

const int N = 3007;

int dp[N][N][2];

inline int sum(int x, int y) {
	if (x+y < 0) return x+y+mod;
	if (x+y >= mod) return x+y-mod;
	return x+y;
}
 
inline int mult(int x, int y) {
	return ((ll) x * y) % mod;
}

int main(){
#ifdef LOCAL
	freopen("I_input.txt", "r", stdin);
	//freopen("I_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	dp[a][b][0] = 1;

	vector<int> pw(N);
	pw[0] = 1;
	for (int i = 1; i < N; ++i) pw[i] = mult(pw[i-1], c);

	for (int i = a; i < c; ++i) {
		for (int j = b; j <= d; ++j) {

			int t = sum(dp[i][j][0], dp[i][j][1]);

			dp[i+1][j][0] = sum(dp[i+1][j][0], mult(t, j));
			if (j+1 <= d) dp[i+1][j+1][1] = sum(dp[i+1][j+1][1], mult(t, i));
		}

		for (int j = b; j < d; ++j) {
			dp[i+1][j+1][1] = sum(dp[i+1][j+1][1], mult(dp[i+1][j][1], i));
		}
	}

	//cout << dp[2][2][1] << endl;

	int ans = 0;
	for (int i = b; i <= d; ++i) {

		int t = sum(dp[c][i][0], dp[c][i][1]);

		ans = sum(ans, mult(t, pw[d-i]));
	}

	cout << ans;



}


Measured memory_bytes: 74076
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, 0, n) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  ll x = a[0];
  rep(i, 1, n) {
    if (x > 1000000000000000000 / a[i]) {
      cout << -1 << endl;
      return 0;
    }

    x *= a[i];
  }

  cout << x << endl;
}


Measured memory_bytes: 3956
import java.util.*;

import java.math.*; 
public class Main {
     Scanner sc = new Scanner(System.in);
	
	
	void run(){ // kokonikaku
		int a[] = new int[5];
		for(int i=0;i<5;i++){
			a[i]=sc.nextInt();
		}
		int k=sc.nextInt();
		
		int e=0;
		for(int i=0;i<1;i++){
			if(a[i+4]-a[i]>k)e=1;
		}
		if(e==1){
			System.out.println(":(");
		}
			else{
			System.out.println("Yay!");
				
			}
		
    
	}

	
	public static void main(String[] args) {
		new Main().run();
        
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int> > pipii;
typedef priority_queue<pii,vector<pii>,greater<pii>> minpq;
typedef priority_queue<pii> maxpq;
//const double PI = acos(-1);
const int mod = 1000000007;
int cnt =0;








int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a;
    cin>>a;
    cout<<a+a*a+a*a*a<<endl;




	
	
	
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
typedef long long ll;

int main() {

  ll n, a, b;
  cin>>n>>a>>b;

  if(a > b) {
    cout<<0;
    return 0;
  }
  if(n == 1) {
    if(a != b) cout<<0;
    else cout <<1;
    return 0;
  }
  cout<<(n-1)*(b-a)+a-b+1;
  return 0;
}


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

int main() {
  int N, K, S;
  cin >> N >> K >>S;
  vector<int> A(N,1);
  for (int i = 0; i < K; i++) A[i] = S;
  if (S < 1e9) {
    for (int i = K; i < N; i++) A[i] = S + 1;
  }
  for (int i = 0; i < N; i++) {
    cout << A[i];
    if (i != N - 1) cout << " ";
    else cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

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

  lol n, t;
  cin >> n >> t;
  lol ans = t, a[n + 5];
  rep(i, n){
    cin >> a[i];
  }
  reps(i, n - 1){
    ans += min(a[i] - a[i - 1], t);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5;
int a[maxn+5];
int n;
long long cal()
{
    for(int i=1;i<=n;++i)
        if(a[i]>i-1) return -1;
    long long ans=0;
    int pre=n+1;
    for(int i=n;i>=1;--i)
    {
        if(i-a[i]>pre) return -1;
        if(i-a[i]<pre) ans+=a[i],pre=i-a[i];
    }
    return ans;
}
int main()
{

    scanf("%d",&n);
    for(int i=1;i<=n;++i) scanf("%d",&a[i]);
    printf("%lld\n",cal());
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
//#include <iostream>
//#include <sstream>
using namespace std;
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define debd(x) pf("%s = %d\n", #x, x)
#define debs(x) pf("%s = %s\n", #x, s)
#define debll(x) pf("%s = %lld\n", #x, x)
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
//bitmask
int onbit(int x, int pos) {x |= (1 << pos); return pos;}
int offbit(int x, int pos) {x &= ~(1 << pos); return x;}
int test(int x, int pos) {return x & (1 << pos);}
int flip(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int onbitall(int x, int pos) {x = (1 << pos)-1; return x;}
//constants
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
//moves
const int dx1[] = {0, 1, 0, -1};
const int dy1[] = {1, 0, -1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy2[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
//    freopen("input.in", "r", stdin);
	int a, b, c, d;
	sf("%d %d %d %d", &a, &b, &c, &d);
	pf("%d\n", max(a*b, c*d));
	return 0;
}

Measured memory_bytes: 128
//ABC142D
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	long long int a, b;
	cin >> a >> b;
	long long int n = __gcd(a,b);
	long long int num = n;
	long long int count = 1;
	long long int i = 2;
	while(n > 1){
		if(n%i == 0){
			count++;
		}
		while(n%i ==0){
			n /= i;
		}
		i++;
		if(i*i > num){
			cout << count+1 << endl;
			return 0;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {

        string inpt = Reader.ReadLine();
        long num = long.Parse(inpt);
        long div = inpt.Select(a => long.Parse(a.ToString())).Sum();

        string ans = "No";

        if(num% div==0) {
            ans = "Yes";
        }
        Console.WriteLine(ans);




    }




    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


101




";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 11220