akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll arr[MAX],pre_dist[MAX],suf_dist[MAX];
ll find_distance(int x,int y)
{
    if(x>=0 && y>=0)
    {
        if(y>=x)
            return y-x;
        else
            return x-y;
    }
    else if(x<=0 && y<=0)
    {
        x=abs(x);
        y=abs(y);
        if(y>=x)
            return y-x;
        else
            return x-y;

    }
    else if((x>=0 && y<=0) || (x<=0 && y>=0))
        return abs(x)+abs(y);

}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>arr[i];
    for(int i=1; i<=n; i++)
    {
        pre_dist[i]=pre_dist[i-1]+find_distance(arr[i-1],arr[i]);
    }
    for(int i=n; i>=1; i--)
    {
        suf_dist[i]=suf_dist[i+1]+find_distance(arr[i+1],arr[i]);
    }
    for(int i=1; i<=n; i++)
    {
        ll x=pre_dist[i-1];
        ll y=suf_dist[i+1];

        ll connect;
        if(i==n)
        {
            connect=find_distance(arr[n-1],0);
        }
        else
        {
            connect=find_distance(arr[i-1],arr[i+1]);
        }
        //  cout<<i<<" "<<x<<" "<<y<<" "<<connect<<endl;
        cout<<connect+x+y<<endl;
    }

    return 0;
}


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

constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

void solve() {
  int a,b,c;
  cin >> a >> b >> c;
  cout << max(0,c-(a-b)) << endl;
}

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

  /* Regular */
  int case_num = 1;
  if (argc > 1 && stoi(argv[1])) cin >> case_num;
  REP(case_no, case_num) {
    cerr << endl << "case " << case_no + 1 << endl;
    solve();
  }
  
  // /* AOJ */
  // solve();
  return 0;
}

Measured memory_bytes: 256
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
l=list(mi())
s=0
t=0
for i in l:
  s+=i
  t+=i**2
print(int((s**2-t)/2))

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

int main(){
	ll n, a, b; cin >> n >> a >> b;
	cout << n / (a + b) * a + min(a, n % (a + b)) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstring>
using namespace std;
typedef long long ll;
ll a,b,gys,cnt;
inline ll gcd(ll x,ll y){return (y==0LL)?x:gcd(y,x%y);}
ll ans=1;
inline void divide(){
	ll tmp=sqrt(gys);
	for(register ll i=2;i<=tmp;i++){
		if(gys%i==0){
			ans++;
			while(gys%i==0LL)	gys/=i;
		}
	}
	if(gys!=1LL)	ans++;
}
int main(){
	scanf("%lld%lld",&a,&b);
	gys=gcd(a,b);
	divide();
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    ll H;
    cin >> H;
    ll ans = 1;
    ll num = 1;
    H/=2;
    while(H>0){
        H/=2;
        ans+=pow(2,num);
        num++;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int n;
  while(cin >> n && n) {
    int a[n][n+1];
    for(int i=0; i<n; i++) {
      for(int j=0; j<=n; j++) cin >> a[i][j];
    }
    int dp[1<<n];
    fill(dp,dp+(1<<n),1<<30);
    dp[0]=0;
    for(int t=0; t<(1<<n); t++) {
      for(int i=0; i<n; i++) {
        if(t&(1<<i)) continue;
        int x=a[i][0];
        for(int j=0; j<n; j++) {
          if(t&(1<<j)) x=min(x,a[i][j+1]);
        }
        dp[t|(1<<i)]=min(dp[t|(1<<i)],dp[t]+x);
      }
    }
    cout << dp[(1<<n)-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 3288
#include<iostream>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<string.h>

using namespace std;

int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int l = a+b,r=c+d;
    if(l > r)
        cout<<"Left"<<endl;
    else if(l<r)
        cout<<"Right"<<endl;
    else
        cout<<"Balanced"<<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import Counter
S = list(map(int, list(input())))
A = [0]
for i, s in enumerate(S[::-1]):
    A.append((A[-1] + s * pow(10, i, 2019)) % 2019)
print(sum([v * (v - 1) // 2 for v in Counter(A).values()]))


Measured memory_bytes: 20224
my ($N, $K, $Q) = (split(/ /o, <STDIN>));
chomp($N);
chomp($K);
chomp($Q);
my @P;
foreach my $i (1..$N) {
  $P[$i] = 0;
}
foreach my $i (0..$Q-1) {
  my $a = <STDIN>;
  chomp($a);
  $P[$a]++;
}
foreach my $i (1..$N) {
  if ( $K + $P[$i] > $Q ) {
    print "Yes\n";
  } else {
    print "No\n";
  }
}

Measured memory_bytes: 4096
s = input()
if len(s) % 2 == 1:
    s = s[:-1]
else:
    s = s[:-2]
while True:
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        exit()
    else:
        s = s[:-2]


Measured memory_bytes: 2940
#include<iostream>
#include<climits>

using namespace std;

int main()
{
	int n,r;
	int min = INT_MAX,ans = INT_MIN;
	
	cin >> n;
	for(int i = 0;i < n;i++)
	{
		cin >> r;
		if(r - min > ans) ans = r - min;
		if(r < min) min = r;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3092
# import numpy as np
# import time

def main():
    s = input()
    # s = '<>>><<><<<<<>>><' # test
    # s = '>>>>>>>'
    n_list = [0] * (len(s)+1)
    # n_list = np.zeros(len(s)+1)

    for i in range(1, len(s)):
        if s[i-1] == '<':
            n_list[i] = n_list[i-1]+1
        else: # i = >
            if s[i] == '>':
                continue
            # j = i # jは左側の                           文字のインデックス
            k = 1                          
            for j in range(i, 1, -1):
                if s[j-1] == '<':
                    n_list[j] = max(n_list[j-1], n_list[j+1])+1
                    break
                n_list[j-1] = k
                k+=1
    
    if s[-1] == '<':
        n_list[-1] = n_list[-2]+1
    elif s[-1] == '>':
        # j = i # jは左側の                           文字のインデックス
        k = 1                     
        for j in range(len(s), 1, -1):
            if s[j-1] == '<':
                n_list[j] = max(n_list[j-1], n_list[j+1])+1
                break
            n_list[j-1] = k
            k+=1
    if s[0] == '>':
        n_list[0] = n_list[1]+1
            
        # print('i={} {}'.format(i, n_list))    
 
    # print(n_list)
    print(int(sum(n_list)))


if __name__ == "__main__":
    # start = time.time()
    main()    
    # elapsed_time = time.time() - start
    # print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")

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

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var tasks = Enumerable.Range(0, n).Select(x => new Task(Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray())).OrderBy(f => f.FinT).ToList();
        long nowT = 0;
        foreach (var t in tasks)
        {
            var rn = t.DoTask(nowT);
            if (rn[1] == 0)
            {
                Console.WriteLine("No");
                return;
            }
            nowT = rn[0];
        }
        Console.WriteLine("Yes");
    }
}

class Task
{
    public long Time { get; set; }
    public long FinT { get; set; }

    public Task(long[] input)
    {
        this.Time = input[0];
        this.FinT = input[1];
    }

    public long[] DoTask(long nowt)
    {
        nowt += this.Time;
        if (nowt > this.FinT)
        {
            return new long[] { nowt, 0 };
        }
        return new long[] { nowt, 1 };
    }
}

Measured memory_bytes: 35332
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;
U_MAP mp;

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

  cin >> n >> m;
  rep(i, n) cin >> a[i];
  // Cout((29 + 7 + 5 + 7 + 9) % 17);
  rrep(i, 1, n) a[i] += a[i - 1];
  rep(i, n) a[i] %= m;
  mp[a[n - 1]]++;
  // rep(i, n) cout << a[i] << " ";
  rrrep(i, n - 2, 0) {
    ll want = a[i];
    ans += mp[want];
    mp[a[i]]++;
  }
  ans += mp[0];
  Cout(ans);
  return 0;
}

Measured memory_bytes: 4492
#include<stdio.h>
int main(void){
    int s1,s2,s3,s4,s5,s6,s7,s8,s9,s10;
    scanf("%d",&s1);
    scanf("%d",&s2);
    scanf("%d",&s3);
    scanf("%d",&s4);
    scanf("%d",&s5);
    scanf("%d",&s6);
    scanf("%d",&s7);
    scanf("%d",&s8);
    scanf("%d",&s9);
    scanf("%d",&s10);
    printf("%d\n",s1+s2+s3+s4+s5+s6+s7+s8+s9+s10);
    return 0;
}


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

int main(){
    int N, Q;
    long long K;
    cin >> N >> K >> Q;
    int A, cnt[N+1];
    fill_n(cnt, N+1, 0);
    rep(i, Q){
        cin >> A;
        cnt[A]++;
    }
    rep2(i, 1, N+1){
        if(K-Q+cnt[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1152
#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;
    cin >> n;
    ll a[n + 1];
    ll k[n + 1];
    k[n] = 0;
    rep(i, n + 1) cin >> a[i];
    for (int i = n - 1; i >= 0; --i) {
        k[i] = k[i + 1] + a[i + 1];
    }
    ll ans = 0;
    ll now = 1;
    if (n == 0 && a[0] != 1) {
        cout << -1 << endl;
        exit(0);
    }
    rep(i, n + 1) {
        // cout << now << endl;
        if (now <= 0) {
            ans = -1;
            break;
        }
        ans += now;
        now = min((now - a[i]) * 2, k[i]);  //next
    }
    if (now != 0) {
        ans = -1;
    }
    // rep(i, n + 1) {
    //     cout << k[i] << endl;
    // }
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

struct Edge {
    int to, id;
};

bool dfs(int u, int v, vector<vector<Edge>> &edges, int parent, vector<int> &route) {
    if (u == v) {
        return true;
    }
    for (Edge w : edges[u]) {
        if (w.to == parent) continue;
        bool b = dfs(w.to, v, edges, u, route);
        if (b) {
            route.push_back(w.id);
            return true;
        }
    }
    return false;
}

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

    vector<vector<Edge>> edges(n);

    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;

        edges[a].push_back({b, i});
        edges[b].push_back({a, i});
    }

    int m;
    cin >> m;

    vector<ll> routes(m);
    rep(i, m) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        vector<int> route;
        dfs(u, v, edges, -1, route);

        ll route_bit = 0;
        for (int r : route) {
            route_bit |= (1ll << r);
        }
        routes[i] = route_bit;
    }

    ll ans = 0;
    rep(i, 1 << m) {
        ll j = 0;
        rep(k, m) {
            if ((i >> k) & 1) {
                j |= routes[k];
            }
        }
        int white = __builtin_popcountll(j);
        ll now = 1ll <<(n - 1 - white);
        if (__builtin_popcount(i) % 2 == 0) {
            ans += now;
        } else {
            ans -= now;
        }
    }

    cout << ans << endl;
}


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

int main(){
  int s;
  cin >> s;
  int cnt = 0;
  if(s == 3) cnt += 5;
  while(s > 4){
    cnt++;
    if(s%2 == 0) s /= 2;
    else s = s * 3 + 1;
  }
  cout << cnt + 4 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define pa pair<int,int>
#define mod 998244353
#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define cl(x) memset(x,0,sizeof x)
#ifdef Devil_Gary
#define bug(x) cout<<(#x)<<" "<<(x)<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define bug(x)
#define debug(...)
#endif

const int INF = 0x7fffffff;
const int N=3e5+5;
/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=(TT=but)+fread(but,1,1<<15,stdin),TT==mo))?-1:*TT++)//*/
inline int read(){
    int x=0,rev=0,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')rev=1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return rev?-x:x;
}/*
struct Edge{
	int nxt,v;
//	int w;
//	int id;
}e[N<<1];
void add(int u,int v){
	e[++tot].v=v,e[tot].nxt=head[u],head[u]=tot;
	e[++tot].v=u,e[tot].nxt=head[v],head[v]=tot;
}*/
char s[N];
int n;
ll tmp;
int main(){
#ifdef Devil_Gary
    freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
#endif
	cin>>s+1;
	n=strlen(s+1);
	
	for(int i=1;i<=n;i++) tmp+=s[i]-'0';
	printf("%s",(tmp%9==0)?"Yes":"No");
	return 0;
}


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

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

int main(){
	char fld[3][3];
	while(true){
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				cin>>fld[i][j];
				if(fld[i][j]=='0') return 0;
			}
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(fld[i][j]=='+') continue;
				for(int k=0;k<8;k++){
					int cnt = 0;
					for(int l=0;;l++){
						int ny = i+dy[k]*l, nx = j+dx[k]*l;
						if(ny<0 || 3<=ny || nx<0 || 3<=nx) break;
						if(fld[ny][nx]==fld[i][j]) cnt++;
					}
					if(cnt==3){
						if(fld[i][j]=='b') puts("b");
						else puts("w");
						goto NEXT;
					}
				}
			}
		}
		puts("NA");
		NEXT:;
	}
	return 0;
}

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

typedef std::pair<int,int> P;
int main()
{
    int a,b;
    std::cin >> a>> b;

    for (int i = 1; i <=1100; i++) {
        int tmpa = i * 0.08;
        int tmpb = i * 0.10;
        if (tmpa == a && tmpb == b) {
            std::cout << i << std::endl;
            return 0;
        }
    }

    std::cout << -1 << std::endl;

    return 0;
}


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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
	cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	cout << head;
	if (sizeof...(tail) != 0) cout << " ";
	print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
	for (auto& a : vec) {
		cout << a;
		if (&a != &vec.back()) cout << " ";
	}
	cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
	for (auto& vec : df) {
		print(vec);
	}
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	string a, b;
	cin >> a >> b;
	string s = a + b;
	double num = atof(s.c_str());
	num = sqrt(num);
	num -= floor(num);
	print(num == 0.0 ? "Yes" : "No");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
s=input()
answer=1
t=s[0]
a=0
for i in range(len(s)):
  if a>=(len(s)-1):
    break
  else:
    if t!=s[a+1]:
      answer+=1
      a+=1
      t=s[a]
    else:
      if a>=(len(s)-2):
        break
      else:
        answer+=1
        t=s[a+1]+s[a+2]
        a+=2
print(answer)

Measured memory_bytes: 3500
# coding: utf-8
# Your code here!
SIZE=200001; MOD=10**9+7 #998244353 #ここを変更する

SIZE += 1
inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
fac = [0]*SIZE  # fac[j] = j! mod MOD
finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD

def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

h,w,a,b = [int(i) for i in readline().split()]


ans = 0
for i in range(h-a):
    ans += choose(i+b-1, b-1) * choose(h-i-1+w-b-1,w-b-1)
    ans %= MOD

print(ans)
    

Measured memory_bytes: 26740
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int n,m;
vector<string>in;
vvi cnt;
int sx,sy,bx,by;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	while(cin>>n>>m,n+m){
		in=vector<string>(n);
		cnt=vvi(n,vi(m,-1));
		rep(i,n)cin>>in[i];
		rep(i,n)rep(j,m)if(in[i][j]=='B'){
			bx=i;by=j;in[i][j]='.';
		}else if(in[i][j]=='A'){
			sx=i;sy=j;in[i][j]='.';
		}
//		f(sx,sy,0);
		queue<pair<pii,int> >qu;
		qu.push(pair<pii,int>(pii(sx,sy),0));
		cnt[sx][sy]=0;
		while(!qu.empty()){
			pair<pii,int>q=qu.front();qu.pop();
			pii t=q.first;
			rep(i,4){
				int nx=t.first+dx[i];
				int ny=t.second+dy[i];
				if(nx<0||ny<0||nx>=n||ny>=m)continue;
				if(in[nx][ny]=='.'&&cnt[nx][ny]==-1){
					cnt[nx][ny]=q.second+1;
					qu.push(pair<pii,int>(pii(nx,ny),q.second+1));
				}
			}
		}
//		rep(i,n){rep(j,m)cout<<" "<<(int)cnt[i][j];cout<<endl;}
		int mi=inf,ax,ay;
		string s;
		cin>>s;
		int c=0;
		rep(i,300){
//			cout<<bx<<" "<<by<<endl;
			if(cnt[bx][by]!=-1){
				int t=cnt[bx][by];
				if(t<=i&&mi>i){
					mi=min(mi,i);
					ax=bx;ay=by;
				}
			}//442688
			if(s[c]=='5');
			else if(s[c]=='8'&&bx)bx--;
			else if(s[c]=='6'&&by<m-1)by++;
			else if(s[c]=='4'&&by)by--;
			else if(s[c]=='2'&&bx<n-1)bx++;
			c++;
			if(c==s.size())c=0;
		}
		
		if(mi==inf)cout<<"impossible"<<endl;
		else cout<<mi<<" "<<ax<<" "<<ay<<endl;
	}
}
 

Measured memory_bytes: 1248
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "limits.h"
#include "bitset"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
using namespace std;

string s;
int cnt;

int main(){
	cin >> s;
	cnt = s.size() / 2;
	lp(s.size())
		if (s[i] == 'p')cnt--;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    long long int N, M, R;
    cin >> N >> M >> R;
    vector<long long int> r(R);
    for(int i = 0; i < R; ++i) {
        cin >> r[i];
    }
    const long long int MAXN = 205;
    const long long int INF = 1LL<<50;
    long long int adj_mat[MAXN][MAXN];
    for(int i = 0; i < MAXN; i++)
        for(int j = 0; j < MAXN; j++)
            adj_mat[i][j] = INF;
    for(int i = 0; i < MAXN; i++)
        adj_mat[i][i] = 0LL;
    for(int i = 0; i < M; ++i) {
        long long int a, b, c;
        cin >> a >> b >> c;
        adj_mat[a][b] = c;
        adj_mat[b][a] = c;
    }
    for(int k = 0; k < MAXN; k++)
        for(int i = 0; i < MAXN; i++)
            for(int j = 0; j < MAXN; j++)
                adj_mat[i][j] =
                    min(adj_mat[i][j],adj_mat[i][k]+adj_mat[k][j]);
    long long minima = 1LL<<60;
    sort(r.begin(),r.end());
    do {
        long long distance = 0LL;
        for(int i = 0; i < R-1; ++i) {
            long long int a = r[i];
            long long int b = r[i+1];
            distance += adj_mat[a][b];
        }
        minima = min(minima,distance);
    } while(next_permutation(r.begin(),r.end()));
    cout << minima << endl;
}


Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B = mapint()

ans = 0
for i in range(A, B+1):
    s = str(i)
    if s[0]==s[-1] and s[1]==s[-2]:
        ans += 1
print(ans)

Measured memory_bytes: 70644
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll int64_t 
#define f(i,s,e) for(i=s;i<e;++i)
#define endl << "\n"
#define sp << " "
#define INF INFINITY
#define mset(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI acos(-1) 
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define eb(a) emplace_back(a)
#define print(x) for(auto it:x) cout<<it<<' '; cout<<"\n";

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

int main()
{
	FAST_IO ;
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	set <ll> s;
	s.insert(a*c) ; s.insert(a*d) ; s.insert(b*c) ; s.insert(b*d) ;
	auto it = s.end() ;
	--it;
	cout << *it endl ;
	return 0;
}

/*
If u haven't come up with an approach yet ,skip this one
  Try this when feeling stuck -
  1. Int overflow, array bounds
  2. Special cases (n=1?)
  3. Prove your approach to yourself(mathematical induction,counter-intuitive or stronger test cases)
  4. Calm down and don't look at standings and stop thinking about rating and think about the question
  5. Just do it! 
*/ 

//Benq's advice - 
/* 
	And following advices are must for me -
	* do something instead of nothing and stay organized
	* WRITE STUFF DOWN 
*/

//#define _GLIBCXX_DEBUG 
// It will convert WA verdict to runtime error if that error is caused due to out of bound excess , declare it at the top
//#pragma GCC optimize "trapv" 
// It will convert WA to runtime error if WA was caused due to int overflow error,declare it anywhere

Measured memory_bytes: 3668
N,M = map(int,input().split())

A_B_AB_list = []
for i in range(N):
    A,B = map(int,input().split())
    A_B_AB = [A,B,A*B]
    A_B_AB_list.append(A_B_AB)
A_B_AB_list.sort()
B_sums = [0]*(N+1)
AB_sums = [0]*(N+1)
for i in range(N):
    B_sums[i+1] = B_sums[i] + A_B_AB_list[i][1]
    AB_sums[i+1] = AB_sums[i] + A_B_AB_list[i][2]
for i in range(1,N+1):
    if B_sums[i] >= M:
        amari = M - B_sums[i-1] 
        ans = AB_sums[i-1] + amari*A_B_AB_list[i-1][0]
        print(ans)
        break

    

Measured memory_bytes: 32148
K = int(input())

def s(i, K):
    return 7*(pow(10, i+1, K) - 1)

flag = False
tmp = 9*K
for i in range(K+2):
    if s(i, tmp) % tmp == 0:
        flag = True
        print(i+1)
        break

if flag == False:
    print(-1)


Measured memory_bytes: 8968
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
const int N=2e5+5;
char s1[N],s2[N];
int a[N],b[N];
int main() {
	scanf("%s %s",s1,s2);
	int len1=strlen(s1),len2=strlen(s2);
	if(len1!=len2)return puts("No"),0; 
	for(int i=1;i<len1;i++) {
		if(!a[s1[i]-'a']&&!b[s2[i]-'a'])a[s1[i]-'a']=s2[i]-'a',b[s2[i]-'a']=s1[i]-'a';
		if(a[s1[i]-'a']==s2[i]-'a'&&b[s2[i]-'a']==s1[i]-'a')continue;
		if(a[s1[i]-'a']!=(s2[i]-'a')||(b[s2[i]-'a']!=s1[i]-'a'))return puts("No"),0;
	}
	puts("Yes");
}

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

using namespace std;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for(auto &z: v)
#define sp << ' ' << 
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353

typedef struct quad{
    int a, b, c, d;
}qua;

int main()
{
    boost;
    ll tt = 1, n, m, k = 0, i, j;
    ll q, l = 0, r = 0, x, y, z, h, a, b, c, d;

    bool poss = true;

    // cin >> tt;
    for(int _ = 1; _ <= tt; _++){
        // cout << "Case #" << _ << ": ";
        cin >> a >> b >> c >> k;

        ll ans = 0;
        ans = min(a, k);

        ll rem = k - ans;

        if(rem){
            rem = rem - min(b, rem);
            if(rem){
                ans = ans - rem;
            }
        }

        cout << ans << nl;
    }   
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

int main() {
    int N, c = 0, p = 0, q = 0;
    cin >> N;
    vector<int> P(N), Q(N), R(N);
    rep(i, N) { cin >> P.at(i); }
    rep(i, N) { cin >> Q.at(i); }
    rep(i, N) { R.at(i) = i + 1; }

    do {
        if(P == R) p = c;
        if(Q == R) q = c;
        c++;
    } while(next_permutation(R.begin(), R.end()));

    cout << abs(p - q) << endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <vector>

#define phb push_back
#define mkp make_pair
#define frs first
#define scn second
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef pair< int, int > Pr;

int N, M;
vector< Pr > C;

void read();
void solve();

bool cmpf(const Pr &, const Pr &);

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

void read() {
  int c, d;

  cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    cin >> c >> d;
    C.phb(mkp(c, d));
  }
}

void solve() {
  vector< Pr > cp;

  for (int i = 0; i < M; ++i) {
    bool ign = false;

    for (int j = 0; j < M && !ign; ++j)
      if (i != j && ((C[i].frs >= C[j].frs) && (C[i].scn <= C[j].scn)))
        ign = true;

    if (!ign)
      cp.phb(C[i]);
  }

  stable_sort(all(cp), cmpf);

  int res = N + 1;

  for (int i = 0, j = 0, ed; i < sz(cp); i = j) {
    j = i + 1, ed = cp[i].scn;

    while (j < sz(cp) && (ed >= cp[j].frs))
      ed = cp[j].scn, ++j;

    res += 2 * (ed - cp[i].frs);
  }

  cout << res << "\n";
}

bool cmpf(const Pr &ra, const Pr &rb) {
  return ra.frs < rb.frs;
}

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define X first
#define Y second
#define pb push_back
#define make_unique(x) sort(all(x)), x.resize(unique(all(x)) - x.begin())
#define int long long

const LL mod = 1e9 + 7;


template<class T>
istream& operator >> (istream& in, vector<T>& v){ for (auto &x : v) { in >> x; } return in; }

template<class T, class U>
istream& operator >> (istream& in, pair<T, U> & v){ in >> v.X >> v.Y;return in; }

template<class T, class U>
ostream& operator << (ostream& out, pair<T, U> & v){ out << v.X << " " << v.Y;return out; }

void chkmax(int &a, int b) {
    a = max(a, b);
    return;
}

void chkmin(int &a, int b) {
    a = min(a, b);
    return;
}

LL ppow (LL x, LL s) {
    if (!s) return 1;
    if (!(s - 1)) return x % mod;
    if (s % 2) return (x * ppow (x, s - 1)) % mod;
    LL b = ppow (x, s / 2);
    return (b * b) % mod;
}

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("ILUXA.in", "r", stdin);
    int n, W;
    cin >> n >> W;
    vector<int> w(n), v(n);
    for (int i = 0;i < n;i++) {
        cin >> w[i] >> v[i];
    }

    int dp[W + 1];
    int new_dp[W + 1];
    for (int i = 0;i <= W;i++) {
        dp[i] = new_dp[i] = 0;
    }
    for (int i = 0;i < n;i++) {
        for (int j = 0;j <= W;j++) {
            if (j + w[i] <= W) {
                chkmax(new_dp[j + w[i]], dp[j] + v[i]);
            }
            chkmax(new_dp[j], dp[j]);
        }
        for (int j = 0;j <= W;j++) {
            dp[j] = new_dp[j];
        }
    }
    cout << dp[W];
    return 0;
}


Measured memory_bytes: 1792
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//234 from prison
	int n,m;
	cin>>n>>m;
	int st= 1,en=n;
	while(m--) {
		int l,r;
		cin>>l>>r;
		st=max(st,l);
		en=min(en,r);
	}
	cout<<max(0,en-st+1);
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3632
//allocation
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int n, k,maxp, w[999999], sum[999999];
int main(){
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; i++){
        scanf("%d", &w[i]);
        sum[i] = sum[i-1]+w[i];
        maxp = max(maxp, w[i]);
    }
    maxp = max(maxp, sum[n]/k);
    while(true){
        int now = maxp;
        int *nowpos = sum;
        for(int i = 1; i <= k; i++){
            //search
            nowpos = upper_bound(nowpos, sum+n+1, now);
            now = *(nowpos-1)+maxp;
        }
        //end
        if(nowpos == sum+n+1) break;
        else maxp++;
    }
    printf("%d\n", maxp);

}



Measured memory_bytes: 4000
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastIO;
    int a, b;
    cin >> a >> b;
    cout << a * b;
}

Measured memory_bytes: 3508
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

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

	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());

	long long ans = 0;
	int ia = 0;
	int ic = 0;
	for (int ib = 0; ib < n; ib++) {

		while (ia < n) {
			if (ia < n - 1 && a[ia+1] < b[ib]) {
				ia++;
			} else {
				break;
			}
		}

	 	while (ic < n) {
	 		if (ic < n - 1 && c[ic] <= b[ib]) {
	 			ic++;
			} else {
				break;
			}
	 	}

	 	// printf("bac: %d %d %d\n", ib, ia, ic);

	 	if (a[ia] < b[ib] && b[ib] < c[ic]) {
	 		ans += 1LL * (ia + 1) * (n - ic);
	 	}
	}

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


Measured memory_bytes: 1664
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <cstdio>
using namespace std;

vector<vector<int>>lst;
unordered_map<long long,pair<int,int>>m;

pair<int,int> dfs(int d,int cur){
	long long key=(long long)d<<32|cur;
	if(m.find(key)!=m.end())return m[key];
	pair<int,int> r={cur,cur};
	if(cur>0){
		auto it=upper_bound(lst[cur].begin(),lst[cur].end(),d);
		if(it!=lst[cur].end()){
			r.first=dfs(*it,cur-1).first;
		}
	}
	if(cur<lst.size()-1){
		auto it=upper_bound(lst[cur+1].begin(),lst[cur+1].end(),d);
		if(it!=lst[cur+1].end()){
			r.second=dfs(*it,cur+1).second;
		}
	}
	return m[key]=r;
}

int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	vector<pair<int,int>>v(k);
	for(int i=0;i<k;i++){
		scanf("%d%d",&v[i].first,&v[i].second);
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	lst.resize(n);
	for(int i=0;i<k;i++){
		lst[v[i].second].push_back(i);
	}
	for(int i=0;i<n;i++){
		auto p=dfs(-1,i);
		printf(i<n-1 ? "%d " : "%d\n",p.second-p.first+1);
	}
}

Measured memory_bytes: 28824
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500 * i + 100 * j + 50 * k:
                cnt += 1

print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;

#define int long long
#define LL long long
#define ULL unsigned long long

const LL LL_INF = ~(ULL)0 >> 1;

int n, f[102], mem[102][21];

int cal(int index, int ans) {
    if (index == n - 2) {
        return (ans == f[n - 1]) ? 1 : 0;
    }

    if ((ans < 0) || (20 < ans)) return 0;

    if (mem[index][ans] == LL_INF) {
        int result = cal(index + 1, ans + f[index + 1]) + cal(index + 1, ans - f[index + 1]);
        return mem[index][ans] = result;
    } else {
        return mem[index][ans];
    }
}

signed main() {
    for (int i = 0; i < 102; ++i) {
        fill(mem[i], mem[i] + 21, LL_INF);
    }

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

    cout << cal(0, f[0]) << endl;

    return 0;
}

Measured memory_bytes: 1172
#define _USE_MATH_DEFINES
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <math.h>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
#define INF 100000000000000LL
 
using namespace std;
 
typedef long long ll;
 
int N;
 
map <ll, int> mp;
map <ll,int>::iterator it;
set <ll> st;
 
ll dv(ll x){
 
  for(ll i=2;; i++){
 
    ll t=i*i*i;
    if(t>x) break;
    while(x%t==0) x/=t;
 
  }
 
  return x;
 
}
 
ll tp(ll x){
	ll A=1,B=1;
	for(ll i=2;;i++){
		if(i*i*i>x) break;
		int cnt=0;
		while(x%i==0)
		{
			x/=i;
			cnt++;
		}
		if(cnt==1) A*=i;
		else if(cnt==2) B*=i;
	}
	
      ll dt=(ll) floor(sqrt(x)+0.5);
	if(dt*dt==x) B*=dt;
	else A*=x;
	ll ret=A*B;
	if(ret>INF/A+1) ret=INF;
	else ret*=A;
	return ret;

}
 
int main(){
 
 scanf("%d",&N);
 
 for(int i=0; i<N; i++){
 
  ll x;
  scanf("%lld",&x);
  x=dv(x);
  mp[x]++;
  //cout<<x<<endl;
 }
 
 int ans=0; //cout<<tp(1027243729)<<endl;
  
 for(it=mp.begin();it!=mp.end();it++){
 
  ll x=it->first; //cout<<x<<endl;
  int cn=it->second;
  ll y=tp(x);
 
  if(st.count(x)) continue;
 
  if(x!=1) ans+=max(cn,mp[y]);
  else ans++;
 
  st.insert(y);
 
 }
  
  cout<<ans<<endl;
 
 return 0;
 
}

Measured memory_bytes: 14336
fun main(args: Array<String>) {
    var (x, y) = readLine()!!.split(" ").map{ it.toInt() }
    val l = readLine()!!.split(" ").map { it.toInt() }.sorted()
    var a = 0
    for (i in 0 until x - 1){
        if(y >= l[i]){
            y -= l[i]
            a += 1
        }
    }
    if(l.last() == y){
        a += 1
    }
    println(a)
}


Measured memory_bytes: 40388
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
int v0_i, v1_i;

//解説AC
//http://drken1215.hatenablog.com/entry/2019/04/14/222900
//まぜこぜ累積和がかけなかった...

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

  int n,k;
  string s;
  cin >> n >> k;
  cin >> s;
  
  vector<int> nums;    
  if (s[0] == '0') nums.push_back(0);
  for (int i = 0; i < s.size();) {
    int j = i;
    while (j < s.size() && s[j] == s[i]) ++j;
    nums.push_back(j - i);
    i = j;
  }
  if (s.back() == '0') nums.push_back(0);

  vector<int> sums((int)nums.size() + 1, 0);
  for (int i = 0; i < nums.size(); ++i) sums[i+1] = sums[i] + nums[i];

  for(auto &e : sums) cerr << e << " ";
  cerr << endl;
  
  int ans = 0;
  for(int l = 0; l < sums.size(); l+=2){
    int r = l+k*2+1;
    if(r >= sums.size()) r = sums.size()-1;
    ans = max(ans, sums[r]-sums[l]);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    ll n,m,k;
    cin>>n>>m>>k;
    ll alst[n+1],blst[m+1];
    alst[0]=0;
    blst[0]=0;
    rep(i,1,n+1){
        cin>>alst[i];            
        alst[i]+=alst[i-1];
    }
    rep(i,1,m+1){
        cin>>blst[i]; 
        blst[i]+=blst[i-1];
    }
    int best=0,best_j=m;
    rep(i,0,n+1){
        ll tmp=k-alst[i];
        if(tmp<0){
            break;
        }
        while(blst[best_j]>tmp)
            best_j--;
        best=max(best,i+best_j);
    }
    cout<<best<<endl;
    return 0;
}


Measured memory_bytes: 6688
/***
	chauhan176's code

	DO WHATEVER IT TAKES!!!
	Nothing happens , nothing happens and then everything happens.
	But the thing is nothing happens in air:)-
***/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long int
#define fi first
#define se second
#define mod 1000000007
#define maxn 200005
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define stringio cin.ignore(256, '\n')  //to take string input after taking integer inputs
#define go_t int t;cin>>t;while(t--)
#define go_pt int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef pair<int,int>pii;
const ll inf = 0x3f3f3f3f3f3f3f3fll;//4x10e18
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    //freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    //freopen("output.txt", "w", stdout);
    #endif

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

    int ans = max(a+b,a-b);
    ans = max(ans,a*b);
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;

int hikaku(const void *n1,const void *n2)
{
    return *(int*)n1-*(int*)n2;
}


int main()
{
    int x,n;
    scanf("%d %d",&x,&n);
    if(n==0)
    {
        printf("%d\n",x);
    }
    else
    {
    
    int p[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&p[i]);
    }
    qsort(p,n,sizeof(int),hikaku);
    int ans=0;
    int pt=0;

    for(int i=1;i<102;i++)
    {
        if(i==p[pt])
        {
            pt=pt+1;
        }
        else
        {
            if(abs(x-ans)>abs(x-i))
            {
                ans=i;
            }
        }
    }

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

    return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int main()
{
    int a, b;
    cin >> a >> b;
    if((a*500) >= b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


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

int n, t, a[100005], ans;

signed main()
{
    cin >> n >> t;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int l = a[0], cost = 0;
    for(int i = 0; i < n; i++){
        if(l > a[i]){
            l = a[i];
            continue;
        }
        cost = max(cost, a[i] - l);
    }
    l = a[0];
    for(int i = 0; i < n; i++){
        if(l > a[i]){
            l = a[i];
            continue;
        }
        if(cost == a[i] - l){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
//author:luckYrat(twitter:@luckYrat_)
//#include <tourist>

//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  string s;cin>>s;
  if(s.size()%2){
    cout << "No" << endl;
    return 0;
  }
  for(int i = 0; s.size() > i; i+=2){
    if(!(s[i] == 'h' && s[i+1] == 'i')){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
from sys import stdin
def main():
    n, m, v, p = map(int, stdin.readline().split())
    a = map(int, stdin.readline().split())
    a.sort()
    s = [0] * (n + 1)
    for i, x in enumerate(a):
        s[i+1] = s[i] + x
    ans = 0
    for i in xrange(n):
        x = a[i] + m
        if x < a[-p]:
            continue
        r = v - p - i
        if r > 0:
            u = r * m
            if u <= x * (n - p - i) - s[n-p+1] + s[i+1]:
                ans += 1
        else:
            ans += 1
    print ans
main()


Measured memory_bytes: 11332