akhauriyash/Code-Regression huggingface dataset:
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
a=get_i.sort!{|x,y| y<=>x}
min_dif=INF
max=a[0]
ans=-1
1.upto(N-1) do|i|
    d=(a[i]-(max-a[i])).abs
    if min_dif>d
        min_dif=d
        ans=a[i]   
    end
end
puts [max,ans].join(" ")

Measured memory_bytes: 10248
N=int(input())
A=[]
for _ in range(N):
    W=input()
    if W in A:
        print('No')
        exit()
    else:
        A.append(W)

for i in range(N-1):
    if A[i][-1]!=A[i+1][0]:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9+7;
#define ll long long

signed main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end(),greater<int>());
  int ans = a[0];
  int index = 1;
  FOR(i,1,n) {
    if(index>=n-1) break;
    ans+=a[i];
    index++;
    if(index<n-1) ans+=a[i];
    index++;
    //cout << ans << endl;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4832
// Author : Mohamed Sameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std ;
int main()
{
    string a , b , c;
    int x , y ;
    cin >> a>> b;
    cin >> x >> y ;
    cin >> c ;
    if (a == c )x--;
    else
        y--;
    cout << x <<" " << y <<"\n";


}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

class Node{
public:
	int key;
	Node* right;
	Node* left;
	Node* parent;
};
Node* root;
Node* NIL;
void insert(int k){
	Node* y = NIL; // x ??????
	Node* x = root;
	Node* z;
	z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;
	while (x != NIL){
		y = x; // ???????¨????
		if (z->key < x->key) x = x->left; // ?????????????§????
		else x = x->right; // ?????????????§????
	}
	z->parent = y;
	if (y == NIL) root = z; // T ???????????´???
	else {
		if (z->key < y->key) y->left = z; // z ??? y ?????????????????????
		else y->right = z; // z ??? y ?????????????????????
	}
}
void preorder(Node* z){
	if (z == NIL) return;
	cout << ' ' << z->key ;
	if (z->left != NIL) preorder(z->left);
	if (z->right != NIL) preorder(z->right);
}
void inorder(Node* z){
	if (z == NIL) return;
	if (z->left != NIL) inorder(z->left);
	cout << ' ' << z->key;
	if (z->right != NIL) inorder(z->right);
}
int main(){
	root = NIL;
	int n; scanf("%d", &n);
	for (int i = 0; i < n; ++i){
		char str[20]; scanf("%s", &str);
		if (strcmp(str, "insert") == 0){
			int tmp; scanf("%d", &tmp);
			insert(tmp);
		}
		else{
			inorder(root); cout << '\n';
			preorder(root); cout << '\n';
		}
	}

}

Measured memory_bytes: 24644
/*
 * Problem     : AOJ0200
 * Title       : Traveling Alone: One-way Ticket of Youth (高校生一人旅 ~青春の片道切符編~)
 * Author      : mizo0203
 * Copyright   : Your copyright free
 * Description : ダイクストラ
 */
#include <stdio.h>
#include <utility> // pairライブラリを使用するのに必要
#include <vector>
#include <queue>
#include <algorithm>
#define MAX_V 100
#define INF 3000000
using namespace std;

struct edge {
  int to, cost, time;
};
typedef pair<int, int> P;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

int k;
int s, q, r;

bool input() {
  int i;
  int n, a, b, cost, time;
  edge e;

  scanf("%d %d", &n, &V);
  if (!n && !V)
    return false;

  for (i = 0; i < V; i++) {
    G[i].clear();
  }
  for (i = 0; i < n; i++) {
    scanf("%d %d %d %d", &a, &b, &cost, &time);
    a--;
    b--;
    e.to = b;
    e.cost = cost;
    e.time = time;
    G[a].push_back(e);
    e.to = a;
    G[b].push_back(e);
  }
  scanf("%d", &k);

  return true;
}

bool input2() {

  if (!k)
    return false;
  k--;

  scanf("%d %d %d", &s, &q, &r);
  s--;
  q--;

  return true;
}

void dijkstra() {
  priority_queue<P, vector<P>, greater<P> > que;
  fill(d, d + V, INF);
  d[s] = 0;
  que.push(P(0, s));

  while (!que.empty()) {
    P p = que.top();
    que.pop();
    int v = p.second;
    if (d[v] < p.first)
      continue;
    for (int i = 0; i < (int) G[v].size(); i++) {
      edge e = G[v][i];
      if (!r) {
        if (d[e.to] > d[v] + e.cost) {
          d[e.to] = d[v] + e.cost;
          que.push(P(d[e.to], e.to));
        }
      } else {
        if (d[e.to] > d[v] + e.time) {
          d[e.to] = d[v] + e.time;
          que.push(P(d[e.to], e.to));
        }
      }
    }
  }
}

int main() {

  while (input()) {
    while (input2()) {
      dijkstra();
      printf("%d\n", d[q]);
    }
  }

  return 0;
}

Measured memory_bytes: 916
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const int mod=1e9+7;
const vi emp;
const int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

string s;

int main(){
	cin>>s;
	string t;
	map<char,char> m;
	m['p']='q';
	m['q']='p';
	m['b']='d';
	m['d']='b';
	for(int i=0;i<s.size();i++) t+=m[s[i]];
	reverse(t.begin(),t.end());
	if(s==t) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a, b, c;
    while(cin >> a >> b >> c, a){
        ll ans1 = INF<int>, ans2 = INF<int>, ans3 = INF<ll>;
        for (int x = 0; x <= 100000; x++) {
            ll k = a*x+c;
            if(k%b == 0){
                ll y = k/b;
                if(x+y < ans1+ans2){
                    ans1 = x, ans2 = y, ans3 = a*x+b*y;
                }else if(x+y == ans1+ans2 && a*x+b*y < ans3){
                    ans1 = x, ans2 = y, ans3 = a*x+b*y;
                }
            }
            k = a*x-c;
            if(k%b == 0 && k >= 0){
                ll y = k/b;
                if(x+y < ans1+ans2){
                    ans1 = x, ans2 = y, ans3 = a*x+b*y;
                }else if(x+y == ans1+ans2 && a*x+b*y < ans3){
                    ans1 = x, ans2 = y, ans3 = a*x+b*y;
                }
            }
            k = c-a*x;
            if(k%b == 0 && k >= 0){
                ll y = k/b;
                if(x+y < ans1+ans2){
                    ans1 = x, ans2 = y, ans3 = a*x+b*y;
                }else if(x+y == ans1+ans2 && a*x+b*y < ans3){
                    ans1 = x, ans2 = y, ans3 = a*x+b*y;
                }
            }
        }
        cout << ans1 << " " << ans2 << "\n";
    }
    return 0;
}


Measured memory_bytes: 3076
K = int(input())
A, B = map(int, input().split())
judge = False;
count = 1
num = K * count
while num <= B:
  if A <= num and num <= B:
    judge = True
    break
  count += 1
  num = K * count
if judge:
  print('OK')
else:
  print('NG')

Measured memory_bytes: 9180
// Date: 2020-06-21

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define IO freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout)
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define D(x) cout << #x << " = " << x << endl;
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int cnt[N], n, q;

int main() {
	FIO;
	cin >> n;
	LL sum = 0;
	rep(i, 1, n) {
		int x;
		cin >> x;
		cnt[x]++;
		sum += x;
	}
	cin >> q;
	while(q--) {
		int b, c;
		cin >> b >> c;
		cnt[c] += cnt[b];
		sum += 1LL*c*cnt[b];
		sum -= 1LL*b*cnt[b];
		cnt[b] = 0;
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 4024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        System.out.println(a*a*a);

    }




}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25416
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
ll x,y,ans;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>x>>y;
	while (x<=y)
	{
		x*=2;
		++ans;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
d,n = map(int, input().split())

if d == 0:
    if n == 100:
        print(101)
    else:
        print(n)
elif d == 1:
    if n == 100:
        print(100*101)
    else:
        print(100*n)
else:
    if n == 100:
        print(100**2*101)
    else:
        print(100**2*n)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  vector<int> v(3);
  cin>>v[0]>>v[1]>>v[2];
  int k;
  cin>>k;
  sort(all(v));
  rep(i,0,k) v[2]=2*v[2];
  cout<<v[0]+v[1]+v[2]<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

ll dp[1000];

int main() {
	int n; cin >> n;
	dp[0] = 2, dp[1] = 1;
	if(n == 1) {
		printf("1\n"); return 0;
	}

	for (int i = 2; i <= n; ++i) {
		dp[i] += dp[i - 1] + dp[i - 2];
	}
	printf("%lld\n", dp[n]);
	return 0;
}

Measured memory_bytes: 256
#空リストと1~入力値までの数字を入れたリストを作成する
line = []
for i in range(1,int(input()) + 1):line.append(i)

#何処と何処を交換するかを入力し交換する
for _ in range(int(input())):
    a,b = map(int,input().split(","))
    line[a - 1],line[b - 1] = line[b - 1],line[a - 1]
    
#出力
for s in line:print(s)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#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__)

const int MAX = 510000;
const int mod = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

int main(){
    ll n,m,k;
    cin>>n>>m>>k;
    COMinit();
    ll ans=COM(n*m-2,k-2);
    ll res1=(n*(n+1)*(n-1)/6)%mod;
    res1*=m*m%mod;
    res1%=mod;
    ll res2=(m*(m+1)*(m-1)/6)%mod;
    res2*=n*n%mod;
    res2%=mod;
    res1+=res2;
    res1%=mod;
    ans*=res1;
    ans%=mod;
    cout<<ans<<endl;
}



Measured memory_bytes: 12160
#include <stdio.h>
int main(void)
{
    int a, b, n;
    while (scanf("%d%d%d",&a,&b,&n) != EOF) {
        int res=0;
        do {
            a = 10*(a%b);
            res += a/b;
        } while (--n);
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 0
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

int main() {
    string s;
    int q;
    cin >> s >> q;

    deque<char> dq;
    for (char c : s) dq.push_back(c);

    int rev = 0;

    rep(i, q) {
        int t;
        cin >> t;
        if (t == 1)
            rev ^= 1;
        else {
            int f;
            char c;
            cin >> f >> c;
            --f;
            f ^= rev;

            if (f)
                dq.push_back(c);
            else
                dq.push_front(c);
        }
    }

    vector<char> v(dq.begin(), dq.end());
    if (rev) reverse(all(v));

    for (char c : v) cout << c;
    cout << "\n";
    return 0;
}


Measured memory_bytes: 1280
use std::cmp::*;
use std::io::*;
use std::num::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn string() -> String {
    read()
}
fn int() -> i64 {
    read()
}
fn char() -> char {
    read::<String>().pop().unwrap()
}
fn vecchar() -> Vec<char> {
    string().chars().collect()
}
fn vecint(n: i64) -> Vec<i64> {
    let mut vec = Vec::new();
    for i in 0..n {
        vec.push(int())
    }
    vec
}

fn main() {
    let mut n = vecint(4);
    n.sort();
    let vec = vec![1i64, 4i64, 7i64, 9i64];
    for i in 0..4 {
        if n[i] != vec[i] {
            println!("NO");
            return;
        }
    }
    println!("YES")
}


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

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


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int H,W;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0&&W==0) break;
		for(int j=1;j<=H;j++){
			for(int i=1;i<=W;i++){
				if(j==1||j==H){
					printf("#");
				}
				else{
					if(i==1||i==W) printf("#");
					else printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
}

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

namespace ABC088A
{
    class Program
    {
        static void Main(string[] args)
        {
            var line1 = Console.ReadLine();
            var N = int.Parse(line1);

            var A = int.Parse(Console.ReadLine());

            if (N % 500 <= A) Console.WriteLine("Yes");
            else Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
typedef long long ll ;
typedef double db;
typedef long double ldb;
typedef unsigned long long ull ;
const double PI = acos(-1) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define for0(i,n)          for(int i=0;i<n;i++)
#define for1(i,n)          for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
//#define gcd(a, b)     __gcd(a, b)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
//#define abs(x)		fabs(x)
#define pcase(z,x)     cout<<"Case "<<z<<": "<<x<<"\n"
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define max 1000000000000000000

using namespace std;

int n,a[2100000],ans;
int main(void)
{
    CIN;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        a[x]++;
    }
    for(int i=1;i<=1000000;i++)
    {
        if(a[i]==1)ans++;
        if(a[i]>0)
        {
            for(int j=i;j<=1000000;j+=i)
            {
                a[j]=0;
            }
        }
    }
    cout<<ans<<endl;
}

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

int main(){
  int ans=0;
  int cur=0;
  rep(i,0,5){
    int t;
    cin>>t;
    ans+=(t+9)/10*10;
    cur=max(cur,9-(t-1)%10);
  }
  cout<<ans-cur<<endl;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        HashSet<String> name = new HashSet<String>();
        for (int i = 0; i < num; i++){
            name.add(sc.next());
        }
        System.out.println(name.size());
    }
}


Measured memory_bytes: 76840
import java.util.Scanner;

/**
 * Main
 */
public class Main {

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

        int K = sc.nextInt();
        long total=0;

        for(int i=1; i<=K; i++){
            for(int j = 1; j<=K; j++){
                for(int l=1; l<=K; l++){
                    total += gcd(gcd(i, j),l);
                    // System.out.println(gcd(gcd(i, j),l));
                }
            }
        }
        System.out.println(total);
    }

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

Measured memory_bytes: 27268
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    auto dp = initVec2<int>(n + 1, k + 2);
    dp[0][0] = 1;
    rep(i, n){
        rep(j, k + 1){
            dp[i][j+1] += dp[i][j];
            dp[i][j+1] %= MOD;
        }

        rep(j, k + 1){
            dp[i+1][j] = dp[i][j];
            if(j - a[i] > 0){
                dp[i+1][j] += MOD;
                dp[i+1][j] -= dp[i][j-a[i]-1];
                dp[i+1][j] %= MOD;
            }
        }
    }
    cout << dp[n][k] << endl;

    return 0;
}


Measured memory_bytes: 80256
function Main(input) {
	input = input.split(" ");  
	var a = BigInt(input[0], 10);
	var b = BigInt(input[1], 10);
    var c = BigInt(input[2], 10);
    var d = BigInt(input[3], 10);


  	var ans = a * c;
  	if(a * d > ans) ans = a * d;
  	if(b * c > ans) ans = b * c;
  	if(b * d > ans) ans = b * d;

    console.log(ans.toString());
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29580
N, C = map(int, input().split())

D = []
for i in range(C):
    D.append(list(map(int, input().split())))

cc = [[0]*C for i in range(3)]
for i in range(N):
    color = list(map(int, input().split()))
    for j in range(len(color)):
        cc[(i+j)%3][color[j]-1] += 1
    
iwakan = [[[0, 0] for _ in range(C)] for _ in range(3)]

for i in range(3):
    for j in range(C):
        tmp = 0
        for k in range(len(cc[i])):
            tmp += cc[i][k]*D[k][j]
        iwakan[i][j][0] = tmp
        iwakan[i][j][1] = j

ans = 10**15
for i in range(len(iwakan)):
    iwakan[i] = sorted(iwakan[i], key=lambda x:x[0])
    
for i in range(3):
    for j in range(3):
        if(iwakan[0][i][1] == iwakan[1][j][1]):
            continue
        for k in range(3):
            if(iwakan[0][i][1] == iwakan[2][k][1]):
                continue
            if(iwakan[1][j][1] == iwakan[2][k][1]):
                continue
            ans = min(ans, iwakan[0][i][0]+iwakan[1][j][0]+iwakan[2][k][0])
            
print(ans)

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

namespace DDCC2020
{
    class A
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int X = input[0];
            int Y = input[1];

            int sum = 0;
            if (X == 3) { sum += 100000; }
            if (X == 2) { sum += 200000; }
            if (X == 1) { sum += 300000; }

            if (Y == 3) { sum += 100000; }
            if (Y == 2) { sum += 200000; }
            if (Y == 1) { sum += 300000; }


            if (X == 1 && Y == 1) { sum += 400000; }

            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <string.h>

int main (void){
  
    char s[200001];
    int len;

    scanf("%s",s);
    len = strlen(s);

    int numa;
    int numz;
    int finda = 1;

    for(int i = 0; i<len; i++){
          
          if(s[i] == 'A'){
              if(finda){
                numa = i;
                finda = 0;
              }
          }

          if(s[i] == 'Z')
            numz = i;
            
    }

    printf("%d", numz-numa+1);

    return 0;   
}


Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <map>
using namespace std;

#define Int int_fast64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T,vector<T>>;
template<class T> using pq = priority_queue<T,vector<T>,greater<T>>;
#define LL(n) Int n; cin >> n;
#define RP(n) for (Int i = 0; i < n; i++)
#define REP(n,i) for (Int i = 0; i < n; i++)

struct node{
    int to;
    int length;
};

vector<vector<node>> to;
vector<int> flag;
vector<int> c;


void dfs(int from) {
    for (auto z : to.at(from)) {
        int next = z.to;
        int length = z.length;
        if (flag.at(next) == 0) {
            flag.at(next) = 1;
            if (length % 2 == 0) {
                c.at(next) = c.at(from);
            } else {
                c.at(next) = 1 - c.at(from);
            }
            dfs(next);
        }
    }
}

int main(void){
    string s;
    cin >> s;
    string str(s.size(),'x');
    cout << str << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

N = int(input())
M = []
for i in range(N):
    A = int(input())
    XY = []
    for j in range(A):
        X, Y = map(int, input().split())
        XY.append([X, Y])
    M.append(XY)

# 残り嘘つき人数を渡して全パターンを列挙する
def check(n, l):
    # 残り0なら以降を全部正直者にして判定
    if n == 0:
        l += [1] * (N - len(l))
        return judge(l)
    # 残りと未確定人数が同じなら全部嘘つきにして判定
    if n == N - len(l):
        l += [0] * (N - len(l))
        return judge(l)

    # iが正直者1
    if check(n, l + [1]):
        return True
    # iが嘘つき0
    if check(n - 1, l + [0]):
        return True

    return False

# 矛盾がないかチェックする
def judge(l):
    for i in range(len(M)):
        # 嘘つきなら無視する
        if l[i] == 0:
            continue
        # 正しいかチェック
        ii = M[i]
        for j in range(len(ii)):
            jj = ii[j]
            if l[jj[0] - 1] != jj[1]:
                return False
    return True

# 嘘つき人数を増やしながら調べる
for i in range(N + 1):
    if check(i, []):
        print(N - i)
        break;


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    ll a,b,c; cin >> a >> b >> c;
    if(c - a- b > 0 && 4*a*b < (c - a - b)*(c-a-b)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>

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

using namespace std;

int main(void) {

	int A, B;
    scanf("%d %d", &A, &B);
    int ans = 0;

    if ( A == B ) ans += A + B;
    else if ( A > B ) ans += A + A - 1;
    else ans += B + B - 1; 
    
    printf("%d\n", ans);

	return 0;
}


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

int main() {
    ll n;
    cin>>n;
    vector<ll> a(n+1);
    rep(i,n)cin>>a[i+1];
    vector<bool> flag(n+1,false);
    ll cnt=0;
    for(ll i=n;i>0;i--){
        if(i>n/2){
            if(a[i]==0){
                flag[i]=false;
            }else{
                flag[i]=true;
                cnt++;
            }
        }else{
            ll aa=1;
            for(ll j=i*2;j<=n;j+=i){
                if(flag[j]){
                    aa*=-1;
                }else{
                    aa*=1;
                }
            }
            if(aa==-1){
                if(a[i]==0){
                    flag[i]=true;
                    cnt++;
                }else{
                    flag[i]=false;
                }
            }else{
                if(a[i]==0){
                    flag[i]=false;
                }else{
                    flag[i]=true;
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;
    rep(i,n){
        if(flag[i+1]){
            cout<<i+1<<" ";
        }
    }
}

Measured memory_bytes: 2560
S = input()
base = ["A", "T", "G", "C"]
Ans = 0
for i in range(len(S)):
	ans = 0
	if S[i] in base:
		for j in range(i, len(S)):
			if S[j] in base:
				ans += 1
			else:
				break
		Ans = max(ans, Ans)
print(Ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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; }
using namespace std;

int N, X, L[110];

int main() {
    cin >> N >> X;

    int height = 0, ans = 1;
    rep(i, N) {
        int l; cin >> l;
        height += l;
        if (height <= X) ans++;
        else break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int x[MAX],y[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll ans=0,n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j*i<=n; j++)
        {
            ll cur=n-(i*j);
            if(cur)
                ans++;
        }
    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>
int main(void){
    int i, j, N, M;
    double all = 0;
    j = 0;
    scanf("%d %d",&N,&M);
    int A[N];
    for(i=0; i<=N-1; i++){
        scanf("%d",&A[i]);
        all += A[i];
    }
  //printf("all=%f\n",all);
    all = all/(4*M);
  //printf("all=%f\n",all);
    for(i=0; i<=N-1; i++){
        if(A[i] >= all){
            j++;
      //    printf("j=%d\n",j);
        }
    }
    if(j >= M){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import collections
n = int(input())
a = [int(i) for i in input().split()] 

"""#TLE
ans = 0
for i in range(n):
    for j in range(i+1, n):
        #print(i, j)
        if j - i == a[i] + a[j]:
            ans += 1
print(ans)
"""

"""#DP
A = [[a[i], i+1] for i in range(n)]
#print(A)
A.sort()
#print(A)
dp = [0 for _ in range(n)]
dp[0] = 0
if abs(A[0][1] - A[1][1]) == A[0][0] + A[1][0]:
    dp[1] = 1
else:
    dp[1] = 0
for i in range(2, n):
    dp[i] = 
"""

#解説AC
ans = 0
A = [[i+1, a[i]] for i in range(n)]
#print(A)
L = [0 for i in range(n)]
R = [0 for i in range(n)]
for i in range(n):
    L[i] = A[i][0] + A[i][1] 
    R[i] = A[i][0] - A[i][1]
#print(L)
#print(R)
cl = collections.Counter(L)
cr = collections.Counter(R)
#print(cl)
#print(cr)
for i in set(L):
    ans += cl[i] * cr[i]
print(ans)


Measured memory_bytes: 95288
import numpy as np

N, L = list(map(int, input().split(" ")))

price = []

for n in range(N):
  price.append(n+L)
  
p2 = np.array(price)
p2 = p2**2
m = min(p2)
index = np.where(p2==m)[0]


price.pop(index)

print(sum(price))



      

Measured memory_bytes: 21116
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

struct tri{
  ll f,s,t;
};

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;ll K;cin >> N >> K;
  if(2*K-1>N){
    cout << -1 << endl;
    return 0;
  }

  vector<PII> v(N);
  ll b;
  int index = 0;
  b = K+2*N-1-N/2;
  if(N%2==1 && K%2==1)--b;
  repp(x,K,K+N){
    if(x&1)continue;
    v[index].first = x+b;
    v[index].second = x;
    ++index;
    --b;
  }

  b = K+2*N-1;
  repp(x,K,K+N){
    if((x&1)==0)continue;
    v[index].first = x+b;
    v[index].second = x;
    ++index;
    --b;
  }

  ll c = K+2*N;
  queue<tri> que;
  rep(i,N){
    que.push({v[i].second,v[i].first-v[i].second,c});
    ++c;
  }
  while(!que.empty()){
    tri t = que.front();que.pop();
    cout << t.f SP t.s SP t.t << endl;
  }
  return 0;
}


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

int main(void){
    string a, b, c;
    cin >> a >> b >> c;
    if(a[a.length()-1] == b[0] && b[b.length()-1] == c[0]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>

using namespace std;

int main() {

    double R;
    cin >> R;

    double PI = 3.141592653589;

    cout << fixed << setprecision(10) << 2 * PI * R << endl;

    return 0;

}

Measured memory_bytes: 3728
import java.io.*;

public class Main {

  static long a, b, n;
  
  public static void main(String[] args) throws Exception {
    
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    String[] in = br.readLine().split(" ");
    a = Long.parseLong(in[0]);
    b = Long.parseLong(in[1]);
    n = Long.parseLong(in[2]);

    br.close();

    long ans = 0;

    if(n >= b){
      ans = calcAns(a, b, b-1);
    }else{
      ans = calcAns(a, b, n);
    }
    System.out.println(ans);

  }

  static long calcAns(long c, long d, long e){
    return ((c * e) / d) - (c * (e / d));
  }

}

Measured memory_bytes: 32756
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>


#define ll long long


//gcdやり直す

void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}




/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}





/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int n;
  scanf("%d",&n);
  int A[n];
  for(int i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  qsort(A/*配列の名前*/,n/*大きさ*/,4/*とりあえず4*/,dn/*とりあえずdn*/);
  //Aが降順ソートされて出てくる
  int B[n];
  for(int i=0;i<n;i++){
    B[i]=A[n-1-i];
  }
  //1->0
  //2->A[0]
  long int ans=A[0];
  //[7,6,3,2,1]
  for(int i=2;i<n;i++){
    ans+=A[i/2];
  }

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

Measured memory_bytes: 3288
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int N,H,W; cin >> N >> H >> W;
    vector<int> x(N);
    for(auto& in:x) cin >> in;
    vector<int> mado(30000,0);
    int from = 10000;
    int end = from + W*N;
    
    for(int i = 0; i < N;i++){
        int F = from + W*i;
        if(i%2==0){
            mado[F + x[i]] += 1;
            mado[F + W + x[i]] += -1;
        }else{
            mado[F - x[i]] += 1;
            mado[F - x[i] + W] += -1;
        }
    }
    for(int i = 1; i < 30000;i++){
        mado[i] += mado[i-1];
    }
    
    ll cnt = 0;
    for(int i = from; i < end; i++){
        if(mado[i]) continue;
        cnt++;
    }
    cout << cnt * H << endl;
    return 0;
}



Measured memory_bytes: 3348
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld double 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX1 100006
#define f first
#define s second
#define pi 2*acos(0.0)
void solve()
{
    ll n,count=0; cin>>n;
    ll arr[n+1];
    rep(i,0,n+1) cin>>arr[i];
    rep(i,0,n)
    {
        ll x;  cin>>x;
        if(arr[i]>=x) 
        {
            arr[i]-=x;
            count+=x;
            x=0;
        }
        else 
        {
            count+=arr[i];
            x-=arr[i];
            if(arr[i+1]>=x) 
            {
                arr[i+1]-=x;
                count+=x;
                x=0;
            }
            else 
            {
                count+=arr[i+1];
                arr[i+1]=0;
            }
        }
    }cout<<count;
}
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt","r",stdin);
    //for getting error from error.txt
    freopen("error.txt", "w", stderr);
    // for writing output to output.txt
    freopen("output.txt","w",stdout);
    #endif
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<"\n";
    cerr<<"My CLOCKS_PER_SEC= "<<CLOCKS_PER_SEC<<"\n";
    return 0;
}


Measured memory_bytes: 4588
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

int main(){
  int N, A, B;
  cin>>N>>A>>B;
  LINT v[N];
  REP(i, N)cin>>v[i];
  if(N==1){
    cout<<v[0]<<endl<<1<<endl;
    return 0;
  }
  sort(v, v+N, greater<LINT>());
  double ansv =0;
  REP(i, A) ansv += v[i];
  ansv /= A;

  LINT comb=1;
  LINT ansk=0;
  LINT X=0, Y=0;
  if(v[0]==v[A-1]){
    for(int i=0; i<N; ++i){
      if(v[0]==v[i]) ++X;
    }

    for(int i=1; i<A; ++i) comb = comb * (X-i+1) / i;
    for(int i=A; i<X+1 && i<B+1; ++i){
      comb = comb * (X-i+1) / i;
      ansk += comb;
    }
  }

  else{
    for(int i=0; i<N; ++i){
      if(v[A-1]==v[i]) ++X;
      if(v[A-1]==v[i] && i<A) ++Y;
    }
    for(int i=1; i<Y+1; ++i) comb = comb * (X-i+1) / i;
    ansk = comb;
  }
  cout<<fixed<<ansv<<endl;
  cout<<ansk<<endl;

  return 0;
}


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

int a[100000];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    scanf("%d", &a[i]);
  int xor_sum = 0;
  for (int i = 0; i < n; i++)
    xor_sum ^= a[i];
  std::unordered_set<int> s;
  for (int i = 0; i < n; i++)
    s.insert(a[i] ^ (a[i] - 1));
  int ans = 0;
  for (int bit = 29; bit >= 0; bit--) {
    if (((1 << bit) & xor_sum) == 0) {
      continue;
    }
    int x = (1 << (bit + 1)) - 1;

    if (s.find(x) != s.end()) {
      xor_sum ^= x;
      ans += 1;
    }
  }

  if (xor_sum != 0) {
    printf("-1\n");
  } else {
    printf("%d\n", ans);
  }
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
double R[500];
double x[500];
signed main(){
    cin>>N;
    rep(i,N)cin>>R[i];
    x[0]=R[0];
    double ans=0;
    for(int i=1;i<N;i++){
        x[i]=R[i];
        for(int j=0;j<i;j++){
            double a=R[i]+R[j];
            double b=abs(R[i]-R[j]);
            double c=sqrt(a*a-b*b);
            chmax(x[i],x[j]+c);
        }
    }

    rep(i,N)chmax(ans,x[i]+R[i]);
    printf("%.20f\n",ans);
    return 0;
}

Measured memory_bytes: 3272
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int y=sc.nextInt();
    for(int man=0;man<=n;man++){
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

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


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

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


int main() {
    i64 N, K; cin >> N >> K;
    vector<i64> A(N);
    REP(i, N) cin >> A[i];
    for (i64 i = K; i < N; i++) {
        if (A[i] > A[i - K]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 4752
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>

using namespace std;
using i64 = long long int;
constexpr i64 BIG = 1000000000000;

int main() {
	ios::sync_with_stdio(false);
	i64 A, B, Q;
	cin >> A >> B >> Q;
	std::vector<i64>s(A);
	for (int a = 0; a < A; a++) {
		cin >> s[a];
	}
	std::vector<i64>t(B);
	for (int b = 0; b < B; b++) {
		cin >> t[b];
	}
	std::vector<i64>x(Q);
	for (int q = 0; q < Q; q++) {
		cin >> x[q];
	}
	for (int q = 0; q < Q; ++q) {
		auto proc = [&]() ->i64 {
			i64 disMin = BIG;
			auto itrS = std::lower_bound(s.begin(), s.end(), x[q]);
			if (itrS != s.end()) {
				i64 dis1 = 0;
				dis1 += std::abs(*itrS - x[q]);
				auto itrT = std::lower_bound(t.begin(), t.end(), *itrS);
				i64 dis2 = BIG;
				if (itrT != t.end()) {
					dis2 = std::min({ dis2,std::abs(*itrS - *itrT) });
				}
				if (itrT != t.begin()) {
					dis2 = std::min({ dis2,std::abs(*itrS - *(itrT - 1)) });
				}
				if (disMin > dis1 + dis2) {
					disMin = dis1 + dis2;
				}
			}
			if (itrS != s.begin()) {
				i64 dis1 = 0;
				dis1 += std::abs(*(itrS - 1) - x[q]);
				auto itrT = std::lower_bound(t.begin(), t.end(), *(itrS - 1));
				i64 dis2 = BIG;
				if (itrT != t.end()) {
					dis2 = std::min({ dis2,std::abs(*(itrS - 1) - *itrT) });
				}
				if (itrT != t.begin()) {
					dis2 = std::min({ dis2,std::abs(*(itrS - 1) - *(itrT - 1)) });
				}
				if (disMin > dis1 + dis2) {
					disMin = dis1 + dis2;
				}
			}
			return disMin;
		};
		i64 dis = BIG;
		dis = std::min({ proc(),dis });
		std::swap(t, s);
		dis = std::min({ proc(),dis });
		std::swap(t, s);
		cout << dis << endl;
	}
	return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){
	int h1,h2,k1,k2,a,b,c,d;
	int hiroshi,kenjiro;
	cin>>h1>>h2;
	cin>>k1>>k2;
	cin>>a>>b>>c>>d;
	hiroshi=h1*a+h2*b+(h1/10)*c+(h2/20)*d;
	kenjiro=k1*a+k2*b+(k1/10)*c+(k2/20)*d;
	if(hiroshi>kenjiro)
		cout<<"hiroshi"<<endl;
	if(hiroshi<kenjiro)
		cout<<"kenjiro"<<endl;
	if(hiroshi==kenjiro)
		cout<<"even"<<endl;
	return 0;
}


Measured memory_bytes: 3088