akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	

    static String[] map =new String[1005];
    static int [] dx={1,0,-1,0};
    static int [] dy={0,1,0,-1};

	public static void main(String args[])throws IOException  {

		Scanner in = new Scanner(System.in);
		
		int n=in.nextInt();
		int[] a=new int[n+1];
		long ans=0;
		int maxx=0;
		for(int i=1;i<=n;i++)
		{
			a[i]=in.nextInt();
			maxx=Math.max(a[i], maxx);
			ans=ans+a[i];
		}
		
		System.out.println(ans-maxx/2);
//		while(in.hasNext())
//		{
//			
//			
//		}
//
//			
//		}
//		
	}
	
}


Measured memory_bytes: 23636
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long n = sc.nextLong();
		StringBuilder sb = new StringBuilder();
		while (n > 0) {
			n--;
			sb.insert(0, (char) ('a' + n % 26));
			n = n / 26;
		}
		System.out.println(sb.toString());
	}
}








Measured memory_bytes: 36028
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split(" ").map(n=>BigInt(n));
    
    let answer = 1n;

    if(A.filter(n=>n===0n).length !== 0) {
        console.log(0);
        return;
    }
    
    for(let i in A) {
        answer *= A[i];
        
        if(answer > 1000000000000000000n) {
            console.log(-1);
            return;
        }
    }
    
    console.log(answer.toString());
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 53796
#include <unistd.h>
 
void ft_putchar(char c)
{
  write(1, &c, 1);
}
 
void ft_putstr(char *str)
{
  while(*str)
    ft_putchar(*(str++));
}
 
int main()
{
  int i;
  int j;
  char c[27] = {0};
  
  i = 0;
  read(0, c, 26);
  i = 0;
  while (c[i])
  {
    j = i + 1;
  		while (c[j])
        {
          if (c[i] == c[j])
          {
            ft_putstr("no");
            return 0;
          }
          j++;
        }
    i++;
  }
  ft_putstr("yes");
  return 0;
}

Measured memory_bytes: 1404
N = int(input())
numbers = list(map(int, input().split()))

odds = list(filter(lambda x: x % 2 == 0, numbers))
evens = list(filter(lambda x: x % 2 == 1, numbers))

# evens_from_odds = sum(divmod(len(odds), 2))
# odds_from_evens = sum(divmod(len(evens), 2))
odds_from_evens = int(len(evens) / 2)
evens_mod = len(evens) % 2
if evens_mod == 1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 14108
#include <bits/stdc++.h>
    
using namespace std;
    
const int N = 2005;
    
int a[N];
    
vector<pair<int,int> >adj[N];
    
int vis[N];
    
int id;
void dfs(int x){
    vis[x]= 1;
    if(a[id]>a[x])id = x;
    
    int u,i;
    
    for(i=0;i<adj[x].size();++i){
        u = adj[x][i].second;
        if(!vis[u])
            dfs(u);
    }
}   

vector<int> ret[N];

void merge(vector<int> &a,vector<int> &b){
    vector<int> R;
    int p1 = 0,p2 = 0;
    
    while(p1<a.size() && p2<b.size())
        if(a[p1]>b[p2])
            R.push_back(a[p1++]);
        else
            R.push_back(b[p2++]);
    
    while(p1<a.size())
        R.push_back(a[p1++]);
    while(p2<b.size())
        R.push_back(b[p2++]);
    
    a = R;
}   
void dfs2(int x){
    int u,i;
    vis[x]= 2;
    for(i=0;i<adj[x].size();++i){
        u = adj[x][i].second;

        if(vis[u]==2)continue;

        dfs2(u);
        merge(ret[x],ret[u]);
    }
    ret[x].push_back(0);
    for(i=ret[x].size()-1;i>=1;--i)
        ret[x][i]= ret[x][i-1];
    ret[x][0]= a[x];
}

int gcd(int x,int y){
    if(x==0)return y;
    return gcd(y%x,x);
}
int main(){
    int n,i;
    cin>>n;
    for(i=1;i<=n;++i)scanf("%d",&a[i]);
    int j;
    for(i=1;i<=n;++i){
        for(j=1;j<=n;++j){
            if(gcd(a[i],a[j])>1)
                adj[i].push_back(make_pair(a[j],j));
        }
        sort(adj[i].begin(),adj[i].end());
    }
    vector<int> R;
    for(i=1;i<=n;++i){
        if(vis[i])continue;
        id = i;
        dfs(i);
        
        dfs2(id);
        merge(R,ret[id]);
    }
    for(i=0;i<R.size();++i)printf("%d ",R[i]);
}


Measured memory_bytes: 42752
//package AtCoder_163;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
        int k=Integer.parseInt(st.nextToken());
        long sum[]=new long[n+1];
        int mod=1000000007;
        for(int i=1;i<=n;i++){
            sum[i]=(sum[i-1]+i)%mod;
        }
        long ans=0;
        for(int i=k;i<=n+1;i++){
            long low=sum[i-1];
            long high=0;
            if(n-i>=0)
                high=(sum[n]-sum[n-i]+mod)%mod;
            else{
                high=sum[n];
            }
//            System.out.println(low+" "+high);
            long temp=(high-low+1+mod)%mod;
            ans=(ans+temp)%mod;
//            System.out.println(ans);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 34128
#include <iostream>

using namespace std;

int main()
{
    string s;

    int i=0;

    cin>>s;

    if((s[i]=='a' && s[i+1]=='b' && s[i+2]=='c')||(s[i]=='b' && s[i+1]=='a' && s[i+2]=='c') || (s[i]=='b' && s[i+1]=='c' && s[i+2]=='a') || (s[i]=='a' && s[i+1]=='c' && s[i+2]=='b') || (s[i]=='c' && s[i+1]=='a' && s[i+2]=='b')||(s[i]=='c' && s[i+1]=='b' && s[i+2]=='a'))

        cout<<"Yes";

    else
        cout<<"No";


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N; cin >> N;
  vector<tuple<ll, ll, ll>> abc(N);
  for(int i = 0; i < N; i++) {
    ll a, b, c; cin >> a >> b >> c;
    abc.at(i) = make_tuple(a, b, c);
  }
  vector<ll> dpa(N, 10000000000), dpb(N), dpc(N);
  dpa.at(0) = get<0>(abc.at(0)); dpb.at(0) = get<1>(abc.at(0)); dpc.at(0) = get<2>(abc.at(0));
  for(int i = 1; i < N; i++) {
    ll a = get<0>(abc.at(i)), b = get<1>(abc.at(i)), c = get<2>(abc.at(i));
    dpa.at(i) = max(dpb.at(i - 1), dpc.at(i - 1)) + a;
    dpb.at(i) = max(dpa.at(i - 1), dpc.at(i - 1)) + b;
    dpc.at(i) = max(dpb.at(i - 1), dpa.at(i - 1)) + c;
  }
  cout << max(max(dpa.at(N - 1), dpb.at(N - 1)), dpc.at(N - 1)) << endl;
}

Measured memory_bytes: 4992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String str = br.readLine();
      	final int DURATION = Integer.parseInt(str.split(" ")[0]);
      	final int NUM = Integer.parseInt(str.split(" ")[1]);
      	final int TIMELIMIT = Integer.parseInt(str.split(" ")[2]);
      	
      	int total = 0;
      	for (int i = 0; i < TIMELIMIT / DURATION; i++) {
   			total += NUM;
      	}
      	System.out.println(total);
	}
}


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

ll n;

int main() {
	cin >> n;
	for(ll i = sqrt(n); i >= 2; i--) {
		if(n % i == 0) {
			cout << i + (n / i) - 2 << endl;
			return 0;
		}
	}
	cout << n - 1 << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"io"
	"os"
	"sort"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

type cost struct{ i, c int }

type pqueue []edge

func (pq pqueue) Len() int { return len(pq) }

func (pq pqueue) Less(i, j int) bool {
	return pq[i].cost < pq[j].cost
}

func (pq pqueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

func (pq pqueue) Peek() interface{} {
	return pq[0]
}

func (pq *pqueue) Push(x interface{}) {
	*pq = append(*pq, x.(edge))
}

func (pq *pqueue) Pop() interface{} {
	n := len(*pq)
	x := (*pq)[n-1]
	*pq = (*pq)[:n-1]
	return x
}

type byX struct{ x, y, z []int }

func (b byX) Len() int           { return len(b.z) }
func (b byX) Less(i, j int) bool { return b.x[b.z[i]] < b.x[b.z[j]] }
func (b byX) Swap(i, j int)      { b.z[i], b.z[j] = b.z[j], b.z[i] }

type byY struct{ x, y, z []int }

func (b byY) Len() int           { return len(b.z) }
func (b byY) Less(i, j int) bool { return b.y[b.z[i]] < b.y[b.z[j]] }
func (b byY) Swap(i, j int)      { b.z[i], b.z[j] = b.z[j], b.z[i] }

type edge struct{ to, cost int }

func (con *contest) main() error {
	var n int
	con.Scan(&n)
	x := make([]int, n)
	y := make([]int, n)
	z := make([]int, n)
	v := make([][]edge, n)
	for i := 0; i < n; i++ {
		con.Scan(&x[i], &y[i])
		z[i] = i
	}
	sort.Sort(byX{x, y, z})
	for i := 0; i < n-1; i++ {
		c := x[z[i+1]] - x[z[i]]
		v[z[i]] = append(v[z[i]], edge{z[i+1], c})
		v[z[i+1]] = append(v[z[i+1]], edge{z[i], c})
	}
	sort.Sort(byY{x, y, z})
	for i := 0; i < n-1; i++ {
		c := y[z[i+1]] - y[z[i]]
		v[z[i]] = append(v[z[i]], edge{z[i+1], c})
		v[z[i+1]] = append(v[z[i+1]], edge{z[i], c})
	}
	res := 0
	used := make([]bool, n)
	pq := make(pqueue, 0, n*4)
	heap.Push(&pq, edge{0, 0})
	for pq.Len() > 0 {
		e := heap.Pop(&pq).(edge)
		if used[e.to] {
			continue
		}
		used[e.to] = true
		res += e.cost
		for _, x := range v[e.to] {
			if used[x.to] {
				continue
			}
			heap.Push(&pq, x)
		}
	}
	con.Println(res)
	return nil
}


Measured memory_bytes: 21504
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
int main() {
int n;
cin>>n;
long long int ans=0;
for(int i=1;i<=n;i++)
{
    for(int j=1;j<=n;j++)
    {
        for(int k=1;k<=n;k++)
        {
            ans+=gcd(i,gcd(j,k));
        }
    }
}
cout<<ans;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rapido ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

void solve()
{
   int n,x,t;cin>>n>>x>>t;
   int kitna=(int)ceil(n*1.0/x);
   int ans=kitna*t;
   cout<<ans<<endl;
}
int32_t main()
{
    rapido;
    int t;
    // cin>>t;
    t=1;
    while(t--)
    solve();
}

Measured memory_bytes: 3728
var n;
var t;
var g = {};
var x = {};

function dfs(t, u){
	var gt = g[t];
	g[t] = [];
	rep(gt.length, function(i){
		v = gt[i];
		if(g[v] !== u){
			dfs(v);
		}
		else{
			x[v] = true;
		}
	});
}

function main(){
	while(n = scan()){
		rep(n, function(i){
			var s = scan_string().slice(0, -1).split(':');
			g[s[0]] = s[1].split(',');
			if(i === 0){
				t = s[0];
			}
		});
		dfs(t);
		var ans = 0;
		for(var i in x){
			++ans;
		}
		print(ans);

		g = {};
		x = {};
	}
}

function rep(a, b, c){
	if(c === undefined){
		c = b;
		b = a;
		a = 0;
	}
	for(var i = a; i < b; ++i){
		if(c(i) === false){
			break;
		}
	}
}
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
var input = '';
var input_index = 0;
 
function scan(){
	return +input[input_index++];
}

function scan_string(){
	return input[input_index++];
}
 
function print(val){
	console.log(val);
}
 
process.stdin.on('data', function(chunk){
	input += chunk;
});
process.stdin.on('end', function(){
	input = input.trim().split(/\s+/);
	main();
});

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

int main(){
    int n,m ;
    cin >> n >> m;
    vector<pair<int,int> > wish(m,pair<int,int>(0,0)) ;
    for (size_t i = 0; i < m; i++)
    {
        cin >> wish.at(i).first >> wish.at(i).second ;
    }
    sort(wish.begin(),wish.end()) ;

    queue<pair<int,int> > wait ;

    pair<int,int> hoge ;
    for (size_t i = 0; i < m; i++)
    {
        hoge = make_pair(wish.at(i).first , wish.at(i).second) ;
        wait.push(hoge);
    }
    
    pair<int,int> now ;
    vector<pair<int,int> > ans;

    now = wait.front() ;
    wait.pop() ;
    
    //大小関係網羅した？
    while(wait.empty() == false){
        if (now.first == wait.front().first)
        {
            //ソートしてあるので実際はif文はいらない
            if (now.second < wait.front().second)
            {
                wait.pop() ;
            }
            
        }else if (now.second > wait.front().second)
        {
            now = wait.front() ;
            wait.pop() ;
        } /*↑↓ここの順番を逆にするとWA*/
        else if(now.second > wait.front().first)
        {
            now.first = wait.front().first ;
            wait.pop() ;
        }
        else
        {
            ans.push_back(now) ;
            now = wait.front();
            wait.pop() ;
        }
        
            
        
        
        
    }

    ans.push_back(now) ;

    cout << ans.size() << endl ;
    /* デバッグ用
    for (size_t i = 0; i < ans.size(); i++)
    {
        cout << ans.at(i).first << ans.at(i).second <<endl ;
    }
    */
}

Measured memory_bytes: 1792
#import <Foundation/Foundation.h>

NSString* input() {
    return [[[NSString alloc] initWithData:[[NSFileHandle fileHandleWithStandardInput] availableData] encoding:NSUTF8StringEncoding] stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
}
void output(NSFileHandle* handle,NSString* s){
    NSData  *dataout = [[NSData alloc] initWithBytes:[s UTF8String] length:[s lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
    [handle writeData:dataout];
}

int main(int argc, const char * argv[])
{
    NSFileHandle *fhandle = [NSFileHandle fileHandleWithStandardOutput];
    NSArray *l = [input() componentsSeparatedByString:@" "];
    NSInteger a = [[l objectAtIndex:0] integerValue];
    NSInteger b = [[l objectAtIndex:1] integerValue];
    NSInteger c = [[l objectAtIndex:2] integerValue];
    
    if(a<b){a^=b;b^=a;a^=b;}
    if(b<c){b^=c;c^=b;b^=c;}
    if(a<b){a^=b;b^=a;a^=b;}
    
    NSString *s = [NSString stringWithFormat:@"%ld\n",10*a+b+c];
    output(fhandle,s);
    
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<ll> l(87);
    l[0] = 2;
    l[1] = 1;
    for(int i = 2; i <= n; i++){
        l[i] = l[i-1] + l[i-2];
    }
    cout << l[n] << endl;
}

Measured memory_bytes: 3604
using System;
using System.Collections.Generic;

namespace Kznner
{
	class Program
	{
		static Dictionary<char, string> pronounces = new Dictionary<char, string>()
		{
			{'0', "pon"},
			{'1', "pon"},
			{'2', "hon"},
			{'3', "bon"},
			{'4', "hon"},
			{'5', "hon"},
			{'6', "pon"},
			{'7', "hon"},
			{'8', "pon"},
			{'9', "hon"}
		};
		
		static void Main()
		{
			string input = Console.ReadLine();
			char last = input[input.Length - 1];
			Console.WriteLine(pronounces[last]);
		}
	}
}

Measured memory_bytes: 26256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	string s; cin >> s;
	int ff = stoi(s.substr(0, 2));
	int ss = stoi(s.substr(2));

	if (((0 < ff) and (ff < 13)) and ((0 < ss) and (ss < 13))) cout << "AMBIGUOUS";
	else if (((ff >= 13) or (ff == 0)) and ((0 < ss) and (ss < 13))) cout << "YYMM";
	else if (((0 < ff) and (ff < 13)) and ((ss >= 13) or (ss == 0))) cout << "MMYY";
	else cout << "NA";


	return 0;
}


Measured memory_bytes: 3028
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int n;
  cin >> n;
  vector<int> v(n);
  for (auto &x: v) cin >> x;

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans += v[i] - (i + 1);
  }

  cout << ans << endl;

  return 0;
}



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

int main()
{
  ll n;
  cin >> n;
  vector<ll> v(n);
  rep(n) cin >> v[i];
  ll cnt = 0, tmp = 0;
  for (ll i = 1; i < n; i++)
  {
    if(v[i] <= v[i-1])
    {
      cnt++;
    } else {
      tmp = max(tmp,cnt);
      cnt = 0;
    }
  }
  tmp = max(tmp,cnt);
  cout << tmp << endl;
  return 0;
}

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

    cin>>str;

    long long n=0;

    for(char i: str)
    {
        n+=(i-'0');
    }

    if(n%9)
    {
        cout<<"No";
    }
    else
    {
        cout<<"Yes";
    }
}

Measured memory_bytes: 3748
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

int main(){
  int n;
  while(cin>>n , n){
    vector<int> vec(n);
    rep(i,n) cin>>vec[i];
    sort(all(vec));
    int res=INF;
    rep(i,n-1) res = min(res, vec[i+1]-vec[i]);
    cout << res<<endl;
  }
  return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define ll long long
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int n,k,ans;
signed main(){
	cin>>n>>k;
	for(int i=k+1;i<=n;i++){
		ans+=n-(n/i*k+min(n%i,max(k-1,(ll)0)));
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back 
#define int long long
using namespace std;
ll visited[51][5101], dist[51][5101], c[51], d[51], ans[51];
vector<pair<int, pair<int, int> > > graph[51];
int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m , s;
	cin >> n >> m >> s;
	for(int i = 0; i < m; i++){
		int a, b, c, t;
		cin >> a >> b >> c >> t;
		a--;
		b--;
		graph[a].pb(mp(b, mp(c, t)));
		graph[b].pb(mp(a, mp(c, t)));
	}
	for(int i = 0; i < n; i++){
		cin >> c[i] >> d[i];
		ans[i] = 1e18;
	}
	set<pair<int, pair<int, int> > > df;
	s = min(5000LL, s);
	df.insert(mp(0, mp(0, s)));
	visited[0][s] = 1;
	dist[0][s] = 0;
	for(int i = 0; i < 50; i++){
		for(int j = 0; j <= 5100; j++)
			dist[i][j] = 1e18;
	}
	dist[0][s] = 0;
	while(df.size()){
		pair<int, pair<int, int> > val = *df.begin();
		int cur_dist = val.first;
		int x = val.second.first;
		int coins = val.second.second;
		df.erase(df.begin());
		visited[x][coins] = 1;
		ans[x] = min(ans[x], cur_dist);
		if(coins < 5000){
			if(!visited[x][coins + c[x]]){
				int old_dist = dist[x][coins + c[x]];
				if(old_dist > cur_dist + d[x]){
					df.erase(mp(old_dist, mp(x, coins + c[x])));
					old_dist = cur_dist + d[x];
					dist[x][coins + c[x]] = old_dist;
					df.insert(mp(old_dist, mp(x, coins + c[x])));
				}
			}
		}
		for(auto to: graph[x]){
			int y = to.first;
			int cs = to.second.first;
			int dt = to.second.second;

			if(coins >= cs && !visited[y][coins - cs]){
				df.erase(mp(dist[y][coins - cs], mp(y, coins - cs)));
				dist[y][coins - cs] = min(dist[y][coins - cs], cur_dist + dt);
				df.insert(mp(dist[y][coins - cs], mp(y, coins - cs)));
			}
		}
	}
	for(int i = 1; i < n; i++)
		cout << ans[i] << '\n';

	return 0;
}

Measured memory_bytes: 14328
#include<iostream>
#include<cstdio>
using namespace std;
int a[200005];
int main(){
	int n,j=1;
	long long s=0,ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		while((s^a[i])!=s+a[i]){
			s^=a[j];
			j++;
		}
		s^=a[i];
		ans+=(i-j+1);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4,avx2,abm,fma")
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;

const char nl = '\n';
const ll INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-11;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());



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

	int a, b;
	cin >> a >> b;
	int x = max((100*a + 7) / 8, (100*b + 9) / 10);
	if(8*x < (a+1)*100 && 10*x < (b+1)*100) {
		cout << x << nl;
	} else {
		cout << -1 << nl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> //required
//#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define lb long double
#define pb push_back
#define loop(i,start,n) for(ll i=start;i<n;i++)
#define rloop(i,n,start)for(ll i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e15
#define NEG_INF -1e15
#define pll pair<ll,ll>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
//using namespace __gnu_pbds;

int main(){
	IOS;
	string str;
	cin >> str;
	ll cnt = 0;
	str = ' ' + str;
	ll dp[4] = {0};
	loop(i, 1, str.size()){
		if(str[i] == 'R')
			dp[i] = dp[i - 1] + 1;
		else
			dp[i] = 0;
		cnt = max(cnt, dp[i]);
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3656
def resolve():
    n,m=map(int, input().split())
    h = list(map(int, input().split()))
    ans = [1 for i in range(n)]
    high = [0 for i in h]

    for i in range(m):
        a,b = map(int, input().split())
        a -= 1
        b -= 1
        if h[a] == h[b]:
            ans[a] = 0
            ans[b] = 0
        elif h[a] < h[b]:
            ans[a] = 0
        else:
            ans[b] = 0
    print(sum(ans))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 20036
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		List<T> list = new ArrayList<T>();
		for(int i = 0; i < N; i++) {
			int A = sc.nextInt();
			int B = sc.nextInt();
			list.add(new T(A,B));
		}
		list.sort((s1,s2) -> {return s1.B - s2.B;});
		String ans = "Yes";
		long sum = 0;
		for (int i = 0; i < N; i++) {
			sum += list.get(i).A;
			if (sum > list.get(i).B) {
				ans = "No";
				break;
			}
		}
		System.out.println(ans);
	}
	static class T {
		int A;
		int B;
		int getA() {
			return A;
		}
		int getB() {
			return B;
		}
		T(int A,int B){
			this.A = A;
			this.B = B;
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 44988
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>

using namespace std;

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

	int sum = 0;
	int min = l;
	for (i = 0; i < n; i++) {
		sum += l + i;
		if (abs(min) > abs(l + i)) {
			min = l + i;
		}
	}

	cout << sum - min << endl;
	return 0;
}

Measured memory_bytes: 888
from cmath import rect, pi
def main():
    n, m = map(int, raw_input().split())
    a = [int(raw_input()) for _ in xrange(n)]
    a.sort()
    ans = 0j
    for i, x in enumerate(a):
        for j in xrange(i + 1, n):
            t = rect(1., pi * (x + a[j]) / m)
            ans += t * (n - j + i - 1) - t * (j - i - 1)
    ans /= n * (n - 1) * (n - 2) / 6
    print "%.12f %.12f" % (ans.real, ans.imag)
main()


Measured memory_bytes: 2820
#include <bits/stdc++.h>
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 long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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 Main(){
    ll x;
    cin >> x;
    int ans = 0;
    ll now = 100;
    while (true) {
        now += now / 100;
        ans += 1;
        if (now >= x) {
            cout << ans << en;
            return;
        }
    }
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
// using i64 = unsigned long long;
using namespace std;

int L;

double calc(double i) {
  double j = (L - i) / 2;
  double k = (L - i) / 2;
  return i * j * k;
}

int main() {

  cin >> L;
  double s = 1;
  double e = L - 2;
  while (abs(s - e) > 1e-7) {
      double m1 = s + (e - s) / 3;
      double m2 = e - (e - s) / 3;
      double r1 = calc(m1);
      double r2 = calc(m2);
      if (abs(r1 - r2) <= 1e-7) {
        s = m1;
        e = m2;
        break;
      } else if (r1 < r2) {
        s = m1;
      } else if (r1 > r2) {
        e = m2;
      }
  }
  cout.precision(20);
  cout << calc(s) << endl;
}

Measured memory_bytes: 256
N = int(input())
A = sorted([int(input()) for i in range(N)])

if N % 2 == 0:
    print(2 * (sum(A[N // 2:]) - sum(A[:N // 2])) - (A[N // 2] - A[N // 2 - 1]))
else:
    print(2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2])) - min(A[N // 2] - A[N // 2 - 1], A[N // 2 + 1] - A[N // 2]))


Measured memory_bytes: 8284
a = input()
b = input() 
if len(a) < len(b):
  print("LESS")
  exit()
elif len(a) > len(b):
  print("GREATER")
  exit()
else:
  for i in range(len(a)):
    if a[i] > b[i]:
      print("GREATER")
      exit()
    elif a[i] < b[i]:
      print("LESS")
      exit()
print("EQUAL")

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

long union_find_find(long num, vector<long> &vec) {
  // cout << "num: " << num << endl;
  if (vec[num] == -1) return num;
  long ret = union_find_find(vec[num], vec);
  vec[num] = ret;
  return ret;
}

unordered_map<long, unordered_set<long>> same_x_group;
unordered_map<long, unordered_set<long>> same_y_group;

unordered_map<long, unordered_set<long>> xs;
unordered_map<long, unordered_set<long>> ys;
unordered_set<long> roots;

void solve() {
  long N;
  cin >> N;

  vector<long> vec(N, -1);
  rep(i, N) vec[i] = -1;
  vector<pair<long, long>> points(N);

  // cout << "foo 1" << endl;

  rep (i, N) {
    long x, y;
    cin >> x >> y;
    same_x_group[x].insert(i);
    same_y_group[y].insert(i);
    points[i] = make_pair(x, y);
  }

  // cout << "foo 2" << endl;

  for (auto _it = same_x_group.begin(); _it != same_x_group.end(); _it++) {
    long tmp_root = *(_it->second.begin());
    for (auto it = _it->second.begin(); it != _it->second.end(); it++) {
      if (it == _it->second.begin()) continue;
      long node = *it;
      vec[node] = tmp_root;
    }
  }

  // cout << "foo 3" << endl;

  for (auto _it = same_y_group.begin(); _it != same_y_group.end(); _it++) {
    long first_node = *(_it->second.begin());
    // cout << "first_node: " << first_node << endl;
    long first_node_root = union_find_find(first_node, vec);
    // cout << "first_node_root: " << first_node_root << endl;
    for (auto it = _it->second.begin(); it != _it->second.end(); it++) {
      if (it == _it->second.begin()) continue;
      long current_node = *it;
      // cout << "current_node: " << current_node << endl;
      long current_node_root = union_find_find(current_node, vec);
      // cout << "current_node_root: " << current_node_root << endl;
      if (current_node_root != first_node_root) vec[current_node_root] = first_node_root;
    }
  }

  // cout << "foo 4" << endl;

  rep (i, N) {
    long root = union_find_find(i, vec);
    xs[root].insert(points[i].first);
    ys[root].insert(points[i].second);
    roots.insert(root);
  }

  // cout << "foo 5" << endl;

  long maximum_points = 0;

  for (auto r: roots) {
    maximum_points += xs[r].size() * ys[r].size();
  }

  // cout << "foo 6" << endl;

  cout << maximum_points - N << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 26392
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int[] A = new int[N];
      int[] sums = new int[N-1];
      
      int MOD = 1000000007;
      
      for(int i = 0; i < N; i++){
        A[i] = sc.nextInt();
      }
      for(int i = N-2; i >= 0; i--){
        if(i == N-2){
          sums[i] = A[i+1];
        }else{
          sums[i] = (sums[i+1] + A[i+1]) % MOD;
        }
      }
      
      // 計算
      long result = 0L;
      for(int i = 0; i < N-1; i++){
        long tmp = ((long)A[i] * sums[i]) % MOD;
        result = (result + tmp) % MOD;
      }
      
      // 出力
      System.out.println(result);
    }
    

}

Measured memory_bytes: 60860
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;

int main()
{
    ll n,m,i,a=0,b=0,k;
    string s,t;
    cin>>s>>t;
    cout<<t<<s;
}

Measured memory_bytes: 3588
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
A = readInts()
for i in range(5):
    if A[i] == 0:
        print(i+1)


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int c[30];

int main() {
	string s;
	cin >> s;
	rep(i, s.size()) c[s[i] - 'a'] = 1;

	if (s.size() < 26) {
		rep(i, 26) if (!c[i]) {
			s.pb('a' + i);
			break;
		}
		cout << s << endl;
		return 0;
	}

	for (int p = 25; p >= 0; --p) {
		string t, tt;
		for (int i = p; i < 26; ++i) {
			t.pb(s[i]);
		}
		tt = t;

		sort(ALL(tt));
		reverse(ALL(tt));

		if (tt == t) {
			continue;
		}

		reverse(ALL(tt));

		string ans;
		rep(i, p) ans.pb(s[i]);

		rep(i, tt.size()) if (tt[i] > s[p]) {
			ans.pb(tt[i]);
			break;
		}

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

	puts("-1");

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX (1 << 8)

int N, M;
int a[MAX];

int ki[MAX * 2 - 1];

int naiyo[MAX];

int main(void) {
	int i;
	int count = 0;
	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 0; i < M; i++) {
		if (scanf("%d", &a[i]) != 1) return 1;
		naiyo[a[i]] = 1;
	}
	for (i = 0; i < N; i++) {
		ki[N - 1 + i] = i;
	}
	for (i = N - 1 - 1; i >= 0; i--) {
		int l = ki[i * 2 + 1];
		int r = ki[i * 2 + 2];
		if (!naiyo[l] && !naiyo[r]) {
			ki[i] = l; /* douse siai wo suru node dotti demo ii */
			count++;
		} else if (!naiyo[l]) {
			ki[i] = l;
		} else if (!naiyo[r]) {
			ki[i] = r;
		} else {
			ki[i] = l; /* douse siai wo sinai node dotti demo ii */
		}
	}
	printf("%d\n", count);
	return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

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

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

int main(){
    string s; cin>>s;
    int n=s.size();

    int ans=0;
    int lb=0, ub=n-1;
    while(lb<=ub){
        if(s[lb]==s[ub]){
            lb++, ub--;
        }
        else if(s[lb]=='x'){
            lb++;
            ans++;
        }
        else if(s[ub]=='x'){
            ub--;
            ans++;
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);


int main(){
  int n;
  cin >> n;
  vector<int>d(n);
  rep(i,n){
    cin >> d[i];
  }
  sort(d.begin(),d.end());
  int left=d[(n-1)/2];
  int right=d[n/2];
  cout << right-left << endl;
  
  return 0;
}


Measured memory_bytes: 640
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solveC(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int[] x = nextInts();
		boolean[] flg = new boolean[6];
		Arrays.fill(flg,true);
		for(int i=0;i<5;i++) {
			flg[x[i]]=false;
		}
		for(int i=1;i<6;i++) {
			if(flg[i]) {
				pw.println(i);
				return;
			}
		}
	}
	public static void solveB(String[] args) throws Exception{
		int X = nextInt();
		int Y = nextInt();

		for(int turu=0;turu<100;turu++) {
			for(int kame=0;kame<100;kame++) {
				if(turu+kame==X&&turu*2+kame*4==Y) {
					pw.println("Yes");
					return;
				}
			}
		}
		pw.println("No");
	}
	public static void solveC(String[] args) throws Exception{
		int X = nextInt();
		int N = nextInt();

		int[] p ;
		if(N!=0) {
			p=nextInts();
		}else {
			nextString();
			p=new int[0];
		}
		boolean[] g = new boolean[102];
		Arrays.fill(g,true);
		for(int i=0;i<N;i++) {
			g[p[i]]=false;
		}
		int ans = -1;
		for(int i=0;i<=101;i++) {
			if(g[i]&&Math.abs(X-i) < Math.abs(X-ans)) {
				ans=i;
			}
		}
		pw.println(ans);


	}
	public static void solveD(String[] args) throws Exception{
		for(int i=1;i<=100;i++) {
			pw.print(i+" ");
		}
	}
	public static void solveE(String[] args) throws Exception{

	}

	public static TreeMap<Long, Long> primeFactorize(long N) {
		TreeMap<Long, Long> map = new TreeMap<>();
		for (long i = 2; i * i <= N; i++) {
			long k = 0;
			while (N % i == 0) {
				k++;
				N /= i;
			}
			map.put(i, k);
		}
		map.put(N, 1L);
		return map;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



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

int main() {
  int n,cnt=0;
  int s[100000];
  cin >> n;
  while(true){
    if(n%2 == 1 || n%2 == -1){
      s[cnt] = 1;
      n -= 1;
    }
    cnt++;
    n /= -2;
    if(n == 0){
      break;
    }
  }
  for(int i = cnt-1;i>=0;i--){
    cout << s[i];
  }
  cout << endl;

}

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

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

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

    long long int upper = 1e9, lower = 0, mid;
    while(upper - lower > 1){
        mid = (upper + lower) / 2;

        long long int times = 0;
        for(int i=0; i<n; i++){
            times += (a[i] - 1) / mid;
        }
        if(times > k) lower = mid;
        else upper = mid;

        //cout << mid << " " << times << endl;
    }
    cout << upper << endl;
    return 0;
}

Measured memory_bytes: 4840
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

// Conbination

int Cmax_def = 2200; // Cmax_def <= 2200
vector<vl> nCm_array; // nCm_array[6][2]  = 6C2,  nCm_array[9][9] = 9C9
void nCm_ini(void)
{
	nCm_array.resize(Cmax_def);
	rep(i, Cmax_def) {
		nCm_array[i].resize(Cmax_def);
		rep(j, i + 1) {
			ll ans;
			if ((j == 0) || (j == i))
				ans = 1;
			else
				ans = nCm_array[i - 1][j] + nCm_array[i - 1][j - 1];
			ans = min(ans, InfLL);
			nCm_array[i][j] = ans;
		}
	}
}

int main() {
	nCm_ini();
	ll N, K, S, T;
	cin >> N >> K >> S >> T;
	vl A(N);
	rep(i, N)
		cin >> A[i];
	ll B = 18;
	vb b_and(B), b_or(B);
	rep(b, B) {
		b_and[b] = (S >> b) % 2;
		b_or[b] = (T >> b) % 2;
	}
	vb can_use(N, true);
	vb both_01(B, true);
	ll ans = 0;
	rep(b, B) {
		if (b_and[b] && !b_or[b]) {
			ans = 0;
			cout << ans << endl;
			return 0;
		}
		if (b_and[b]) {
			both_01[b] = false;
			rep(i, N) {
				if ((A[i] >> b) % 2 == 0)
					can_use[i] = false;
			}
		}
		if (!b_or[b]) {
			both_01[b] = false;
			rep(i, N) {
				if ((A[i] >> b) % 2 == 1)
					can_use[i] = false;
			}
		}
	}
	ll BB = 1;
	rep(i, B)
		BB *= 2;
	rep(bb, BB) {
		vb bvec(B);
		ll onecount = 0;
		bool both_01_flag = 0;
		rep(b, B) {
			bvec[b] = (bb >> b) % 2;
			onecount += bvec[b];
			if (!both_01[b]&& bvec[b])
				both_01_flag = 1;
		}
		if (both_01_flag)
			continue;
		ll anstmp = 0;
		map<ll, ll> Amap;
		rep(i, N) {
			if (!can_use[i])
				continue;
			ll Atmp = 0;
			rep(b, B) {
				if (bvec[b] & ((A[i] >> b) % 2)) {
					ll Atmptmp = 1;
					rep(k, b)
						Atmptmp *= 2;
					Atmp += Atmptmp;
				}
			}
			Amap[Atmp]++;
		}
		auto it = Amap.begin();
		while (it != Amap.end()) {
			ll Acounttmp = it->second;
			for (int n = 1; n <= min(K, Acounttmp); n++) {
				anstmp += nCm_array[Acounttmp][n];
			}
			it++;
		}
		if (onecount % 2 == 1) {
			ans -= anstmp;
		}
		else
			ans += anstmp;
	}


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

Measured memory_bytes: 41500
while True:
    n, k = [int(i) for i in input().split()]
    if n == 0 and k == 0:
        break
    a = [int(input()) for i in range(n)]
    s = sum(a[0:k])
    max = s
    for i in range(k, n):
        s = s + a[i] - a[i - k]
        if s > max:
            max = s
    print(max)



Measured memory_bytes: 9880
#include<stdio.h>
#include<stdlib.h>
#define MAX 100005
#define NIL -1

struct Node {
  int p,l,r;
};

struct Node t[MAX];
int n,D[MAX];

void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",t[u].p);
  printf("depth = %d, ",D[u]);
  if(t[u].p==NIL)printf("root, ");
  else if(t[u].l==NIL) printf("leaf, ");
  else  printf("internal node, ");

  printf("[");
  for(i=0,c=t[u].l;c!=NIL;i++,c=t[c].r){
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void rec(int u, int p){
  D[u]=p;
  if(t[u].r!=NIL)rec(t[u].r,p);
  if(t[u].l!=NIL)rec(t[u].l,p+1);
}


int main(){
  int num,i,j,d,v,c,l,r;
  scanf("%d",&num);
  for(i=0;i<num;i++){
    t[i].p=t[i].l=t[i].r=NIL;
  }
  for(i=0;i<num;i++){
    scanf("%d",&v);
    scanf("%d",&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0)t[v].l=c;
      else t[l].r=c;
      l=c;
      t[c].p=v;
    }
  }
  for(i=0;i<num;i++){
    if(t[i].p==NIL)r=i;
  }

  rec(r,0);
  for(i=0;i<num;i++)print(i);

  return 0;
}



Measured memory_bytes: 6380