akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
    int S;
    bool fY=false;
    cin >> S;
    for(int i=0; i<S; i++){
        char tmpc;
        cin >> tmpc;
        if(tmpc=='Y')fY=true;
    }
    cout << (fY ? "Four" : "Three");
    return 0;
}

Measured memory_bytes: 256
/** I can do this all day **/

#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"

//void add(int I, int value){seg[I += MAXN] = value;for (I >>= 1; I; I >>= 1){seg[I] = __gcd(seg[I << 1], seg[I << 1 | 1]);}}

//int query(int l, int r){int ans = seg[l + MAXN];for (l += MAXN, r += MAXN + 1; l < r; l >>= 1, r >>= 1){if(l & 1) ans = __gcd(ans, seg[l ++]);if(r & 1) ans = __gcd(ans, seg[-- r]);}return ans;}

const int MAXN = 1e6 + 10;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 8e18;
const int LOG = 22;

ll pw(ll a , ll b, ll mod)  { return (!b ? 1 : (b & 1 ? (a * pw(a * a % mod, b / 2, mod)) % mod : pw(a * a % mod, b / 2, mod))); }

int main(){
    fast_io;
    //cout << fixed << setprecision(15);
    //scanf("%d %d %f %lld %s %c", &x);
    //printf("%d %d %f %lld %s %c", x);
    ll n, k;
    cin >> n >> k;
    cout << min(n % k, k - (n % k));
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_b() {
	ll n;
	ll ans = 0;

	cin >> n;

	ll a;
	rep(i, n) {
		a = i + 1;
		if (a % 3 == 0 || a % 5 == 0) {

		}
		else {
			ans += a;
		}
	}

	cout << ans << "\n";
}

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

	solve_abc_b();

	return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

int N,A[100010],B[100010],C[100010];
int dp[100010][3];

int DP(int a,int k){
	if(dp[a][k]!=-1)return dp[a][k];
	int res=0,res2=0,res3=0;
	if(a==N){
		return 0;
	}
	DEB(k)END
	while(0);
	if(k==0){
		res2=DP(a+1,1)+B[a+1];
		res3=DP(a+1,2)+C[a+1];
	}
	else if(k==1){
		res=DP(a+1,0)+A[a+1];
		res3=DP(a+1,2)+C[a+1];
	}
	else if(k==2){
		res=DP(a+1,0)+A[a+1];
		res2=DP(a+1,1)+B[a+1];
	}
	return dp[a][k]=max({res,res2,res3});
}

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i]>>B[i]>>C[i];
	}
	REP(i,100010)REP(j,3){
		dp[i][j]=-1;
	}
	cout<<max({DP(0,0)+A[0],DP(0,1)+B[0],DP(0,2)+C[0]})<<endl;
	return 0;
}


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

int main() {
  int N,K;
  cin>>N>>K;
  int pattern=1;
  for(int i=1;i<=N;i++){
    if(i==1){
      pattern*=K;
    }
    else{
      pattern*=(K-1);
    }
  }
    cout<<pattern<<endl;
}


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

int sumOfDigits(int n)
{
    int sum = 0;
    while (n > 0)
    {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main()
{
    int N;
    cin >> N;
    if (N % sumOfDigits(N) == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3540
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'



void solve(){
  int n;
  cin >> n;
  int mn = n;
  int c = 0;
  forn(i,n){
    int a;
    cin >> a;
    if (a <= mn) c++;
    setmin(mn,a);
  }
  cout << c;
}

int main() {
  ios::sync_with_stdio(false); 
  // cin.tie(0); cout.tie(0);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 




*/

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

int main(){
	int n,t,m;
	char c;
	cin >> n;
	bool cards[4][14]={ 0 };


	for(int x=0; x<n; x++){ //x??§??\??????????????°???????????£???????????????????????\???????????????
		cin >> c >> t;
		if( c=='S' ) m=0;
		if( c=='H' ) m=1;
		if( c=='C' ) m=2;
		if( c=='D' ) m=3;
		cards[m][t] = 1;
	}


	for(int i=0; i<4; i++){ //?¶????????????????????????????????????????
		for(int j=1; j<=13; j++){
			if( cards[i][j]==0 ){
				if( i==0 ) cout << 'S' << " " << j << "\n";
				if( i==1 ) cout << 'H' << " " << j << "\n";
				if( i==2 ) cout << 'C' << " " << j << "\n";
				if( i==3 ) cout << 'D' << " " << j << "\n";
			}
		}
	}


	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h> 
using namespace std;
 int main() { 
   int N, K; 
   cin >> N >> K; 
   int ans = 0; 
   while(N > 0) { 
     N /= K; // N をK で割った商に置き換える 
     ans++;

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


Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

class X{
	long a;
	long b;
	long id;
	this(long id, long a, long b){
		this.id = id;
		this.a = a;
		this.b = b;
	}
	long c(){
		return a + b;
	}
}	

void main(){
	long n = read.to!long;
	X[] xs;
	foreach(i; 0 .. n){
		xs ~= new X(i, read.to!long, read.to!long);
	}
	
	xs.sort!"a.c > b.c"();
	
	long ans;
	foreach(i, x; xs){
		if(i % 2 == 0) ans += x.a;
		else ans -= x.b;
	}
	
	ans.writeln;
	
}


Measured memory_bytes: 17532
#include <iostream>

using namespace std;

int main() {

  while ( true ) {
    int N, M, P;
    cin >> N >> M >> P;
    if ( N == 0 ) break;    
    
    int sum = 0, hit;
    for ( int i = 1; i <= N; i++ ) {
      int val;
      cin >> val;
      sum += val;
      if ( i == M ) {
	hit = val;
      }
    }
    const int ans = ( hit == 0 ? 0 : sum * ( 100 - P ) / hit );
    cout << ans << endl;
  }  
}

Measured memory_bytes: 1160
def main():
    S = input()
    ans = "Yes"
    if len(S) % 2 == 1:
        ans = "No"
    elif len(S) % 2 == 0:
        i = 0
        j = 2
        while j <= len(S):
            if S[i:j] == "hi":
                pass
            elif S[i:j] != "hi":
                ans = "No"
            i += 2
            j += 2
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include<stdio.h>
int main(){
	int h,r;
	scanf("%d %d",&h,&r);
	if((h+r)==0)
	printf("0\n");
	if((h+r)>=1)
	printf("1\n");
	if((h+r)<=-1)
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 1816
#include <cstdio>

using namespace std;

const int SIEVE_SIZE = 100000;

bool sieve[SIEVE_SIZE + 1];
int prime[SIEVE_SIZE + 1];

int main()
{
	int n;
	int i,j,cnt = 0;
	
	sieve[0] = sieve[1] = true;
	for (i = 2; i * i <= SIEVE_SIZE; i++){
		if (sieve[i]) continue;
	   	for (j = i*i; j <= SIEVE_SIZE; j += i){
	    	 sieve[j] = true;
	    }
	}
	
	for (i = 0; i < SIEVE_SIZE ; i++){
		if (!sieve[i]){
			prime[cnt++] = i;
		}
	}
	
	int sa;
	
	while (scanf("%d", &n), n != 0){
		cnt = 0;
		
		for (i = 0; prime[i] <= n/2; i++){
			sa = n - prime[i];
			if (sieve[sa] == false){
				cnt++;
			}
		}
		
		printf("%d\n", cnt);
	}
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
	string a;
	cin >> a;
	int b = a.size();
	REP(i,b){
		if(i%2 == 0){
			cout << a[i];
		}
	}
    return 0;
}

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

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define RREPS(i,n) RFOR(i,1,n+1)
#define ALL(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define debug(x) cout << #x << ": " << x << endl

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF (1L << 30)
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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; }
using ll = long long;
#define int ll

bool Fcomp(const pair<int,int>& firstElof, const pair<int,int>& secondElof)
{return firstElof.F < secondElof.F;}
bool Scomp(const pair<int,int>& firstElof, const pair<int,int>& secondElof)
{return firstElof.S < secondElof.S;}

//**********

signed main(void) {
    
    int n=0;
    vector<int> a;
    
    scanf("%lld",&n);
    REP(i,n){
        int sc;
        scanf("%lld",&sc);
        a.pb(sc);
    }
    sort(ALL(a));
    reverse(ALL(a));
    double half = a[0]/2.0;
    double ans = a[0]*1.0;
    //debug(half);debug(ans);
    FOR(i,1,n){
        if(abs(ans-half)>=abs(a[i]-half)) {
            ans = a[i];
      //      debug(ans);
        }
    }

    printf("%lld %lld\n",a[0],int(ans));

    return 0;
    
}






Measured memory_bytes: 1400
/*Filename: aoj0010.cpp
 *Author: Mushiyo
 */

#include <stdio.h>
#include <iostream>
#include <cmath>

using namespace std;

struct Point {
	double x;
	double y;
};

double countDist(Point p1, Point p2) {
	double xDist = abs(p1.x - p2.x);
	double yDist = abs(p1.y - p2.y);

	return sqrt(xDist * xDist + yDist * yDist);
}

Point getCircumCircleCenter(Point p1, Point p2, Point p3) {
	Point bias = p1;

	// a, b & c for ax + by = c
	double a1 = p2.x - p1.x, b1 = p2.y - p1.y, c1 = (a1 * a1 + b1 * b1) / 2;
	double a2 = p3.x - p1.x, b2 = p3.y - p1.y, c2 = (a2 * a2 + b2 * b2) / 2;
	/* translate the origin to p1
	 * let the center of the circumscribed circle be (x, y)
	 * we can get the value of (x, y) by solve the following simultaneous equations to :
	 * a1 * x + b1 * y = c1 --(1)
	 * a2 * x + b2 * y = c2 --(2)
	 *
	 * 1. after rearrange eq.1, we have:
	 * y = (c1 - a1 * x) / b1
	 * plugging this into eq.2, we have:
	 * x = (b1 * c2 - b2 * c1) / (a2 * b1 - a1 * b2)
	 *
	 * 2. after rearrange eq.1, we have:
	 * x = (c1 - b1 * y) / a1
	 * plugging this into eq.2, we have:
	 * y = (a1 * c2 - a2 * c1) / (a1 * b2 - a2 * b1)
	 *   = (a2 * c1 - a1 * c2) / (a2 * b1 - a1 * b2)
	*/
	double d = a2 * b1 - a1 * b2;
	Point center;
	center.x = bias.x + (b1 * c2 - b2 * c1) / d;
	center.y = bias.y + (a2 * c1 - a1 * c2) / d;

	return center;
}

int main() {
	int n;

	while (cin >> n) {
		while (n > 0) {
			Point a, b, c;
			cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;

			Point center = getCircumCircleCenter(a, b, c);
			double radius = countDist(center, a);

			printf("%.3f %.3f %.3f\n", center.x, center.y, radius);

			--n;
		}
	}

	return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <stack>
#include <cstdio>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <iterator>
#include <sstream>
#define popcount(x) __builtin_popcount(x)
#define oddparity(x) __builtin_parity(x)
#define clz(x) __builtin_clz(x)
#define ctz(x) __builtin_ctz(x)
#define sf scanf
#define pf printf
#define ll long long int
using namespace std;

int i, n;
ll ans = 1;

int main()
{
    sf("%d", &n);
    for (i = 1; i <= n; i++) {
        ans = (ans * i) % 1000000007;
    }
    pf("%I64d\n", ans);
    return 0;
}

Measured memory_bytes: 256
use proconio::*;

// https://atcoder.jp/contests/tokiomarine2020/submissions/14270733
// ほぼこちらの写経

const MAX: usize = 1 << 18;
const MID: usize = 12;

fn chmax<T: Ord>(x: &mut T, a: T) {
    if *x < a {
        *x = a;
    }
}

fn merge<T: Ord + Copy>(mut a: Vec<T>, mut b: Vec<T>) -> Vec<T> {
    let mut c = Vec::with_capacity(a.len() + b.len());
    while !a.is_empty() && !b.is_empty() {
        if *a.last().unwrap() >= *b.last().unwrap() {
            c.push(a.pop().unwrap());
        } else {
            c.push(b.pop().unwrap());
        }
    }
    for a in a.into_iter().chain(b.into_iter()).rev() {
        c.push(a);
    }
    c.reverse();
    c
}

#[fastout]
fn run() {
    input! {
        n: usize,
        mut item: [(i32, i32); n],
        q: usize,
        ask: [(usize, i32); q],
    }
    while item.len() < MAX {
        item.push((0, 0));
    }
    item.insert(0, (0, 0));
    let mut query = vec![Some(vec![]); MAX + 1];
    for (i, &(v, w)) in ask.iter().enumerate() {
        query[v].as_mut().unwrap().push((w, 0, i));
    }
    for q in query.iter_mut() {
        q.as_mut().unwrap().sort();
    }
    for i in ((1 << MID)..MAX).rev() {
        let (v, w) = item[i];
        let a = query[i].take().unwrap();
        let b = a.iter().map(|a| (a.0 - w, a.1 + v, a.2)).collect::<Vec<_>>();
        let c = merge(a, b);
        query[i / 2] = Some(merge(query[i / 2].take().unwrap(), c));
    }
    let mut ans = vec![0; q];
    let mut stack = vec![(1, vec![(0, 0)])];
    while let Some((k, dp)) = stack.pop() {
        let (v, w) = item[k];
        let dp2 = dp.iter().map(|p| (p.0 + w, p.1 + v)).collect::<Vec<_>>();
        let dp = merge(dp, dp2);
        let query = query[k].take().unwrap();
        let mut val = std::i32::MIN / 2;
        let mut p = 0;
        for (rem, v, k) in query.into_iter() {
            while p < dp.len() && dp[p].0 <= rem {
                val = std::cmp::max(val, dp[p].1);
                p += 1;
            }
            chmax(&mut ans[k], val + v);
        }
        if 2 * k < 1 << MID {
            stack.push((2 * k, dp.clone()));
            stack.push((2 * k + 1, dp.clone()));
        }
    }
    for a in ans {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 121684
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>

using namespace std;
int N;

int main() {
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());

  int dup = 0;
  for (int i=1; i<N; i++) {
    if (A.at(i-1) == A.at(i)) {
      dup++;
    }
  }
  int ans;
  if (dup == 0) {
    ans = 0;
  } else {
    ans = (dup+1)/2;
  }
  cout << N-(ans*2) << endl;
}


Measured memory_bytes: 640
import sys
N, Y = map(int, input().split())
ans = 0
for i in range(N + 1):
    for j in range(N + 1):
        if i + j > N:
            continue
        if 10000 * i + 5000 * j + 1000 * (N - i - j) == Y:
            print(i, j, N - i - j)
            sys.exit()
print('-1 -1 -1')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
int gcd(int a, int b) {return b ? gcd(b, a % b) : a;}
int lcm(int a, int b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = res * a;
      a = a * a;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}
void go()
{
#ifndef ONLINE_JUDGE
  freopen("ip.txt","r",stdin);
  freopen("op.txt","w",stdout);
  #endif
}

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


int main() 
{ 
    fast_io
    go();
    int n;cin>>n;
    vi v(n);
    for0(i,n)
    cin>>v[i];
    int c=1;
    sort(v.rbegin(),v.rend());
    intt ans=v[0];
    for(int i=2;i<n;i++)
    {
      ans+=v[c];
      if(i%2)
        c++;
    }
    cout << ans <<"\n";



}    

Measured memory_bytes: 3976
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
    int n;
    double a[1000];
    double b[1000];
    double sum[5]={0,0,0,0,0};
    double ans[5]={0,0,0,0,0};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        sum[1] += abs(a[i]-b[i]);
    }
    for(int i=0;i<n;i++){
        sum[2] += pow(a[i]-b[i],2);
    }
    for(int i=0;i<n;i++){
        sum[3] += pow(abs(a[i]-b[i]),3);
    }
    for(int i=0;i<n;i++){
        sum[4]=max(sum[4],abs(a[i]-b[i]));
    }
    for(int i=1;i<=3;i++){
        ans[i]=pow(sum[i],1.0*1/i);
    }
    ans[4]=sum[4];
    for(int i=1;i<=4;i++){
        cout<<fixed<<setprecision(30)<<ans[i]<<endl;
    }
    return 0;
}



Measured memory_bytes: 3396
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
count = 0
for i in range(N):
    A = list(map(int,input().split()))
    sums = 0
    for j in range(M):
        sums += A[j]*B[j]
    sums+=C
    if sums > 0:
        count+=1
print(count)

Measured memory_bytes: 3060
///cREATED bY BERNARB.01
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef priority_queue<int,vector<int>,greater<int>> pqil;
typedef priority_queue<int> pqig;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef priority_queue<pii> pqiig;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int, int> mii;
#define mid ((l+r)/2)
#define PB push_back
#define PP pop_back
#define PF push_front
#define DF pop_front
#define F first
#define S second
#define MP make_pair
#define C continue
#define B break
#define R return
#define sz(v) (int)(v).size()
#define len(s) (int)(s).length()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(arr, x) memset((arr), (x), sizeof (arr))
#define loop(n) for(int i=0; i<(n); i++)
#define lop(a, n) for(int i=(a); i<(n); i++)
#define jloop(n) for(ll j=0; j<(n); j++)
#define rloop(n) for(ll i=(n)-1; i>=0; i--)
#define sgm(y) (((y)*((y)+1))/2)
const ll INF = 2e17+423;
const ll mod = 1e9+7; //998244353;
const ld pi = acos(-1.0);
const ld cmpf = 1e-9;
//__int128_t
//      -ASCII-
//a -> z | A -> Z | 0 -> 9
//97 122 | 65  90 | 48  57
#define endl '\n'
ll po(ll,ll);















int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, d, a;
  cin >> n >> d >> a;
  pii p[n];
  loop(n) cin >> p[i].F >> p[i].S;
  sort(p, p+n);
  ll ans = 0, c[n+9];
  int j=0;
  clr(c, 0);
  loop(n){
    if(i>0) c[i]+=c[i-1];
    if(p[i].S-(c[i]*a)<=0) C;
    int far = p[i].F+(2*d);
    while(p[j].F<=far&&j<n) j++;
    int bmbs = max((p[i].S-(c[i]*a)+a-1)/a, 0LL);
    c[i]+=bmbs;
    c[j]-=bmbs;
    ans+=bmbs;
  }
  cout << ans << endl;
  R 0;
}
/*

*/




























































ll po(ll x, ll n){
  if(n==0) R 1;
  ll y = po(x, n/2);
  y = ((y)*(y));
  if(n%2) y = (y*(x));
  R y;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n,m; cin>>n>>m;
  vpll ab(m);
  rep(i,m){
    ll a,b; cin>>a>>b;
    a--;
    ab[i]={a,b};
  }
  
  vb check(n);
  vll num(n);
  rep(i,m){
    ll a,b;
    tie(a,b)=ab[i];
    if(check[a]){
      if(num[a]!=b){
        cout<<-1<<endl;
        return 0;
      }
    }else{
      check[a]=true;
      num[a]=b;
    }
  }
  
  if(n==1){
    cout<<num[0]<<endl;
  }else{
    if(check[0]&&num[0]==0){
      cout<<-1<<endl;
      return 0;
    }
    if(!check[0]&&num[0]==0){
      num[0]=1;
    }
    rep(i,n){
      cout<<num[i];
    }
    cout<<endl;
  }
  
}


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

using namespace std;

int main(){
    string s,t; cin >> s >> t;

    int ans=0;
    for(int i=0;i<s.length();i++){
        if(s[i]!=t[i])ans++;
    }
    cout << ans << endl;

    
    return 0;
}

Measured memory_bytes: 3916
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define inf 100000000000000
#define mod 1000000007
#define ld long double
#define point complex<double>
#define pi  acos(-1)
#define IO                    \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
using namespace std;
long double dot (point a,point b)
{
	return (conj(a)*b).real();
}
long double theta(point a,point b)
{
	long double x=dot(a,b);
	x/=abs(a);
	x/=abs(b);
	return acos(x)*180/pi;
}
long double cross(point a,point b)
{
	return (conj(a)*b).imag();
}
long double arg2(point a)
{
	return arg(a)*180/pi;
}
int H,W,K;
string tab[11];
int res=0;
ll solve(vector<int>&hcut)
{
	ll arr[hcut.size()+1][W]={};
	ll cut=0;
	for(int i=0;i<W;i++)
	{
		cut=0;
		ll cnt=0;
		for(int ii=0;ii<H;ii++)
		{
			if(tab[ii][i]=='1')cnt++;
			if(ii==H-1||(cut<hcut.size()&&hcut[cut]==ii))
			{
				if(cnt>K)return inf;
				arr[cut][i]=cnt;
				cut++;
				cnt=0;
			}
		}
	}
	ll res=0;
	ll rem[hcut.size()+1]={};
	for(int i=0;i<W;i++)
	{
		for(int ii=0;ii<hcut.size()+1;ii++)
		{
			rem[ii]+=arr[ii][i];
			if(rem[ii]>K)
			{
				res++;
				i--;
				memset(rem,0,sizeof(rem));
				break;
			}
		}
	}
	return res;
}


ll crt(int cur,vector<int>&hcut)
{
	if(cur==H-1)
	{

		 int x=solve(hcut);
		 	/*cout<<x<<endl;
			for(auto h:hcut)
			{
				cout<<h<<" ";
			}
			cout<<endl;*/
		 return x;
	}
	int x=crt(cur+1,hcut);
	hcut.push_back(cur);
	 x=min(x,1+(int)crt(cur+1,hcut));
	hcut.pop_back();
	return x;
}
/*11100
10001
00111*/
int main()
{
    IO
		cin>>H>>W>>K;
		 for(int i=0;i<H;i++)
		 {
			 cin>>tab[i];
		 }
		 vector<int>v={};
		 cout<<crt(0,v);

    return 0;
}


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

int main() {
  int n;
  string s;
  bool found = false;

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == "Y") {
      found = true;
      break;
    }
  }

  if (found) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
N,A,B,C,D = map(int, input().split())
X = N//A
Y = N//C
S = (N//A)+1
T = (N//C)+1

if (N%A)==0:
    if (N%C)==0:
        print(min(X*B, Y*D))
    else:
        print(min(X*B, T*D))
else:
    if (N%C)==0:
        print(min(S*B, Y*D))
    else:
        print(min(S*B, T*D))


Measured memory_bytes: 5596
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#pragma warning(disable:4996) 

typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;



void solve()
{
    int n, K;
    scanf("%d%d", &n, &K);
    vector<int> a(n);
    int i;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    if (K > 100) {
        for (i = 0; i < n; i++) {
            printf("%d", n);
            if (i < n - 1) printf(" ");
            else printf("\n");
        }
        return;
    }

    int j;
    for (i = 0; i < K; i++) {
        vector<int> b(n+1,0);
        for (j = 0; j < n; j++) {
            int lim0 = MAX(0, j - a[j]);
            int lim1 = MIN(n - 1, j + a[j]);
            b[lim0]++;
            b[lim1 + 1]--;
        }
        for (j = 0; j < n; j++) {
            if (j == 0) {
                a[j] = b[j];
            }
            else {
                a[j] = a[j - 1] + b[j];
            }
        }
    }
    for (i = 0; i < n; i++) {
        printf("%d", a[i]);
        if (i < n - 1) printf(" ");
        else printf("\n");
    }


    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 4460
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	string s;
	while(cin>>s,s!="#"){
		set<string>se;
		se.insert(s);
		rep(i,25){
			set<string>ns;
			int t=25-i;
			for(auto a:se){
				rep(j,a.size())if(a[j]-'a'==t)goto end;
				else if(a[j]-'a'==t-1){
					
					a[j]++;
					ns.insert(a);
					a[j]--;
				}
				ns.insert(a);
				end:;
			}
			se=ns;
		}
		cout<<se.size()<<endl;
		if(se.size()<=10)for(auto a:se)cout<<a<<endl;
		else{
			auto it=se.begin();
			rep(i,5)cout<<(*it)<<endl,it++;
			it=se.end();
			rep(i,5)it--;
			rep(i,5)cout<<(*it)<<endl,it++;
		}
	}
}



Measured memory_bytes: 6684
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string N;
    while(cin >> N, N != "0000")
    {
        int cnt = 0;
        char ch = N.front();
        bool ok = false;
        for(int i = 0; i < N.size(); i++) if(ch != N[i]) ok = true;
        if(ok == false)
        {
            cout << "NA" << endl;
            continue;
        }
        while(N != "6174")
        {
            string L = N, S = N;
            sort(L.begin(), L.end(), greater<char>());
            sort(S.begin(), S.end());
            N = to_string(stoi(L) - stoi(S));
            while(N.size() != 4) N.insert(N.begin(), '0');
            cnt++;
        }
        cout << cnt << endl;
    }
    return 0;
}




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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX/3
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    LL ans = 0;
    for(int i=0;i<n;i++){
        ans += a[i]/2;
        a[i] %= 2;
        if(i == n-1) continue;
        if(a[i] == 1 && a[i+1] > 0){
            ans++;
            a[i] = 0;
            a[i+1]--;
        }
    }
    cout << ans << endl;
    return 0;
}


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

struct zt{
	int x , y , px , py;
	friend bool operator <(zt p , zt q){
		if(p.x != q.x) return p.x < q.x;
		if(p.y != q.y) return p.y < q.y;
		if(p.px != q.px) return p.px < q.px;
		return p.py < q.py;
	}
}; map < zt , long long > dp;
long long N , arr[19];

long long search(int p , int q , int px , int py){
	if(q - p == 1) return 0;
	zt cur = (zt){p , q , px , py};
	if(dp.find(cur) != dp.end()) return dp[cur];
	long long ans = 1e18;
	for(int i = p + 1 ; i < q ; ++i)
		ans = min(ans , search(p , i , px , px + py) + search(i , q , px + py , py) + arr[i] * (px + py));
	return dp[cur] = ans;
}

int main(){
	cin >> N; for(int i = 1 ; i <= N ; ++i) cin >> arr[i];
	cout << search(1 , N , 1 , 1) + arr[1] + arr[N]; return 0;
}


Measured memory_bytes: 16512
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<< C <<endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EB emplace_back
#define FORE(a, b) for (auto &&a:b)
#define FIND(s, n) (s.find(n) != s.end())

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;

int main(void) {
    int T; cin >> T;
    REP(i, T) {
        int n, d; cin >> n >> d;
        int ans = 0;
        REP(i, n - 1) {
            int buf = 127 ^ d;
            ans += 127;
            d = buf;
        }
        ans += d;
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
'use strict'
function main(inp) {
  inp = Number(inp.trim())
  const sqrt = Math.floor(Math.sqrt(inp))
  for (let i = sqrt; i > 0; i--) {
    if (inp % i == 0) {
      console.log(i + (inp / i) - 2)
      break;
    }
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 9420
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 998244353
#define MAX 200003

int main(){
  int N;
  cin>>N;
  vector<int> count(N+1,0);
  for(int i=1;i<=100;i++){
    for(int j=1;j<=100;j++){
      for(int k=1;k<=100;k++){
        int x=i*i + j*j + k*k + i*j + j*k + k*i;
        if(x>N){
          continue;
        }
        count.at(x)++;
      }
    }
  }

  for(int i=1;i<=N;i++){
    cout<<count.at(i)<<endl;
  }
}


Measured memory_bytes: 3608
#include<stdio.h>

void insertionsort( int a[] , int n );
void output( int a[] , int n );

int main( void )
{
    int n;
    scanf( "%d" , &n );
	
	int a[n];
	int i;
	
	for( i = 0;  i < n; i++ ){
		
		scanf( "%d" , &a[i] );
		
	}
	
	output( a , n );
	
	insertionsort( a , n );
	
	return 0;
	
}

void insertionsort( int a[] , int n ){
	
	int i , j;
	int v;
	
	for( i = 1;  i <= n - 1; i++ ){
		
		v = a[i];
		j = i - 1;
		
		while( j >= 0 && a[j] > v ){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		output( a , n );
	}
	
}

void output( int a[] , int n ){
	
	int i;
	
	for( i = 0;  i < n; i++ ){
		
		if( i > 0 ){
			printf( " " );
		}
		
		printf( "%d" , a[i] );
		
	}
	
	printf( "\n" );
}


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

bool prime[1000003];
bool sieve() {
    memset(prime, true, sizeof(prime));
    for(int i = 2; i * i < 1000003; ++i){
        if(prime[i]){
            for(int j = 2 * i; j < 1000003; j += i){
                prime[j] = false;
            }
        }
    }
}
long long fact(int n) {
    long long ans = 1;
    for(int i = 2; i <= n; ++i) ans *= i;
    return ans;
}

int main() { 
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i) a[i] = i;
    int x[n], y[n];
    for(int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
    } 
    double sum = 0;
    do {
        for(int i = 0; i < n - 1; ++i) {
            sum += sqrt(pow(x[a[i]] - x[a[i+1]], 2) + pow(y[a[i]] - y[a[i+1]], 2));
        }
    } while (next_permutation(a,a+n));
    cout << fixed << setprecision(6) <<sum / fact(n) << endl;
    
}


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
t = 0
for i,b in enumerate(B):
    m = min(A[i], b)
    b -= m
    A[i] -= m
    t += m
    m = min(A[i+1], b)
    b -= m
    A[i+1] -= m
    t += m
print(t)

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

#define N 100

int count[N + 1];

int main(void)
{
    int a, max, i;

    memset(count, 0, sizeof(count));

    while(~scanf("%d", &a))
        count[a]++;


    max = 0;
    for(i=1; i<=N; i++)
        if(count[i] > max)
            max = count[i];


    for(i=1; i<=N; i++)
        if(count[i] == max)
            printf("%d\n", i);

    return 0;
}



Measured memory_bytes: 1972
// 問題の URL を書いておく
// 

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <numeric>
#include <list>
#include <set>
using namespace std;

//#define ENABLE_PRINT

template<typename T>
T Input()
{
    T v;
    cin >> v;
    return v;
}

template<typename T>
vector<T> InputVector(int n)
{
    vector<T> v(n);
    for(int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
    return v;
}

template<typename T>
void InputArray(T* begin, int n)
{
    for(int i = 0; i < n; ++i)
    {
        cin >> begin[i];
    }
}

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

#define rep(i, n) for(int i = 0; i < (int)(n); ++i)

int main(int, const char**)
{
    int n;
    cin >> n;
    auto as = InputVector<int>(n);
    sort(as.begin(), as.end());
    set<int> invalids;
    
    auto aMax = *as.rbegin();
    int count = 0;
    rep(i, n)
    {
        if(invalids.find(as[i]) != invalids.end())
        {
            continue;
        }
        for(int j = as[i] * 2; j <= aMax; j += as[i])
        {
            invalids.insert(j);
        }
        if(i < n - 1 && as[i] == as[i + 1])
        {
            invalids.insert(as[i]);
            continue;
        }
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 50668
n,m=map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
    a[i]+=[sum(a[i])]
    print(*a[i])
a=list(zip(*a[::-1]))
for i in range(m):print(sum(a[i]),end=' ')
print(sum(a[m]))



Measured memory_bytes: 5768
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

char str[100005];
ll dp[100005][2][101];      // keta,smaller,amari

int main(int argc, char* argv[])
{
    int D;
    scanf("%s", str);
    scanf("%d", &D);

    int len=strlen(str);

    dp[0][0][0]=1;
    int i,j,k,m;
    for(i=0; i<len; i++) {
        int tmp=str[i]-'0';
        for(j=0; j<2; j++) {
            for(k=0; k<=(j? 9: tmp); k++) {
                for(m=0; m<D; m++) {
                    dp[i+1][j || k<tmp][(m+k)%D] += dp[i][j][m];
                    dp[i+1][j || k<tmp][(m+k)%D] %= MOD;
                }
            }
        }
    }
    printf("%lld\n", (dp[len][1][0]+dp[len][0][0]-1+MOD)%MOD);

    return 0;
}


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

int K,T,a[10010];

int main(){
    cin >> K >> T;

    int i,x;
    for (i=1; i<=T; i++){
        cin >> x;
        if (2*x>K+1){
            cout << (2*x-K-1) << "\n";
            return 0;
        }
    }

    cout << 0 << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int H,W,N;
	cin >> H >> W >> N;
	int sx,sy;
	cin >> sx >> sy;
	sx--,sy--;
	string s,t;
	cin >> s >> t;
	rep(_,2){
		int L = 0, R = W-1;
		for(int i=N-1;i>=0;i--){
			if(t[i] == 'L') R = min(R+1,W-1);
			if(t[i] == 'R') L = max(L-1,0);

			if(s[i] == 'L') L++;
			if(s[i] == 'R') R--;

			if(L > R){
				cout << "NO" << endl;
				return 0;
			}
		}
		if(sy<L || R<sy){
			cout << "NO" << endl;
			return 0;
		}

		swap(H,W);
		swap(sx,sy);
		for(char& c: s){
			if(c == 'L' || c == 'U') c = 'L'^'U'^c;
			else c = 'R'^'D'^c;
		}
		for(char& c: t){
			if(c == 'L' || c == 'U') c = 'L'^'U'^c;
			else c = 'R'^'D'^c;
		}
	}
	cout << "YES" << endl;
}


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

int n,k,dist[2010],ans=1e9;
queue<int> q;
vector<int> pos[2010];

inline void bfs()
{
	while(!q.empty())
	{
		int cur=q.front();
		q.pop();
		for(int j:pos[cur])
		{
			int w=dist[cur]+2;
			if(dist[j]<=w) continue;
			dist[j]=w;
			q.push(j);
		}
	}
}

inline int solveVertex(int i)
{
	fill(dist,dist+n,1e9);
	dist[i]=0;
	
	q.push(i);
	bfs();
	int sum=0;
	for(int j=0;j<n;j++) if(dist[j]>k) sum++;
	
	return sum;
}

inline int solveEdge(int i,int j)
{
	fill(dist,dist+n,1e9);
	dist[i]=dist[j]=1;
	
	q.push(i);
	q.push(j);
	bfs();
	int sum=0;
	for(int m=0;m<n;m++) if(dist[m]>k) sum++;
	
	return sum;
}

int main()
{
	cin>>n>>k;
	for(int i=0;i<n-1;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;b--;
		pos[a].push_back(b);
		pos[b].push_back(a);
	}
	
	for(int i=0;i<n;i++) ans=min(ans,solveVertex(i));
	for(int i=0;i<n;i++)
		for(int j:pos[i])
			if(j>i) ans=min(ans,solveEdge(i,j));
	
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 512
n = int(input())
d = [0]*n
res = 0
for i in range(1, int(n**0.5)+1):
    for j in range(1, int(n**0.5)+1):
        for k in range(1, int(n**0.5)+1):
            res = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if res <= n:
                d[res-1] += 1

#print(d)
for i in range(n):
    print(d[i])

Measured memory_bytes: 74928
#include <stdio.h>
#include <math.h>
#define rep(i,l,n) for(i=l;i<n;i++)

int main(void){
	double x[101],y[101],s[101];
	double n,d1,d22,d2,d33,d3,d8,max;
	int i;
	
	scanf("%lf",&n);
	
	rep(i,0,n) scanf("%lf",&x[i]);
	rep(i,0,n) scanf("%lf",&y[i]);
	
	max=0;
	rep(i,0,n){
		s[i]=fabs(x[i]-y[i]);
		d1+=s[i];
		d22+=pow(s[i],2);
		d33+=pow(s[i],3);
		if(s[i]>max) max=s[i];
	}
	
	d2=pow(d22,0.5);
	d3=pow(d33,1.0/3);
	d8=max;
	
	printf("%lf\n%lf\n%lf\n%lf\n",d1,d2,d3,d8);
	
	return 0;
}

Measured memory_bytes: 712
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,k,s=0;
    cin>>n>>k;
    int num[n];
    for(int i=0;i<n;i++)
        cin>>num[i];
    sort(num,num+n);
    for(int i=0,j=n-1;i<k;i++,j--)
        s+=num[j];
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
int inf_int=2e9;
ll inf_ll=1e18;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
const double pi=3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz size()

bool debug=0;
const int MAXN=2000;
int mod=1e9+9;


#define rank asfalgalsglasgllzxdgl


void solve()
{
    int x,y,x1,y1;
    cin >> x >> y >>x1 >> y1;

    for(int i=y;i<y1;++i)
    {
        cout << "U";
    }
    for(int i=x;i<x1;++i)
    {
        cout <<"R";
    }
    for(int i=y;i<y1;++i)
    {
        cout << "D";
    }
    for(int i=x;i<x1;++i)
    {
        cout <<"L";
    }
    cout << "L";
    for(int i=y;i<y1+1;++i)
    {
        cout << "U";
    }
    for(int i=x;i<x1+1;++i)
    {
        cout <<"R";
    }
    cout <<"D";
    cout << "R";
    for(int i=y;i<y1+1;++i)
    {
        cout << "D";
    }
    for(int i=x;i<x1+1;++i)
    {
        cout <<"L";
    }
    cout <<"U";
}


#define FILE "stupid_rmq"
int main()
{
        #ifdef zxc
            freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
        #endif // zxc

    //    freopen(FILE".in","r",stdin);
   //   freopen(FILE".out","w",stdout);

       if(!debug)
       {
            ios_base::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
       }

        int t=1;
         while(t--)
            solve();

        return 0;
}


Measured memory_bytes: 384
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
S = np.array([list(map(int, input().split())) for i in range(D)])

last_day = np.zeros(26, dtype=int)
score = 0

def calc(d, i, last_day):
    decrease = c * (d - last_day)
    decrease[i] = 0
    return S[d, i] + decrease.sum()

ans = []
for d in range(1, D+1):
    diff = [calc(d-1, i, last_day) for i in range(26)]
    choice = np.argmax(diff)
    ans.append(choice+1)
    last_day[choice] = d

print(*ans, sep='\n')

Measured memory_bytes: 27512
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
  int N,K;
  cin>>N>>K;
  double E[N];
  double p;
  for(int i=0;i<N;i++){
    cin>>p;
    E[i]=(p+1.0)/2;
  }
  double s=0;
  for(int i=0;i<K;i++){
    s+=E[i];
  }
  double retval=s;
  for(int i=0;i<N-K;i++){
    s-=E[i];
    s+=E[i+K];
    retval=max(s,retval);
  }
  printf("%.16f\n",retval);
  return 0;
}


Measured memory_bytes: 1792
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        BufferedReader bu = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String [] inp = bu.readLine().split(" ");
        int n = Integer.parseInt(inp[0]), k = Integer.parseInt(inp[1]);
        inp = bu.readLine().split(" ");
        int [] arr = new int[n];
        for (int pos = 0; pos < n; pos++) {
            arr[pos] = Integer.parseInt(inp[pos]);
        }

        for (int pos = k; pos < n; pos++) {
            if (arr[pos] > arr[pos-k])
                sb.append("Yes\n");
            else
                sb.append("No\n");
        }
        System.out.print(sb);
    }
}


Measured memory_bytes: 62568