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

using namespace std;

int main()
{
    int H;
    int N;
    int A;
    int c=0;
    cin >> H;
    cin >> N;
    while(c<N){
        cin >> A;
        H-=A;
        c++;
    }
    if(H<=0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
    }


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main() {
	int n;
	cin >> n;
	
	vector<vector<int>> data(n + 10, vector<int>(3,0));
	rep(i, n) {
		cin >> data[i][0] >> data[i][1] >> data[i][2];
	}

	vector<vector<int>> dp(n + 10, vector<int>(3, 0));
	dp[0][0] = data[0][0];
	dp[0][1] = data[0][1];
	dp[0][2] = data[0][2];

	for (int i = 1; i < n; i++) {
		dp[i][0] = max(dp[i - 1][1] + data[i][0], dp[i - 1][2] + data[i][0]);
		dp[i][1] = max(dp[i - 1][2] + data[i][1], dp[i - 1][0] + data[i][1]);
		dp[i][2] = max(dp[i - 1][0] + data[i][2], dp[i - 1][1] + data[i][2]);
	}
	
	cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]) << endl;
	return 0;
}

Measured memory_bytes: 14292
def sumXOR(arr,n): 
      
    sum = 0
    for i in range(0, 65): 
    
        #  Count of zeros and ones 
        zc = 0
        oc = 0
           
        # Individual sum at each bit position 
        idsum = 0
        for j in range(0, n): 
            if (arr[j] % 2 == 0): 
                zc = zc + 1
                  
            else: 
                oc = oc + 1
            arr[j] = arr[j] // 2
          
           
        # calculating individual bit sum  
        idsum = oc * zc * (1 << i) 
    
        # final sum     
        sum = sum + idsum;  
      
    return sum%(1000000007)
  
  
  
# driver function  
sum = 0
n = int(input())
arr = list(map(int,input().split()))
arr.sort()
sum = sumXOR(arr, n); 
print (sum) 

Measured memory_bytes: 125624
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)

	V := make(map[int]int)
	var d int
	l := 0
	for i := 0; i < N; i++ {
		fmt.Scan(&d)
		if i == 0 && d != 0 {
			fmt.Println(0)
			return
		}

		V[d]++
		if l < d {
			l = d
		}
	}

	if V[0] != 1 {
		fmt.Println(0)
		return
	}

	ans := 1
	p := 1
	for i := 0; i <= l; i++ {
		if v, ok := V[i]; ok {
			for j := 0; j < v; j++ {
				ans = (ans * p) % 998244353
			}
			p = v
		} else {
			fmt.Println(0)
			return
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 8064
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <set>
using namespace std;
using vi = vector<int>;
using vsi = vector<set<int>>;

int main(void){
    int n, m;
    cin >> n >> m;
    vi H(n);
    for(int &h : H) cin >> h;
    vsi O(n);
    for(int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        a -= 1; b -= 1;
        O[a].insert(b);
        O[b].insert(a);
    }
    set<int> a;
    for(int i=0; i<n; i++){
        if(!O[i].empty()){
            bool frag = false;
            for(auto &v : O[i]){
                if(H[v] >= H[i]){
                    frag = true;
                    break;
                }
            }
            if(frag) continue;
        }
        a.insert(i);
    }
    cout << a.size() << '\n';
    return 0;
}

Measured memory_bytes: 22016
def resolve():
    # 整数 1 つ
    k = int(input())
    # 整数複数個
    A, B = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    r=False
    for i in range(A, B+1):
        if i % k == 0:
            print("OK")
            r=True
            break

    if r ==False:
        print("NG")

    #print("n")


resolve()

Measured memory_bytes: 61860
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N = int(input())
res = 0
for i in range(1,N+1,2):
    if len(make_divisors(i)) == 8:
        res += 1

print(res)

Measured memory_bytes: 3188
#include <stdio.h>

#define STR_MAX 100
#define MAX_NODE 500001

typedef struct _NODE{
    int key;
    struct _NODE *right;
    struct _NODE *left;
} NODE;

NODE node_pool[MAX_NODE];
int node_cnt;
NODE *root;

void insert_tree(NODE **root,int k);
void print_tree(NODE *root);
void print_tree_inorder(NODE *node);
void print_tree_preorder(NODE *node);

int main(){
    int i;
    int m,k;
    char buf[STR_MAX];

    node_cnt = 0;
    root = NULL;

    scanf("%d%*c",&m);
    for( i=0; i<m; i++){
        fgets(buf,STR_MAX,stdin);
        if(buf[0]=='i'){
            //insert
            sscanf(buf,"%*s %d",&k);
            insert_tree(&root,k);
        }else{
            //print
            print_tree(root);
        }
    }

    return 0;
}


void insert_tree(NODE **root,int k){
    NODE *y = NULL; // x の親
    NODE *x = *root;
    NODE *z = &node_pool[node_cnt];
    node_cnt++;
    z->key = k;
    z->right = NULL;
    z->left = NULL;

    while( x != NULL ){
        y = x; // 親を設定
        if( z->key < x->key ){
            x = x->left; // 左の子へ移動
        }else{
            x = x->right; // 右の子へ移動
        }
    }

    if( y == NULL){ // T が空の場合
        *root = z;
    }else if( z->key < y->key){
        y->left = z; // z を y の左の子にする
    }else{
        y->right = z; // z を y の右の子にする
    }
}

void print_tree(NODE *root){
    print_tree_inorder(root);
    printf("\n");
    print_tree_preorder(root);
    printf("\n");
}

void print_tree_inorder(NODE *node){
    if(node==NULL) return;
    print_tree_inorder(node->left);
    printf(" %d",node->key);
    print_tree_inorder(node->right);
}

void print_tree_preorder(NODE *node){
    if(node==NULL) return;
    printf(" %d",node->key);
    print_tree_preorder(node->left);
    print_tree_preorder(node->right);
}



Measured memory_bytes: 13428
#include <iostream>
#include <algorithm>

using namespace std;
const int MAXN = 1e5 + 5;

int n;

struct Data{
	int a, b;
}stu[MAXN];

int Comp(const Data &x, const Data &y) {
	return x.b < y.b;
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> stu[i].b;
		stu[i].a = i;
	}
	sort(stu + 1, stu + n + 1, Comp);
	for (int i = 1; i <= n; i++) cout << stu[i].a << " ";
	return 0;
}

Measured memory_bytes: 1536
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	string s; cin >> s;
	string t = s;
	reverse(t.begin(), t.end());
	int n = s.size() / 2;


	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] != t[i])ans++;
	}

	cout << ans << endl;

	return 0;
}

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

#define NUM 30

int main( void )
{
	vector <bool> at( NUM + 1, false );

	for ( int i = 0; i < NUM; i++ )
	{
		int student;
		cin >> student;
		at[student] = true;
	}

	for ( int i = 1; i < NUM + 1; i++ )
	{
		if ( at[i] == false )
			cout << i << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int BIT[200201];
void add(int A) {
	while (A <= 200200) {
		BIT[A]++;
		A += A & -A;
	}
}

int query(int A) {
	int kotae = 0;
	while (A > 0) {
		kotae += BIT[A];
		A -= A & -A;
	}
	return kotae;
}

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

	int N, K;
	cin >> N >> K;

	int A[200000];
	ll B[200001] = {}, C[200001] = {};
	rep(i, N) cin >> A[i];
	rep(i, N) {
		B[i + 1] = B[i] + A[i] - K;
		C[i + 1] = B[i + 1];
	}
	sort(B, B + N + 1);

	ll kotae = 0;
	int are = lower_bound(B, B + N + 1, 0) - B + 1;
	add(are);
	ce(are);
	rep(i, N) {
		are = lower_bound(B, B + N + 1, C[i + 1]) - B + 1;
		kotae += query(are);
		add(are);
	}
	co(kotae);

	Would you please return 0;
}

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

#ifndef DEBUG
#define endl '\n'
#define debug(...)
#else
#define debug(...) __VA_ARGS__
#endif
#define debugf(...) debug(printf(__VA_ARGS__);)

const int N = 1e5 + 5;
using ll = long long;

set<ll> seen;


int (((((main)))))() <%
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    ll n, k;
    cin >> n >> k;

    ll a = n / k;
    ll b = (n+k-1) / k;

    ll p = n - a*k;
    ll q = n - b*k;
    cout << min({ abs(p), abs(q), abs(p - k), abs(q - k) });

    return 0;
%>

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//--<for debugging>
#define whatis(x) cout << #x << " is " << x<<" ";
#define whatisl(x) cout << #x << " is " << x<<"\n";
#define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
#define lline cout<<"\n";
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
    
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a <<" , ";
    err(++it, args...);
}
//--</for debugging> 
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define testcase ll tt; cin >> tt; while(tt--)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
#define vll vector<ll>
#define pll pair<ll,ll>
#define sll set<ll>
#define pint pair<int,int>
const ll INF=1e9+7;
const ll MOD=1e9+7;
int main()
{
    boost vars
    cin>>s>>z;
    if(z>=s)cout<<"unsafe";
    else cout<<"safe";
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int ans = 0;
		int n = scanner.nextInt();
		for (int i = 0; i < n; i++) {
			int form = scanner.nextInt();
			int to = scanner.nextInt();
			ans += to-form+1;
		}
		
		System.out.println(ans);
		scanner.close();
	}
	

}


Measured memory_bytes: 25164
def doc_string():
	"""
	I can fly.
	"""

while True:
	try:
		a,b,c = map(str,raw_input().split())
	except EOFError:
		break
	
	if len(b) == 1:
		b = "0" + b
	if len(c) == 1:
		c = "0" + c
		
	code = int(a + b + c)
	
	if code >= 19890108:
		print "heisei",int(a) - 1989 + 1,int(b),int(c)
	elif 19261225 <= code and code <= 19890107:
		print "showa",int(a) - 1926 + 1,int(b),int(c)
	elif 19120730 <= code and code <= 19261224:
		print "taisho",int(a) - 1912 + 1,int(b),int(c)
	elif 18680908 <= code and code <= 19120729:
		print "meiji",int(a) - 1868 + 1,int(b),int(c)
	else:
		print "pre-meiji"

Measured memory_bytes: 6348
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] L = new int[2*N];
        int temp = 0, result = 0;
        for (int i = 0; i < 2*N; i++) {
            L[i] = scanner.nextInt();
        }
        for (int i = 0; i < L.length; i++) {
            for (int j = i; j < L.length; j++) {
                if (L[i] > L[j]) {
                    temp = L[i];
                    L[i] = L[j];
                    L[j] = temp;
                }
            }
        }
        for (int i = 0; i < L.length; i=i+2) {
            result += L[i];
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
object Main {
  def main(args:Array[String]) {
    var A = readLine().split(' ').map(_.toInt)
    var B = readLine().split(' ').map(_.toInt)
    var C = readLine().split(' ').map(_.toInt)
    val N = readLine().toInt
    var ans = "No"
    for(i <- 0 until N) {
      var num = readLine().toInt
      for(j <- 0 until 3) {
        if(A(j) == num) A(j) = -1
        else if(B(j) == num) B(j) = -1
        else if(C(j) == num) C(j) = -1
        if((A(j) + B(j) + C(j)) == -3) ans = "Yes"
      }
    }
    if(A.sum == -3 || B.sum == -3 || C.sum == -3) ans = "Yes"
    else if((A(0) + B(1) + C(2)) == -3 || (A(2) + B(1) + C(0)) == -3) ans = "Yes"
    println(ans)
  }
}


Measured memory_bytes: 25552
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    long long ans=10000000000;
    cin >> n>>k;
    long x[n];
    for(int i=0;i<n;i++){
        cin >> x[i];
    }


    int cent=0;
    vector<long long> plus,minus;
    plus.push_back(0);
    minus.push_back(0);
    for(int i =0;i<n;i++){
        if(x[i]<0){
            minus.push_back(x[i]);
        }
        if(x[i]==0){
            k--;
        }
        if(x[i]>0){
            plus.push_back(x[i]);
        }
    }
    sort(minus.begin(),minus.end(),greater<long>());
    // cerr << minus[0] << endl;
    // cerr << plus[0] << endl;

    for(int i =0;i<=k;i++){
        if(i>plus.size()-1 || k-i>minus.size()-1){
            continue;
        }
        // cerr << plus[i] <<" " << abs(minus[k-i])<<endl;
        if(i>0&&i<k){
            ans = min(ans,plus[i]+abs(minus[k-i])+min(plus[i],abs(minus[k-i])));
        }else{
            ans = min(ans,plus[i]+abs(minus[k-i]));
        }
        // cerr << ans<<endl;
    }

    if(k==0){
        ans =0;
    }

    cout << ans<<endl;
}

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

typedef long long ll;
ll MOD = 1000000007;

int main()
{   
    ll n, k;
    cin >> n >> k;
    vector <int> a(2*n);
    ll c1 = 0, c2 = 0, tmp;

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

    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            if (a[i] > a[j]) c1++;
        }
    }
    //cout << c1 << endl;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] > a[j]) c2++;
        }
    }
    //cout << c2 << endl;

    ll ans1 = (k*c1)%MOD;
    ll ans2 = (k*(k-1) / 2ll) % MOD;
    (ans2 *= c2) %= MOD;
    cout << (ans1 + ans2) % MOD << endl;

    
    return 0;
}


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

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

    int n; cin>>n;
    map<int, int> x, c;
    for(int i=0; i<n; ++i) {
        int a; cin>>a; 
        if (!x.count(a)) x[a]=i;
        ++c[a];
    }
    x[0]=n+1;

    long res[n]={}, s=0;
    int k=n+1;
    for(auto i=rbegin(x), j=i; ++j!=rend(x); ++i) {
        s+=c[i->first];
        k=min(k, i->second);
        res[k]+=(i->first - j->first)*s;
    }

    for(auto& e: res) cout<<e<<'\n';
}


Measured memory_bytes: 11264
inp = list(map(lambda x: int(x), input().split(" ")))
n = inp[0]
w = inp[1]
inp = []
for i in range(n):
    inp.append(list(map(lambda x: int(x), input().split(" "))))

dp = [[0]*(w+1) for i in range(n+1)]

for i in range(n):
    for j in range(w+1):
        if (j>=inp[i][0]):
            dp[i+1][j] = max(dp[i][j], dp[i][j-inp[i][0]]+inp[i][1])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[-1][-1])

Measured memory_bytes: 120300
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a <= 0 && 0 <= b)cout << "Zero" << endl;
  else if(a > 0)cout << "Positive" << endl;
  else if(b < 0){
    if((a-b) % 2 == 0)cout << "Negative" << endl;
    else cout << "Positive" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,t,num,ans,id,p;
int main()
{
	cin>>n>>t;
	ans=1010101010;
	for(int i=1;i<=n;i++) {
		cin>>p>>id;
		if(p<ans&&id<=t) ans=p;
	}
	if(ans==1010101010) printf("TLE");
	else printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
typedef pair< pairint , string> P;
int gcd( int x, int y ){ return y ? gcd(y, x%y) : x; }
bool pairCompare(const P& firstElof, const P& secondElof)
{
  if(firstElof.first.first!= secondElof.first.first)    return firstElof.first.first< secondElof.first.first;
else if(firstElof.first.second != secondElof.first.second)    return firstElof.first.second< secondElof.first.second;
else return false;
}
signed main() {
double x=0,y=0,z=0,w=0,n=0,m=0;
int a[4]={0,0,0,0},b[4]={0,0,0,0};
while(std::cin >> x>>y){
if(35.50>x&&71>y)std::cout << "AAA" << '\n';
else if(37.50>x&&77>y)std::cout << "AA" << '\n';
else if(40>x&&83>y)std::cout << "A" << '\n';
else if(43>x&&89>y)std::cout << "B" << '\n';
else if(50>x&&105>y)std::cout << "C" << '\n';
else if(55>x&&116>y)std::cout << "D" << '\n';
else if(70>x&&148>y)std::cout << "E" << '\n';
else std::cout << "NA" << '\n';
}
}



Measured memory_bytes: 3020
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

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

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const double EPS = 1e-10;

int main() {
	int N, K, res, max;

	while(cin >> N >> K, N) {
		vi num(N);
		res = 0;

		REP(i, N) {
			cin >> num[i];
		}

		REP(i, K) {
			res += num[i];
		}
		max = res;

		REP(i, N-K) {
			res -= num[i];
			res += num[K+i];

			if(max < res) {
				max = res;
			}
		}

		cout << max << endl;
	}

	return 0;
}

Measured memory_bytes: 1532
x = input()
xbc  = int(x[-2:])
xa   = int(x[0])
cost = xbc
cnt=0

for i in range(5,-1,-1):
    if((cost // i)>0):
        w = cost //i
        cost -= i*w
        cnt += w
    if(cost==0):
        break
if(int(x)<cnt*100):
    print("0")
else:
    print("1")

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

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    int tmp = b, ct = 0;
    while(tmp){
        tmp /= 10;
        ct++;
    }
    for(int i = 0; i < ct; ++i){
        a *= 10;
    }
    a += b;
    for(int i = 0; i * i <= a ; ++i){
        if(i * i == a){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 256
object Main extends App {
  val scan = new java.util.Scanner(System.in)
  val h, w = scan.next().toInt
  val map: Array[String] = for (_ <- (1 to h).toArray) 
                           yield scan.next()
  var flag = true
  for (y <- 0 until h) {
    for (x <- 0 until w) {
      if (map(y)(x) == '#') {
        if      (y-1 >= 0 && map(y-1)(x) == '#') {}
        else if (y+1 <  h && map(y+1)(x) == '#') {}
        else if (x-1 >= 0 && map(y)(x-1) == '#') {}
        else if (x+1 <  w && map(y)(x+1) == '#') {}
        else { flag = false }
      }
    }
  }
  println(if (flag) {"Yes"} else {"No"} )
}

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

int main(){
    int N;
    cin>>N;
    int board[2][N];
    for(int i=0;i<=1;i++){
        for(int j=0;j<N;j++){
            cin>>board[i][j];
        }
    }
    int zeros = 0,ones = 0;
    for(int i=0;i<N;i++){
        zeros += board[0][i];
    }
    ones = board[1][N-1];    int maxe = zeros+ones;
    for(int i=N-1;i>0;i--){
        zeros -=board[0][i];
        ones += board[1][i-1];
        maxe = max(maxe,zeros+ones);
    }
    cout<<maxe<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int N;

bool issym(vector<vector<char>> T, int k) {
	rep(i, N) rep2(j, i, N) if (T.at(i).at(k + j) != T.at(j).at(k + i)) return false;
	return true;
}

int main() {
	cin >> N;
	vector<vector<char>> S(N, vector<char>(N));
	rep(i, N) rep(j, N) cin >> S.at(i).at(j);
	dbvv(S);
	rep(i, N) {
		rep(j, N - 1) S.at(i).push_back(S.at(i).at(j));
	}
	dbvv(S);
	int ans = 0;
	rep(k, N) if (issym(S, k)) ans += N;
	cout << ans << endl;
}

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

#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define FILL0(x) memset(x,0,sizeof(x))
#define FILL1(x) memset(x,-1,sizeof(x))

using namespace std;

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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

    ll l, r;
    l = r = 0; //rは次に見る場所

    int zero = 0;
    if(s[0]=='0')
    {
        zero = 1;
    }

    ll ans = 0;
    while(r<n)
    {
        if(zero<=k)
        {
            chmax(ans, r-l+1);

            if(s[r]=='1' && s[r+1]=='0')
            {
                zero++;
            }

            r++;
        }
        else
        {
            if(s[l]=='0' && s[l+1]=='1')
            {
                zero--;
            }
            l++;
        }
    }

    cout << ans << endl;
 
 
    
    


    return 0;

}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 1, sizeof(mat))
const int N=100;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll cost,w;
	int n; cin >> n;
	int a[N]; FOR(i,0,n)cin >> a[i];

	FOR(i,-100,101){
		w=0;
		FOR(j,0,n){
			w += (a[j]-i)*(a[j]-i);
		}
		if(i==(-100))cost=w;
		else cost = min(cost,w);
	}
	cout << cost << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int main(){
  int n;
  cin >> n;
  vector<ll>v(n);
  rep(i,n)cin >> v[i];
  ll minlong = 1000000000000;
  vector<ll>rui(n+1);
  rui[0] = 0;
  rep(i,n){
    rui[i+1] += v[i] + rui[i];
  }
  rep(i,n-1){
    minlong = min(minlong,abs(rui[i+1] - (rui[n]-rui[i+1])));
  }
  cout << minlong <<endl;

  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using vec = vector<int>;
using vec2 = vector<vector<int>>;
ll inf = pow(2,62);

int main(){
    ll l, r, d;
    int count = 0;
    cin >> l >> r >> d;
    for(int i = l;i <= r;i++){
        if(i%d == 0){
            count++;
        }

    }
    cout << count << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define stop exit(0)
int main(){
    vector <long long> v;
    long long a,b=100,c=0,d=0,e=1,f=0,g=0,i,j,k=1,l=0,r=1,n,m[300001],z[400001],h[600001],p[600001],sum[10001];
    string s,t,x,y[200001];
    double q,u,w;
    cin>>a>>b>>c;
    d=min(b-1,c);
    cout<<(a*d)/b;
}

Measured memory_bytes: 9844
n = int(input())
s = input()

cnt = 0
w = [0]
for c in s:
    if c == '.':
        w.append(cnt + 1)
        cnt += 1
    else:
        w.append(cnt)

cnt = 0
b = [0]
for c in s:
    if c == '#':
        b.append(cnt + 1)
        cnt += 1
    else:
        b.append(cnt)

# w_c = [0]
# for i in range(n):
#     w_c.append(w_c[i] + w[i])
# b_c = [0]
# for i in range(n):
#     b_c.append(b_c[i] + b[i])

# ...###
res = 10**10
for i in range(n + 1):
    tmp = 0
    tmp += b[i]
    tmp += w[-1] - w[i]
    res = min(tmp,res)
print(res)


Measured memory_bytes: 59368
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 61
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};

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

    int K,X;
    cin>>K>>X;
    if(500*K>=X) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
n = gets.to_i
h = gets.split.map(&:to_i)
a = Array.new(n + 1, Float::INFINITY)
a[0] = 0
h.unshift(h[0])
0.upto(n - 1) do |i|
  a[i + 1] = [a[i + 1], (h[i] - h[i + 1]).abs + a[i]].min
  a[i + 2] = [a[i + 2], (h[i] - h[i + 2]).abs + a[i]].min if i < n - 1
end
puts a[n]

Measured memory_bytes: 11780
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, M;
vector<pair<int, int>> E[201010];
vector<pair<int, int>> EE[201010];
int vis[201010], col[201010];
//---------------------------------------------------------------------------------------------------
#define no "No"
#define yes "Yes"
string solve() {
    rep(i, 0, N) if (!vis[i]) {
        col[i] = 0;
        vis[i] = 1;
        queue<int> que;
        que.push(i);
        while (!que.empty()) {
            int q = que.front(); que.pop();

            fore(p, E[q]) {
                if (vis[p.first]) {
                    if (col[q] + p.second != col[p.first]) return no;
                } else {
                    col[p.first] = col[q] + p.second;
                    vis[p.first] = 1;
                    que.push(p.first);
                }
            }

            fore(p, EE[q]) {
                if (vis[p.first]) {
                    if (col[q] - p.second != col[p.first]) return no;
                }
                else {
                    col[p.first] = col[q] - p.second;
                    vis[p.first] = 1;
                    que.push(p.first);
                }
            }
        }
    }

    return yes;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        E[a].push_back({ b, c });
        EE[b].push_back({ a, c });
    }
    cout << solve() << endl;
}

Measured memory_bytes: 17664
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from math import gcd

N = read_a_int()
A = read_ints()

# わかっているのは自分以外のXORの演算
# Aiをすべて合計したら必ず
S = 0
for a in A:
    S ^= a

ans = []
for a in A:
    ans.append(S ^ a)
print(*ans)


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

int main(int argc, char ** argv) {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	int n; std::cin >> n;
	if (n < 3 || __builtin_popcount(n) == 1)
		return std::cout << "No" << std::endl, 0;
	std::cout << "Yes" << std::endl;
	for (int i = 2; i + 1 <= n; i += 2) {
		std::cout << i << ' ' << i + 1 << '\n';
		std::cout << i + 1 << ' ' << 1 << '\n';
		std::cout << 1 << ' ' << i + n << '\n';
		std::cout << i + n << ' ' << i + n + 1 << '\n';
	}
	std::cout << n + 1 << ' ' << 2 << '\n';
	if (n % 2 == 0) {
		for (int i = 2; i < n; ++i) {
			int t = n ^ 1 ^ i;
			if (2 <= t && t < n) {
				std::cout << n << ' ' << t + n * (t % 2 == 0) << '\n';
				std::cout << n * 2 << ' ' << i + n * (i % 2 == 0) << '\n';
				return 0;
			}
		}
		assert(0);
	}
	return 0;
}


Measured memory_bytes: 2304
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

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

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

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  string s;
  cin>>s;
  cout<<(s[2]==s[3]&&s[4]==s[5]?"Yes":"No")<<endl;

  return 0;
}




Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;

int main()
{
    const char *Alice = "Alice";
    const char *Bob = "Bob";
    const char *Draw = "Draw";

    int A, B;
    if (scanf("%d%d", &A, &B) < 2) return 0;

    A = A == 1 ? A + 13 : A;
    B = B == 1 ? B + 13 : B;

    printf("%s\n", A == B ? Draw : A < B ? Bob : Alice);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n,a,b,aa,bb;
int main(){
	cin>>n>>a>>b;
	aa=abs(a-n);
	bb=abs(b-n);
	if(aa<bb){
		cout<<"A"<<endl;
	}
	else cout<<"B"<<endl;
	return 0;
}

Measured memory_bytes: 256
X,K,D = (int(x) for x in input().split())
X=abs(X)
if X>K*D:
    print(X-K*D)
else:
    s=X//D
    X-=s*D
    K-=s
    if K%2==0:
        print(X)
    else:
        print(abs(X-D))

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

#define int long long
#define debug(x) cout<<#x<<" "<<x<<endl;

const int N=1e6+5;
const double eps=1e-9;
const int INF=1e18;

signed main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int x;cin>>x;
    cout<<x*x<<endl;
    return 0;
}

//Created Time  :2019/11/16 20:00:35


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define REPI(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) REPI(i,0,n)

typedef long long ll;

int SURP = 1000000007;


int main(){
	int N,Ma,Mb;

	cin >> N >> Ma >> Mb;

	int a[50];
	int b[50];
	int c[50];

	REP(i,N){
		cin >> a[i] >> b[i] >> c[i];
	}

	static int p[50][401][401];

	REP(i,N+1){
		REP(at,401){
			REP(bt,401){
				p[i][at][bt] = SURP;
			}
		}
	}

	p[0][0][0] = 0;

	REP(i,N){
		REP(at,401){
			REP(bt,401){
				if(p[i][at][bt] == SURP) continue;
				p[i+1][at][bt] = min(p[i+1][at][bt],p[i][at][bt]);
				p[i+1][at+a[i]][bt+b[i]] = min(p[i+1][at+a[i]][bt+b[i]],p[i][at][bt] + c[i]);
 			}
		}
	}

	int pp = 1;
	int tmp = SURP;

	while(true){
		if(Ma * pp >= 401 || Mb * pp >= 401) break;
		if(tmp >  p[N][Ma * pp][Mb * pp]) tmp = p[N][Ma * pp][Mb * pp];
    	pp++;
	}

	if (tmp == SURP) tmp = -1;
	cout << tmp << endl;

	return 0;
}


Measured memory_bytes: 26880
import java.io.*;
import java.util.StringTokenizer;

class Main {
	public static void main(String args[]) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String buf;

		try {
			while ((buf = br.readLine())!=null) {
				StringTokenizer st = new StringTokenizer(buf);
				long n = Integer.parseInt(st.nextToken());
				long m = Integer.parseInt(st.nextToken());
				long gcd;
				long lcm = n*m;
				while (n%m!=0) {
					long t = m;
					m = n%m;
					n = t;
				}
				gcd = m;
				lcm = lcm/gcd;
				System.out.println(gcd+" "+lcm);
			}
		} catch (Exception e) {
			System.out.println("Exception!");
		}
	}
}

Measured memory_bytes: 16876
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

int main() {
  int N, X;
  cin >> N >> X;
  int res;
  rep(i, N) {
    int x;
    cin >> x;
    int dis = abs(X - x);
    if (i == 0) {
      res = dis;
    } else {
      res = gcd(res, dis);
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define FOR(i, c) \
  \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
double func(double n){
  double ans=0;
  for(int i=1; i<=n; i++){
    ans += (double)(i)/n;
  }
  return ans;
} 

int main() {
  ll x,y,z=0,k,n,m,h,w,Min=1e9+1;
  double sum=0,Max=-1e9;
  string s,t,u;
  bool ok = false;
  cin >> n >> k; 
  VI a(n);
  vector<double> b(n);
  vector<double> c(n+1);
  c[0] = 0;
  rep(i,n){
    cin >> a[i];
  }
  for(int i=0;i<n;i++){
    b[i] = func(a[i]);
  }
  rep(i,n){
    c[i+1] = b[i]+c[i];
  }

  Max = c[k] - c[0];

  for(int i=0; i<n-k+1; i++){
    double tmp = c[i+1+k] - c[i+1];
    if(Max < tmp){
      Max = tmp;
    }
  }
  double ans = Max;
  cout << setprecision(15) << ans << endl;
  return 0;
}

Measured memory_bytes: 4096
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

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

    vector<ll> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }

    ll mh = h[0];
    ll ans = 1;

    for(int i = 1; i < n; i++){
        if(mh <= h[i]){
            mh = h[i];
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 500
int main(void)
{
  int n;    //??§????????????
  int i,j;  //i?????°???????????????j?????°????????????
  int d;    //?????????????????°

  scanf("%d", &d);
  while(1){
    scanf("%d", &n);

    int a[N][N]={}; //0??§?????????
    int k=0;        //??°?????????????????°
    int x=0;        //??????????????????
    
    //1???????´?
    for(i=0;i<n;i++)
      a[i][0]=1;//?????????

    while(1){
      for(i=k;i<n-k;i++)
	a[k][i]=1;//??????
      if(n-2*k<3){
	//	printf("a\n");/////
	x=1;
	break;
      }
      for(i=k;i<n-k;i++)
	a[i][n-k-1]=1;//??????
      
      //    printf("A\n");/////
      if(x)break;
      k++;
      for(i=n-k;i>=k+1;i--)
	a[n-k][i]=1;//??????
      if(n-2*k<3){
	//	printf("b\n");
	x=1;
	break;
      }
      for(i=n-k;i>=k+1;i--)
	a[i][k+1]=1;//??????
      
      //     printf("B\n");/////
      if(x)break;
      k++;
    }
   
    for(i=0;i<n;i++){//print
      for(j=0;j<n;j++){
	switch(a[i][j]){
	case 0:printf(" ");break;
	case 1:printf("#");break;
	}
      }
      puts("");
    }//endprint

    d--;
    if(d<=0)break;
    puts("");

  }//endwhile
  return 0;
}

Measured memory_bytes: 1568
import sys

S = input()

if S == 'SUN':
    print('7')
elif S == 'MON':
    print('6')
elif S == 'TUE':
    print('5')
elif S == 'WED':
    print('4')
elif S == 'THU':
    print('3')
elif S == 'FRI':
    print('2')
elif S == 'SAT':
    print('1')

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

using namespace std;

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

int main(){
        int a, b, c, d;
        cin>>a>>b>>c>>d;
        if(a+b==c+d){
                cout<<"Balanced"<<endl;
        }
        else if(a+b<c+d){
                cout<<"Right"<<endl;
        }
        else{
                cout<<"Left"<<endl;
        }
        return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    int x, y, sum=0;
    cin >> x >> y;
    if (x == 3) sum += 100000;
    if (x == 2) sum += 200000;
    if (x == 1) sum += 300000;
    if (y == 3) sum += 100000;
    if (y == 2) sum += 200000;
    if (y == 1) sum += 300000;
    if (x == 1 && y == 1) sum += 400000;
    cout << sum << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(void){
    int n, a, b; cin >> n >> a >> b;
    int total = 0;
    for (int i = 1; i < n + 1; i++){
        int sum = findSumOfDigits(i);
        if (sum >= a && sum <= b){
            total += i;
        }
    }
    cout << total << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9+7; constexpr int MAX = 200020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;
void y(bool cond) {
	if (cond)print("Yes");
	else print("No");
}

void no() {
	print("No");
	exit(0);
}

bool ng[11];
void solve() {
	int N, K; cin >> N >> K;
	REP(i,K){
		int d; cin >> d;
		ng[d] = true;
	}
	FOR(i,N,500000){
		string s = to_string(i);
		bool ok = true;
		REP(i, s.size()) {
			int num = s[i] - '0';
			if (ng[num])ok = false;
		}
		if (ok) {
			print(i); return;
		}
	}
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}




Measured memory_bytes: 256
#include <iostream>
#include <numeric>

inline int read(){
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=x*10+c-'0';c=getchar();}
	return x*f;
}

int cnt[1000001];

int main(){
  int n = read();
  int num = read();
  int g = num;
  int ex = (n-1)/8;
  cnt[num] = 1;
  /*
  for(int i=0;i<ex;i++){
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
  }
  for(int i=0;i<(n-1)%8;i++){
    num = read();
    g = std::gcd(g, num);
    cnt[num]++;
  }
  */
  for(int i=1;i<n;i++){
    num = read();
    g = std::gcd(num, g);
    cnt[num]++;
  }

  if(n - cnt[1] > 80000){
    if(g==1) printf("setwise coprime\n");
    else printf("not coprime\n");
    return 0;
  }

  if(g!=1){
    printf("not coprime\n");
    return 0;
  }

  int use[1000001];
  int max_S = 0;
  for(int i=2;i<=1000000;i++){
    if(use[i]==-1) continue;
    int S = 0;
    for(int j=i;j<=1000000;j+=i) {
      S += cnt[j];
      use[j] = -1;
    }
    if(max_S<S) max_S = S;
  }
  if(max_S<2) printf("pairwise coprime\n");
  else printf("setwise coprime\n");
}


Measured memory_bytes: 11440
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int i = 1;
    while(true){
      int n = sc.nextInt();
      if(n == 0){
        break;
      }
      System.out.println("Case " + i++ + ": " + n); 
    }
  }
}



Measured memory_bytes: 41164