akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

ll A[100100];
ll B[100100];
ll D[100100];
int main(){
    int N;
    cin >> N;
    ll sum = 0;
    ll ans = 0;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
    }
    REP(i,N){
        ll b;
        cin >> b;
        B[i] = b;
        D[i] = A[i] - b;
        if(D[i] < 0){
            sum += D[i];
            ans ++;
        }
    }

    sort(D, D+N, greater<ll>());

    bool ok = false;
    REP(i, N){
        if(sum >= 0) {
            ok = true;
            break;
        }

        ll d = D[i];
        if(d < 0) {
            break;
        }
        sum += d;
        ans ++;
    }

    if(!ok) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>

using namespace std;
int arr[123456 * 2 + 1] = {};
void Eratosthenes(int N) {
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}
	arr[0] = 0;
	arr[1] = 0;
}
int main() {
	int n;
	Eratosthenes(123456*2+1);
	while (scanf("%d", &n)) {
		if (n == 0)
			return 0;
		int cou = 0;
		for (int i = n+1; n * 2 >= i; i++) {
			if (arr[i]) {
				cou++;
			}
		}
		printf("%d\n", cou);
	}
	
	return 0;
}

Measured memory_bytes: 4160
<?php
    list($X,$N) = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    //$N==0の時2行目が空行となるので＄Xをそのまま表示して終わり
    if($N == 0){
        echo $X."\n";
        exit;
    }
    
    $array = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    //被検索対象の数字の中に検索したい数字がなければ検索したい数字で決定して終わる
    if(in_array($X,$array)){
    }else{
        echo $X."\n";
        exit;
    }
    sort($array);
    
    //ここに来たということは検索する数字が文字列に存在しているのでその数字を
    //1ずつ増減させて調べていく
    for($i=1;$i<=100;$i++){
        $A = $X - $i;
        $B = $X + $i;
        //存在しない数字があった瞬間決定する
        if(in_array($A,$array)==0 && $A>=0){
            // echo array_search($A,$array);
            // print_r($array);
            // echo "a\n";
            echo $A."\n";
            exit;
        }
        if(in_array($B,$array)==0 && $B<=101){
            // echo "b\n";
            echo $B."\n";
            exit;
        }
        
    }

?>

Measured memory_bytes: 16200
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n,m;
	cin>>n>>m;
	vi dp(n+1,inf);
	dp[0]=0;
	while(m--){
		int a;
		cin>>a;
		rep(i,n-a+1)dp[i+a]=min(dp[i+a],dp[i]+1);
	}
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 1288
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int m, k;
  scanf("%d%d", &m, &k);
  if (m == 1) {
    if (k != 0) {
      puts("-1");
    } else {
      puts("0 0 1 1");
    }
    return 0;
  }
  if (k >= (1 << m)) {
    puts("-1");
    return 0;
  }
  vector<int> a;
  for (int i = 0; i < (1 << m); ++i) {
    if (i == k) continue;
    a.push_back(i);
  }
  a.push_back(k);
  for (int i = (1 << m) - 1; i >= 0; --i) {
    if (i == k) continue;
    a.push_back(i);
  }
  a.push_back(k);
  for (int i = 0; i < a.size(); ++i) {
    printf("%d%c", a[i], " \n"[i + 1 == a.size()]);
  }
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    ll x, k, d; cin >> x >> k >> d;

    int flag = 0;
    if(x < 0) {
        x *= -1;
        flag = 1;
    }
    
    ll ans;
    ll cnt = x / d;

    if(cnt > k) ans = x - d * k;
    else if(cnt % 2 == k % 2){
        ans = x % d;
    }else{
        ans = x % d - d;
    }

    if(flag) ans *= -1;
    cout << abs(ans) << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3648
import scala.io.StdIn
object Main extends App {
  
  val n = StdIn.readLine().trim.toInt
  
  val result = (0 until n).foldLeft(List.empty[String], Set.empty[String]){
    case ((acc, dict), _) =>
    val cmd = StdIn.readLine().split(' ')
    if(cmd(0) == "insert"){
      (acc, dict + cmd(1))
    } else {
      if(dict.contains(cmd(1))) {
        ("yes"::acc, dict)
      } else {
        ("no"::acc, dict)
      }
    }
  }
  println(result._1.reverse.mkString(f"%n"))

}


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


int main() {
  int a, b;
  cin >> a >> b;
  if(a+b >= 24) cout << a+b-24 << endl;
  else cout << a+b << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main()
{
	int n;
	cin>>n;
	vi v(n);
	rep(i,n)
	cin>>v[i];
	sort(All(v));
	cout<<accumulate(All(v),0)-v.back()/2<<endl;
    return 0;
}

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

#define ll long long
#define ar array

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

	int h, n;
	cin >> h >> n;
	int a[n];
	int s=0;
	for(int i=0; i<n; ++i) {
		cin >> a[i];
		s+=a[i];
	}
	cout << (s>=h?"Yes":"No");
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define MAX 100005
#define INF (1e9+1)

int n,W;
int dp[MAX];

int main(){
  fill(dp,dp+MAX,-INF);
  dp[0]=0;
  
  cin>>n>>W;
  for(int i=0;i<n;i++){
    int v,w,m;
    cin>>v>>w>>m;

    for(int k=0;k<=30;k++){
      int key= min( m, (1<<k) );
      m-=key;
      int nv=key*v;
      int nw=key*w;
      for(int j=W;j>=nw;j--){
        dp[j]=max(dp[j],dp[j-nw]+nv);
      }


    }
    
  }
  int ans=0;
  for(int i=0;i<=W;i++)
    ans=max(ans,dp[i]);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3468
<?php
$n = trim(fgets(STDIN));
$a = explode(' ', trim(fgets(STDIN)));

echo implode(' ', $a) . PHP_EOL;

for ($i=1; $i < $n; $i++) {
  $v = $a[$i]; // 3
  $j = $i - 1; // 0

  while ($j >= 0 && $a[$j] > $v) { // 8 > 3
    $a[$j + 1] = $a[$j]; // $a[1] = 8
    $j--; // -1
  }

  $a[$j + 1] = $v; // $a[0] = 3

  echo implode(' ', $a) . PHP_EOL;
}



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


int main(){

    int d;
    cin>>d;
    if(d==25){
        cout << "Christmas " << endl;
    }else if(d==24){
        cout << "Christmas Eve" << endl;
    }else if(d==23){
        cout << "Christmas Eve Eve" << endl;
    }else if(d==22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int gcd(int a,int b)
{
  if(a%b==0)
  return b;
  else
  return gcd(b,a%b);
}
int main()
{
int a,b;
 scanf("%d%d",&a,&b);
 printf("%d\n",gcd(a,b));
  return 0;
}


Measured memory_bytes: 2100
# 各桁についての13で割ったあまりを足し合わせると5になる
# "??"の場合、
# 1桁目が"3"だと、13で割ったあまりは3
# 2桁目が"8"だと、13で割ったあまりは2
# 従い83を13で割ったあまりは5
# 下から数えてN桁目までに、あまりの合計がP(0〜12)になっている数がそれぞれいくつあるかをDPする
# dp[i桁目(下から数える)][あまりの合計]

S = input()
N = len(S)
S = S[::-1] # 逆順にしたほうがやりやすい
dp = [[0] * 13 for i in range(N)]
if S[0] != "?":
  dp[0][int(S[0])] = 1 # 指定の数をとりあえずカウント
else:
  for i in range(10):
    dp[0][i] = 1 # 1桁目は、あまり0〜9になる数が一つずつある
     
# あまりリストの管理 桁数が一つ増えるごとに、各数に対しての13で割ったあまりを計算する
amari = [i for i in range(10)]

DIV = 10 ** 9 + 7

# 各桁のあまりの数を更新する
# これにより、桁が増えたときに更新すべきあまりの種類（あまり13種類に対して
# ひと桁は10種類しかない）を管理できる
def update_amari():
  for i in range(len(amari)):
    amari[i] = (amari[i] * 10) % 13

# 2桁目以降をDP
for i in range(1,N):
  update_amari() # 各桁のあまりをアップデート
  if S[i] == "?":
    # あらゆる数が入る
    # i-1桁目の各数のループと、i桁目のあまりの各数のループ
    for j in range(len(dp[i-1])):
      # 前の桁であまりがjだったとき
      for k in amari:
        dp[i][(j + k) % 13] += dp[i-1][j]
        dp[i][(j + k) % 13] %= DIV
  else:
    # 数が決まっている
    for j in range(len(dp[i-1])):
      # あまりが決まっている
      am = amari[int(S[i])]
      dp[i][(j + am) % 13] += dp[i-1][j]
      dp[i][(j + am) % 13] %= DIV
        
# 最終桁までいったときにあまりが5になる数が必要なので、dp[N-1][5]が答え
print(dp[N-1][5])


Measured memory_bytes: 62300
import java.util.Scanner;
import java.util.Arrays;
public class Main {
	public static void main(String... args){
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int[] a = new int[N];
      for(int i = 0; i < N; i++) {
        a[i] = sc.nextInt();
      }
      Arrays.sort(a);
      double output = a[0];
      for(int i = 1 ; i < N ; i++) {
      	output = (double)((output + (double) a[i]) / 2);
      }
      System.out.println(output);
      
    }
}

Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

struct edge{
    ll u;
    ll v;
    ll cost;
    edge(){}
    edge(ll u,ll v, ll cost):u(u),v(v),cost(cost){}
};

void dijkstra(ll root,ll n,vector<vector<edge>>&T ,vector<ll>& dist){
    queue<ll> q;
    q.push(root);
    dist[root] = 0;
    while(!q.empty()){
        ll next = q.front(); q.pop();
        for(auto e:T[next]){
            if(dist[e.v] > dist[e.u] + e.cost){
                dist[e.v] = dist[e.u] + e.cost;
                q.push(e.v);
            }
        }
    }
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<vector<edge>> T(n);
    for(int i = 0; i < n - 1;i++){
        ll s,t, w; cin >> s >> t >> w;
        T[s].emplace_back(edge(s,t,w));
        T[t].emplace_back(edge(t,s,w));
    }
    
    ll root = 0;
    ll v1,v2;
    ll max_dist;
    vector<ll> dist(n,INF);

    dijkstra(root, n, T, dist);
    
    v1 = -1; max_dist = -INF;
    for(int i = 0; i < n;i++){
        if(dist[i] == INF)continue;
        if(dist[i] > max_dist){
            max_dist = dist[i];
            v1 = i;
        }
    }
    
    dist.assign(n,INF);
    dijkstra(v1, n, T, dist);
    
    v2 = -1; max_dist = -INF;
    for(int i = 0; i < n;i++){
        if(dist[i] == INF)continue;
        if(dist[i] > max_dist){
            max_dist = dist[i];
            v2 = i;
        }
    }
    
    cout << max_dist << endl;
    
    return 0;
}

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

int main() {
    int n, l;
    cin >> n >> l;

    vector<pair<int , int>> ap(n);

    int sum = 0;
    for(int i = 0; i < n; i++) {
        ap[i].first = i+1;
        ap[i].second = l+(i+1)-1;
        sum += ap[i].second;
        //cout << l+(i+1)-1 << endl;
    }

    int tmp = -2.0e7;
    int ans = 0;
    int flag = 0;
    if(sum < 0) {
        flag = 1;
        sum = abs(sum);
    }
    
    if(ap[0].second >= 0) {
        cout << sum - ap[0].second << endl;
    }
    else {
        for(int i = 0; i < n; i++) {
            //cout << tmp <<  " " << sum << endl;
            if(ap[i].second < 0) {
                tmp = max(tmp, sum+ap[i].second);
            }
            else { 
                tmp = max(tmp, sum-ap[i].second);
            }
        }
        if(flag == 1) {
            cout << -tmp << endl;
        }
        else {
            cout << tmp << endl;
        }
    }

    return 0;
    
}

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

signed main()
{
	ll n,k;
	cin >> n >> k;
	ll ans = 0;
	for(int i = 1;i<=n;i++)
	{
		if(i%k==0)
		{
			ans += (n/k)*(n/k);
		}
		if(k%2==0&&i%k==k/2)
		{
			ans += (n/k+(n%k<k/2?0:1))*(n/k+(n%k<k/2?0:1));
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
using System.Diagnostics;

class Scanner
{
    private readonly char Separator = ' ';
    private int Index = 0;
    private string[] Line = new string[0];
    public string Next()
    {
        if (Index >= Line.Length)
        {
            Line = Console.ReadLine().Split(Separator);
            Index = 0;
        }
        var ret = Line[Index];
        Index++;
        return ret;
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    private long NextLong()
    {
        return long.Parse(Next());
    }
}

class Program
{
    private int N, A, B;
    private void Scan()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        A = sc.NextInt();
        B = sc.NextInt();
    }

    public void Solve()
    {
        Scan();
        Console.WriteLine((B - A) % 2 == 0 ? "Alice" : "Borys");
    }

    static public void Main()
    {
        new Program().Solve();
    }
}

Measured memory_bytes: 13140
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b, x = f()
    if x>=a and x<= a+b:
        print('YES')
    else:
        print('NO')

solve()


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

int main()
{
    int N,A,B;
    cin >> N >> A >> B ;

    if((B-A)%2==0){
        cout << "Alice" << endl;
    }else{
        cout << "Borys" << endl;
    }

    return 0;
}

Measured memory_bytes: 3132
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        
//        int n=sc.nextInt();
        long x=sc.nextLong();
        for (long a = 1; a<1000000; a++) {
			for (long b = a-1; -a <= b; b--) {
				if((long)(pow(a,5)-pow(b,5))==x)ret(a+" "+b);
			}
		}
    
   
        out.println();
     	out.flush();
    }
    
    
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,c;long s;
//	P(int  x, int c, long s) {
//	  this.x=x;
//	  this.c=c;
//	  this.s=s;
//	}
//}


class P implements Comparable<P>{
	int x,c;long s;
	P(int  x, int c, long s) {
	  this.x=x;
	  this.c=c;
	  this.s=s;
	}

    public int compareTo(P p){
        return Long.signum(s-p.s);
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 37160
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 300010
using namespace std;
struct tt{int l, r, sum;}t[6000010];
struct aa{int x, y;}a[N];
int n, m, l, root[N], ans, now, l1, x;
inline char gc(){
	static char now[1<<16], *S, *T;
	if(S==T){T=(S=now)+fread(now, 1, 1<<16, stdin); if(S==T)return EOF;}
	return *S++;
}
inline int read(){
	int x=0, f=1; char ch=gc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=gc();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=gc();}
	return x*f;
}
inline bool cmp(aa a, aa b){return a.x<b.x;}
inline void ins(int i, int x, int L, int R){
	t[l]=t[i]; t[l].sum++;
	if(L<R){
		int mid=(L+R)>>1, l1=l;
		if(x<=mid){l++; t[l1].l=l; ins(t[i].l, x, L, mid);}
		else{l++; t[l1].r=l; ins(t[i].r, x, mid+1, R);}
	}
}
inline int csum(int x1, int x2, int a, int b, int L, int R){
	if(a<=L&&R<=b)return t[x1].sum-t[x2].sum;
	int mid=(L+R)>>1, s=0;
	if(a<=mid)s+=csum(t[x1].l, t[x2].l, a, b, L, mid);
	if(mid<b)s+=csum(t[x1].r, t[x2].r, a, b, mid+1, R);
	return s;
}
int main(){
	n=read(); m=read();
	for(int i=1; i<=n; i++){a[i].x=read(); a[i].y=read();}
	sort(a+1, a+1+n, cmp);
	l=root[0]=now=0;
	for(int i=1; i<=m; i++){
		root[i]=root[i-1];
		while(now<n&&a[now+1].x==i){
			now++;
			l++; l1=l; ins(root[i], a[now].y, 1, m); root[i]=l1;
		}
	}
	printf("%d\n", n);
	for(int i=2; i<=m; i++){
		ans=n;
		for(x=i; x<=m; x+=i)ans-=csum(root[x-1], root[x-i], x-i+1, x-1, 1, m);
		x-=i; if(x<m)ans-=csum(root[m], root[x], x+1, m, 1, m);
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 67712
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<set>
#include<ctime>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
inline void write(int a){
	if(a>=10)write(a/10);
	putchar('0'+a%10);
}
inline void writeln(int a){
	write(a); puts("");
}
inline int read()//不管是正负数，都可以 
{
	int x = 0; char ch = getchar(); bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline int ksm(int a,int b,int n){
	int t=1,y=a;
	while (b){
		if (b&1) t=(long long)t*y%n;
		y=(long long)y*y%n;
		b>>=1;
	}
	return t;
}
const int N=100005,mod=1000000007;
inline int ni(int k){
	return ksm(k,mod-2,mod);
}
int n,a[N],f[N],g[N],tong[N],s2,s1;
int main(){
	n=read();
	for(int i=1;i<=n+1;i++){a[i]=read(); if(tong[a[i]]){s2=i; s1=tong[a[i]];} tong[a[i]]=i;}
	writeln(n);
	f[1]=n+1;
	for(int i=2;i<=n;i++)f[i]=(long long)f[i-1]*(n-i+2)%mod*ni(i)%mod;
	g[2]=n-(s2-s1); //g[i]=c(n-(s2-s1),i-1)
	for(int i=3;i<=n;i++)g[i]=(long long)g[i-1]*(n-s2+s1-i+2)%mod*ni(i-1)%mod;
	for(int i=2;i<=n;i++){
		//cout<<f[i]<<" "<<g[i]<<" "<<i<<" "<<s1<<endl;
		writeln((f[i]-g[i]+mod)%mod);
	}
	write(1);
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;




int main(void) {
  ll N, L;
  cin >> N >> L;
  ll i;
  ll a[MAX];
  ll s=0;
  
  for(i=0; i<N; i++) {
    cin >> a[i];
  }
  
  
  ll key=-1;
  for(i=0; i<N-1; i++) {
    if(a[i]+a[i+1]>=L) key=i;
  }
  
  if(key==-1) {
    pt("Impossible");
    return 0;
  }
  
  vector<ll> v;
  for(i=0; i<key; i++) v.push_back(i);
  for(i=N-2; i>key; i--) v.push_back(i);
  v.push_back(key);
  
  pt("Possible");
  for(i=0; i<N-1; i++) pt(v[i]+1);
}


Measured memory_bytes: 2548
// ref: https://competitive-kivantium.hateblo.jp/entry/2019/04/27/233759

//#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);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    uint N; cin >> N;
    vector<int> vA(N); for(uint i=0; i<N; ++i){ cin >> vA[i]; }
    
    vector<vector<int64>> dp(N+1, vector<int64>(2));
    dp[0][0] = 0;
    dp[0][1] = INT_MIN;
    
    for(uint i=0; i<N; ++i){
        dp[i+1][0] = max(dp[i][0]+vA[i], dp[i][1]-vA[i]);
        dp[i+1][1] = max(dp[i][0]-vA[i], dp[i][1]+vA[i]);
    }
    cout << dp[N][0] << endl;
    
    return 0;
}


Measured memory_bytes: 6144
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.abs

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val mod = 1_000_000_007L
    val (n, m) = readLongList()
    val nFact = calcFactorial(n, mod)
    val mFact = calcFactorial(m, mod)
    val ans = when {
        abs(n - m) >= 2 -> 0
        n == m -> (2 * ((nFact * mFact) % mod)) % mod
        else -> (nFact * mFact) % mod
    }
    out.println(ans)
}

/** O(n) mod <= 2_147_483_648 */
fun calcNPermutationM(n: Long, m: Long, MOD: Long = (1L shl 31)): Long {
    var ret = 1L
    for (i in (n - m + 1)..n) { ret = (ret * i) % MOD }
    return ret
}

/** O(x) mod <= 2_147_483_648 */
fun calcFactorial(x: Long, MOD: Long = (1L shl 31)) = calcNPermutationM(x, x, MOD)

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

#define int long long

#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
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

struct Dinic{
    struct edge{
        int to,cap,rev;
        edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
    };

    static const int INF=1001001001;
    vector<vector<edge>>G;
    vector<int>level,iter;
    Dinic(int v):G(v),level(v),iter(v){}

    void addEdge(int from,int to,int cap){
        G[from].push_back(edge(to,cap,G[to].size()));
        G[to].push_back(edge(from,0,G[from].size()-1));
    }

    void bfs(int s){
        fill(level.begin(),level.end(),-1);
        queue<int>que;
        level[s]=0;
        que.push(s);
        while(que.size()){
            int v=que.front();
            que.pop();
            for(auto &e:G[v]){
                if(e.cap&&level[e.to]==-1){
                    level[e.to]=level[v]+1;
                    que.push(e.to);
                }
            }
        }
    }

    int dfs(int v,int t,int f){
        if(v==t)return f;
        for(int &i=iter[v];i<G[v].size();i++){
            edge &e=G[v][i];
            if(e.cap>0&&level[v]<level[e.to]){
                int d=dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    G[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    int maxFlow(int s,int t){
        int flow=0;
        while(true){
            bfs(s);
            if(level[t]<0)return flow;
            fill(iter.begin(),iter.end(),0);
            int f;
            while((f=dfs(s,t,INF))>0)flow+=f;
        }
    }
};

signed main(){
    int N;cin>>N;
    Dinic d(N+114);

    int src=N+20,snk=N+40;

    int base=0;

    for(int i=1;i<=N;i++){
        int a;cin>>a;
        if(a>=0){
            base+=a;
            d.addEdge(src,i,a);
            d.addEdge(i,snk,0);
        }
        else{
            d.addEdge(src,i,0);
            d.addEdge(i,snk,-a);
        }
    }

    for(int i=1;i<=N;i++){
        for(int j=i+i;j<=N;j+=i){
            d.addEdge(j,i,Dinic::INF);
        }
    }

    cout<<base-d.maxFlow(src,snk)<<endl;
    return 0;
}


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

void fastio()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
}

void solve()
{

  int l,r,d;cin>>l>>r>>d;
  int ans = (r/d - l/d);
  if(l%d==0  && r%d==0)ans++;
  cout<<ans;
}

int32_t main()
{
    fastio();
    // int t;cin>>t;
    // while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3684
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

int N, M;
P ranges[100000];

void solve()
{
    int ans = 0;
    sort(ranges, ranges+M);
    int m = ranges[0].se;
    REP(i, M){
        m = max(m, ranges[i].se);
    }
    cout << max(0, ranges[0].fi - m + 1) << endl;

}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    REP(i, M){
        cin >> ranges[i].se >> ranges[i].fi;
        ranges[i].fi--;
        ranges[i].se--;
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


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

int main(){
  
  int N,M;
  cin>>N>>M;
  int sum=0;
  vector<int> hyou(N);
  for(int i=0;i<N;i++){
    cin>>hyou.at(i);
    sum+=hyou.at(i);
  }
  sort(hyou.begin(),hyou.end());
  reverse(hyou.begin(),hyou.end());
  if(hyou.at(M-1)*4*M<sum)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;
}

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

long double n, m, d;

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> d;
    long double bpairs;
    
    d ? bpairs = (2 * (n - d)) / (n * n) : bpairs = 1 / n;
    cout << fixed << setprecision(6) << bpairs * (m - 1);
    // m - 1 slots that could contribute to the beauty.
    // no mod means that wouldn't be able to calculate factorials so can't be just combo.
    // Maybe use the denom (n * m) so you don't have to use mod?
    //
    //
}


Measured memory_bytes: 3796
#include<stdio.h>

int A[1000000], n;

/*二分探索*/

int binarySearch(int key){
	int left = 0;
	int right = n;
	int mid;
	
	while( left < right ){
		mid = (left + right) / 2;
		if( key == A[mid] ) return 1;  /*keyを発見*/
		if( key > A[mid] ) left = mid + 1; /*後半を探索*/
		else if( key < A[mid] ) right =mid; /*前半を探索*/
	}
	return 0;
}

int main(){
	int i, q, k, sum=0;
	
	scanf("%d", &n);
	for( i=0; i<n; i++){
		scanf("%d",&A[i]);
	}
	
	scanf("%d",&q);
	for(i=0; i<q; i++){
		scanf("%d",&k);
		if(binarySearch(k))sum++;
	}
	printf("%d\n",sum);
	
	return 0;
}



Measured memory_bytes: 2160
import heapq
N=int(input())
a=list(map(int, input().split()))

table1=[0]*(N+1)
table1[0]=sum(a[:N])
q1=a[:N].copy()
heapq.heapify(q1)

for i in range(N):
  table1[i+1]=table1[i]+a[N+i]
  heapq.heappush(q1, a[N+i])
  tmp=heapq.heappop(q1)
  table1[i+1]-=tmp

table2=[0]*(N+1)
table2[N]=sum(a[2*N:])
q2=[-x for x in a[2*N:]]
heapq.heapify(q2)

for i in range(N):
  table2[N-1-i]=table2[N-i]+a[2*N-1-i]
  heapq.heappush(q2, -a[2*N-1-i])
  tmp=-heapq.heappop(q2)
  table2[N-1-i]-=tmp
  
print(max([table1[i]-table2[i] for i in range(N+1)]))

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int N, H;
    cin >> N >> H;

    priority_queue<int> bQue;
    int maxa = 0;
    
    for(int i = 0; i < N; i++){
        int a, b; cin >> a >> b;
        maxa = max(maxa, a);
        bQue.push(b);
    }

    int ans = 0;
    while(!bQue.empty()){
        int curB = bQue.top();
        bQue.pop();
        if(curB < maxa) break;
        H -= curB;
        ans++;
        if(H <= 0) break;
    }

    if(H>0) ans += (H + maxa - 1) / maxa;
    cout << ans << endl;

    return 0;
}


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

int main(){
	int n;
	int x[100];
	int y[100];
	int i,p=0;
	double D[4]={0};
	double max=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&x[i]);   // x?????\???
	}
	for(i=0;i<n;i++){
		scanf("%d",&y[i]);   // y?????\???
	}
	
	while(p<3){
		for(i=0;i<n;i++){
			D[p]+=pow(abs(x[i]-y[i]),p+1);
		}
		D[p]=pow(D[p],1/(double)(p+1));
		printf("%lf\n",D[p]);
		p++;
	}
	
	for(i=0;i<n;i++){
		if(abs(x[i]-y[i])>max){
			max=abs(x[i]-y[i]);
		}
	}
	D[3]=(double)max;
	printf("%lf\n",D[3]);
		
		return 0;
}

Measured memory_bytes: 696
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int ans = 9999999;

    string s;
    cin>>s;

    for(char c = 'a'; c <= 'z'; c++){
        int mx = 0;
        int a = 0;
        for(char i : s){
            if(c != i){
                a++;
            }
            else{
                a = 0;
            }
            mx = max(mx, a);
        }
        ans = min(ans, mx);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication32
{
    class Program
    {  
      static void Main()
      {
		  int[] a=new int[3];
		  for (int b =0;b<3;b++)
		  a[b]=int.Parse(Console.ReadLine());
		  Array.Sort(a);
		  int[] c=new int[2];
		  for (int d =0;d<2;d++)
		  c[d]=int.Parse(Console.ReadLine());
		  Array.Sort(c);
		  Console.WriteLine(a[0]+c[0]-50);
		  
		  	  }}}

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


void solve(long long N, long long K){
    ll ans = 1e18;
    set<ll> se;
    while(1){
        if(N >= K){
            N -= N / K * K;
        }else{
            N = abs(N - K);
        }
        ans = min(N, ans);
        if(se.find(N) == se.end())se.insert(N);
        else break;
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    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<ll,pll> 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;

int main(){
	cin>>a>>b>>c;
	cout<<max(0,c-a+b)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const ll mod=1000000007;
int main(void){
    int a,b;
    cin>>a>>b;
    if((a*b)%2==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
      using namespace std;
      #define ll long long
      #define pb push_back
      #define pll  pair <long long,long long>
      #define mp make_pair
      #define ss second
      #define ff first
      #define maa 1000000007
      #define endl '\n'
      #define ld long double
      #define all(x) x.begin(),x.end()
      ll  power(ll  i,ll  j)
      {
        if(j==0)
        return 1 ;
        ll t=power(i,j/2)%maa ;
        if(j%2==0)
        return (t%maa*t%maa)%maa ;
        else
        return ((t%maa*t%maa)%maa*(i%maa)%maa)%maa ;
      }
      bool is(ll  i)
      {
        if(i==1)
            return 0 ;
        ll  f=0 ;
        for(ll  j=2;j<=sqrt(i);j++)
        {
            if(i%j==0)
            {
                f=1 ;
                break ;
            }
        }
        return !f ;
      }
      ll dp[3001][3001] ;
      string r,s ;
      ll fun(ll i,ll j)
      {
          if(i==-1||j==-1)
          return 0 ;
          else if(dp[i][j]!=-1)
          return dp[i][j] ;
          else
          {
              ll ans=0 ;
              ans=max(fun(i-1,j),fun(i,j-1)) ;
              if(r[i]==s[j])
              ans=max(ans,1+fun(i-1,j-1)) ;
              return dp[i][j]=ans ;
          }
          
      }
      
      void fun1(ll i,ll j,ll u,string &sans)
      {
          
          
          if(u==0)
         {
             sans ;
             return ;
         }
         if(i==-1||j==-1)
          return ;
          
         // cout<<i<<" "<<j<<" "<<u<<endl ;
          
          if(u==fun(i-1,j))
          {
             
              fun1(i-1,j,u,sans) ;
          }
          else if(u==fun(i,j-1))
          {
              
              fun1(i,j-1,u,sans) ;
          }
          else if(r[i]==s[j]&&(u-1)==fun(i-1,j-1))
          {
              sans+=s[j] ;
              fun1(i-1,j-1,u-1,sans) ;
          }
      }
      int main()
      {

        /// 50-4
        /// freopen("input.txt","r",stdin);
        /// freopen("output.txt","w",stdout);
        cin>>r>>s ;
        for(ll i=0;i<3001;i++)
        for(ll j=0;j<3001;j++)
        dp[i][j]=-1 ;
        
        ll ans=fun(r.length()-1,s.length()-1) ;
        
        string sans="" ;
       fun1(r.length()-1,s.length()-1,ans,sans) ;
        
        reverse(all(sans)) ;
        cout<<sans ;
      
        
        
      }








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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> vec(n);
    rep(i, n) cin >> vec[i];
    sort(vec.begin(), vec.end());
    int ans = 0;
    rep(i, k) ans += vec[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
// C - Connect Cities
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int n, m; cin>>n>>m;
	dsu d(n);
	rep(i, m){
		int a, b; cin>>a>>b;
		d.merge(a-1, b-1);
	}
	set<int> l;
	rep(i, n) l.insert(d.leader(i));
	cout<< l.size()-1 <<endl;
}


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

const ll INF = 1001002003004005006ll;

ll dp[301][301];

int main() {
  int n, k;
  cin >> n >> k;
  int m = n - k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  h.insert(h.begin(), 0);
  rep(i, n + 1) rep (j, m + 1) dp[i][j] = INF;
  dp[0][0] = 0;
  for (int i = 1; i <= n; ++i) rep (j, m) {
    ll now = INF;
    rep(k, i) {
      chmin(now, dp[k][j] + max(0, h[i] - h[k]));
    }
    dp[i][j + 1] = now;
  }
  ll ans = INF;
  rep(i, n + 1) chmin(ans, dp[i][m]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 896
#include<stdio.h>
int main(void){
  int n,k;
  double ans=0,p[200000],q[200000];
  scanf("%d %d",&n,&k);
  for(int i=0;i<n;i++){
    scanf("%lf",&p[i]);
    p[i]=(p[i]+1)/2;
  }
  for(int i=0;i<k;i++){
    q[0]+=p[i];
    ans=q[0];
  }
  for(int i=1;i<n-k+1;i++){
    q[i]=q[i-1]-p[i-1]+p[i+k-1];
    if(ans<q[i]){
      ans=q[i];
    }
  }
  printf("%lf",ans);
  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int D,N;

int main(){
  cin >> D >> N;
  int ans = 1;
  for(int i = 0;i < D;i++) ans *= 100;
  int cnt = 0;
  int now = ans;
  while(cnt < N){
    if((now / ans) % 100 == 0) {
      now += ans;
      continue;
    }
    cnt++;
    now += ans;
  }

  cout << now - ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define vi vector<int>
#define fi first
#define sec second
#define pb push_back
#define ll long long int
#define mp make_pair
#define endl '\n'
#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)

long long a;
double b;
long long c;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin>>a>>b;
    c = (b+0.001)*100;
    a*=c;
    a/=100;
    cout<<a;
}


Measured memory_bytes: 3656
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	solve(){}
	ll operator()(int n, vi&a) {
		sort(a.rbegin(), a.rend());
		ll ret=0;

		for(int i=1;i<n;i++)
		{
			ret+=a[i/2];
		}
		return ret;
	}
};

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

	for(;;)
	{
		int n;
		cin >> n;
		if(cin.fail()) break;
		vi a(n);
		for(auto&m:a) cin >> m;

		cout << solve()(n, a) << "\n";
	}
	return 0;
}


Measured memory_bytes: 3988
#include<stdio.h>
int main()
{
 int a,b;
 scanf("%d %d",&a,&b);
 if(a%3==0){
 printf("Possible");
 }else if(b%3==0){
 printf("Possible");
 }else if((a+b)%3==0){
 printf("Possible");
 }else{
 printf("Impossible");
 }
return 0;
}


Measured memory_bytes: 128
using System;
class ProgramB
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int L = int.Parse(input[1]);

            int sum = 0;

            if( L >= 0)
            {
                for(int i = 2; i <= n;i++)
                    sum += L - 1 + i;
            }
            else if( L < 0 && n <= Math.Abs(L) + 1)
            {
                for(int i = 1; i <= n - 1;i++)
                    sum += L - 1 + i;
            }
            else
            {  
                for(int i = 1; i <= n ;i++)
                    sum += L - 1 + i;
            }


            Console.WriteLine(sum);
        }
    }

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

int main() {
    vector<int> v(3);
    for (int i = 0; i < 3; ++i) {
        cin >> v.at(i);
    }

    sort(v.begin(), v.end());

    int ans = v.at(0) + v.at(1);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_que<int> pque;//これは大きい順
//typedef priority_que<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
  int h,n;
  cin >> h >> n;
  int a[n];
  rep(i, n) cin >> a[i];
  int sum=0;
  rep(i,n) sum += a[i];
  if(sum >= h) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void)
{
	int x, i = 1;
	
	while (scanf("%d", &x))
	{
		if(x == 0)
		{
			break;	
		}
		printf("Case %d: %d\n", i++, x);
	
	}
	return 0;
}


Measured memory_bytes: 2568
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "tmp.cpp"

int calc2(string s) { return (s[0] - '0') * 10 + (s[1] - '0'); }

int calc(string s) {
  string h = s.substr(0, 2), m = s.substr(3, 2), sec = s.substr(6, 2);
  return calc2(h) * 3600 + calc2(m) * 60 + calc2(sec);
}

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

  while (true) {
    int n;
    cin >> n;
    if (n == 0)
      break;
    vector<int> imos(24 * 60 * 60, 0);

    REP(i, n) {
      string s, t;
      cin >> s >> t;
      imos[calc(s)]++;
      imos[calc(t)]--;
    }

    int size = imos.size();
    FOR(i, 1, size) { imos[i] += imos[i - 1]; }

    int ans = 0;
    REP(i, size) { chmax(ans, imos[i]); }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3468
import statistics

def main():
    num = int(input())
    data = list(map(int, input().split()))

    for i in range(num):
        data[i] -= i + 1

    data.sort()
    mean = statistics.median(data)
    mean = int(round(mean, 0))

    ans = 0

    for i in range(num):
        data[i] -= mean
        ans += abs(data[i])
    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 27224
//be name khoda
#include<bits/stdc++.h>

typedef long long ll;
typedef long double ld;

using namespace std;

const ll INF = 1e18;
const ll maxn = 220;
const ll K = 2e5+10;
const ll mod = 1e9+7;

ll n , m , w;
ll dp[maxn][K], c[maxn], v[maxn];

int main()
{
    cin>> n >> w;
    for(ll i = 1; i <= n; i++){
        cin>> c[i] >> v[i];
    }

    for(ll i = 1; i <= n; i++)
    {
        for(ll j = 0; j <= w; j++){
            if(i == 1){
                if(j >= c[i])
                    dp[i][j] = v[i];
                else
                    dp[i][j] = 0;
                continue;
            }
            if(j >= c[i])
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-c[i]] + v[i]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout<< dp[n][w];
}










Measured memory_bytes: 156544
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

int N, C;
vector<vector<int>> channel(31, vector<int>(100001, 0));

int main(void){
    
    scanf("%d %d", &N, &C);
    for(int i = 0; i < N; ++i){
        int s, t, c; scanf("%d %d %d", &s, &t, &c);
        --s;
        ++channel[c][s], --channel[c][t];
    }
    
    for(int i = 1; i <= C; ++i) for(int j = 1; j < 100001; ++j) channel[i][j] += channel[i][j - 1];
    for(int i = 1; i <= C; ++i) for(int j = 0; j < 100001; ++j) if(channel[i][j]) channel[i][j] = 1;
    
    int ans = 0;
    for(int i = 0; i < 100001; ++i){
        int cnt = 0;
        for(int j = 1; j <= C; ++j) cnt += channel[j][i];
        ans = max(ans, cnt);
    }
    printf("%d\n", ans);
    
    return 0;
}



Measured memory_bytes: 12800
#include <stdio.h>
int a[100];
int main(void){
	int n,i,x=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		int d;
		scanf("%d",&d);
		a[d-1]=1;
	}
	for(i=0;i<100;i++)
		x+=a[i];
	printf("%d",x);
	return 0;
}

Measured memory_bytes: 128