akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define mod       1000000007
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define ps(s)     for(auto i:s){cout<<i<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"This is test"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
double get(pair<int,int>a,pair<int,int>b){
	int x=a.ff-b.ff;
	int y=a.ss-b.ss;
	x=x*x;y=y*y;
	return (double)sqrt(x+y);
}
void solve(){
	ll n,k,q;cin>>n>>k>>q;
	map<int,int>m;
	for(int i=0;i<q;i++){ll x;cin>>x;m[x]+=1;}
	for(int i=1;i<=n;i++){
		ll x=q-m[i];
		if(x>=k){cout<<"No\n";}
		else{cout<<"Yes\n";}
	}
}
int32_t main(){
	kehsihba();
	//init();
	ll t=1;
	//cin>>t;
	for(int k=1;k<=t;k++){
		//cout<<"Case "<<k<<": ";
		solve();
		//e;
	}
}

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

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long int 
#define MAX 305
const int M=1e9+7;
const ll INF = 1LL << 60;
typedef pair<int,int> pii;
typedef double ld;
bool visited[MAX];
vector<int>adj[MAX];
int n;

ld dp[MAX][MAX][MAX];
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL); 
	cin>>n;
	int c1=0,c2=0,c3=0;
	for(int i=1;i<=n;i++)
	{
		int c;
		cin>>c;
		if(c==1)
		{
			c1++;
		}
		if(c==2)
			c2++;
		if(c==3)
			c3++;
	}
	for(int k=0;k<MAX;k++)
	{
		for(int j=0;j+k<MAX;j++)
		{
			for(int i=0;i+j+k<MAX;i++)
			{
				if(i==0 && j==0 && k==0)
					continue;
				if(i+j+k>MAX)
					continue;
				ld w=1.0*n/(i+j+k);
				ld p1=1.0*i/(i+j+k);
				ld p2=1.0*j/(i+j+k);
				ld p3=1.0*k/(i+j+k);

				if(i)
					dp[i][j][k]+=p1*dp[i-1][j][k];
				if(j)
					dp[i][j][k]+=p2*dp[i+1][j-1][k];
				if(k)
					dp[i][j][k]+=p3*dp[i][j+1][k-1];
				dp[i][j][k]+=w;
			}
		}
	}
	cout<<fixed<<setprecision(15)<<dp[c1][c2][c3]<<endl;
	return 0;	
}


Measured memory_bytes: 221440
#include <bits/stdc++.h>
using namespace std;
#define ll long long
 
int main(int qtd, char* nome[])
{
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	int h, x;
	cin >> h >> x;
	cout << ceil((double)h/x) << endl;
	
	return 0;
}

Measured memory_bytes: 892
import java.util.Scanner;
import java.math.BigDecimal;

public class Main {
    public static void main(String args[]) {
        int debt = 100000;
        int nWeeks = Integer.parseInt(new Scanner(System.in).next());
        for(int i = 0; i < nWeeks; i++) {
            debt = new BigDecimal(debt * 1.05).setScale(-3, BigDecimal.ROUND_CEILING).intValue();
        }
        System.out.println(debt);

    }
} 

Measured memory_bytes: 17220
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn int
using ll = long long;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int a[1000000];

#define  MAX 10000
struct Node { int parent, left, right; };
Node T[MAX];
int n;
int NIL = -1;

void preParse(int id) {
	if (id == NIL)
		return;
	cout << " " << id ;
	preParse(T[id].left);
	preParse(T[id].right);
}

void inParse(int id) {
	if (id == NIL)
		return;
	inParse(T[id].left);
	cout << " " << id;
	inParse(T[id].right);
}

void postParse(int id) {
	if (id == NIL)
		return;
	postParse(T[id].left);
	postParse(T[id].right);
	cout << " " << id ;
}

signed main() {
	cin >> n;
	int id, left, right,i;
	rep(i, n) T[i].parent = NIL;
	rep(i, n) {
		cin >> id >> left >> right;
		T[id].left = left;
		T[id].right = right;
		if (left != NIL)T[left].parent = id;
		if (right != NIL)T[right].parent = id;
	}
	int root;
	rep(i, n) if (T[i].parent == NIL) root = i;
	cout << "Preorder" << endl;
	preParse(root);
	cout << endl;
	cout << "Inorder" << endl;
	inParse(root);
	cout << endl;
	cout << "Postorder" << endl;
	postParse(root);
	cout << endl;
	return 0;
}


Measured memory_bytes: 3112
#define _USE_MATH_DEFINES
#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 MOD = 1e9 + 7;

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

int main() {
    int N;
    cin >> N;
    bool a = true;
    rep(i, N + 1) {
        if(int(1.08 * i) == N) cout << i << endl, a = 0;
    }
    if(a) cout << ":(" << endl;
}


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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    string s,t;
    cin >> s >> t;
    cin >> n;
    ll ss=s.size(),ts=t.size();
    ll sacnt[ss+1]={},sbcnt[ss+1]={};
    ll tacnt[ts+1]={},tbcnt[ts+1]={};
    for(i=0;i<ss;i++){
        if(s[i]=='A')sacnt[i+1]++;
        else sbcnt[i+1]++;
    }
    for(i = 0; i < ts; i++) {
        if(t[i] == 'A')
            tacnt[i + 1]++;
        else
            tbcnt[i + 1]++;
    }
    for(i=0;i<ss;i++){
        sacnt[i+1]+=sacnt[i];
        sbcnt[i+1]+=sbcnt[i];
    }
    for(i = 0; i < ts; i++) {
        tacnt[i + 1] += tacnt[i];
        tbcnt[i + 1] += tbcnt[i];
    }
    for(i=0;i<n;i++){
        ll a,b,c,d;
        cin >> a >> b >> c >> d;
        ll sa = sacnt[b]-sacnt[a-1];
        ll sb = sbcnt[b]-sbcnt[a-1];
        ll ta = tacnt[d] - tacnt[c - 1];
        ll tb = tbcnt[d] - tbcnt[c - 1];
        if((sa + sb * 2) % 3 == (ta + tb * 2) % 3){
            cout << "YES" << endl;
        }else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
vector<int> a[100001];
int n, m, u, v, d[100001], kq;
void nhap()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>u>>v;
        a[u].push_back(v);
    }
    memset(d, -1, sizeof d);
}
int dfs(int u)
{
    if(d[u]!=-1) return d[u];
    vector<int>::iterator v;
    int res=0;
    for(v=a[u].begin();v!=a[u].end();v++)
        res=max(res, dfs(*v));
    res++;
    return d[u]=res;
}
int main()
{
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
    nhap();
    for(int i=1;i<=n;i++)
        if(d[i]==-1) dfs(i);
    kq=0;
    for(int i=1;i<=n;i++) kq=max(kq, d[i]);
    cout<<kq-1;
    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split();
        long A = long.Parse(input[0]);
        long B = long.Parse(input[1]);
        if ((A + B) % 2 == 1) { Console.WriteLine("IMPOSSIBLE"); }
        else { Console.WriteLine((A + B) / 2); }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<int,P> PP;

vector<PP> v;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main()
{
	
	ll a,b,c,d,cc,dd;
	cin >> a >> b >> c >> d;
	ll lcm = c * d;
	cc = c;
	dd = d;
	if(cc<dd) swap(cc,dd);
	ll r = cc % dd;
	while(r!=0){
		cc = dd;
		dd = r;
		r = cc % dd;
	}
	lcm /= dd;
	ll ans = 0;
	ll c_sa = b/c - (a-1)/c;
	ll d_sa = b/d - (a-1)/d;
	ll kaburi = b/lcm - (a-1)/lcm;
	//cout << c_sa << " " << d_sa << " " << kaburi << endl;
	cout << b-a + 1 - c_sa - d_sa + kaburi << 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++)
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i,n){
    cin >> h.at(i);
  }
  vector<int> p(n);
  rep(i,n){
    p.at(h.at(i)-1)++;
  }
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  int ans=0;
  for(int i=k;i<n;i++){
    ans+=p.at(i);
  }
  cout << ans;
}

Measured memory_bytes: 1792
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

#
# A, B, C = list(map(int, sys.stdin.readline().split()))
# a = A
# ok = False
# for _ in range(1000):
#     ok |= a % B == C
#     a += A
# if ok:
#     print('YES')
# else:
#     print('NO')
#

A, B = [int(sys.stdin.readline()) for _ in range(2)]
if A>B:
    print('GREATER')
elif A<B:
    print('LESS')
else:
    print('EQUAL')


Measured memory_bytes: 13644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define plint pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    int n,r;
    cin >> n >> r;
    if(n<=9){
        cout << r+100*(10-n) << endl;
    }else{
        cout << r << endl;
    } 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

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

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

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

using ll = long long;
constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

struct City {
    int cityNum;
    int prefNum;
    int year;
    string ID = "";
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vector<int>X(N + 1);
    cin >> X;

    SORT(X);
    FOR(i, 1, N + 1) {
        X[i] -= X[0];
    }

    int ans = X[1];
    FOR(i, 2, N + 1) {
        ans = GCD(ans, X[i]);
    }
    cout << ans << endl;
    return 0;

}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 100;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    CIN(a,b,c,x);
    int ans=0;
    RepS(i,0,a){
        RepS(j,0,b){
            RepS(k,0,c){
                int cls=500*i+100*j+50*k;
                if(cls==x) ans++;
            }
        }
    }
    printf("%d\n",ans);

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
	char s[256];
	int count=0;
	scanf("%s",s);
	if(strlen(s)%2==1){
		for(int i=0;i<strlen(s)/2;i++){
			if(s[i]!=s[strlen(s)-1-i])count++;
		}
	}else{
		for(int i=0;i<strlen(s)/2;i++){
			if(s[i]!=s[strlen(s)-1-i])count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    private static final BufferedReader br = new BufferedReader(
            new InputStreamReader(System.in));

    public static void main(String[] args) throws Exception {
        while (true) {
            int n = nextInt();

            if (n == 0) {
                break;
            }

            int i = 0, j = 2, k = 1;

            while (true) {
                k += j;

                if (n < k) {
                    break;
                }

                if ((n - k) % j == 0) {
                    i++;
                }

                j++;
            }

            System.out.println(i);
        }
    }

    private static Integer nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(br.readLine());
    }
}

Measured memory_bytes: 16888
#include<bits/stdc++.h>
#define IOS                      \
    ios_base::sync_with_stdio(0);\
    cin.tie(0);                  \
    cout.tie(0);
#define eps 1e-6
//#define ll long long
#define int long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
const int mod=1000000007;
using namespace std;
//typedef pair<int ,int> P;
signed main()
{
    int k,n,sum,t,num;
    cin>>k>>n;
    int a[n+1],dis[n+1];
    for(int i=1;i<n+1;i++)
    {
        cin>>a[i];
    }
    dis[n]=min(a[n]-a[1],k-(a[n]-a[1]));
    for(int i=1;i<n;i++)
    {
        dis[i]=a[i+1]-a[i];
    }
    sort(dis+1,dis+n+1);
    int dex=n-1;
    int ans=0;
    rep(i,1,dex+1)
    ans+=dis[i];
    cout<<ans;
}


Measured memory_bytes: 3456
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    int n;
    int[] as;

    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
    }

    void solve(){
        int[] dp = new int[n];
        //Arrays.fill(dp, Integer.MAX_VALUE);
        int length = 1;
        dp[0] = as[0];
        for (int i = 1; i < n; i++) {
            if (dp[length - 1] < as[i])
                dp[length++] = as[i];
            else {
                dp[getIndex(dp, length, as[i])] = as[i];
            }
        }
        System.out.println(length);
    }

    int getIndex(int[] as, int length, int v) {
        int l = 0;
        int r = length;
        while (r != l) {
            int mid = l + (r - l) / 2;
            if (as[mid] >= v)
                r = mid;
            else
                l = mid + 1;
        }
        return r;
    }

}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	vector<int> a(n + 2);
	a[0] = a[n + 1] = 0;
	for(int i = 1; i <= n; i++){
		cin>>a[i];
	}
	ll sum = 0;
	for(int i = 1; i <= n + 1; i++){
		sum += abs(a[i] - a[i - 1]);
	}
	for(int i = 1; i <= n; i++){
		cout<<sum - abs(a[i + 1] - a[i]) - abs(a[i] - a[i - 1]) + abs(a[i + 1] - a[i - 1])<<'\n';
	}

	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<cstring>
#include<cassert>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<vector>
#include<time.h>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(ll i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const ll N=262227;
const ll INF=1e9+7;
const ll mod=998244353;
ll Pow(ll x,ll y){
	ll ans=1,now=x;
	while(y){
		if(y&1)ans=ans*now%mod;
		now=now*now%mod;
		y>>=1;
	}
	return ans;
}
ll f[N],g[N],d[N],u[N];
ll n,m,s=0;
int main(){
	scanf("%lld",&n);
	m=1ll<<n;
	rep0(i,m)scanf("%lld",&g[i]);
	rep0(i,m)s=(s+g[i])%mod;
	s=Pow(s,mod-2);
	rep0(i,m)g[i]=g[i]*s%mod;
	rep0(i,m){
		d[i]=mod-1;
		if(!i)d[i]=(d[i]+m)%mod;
	}
	g[0]=(g[0]-1+mod)%mod;
	for(ll i=1;i<m;i<<=1){
		for(ll j=0;j<m;j+=i*2){
			rep0(k,i){
				ll x=g[j+k],y=g[i+j+k];
				g[j+k]=(x+y<mod)?x+y:x+y-mod;
				g[i+j+k]=(x-y<0)?x-y+mod:x-y;
				x=d[j+k],y=d[i+j+k];
				d[j+k]=(x+y<mod)?x+y:x+y-mod;
				d[i+j+k]=(x-y<0)?x-y+mod:x-y;
			}
		}
	}
	rep(i,m-1)f[i]=Pow(g[i],mod-2)*d[i]%mod;
	for(ll i=1;i<m;i<<=1){
		for(ll j=0;j<m;j+=i*2){
			rep0(k,i){
				ll x=f[j+k],y=f[i+j+k];
				f[j+k]=(x+y<mod)?x+y:x+y-mod;
				f[i+j+k]=(x-y<0)?x-y+mod:x-y;
			}
		}
	}
	ll in=Pow(m,mod-2);
	rep0(i,m)printf("%lld\n",(f[i]-f[0]+mod)*in%mod);
	return 0;
}


Measured memory_bytes: 8960
/*
https://atcoder.jp/contests/dp/tasks/dp_g
*/

#include <bits/stdc++.h>
using namespace std;
int main() {
  // ios_base::sync_with_stdio(0);
  // cin.tie(0); cout.tie(0);
  int n,m;
  cin >> n >> m;
  vector<vector<int>> graph(n);
  vector<vector<int>> dag(n);
  vector<int> inDegree(n,0);
  vector<bool> visited(n,false);
  vector<int> component(n,0);
  for(int i=0;i<m;i++) {
    int x,y; cin >> x >> y;
    x--; y--;
    graph[x].push_back(y);
    graph[y].push_back(x);
    dag[x].push_back(y);
    inDegree[y]++;
  }
  // for(int i=0;i<n;i++) {
  //   cout << i << ": ";
  //   for(auto e: graph[i]) cout << e << ' ';
  //   cout << '\n';
  // }
  // find disconnected components
  int cn = 0;
  for(int i=0;i<n;i++) {
    if (!visited[i]) {
      cn++;
      function<void(int,int)> dfs = [&](int u,int v) {
        visited[u] = true;
        component[u] = cn;
        for(auto child: graph[u]) {
          if (child != v and !visited[child])
            dfs(child,u);
        }
      };
      dfs(i,i);
    }
  }
  // for(auto e: component) {
  //   cerr << e << ' ';
  // }
  // cerr << '\n';
  vector<queue<array<int,2>>> kahn(cn);
  for(int i=0;i<n;i++) {
    if (inDegree[i] == 0) {
      kahn[component[i]-1].push({i,0});
    }
  }
  int res = 0;
  int ctr=0;
  for(auto it=kahn.begin();it!=kahn.end();it++,ctr++) {
    // cerr << "Started at: " << ctr << '\n';
    // int cnt = 0;
    auto &s = *it;
    while(!s.empty()) {
      auto node = s.front();
      res = max(res,node[1]);
      // cerr << "Popped: " << node[0] << '\n';
      s.pop();
      
      for(auto e: dag[node[0]]) {
        inDegree[e]--;
        if (inDegree[e] == 0) {
          s.push({e,node[1]+1});
        }
      }
    }
    // res = max(res,cnt);
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 24192
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ACC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mod 1000000007
#define MAXN 10000001
//string alpha="abcdefghijklmnopqrstuvwxyz";
//int dx[]={1,-1,0,0};
//int dy[]={0,0,1,-1};
//int dx8[]={1,-1,0,0,1,1,-1,-1};
//int dy8[]={0,0,1,-1,1,-1,1,-1};
/*int spf[MAXN];
void sieve()
{
	int i,j;
	for(i=0;i<MAXN;i++)
	spf[i]=i;
	for(i=4;i<MAXN;i+=2)
	spf[i]=2;
	for(i=3;i*i<MAXN;i++)
	{
		if(spf[i]==i)
		{
			for(j=i*i;j<MAXN;j+=i)
			{
				if(spf[j]==j)spf[j]=i;
			}
		}
	}
}*/
/*bool isvowel(char c)
{
    switch(c)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':return true;
        default : return false;
    }
}*/
/*bool isValid(int x,int y,int n,int m)
{
    if(x<0||x>n-1||y<0||y>m-1)return false;
    return true;
}*/
/*
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(y.second==x.second)
        return y.first<x.first;
    return y.second<x.second;
}*/
/*int power(int x,int y)
{
    int ans=1;
    for(int i=1;i<=y;i++)
    {
        ans=((ans%mod)*(x%mod))%mod;
    }
    return ans;
}*/
int32_t main()
{
    ACC
    int T;
    T=1;
    //cin>>T;
    while(T--)
    {
        int h,w,m,i,mr=0,mc=0;
        cin>>h>>w>>m;
        map<int,int> r,c;
        map<pair<int,int>,int> mp;
        for(i=0;i<m;i++)
        {
            int x,y;
            cin>>x>>y;
            r[x]++;
            mr=max(mr,r[x]);
            c[y]++;
            mc=max(mc,c[y]);
            mp[{x,y}]++;
        }
        vector<int> v1,v2;
        for(auto j:r)
        {
            if(j.second==mr)v1.pb(j.first);
        }
        for(auto j:c)
        {
            if(j.second==mc)v2.pb(j.first);
        }
        int ans=0;
        for(i=0;i<(int)(v1.size());i++)
        {
            for(int j=0;j<(int)(v2.size());j++)
            {
                if(mp[{v1[i],v2[j]}]>0)ans=max(ans,mr+mc-1);
                else
                {
                    ans=max(ans,mr+mc);break;
                }
            }
            if(ans==mr+mc)break;
        }
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 67844
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;

#define PB push_back
#define MP make_pair

const double pi = acos(-1.);
const double eps = 1e-6;

int mod = 1000000000 + 7;
int a[110000];
int main()
{
	int n;
	scanf("%d", &n);
	int all = 0;
	int ret = 1;
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
		if ((i - all) * 2 - 1 > a[i]) {
			ret = ret * (long long)(i - all) % mod;
			all++;
		}
	}
	while (all < n) {
		ret = ret * (long long)(n - all) % mod;
		all++;
	}
	printf("%d\n", ret);
}



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

int main(){
  char m;
  string a,b,ans;
  int i,j,c;

  while(scanf(" %c ",&m)!=EOF){
    cin >> a >> b;

    ans.erase();

    i = 0;
    j = 0;
    while(i<a.size() && j<b.size()){
      if(a[i]==b[j]){
	ans.push_back(a[i]);
	i++;
	j++;
      }else{
	c = 1;
	if(a[i]=='('){
	  if(m=='u')ans.push_back(a[i]);
	  while(c){
	    i++;
	    if(m=='u')ans.push_back(a[i]);
	    if(a[i]=='(')c++;
	    if(a[i]==')')c--;
	  }
	  i++;
	}else{
	  if(m=='u')ans.push_back(b[j]);
	  while(c){
	    j++;
	    if(m=='u')ans.push_back(b[j]);
	    if(b[j]=='(')c++;
	    if(b[j]==')')c--;
	  }
	  j++;
	}
      }
    }

    cout << ans << endl;

  }
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(4100000)
a = str(input())
a = a
length = len(a)
b = len(a)
ans = 0
if b == 1:
    print(a)
else:
    for i in reversed(range(1,b+1)):
        if i%2 == 1 and i == b:
            temp = ""
            for k in range(i-1):
                temp += "9"
            ans += int(a[b-i:]) - int(temp)

        elif i%2 == 1:
            temp = 9*10**(i)//10

            ans += temp
    print(ans)

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

int main()
{
	int h, w;
	cin >> h >> w;
	vector<vector<char>> v(h, vector<char>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> v[i][j];
		}
	}
	for (int i = h - 1; i >= 0; i--) {
		bool f = true;
		for (int j = 0; j < w; j++) {
			if (v[i][j] == '#') {
				f = false;
				break;
			}
		}
		if (f) {
			v.erase(v.begin() + i);
		}
	}
	h = v.size();

	for (int j = w - 1; j >= 0; j--) {
		bool f = true;
		for (int i = 0; i < h; i++) {
			if (v[i][j] == '#') {
				f = false;
				break;
			}
		}
		if (f) {
			for (int i = 0; i < h; i++) {
				v[i].erase(v[i].begin() + j);
			}
		}
	}
	w = v[0].size();

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << v[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    now = a[0]
    for i in range(1, n):
        if now > a[i]:
            ans += now - a[i]
        now = max(a[i], now)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 32384
N, L = [int(i) for i in input().split()]

min_ = L
max_ = L + N -1

def eat_apple():
    if max_<0:
        return max_ 
    if L < 0:
        return 0
    return L

print((min_+max_)*(max_-min_+1)//2 - eat_apple())

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

int main() {
    int N;

    cin >> N;
    int mod = N % 10;
    if (mod == 2 || mod == 4 || mod == 5 || mod == 7 || mod == 9) {
        cout << "hon" << endl;
    } else if (mod == 0 || mod == 1 || mod == 6 || mod == 8) {
        cout << "pon" << endl;
    } else {
        cout << "bon" << endl;
    }
}


Measured memory_bytes: 3600
#define _USE_MATH_DEFINES

#include <bits/stdc++.h> 
  
using namespace std;
  
#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second    
// #define int long long
#define double long double       
#define vec vector            
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double> 
#define beg begin
  
#ifdef LOCAL
    #define dbg(x) cerr << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
    cout.setf(ios::fixed); cout.precision(9);    
    solve();   
    return 0;
} 

void solve() {
    int h, n;
    cin >> h >> n;
    vec<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    int sum = accumulate(all(a), 0ll);
    if (sum >= h) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 640
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int sol(int h,int m,int s){
    int ret;
    
    ret=s+m*60+h*60*60;
    return ret;
}



int main() {
    rep(abc,3){
        int a,b,c,d,e,f;
        cin>>a>>b>>c>>d>>e>>f;
        int ans=sol(d,e,f)-sol(a,b,c);
        
        cout<<(int)(ans/3600)<<" ";
        ans-=(int)(ans/3600)*3600;
        cout<<(int)(ans/60)<<" ";
        ans-=(int)(ans/60)*60;
        cout<<ans<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[100100],b[100100],c[100100],n;
ll dp[100100][4];
ll dp1(int i ,int last)
{
    if(i==n)
        return 0;
    if(dp[i][last]!=-1)
        return dp[i][last];
    ll x1=-1,x2=-1,x3=-1;
    if(last!=0)
    {
        x1=a[i]+dp1(i+1,0);
    }
    if(last!=1)
    {
        x2=b[i]+dp1(i+1,1);
    }
    if(last!=2)
    {
        x3=c[i]+dp1(i+1,2);
    }
    return dp[i][last]=max(max(x1,x2),x3);
}
int main()
{
    ios_base::sync_with_stdio(0);
    memset(dp,-1,sizeof(dp));
    cin>>n;
    for(int i = 0 ; i<n ;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    cout<<dp1(0,3);
    return 0;
}


Measured memory_bytes: 10752
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef pair<int,int> PA;
int main(){
  int v,e,s,t,w;
  vector<PA> vec[100001];
  scanf("%d %d",&v,&e);
  for(int i=0;i<e;i++){
    scanf("%d %d %d",&s,&t,&w);
    vec[s].push_back(PA(w,t));
    vec[t].push_back(PA(w,s));
  }
  priority_queue<PA,vector<PA>,greater<PA> > pq;
  pq.push(PA(0,0));
  bool g[100001]={false};
  int cnt = 0;
  while(!pq.empty()){
    PA pt = pq.top();
    pq.pop();
    if(g[pt.second]) continue;
    g[pt.second] = true;
    cnt += pt.first;
    for(int i=0;i<vec[pt.second].size();i++){
      pq.push(vec[pt.second][i]);
    }
  }
  printf("%d\n",cnt);
  return(0);
}



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

struct inp{
    int time;
    string name;
};
int vol = 1000000;
class queue{
private:
    int head, tail;
    inp input[1000000];
public:
    queue(){
        head = 0;
        tail =0;
    }
    void enqueue(inp a){
        input[tail] = a;
        tail++;
        if (tail == vol) tail = 0;
    }
    inp dequeue(){
        head++;
        if (head == vol){
            head = 0;
            return input[vol-1];
        }
        return input[head-1];
    }
    bool isempty(){
        return head == tail;
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    queue work;
    for (int i = 0; i < n; i++){
        string n;
        int a;
        cin >> n >> a;
        inp input = {a, n};
        work.enqueue(input);
    }
	int time = 0;
	while(!work.isempty()){
		inp a = work.dequeue();
		if (a.time <= q){
			time += a.time;
			cout << a.name << " " << time << endl;
			continue;
		}
		time += q;
		a.time -= q;
		work.enqueue(a);
	}
}


Measured memory_bytes: 21124
N, A, B, C, D = map(int, input().split())
S = input()

if S[A-1:max(C,D)].count('##') > 0:
    print('No')
else:
    if C < D:
        print('Yes')
    else:
        if S[B-2:D+1].count('...') > 0:
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 40560
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define all(c) (c).begin(), (c).end()
#define endl '\n'
// auto start = high_resolution_clock::now(); 
// auto stop = high_resolution_clock::now(); 
// auto duration = duration_cast<microseconds>(stop - start); 
 
// cout << duration.count() << endl; 


int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
//      int t;
//      cin >> t; 
//      while(t--){
     	
// }

    int n;
    cin >> n;
    string s;
    cin >> s;

int r = 0;
int b = 0,g = 0;

fo(i,0,n){
	if(s[i] == 'R')r++;
	else if(s[i] == 'B')b++;
	else g++;
}

int res = r*b*g;
int neg = 0;
fo(i,0,n){
	fo(j,i+1,n){
		int k = j + j- i;
			if(k < n){
				if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k])neg++;
			}
			}

			}
cout << res-neg << endl;


return 0;
}


Measured memory_bytes: 3652
def resolve():
    h, w = map(int, input().split())
    s = [input() for _ in range(h)]
    hs = [[0]*w for _ in range(h)]
    ws = [[0]*w for _ in range(h)]

    for i in range(h):
        cums = 0
        for j in range(w):
            if s[i][j] == "#":
                cums = 0
                ws[i][j] = 0
            else:
                cums += 1
                ws[i][j] = cums
        for j in reversed(range(w-1)):
            if ws[i][j+1] != 0 and ws[i][j] != 0:
                ws[i][j] = ws[i][j+1]

    for i in range(w):
        cums = 0
        for j in range(h):
            if s[j][i] == "#":
                cums = 0
                hs[j][i] = 0
            else:
                cums += 1
                hs[j][i] = cums
        for j in reversed(range(h-1)):
            if hs[j+1][i] != 0 and hs[j][i] != 0:
                hs[j][i] = hs[j+1][i]

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, ws[i][j] + hs[i][j])
    print(ans-1)
resolve()

Measured memory_bytes: 123096
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
typedef pair<char, long long> P;
const double pi = 3.141592653589793238;
int main() {
	double A, B, H, M;
	cin >> A >> B >> H >> M;
	double H_k = 30 * H + M * 0.5, M_k = M * 6;
	double kaku = max(H_k, M_k) - min(H_k, M_k);
	if (kaku > 180) kaku = 360 - kaku;
	kaku *= (pi / 180);
	double ans = sqrt(A * A + B * B - 2 * A * B * cos(kaku));
	printf("%.12lf\n", ans);
}

Measured memory_bytes: 4156
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
#define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        1e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}




void solve()
{
  int n;
  cin >> n;

  int a[n+1];
  
  map<int,int>mp;

  forf(i,1,n+1) 
  {
    cin >> a[i];
    mp[a[i]]++;
  }

  int an = 0;

  for(auto x:mp)
  if(x.se>1)
  {
    an += (x.se*(x.se-1))/2;
  }
  

  for(int i=1;i<=n;i++)
  {
    if(mp[a[i]] <= 1)
    {
        cout<<an<<endl;
    }else
    {
        cout<<an - mp[a[i]]+1<<endl;
    }
  }
  

}


int32_t main()
{
  pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

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

int func(vector<int> &arr, int k) {
    int res = 0;
    for (auto el: arr) {
        int c = abs(el - k);
        res += c * c;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    int n, s = 0;
    cin >> n;
    vector<int> arr(n);
    for (auto &el: arr) cin >> el, s += el;

    int x = (int) ceil(s / (double) n);
    int y = (int) floor(s / (double) n);

    cout << min(func(arr, x), func(arr, y)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int f(int x){
	return x*x;
}

int main(){
	int d;
	int s;

	while(cin >> d){
		s = 0;
		for(int i = 0; i < 600/d; i++){
			s+=d*f(d*i);
		}
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 1156
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

using namespace std;

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

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

ll a[200010];
ll cnt[1000010];
ll x[1000010];

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	ll n,ans=0;
	cin>>n;for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)cnt[a[i]]++;
	for(int i=1;i<=1000000;i++)for(int j=i;j<=1000000;j+=i){x[j]+=cnt[i];}
	for(int i=0;i<n;i++)if(x[a[i]]==1)ans++;cout<<ans;
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    int q; cin >> q;
    while (q--) {
        int b, e; cin >> b >> e;
        reverse(a.begin() + b, a.begin() + e);
    }
    int i = 0; for (auto ai: a) cout << (i++ ? " " : "") << ai;
    cout << endl;
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n; cin >> n;
	vector<int> as(n);
	for (auto& a : as) {
		cin >> a;
	}

	int ans = 0;
	int c = 0;
	FOR_LT(i, 0, n - 1) {
		if (as[i] >= as[i + 1]) {
			c++;
			ans = max(ans, c);
		}
		else {
			c = 0;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
pub struct Poper<'a> {
	iter: std::str::SplitWhitespace<'a>,
}

impl<'a> Poper<'a> {
	pub fn new(iter: std::str::SplitWhitespace) -> Poper {
		Poper { iter: iter }
	}
	pub fn read<T: std::str::FromStr>(&mut self) -> T
	where
		<T as std::str::FromStr>::Err: std::fmt::Debug,
	{
		self.iter.next().unwrap().parse().unwrap()
	}
}

// const MOD: u64 = 1_000_000_007;

fn main() {
	let input = {
		use std::io::Read;
		let mut s = String::new();
		std::io::stdin().read_to_string(&mut s).unwrap();
		s
	};
	let mut iter = Poper::new(input.split_whitespace());

	let n: usize = iter.read();

	let words: Vec<String> = (0..n)
		.into_iter()
		.map(|_| {
			let w: String = iter.read();
			let mut t = w.chars().map(|c| c.to_string()).collect::<Vec<String>>();
			t.sort();
			t.join("")
		})
		.collect();

	use std::collections::HashMap;

	let mut map: HashMap<String, u64> = HashMap::new();

	for w in words {
		let b = map.entry(w).or_insert(0);
		*b += 1;
	}

	let mut s = 0;
	for (_, n) in map {
		s += p(n);
	}
	println!("{}", s);
}

fn p(n: u64) -> u64 {
	if n < 2 {
		0
	} else {
		n * (n - 1) / 2
	}
}


Measured memory_bytes: 23612
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>*/
 
#define pb push_back
#define mp make_pair
#define sz(s) ((int)(s.size()))
#define all(s) s.begin(), s.end()
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define per(i, n, a) for (int i = n; i >= a; --i)
#define onlycin ios_base::sync_with_stdio(false); cin.tie(0) 
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
/*typedef tree<
pair < int, int >,
null_type,
less< pair < int, int > >,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
// find_by_order() order_of_key()
const int MAXN = (int)5e5+228;
const char nxtl = '\n';
const int mod = (int)1e9+7;
const double eps = (double)1e-7;
template<typename T> inline bool updmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<typename T> inline bool updmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

string s;
int n;
int cnt[30];

int main() {
	#ifdef accepted
		freopen(".in", "r", stdin);
		freopen(".out", "w", stdout);
	#endif
	onlycin;
	cin >> s; n = sz(s);
	/*set < string >  S;
	S.insert(s);
	rep(i, 0, n - 1) {
		rep(j, i, n - 1) {
			string cur = s;
			reverse(cur.begin() + i, cur.begin() + j + 1);
			if(S.count(cur)) {
				cout << i << ' '<< j << nxtl;
			}
			S.insert(cur);
		}
	}
	string cur = s;
	reverse(all(cur));
	cerr << sz(S) << nxtl;
	
	vector<vector<int>> p(2,vector<int>(n,0));
  for(int z=0,l=0,r=0;z<2;z++,l=0,r=0) {
        for(int i=0;i<n;i++)
        {
            if(i<r) p[z][i]=min(r-i+!z,p[z][l+r-i+!z]);
            while(i-p[z][i]-1>=0 && i+p[z][i]+1-!z<n && s[i-p[z][i]-1]==s[i+p[z][i]+1-!z]) p[z][i]++;
            if(i+p[z][i]-!z>r) l=i-p[z][i],r=i+p[z][i]-!z;
        }
    }*/
  ll res = n * (n + 1ll) / 2ll + 1ll;
  /* rep(i, 0, n - 1) {
		res -= p[0][i];
		res -= p[1][i] + 1;
  }
	if(res == 1) cout << res, exit(0);
	int l = 0;
	while(s[l] == s[n - l - 1]) l++;
  res -= l;
  cout << res << nxtl;*/

  memset(cnt, 0, sizeof cnt);
  rep(i, 0, n - 1) {
	  cnt[s[i] - 'a']++;
		res -= cnt[s[i] - 'a'];
  }
  cout << res << nxtl;

	return 0;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    map<ll,ll>mp;
    ll n;
    cin>>n;
    mp[n]++;
    ll c=1;
    while(1)
    {
        if(n%2==0)
        {
            n=n/2;
            c++;
            if(mp[n]==0)
            {
                mp[n]++;
            }
            else
            {
                break;
            }
        }
        else
        {
            n=3*n+1;c++;
            if(mp[n]==0)
            {
                mp[n]++;
            }
            else
            {
                break;
            }
        }
    }
    cout<<c<<endl;
return 0;
}


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

int main() {
	string s;
	cin >> s;
	int res = 1000;
	for (int i = 0; i < s.length(); i++) {
		int num = -1;
		vector<int> pos;
		for (int j = 0; j < s.length(); j++) {
			if (s[j] == s[i]) {
				pos.push_back(j);
			}
		}
		num = max(num, pos[0]);
		for (int j = 1; j < pos.size(); j++) {
			num = max(num, pos[j] - pos[j - 1] - 1);
		}
		num = max(num, int(s.length() - 1 - pos[pos.size() - 1]));
		res = min(res, num);
	}
	cout << res << endl;
	return 0;
}

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

using namespace std;

int main(){

	double a,b;
	cin>>a>>b;
	int d,r;
	double f;
	d=a/b;
	r=a-d*b;
	f=a/b;
	//cout<<d<<" "<<r<<" "<<f<<endl;
	printf("%d %d %7.5f",d,r,f);


	return 0;
}

Measured memory_bytes: 1236
package main

import (
	"fmt"
)

//var sc = bufio.NewScanner(os.Stdin)

//func nextInt() int {
//	sc.Scan()
//	i, e := strconv.Atoi(sc.Text())
//	if e != nil {
//		panic(e)
//	}
//	return i
//}
//
//func nextString() string {
//	sc.Scan()
//	return sc.Text()
//}

func main() {
	//sc.Split(bufio.ScanWords)
	//n := nextInt()
	//s := nextString()
	var n int
	fmt.Scanf("%d", &n)
	var s string
	fmt.Scanf("%s", &s)

	wcount := make([]int, n)
	ecount := make([]int, n)

	for i := 0; i < n; i++ {
		if s[i] == 'W' {
			if i == 0 {
				wcount[i] = 1
			} else {
				wcount[i] = wcount[i-1] + 1
			}
		} else {
			if i > 0 {
				wcount[i] = wcount[i-1]
			}
		}
		if s[len(s)-i-1] == 'E' {
			if i == 0 {
				ecount[len(s)-i-1] = 1
			} else {
				ecount[len(s)-i-1] = ecount[len(s)-i] + 1
			}
		} else {
			if i > 0 {
				ecount[len(s)-i-1] = ecount[len(s)-i]
			}
		}
	}

	//fmt.Println("wcount", wcount)
	//fmt.Println("ecount", ecount)

	ans := n + 1
	for i := 0; i < n; i++ {
		var res int
		if s[i] == 'W' {
			res = (wcount[i] - 1) + ecount[i]
		} else {
			res = wcount[i] + (ecount[i] - 1)
		}
		if res < ans {
			//fmt.Println(i, ecount, wcount)
			ans = res
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 8576