akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#define endl '\n'
//#define ll long long
#define mod 1000000007
#define NCONS 200001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;
ll gcd(ll a, ll b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

int food[31];
int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    for(int i = 0; i < n; i++)
    {
        int k; cin >> k;
        while(k--)
        {
            int a; cin >> a;
            food[a] += 1;
        }
    }
    int cnt = 0;
    
    for(int i = 1; i <= m; i++)
        if(food[i] == n)
            cnt += 1;
    cout << cnt << endl;
    
    
   
    return 0;
}


/*
 
 
 */


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

using namespace std;

int c[20],a[20][20],b[20];
long long sum = 0x3f3f3f3f3f3f;
int n,m,x,flag = 0;
bool check(){
for(int i = 1;i <= m;i++)
    if(b[i]<x) return false;
return true;
    }
void dfs(int p,int q,long long l)//0 no 1 yes
{
    if(check())
    {sum = min(l,sum);
     flag = 1;
     return ;
    }
    if(p>n)return;
    if(q==1)
    {
        for(int i = 1;i<=m;i++)
            b[i]+=a[p][i];
        dfs(p+1,0,l+a[p][0]);
        dfs(p+1,1,l+a[p][0]);
        for(int i = 1;i<=m;i++)
            b[i]-=a[p][i];
    }
    if(q==0)
    {
        dfs(p+1,0,l);
        dfs(p+1,1,l);
    }
}
int main(){

  cin>>n>>m>>x;
  for(int i =1 ;i <= n;i++)
    for(int j =0 ;j <= m;j++)
       cin>>a[i][j];
  memset(b,0,sizeof(b));
  dfs(1,0,0);
  memset(b,0,sizeof(b));
  dfs(1,1,0);
  if(!flag ) cout<<"-1"<<endl;
  else
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3628
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int n,k; 
  cin >> n >> k;
  
  int ans = 0;
  ll b = 1;
  REP(i,50){
    if(b > n){
      break;
    }
    b *= k;
    ans++;
  }
  
  cout << ans << endl;
}

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

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

    if(n==0)break;

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

    int dif = 1000001;
    for(int i=0; i<n-1; i++){
      for(int j=i+1; j<n; j++){
        int d = abs(a[i]-a[j]);
        if(d<dif){
          dif=d;
        }
      }
    }

    cout << dif << endl;
  }

  return 0;
}



Measured memory_bytes: 3108
N = int(input())
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x - X) + abs(y - Y) <= t - T and t % 2 == (x + y) % 2:
        count += 1
    T, X, Y = t, x, y
print("Yes" if count == N else "No")


Measured memory_bytes: 3060
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		while (true)
		{
			int n = sc.nextInt(),
				p = sc.nextInt();
			if (n == 0 && p == 0) break;
			int candidate[] = new int[n];
			int index = 0, current = p;
			while (true)
			{
				if (current > 0)
				{
					candidate[index]++;
					current--;
				}
				else
				{
					current = candidate[index];
					candidate[index] = 0;
				}
				if (candidate[index] == p)
				{
					break;
				}
				index++;
				if (index == n) index = 0;
			}
			System.out.println(index);
		}
	}
}

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

#define lli long long int
#define LLI(n) \
  lli n;       \
  cin >> n;
#define LLIV(a, n)            \
  vector<lli> a(n);           \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define STR(n) \
  string n;    \
  cin >> n;
#define Sort(n) sort(n.begin(), n.end());
#define Reve(n) reverse(n.begin(), n.end());
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define C45(n) (n + 1) / 2
#define OUT(n) cout << n << endl;
#define SRC(n, c)                    \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    if (s.at(i) == c)                \
    {                                \
      n++;                           \
    }                                \
  };
#define ZISYO(s, S)                  \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    S.at(i) = s.at(i);               \
  }                                  \
  Sort(S) Reve(S) for (lli i = 0; i < s.size(); i++) { s.at(i) = S.at(i); };

//素数
bool IsPrime(lli num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}
//各桁の和
lli Sum(lli n)
{
  lli sum = 0;
  if (n < 0)
    return 0;
  while (n > 0)
  {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(void)
{
  ios::sync_with_stdio(false);
  STR(s)
  vector<char> S(s.size());           \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    S.at(i) = s.at(i);               \
  }                                  \
  Sort(S) for (lli i = 0; i < s.size(); i++) { s.at(i) = S.at(i); };
  STR(t)
  vector<char> T(t.size());
  ZISYO(t, T)
  if (s < t) yes else no return 0;
}


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int X, Y;
    cin >> X >> Y;
    cout << X +  Y / 2 << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 256
$stdin = DATA if $stdin.eof?

a, b, c = gets.split.map(&:to_i)

puts a * b * Math.sin(c * Math::PI / 180) / 2
puts a + b + Math.sqrt(a**2 + b**2 - (2 * a * b * Math.cos(c * Math::PI / 180)))
puts b * Math.sin(c * Math::PI / 180)

__END__
4 3 90

Measured memory_bytes: 6180
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <map>
#include <array>
#include <cmath>

using namespace std;

int PRIME = 1000000007;

map<string, int> table{
    {"SUN", 7},
    {"MON", 6},
    {"TUE", 5},
    {"WED", 4},
    {"THU", 3},
    {"FRI", 2},
    {"SAT", 1}
};

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


    long long N, P;
    cin >> s;
    cout << table[s];


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

int main(){
	
    ll n;cin>>n;
    ll a[n+1];
    
    map<ll,ll>mpp;
    ll ans=0;
    
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    	ans+=mpp[i-a[i]];
    	mpp[a[i]+i]++;
	}
	
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 27824
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
 #define rep(i, n) for (int i = 0; i < (int)(n); i++)
 #define big 1000000007
 #define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
//dequeを使えばもっと速くできる
int main(){
    int n;
    cin>>n;
    deque<int> d;
    rep(i,n){
        int a;
        cin>>a;
        if(i%2==0){
            d.push_back(a);
        }
        else{
            d.push_front(a);
        }
    }
    if(n%2==0){
        rep(i,n){
            cout<<d[i]<<" ";
        }
    }
    else{
        for(int i=n-1;i>=0;i--){
            cout<<d[i]<<" ";
        }
    }
    cout<<endl;
}

Measured memory_bytes: 2944
//
//  main.cpp
//  B - Theater
//
//  Created by wenhan on 2017/9/9.
//  Copyright © 2017年 wenhan. All rights reserved.
//

#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;
    int x,y;
    int s=0;
    while(n--)
    {
        cin>>x>>y;
        s+=(y-x+1);
    }
    cout<<s<<endl;
    // insert code here...
    //std::cout << "Hello, World!\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<queue>

using namespace std;

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

map<string, int> mp;
struct edge{int to, cost;};
vector<edge> dis[600];
int d[600];

int main() {
  int n, m;
  for (;;) {
    cin >> n >> m;
    if (n == 0 && m == 0) break;
    string s, a, g;
    rep (i, 600) dis[i].clear();
    cin >> s>> a>> g;
    mp.clear();
    mp[s] = 0;
    mp[a] = 1;
    mp[g] = 2;
    int count = 3;
    rep (i, m) {
      string sa, sb;
      int cost, pen;
      int aa, bb;
      cin >> sa >> sb >> cost >> pen;
      cost = cost / 40 + pen;
      if (mp.count(sa)) aa = mp[sa];
      else mp[sa] = aa = count++;
      if (mp.count(sb)) bb = mp[sb];
      else mp[sb] = bb = count++;
      edge e;
      e.to = bb;
      e.cost = cost;
      dis[aa].push_back(e);
      e.to =  aa;
      dis[bb].push_back(e);
      //cout << sa << " " << aa << " " << sb <<" " << bb <<" " << cost << endl;
    }
    rep (i, 600) d[i] = 100000000;
    priority_queue<pair<int, int> ,vector<pair<int,int> > ,greater<pair<int, int> > > que;
    que.push(make_pair(0, 0));
    while (!que.empty()) {
      pair<int, int> now = que.top();
      //cout << now.first << " " << now.second << endl;
      que.pop();
      if (now.first >= d[now.second]) continue;
      d[now.second] = now.first;
      rep (i, dis[now.second].size()) {
	que.push(make_pair(now.first+dis[now.second][i].cost, dis[now.second][i].to));
      }
    }
    //cout << mp[a] << endl;
    int res = d[mp[a]];
    //cout << res << endl;
    rep (i, 600) d[i] = 100000000;
    que.push(make_pair(0, 1));
    while (!que.empty()) {
      pair<int, int> now = que.top();
      //cout << now.first << " " << now.second << endl;
      que.pop();
      if (now.first >= d[now.second]) continue;
      d[now.second] = now.first;
      rep (i, dis[now.second].size()) {
	que.push(make_pair(now.first+dis[now.second][i].cost, dis[now.second][i].to));
      }
    }
    res += d[mp[g]];
    cout << res << endl;
  }
}

Measured memory_bytes: 1280
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;



int main()
{
	int n;
	cin >> n;
	vector<vector<int>> grid(2, vector<int>(n));

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

	int ans = 0;
	for (int i = 0; i < n; i++) {
		int  temp = 0;
		for (int j = 0; j < n; j++) {
			if (j < i) {
				temp += grid[0][j];
			}
			if (j == i) {
				temp += (grid[0][j] + grid[1][j]);
			}
			if (j > i) {
				temp += grid[1][j];
			}
		}
		ans = max(ans, temp);
	}

	cout << ans << endl;

	return 0;
}


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

int main() {
  int now=0;
  string s;
  cin>>s;
  rep(i, 4) {
    if (s[i] == '+') now++;
    else now--;
  }
  cout<<now<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
  VI a(n); rep(i,n) cin>>a[i];
  int ans = 0;
  rep(i,n){
    while(i+1<n&&a[i]==a[i+1]) i++;
    if(i+1<n&&a[i]<a[i+1]){
      while(i+1<n&&a[i]<=a[i+1]) i++;
    }else if(i+1<n&&a[i]>a[i+1]){
      while(i+1<n&&a[i]>=a[i+1]) i++;
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
  string x, y;
  cin >> x >> y;
  if(x.size()>y.size()) {
    cout << "GREATER";
    return 0;
  }
  else if(x.size()<y.size()) {
    cout << "LESS";
    return 0;
  }
  else {
    for(int i=0; i<x.size(); i++) {
      if(x[i]>y[i]) {
        cout << "GREATER";
        return 0;
      }
      else if(x[i]<y[i]) {
        cout << "LESS";
        return 0;
      }
    }
    cout << "EQUAL";
  }
  return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	int n, m, i;
	int is[100000];
	scanf("%d%d", &n, &m);
	memset(is, 0, n*sizeof(int));
	int ans[2]={0,0};
	for(i=0; i<m; i++){
		int p;
		char s[5];
		scanf("%d%s", &p, s);
		if(is[p]>=0){
			if(s[0]=='A'){
				ans[0]++;
				ans[1]+=is[p];
				is[p]=-1;
			}else{
				is[p]++;
			}
		}
	}
	printf("%d %d\n", ans[0], ans[1]);
}


Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

/*
// WA

int64 div_ceil(int64 lhs, int64 rhs){ return (lhs-1)/rhs + 1; }

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int64 N; cin >> N;
    
    uint num=5;
    vector<int64> v(num); for(uint i=0; i<5; ++i){ cin >> v[i]; }
    
    int64 sum=0;
    int64 min_v=N;
    for(uint i=0; i<num; ++i){
        sum += (v[i] < min_v) ? div_ceil(min_v, v[i]) : 1ull;
        min_v = min(min_v, v[i]);
    }
    
    cout << sum << endl;
    
    return 0;
}
*/

int64 div_ceil(int64 lhs, int64 rhs){ return (lhs-1)/rhs + 1; }

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int64 N; cin >> N;
    
    uint num=5;
    vector<int64> v(num); for(uint i=0; i<5; ++i){ cin >> v[i]; }
    int minIdx  = min_element(v.begin(), v.end()) - v.begin();
    int minIdx2 = min_element(v.begin(), v.begin() + minIdx) - v.begin();
    
    int64 v_min1 = v[minIdx ];
    int64 v_min2 = v[minIdx2];
    int64 sum = 3 + div_ceil(N, v_min1) + div_ceil(v_min1, v_min2);
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct point{
	double x,y;
	point(){}
	point(double _x,double _y){
		x=_x;y=_y;
	}
	point operator -(const point &b) const{
		return point(x-b.x,y-b.y);
	}
	double operator ^(const point &b) const{
		return (x*b.x)+(y*b.y);
	}
	double operator *(const point &b) const{
		return x*b.y-y*b.x;
	}
};
double len(point p){
	return (p.x*p.x+p.y*p.y);
}
int solve(point p0,point p1,point p2){
	if((p1-p0)*(p2-p0)>0) return 1;
	if((p1-p0)*(p2-p0)<0) return 2;
	if(((p1-p0)^(p2-p0))<0) return 3;
	if(len(p1-p0)<len(p2-p0)) return 4;
	return 5;
}
int main(){
	point p0,p1;
	int q;
	point p2;
	cin>>p0.x>>p0.y>>p1.x>>p1.y;
	cin>>q;
	for(int i=1;i<=q;++i){
		cin>>p2.x>>p2.y;
		switch(solve(p0,p1,p2)){
			case 1: puts("COUNTER_CLOCKWISE");break;
			case 2: puts("CLOCKWISE");break;
			case 3: puts("ONLINE_BACK");break;
			case 4: puts("ONLINE_FRONT");break;
			case 5: puts("ON_SEGMENT");break;
		}
	}
	return 0;
}


Measured memory_bytes: 3224
void main() {
	auto N = ri;
	auto A = N.iota.map!(v => ri).array;
	auto arr = new int[](N), arr2 = new int[](N);
	arr[0] = A[0];
	arr2[$ - 1] = A[$ - 1];
	foreach(i; 1..N) {
		arr[i] = max(arr[i-1], A[i]);
	}
	foreach_reverse(i; 0..N-1) {
		arr2[i] = max(arr2[i+1], A[i]);
	}
	debug arr.writeln;
	debug arr2.writeln;
	writeln(arr2[1]);
	foreach(i; 1..N-1) {
		writeln(max(arr[i-1], arr2[i+1]));
	}
	writeln(arr[$ - 2]);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 6268
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <array>
#include <map>
#include <set>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> ds(n);
    for (auto &d : ds)
    {
        cin >> d;
    }
    sort(ds.begin(), ds.end());
    cout << (ds[n/2] - ds[n/2-1]) << endl;


}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n, k;
    cin >> n >> k;
    int a[n+1];
    int cnt = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for (int i = 0; i < n; i++){
        if(a[i] >= k){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 640
N, Y = map(int, input().split())
Y //= 1000
tmp_a = Y//10 + 1
tmp_b = Y//5 + 1

for i in range(tmp_a):
    for j in range(tmp_b):
        k = N-(i+j)
        if k>=0 and 10*i+5*j+k==Y:
                print(i,j,k)
                exit()
print('-1 -1 -1')

Measured memory_bytes: 3060
#include<stdio.h>

int main()
{
	double d[10],v[2],sum,t,d_end;
	int i,er;

	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",d,d+1,d+2,d+3,d+4,d+5,d+6,d+7,d+8,d+9,v,v+1)!=EOF)
	{
		sum=0.0;
		er=1;
		for(i=0;i<10;i++)
		{
			if(d[i]<=0.0)
			{
				er=1;
				break;
			}
			sum+=d[i];
		}

		t=sum/(v[0]+v[1]);
		d_end=v[0]*t;
		sum=0.0;

		for(i=0;i<10;i++)
		{
			if(sum<d_end && sum+d[i]>=d_end)
			{
				printf("%d\n",i+1);
				break;
			}
			sum+=d[i];
		}

	}
	return 0;
}

Measured memory_bytes: 624
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pii pair<int,int>
#define point pair<double,double>
#define segment pair<point,point>
#define circle pair<point,double> //titik pusat, radius
#define line pair<double,double> //m,c
#define ins insert
#define er erase

#define FORU(a,b,c) for(int a=b; a<=c; a++)
#define FORD(a,b,c) for(int a=b; a>=c; a--)
#define FOR(a,b) for(int a=1; a<=b; a++)
#define FORA(a,b) for(auto (a) : (b))

const double EPS = 1e-9;
const double PI = acos(-1);
const int MOD = 1e9+7;

#define yu using
#define don namespace
#define sei std

yu don sei;

//const int nPrime=100000;
//bool isprime[nPrime];
//vector<int>prime;
//
//void pre()
//{
//	memset(isprime,1,sizeof(isprime));
//	isprime[1]=0;
//	for(int i=2;i*i<=nPrime;i++)
//	{
//		for(int j=i*i;j<nPrime;j+=i)
//		{
//			isprime[j]=0;
//		}
//	}
//	for(int i=2;i<nPrime;i++)
//	{
//		if(isprime[i])prime.pb(i);
//	}
//}

// ll pwr(ll b,ll e)
// {
// 	if(e==0)return 1;
// 	if(e==1)return b;
// 	ll temp=power(b,e/2);
// 	if(e%2==0)
// 	{
// 		return (temp*temp);
// 	}
// 	else
// 	{
// 		return (temp*temp*b);
// 	}
// }

// ll modpow(ll b,ll e)
// {
// 	b%=MOD;
// 	if(e==0)return 1;
// 	if(e==1)return b%MOD;
// 	ll temp=power(b,e/2);
// 	if(e%2==0)
// 	{
// 		return (temp*temp) %MOD;
// 	}
// 	else
// 	{
// 		return ((temp*temp %MOD )*b)%MOD;
// 	}
// }

ll gcd(ll a,ll b)
{
	if(b==0)return a;
	return gcd(b,a%b);
}

//int n,m;

//bool valid(int x,int y)
//{
//	if(x<0)return 0;
//	if(y<0)return 0;
//	if(x>=n)return 0;
//	if(y>=m)return 0;
//	return 1;
//}

//int p[]={-1,0,1,0};
//int q[]={0,1,0,-1};

//int p[]={-1,-1,-1,0,0,1,1,1};
//int q[]={-1,0,1,-1,1,-1,0,1};

point add(point a,point b)
{
	return {a.fi+b.fi,a.se+b.se};
}

point sub(point a,point b)
{
	return {a.fi-b.fi,a.se-b.se};
}

double dist(point a,point b)
{
	return ((a.fi-b.fi)*(a.fi-b.fi) + (a.se-b.se)*(a.se-b.se));
}

double rdist(point a,point b)
{
	return sqrt((a.fi-b.fi)*(a.fi-b.fi) + (a.se-b.se)*(a.se-b.se));
}

double distPS(point a,segment b)//heron formula, extreemely prone to precison error
{
	double AB=rdist(a,b.fi);
	double AC=rdist(a,b.se);
	double BC=rdist(b.fi,b.se);
	double s=AB+AC+BC;
	s/=2.0;
	return 2*sqrt(s*(s-AB)*(s-BC)*(s-AC))/BC;
}

double dabs(double a)
{
	if(a+EPS>0)return a;
	return -a;
}

double dotProduct(point a,point b)
{
	return a.fi*b.fi + a.se*b.se;
}

double crossProduct(point a,point b)
{
	return a.fi*b.se - a.se*b.fi;
}

int ccw(point a,point b,point c)// -1 CCW 0 COL 1 CW
{
	double tmp=crossProduct(sub(b,a),sub(c,a));
	if(tmp>EPS)
	{
		return -1;
	} 
	else if(tmp<-EPS)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

point intLiLi(point a,point b,point c,point d)
{
	return mp(((a.fi*b.se-b.fi*a.se)*(c.fi-d.fi) - (a.fi-b.fi)*(c.fi*d.se-d.fi-c.se))/((a.fi-b.fi)*(c.se-d.se) - (a.se-b.se)*(c.fi-d.fi) ),
			((a.fi*b.se-b.fi*a.se)*(c.se-d.se)-(a.se-b.se)*(c.fi*d.se-d.fi*c.se))/((a.fi-b.fi)*(c.se-d.se) - (a.se-b.se)*(c.fi-d.fi) ));
}

int main()
{
	int n,k;
	cin>>n>>k;
	cout<<ceil((double)(n-1)/(k-1))<<endl;
	return 0;
}

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

int main() {
 string s;
  int k;
  cin >> k >> s;
  if(s.size() <= k) cout << s <<endl;
  else{
    for(int i =0; i<k; i++){
     cout<< s.at(i); 
    }
    cout << "..." << endl;
  }
 
}

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

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define pf push_front
#define pof pop_front
#define pob pop_back
#define ull unsigned long long
#define ll long long
#define sz(a) a.size()
#define all(s) s.begin(), s.end()
#define rall(s, n) s, s + n
#define x first
#define y second
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define pii pair <int, int>
#define pll pair <ll, ll>
#define INF 1000000000
#define mod 1000000007
#define reset(a, nilai) memset(a, nilai, sizeof(a))
using namespace std;

string s;
int main () {
	IOS;

	cin >> s;
	if ((s[0] != s[1]) && (s[2] == s[3]) && (s[4] == s[5])) {
		cout << "Yes";
	} else {
		cout << "No";
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc121b()
}

fun abc121b() {
    val (n, m, c) = readLine()!!.split(" ").map { it.toInt() }
    val b = readLine()!!.split(" ").map { it.toInt() }
    var count = 0
    repeat(n) {
        val a = readLine()!!.split(" ").map { it.toInt() }
        var total = 0
        for (i in 0 until m) {
            total += a[i] * b[i]
        }
        total += c
        if (total > 0) count++
    }
    println(count)
}

Measured memory_bytes: 37688
// これはヒントですがにぶたんはオーバーキルっつーかキルできねぇTLEなったわ
// fmt.Scan()だとTLEなるのでこしらえた

package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()

	X, Y, A, B, C := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()
	P, Q, R := nextInts(A), nextInts(B), nextInts(C)
	sort.Sort(sort.Reverse(sort.IntSlice(P)))
	sort.Sort(sort.Reverse(sort.IntSlice(Q)))
	R = append(R, P[:X]...)
	R = append(R, Q[:Y]...)
	sort.Sort(sort.Reverse(sort.IntSlice(R)))
	ans := 0
	for i := 0; i < X+Y; i++ {
		ans += R[i]
	}
	fmt.Fprintln(out, ans)
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}


Measured memory_bytes: 10752
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define REP(i, n) rep (i, n)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define CLR(a) memset((a),0,sizeof(a))
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
template<typename T,typename U> ostream& operator<< (ostream& out, const pair<T,U>& val){return out << "(" << val.F << ", " << val.S << ")";}
template<class T> ostream& operator<< (ostream& out, const vector<T>& val){out << "{";rep(i,SZ(val)) out << (i?", ":"") << val[i];return out << "}";}
void pkuassert(bool t){t=1/t;};
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};

int m,n;

void solve(){
  cin >> m >> n;
  for(int i=1;i*i<=m*m+n*n;++i)
    for(int j=0;j<=i;++j){
      if(i*i+j*j>m*m+n*n) break;
      if((m*m+n*n)%(i*i+j*j)) continue;
      if(i==max(abs(n),abs(m)) && j==min(abs(n),abs(m))) continue;
      if(j==0 && i==1) continue;
      //cout << i << ' ' << j << endl;
      rep(l,2){
        swap(n,m);
        rep(k,4){
          if(k&1) i=-i;
          else j=-j;
          if(abs(m*i+n*j)%(i*i+j*j)) continue;
          if(abs(m*j-n*i)%(i*i+j*j)) continue;
          cout << 'C' << endl;
          return;
        }
      }
    }
  cout << 'P' << endl;
}

int main(int argc, char *argv[])
{
  int n;
  cin >> n;
  rep(i, n) solve();
  return 0;
}

Measured memory_bytes: 1152
from functools import lru_cache, reduce
from itertools import accumulate

N, M = map(int, input().split())

@lru_cache(maxsize=None)
def mod_inv(x):
  x1, y1, z1 = 1, 0, x
  x2, y2, z2 = 0, 1, M
  while z1 != 1:
    d, m = divmod(z2, z1)
    x1, x2 = x2-d*x1, x1
    y1, y2 = y2-d*y1, y1
    z1, z2 = m, z1
  return x1%M

def gen_Y(i, A):
  yield A
  # sC2/1, (s-2)C2/2, (s-4)C2/3  ...
  s = 3*(N-i)
  r = s*(s-1)>>1
  d_r = (s<<1)-3
  for j in range(1, N-i+1):
    yield r * mod_inv(j)
    r -= d_r
    d_r -= 4

def gen_X():
  # sC3*2/1, (s-3)C3*2/2, (s-6)C3*2/3  ...
  yield 1
  a = N
  b = 3*N - 1
  for i in range(1, N+1):
    yield a * b * (b-1) * mod_inv(i)
    a -= 1
    b -= 3

def mul_mod(x, y):
  return x * y % M

def acc_mod(it):
  return accumulate(it, mul_mod)

ans = sum(sum(acc_mod(gen_Y(i, A))) for i, A in enumerate(acc_mod(gen_X())))%M

print(ans)

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

int main()
{
    int n;
    cin >> n;
    int a[n];
    vector<int> x(9);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] < 400)
        {
            x[0]++;
        }
        else if (a[i] < 800)
        {
            x[1]++;
        }
        else if (a[i] < 1200)
        {
            x[2]++;
        }
        else if (a[i] < 1600)
        {
            x[3]++;
        }
        else if (a[i] < 2000)
        {
            x[4]++;
        }
        else if (a[i] < 2400)
        {
            x[5]++;
        }
        else if (a[i] < 2800)
        {
            x[6]++;
        }
        else if (a[i] < 3200)
        {
            x[7]++;
        }
        else
        {
            x[8]++;
        }
    }
    int count = 0;
    for (int i = 0; i < 8; i++)
    {
        if (x[i] > 0)
        {
            count++;
        }
    }

    if (count == 0)
    {
        cout << 1 << " ";
        cout << x[8] << endl;
    }
    else
    {
        cout << count << " ";
        count += x[8];
        
        cout << count << endl;
    }
}


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

using namespace std;

int main(){
  char s[3];
  cin >> s;
  sort(s,s+3);
  bool can = (s[0] != s[1]) || (s[1] != s[2]);
  (can)? cout << "Yes": cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
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<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int a,b,c,d;

int main(){
	cin>>a>>b>>c>>d;
	cout<<(a-c)*(b-d)<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    ll sum[n + 1];
    ll a;
    sum[0] = 0;
    REP(i, n){
        cin >> a;
        sum[i] = sum[i - 1] + a;//cout << "i: " << i << ", sum[i]: " << sum[i] << endl;
    }

    ll ans = 1000000000000;
    REP(i, n - 1){
        ans = min(ans, abs(sum[n] - sum[i] - sum[i]));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5160
#include<cstdio>


double s[10];

void set()
{
	for(int i=1;i<10;i++)
	{
		if(i%2==0)
		{
			s[i]=s[i-1]/3;
		}
		else
		{
			s[i]=s[i-1]*2;
		}
	}
}

int main()
{
	double a;
	while(scanf("%lf",&a)!=EOF)
	{
		s[0]=a;
		set();
		double ans=0.0;
		for(int i=0;i<10;i++)
		{
			ans+=s[i];
		}
		printf("%lf\n",ans);
	}
	return 0;
}

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

using namespace std;

int main() {
//#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
//#endif
	int n;
	cin >> n;
	map<int, bool> mp;
	while (n--) {
		int a;
		cin >> a;
		mp[a] = !mp[a];
	}
	int result = 0;
	for (auto x: mp) {
		result += x.second;
	}
	cout << result;
	return 0;
}


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

int main(void){
   int n,m,l,A[200][200]={{0}},B[200][200]={{0}};
   long C[200][200]={{0}};
   int i,j,k;
   cin >> n >> m >> l;

   for(i = 0; i < n; i++){
       for(j = 0; j < m; j++) {
           cin >> A[i][j];
       }
   }
   for(i = 0; i < m; i++){
       for(j = 0; j < l; j++) {
           cin >> B[i][j];
       }
   }
   for(i = 0; i < n; i++){
       for(j = 0; j < l; j++){
           for(k = 0; k < m; k++){
               C[i][j] += A[i][k]*B[k][j];
           }
       }
   }
   for(i = 0; i < n; i++){
       for(j = 0; j < l; j++){
           cout << C[i][j];
           if(j!=l-1)cout << " ";
       }
       cout << endl;
   }
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define ll long long
using namespace std;
vector<int> nex[114514];
int deg[114514],used[114514];
signed main(){
	int n;
	cin>>n;
	for(int i=0;i<n-1;i++){
		int x,y;
		cin>>x>>y;
		nex[x].pb(y);
		nex[y].pb(x);
		deg[x]++;
		deg[y]++;
	}
	queue<int> que;
	for(int i=1;i<=n;i++){
		if(deg[i]==1){
			que.push(i);
		}
	}
	while(!que.empty()){
		int cur = que.front(); que.pop();
		if(used[cur]==0){
			for(int i=0;i<nex[cur].size();i++){
				int dur = nex[cur][i];
				if(used[dur]==0){
					used[cur]=dur;
					used[dur]=cur;
					deg[cur]=0;
					deg[dur]=0;
					for(int j=0;j<nex[dur].size();j++){
						if( deg [ nex[dur][j] ] >= 1){
							deg[ nex[dur][j] ]--;
						}
						if( deg[nex[dur][j]] == 1){
							que.push(nex[dur][j]);
						}
					}
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(used[i]==0){
			cout<<"First"<<endl;
			return 0;
		}
	}
	cout<<"Second"<<endl;
	return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  
  int x, d=0;
  for(int i=0;i<N;i++){
    cin >> x;
    if(x>K-x) d+=2*(K-x);
    else d+=2*x;
  }
  cout << d << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	const int inf=100000000;
	int n,m;
	cin >> n >> m;
	int a[1000],b[1000],c[1000],dist[100][100];
	for(int i=0;i<m;i++){
		cin >> a[i] >> b[i] >> c[i];
		a[i]--,b[i]--;
	}
	
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j) dist[i][j]=0;
			else dist[i][j]=inf;
		}
	}
	
	for(int i=0;i<m;i++){
		dist[a[i]][b[i]]=min(dist[a[i]][b[i]],c[i]);
		dist[b[i]][a[i]]=min(dist[b[i]][a[i]],c[i]);
	}

	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
			}
		}
	}

	int ans=m;
	for(int i=0;i<m;i++){
		bool shortest=false;
		for(int j=0;j<n;j++) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
		if(shortest) ans--;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};


int main(int argc, char const *argv[]) {
  ll a,b;
  std::cin >> a >> b;
  if(a<=0 && b>0 || (a==0 || b==0)){
    std::cout << "Zero" << '\n';
    return 0;
  }
  else if(a>0 && b>0){
    std::cout << "Positive" << '\n';
  }
  else{
    ll n=abs(a),m=abs(b);
    if((abs(n-m)+1)%2){
      std::cout << "Negative" << '\n';
    }
    else std::cout << "Positive" << '\n';
  }

  return 0;
}


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

int main(void){
   string s, t;
   cin >> s >> t;
   for(int i = 0; i < s.length()-1; i++){
        for(int j = i+1; j < s.length(); j++)
            if(s[i] > s[j])
                swap(s[i], s[j]);
   }
   for(int i = 0; i < t.length()-1; i++){
        for(int j = i+1; j < t.length(); j++)
            if(t[i] < t[j])
                swap(t[i], t[j]);
   }
    if(s < t)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
using namespace boost::multiprecision;  
using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,k;
    cin >> n >> k;

    vector<double> vec(n+1);
    reps(i,n){
        cin >> vec[i];
        double tmp = vec[i];
        vec[i] = (vec[i] + 1) * vec[i] / 2;
        vec[i] /= tmp;
        vec[i] += vec[i-1];
    }

    double maxv = 0;
    for(int i = 0;i <= n-k;++i){
        double tmp = vec[i+k] - vec[i];
        chmax(maxv,tmp);
    }

    cout << Fixed << maxv << '\n';

    return 0;
}


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

pair<int,int> find_farthest(int first,vector<vector<int>> &E){
	vector<int> dis(E.size(),-1);
	int maxi = 0;
	int ind = first;
	dis[first]=0;
	queue<int> que;
	que.push(first);
	
	
	
	while(que.size()!=0){
		int a = que.front();
		que.pop();
		for(int i=0;i<E[a].size();i++){
			if(dis[E[a][i]]==-1){
				dis[E[a][i]]=dis[a]+1;
				que.push(E[a][i]);
			}
			if(dis[E[a][i]]>maxi){
				maxi=dis[E[a][i]];
				ind=E[a][i];
			}
		}
	}
	return make_pair(ind,dis[ind]);
	
}

int main(){
	int N;
	cin>>N;
	vector<vector<int>> E(N,vector<int>(0));
	for(int i=0;i<N-1;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	int x = find_farthest(find_farthest(0,E).first,E).second;
	if(x%3==1){
		cout<<"Second"<<endl;
	}
	else{
		cout<<"First"<<endl;
	}
	
	
	
	return 0;
}


Measured memory_bytes: 13556
#include <iostream>
#include <cstdlib>
#include <list>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(void)
{
    int a,b,k;
    cin >> a >> b >> k;
    int n[100];


    if (a < b)
    {
        int j = 0;
        for (int i = a; i > 0; --i)
        {
            if ((a % i == 0) && (b % i == 0))
            {
                n[j] = i;
                ++j;
            }
        }
    }
    else 
    {
        int j = 0;
        for (int i = b; i > 0; --i)
        {
            if ((a % i == 0) && (b % i == 0))
            {
                n[j] = i;
                ++j;

            }
        }
    }

    cout << n[k-1];
    
        
    return 0;
}

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

int n;
int graph[100][100];
int INF = -100000007;
// 未探索はINF
int d[100];

int main() {

  cin >> n;

  // 配列を初期化
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      graph[i][j] = 0;
    }
    d[i] = INF;
  }

  // 入力を受け取る
  for(int i = 0; i < n; i++) {
    int u, k;
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      int v;
      cin >> v;
      graph[u - 1][v - 1] = 1;
    }
  }

  // 頂点1を設定
  queue<int> q;
  q.push(0);
  d[0] = 0;

  // 探索
  while (!q.empty()) {
    int u = q.front(); q.pop();
    for (int i = 0; i < n; i++) {
      if (graph[u][i] == 0) {
        continue;
      }
      if (d[i] != INF) {
        continue;
      }
      d[i] = d[u] + 1;
      q.push(i);
    }
  }

  // 探索結果を出力
  for (int i = 0; i < n; i++) {
    if (d[i] == INF) {
      cout << i + 1 << " -1" << endl;
    } else{
      cout << i + 1 << " " << d[i] << endl;
    }
  }

  return 0;

}


Measured memory_bytes: 3156
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
    ll n, d;  cin >> n >> d;
    ll *x = new ll[n], *y = new ll[n];
    for (int i = 0; i < n; i++)
        cin >> x[i] >> y[i];

    ll ans = 0;
    for (ll i = 0; i < n; i++) {
        if (x[i]*x[i]+y[i]*y[i] <= d*d)
            ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6708
function Main(input){
    const sn = input.split('\n');
    const N = sn.shift();
    let answer = 0;
    let box = new Map();
    for(let i=0; i<sn.length; i++){
        const sortStr = sn[i].split('').sort().join('').trim();
        if(box.has(sortStr)){
            answer += box.get(sortStr);
            box.set(sortStr, box.get(sortStr)+1)
        } else{
            box.set(sortStr, 1);
        }
    }
    console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


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

int main(){
  int A,B,C,X,way = 0;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> X;
  for (int a = 0;a<=A;a++){
    for (int b = 0;b<=B;b++){
      for (int c = 0;c<=C;c++){
        if (500*a+100*b+50*c == X){
          way ++;
        }
      }
    }
  }
  cout << way <<endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
A, B, M = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
ans = min(a_list) + min(b_list)
for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a_list[x - 1] + b_list[y - 1] - c)

print(ans)

Measured memory_bytes: 18648
n=int(input())
red=[0]*n
for i in range(n):
    a,b=map(int,input().split())
    red[i]=(a,b)
blue=[0]*n
for i in range(n):
    a,b=map(int,input().split())
    blue[i]=(a,b)
blue.sort()
c=0
for bx,by in blue:
    maxry=-1
    maxi=-1
    for i in range(len(red)):
        rx,ry=red[i]
        if rx < bx and ry < by:
            if maxry < ry:
                maxry=ry
                maxi=i
    if not maxi == -1:
        c+=1
        red.pop(maxi)
print(c)


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

void solve()
{
	ll n,d;
	cin>>n>>d;
	ll cnt = 0;
	while(n--)
	{
		ll x,y;
		cin>>x>>y;
		if(x*x+y*y<=d*d)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
}

int main()
{
	ll t =1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3636
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String nl = System.getProperty("line.separator");
		StringBuilder p = new StringBuilder(1000);
		StringBuilder d = new StringBuilder("..");
		StringBuilder s = new StringBuilder("##");
		StringBuilder k = new StringBuilder(100);
		Scanner r = new Scanner(System.in);
		int h, w, i, ww;
		String u;
		for (i = 0; i < 4; ++i) {
			d.append(d);
			s.append(s);
		}
		ww = d.length();
		while ((h = r.nextInt()) + (w = r.nextInt()) != 0) {
			while (w > ww) {
				d.append(d);
				s.append(s);
				ww += ww;
			}
			p.append(u = s.substring(0,w));
			p.append(nl);
			k.setLength(0);
			k.append('#');
			k.append(d.substring(2, w));
			k.append('#');
			k.append(nl);
			for (i = h - 2; i > 0; --i) {
				p.append(k);
			}
			p.append(u);
			p.append(nl);
			p.append(nl);
		}
		System.out.print(p);
	}
}

Measured memory_bytes: 18372
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

     Scanner sc=new Scanner(System.in);
     long  n=sc.nextInt();
     long  sum=0;
     for(long i=1;i<=n;i++)
     {
         if(i%3!=0&&i%5!=0)
             sum+=i;
     }
     System.out.println(sum);

    }
}


Measured memory_bytes: 35788
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> a(N);
    int sum = 0;
    rep(i,N) {
        cin >> a[i];
    }
    int min = 40000*100;
    for(int i = -100; i <= 100; i++) {
        int sum = 0;
        rep(j,N) {
            sum += pow(a[j] - i, 2.0);
        }
        if(sum < min) min = sum;
    }
    
    cout << min << endl;
    return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"
#define int ll

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

  int N,M,K;
  cin>>N>>M>>K;
  vector<int>A(N),B(M);
  for(int i=0;i<N;i++)cin>>A[i];
  for(int i=0;i<M;i++)cin>>B[i];
  ll sum=0;
  ll ans=0;
  vector<ll>sb(M+1);
  sb[0]=0;
  for(int i=0;i<=M;i++)sb[i+1]=sb[i]+B[i];
  for(int i=0;i<=N;i++){
    if(i!=0)sum+=A[i-1];
    ll l=0,r=M+1,m;
    while(r-l>1){
      m=(l+r)/2;
      if(sb[m]+sum<=K)l=m;
      else r=m;
    }
    if(sb[l]+sum<=K)ans=max(l+i,ans);
  }
  cout<<ans<<endl;

  return 0;
}


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

using namespace std;

const int INF = 1 << 30;

int main()
{
  int N;
  string S;

  cin >> S;


  int sz[100001] = {}, sz2[100001] = {};
  for(int i = (int) S.size() - 1; i >= 0; i--) {
    sz[i] = sz[i + 1];
    if(S[i] == 'g') ++sz[i];
    else --sz[i];
  }

  int goo = 0, ret = -INF;
  int lost = 0;
  for(int i = 0; i < S.size(); i++) {
    if(S[i] == 'g') ++goo;
    else if(S[i] == 'p' && goo == 0) ++lost;
    else --goo;
    ret = max(ret, -lost + min(goo, sz[i + 1]));
  }
  cout << ret << endl;
}

Measured memory_bytes: 896
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
from fractions  import gcd

n,m,k=map(int,input().split())
f=False
for i in range(n+1):
    for j in range(m+1):
        if m*i+n*j-2*i*j==k:
            print("Yes")
            f=True
            break
    if f:
        break
else:
    print("No")

Measured memory_bytes: 64492
n,m=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(n)]
B=[list(map(int,input().split())) for _ in range(m)]
for i in range(n):
    min=4*10**8
    num=0
    for j in range(m):
        d=abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])
        if d<min:
            min=d
            num=j+1
    print(num)

Measured memory_bytes: 3064