akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

#define int64 long long

using namespace std;

int main()
{
	int64 xx, yy = 0, ii = 100;
	cin >> xx;
	do
	{
		yy++;
		ii *= 1.01;
	} while(ii < xx);
	cout << yy << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

ll solve(ll K) {
  ll n_mod_K = 7 % K;
  ll trial_count = 1;
  while (n_mod_K != 0) {
    if (trial_count > K) {
      return -1;
    }

    n_mod_K = (n_mod_K * 10 + 7) % K;
    trial_count++;
  }
  return trial_count;
}

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll K;
  cin >> K;

  // main procedure
  ll ans = solve(K);

  // output
  cout << ans << endl;

  return 0;
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef pair<int, int> PII;

const double EPS = 1e-10;

const int N = 1e+5;
const int Q = 50000;
int n, q;
int s[N], t[Q];

int binary_search(int x) {
  int l = 0;
  int r = n;
  int m;
  while (r-l > 0) {
    m = (l+r)/2;
    if (s[m] == x)
      return m;
    else if (s[m] < x) 
      l = m + 1;
    else
      r = m;
  }
  return -1;
}

int main() {
  int i;
  scanf("%d ", &n);
  for (i=0; i<n; i++)
    scanf("%d ", s+i);
  scanf("%d ", &q);
  for (i=0; i<q; i++)
    scanf("%d ", t+i);

  int res = 0;
  for (i=0; i<q; i++)
    if (binary_search(t[i]) != -1)
      res++;

  printf("%d\n", res);

	return 0;
}

Measured memory_bytes: 1776
# https://qiita.com/u2dayo/items/d83ef1c642302abaf89e#c%E5%95%8F%E9%A1%8Ctsundoku
from itertools import accumulate
import bisect

N, M, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_acc = [0] + list(accumulate(a))  # aを0冊読む=1冊も読まない場合があるので、[0]を先頭に追加します
b_acc = list(accumulate(b))  # bisect_rightでは、x以下の要素がいくつあるか？を求めるので、こちらに0は入れません

ans = 0
for an in range(N + 1):
    rem = K - a_acc[an]
    if rem < 0:
        # aをこれ以上読めません
        break

    bn = bisect.bisect_right(b_acc, rem)
    ans = max(ans, an + bn)

print(ans)


Measured memory_bytes: 132528
constexpr bool isDebugMode = false;
int testcase = 1;
#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
    #include <atcoder/all>
    using namespace atcoder;
#endif
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b , a % b) : b;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

void solve();

int main(){
    while(testcase--) solve();
    return 0;
}

void solve(){
    bool x; cin >> x; 
    pt(!x);    
    return;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(void){

    long long a, sum = 0 ;
    cin >> a ;
    
    for(int i = 3; i <= a; i += 3){
        sum += i;
    }
    
    for(int i = 5; i <= a; i += 5){
        sum += i;
    }
    
    for(int i = 15; i <= a; i += 15){
        sum -= i;
    }
    
    cout << a * ( a + 1 ) / 2 - sum << endl;

}


Measured memory_bytes: 3592
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
struct Node {
    int key;
    struct Node *prev, *next;
};
 
struct Node *nil;
 
void init() {
    nil = (struct Node *)malloc(sizeof(struct Node));
    nil->next = nil;
    nil->prev = nil;
}
 
void insert(int key) {
    struct Node *x = (struct Node *)malloc(sizeof(struct Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}
 
struct Node* listSearch(int key) {
    struct Node *cur = nil->next;
    while(cur != nil && cur->key != key ) {
        cur = cur-> next;
    }
    return cur;
}
 
void deleteNode(struct Node *t) {
    if (t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}
 
void deleteFirst() {
    deleteNode(nil->next);
}
 
void deleteLast() {
    deleteNode(nil->prev);
}
void deleteKey(int key) {
    deleteNode(listSearch(key));
}
 
void printList() {
    struct Node *cur;
    cur = nil->next;
    int isf = 0;
 
    while(1) {
        if (cur == nil) break;
        if(isf++ > 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}
 
 
int main(void) {
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for (i = 0; i < n; i++) {
        scanf("%s%d",com, &key);
        if(com[0] == 'i') {
            insert(key);
            np ++;
            size++;
        }else if(com[0] == 'd') {
            if(strlen(com) > 6) {
                if( com[6] == 'F') {
                    deleteFirst();
                }else if(com[6] == 'L') {
                    deleteLast();
                }
            }else {
                deleteKey(key);
                nd ++;
            }
            size --;
        }
    }
    printList();
    return 0;
 
}

Measured memory_bytes: 32952
#include<stdio.h>
int main(void){
  int sum=0;
  char A[4],B[4];
  scanf("%s",A);
  scanf("%s",B);
  for(int i=0;i<3;i++){
    if(A[i]==B[i]){
      sum++;
    }
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
struct node
{
    int a,b,c,d;
}re[10000];
int a[1005][1005];
int main()
{
    int h,w;
    cin>>h>>w;
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
        cin>>a[i][j];
    int cnt=0;
    for(int i=1;i<h;i++)
        for(int j=1;j<=w;j++)
        if(a[i][j]%2==1) a[i][j]--,a[i+1][j]++,re[cnt].a=i,re[cnt].b=j,re[cnt].c=i+1,re[cnt].d=j,cnt++;
    for(int j=1;j<w;j++)
        if(a[h][j]%2==1) a[h][j]--,a[h][j+1]++,re[cnt].a=h,re[cnt].b=j,re[cnt].c=h,re[cnt].d=j+1,cnt++;
    printf("%d\n",cnt);
    for(int i=0;i<cnt;i++)
        printf("%d %d %d %d\n",re[i].a,re[i].b,re[i].c,re[i].d);
}


Measured memory_bytes: 6144
#include<stdio.h>
int main() {
  char str[3];
  scanf("%s", str);
  int tmp = 0;
  int rcount = 0;
  int end(int pos) {
    if(pos == 2) {
      return 0;
    }
  }
  for(int i=0; i<3; i++) {
    tmp = 0;
    if(str[i] == 'R') {
      tmp++;
      //printf("%s%d\n", "first",tmp);
      end(i);
      if(str[i+1] == 'R') {
        tmp++;
        end(i+1);
        //printf("%s%d\n", "second", tmp);
        if(str[i+2] == 'R') {
          tmp++;
          end(i+2);
          //printf("%s%d\n", "third", tmp);
        }
      }
    }
    //printf("%s%d\n", "final", tmp);
    if(rcount<tmp) {
      //printf("%d", rcount);
      //printf("%d\n", tmp);
      rcount = tmp;
      //printf("%s%d\n", "tmpRcount", rcount);
    }
  }
  printf("%d\n", rcount);
}


Measured memory_bytes: 1712
N, K = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
divisor = []
n = 1
while n*n <= s:
    q, m = divmod(s, n)
    if m==0:
        divisor.append(n)
        divisor.append(q)
    n += 1
if n*n==s:
    divisor.pop()
ans = 1
for d in divisor:
    M = []
    for a in A:
        M.append(a%d)
    n = sum(M) // d
    M.sort(reverse=True)
    a = n*d - sum(M[:n])
    if a <= K:
        ans = max(ans, d)
print(ans)


Measured memory_bytes: 3064
x = int(input())
if x < 4:
    print(1)
    exit()
ans = 1 # 1^b = 1
for i in range(2, x+1): # [2,x]
    a = i # a^1
    while a < x:
        a *= i # a^b,(b>=2)
        if a <= x: ans = max(ans, a)
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if((a*100+b*10+c)%4==0) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N,M;
    cin >> N >> M;
    int count=0;
    if(N>=2){
        count+=N*(N-1)/2;
    }
    if(M>=2){
        count+=M*(M-1)/2;
    }
    cout << count << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n,m;
int w[100010];
vector<int> g[100010];
int mx[100010];
bool vis[100010];

int dfs(int v,int pre){
  bool dame=false;
  vis[v]=true;
  mx[v]=0;
  for(int nv : g[v]){
    if(nv==pre)continue;
    if(vis[nv]||dfs(nv,v)==-1)dame=true;
    maxch(mx[v],mx[nv]);
  }
  mx[v]+=w[v];
  return dame?mx[v]=-1:mx[v];
}

int main(){
  cin>>n>>m;
  rep(i,n)cin>>w[i];
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  memset(mx,-1,sizeof(mx));
  dfs(0,-1);
  int add=0,sum=0;
  rep(i,n){
    if(mx[i]==-1)sum+=w[i];
    else maxch(add,mx[i]);
  }
  cout<<sum+add<<endl;

  return 0;
}



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

int main(void){
    int n,i,sum;
    double mean,min_dif;
    sum = 0;
    mean = 0.0;

    cin >> n;

    vector<int> a(n);
    vector<double> dif_mean_a(n);
    for(i=0; i<n; i++){
        cin >> a.at(i);
        sum += a.at(i);
    }

    mean = (double)sum / (double)n;
    min_dif = (double)sum;

    for(i=0; i<n; i++){
        dif_mean_a.at(i) = abs( (double)a.at(i) - mean );
        min_dif = min(dif_mean_a.at(i) , min_dif);
    }

    for(i=0; i<n; i++){
        if(min_dif == abs (a.at(i) - mean)){
            cout << i << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
ll n, total;
 
int main() {
  cin>>n;
  for (int i=1; i<=n; i++) {
    if (i%3!=0&&i%5!=0) total+=i;
  }
  cout<<total<<endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define sz(x) ((long long)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define oo 1e15;

const ld eps = 1e-9;
const ld pi = acosl(-1);
const int mod = 998244353;
const int mod1 = 1e9 + 7;


mt19937_64 rnd(time(0));

void faster()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios::sync_with_stdio(false);
}
int timer = 0;
vector <vector <int> > g;
vector <bool> used;
vector <int> topsort;
void dfs(ll v)
{
    if (used[v]) return;
    used[v] = true;
    for (auto i : g[v])
        dfs(i);
    topsort.push_back(v);
}
signed main() {
    faster();
    // freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
    //______________________________________
    /*__*/double start = clock();/*__*/
    //_____________________________________
    int n, m;
    cin >> n >> m;
    g.resize(n + 1);
    used.resize(n + 1);
    for (int i = 0; i < m; i++)
    {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
    }
    for (int i = 1; i <= n; i++)
        if (!used[i])
            dfs(i);
    vector <int> dp(n + 1, 0);
    int maxn = 0;
    fill(all(used), false);
    reverse(all(topsort));
    for (auto i : topsort)
    {
  //      cout << i << endl;
        used[i] = true;
        for (auto j : g[i])
        {
            if (used[j]) continue;
            dp[j] = max(dp[i] + 1, dp[j]);
            maxn = max(maxn, dp[j]);
        }
    }
    cout << maxn;
    //______________________________________
    //  cerr << "Time " << (clock() - start)  * 1.0 / CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 8696
// AOJ 2657: Books
// 2017.11.16 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct { char t[52]; int lt; char a[52]; int la; int d; } T;
T book[101]; int n;

int nxt[100], nxa[100];
int kmpMatch(char *text, int len, char *pattern, int patlen, int *next)
{
    char *pp;
    char *textEnd, *patEnd;

    if (len < patlen) return 0;

    textEnd = text + len;
    patEnd  = pattern + patlen;

    pp = pattern;
    while (text != textEnd) {
        if (*text++ == *pp) pp++;
        else if (pp != pattern) {
            pp = pattern + *(next + (pp - pattern));
            text--;
        }
        if (pp == patEnd) return 1;
    }
    return 0;
}

int kmpNext(int *next, int nlen, char *pattern, int patlen)
{
    char *tp, *pp;
    char *patEnd;

    if (nlen < patlen) return -1;

    patEnd  = pattern + patlen;
    *next = 0;

    tp = pp = pattern;
    while (++tp != patEnd) {
        *(next + (tp - pattern)) = pp - pattern;
        if (*tp == *pp) pp++;
    }
    return 0;
}

int ymd2d(char *s)
{
	int y, m, d;
	y = atoi(s), m = atoi(s+5), d = atoi(s+8);
	return (((y << 4) + m) << 5) + d;
}

int main()
{
	int i, j, q, lt, la, from, to;
	char qt[52], qa[52], buf[15], bu2[15];
	T *t;

	scanf("%d", &n);
	for (t = book, i = 0; i < n; i++, t++) {
		scanf("%s%s%s", t->t, t->a, buf);
		t->lt = strlen(t->t), t->la = strlen(t->a), t->d = ymd2d(buf);
	}
	scanf("%d", &q);
	for (i = 0; i < q; i++) {
		int ft, fa, fm, fo;
		ft = fa = fm = fo = 0;
		scanf("%s%s%s%s", qt, qa, buf, bu2);

		if (*qt == '*') ft = 1;
		else lt = strlen(qt), kmpNext(nxt, 100, qt, lt);

		if (*qa == '*') fa = 1;
		else la = strlen(qa), kmpNext(nxa, 100, qa, la);

		if (*buf == '*') fm = 1;
		else from = ymd2d(buf);

		if (*bu2 == '*') fo = 1;
		else to = ymd2d(bu2);

		if (i > 0) putchar('\n');
		for (t = book, j = 0; j < n; j++, t++) {
			int a = ft, b = fa, c = fm, d = fo;
			if (!a) a = kmpMatch(t->t, t->lt, qt, lt, nxt);
			if (!b) b = kmpMatch(t->a, t->la, qa, la, nxa);
			if (!c) c = (t->d >= from);
			if (!d) d = (t->d <= to);

			if (a&b&c&d) puts(t->t);
		}
	}
	return 0;
}

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

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

    bool a = false, b = false;
    rep(i, 0, 3) {
        if (s[i] == 'A') a = true;
        if (s[i] == 'B') b = true;
    }

    if (a && b) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> A = new ArrayList<>();
        for(int i=0; i<N; i++){
            A.add(scanner.nextInt());
        }

        List<Integer> L = new ArrayList<>();
        List<Integer> R = new ArrayList<>();
        List<Integer> GCDatI = new ArrayList<>();

        for(int i=0; i<N; i++){
            L.add(0);
            R.add(0);
            GCDatI.add(0);
        }
        
        for(int i=0; i<N; i++){
            if(i==0){
                L.set(i,0);
            }else{
                L.set(i, GCD(L.get(i-1), A.get(i-1)));
            }
        }

        for(int i=N-1; i>=0; i--){
            if(i==N-1){
                R.set(i,0);
            }else{
                R.set(i, GCD(R.get(i+1), A.get(i+1)));
            }
        }

        for(int i=0; i<N; i++){
            GCDatI.set(i, GCD(L.get(i),R.get(i)));
        }
        System.out.println(Collections.max(GCDatI));
    }

    public static int GCD(int a, int b){
        int large;
        int small;
        if(a<b){
            large = b;
            small = a;
        }else{
            large = a;
            small = b;
        }
        if(small == 0){
            return large;
        }
        int temp;
        while( (temp=large%small) != 0){
            large = small;
            small = temp;
        }
        return small;
    }
}

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

int main() {
    int A, B, C; cin >> A >> B >> C;
    vector<int> k = {A, B, C};
    sort(k.begin(), k.end(), greater<int>());
    k[2] += k[0] - k[1];
    cout << (k[0] - k[1]) + (k[0] - k[2]) / 2 + ((k[0] + k[2] ) % 2) * 2 << endl;
}


Measured memory_bytes: 256
n,x=map(int,input().split())
a=list(map(int,input().split()))
sm=0
for i in range(n-1):
  b=max(a[i]+a[i+1]-x,0)
  a[i+1]=max(a[i+1]-b,0)
  sm+=b
 
print(sm)

Measured memory_bytes: 19988
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int r = 0, b = 0;
	rep(i,s.size()){
		if(s[i] == '0') ++r;
		else ++b;
	}
	int ans = min(r, b) * 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
A,B,N = map(int,input().split())
def floor(x):
  return int(x//1)
list = []
if N >= B:
    list.append(floor((A*(B-1))/B)-(A*floor((B-1)/B)))
else:
    list.append(floor((A*N)/B)-(A*floor(N/B)))
print(max(list))

Measured memory_bytes: 61896
/***

   Author : Md. Jashim Uddin
   From   : RMSTU

 ***/
#include<bits/stdc++.h>
using namespace std;
#define     sf(a)           scanf("%d",&a)
#define     sff(a,b)        scanf("%d %d",&a,&b)
#define     sfff(a,b,c)     scanf("%d %d %d",&a,&b, &c)
#define     pb              push_back
#define     ll              long  long int
#define     fast            ios_base :: sync_with_stdio(false);cin.tie(0)
#define     pi              2*acos(0)
#define     sp              fixed<<setprecision
#define     lcm(a,b)        (a*b)/gcd(a,b)
#define     gcd(a,b)        _gcd(a,b)
#define     forn(i,n)       for(int i=1;i<=n;i++)
#define      mx               1000000
int main()
{
   ll m,n;
   cin>>m>>n;
   if(n>=m)cout<<"unsafe"<<endl;
   else cout<<"safe"<<endl;


    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << (b?"YES\n":"NO\n");}
void Yes(bool b) {cout << (b?"Yes\n":"No\n");}
void yes(bool b) {cout << (b?"yes\n":"no\n");}
void Yay(bool b) {cout << (b?"Yay!\n":":(\n");}

long long powmod(long long a,long long b){
    long long c=1;
    while(b>0){
        if(b&1) c=a*c%mod;
        a=a*a%mod;
        b>>=1;
    }
    return c;
}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n;
	cin >> n;
	vll a(n);
	rep(i,n) cin >> a[i];
	deque<ll> ans;
	rep(i,n){
		ll x=lower_bound(all(ans),a[i])-ans.begin();
		if(x==0) ans.push_front(a[i]);
		else ans[x-1]=a[i];
	}
	cout << SIZE(ans) << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}


ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

int main(){
  int n;cin>>n;
  vi a(n);

  rep(i,n) cin>>a[i];
  double bb=0, bs=1;
  rep(i,n) bs =a[i];
  rep(i,n) bb += bs/a[i];
  
  printf("%.14lf\n",bs/bb);
}
  


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

#define int long long

using namespace std;

inline int read() {
	int res=0,fh=1;
	char ch=getchar();
	while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
	if(ch=='-')fh=-1,ch=getchar();
	while(ch>='0'&&ch<='9')res=res*10+ch-'0',ch=getchar();
	return fh*res;
}

const int maxn=4000010;
const int mod=1e9+7;

int fac[maxn],inv[maxn];
inline int fpw(int x,int a){
	int ans=1;
	while(a){
		if(a&1) (ans*=x)%=mod;
		(x*=x)%=mod;
		a>>=1;
	}
	return ans;
}
inline int C(int n,int m){
	return (((fac[m]*inv[n])%mod)*inv[m-n])%mod;
}

#define LL int
#define inv_fac inv
#define Mod mod
#define re register
#define Maxn maxn
inline void pre(){
	fac[0]=1;
	for(int i=1;i<maxn;i++)
		fac[i]=(fac[i-1]*i)%mod;
	inv[maxn-1]=fpw(fac[maxn-1],mod-2);
	for(int i=maxn-2;i>=0;i--)
		inv[i]=(inv[i+1]*(i+1))%mod;
}


int n,k;
int f[2010][2010];
//f[i][j] 表示在这些位置上已经放了i个白球，j种其他颜色的球。(i<j)

signed main(){
	n=read();if((k=read())==1) return puts("1"),0;
	pre();
	memset(f,0,sizeof f);f[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			f[i][j]=f[i-1][j];
			if(!j) continue;
			(f[i][j]+=f[i][j-1]*(n-j+1)%mod*C(k-2,n-i+(n-j+1)*(k-1)%mod-1)%mod)%=mod;
		}
	}
	return printf("%lld",f[n][n]%mod),0;
}


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

void solve() {
    ll n,ret = 0;
    cin>>n;
    set<ll> s;
    for(ll i = 1;i*i<=n*2;++i) {
        if( n%i== n/i) {
            //ret += i;
            s.insert(i);
        }
    }
    ll g = 0,u = 0;
    ll v = 0;
    for(ll i = 1;i*i<=n;++i) {
        ll y = n/i;
        ll x = n/(i+1) + 1;
        x = max(x, i+1);
        if(x<=y) {
            ll u = n - x*i, v = n - y*i;
            //cout<<n/x<<" "<<n/y<<" "<<i<<endl;
            //cout<<x<<" "<<y<<endl;
            if(v>i || i>u) {
                continue;
            }
            ll g = (u - i);
            if(g%i==0) {
                g/=i;
                ll cur = (x + g);
                s.insert(cur);
            }
        }
    }
    for(set<ll>::iterator it = s.begin();it!= s.end();++it) {
        ret += (*it);
    }
    cout<<ret<<endl;
}

int main(){
    //freopen("input.txt","r",stdin);
    solve();
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

const int max_n = 500005;
int a[max_n];
int n; 

void maxHeapify (int i )
{
	int l = 2*i + 1;
	int r = 2*i + 2;
	int largest;

	if (l < n && a[l] > a[i] )
		largest = l;
	else
		largest = i;
	if (r < n && a[r] > a[largest] )
		largest = r;

	if (largest != i ){
		swap (a[i], a[largest] );
		maxHeapify (largest );
	} // end if				
}

int main()
{
	memset (a, 0, sizeof (a ) );
	scanf ("%d", &n );
	rep (i, n ) scanf ("%d", &a[i] );

	for (int i = n - 1; i >= 0; i-- )
		maxHeapify (i );

	rep (i, n ){
		printf (" %d", a[i] );
	} // end rep
	printf ("\n" );	

	return 0;
}

Measured memory_bytes: 3152
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
# 同一の集合の判定
def same(x, y):
    if find(x) == find(y):
        return True
    else:
        return False
# 集合の併合
def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if par[x] > par[y]:
        x, y = y, x
    par[x] += par[y]
    par[y] = x

# 集合の数
def uCnt(x):
    return -par[find(x)]


N, M = map(int, input().split())
par = [-1 for i in range(N)]
for i in range(M):
    x, y, z = map(int, input().split())
    x -= 1
    y -= 1
    unite(x, y)

ans = [i for i in range(N) if par[i] < 0]
print(len(ans))

Measured memory_bytes: 7848
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF INT_MAX
#define INFLL _I64_MAX
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
int main(void)
{
	int n, ans=1;

	cin>>n;

	vector<int> d(n);

	rep(i, n) cin>>d[i];

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

	rep(i, n-1){
		if(d[i]!=d[i+1]){
			ans++;
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G1[500005];
vector<ll> G2[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
 
ll mod = 1000000007;
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

 
//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,sum,ans,a,b,c,e,g,h,w,i,j,k,q;
ll x[500005],y[500005],z[500005];
char s[500005];
bool dame;


void solve(ll unit){
    ll a = 0;
    ll max_a = 0;
    priority_queue <ll> pql;
    for(ll i=0;i<n;i++){
        ll low = (x[i] / unit) * unit;
        ll high = low + unit;
        ll num1 = abs(low - x[i]);
        ll num2 = abs(high - x[i]);
        //ll num = min(num1,num2);
        a += num1;
        pql.push(num1);
    }
    ll b = 0;
    bool ok = false;
    if(a <= k){
        ok = true;
    }
    while(!pql.empty()){
        ll large_int = pql.top();
        pql.pop();
        a -= large_int;
        b += unit - large_int;
        if(max(a,b) <= k){
            ok = true;
            break;
        }
    }
    if(max(a,b) <= k){
        ok = true;
    }
    if(ok){
        ans = max(ans,unit);
    }
    return;
}



int main(){
    cin >> n >> k;
    ans = 1;
    ll sum = 0;
    for(i=0;i<n;i++){
        cin >> x[i];
        sum += x[i];
    }
    for(ll i=1;i*i<=sum;i++){
        if(sum % i == 0){
            solve(i);
            solve(sum / i);
        }
    }
    p(ans);
    
    return 0;
}












Measured memory_bytes: 27776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll n,m,k,f[100010],b[100010];
vector<ll>ch[100010];
ll ans[100010];
void dep(ll now,ll cnt){
	for(ll i=0;i<ch[now].size();i++){
		ll next=ch[now][i];
		if(f[next]!=0){
			continue;
		}
		f[next]=cnt;
		dep(next,cnt);
	}
}
int main() {
	cin>>n>>m>>k;
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		ch[x].push_back(y);
		ch[y].push_back(x);
	}
	ll cnt=1;
	for(ll i=0;i<n;i++){
		if(f[i]!=0){
			continue;
		}
		f[i]=cnt;
		dep(i,cnt);
		cnt++;
	}
	for(ll i=0;i<n;i++){
		ans[f[i]]++;
	}
	for(ll i=0;i<k;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		if(f[x]==f[y]){
			b[x]++;
			b[y]++;
		}
	}
	for(ll i=0;i<n;i++){
		cout << ans[f[i]]-1-b[i]-ch[i].size()<<" ";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 12236
#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
const ll mod = 1e9+7; 
using namespace std;
int read(){
	int x=0,pos=1;char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) if(ch=='-') pos=0;
	for(;isdigit(ch);ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
	return pos?x:-x;
}
const int N = 3001;
int n,k;
ll f[N][N];
int main(){
	n=read(),k=read();
	for(int i=2;i<=n;i++){
		f[1][i]=1;
	}
	for(int i=1;i<k-1;i++){
		ll sum=f[i][n-i+1];
		for(int j=n-i;j>=2;j--){
			sum=(sum+f[i][j])%mod;
			f[i+1][j]=sum;
		}
	}
	ll ans=0;
	for(int i=2;i<=n;i++){
		ans=(ans+f[k-1][i])%mod;
	}
	if(k==1){
		ans=1;
	}
	if(k!=n){
		ll pm=1;
		for(int i=1;i<=n-k-1;i++){
			pm=pm*2ll%mod;
		}
		ans=ans*((pm)%mod)%mod;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 46976
#include<stdio.h>

int main(void)
{
  int n, m, i, j;

  scanf("%d %d", &n, &m);

  int A[n][m], b[m], ans[100] = {0};

  for(i = 0; i < n; i++) {
    for(j = 0; j < m; j++) {
      scanf("%d", &A[i][j]);
    }
  }

  for(i = 0; i < m; i++) {
    scanf("%d", &b[i]);
  }

  for(i = 0; i < n; i++) {
    for(j = 0; j < m; j++) {
      ans[i] += A[i][j] * b[j];
    }
  }

  for(i = 0; i < n; i++) {
    printf("%d\n", ans[i]);
  }

  return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

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

int32 n;
vector<vector<int32>> dist;
vector<vector<bool>> hito;
void bfs(int32 sx,int32 sy){
  queue<pii> que;
  que.emplace(sx,sy);
  while(!que.empty()){
    auto [cx,cy] = que.front();que.pop();
    REP(k,4){
      int32 nx = cx + dx[k];
      int32 ny = cy + dy[k];
      if(nx < 0 || n+2 <= nx)continue;
      if(ny < 0 || n+2 <= ny)continue;
      int32 d = dist[cx][cy];
      if(hito[cx][cy])++d;
      if(d < dist[nx][ny]){
        dist[nx][ny] = d;
        que.emplace(nx,ny);
      }
    }
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  dist = vector<vector<int32>>(n+2,vector<int32>(n+2,INF));
  dist[0][0] = 0;
  hito = vector<vector<bool>>(n+2,vector<bool>(n+2,false));
  REP(i,n)REP(j,n){
    hito[i+1][j+1] = true;
  }
  bfs(0,0);
  int32 ans = 0;
  REP(i,n*n){
    int32 p;
    cin >> p;
    --p;
    int32 x = p%n+1;
    int32 y = p/n+1;
    ans += dist[x][y];
    hito[x][y] = false;
    bfs(x,y);
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 5688
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}


int main(void) {
    int i,j;
    int n;
    while(cin >> n,n){
        n++;
        vi p(n+1),t(n+1);
        p[0] = t[0] = 0;
        rep(i,n-1) cin >> p[i+1] >> t[i+1];
        p[n] = 0, t[n] = INF;
        vector<vi> dp(n+1,vi(4,INF));
        dp[0][0] = 0;
        /* dp[i][j] := i個目までの風船を獲得して、j個の風船を載せていて、
            p[i]にいるときの最短移動距離
        */
        rep(i,n){
            bool c = false;
            rep(j,4)if(dp[i][j] < INF){
                c = true;
                if(j<3 && abs(p[i]-p[i+1])*(j+1) <= t[i+1]-t[i]){
                    dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j]+abs(p[i]-p[i+1]));
                }
                if(p[i]*(j+1)+p[i+1] <= t[i+1]-t[i]){
                    dp[i+1][1] = min(dp[i+1][1], dp[i][j]+p[i]+p[i+1]);
                }
            }
            if(c == false){
                cout << "NG " << i << endl;
                break;
            }
        }
        int ans = INF;
        rep(i,4) ans = min(ans, dp[n][i]);
        if(ans < INF){
            cout << "OK " << ans << endl;
        }
    }
}



Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>

using namespace std;

#define ll long long
#define ld long double
#define v vector

#define rep(i, n)      for (int i = 0; i < (int)(n); ++i)
#define rep3(i, m, n)  for (int i = (m); i < (int)(n); ++i)
#define rrep(i, n)     for (int i = (int)(n)-1; i >= 0; --i)
#define rrep3(i, m, n) for (int i = (int)(n)-1; i >= (m); --i)
#define all(x) x.begin(), x.end()
#define rall(x) x.end(x), x.begin()

#define endl '\n'


ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll solve(ll A, double B) {
  return A * (int)(B*100+0.5) / 100;
}

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

  double A;
  double B;
  cin >> A >> B;

  auto ans = solve(A, B);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

double p[200000];

int main()
{
	int N, K;
	double sum = 0, ans = 0;

	cin >> N >> K;
	rep(i, N) cin >> p[i];
	rep(i, N) p[i] = (p[i] + 1.0) / 2;

	rep(i, N) {
		if (i < K) {
			sum += p[i];
		}
		else {
			sum -= p[i - K];
			sum += p[i];
		}
		ans = max(ans, sum);
	}

	printf("%.10lf\n", ans);

	return 0;
}


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

int main() {
    int n,x;
    int max =-1000000;
    int min =1000000;
    long long sum = 0;
    cin >> n;
    while(n > 0){
        cin >> x;
        if(x > max)
            max = x;
        if(x < min)
            min = x;
        sum = sum + x;
        n--;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 3100
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

LL a[505][505];

int main(){
	ios::sync_with_stdio(false);
	LL n,k;
	cin >> k;
	
	n = min(500LL,k);
	for(LL i = 1;i <= n;i ++){
		for(LL j = 1;j <= n;j ++){
			a[j][i] = i;
		}
	}
	if(k > 500){
		k -= 500;
		for(LL i = 1;i <= k;i ++){
			for(LL j = 2;j <= n;j += 2){
				a[j][i] += n;
			}
		}
	}
	
	cout << n << endl;
	for(LL i = 1;i <= n;i ++){
		for(LL j = i;j <= n;j ++) cout << a[i][j] << ' ';
		for(LL j = 1;j < i;j ++) cout << a[i][j] << ' ';
		cout << endl;
	}
	return 0;
}
//

Measured memory_bytes: 3328
using System;

class Program
{
    static void Main(string[] args)
    {
        int n, f, r, total;

        while (true)
        {
            //テスト点数受け取り
            string[] str = Console.ReadLine().Split(' ');
            n = int.Parse(str[0]);
            f = int.Parse(str[1]);
            r = int.Parse(str[2]);

            //中間&期末の合計
            total = n + f;

            if (n == -1 && f == -1 && r == -1)
            {
                break;
            }

            if (total < 30 || n == -1 || f == -1)
            {
                Console.WriteLine("F");
            }
            else if (total >= 80)
            {
                Console.WriteLine("A");
            }
            else if (total >= 65)
            {
                Console.WriteLine("B");
            }
            else if (total >= 50 || r >= 50)
            {
                Console.WriteLine("C");
            }
            else if (total >= 30)
            {
                Console.WriteLine("D");
            }
          
        }
    }
}


Measured memory_bytes: 8884
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
 
//defines
typedef long long ll;
typedef long double ld;

    
ll a,b,c,n,m,k,t=1;

void solve()
{ 
  cin>>n;
  vector<ll>v(n+1),vv(n+1),vvv(n);
  for(ll i=1;i<=n;i++)cin>>v[i];
  for(ll i=1;i<=n;i++)cin>>vv[i];
  for(ll i=1;i<=n-1;i++)cin>>vvv[i];
  
  ll sum=0,prev=v[0];
  
  for(ll i=1;i<=n;i++)
  {
      if(prev==v[i]-1LL)
      {
          sum+=(vv[v[i]]+vvv[v[i]-1LL]);
          prev=v[i];
      }
      else
      {
           sum+=(vv[v[i]]);
          prev=v[i];
      }
  }
  cout<<sum;
  
 if(t>0)cout<<"\n";
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  //cin>>t;
    while(t--)
    {
        solve();
    }
  //cout<<sum;
        
    return 0;
}

Measured memory_bytes: 256
import * as fs from "fs";

const input = fs.readFileSync("/dev/stdin", "utf8");
const a = +input.split(" ")[0];
const b = +input.split(" ")[1];
const c = +input.split(" ")[2];
const d = +input.split(" ")[3];

const ac = BigInt(a) * BigInt(c);
const ad = BigInt(a) * BigInt(d);
const bc = BigInt(b) * BigInt(c);
const bd = BigInt(b) * BigInt(d);

let max: BigInt;

if (ac >= ad && ac >= bc && ac >= bd) {
  max = ac;
} else if (ad >= ac && ad >= bc && ad >= bd) {
  max = ad;
} else if (bc >= ac && bc >= ad && bc >= bd) {
  max = bc;
} else if (bd >= ac && bd >= ad && bd >= bc) {
  max = bd;
}

console.log(`${max}`);


Measured memory_bytes: 29616
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
	int r, c;
	cin >> r >> c;
	int spreadsheet[r][c];
	for(int i = 0; i < r; i++){
		for(int j = 0; j < c; j++){
			cin >> spreadsheet[i][j];
		}
	}
	int rsum[r];
	for(int i = 0; i < r; i++){
		rsum[i] = 0;
	}
	int csum[c];
	for(int i = 0; i < c; i++){
		csum[i] = 0;
	}
	int totalsum = 0;
	for(int i = 0; i < r; i++){
		for(int j = 0; j < c; j++){
			rsum[i] += spreadsheet[i][j];
			totalsum += spreadsheet[i][j];
		}
	}
	for(int i = 0; i < c; i++){
		for(int j = 0; j < r; j++){
			csum[i] += spreadsheet[j][i];
		}
	}
	for(int i = 0; i < r; i++){
		for(int j = 0; j < c; j++){
			cout << spreadsheet[i][j] << " ";
		}
		cout << rsum[i] << "\n";
	}
	for(int i = 0; i < c; i++){
		cout << csum[i] << " ";
	}
	cout << totalsum << "\n";
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,n;
cin >>x>>n;
int p=0,k=2,z=1,l,j=0,b=0;
int arr[n];
for(int i=0;i<n;i++)
{
    cin >> arr[i];
    if(arr[i]==x) b++;
}

if(n==0 || b<1)
{
    cout<< x;
    return 0;
}
while(p<1)
{
    l=x;
   if(z%2!=0) l=l-(k/2);
   else l=l+(k/2);
for(int i=0;i<n;i++)
{

    if(arr[i]==l)
    {       j++;

    }
}
if (j<1)
{
      cout<< l;
         p++;
         break;

}
k++;
z++;
j=0;
}
    return 0;
}


Measured memory_bytes: 3624
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <math.h>
#include <map>
#include <utility>
#define ll long long 
#define PI 3.14159265358979323846
#define INF 10000000000
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;

int main() {
	ll N, ans;
	cin >> N;
	rep(i, 100) {

		if (N <= i * 1000) {
			ans = (i*1000)-N;
			cout << ans << endl;
			return 0;
		}
	}

return 0;
}

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

int main() {
  long long N,M;
  cin >> N >> M;
  vector<long long> S(N),T(M),ans(N,0);
  for (int i=0; i<N; i++) {
    cin >> S[i];
  }
  for (int i=0; i<M; i++) {
    cin >> T[i];
  }
  long long value = 1;
  
  for (int i=0; i<M; i++) {
    value = 1;
    for (int j=0; j<N; j++) {
      if (T[i] == S[j]) {
        ans[j] += value;
        ans[j] %= 1000000007;
        value = 0;
      }
      value += ans[j];
      value %= 1000000007;
    }
  }
  
  long long answer = 1;
  for (int i=0; i<N; i++) {
    answer += ans[i];
    answer %= 1000000007;
  }
  
  cout << answer << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
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 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 long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

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

signed main(){
	ll n,s; cin>>n>>s;
	VL t(n); rep(i,n) cin>>t[i];
	ll l = t[0]; ll ans = 0;
	rep(i,n){
		if(!i) continue;
		if(t[i]-l<=s) ans+=t[i]-l;
		else ans+=s;
		l=t[i];
	}
	ans+=s;
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
    int n,f=0;
    scanf("%d",&n);
    if(n%10==7)
    {
        f++;
    }
    n=n/10;
    if(n%10==7)
    {
        f++;
    }
    n=n/10;
    if(n%10==7)
    {
        f++;
    }
    if(f>0)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 1624
import math

n = int(input())
N = math.factorial(n)
prime = [2]
for L in range(3,n):
    chk=True
    for L2 in prime:
        if L%L2 == 0:chk=False
    if chk==True:prime.append(L)
#print(prime)

cnt = []
for x in prime:
    l = N
    i = 0
    while 1:
        if l%x == 0:
            i += 1
            l //= x
        else:
            break
    cnt.append(i)
#print(cnt)

upper74 = 0
upper24 = 0
upper14 = 0
upper2 = 0
upper4 = 0
for x in cnt:
    if x >= 74:
        upper74 += 1
    if x >= 24:
        upper24 += 1
    if x >= 14:
        upper14 += 1
    if x >= 4:
        upper4 += 1
    if x >= 2:
        upper2 += 1
#print(upper2,upper4,upper24)
res = 0
#a**74タイプ
res += upper74
#a**2 * b**24　タイプ
res += (upper2 - 1)*upper24
#a**4 * b**14　タイプ
res += (upper4 - 1)*upper14
#a**2 * b**4 * c**4　タイプ
res += (upper4*(upper4 - 1)//2) * (upper2 - 2)
print(res)

Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll X;
    cin >> X;
    ll ans = 0;
    ans += 1000*(ll)(X/500);
    X -= (ll)(X/500)*500;
    ans += 5*(ll)(X/5);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256