akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
//typedef unsigned long long int ull;
typedef long double ld;
 
#define endl '\n'
#define loop(i, m, n) for (ll i = m; i < n; i++)
#define loope(i, m, n) for (ll i = m; i <= n; i++)
#define epool(i, m, n) for (ll i = m; i >= n; i--)
#define mod 1000000007
#define mod2 998244353
#define vi vector<ll>
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x, 0;
#define all(v) v.begin(),v.end()

#define naman                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;

ll mpow(ll base, ll exp){
    base %= mod;
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

const ll INF=1e18;
const double PI=4*atan(1);

void solve(){
    ll n;
    cin >> n;
    ll ans=0;
    loope(i,2,sqrt(n)){
        ll cur=0;
        while(n%i==0){

            cur++;
            n=n/i;
        }
        //if(cur>=1)
        //cout << i << " " << cur << endl;
        ans+=(sqrt(1+8*cur)-1)/2;
        //cout << ans << endl;
    }

    if(n>1) ans++;

    cout << ans << endl;
}

int32_t main(){
    naman
    ll i = 0,j = 0;
      
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
      
    //cout << fixed << setprecision(10);

    ll t;
    t=1;
    //cin >> t;
    ll cno=0;
    while (t--){
        solve();

    }

}

Measured memory_bytes: 3696
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N = 1000;

int lcs(string X, string Y)
{
    int c[N+1][N+1];
    int m = X.size();
    int n = Y.size();
    int maxl = 0;
    X = ' ' + X;
    Y = ' ' + Y;
    for (int i = 0; i <= m; i++) c[i][0] = 0;
    for (int j = 0; j <= n; j++) c[0][j] = 0;

    for (int i = 1; i <= m; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if (X[i] == Y[j])
            {
                c[i][j] = c[i - 1][j - 1] + 1;
            }
            else
            {
                c[i][j] = max(c[i - 1][j], c[i][j - 1]);
            }
            maxl = max(maxl, c[i][j]);
        }
    }

    return maxl;
}

int main()
{
    string s1, s2;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << endl;
    }
    return 0;
}


Measured memory_bytes: 6988
import collections

def main():
    S = []
    T = []
    n = int(input())
    for _ in range(n):
        S.append(input())
    m = int(input())
    for _ in range(m):
        T.append(input())

    cs = collections.Counter(S)
    ct = collections.Counter(T)
    ans = 0
    for s in cs:
        ans = max(ans,cs[s]-ct[s])
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
using namespace std;

typedef complex<double> P;
const double PI = 3.14159265;
const double eps = 1e-7;

inline double dist(const P &p,const P &q) {
    double dx = (p-q).real(),dy = (p-q).imag();
    return sqrt(dx*dx+dy*dy);
}

// rotate to right , radian
P rotate(const P &p,double degree) {
    return P(p.real()*cos(degree)+p.imag()*(-sin(degree)),
             p.real()*sin(degree)+p.imag()*cos(degree));
}

struct Circle {
    double r;
    P c;
    Circle(P c,double r) : c(c), r(r) {;}
};

// p in C?
inline bool inC(const Circle &c,const P &p) {
    return dist(c.c,p) < c.r + eps;
}

// p1,p2©ç£dÌ2ÂÌ_ðÔ·
// dist(p1-p2) > 2*dÌÆ«nanªÔéÌÉÓ
// aoj 1132
pair<P,P> findCenter(P &p1,P &p2,double d) {
    P cp = (p1+p2); cp /= 2;
    P od = rotate(p2-cp,PI/2);

    double abod = abs(p2-cp);//,abcp = norm(cp-p1);
    double len = sqrt(d-norm(cp-p1));

    P rep1 = cp + (od/abod)*len;
    P rep2 = cp - (od/abod)*len;
    return make_pair(rep1,rep2);
}

int main() {
    int n;
    while(cin>>n, n) {
        vector<P> pv;
        double x,y;
        for(int i=0; i<n; ++i) {
            cin>>x>>y;
            pv.push_back(P(x,y));
        }

        int ans = 1;
        for(int i=0; i<n; ++i) {
            for(int j=i+1; j<n; ++j) {
                if(dist(pv[i],pv[j]) > 2.0) continue;
                pair<P,P> p = findCenter(pv[i],pv[j],1.0);
                int t1 = 0,t2 = 0;
                Circle c1(p.first,1.0);
                Circle c2(p.second,1.0);
                for(int k=0; k<n; ++k) {
                    if(inC(c1,pv[k])) t1++;
                    if(inC(c2,pv[k])) t2++;
                }
                ans = max(ans, max(t1,t2));
            }
        }

        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1000
#include <algorithm>//min/max/sort(rand-access it)/merge
#include <bitset>
#include <climits>//INT_MAX/INT_MIN/ULLONG_MAX
#include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc
#include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort
#include <iomanip>//setfill/setw
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific
#include <iterator>
#include <list>
#include <queue>
#include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline
#include <tuple>
#include <utility>//pair
#include <valarray>
#include <vector>

#define PRIME 1000000007

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<ull, int> puli;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pllll;
typedef pair<ull, ull> pulul;
typedef pair<double, double> pdd;
typedef tuple<int, int, int> ti3;
typedef tuple<int, int, int, int> ti4;

const bool debug = false;

int main(void) {
	int vert = 0;
	int hori = 0;
	string str;
	cin >> str;
	for (size_t i = 0; i < str.size(); ++i)
	{
		char s = str[i];
		switch (s) {
			case 'N':{
				switch (vert) {
					case -1: vert = 2; break;
					case 0: vert = 1; break;
					default: break;
				}
				break;
			}
			case 'S':{
				switch (vert) {
					case 1: vert = 2; break;
					case 0: vert = -1; break;
					default: break;
				}
				break;
			}
			case 'E':{
				switch (hori) {
					case -1: hori = 2; break;
					case 0: hori = 1; break;
					default: break;
				}
				break;
			}
			case 'W':{
				switch (hori) {
					case 1: hori = 2; break;
					case 0: hori = -1; break;
					default: break;
				}
				break;
			}
		}
		if (debug)
		{
			cout << s << "/";
		}
	}
	cout << ((vert%2 == 0 && hori%2 == 0) ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
func gcd(_ a: Int, _ b: Int) -> Int {
    guard b != 0 else { return a }
    return gcd(b, a % b)
}

func gcda(_ s: [Int]) -> Int {
    guard !s.isEmpty else { return 0 }
    guard s.count > 1 else { return s.first! }

    var tmpS = s
    let first = tmpS.removeFirst()
    return tmpS.reduce(first) { gcd($0, $1) }
}

func memoize(_ f: @escaping ([Int]) -> Int) -> ([Int]) -> Int {
    var dic = [[Int] : Int]()
    return { nums in
        if let value = dic[nums.sorted()] {
            return value
        } else {
            let result = f(nums)
            dic[nums] = result
            return result
        }
    }
}

let m_gcda = memoize(gcda)

let k = Int(readLine()!)!

var results = [Int]()
for a in 1...k {
    for b in 1...k {
        for c in 1...k {
            results.append(gcda([a, b, c]))
        }
    }
}

let sum = results.reduce(into: 0) { $0 += $1 }
print(sum)


Measured memory_bytes: 74680
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  long long int n;
  cin>>n;
  long long int a[n],i;
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  if(n%2==1){
    cout<<0<<endl;
    return 0;
  }
  sort(a,a+n);
  cout<<a[n/2]-a[n/2-1]<<endl;
return 0;
}

Measured memory_bytes: 1024
import sys

readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(" ")]

total = 0
ret = 1
n = readInt()
aa = []
for i in range(n):
    v = readInt()
    aa.append(v)
    total += v
    ret *= 3


L = (n * max(aa) + 1)
memo = [-1] * ((n+1) * L * 2)
def dfs(i, c):
    key = (i * L * 2) + 2 * c
    if 0 <= memo[key]:
        return memo[key: key+2]

    if i == n:
        memo[key + 0] = 3 if total <= (2 * c) else 0
        memo[key + 1] = 3 if total == (2 * c) else 0
        return memo[key: key + 2]

    v0 = dfs(i + 1, c)
    v1 = dfs(i + 1, c + aa[i])

    memo[key + 0] = (2 * v0[0] + v1[0]) % 998244353
    memo[key + 1] = (v0[1] + v1[1]) % 998244353
    return memo[key: key + 2]

a, b = dfs(0, 0)
ret = (ret - a + b) % 998244353
print(ret)

Measured memory_bytes: 508552
import sys
input = sys.stdin.readline
N,K = map(int,input().split())
V = list(map(int,input().split()))
D = []
ans = 0
for i in range(K+1):
    for j in range(K-i+1):
        if i + j > N:
            break
        D.append(V[:i]+V[N-j:])
for d in D:
    for x in range(K-len(d)):
        if d==[]:
            break
        elif min(d)<0:
            d.pop(d.index(min(d)))

        elif min(d)>0:
            break        
    if d!=[]:
        s = sum(d)
        if s>0 and s>ans:
            ans = s
print(ans)

Measured memory_bytes: 3444
#include <stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);

	
	if(a==b&&b==c){
	printf("Yes");
	
	}else {
		printf("No");
	}
	
	
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 128
N = int(input())
a = map(int, input().split())

def color(r):
    return min(r // 400, 8)

c = list(map(color, a))
cs = set(c)
cc = len(cs)
ac = c.count(8)
if ac == 0:
    print(cc, cc)
else:
    cc -= 1
    print(max(1,cc), cc+ac)

Measured memory_bytes: 38256
#include<stdio.h>
#define N 25

typedef struct node{
	int L_id;
	int R_id;
	int P_id;
}node;

node a[N];

void preorder(int root){
	
	printf(" %d",root);
	
	if(a[root].L_id!=-1)
		preorder(a[root].L_id);
	
	if(a[root].R_id!=-1)
		preorder(a[root].R_id);

	return;
	
}

void inorder(int root){
	
	if(a[root].L_id!=-1)
		inorder(a[root].L_id);
	
	printf(" %d",root);
	
	if(a[root].R_id!=-1)
		inorder(a[root].R_id);

	return;
	
}

void postorder(int root){
	
	if(a[root].L_id!=-1)
		postorder(a[root].L_id);
	
	if(a[root].R_id!=-1)
		postorder(a[root].R_id);
		
	printf(" %d",root);

	return;
	
}

void print(int root){

	printf("Preorder\n");
	preorder(root);
	printf("\n");
	
	printf("Inorder\n");
	inorder(root);
	printf("\n");
	
	printf("Postorder\n");
	postorder(root);
	printf("\n");
	
	return;
	
}


int main(){
	int n,x,i;
	int root;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++)
		a[i].P_id=-1;
	
	for(i=0;i<n;i++){
		scanf("%d",&x);
		scanf("%d %d",&a[x].L_id,&a[x].R_id);
		if(a[x].L_id!=-1)
			a[a[x].L_id].P_id=x;
		if(a[x].R_id!=-1)
			a[a[x].R_id].P_id=x;
	}
	
	for(i=0;i<n;i++){
		if(a[i].P_id==-1){
			root=i;
			break;
		}
	}
	
	print(root);
	
	return 0;
	
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
const ll inf = 1LL<<60;

struct Doubling {
  const ll LOG = 60;
  vector<vector<ll>> table;

  Doubling(ll n) {
    table.assign(LOG, vector<ll>(n, -1));
  }
  void set_next(ll k, ll x) {
    table[0][k] = x;
  }
  void build() {
    for (int k=0; k+1<LOG; k++) {
      for (int i=0; i<(int)table[k].size(); i++) {
        if (table[k][i] == -1) table[k+1][i] = -1;
        else table[k+1][i] = table[k][table[k][i]];
      }
    }
  }
  ll query(ll k, ll t) {
    for (int i=LOG-1; i>=0; i--) {
      if ((t>>i)&1) k = table[i][k];
    }
    return k;
  }
};

int main()
{
  ll n,k; cin>>n>>k;
  Doubling to = Doubling(n);
  rep(i, n) {
    ll a; cin>>a; a--;
    to.set_next(i, a);
  }
  to.build();
  cout << to.query(0, k)+1 << endl;

  return 0;
}


Measured memory_bytes: 98536
#include<bits/stdc++.h>
using namespace std;
#define INF (1<<28)
#define MAX 100000
int n;
int t[MAX],l[MAX],r[MAX];

int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&t[i]);
    l[i]=r[i]=i;
  }
  int d=-1;
  for(int i=0;i<n;i++){
    if(t[i]==0){
      d=INF;
    }else if(t[i]<0){
      d=min(d-1,-t[i]);
    }else if(t[i]>0){
      d--;
      l[i]=d;
    }
  }
  d=-1;
  for(int i=n-1;i>=0;i--){
    if(t[i]==0){
      d=INF;
    }else if(t[i]<0){
      d=min(d-1,-t[i]);
    }else if(t[i]>0){
      d--;
      r[i]=d;
    }
  }
  
  int ans=0,c;
  for(int i=0;i<n;i++){
    c=max(0,max(l[i],r[i]));
    if(t[i]>0)ans+=min(t[i],c);
  }
  cout<<ans<<endl;
  
  return 0;
}

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

using namespace std;

int a;
int b;
int c;
int k;

int main() {
	cin >> a >> b >> c >> k;
	if(a > b) swap(a, b);
	if(b > c) swap(b, c);
	cout << a + b + c * (1 << k);
	return 0;
}

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> grid(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> grid.at(i).at(j);
    }
  }
  
  vector<int> yoko,tate;
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (grid.at(i).at(j) == '#') {
        break;
      }
      if (j == W - 1) {
        yoko.push_back(i);
      }
    }
  }
  
  for (int j = 0; j < W; j++) {
    for (int i = 0; i < H; i++) {
      if (grid.at(i).at(j) == '#') {
        break;
      }
      if (i == H - 1) {
        tate.push_back(j);
      }
    }
  }
  
  for (int i = 0; i < H; i++) {
    if (count(yoko.begin(),yoko.end(),i)) {
      continue;
    }
    for (int j = 0; j < W; j++) {
      if (count(tate.begin(),tate.end(),j)) {
        continue;
      }
      cout << grid.at(i).at(j);
    }
    cout << endl;
  }
}

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

const ll MOD=1e9+7;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    int n; cin>>n;
    vector<int> a(100005,0);
    for(int i=0; i<n; i++){
        int x; cin>>x;
        a[x]++;
    }
    ll ans=0;
    bool ok=true;
    if(n%2==0){
        for(int i=0; i<a.size(); i++){
            if(i%2==1 and a[i]!=2  and a[i]!=0){
                ok=false;
            }
        }
        if(ok==true){
            cout<<modpow(2LL,n/2,MOD)<<endl;
            return 0;
        }else{
            cout<<0<<endl;
            return 0;
        }
    }else{

        if(a[0]!=1) ok=false;
        for(int i=1; i<a.size(); i++){
            if(i%2==0 and a[i]!=2 and a[i]!=0){
                ok=false;
            }
        }
        if(ok==true){
            cout<<modpow(2LL,(n-1)/2,MOD)<<endl;
            return 0;
        }else{
            cout<<0<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 640
var n,m,i,j,k,sum,now,a,b,c,d : longint ;
    cc,yo : array [0..1000001] of longint ;
    so,s1,s2 : ansistring ;
begin
 readln(a,b,c,d);
 if a+b>c+d then
  writeln('Left')
 else  if a+b<c+d then
  writeln('Right')
 else
  writeln('Balanced'); 
end.


Measured memory_bytes: 128
/**
 *    author:  tourist
 *    created: 23.03.2019 14:18:06       
**/
#include <bits/stdc++.h>

using namespace std;

class dsu {
 public:
  vector<int> p;
  int n;

  dsu(int _n) : n(_n) {
    p.resize(n);
    iota(p.begin(), p.end(), 0);
  }

  inline int get(int x) {
    return (x == p[x] ? x : (p[x] = get(p[x])));
  }

  inline bool unite(int x, int y) {
    x = get(x);
    y = get(y);
    if (x != y) {
      p[x] = y;
      return true;
    }
    return false;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  vector<int> deg(n);
  for (int i = 0; i < n; i++) {
    deg[i] = (int) g[i].size();
  }
  for (int i = 0; i < n; i++) {
    if (deg[i] % 2 != 0) {
      cout << "No" << '\n';
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    if (deg[i] >= 6) {
      cout << "Yes" << '\n';
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    if (deg[i] >= 4) {
      dsu d(n);
      for (int j = 0; j < n; j++) {
        if (i != j) {
          for (int k : g[j]) {
            if (i != k && j < k) {
              if (!d.unite(j, k)) {
                cout << "Yes" << '\n';
                return 0;
              }
            }
          }
        }
      }
    }
  }
  cout << "No" << '\n';
  return 0;
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    int ans = 0;
    int a[n + 1], b[n + 1], 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 - 1; i++)
        cin >> c[i];

    ans += b[a[0] - 1];

    for (int i = 1; i < n; i++){
        if (a[i] - a[i - 1] == 1){
            ans = ans + b[a[i] - 1] + c[a[i] - 2];
        } else {
            ans += b[a[i] - 1];
        }
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define PII pair<int,int>
#define s second
#define f first
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
ll MOD = 1e9+7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x)%MOD;
        }
        p = p >> 1;
        x = (x*x)%MOD;
    }
    return res;
}
int n;
struct box{
    ll w, s, v;
    bool operator < (const box &other) const{
        if(s+w != other.s+other.w){
            return  s+w > other.s+other.w;
        }
        return v < other.v;
    }
};
vector<box> arr;
ll dp[1005][10005];
ll solve(ll index, ll left){
    if(left < 0){
        return -LLONG_MAX/100;
    }
    if(index == n){
        return 0;
    }
    if(left != LLONG_MAX && dp[index][left] != -1){
        return dp[index][left];
    }
    return dp[index][left] = max(solve(index+1, left), arr[index].v+solve(index+1, min(left-arr[index].w, arr[index].s)) );
}
int main() {
    IO;
    memset(dp, -1, sizeof dp);
    cin >> n;
    arr.resize(n);
    for(int i = 0; i < n; i++){
        cin >> arr[i].w >> arr[i].s >> arr[i].v;
    }
    sort(arr.begin(), arr.end());
    cout << solve(0, LLONG_MAX);


    return 0;
}


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

int main() {
    ll a, b;
    ll n, sum;
    cin >> n >> a >> b;
    sum = a+b;
    ll ans = 0;
    ans = (n/sum)*a;
    ans += min(a,n%sum);

    cout << ans << 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()
{
  char s[3] ;
  char t[3] ;
  
  rep(i, 3){
    cin >> s[i] ;
  }
  rep(j, 3){
    cin >> t[j] ;
  }
  
  if(s[0]==t[2] && s[1]==t[1] && s[2]==t[0]){
    cout <<"YES"<<endl ;
  }
  else{
    cout <<"NO"<<endl ;
  }
    return 0 ;
}

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

int main() {
    long long n; cin >> n;
    
    long long max_a = -1000000, min_a = 1000000, sum_a = 0;
    for (int i = 0; i < n; ++i) {
        long long a; cin >> a;
        max_a = max(max_a, a);
        min_a = min(min_a, a);
        sum_a += a;
    }
    printf("%lld %lld %lld\n", min_a, max_a, sum_a);
    
    return 0;
}


Measured memory_bytes: 3212
import sys
a,b=map(int, input().split())

if a-b > a+b:
    if a-b > a*b:
        print(a-b)
    else:
        print(a*b)
elif a*b > a+b:
    if a*b > a-b:
        print(a*b)
    else:
        print(a-b)
else:
    print(a+b)
    

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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a,int64_t b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int64_t a,int64_t b){return a/gcd(a, b)*b;}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int64_t a){if(a<=1)return false;for(int64_t i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}
int get_adp(double x, int n){return (int)round((x-(int)x)*pow(10,n))%10;} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n){return n*(2*s+n-1)/2;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//	for(auto x : v) cout << x << " "; cout << "\n";     // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

//bit全探索
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
// }


int main()
{
	int n, v_max, index = 1, temp, ans = 0;

	cin >> n;
	vector<int> l(n);
	for (int i = 0; i < n; i++)
		cin >> l[i];
	sort(l.begin(), l.end());
	v_max = l[n - 1];
	vector<int> v(v_max + 1);
	for (int i = 0; i < n; i++)
	{
		while (index <= l[i])
			v[index++] = i + 1;
	}
	while (index <= v_max)
		v[index++] += n;
	// for (int i = 0; i <= v_max; i++)
	// 	cout << v[i] << " ";
	// cout << endl;
	for (int i = 0; i < n - 2; i++)
	{
		for (int j = i + 1; j < n - 1; j++)
		{
			temp = l[i] + l[j];
			if (temp <= v_max && v[temp] - j - 2 >= 0)
				ans += v[temp] - j - 2;
			else
				ans += n - j - 1;
			// cout << v[temp - 1] - j - 1<< " " ;
		}
		// cout << endl;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3680
#include <iostream>
#include <string>

int main(int argc, char *argv[])
{
    std::string s;
    int ans;

    std::cin >> s;

    if (s == "SAT") {ans = 1;}
    if (s == "FRI") {ans = 2;}
    if (s == "THU") {ans = 3;}
    if (s == "WED") {ans = 4;}
    if (s == "TUE") {ans = 5;}
    if (s == "MON") {ans = 6;}
    if (s == "SUN") {ans = 7;}

    std::cout << ans << std::endl;

    return 0;
}


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

using namespace std;

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

    long n;
    cin >> n;
    char s[n];
    // string s;
    // scanf("%s", &s);
    cin >> s;
    long right_e = 0;
    // for (long i = 1; i < n; i++) right_e += (s[i] == 'E');
    for (long i = 1; i < n; i++) if (s[i] == 'E') right_e++;
    long min_count = right_e;
    long left_w = 0;
    for (long i = 1; i < n; i++) {
    // for (long i = 1; i < n; i++) {
        if (!min_count) break;
        // right_e -= s[i] == 'E';
        // left_w += s[i - 1] == 'W';
        if (s[i ] == 'E') right_e--;
        if (s[i -1] == 'W') left_w++;
        min_count = min(min_count, right_e + left_w);
    }
    cout << min_count << '\n';
    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    ll a, amari;
    string bb,c;
    cin >> a >> bb;
    bb.erase((find(all(bb), '.')));
    ll b = stoll(bb);
    ll sum = a * b;
    ll div = 2;
    if (bb[bb.size() - 1] ==0 &&  bb[bb.size() - 2] == 0)div = 0;
    else if (bb[bb.size() - 1] == 0)div = 1;
    c = to_string(sum);
    if (c.size() <= div)cout << 0 << endl;
    else cout << c.substr(0,c.size() - div)<< endl;
    return 0;
}


Measured memory_bytes: 3708
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define MOD 1000000007
using ll = long long;
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    cout << (n - 1)*(m - 1) << endl;
    return 0;
}


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

int main(){
    int x,y; cin >> x >> y;
    int ans = 0;
    vector<int> m{300000, 200000, 100000};
    if(x<=3) ans += m[x-1];
    if(y<=3) ans += m[y-1];
    if(ans==600000) ans += 400000;
    cout << ans << endl;
}

Measured memory_bytes: 3608
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

map<ll,ll> pfmp; //各素因数の冪指数の最大値を格納
vector<ll> pfv(0); //異なる素因数を昇順に格納

void pf(ll N){
  ll n=N;
  if(n<=0) return;
  ll exp;
  if(n%2==0){
    if(pfmp[2]==0) pfv.push_back(2);
    exp=0;
    while(n%2==0){
      n/=2;
      exp++;
    }
    if(exp>pfmp[2]) pfmp[2]=exp;
  }
  if(n==1) return;
  for(ll i=3;i<=sqrt(N);i+=2){
    if(n%i==0){
      if(pfmp[i]==0) pfv.push_back(i);
      exp=0;
      while(n%i==0){
        n/=i;
        exp++;
      }
      if(exp>pfmp[i]) pfmp[i]=exp;
    }
  }
  if(n!=1){
    if(pfmp[n]==0){
      pfv.push_back(n);
      pfmp[n]=1;
    }
  }
  //sort(all(pfv));
}

ll rui(ll a,ll n){
  ll ans=1;
  while(n>0){
    if(n&1) ans=ans*a%mod;
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

ll modinv(ll a,ll m){
  ll b=m,u=1,v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  u%=m;
  if(u<0) u+=m;
  return u;
}

int main(){
  int N; cin >> N;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];
  rep(i,N){
    pf(a[i]);
  }
  ll lcm=1;
  rep(i,pfv.size()){
    lcm*=rui(pfv[i],pfmp[pfv[i]]);
    lcm%=mod;
  }
  ll ans=0;
  rep(i,N){
    ans+=lcm*modinv(a[i],mod);
    ans%=mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
// created by mtnshh
 
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
 
#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl
 
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265
 
const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	string s;
	cin>>s;
	if(s[2]==s[3] and s[4]==s[5])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;		
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
 
  using namespace std;
   

//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  typedef long double lld;
//   typedef string str;
//   typedef unsigned long long ull;
  ll INF = INT_MAX;
  ll mod = 1000000007;
  // lld PI = 3.141592653;

// const int N = 2e5 + 5;

// int a[N];
// int n,k;
  
 

  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     
   int n,m;
   cin>>n>>m;
   vector<int> h(n+1);
   for (int i =1;i<=n;i++) cin>>h[i];
    vector<int> from_me[n+1];
    for (int i = 0;i<m;i++){
      int a,b;
      cin>>a>>b;
      from_me[a].push_back(b);
      from_me[b].push_back(a);
    }
    // cout<<"--\n";
    int ans = 0;
    for (int i = 1;i<=n;i++){
      bool ok = true;
      
      for (int j = 0;j<from_me[i].size();j++){
        if (h[from_me[i][j]]>=h[i]) {ok =false; }
      }
      if (ok) {ans++; }
    }
   cout<<ans<<"\n";
}
  

Measured memory_bytes: 8428
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
     
    int n = sc.nextInt();
    int d = sc.nextInt();
    int m=0;
    int i=0;
    while(i < n){ 
      long a = sc.nextLong();
      long b = sc.nextLong();
      i++;
      if(Math.sqrt(a*a + b*b)<=d) m++;
   
    }
    
    System.out.println(m);
  }
}

Measured memory_bytes: 60344
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int N,M;
	long long K;
	cin>>N>>M>>K;
	
	vector<long long> A(N),B(M);
	for(int i=0;i<N;i++){
		cin>>A[i];
		if(i!=0)A[i] += A[i-1];
	}
	
	for(int i=0;i<M;i++){
		cin>>B[i];
		if(i!=0)B[i] += B[i-1];
	}
	A.insert(A.begin(),0LL);
	B.insert(B.begin(),0LL);
	
	int ans = 0;
	
	for(int i=0;i<=N;i++){
		long long t = K-A[i];
		if(t<0)continue;
		int d = distance(B.begin(),upper_bound(B.begin(),B.end(),t));
		ans = max(ans,i+d-1);
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 8008
#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>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e2 + 10;
int cnt[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	LL k;
	cin >> k;
	for (int i = 0; i < n; i++)
	{
		LL x;
		cin >> x;
		for (int i = 0; (1LL << i) <= x; i++)
		{
			cnt[i] += x >> i & 1;
		}
	}
	LL sum = 0;
	LL ans = 0;
	for (int i = 45; i >= 0; i--)
	{
		if (k >> i & 1)
		{
			LL tot = 0;
			for (int j = i - 1; j >= 0; j--)
			{
				tot += max(cnt[j], n - cnt[j]) * (1LL << j);
			}
			ans = max(ans, tot + sum + cnt[i] * (1LL << i));
		}
		if (k >> i & 1) sum += (n - cnt[i]) * (1LL << i);
		else sum += cnt[i] * (1LL << i);
	}
	ans = max(ans, sum);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
n, m = map(int, input().split())
a = list(map(int, input().split()))

def cumsum(s):
    n = len(s)
    cs = [0] * (n+1)
    for i in range(n):
        cs[i+1] = cs[i] + s[i]
    return cs

def bs_list(a, f):
    l, r = -1, len(a)
    while r - l > 1:
        x = (l + r) // 2
        if f(a[x]): r = x
        else: l = x
    return None if r == len(a) else r

a.sort()
ca = cumsum(a)

def detect(x):
    num = 0
    for b in a[::-1]:
        res = bs_list(a, lambda y: y >= x - b)
        if res is None: break
        num += n - res
    return num <= m

l, r = -1, 10**5*2+10
while r - l > 1:
    x = (l+r) // 2
    if detect(x): r = x
    else: l = x

s, c = 0, 0
for b in a[::-1]:
    res = bs_list(a, lambda x: x >= r - b)
    if res is None: break
    c += (n - res)
    s += b * (n - res) + (ca[n] - ca[res])

print(s + (m - c) * l)


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 22;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ll dp[MAXN][(1ll << MAXN)];
ll c[MAXN][MAXN];

ll get_bit(ll n, ll k){
	return min(1ll, n & (1ll << k));
}

vector<ll> W;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	for(int i = 1; i <= n; i++) for(int j = 0;j<n;j++) cin >> c[i][j];
	
	dp[0][0] = 1;
	
	for(int i = 1;i <= n;i++){
		for(int j = 0; j < (1ll << n); j++){
			if(__builtin_popcount(j) != i) continue;

			for(int k = 0; k < n; k++){
				if(get_bit(j, k) == 1 and c[i][k] == 1){
					dp[i][j] += dp[i - 1][j ^ (1ll << k)];
					dp[i][j] %= MOD;
				}
			}
		}
	}
	
	cout << dp[n][(1ll << n) - 1];
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 323840
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
    int a, b, c, d; cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0) {
            puts("Yes");
            break;
        }
        a -= d;
        if (a <= 0) {
            puts("No");
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
int n, m, x, y;
int ac[100000];
int wa[100000];
char s[10];
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d", &x); x--;
		scanf(" %s", s);
		if (s[0] == 'A') {
			ac[x] = 1;
		}
		if (s[1] == 'A' && ac[x] == 0) {
			wa[x]++;
		}
	}
	x = 0;
	for (int i = 0; i < n; i++) {
		x += ac[i];
		if (ac[i])y += wa[i];
	}
	printf("%d %d\n", x, y);
}

Measured memory_bytes: 896
n = int(input())
ds = [tuple(map(int,input().split())) for i in range(n)]
ans = 0
x = 0
for i in range(n-1):
    #print(x)
    if (ds[i][0] == ds[i][1]) and (ds[i+1][0] == ds[i+1][1]):
        x += 1
    else:
        ans = max(ans,x+1)
        x = 0
print("Yes" if max(ans,x+1) >= 3 else "No")

Measured memory_bytes: 9196
#include<iostream>

using namespace std;
int main(){
    int A,B,i;
    cin>>A>>B;
    for(i=1;1<1000;i++){
        if(i*0.08>=A&&i*0.08<A+1&&i/10==B){
            cout<<i<<endl;
            break;
        }
        if(i*0.08>A+1){
            cout<<-1<<endl;
            break;
        }
    }
}

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


class Program
{
    static void Main()
    {
        List<int> a = new List<int>();
        
        while (true)
        {
            string s = Console.ReadLine();
            if (s == "0") break;
            a.Add(int.Parse(s));
        }
        for (int i = 0; i < a.Count; i ++)
        {
            Console.WriteLine("Case {0}: {1}", i + 1, a[i]);
        }
    }
}


Measured memory_bytes: 15984
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b, c := intScanner(), intScanner(), intScanner()
	if a+b+c >= 22 {
		fmt.Println("bust")
	} else {
		fmt.Println("win")
	}

}


Measured memory_bytes: 1772
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#define BUFSIZE 1000000

char hoge[BUFSIZE] = {0};
long long A,B;
long long V,W,T;

int main(void){
  scanf("%lld %lld",&A ,&V);
  scanf("%d %d",&B ,&W);
  scanf("%d",&T);


  if(V > W && abs(B-A) <= T*(V-W)){
    printf("YES");
  }else{
    printf("NO");
  }

  return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  int h_max = 0;
  int answer = 0;
  for (int i = 0; i < N; i++) {
    int H;
    cin >> H;
    if (H >= h_max) {
      answer++;
      h_max = H;
    }
  }
  cout << answer;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    
    int N;
    cin >> N;
    vi A(N);
    in(N,A);
    
    sort(all(A));
    
    set<int> B;
    
    
    int ans = 0;
    
    rep(i,N){
        int f = 0;
        if(i != N-1){
            if(A[i] == A[i+1]) f=1;
        }
        for (int j = 1; j*j <= A[i]; j++) {
            if(A[i]%j == 0){
                if(B.count(j)) f = 1;
                if(B.count(A[i]/j)) f = 1;
                if(f == 1) break;
            }
        }
        B.insert(A[i]);
        if(f == 0) ans++;
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 13368
using System;

class Program
{
    static void Main(string[] args)
    {
        Console.ReadLine();
        char[] s = Console.ReadLine().ToCharArray();
        int count = 0;
        for(int i = 0; i < s.Length - 2; i++)
        {
            if (s[i] != 'A')
                continue;
            if (s[i + 1] != 'B')
                continue;
            if (s[i + 2] == 'C')
                count++;
        }

        Console.WriteLine(count);

    }


}

Measured memory_bytes: 25812
import java.util.Scanner;

class Main {
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		
		//整数の数nを受け取る
		String s1 = sc.next();
	    int n = Integer.parseInt(s1);
	    int a[] = new int[n];
	    long sum = 0;
	    
	    //n回、整数を読み取り、配列に入れる
	    for(int i = 0; i <= n-1; i++){
	    	String s2 = sc.next();
		    int j = Integer.parseInt(s2);
		    a[i] = j;
	    }
	    
	    //配列の０番目に大きな数、最後に小さな数が来るように並べ変える
	    for(int i = 0; i <= a.length-1; i++){
	    	for(int j = 0; j <= a.length-2; j++){
	    		if(a[j] < a[j+1]){
	    			int w = a[j];
	    			a[j] = a[j+1];
	    			a[j+1] = w;
	    		}
	    	}
	    }
	    
	    //配列に格納されている整数の合計を計算
	    for(int i = 0; i < a.length; i++){
	    	sum = sum + (long)a[i];
	    }
	    
	    //最小値、最大値、合計を表示
	    System.out.println(a[a.length-1] + " " + a[0] + " " + sum);
	}
}

Measured memory_bytes: 39460
n,m=map(int,input().split())
s=list(input())
s=list(map(int,s))
dp=[float("inf")]*(n+1)
dp[0]=0

i=n
ans=[]
while i>0:
    if i<=m:
        ans.append(i)
        break
    j=m
    while True:
        if j==0:
            print(-1)
            exit()
        if s[i-j]:
            j-=1
        else:
            ans.append(j)
            i-=j
            break


ans.reverse()
print(*ans)


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

int main(){
    int n;
    cin >> n;
    vector<int> w(n);
    int sum = 0;
    rep(i,n){
        cin >> w[i];
        sum += w[i];
    }
    int ans = 1e6;
    int now = 0;
    rep(i,n-1){
        now += w[i];
        ans = min(ans, abs(sum-now*2));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

//typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;
const int INF = 1000000000;

int main(){

	int n,s;
	while(cin >> n && !(n == 0)){
		int maxNum = 0;
		vector<int> nums;
		for(int i = 0; i < n; i++){
			int x;
			cin >> x;
			nums.push_back(x);
		}
		sort(nums.begin(),nums.end());
		int sum = 0;
		for(int i = 1; i < nums.size() - 1; i++){
			sum += nums[i];
		}
		cout << (int)((double)sum/(nums.size()-2)) << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<iomanip>
using ll = long long;
using namespace std;
const ll MM = 1000000000;
const ll mod = MM + 7;

int main(){
    int n; cin >> n;
    int a[101];
    int count = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        count += a[i];
    }
    double ave = count*1.00 / n;
    double mn = 100, mn_i = -1;
    double diff = 0;
    for(int i = 0; i < n; i++){
        diff = (a[i] - ave)*1.0;
        if(diff < 0) diff = diff * (-1.0);

        if(diff < mn){
            mn = diff;
            mn_i = i;
        }
    }
    cout << mn_i << endl;
}

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

int main()
{
    int n, r=0;
    cin >> n;
    int a[n+1], b[n+1];
    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++){
		if(a[i] - b[i] >0) r += a[i] - b[i];
	}

	cout << r;

    return 0;
}



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


int main(){
  int N;
  cin >> N;
  if(N == 1){
    cout << "Yes" << endl;
    return 0;
  }
  vector<int> H(N);
  int pre = -10;
  for(int i=0; i < N; i++){
    cin >> H.at(i);
    if(pre <= (H.at(i)-1)){
      pre = H.at(i) - 1;
    }
    else if(pre <= H.at(i)){
      pre = H.at(i);
    }
    else{
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a > 0) {
            System.out.println("Positive");
        } else {
            if (b >= 0) {
                System.out.println("Zero");
            } else {
                if ((a - b) % 2 == 0) {
                    System.out.println("Negative");
                } else {
                    System.out.println("Positive");
                }
            }
        }
   }
}


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

inline void up(int &x, int y) { x < y ? x = y : 0; }
inline void down(int &x, int y) { x > y ? x = y : 0; }
std::string s;
int main() {
	std::cin >> s;
	int n = s.size();
	for (int i = 0; i < n; ++i) {
		if (s[i] == '7') return puts("Yes"), 0;
	}
	puts("No");
}




Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define ll long long
#define pb push_back
#define endl "\n"
#define mod 1000000007
using namespace std;
int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	while(a>0 || c>0)
	{
		c=c-b;
		if(c<=0)
		{
			cout<<"Yes"<<endl;
			break;
		}
		a=a-d;
	if(a<=0)
		{
			cout<<"No"<<endl;
			break;
		}
	
	}
}

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

int main() {
    int N, K;
    std::cin >> N >> K;

    int ans = 1;
    for (int i = 0; i < N; ++i) {
        if ((ans * 2) < (ans + K)) {
            ans *= 2;
        } else {
            ans += K;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
sc = [tuple(map(int, input().split())) for j in range(m)]
for i in range(10**n):
    if len(str(i)) == n and all(str(i)[s - 1] == str(c) for s, c in sc):
        print(i)
        break
else:
    print(-1)

Measured memory_bytes: 9132
S = int(input())
Front = int(S / 100)
Back = S % 100

MMYY = False
YYMM = False

if 1 <= Front and Front <= 12:
  MMYY = True

if 1 <= Back and Back <= 12:
  YYMM = True

if MMYY and YYMM:
  print("AMBIGUOUS")
elif MMYY:
  print("MMYY")
elif YYMM:
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
const int mod=1e9+7;
typedef long long ll;
int n;
ll ans;
int sum[26];
char ch[N];
int main(){
	scanf("%d",&n);
	scanf("%s",ch+1);
	for(int i=1;i<=n;i++)
		sum[ch[i]-'a']++;
	ans=1;
	for(int i=0;i<26;i++)
		ans=ans*(sum[i]+1)%mod;
	ans=(ans-1)%mod;
	ans=(ans+mod)%mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
use proconio::{fastout, input};
use std::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
        s: String
    };

    let mut set = BinaryHeap::new();
    set.push("2019/04/30");
    set.push(&s);

    if set.pop().unwrap() != "2019/04/30" && s != "2019/04/30" {
        println!("TBD")
    } else {
        println!("Heisei")
    }
}


Measured memory_bytes: 2200