akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int gcd(int x,int y){
if(y==0) return x;
return gcd(y,x%y);}
int main()
{
    int a,i,j,k;
    long long int m,n=0;
    scanf("%d",&k);
    for(i=1;i<=k;i++){
        for(j=1;j<=k;j++){
            for(a=1;a<=k;a++){
               m=gcd(gcd(i,j),a);
               n=m+n;
            }
        }
    }
    printf("%d",n);
    return 0;
}

Measured memory_bytes: 1736
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		A = A - (B + C);
		
		if(A < 0){
			A = A * -1;
		}
		else if(A > 0){
			A = 0;
		}
		System.out.println(A);
	}
}

Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
  ll n; cin>>n;
  vector<ll> x(n),y(n);
  for(int i=0; i<n; i++) {
    cin>>x[i];
    y[i] = x[i];
  }
  sort(y.begin(),y.end());
  for(int i=0; i<n; i++) {
    if(x[i]<y[n/2]) cout<<y[n/2]<<"\n";
    else cout<<y[n/2-1]<<"\n";
  }
}

Measured memory_bytes: 5376
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Data.List
import Data.Char

toTuple bs =
    let
        Just (a, bs') = B.readInt bs
        Just (b, _) = B.readInt $ B.dropWhile isSpace bs'
    in
        (a, b)

solve [] _ = 0
solve ((a,b):xs) m
    | m <= 0 = 0
    | otherwise = ((min b m) * a) + solve xs (m-b)

main = do
    [n,m] <- map read . words <$> getLine
    ds <- sort <$> replicateM n (toTuple <$> B.getLine)
    print $ solve ds m

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


Measured memory_bytes: 256
var
  s:ansistring;
  p:boolean;
  l:longint;
begin
  readln(s);
  while true do
  begin
    if s='' then begin writeln('YES');exit;end;
    p:=false;
    if length(s)<5 then begin writeln('NO');exit;end;
    l:=length(s);
    if (s[l]='m') and (s[l-1]='a') and (s[l-2]='e') and (s[l-3]='r') and (s[l-4]='d') then begin delete(s,l-4,5);p:=true;end;
    if s='' then begin writeln('YES');exit;end;
    l:=length(s);
    if (s[l]='r') and (s[l-1]='e') and (s[l-2]='m') and (s[l-3]='a') and (s[l-4]='e') and (s[l-5]='r') and (s[l-6]='d') then begin delete(s,l-6,7);p:=true;end;
    if s='' then begin writeln('YES');exit;end;
    l:=length(s);
    if (s[l]='e') and (s[l-1]='s') and (s[l-2]='a') and (s[l-3]='r') and (s[l-4]='e') then begin delete(s,l-4,5);p:=true;end;
    if s='' then begin writeln('YES');exit;end;
    l:=length(s);
    if (s[l]='r') and (s[l-1]='e') and (s[l-2]='s') and (s[l-3]='a') and (s[l-4]='r') and (s[l-5]='e') then begin delete(s,l-5,6);p:=true;end;
    if s='' then begin writeln('YES');exit;end;
    l:=length(s);
    if p=false then begin writeln('NO');exit;end;
  end;
end.


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#define x first
#define y second
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
#define int long long 
signed main(){
  int a,b;
  cin >> a >> b;
  cout << 6 - a - b;
  return 0;
} 


Measured memory_bytes: 256
def resolve():
    import itertools
    N = int(input())
    A = []
    X = []
    ans = [0]
    for _ in range(N):
        a = int(input())
        xx = []
        for __ in range(a):
            x = list(map(int, input().split()))
            xx.append(x)
        X.append(xx)
        A.append(a)
    for i in itertools.product([0, 1], repeat=N):
        flag = 0
        for p in range(N):
            for q in range(A[p]):
                if i[p] == 1 and X[p][q][1] != i[X[p][q][0]-1]:
                    flag = 1
        if flag == 0:
            ans.append(i.count(1))
    print(max(ans))
resolve()

Measured memory_bytes: 9252
# coding : utf-8

import numpy as np

A,B,C = input().split()
A,B,C = int(A),int(B),int(C)

if((B-A+1) > 2*C):
	for i in range(C):
		print(A + i)
	for i in range(C):
		print(B + i - C + 1)
else:
	for i in range(A,B+1):
		print(i)

Measured memory_bytes: 21524
#include<iostream>
#include<vector>
#include<utility>
#include<numeric>
 
int main(){
     
    size_t n;
    std::cin >> n;
 
    std::vector<size_t> t(n);
 
    for(auto&& e : t){
        std::cin >> e;
    }
 
    size_t sum = std::accumulate(t.begin(), t.end(), 0ul);
 
    size_t m;
    std::cin >> m;
 
    std::vector<std::pair<size_t, size_t>> px(m);
 
    for(auto&& e : px){
        size_t p, x;
        std::cin >> p >> x;
        e = {p, x};
    }
 
    for(size_t i = 0; i < m; i++){
        std::cout << sum - t.at(px.at(i).first - 1) + px.at(i).second << std::endl;
    }
     
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	// ReadString returns a WORD string.
	ReadString func() string
)

func init() {
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
}

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	n, _ := strconv.Atoi(ReadString())
	return n
}

func readInt64() int64 {
	n, _ := strconv.ParseInt(ReadString(), 0, 64)
	return n
}

// 10 11 12 => [10, 11, 12]
func readIntSlice(size int) []int {
	a := make([]int, size)
	for i := 0; i < size; i++ {
		a[i] = readInt()
	}
	return a
}

func get2byte(size int) [][]byte {
	a := make([][]byte, size)
	for i := 0; i < size; i++ {
		var low string
		fmt.Scan(&low)
		a[i] = []byte(low)
	}
	return a
}

func transpose(a [][]int) {
	n := len(a)
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			a[i][j], a[j][i] = a[j][i], a[i][j]
		}
	}
}

func fact(n, m int) int {
	res := 1
	for i := m + 1; i <= n; i++ {
		res *= i
	}
	return res
}

func perm(n, r int) int {
	if r > n {
		return 0
	}
	return fact(n, n-r)
}

func comb(n, m int) int {
	if m > n {
		return 0
	}
	return fact(n, n-m) / fact(m, 0)
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

func max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

func main() {
	a, b, n := readInt64(), readInt64(), readInt64()
	if b-1 >= n {
		fmt.Println(int64(math.Floor(float64(a) * float64(n) / float64(b))- float64(a) * math.Floor(float64(n)/float64(b))))
	} else {
		fmt.Println(int64(math.Floor(float64(a) * float64(b-1) / float64(b))- float64(a) * math.Floor(float64(b-1)/float64(b))))
	}
}


Measured memory_bytes: 1756
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] s = new int[n];
    int sum = 0;

    for (int i = 0; i < n; i++) {
      s[i] = sc.nextInt();
      sum += s[i];
    }

    Arrays.sort(s);
    for (int i = 0; i < n; i++) {
      if ((sum % 10) != 0) {
        System.out.println(sum);
        return;
      } else {
        if ((s[i] % 10) != 0) {
          sum -= s[i];
        }
      }
    }

    System.out.println(0);

  }
}


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

int main() {
  int N, M, a, b;
  cin >> N >> M;
  vector<int> vec(60);
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    vec.at(a - 1) += 1;
    vec.at(b - 1) += 1;
  }
  for (int i = 0; i < N; i++) {
    cout << vec.at(i) << endl;
  }
}



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

using namespace std;

const double Pi = 3.14159265;
const double Degree = Pi / 180;

int main(int argc, char const* argv[])
{
	double scale,dTheta,theta;
	double x,y;
	char comma;
	x = y = 0;
	theta = 0;

	while( cin >> scale >> comma >> dTheta && scale != 0 ){
		x += scale * cos( -theta * Degree );
		y += scale * sin( -theta * Degree );
		theta += dTheta;
	}
	cout << static_cast<int>(-y) << endl;
	cout << static_cast<int>(x) << endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <string>
#include <ctime>
#include <stdio.h>
#include <string.h>

using namespace std;

#define re return
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repm(i, n) for (int i = 1; i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define vi vector<int>
#define vl vector<long>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector< pair<int,int> >
#define ll long long
#define ld long double 
#define str string
// freopen("firesafe.in", "r", stdin);
// freopen("firesafe.out", "w", stdout);
long long unsigned ans=1;
//map<ll,ll>mmap;
int main(){
   int n,m;
   cin>>n>>m;
   if(abs(n-m)>1){
    cout<<0<<endl;
    return 0;
   }else{
    if(n==m){
      ans=ans*2;
      for(int i=0;i<n;i++){
        ans=ans*m*m;
        if(ans>(1000000000+7)){
          ans%=(1000000000+7);
        }
        m--;
      }
    }else{
      ans=ans*max(n,m);
      int val = min(m,n);
      for(int i=0;i<min(m,n);i++){
        ans=ans*val*val;
        if(ans>(1000000000+7)){
          ans%=(1000000000+7);
        }
        val--;
      }
    }
   }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
{
  int x,y,z,n;
  scanf("%d %d %d",&x,&y,&z);
  n=x;
  x=y;
  y=n;
  n=x;
  x=z;
  z=n;
  printf("%d %d %d",x,y,z);
  return 0;
}

Measured memory_bytes: 1712
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
typedef tuple<ll,int,int> T;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
int main(){
    int x,y;
    cin>>x>>y;
    int cnt=0;
    if(x>y){
       cnt++;
       if(x==abs(y))cnt=1;
       else if((x>0&&y>0)||(x<0&&y<0)){
           cnt+=(x-y)+1;
       }
       else if((x>0&&y<0)){
           cnt+=abs(x-abs(y));
       }
       else cnt+=abs(x-y);
    }
    else if(y>x){
        if(abs(x)==y)cnt++;
        else if((x>=0&&y>=0)||(x<=0&&y<=0))cnt=abs(x-y);
        else if (y>0&&x<0){
            cnt=abs(y-abs(x))+1;
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int n,k;
long long ans=0;
long long c=0;
int main()
{
    cin>>n>>k;
    if ((k&1)==1)
    {
        c = (n/k);
        ans = c*c*c;
    }else
    {
        c = (n/k);
        ans = c*c*c;
        c=0;
        for (int i=1; i<=n; ++i)
            if (i%k==(k>>1)) c+=1;
        ans += c*c*c;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int N,A,B;
int main() {
	scanf("%d%d%d",&N,&A,&B);
	if(A>B) {
		printf("0\n");
		return 0;
	}
	if(N==1) {
		if(A!=B) {
			printf("0\n");
		} else {
			printf("1\n");
		}
		return 0;
	}
	long long minv=A+B;
	long long maxv=A+B;
	minv+=(long long)(N-2)*A;
	maxv+=(long long)(N-2)*B;
	printf("%lld\n",maxv-minv+1);
	return 0;
}


Measured memory_bytes: 128
// #pragma GCC optimize("O3")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace ::std;
// clang-format off
template<typename T> T nxt() {T res; cin >> res; return res;}
#define tests() for (int _ = nxt<int>(); _ >= 0; _--)
#define nxt1(t,n) t (n); cin >> n
#define nxt2(t,n,m) t (n),(m); cin >> n >> m
#define nxt3(t,n,m,k) t (n),(m),(k); cin >> n >> m >> k
#define rep(i, A) for (int i = 0 ; i < A ; i++)
#define ll long long
typedef pair<int,int> pii;typedef pair<ll, ll> pll;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<ll> vl;typedef vector<vl> vvl;
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl;
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){for(T ti : t)s<<ti<<" ";return s; }
#define all(x) (x).begin(), (x).end()
#define last(vec) vec[vec.size()-1]
#define has(c,x) ((c).find(x) != (c).end())
// clang-format on

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

    int N = nxt<int>();
    vi h(N);
    generate(all(h), nxt<int>);

    vi dp(N);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 0; i < N - 2; i++) {
        dp[i + 2] = min(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]));
    }

    cout << dp[N - 1] << endl;

    return 0;
}


Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    vector<vector<int>> A(3,vector<int>(3));
    
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>A[i][j];
        }
    }
    
    int N;cin>>N;
    
    while(N--){
        int a;cin>>a;
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(A[i][j]==a) A[i][j]=-1;
            }
        }
    }
    
    bool ok=false;
    
    for(int i=0;i<3;i++){
        int cnt=0;
        for(int j=0;j<3;j++){
            if(A[i][j]==-1) cnt++;
        }
        if(cnt==3) ok=true;
    }
    
    for(int j=0;j<3;j++){
        int cnt=0;
        for(int i=0;i<3;i++){
            if(A[i][j]==-1) cnt++;
        }
        if(cnt==3) ok=true;
    }
    
    if(A[0][0]==-1&&A[1][1]==-1&&A[2][2]==-1) ok=true;
    
    if(A[0][2]==-1&&A[1][1]==-1&&A[2][0]==-1) ok=true;
    
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <map>
using namespace std;
#define ll long long

bool d(int i) {
	int num = 0;
	for (int k = 1; k <= i; k++) {
		if (i % k == 0)num++;
	}
	if (num == 8)return true;
	else return false;
}

int main() {
	ll n, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i = i + 2) {
		if (d(i)) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    string n;
    cin >> n;
    cout << "AB" << (char)('C' + (n.length() == 4));
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

str_list = ["WA"] * n # 問題数分のリスト
int_list = [0] * n    # 問題数分のリスト
num = 0
ac = 0    

for p_, s in  ps: # p：問題番号 s：AC or WA
    p = int(p_) - 1
    if s == "AC":
        str_list[p] = "AC" # WAリスト
    else: # s!= WA
        if str_list[p] !="AC": # まだACされていない問題が、WAだったら
            int_list[p] += 1   # 問題ごとのWAの回数

for i in range(n): 
    if str_list[i] == "AC": # ペナルティはACできた問題のみ
        num += int_list[i] # WAの回数}
        ac += 1            # ACの数

print(ac, num)

Measured memory_bytes: 27464
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <deque> 

using namespace std;


int base[30];

void init()
{
	base[0] = 1;
	for (int i = 1 ; i < 30 ; i++)
		base[i] = base[i - 1] * 2;
}

int n, k;
const double ZERO = 1e-10;

int main()
{
	init();
	scanf("%d%d", &n, &k);
	
	int p = 0;
	double realBase;	
	while (base[p] < k)
	{
		p++;
	}
	realBase = base[p];
	
	long long realNumber = 1;
	
	for (int i = 2 ; i <= n ; i++)
	{
		p = 0;
		while ((base[p] * i) < k)
			p++;
			
		int curNumber = base[p];
		realNumber = realNumber + realBase / curNumber;
	}
	
	double ans = (double)realNumber / (realBase * n);
	printf("%.12lf\n", ans);
	
	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
   
int main() {
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n-1;i++) cin>>a.at(i);
    map<int,int> num;
    for(int i=0;i<n-1;i++){
        if(num.count(a.at(i))) num.at(a.at(i))++;
        else num[a.at(i)]=1;
    }
    for(int i=1;i<=n;i++){
        if(num.count(i)) cout<<num.at(i)<<endl;
        else cout<<"0"<<endl;
    }
}
   

    
    

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, D, X;
  cin >> N >> D >> X;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    X += (D + a - 1) / a;
  }
  cout << X << '\n';
  return 0;
}


Measured memory_bytes: 256
n,a,b=map(int,input().split())
answer = 0
for i in range(1, n+1):
    sum = 0
    for j in range(len(str(i))):
        # print(str(i)[j])
        sum += int(str(i)[j])
    if a <= sum and sum <= b:
        # print(sum)
        answer += i

print(answer)

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

#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)

int main(){
    int a, b, n;
    while(cin >> a >> b >> n){
        int t = 0;
        REP(i,n){
            a = (a % b) * 10;
            t += a / b;
        }
        cout << t << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
n,l=map(int,input().split())
a=list(range(l,l+n,1))
x=sum(a)
if(0 in a):
  a.remove(0)
  print(sum(a))
elif(x<0):
  a.remove(max(a))
  print(sum(a))
elif(x>0):
  a.remove(min(a))
  print(sum(a))

Measured memory_bytes: 9216
def main():
    input1 = input().split()
    N = int(input1[0])
    M = int(input1[1])

    H = [0]*N
    input2 = input().split()
    for i in range(N):
        H[i] = int(input2[i])
    
    A = [0]*M
    B = [0]*M
    for i in range(M):
        input3 = input().split()
        A[i] = int(input3[0])
        B[i] = int(input3[1])

    mountain = [0]*N
    for i in range(M):
        if H[A[i]-1] <= H[B[i]-1]:
            mountain[A[i]-1] = 1
        if H[B[i]-1] <= H[A[i]-1]:
            mountain[B[i]-1] = 1
    result = 0
    for i in range(N):
        if mountain[i] == 0:
            result += 1
            
    print(result)

if __name__ == "__main__":
    main()

Measured memory_bytes: 28688
#include <stdio.h>

int main(void) {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  
  int d = a / c;
  int e = b / c;
  
  if (d * c < a) {
    d ++;
  }
  
  printf ("%d\n", e - d + 1);
}

Measured memory_bytes: 1732
import sys
def I(): return int(sys.stdin.readline().rstrip())


N = I()
A = [I() for _ in range(N)]

ans = 0
for i in range(N):
    a = A[i]
    ans += a//2
    A[i] -= 2*(a//2)
    if A[i] == 1 and i < N-1 and A[i+1] >= 1:
        ans += 1
        A[i] = 0
        A[i+1] -= 1

print(ans)


Measured memory_bytes: 77184
#include <iostream>
#include <string>

using namespace std;

int mass[8][8];

void Bombs_Chain(int y, int x)
{
	if(mass[y][x]==1)
	{
		mass[y][x] = 0;
		
		for(int i=1; i<=3; i++)
		{
			if(x+i < 8)    Bombs_Chain(y, x+i);
			if(x-i > -1)   Bombs_Chain(y, x-i);
			if(y+i < 8)    Bombs_Chain(y+i, x);
			if(y-i > -1)   Bombs_Chain(y-i, x);
		}
	}
}

int main()
{
	int n, x, y;
	string str;

	cin >> n;

	for(int i=0; i<n; i++)
	{
		for(int j=0; j<8; j++)
		{
			cin >> str;

			for(int k=0; k<8; k++)
			{
				mass[j][k] = (str[k]=='1') ? 1 : 0;
			}
		}

		cin >> x >> y;

		Bombs_Chain(y-1, x-1);

		cout << "Data " << i+1 << ":" << endl;

		for(int j=0; j<8; j++)
		{
			for(int k=0; k<8; k++)
			{
				cout << mass[j][k];
			}
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1200
n,m = map(int,input().split())
p = list(map(lambda x: int(x)-1,input().split()))
par = [i for i in range(n)]
def root(x):
    if x==par[x]:
        return x
    else:
        par[x] =root(par[x])
        return par[x]
def union(x,y):
    x= root(x)
    y= root(y)
    if x==y:
        return
    else:
        par[x]=y

for _ in range(m):
    px,py = map(lambda x: int(x)-1,input().split())
    union(px,py)

for i in range(n):
    root(i)

dual = [(x,y) for x,y in zip(p,par)]
dual.sort(key=lambda x:x[0])
ans = 0
for i in range(n):
    if dual[i][1]==par[i]:
        ans+=1
print(ans)



Measured memory_bytes: 20196
#include <cstdio>
#include <queue>
#include <vector>

using namespace std;


int main(){
	int a,b,c,d,e,f;
	double x,y;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != EOF){
		x = (double)(c*e - b*f) / (double)(a*e - d*b);
		y = (c - a*x)/b;
		if(x == -0.0){ x = 0; }
		if(y == -0.0){ y = 0; }
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        String s = scan.next();

        if (a >= 3200) {
            System.out.println(s);
        } else {
            System.out.println("red");
        }
    }
}


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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

#define deg_to_rad(deg) (((deg)/360)*2*M_PI)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

using namespace std;

int main (void) {
    int A, B, X;
    int Vol;
    double ans;
    scanf("%d %d %d", &A, &B, &X);
    Vol = A * B / 2 * A;
    if ( X == Vol ){
        ans = 45.0000000000;
    }
    else if ( X < Vol ){
        ans = 90.0 - rad_to_deg( atan2( 2 * X ,  B * B * A ) );
    }
    else if ( X > Vol ){
        ans = rad_to_deg( atan2( 2 * (A * A * B - X),  A * A * A ) );
    }
    printf("%f\n", ans); 
    return 0;
}

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


 


int main()
{
  long long h , a;
  cin >> h>> a; 

  long long ans = h / a;
  if(ans * a != h)
    ans++;
  

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
while True:
    n, q = map(int, input().split())
    if n == 0:
        break
    count = [0] * 101
    for i in range(n):
        dates = list(map(int, input().split()))
        for d in range(1, len(dates)):
            count[dates[d]] += 1
    ind = 0
    max_ = 0
    for i in range(101):
        if max_ < count[i]:
            ind = i
            max_ = count[i]
    if max_ < q:
        print(0)
    else:
        print(ind)



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

using namespace std;



int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);cout.tie(NULL);
   
   int n,i;
   cin>>n;
   for(i=1;;++i)
    {
        if(i*1000>=n)
           break;
    }
    
    cout<<i*1000-n;
    
   
     return 0;
}

Measured memory_bytes: 3636
def main():
    a, b, c = map(int, input().split())

    flag = 1
    comp = a
    while comp <= a*b:
        if comp%b == c:
            print("YES")
            flag = 0
            break
        comp += a

    if flag: print("NO")


if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;




int main(void){
    ll x;
    cin>>x;
    if(x<=6)cout<<1<<endl;
    else{
        ll s=0;
        if(x%11==0)s=x/11;
        else  s = x/11+1;
        ll ans = 2*s;
        if((x-6)%11==0)s=(x-6)/11;
        else s = (x-6)/11+1;
        ans = min(ans,2*s+1);
        cout<<ans<<endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b;
  for (auto& e : a) cin >> e;
  b = a;
  sort(begin(b), end(b));
  int r = 0;
  for (int i = 0; i < n; i++) {
    r += a[i] != b[i];
  }
  cout << (r <= 2 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
;; B - Palindrome-philia

(defun solve (S)
  (let ((len (length S)))
    (loop for i from 0 below (ash len -1)
      count (not (equal (char S i) (char S (- (1- len) i)))))))

(let ((S (read-line)))
  (princ (solve S))
  (fresh-line))


Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
#define int long long int
const int mod = 1e9+7;
int32_t main(){
	int n,ans=1;cin>>n;
	for(int i=1;i<=n;i++){
		ans*=i;
		ans%=mod;
	}
	cout<<ans;
}


Measured memory_bytes: 256
s = input()
a = 0
b = 0
for i in range(len(s)):
    if i & 1:
        if s[i] == "0":
            a += 1
        else:
            b += 1
    else:
        if s[i] == "0":
            b += 1
        else:
            a += 1
print(min(a, b))


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

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

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

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

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N,W;
    cin >> N >> W;

    vector<i64> w(N),v(N);
    rep(i,0,N) cin >> w[i] >> v[i];

    i64 size=100*1000+1;
    vector<i64> dp(size,inf64);
    dp[0]=0;
    dp[v[0]]=w[0];
    rep(i,1,N){
        for(i64 j=size; j>=0; --j){
            if(j-v[i]<0) break;
            chmin(dp[j],dp[j-v[i]]+w[i]);
        }
    }

    i64 ans=0;
    rep(i,0,size) if(dp[i]<=W) ans=i;

    cout << ans << endl;
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, N) for (int i = 0; i < (N); i++)
#define REP(i, a, N) for (int i = a; i < (N); i++)
#define rrep(i, N, k) for (int i = (N); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - (int)1e8;
const ll INFLL = numeric_limits<ll>::max() - (ll)1e17;

int main() {
    int Q;
    cin >> Q;
    auto calcParticipants = [&](ll maxValue) {
        maxValue--;
        ll left = 0, right = 3e9 + 100;
        while (right - left > 1) {
            ll mid = left + (right - left) / 2;
            ll temp = (mid + 1) / 2 * (mid + 1 - (mid + 1) / 2);
            if (temp <= maxValue) left = mid;
            else right = mid;
        }
        return left - 1;
    };
    for (int i = 0; i < Q; i++) {
        ll A, B;
        cin >> A >> B;
        auto idx = calcParticipants(A * B);
        if (A == B) cout << (A - 1) * 2 << endl;
        else cout << idx << endl;
    }
}

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

int main() {
    int N;
    ll K;
    cin >> N;
    cin >> K;
    vector<ll> A(N);
    vector<ll> F(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> F[i];
    sort(A.begin(), A.end());
    sort(F.begin(), F.end());
    reverse(F.begin(), F.end());
    ll s = -1;
    ll t = 0;
    for (int i = 0; i < N; i++) {
        t = max(t, A[i] * F[i]);
    }
    while(t-s > 1){
        ll u = (t+s)/2;
        ll cnt = 0;
        for (int i = 0; i < N; i++){
            if (A[i] * F[i] > u) {
                cnt += (A[i] * F[i] - u + F[i] - 1) / F[i];
            }
        }
        if (cnt <= K) t = u;
        else s = u;
    }
    cout << t << endl;
    return 0;
}

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

// xをすべて除いたときsは回文である必要がある
// その回文の対称な文字間にあるxの個数の差の合計が答え
int main() {
    string s;
    cin >> s;
    int n = s.size(), ans = 0;
    for(int l=0,r=n-1; l<r; l++,r--){
        int xl = 0, xr = 0;
        while(l<n && s[l]=='x'){
            l++;
            xl++;
        }
        while(r>=0 && s[r]=='x'){
            r--;
            xr++;
        }
        if(s[l]==s[r]){
            ans += abs(xl-xr);
        }
        else{
            ans = -1;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int n, s[100000];
int binary_search(int t)
{
	int left = 0;
	int right = n - 1;
	int mid;
	while (left <= right) {
		mid = (left + right) / 2;
		if (t == s[mid]) {
			return 1;
		}
		else if (t < s[mid]) {
			right = mid - 1;
		}
		else {
			left = mid + 1;
		}
	}
	return 0;
}

int main()
{
	int q, t[50000],i,c=0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &s[i]);
	}
	scanf("%d", &q);
	for (i = 0; i < q; i++) {
		scanf("%d", &t[i]);
		
	}
	for (i = 0; i < q; i++) {
		if (binary_search(t[i]) == 1) {
			c++;
		}
	}
	printf("%d\n", c);
	return 0;
}

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

#define ll long long

signed main() {
  string c;
  cin >> c;
  if(c=="a"||c=="i"||c=="u"||c=="e"||c=="o")
  {cout << "vowel" << endl;}
  else{cout << "consonant" << endl;}
}

Measured memory_bytes: 3628
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int X, N;
	Set<Integer> set;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		X = Integer.parseInt(tokens[0]);
		N = Integer.parseInt(tokens[1]);

		set = new HashSet<>();
		tokens = in.readLine().split(" ");
		for (int i = 0; i < N; ++i) {
			set.add(Integer.parseInt(tokens[i]));
		}
	}

	void calc() {
		if (set.isEmpty()) {
			System.out.println(X);
			return;
		}
		int small = 101;
		int large = 0;
		for (int i = X; i >= 0; --i) {
			if (!set.contains(i)) {
				small = i;
				break;
			}
		}
		for (int i = X; i <= 101; ++i) {
			if (!set.contains(i)) {
				large = i;
				break;
			}
		}
		if (Math.abs(X - small) <= Math.abs(large - X)) {
			System.out.println(small);
		} else {
			System.out.println(large);
		}
	}

	void showResult() {
	}
}

Measured memory_bytes: 32924
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll ar[500009];
int main()
{
    ll a,b,c,i,j,k=0,z=0;
    string s,d;
    cin>>a;
    for(i=1;i<=a;i++)
    {
        cin>>ar[i];
    }
    j=1;k=0;
    for(i=1;i<=a;i++)
    {
        if(ar[i]==j)
        {
            j++;
        }
        else
        {
            k++;
        }
    }
    if(k==a)k=-1;
    cout<<k<<endl;
}


Measured memory_bytes: 1792
from itertools import tee


def pairwise(iterable):
    a, b = tee(iterable)
    next(b, None)
    return zip(a, b)


N = int(input())
A = list(map(int, input().split()))
cut = 0
previous = None
is_increase = False
is_decrease = False

for a in A:
    if previous is None:
        previous = a
    elif not (is_increase or is_decrease):
        if previous < a:
            is_increase = True
        elif previous > a:
            is_decrease = True
        previous = a
    elif is_increase and a < previous:
        cut += 1
        is_increase = False
    elif is_decrease and a > previous:
        cut += 1
        is_decrease = False

    previous = a

print(cut + 1)


Measured memory_bytes: 14100
n,k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10**9 +7

if(k==n):
    ans = 1
    for ai in a:
        ans *= ai
        ans %= mod
    print(ans)
    exit()

a_plus = []
a_minus = []
cnt_0 = 0

for ai in a:
    if(ai==0):
        cnt_0 += 1
    elif(ai > 0):
        a_plus.append(ai)
    else:
        a_minus.append(ai)

a_plus.sort(reverse = True)
a_minus.sort()

cnt_p = len(a_plus)
cnt_m = len(a_minus)

if(cnt_p + cnt_m < k):
    print(0)
    exit()

if(cnt_p + cnt_m == k)&(cnt_0>0)&(cnt_m%2==1):
    print(0)
    exit()


if(cnt_m == n)&(k%2==1):
    ans = 1
    for i in range(k):
        ans *= a_minus[cnt_m - 1 - i]
        ans %= mod
    print(ans)
    exit()
elif(cnt_p == 0)&(k%2==1):
    print(0)
    exit()

p_ind = 0
m_ind = 0

ans = 1
if(k%2==1):
    ans = a_plus[0]
    p_ind = 1

for i in range(k//2):
    tmp_p = 0
    tmp_m = 0
    if(p_ind + 2 <= cnt_p ):
        tmp_p = a_plus[p_ind] * a_plus[p_ind+1]

    if(m_ind + 2 <= cnt_m ):
        tmp_m = a_minus[m_ind] * a_minus[m_ind+1]

    if(tmp_p > tmp_m):
        ans *= tmp_p
        p_ind += 2
    else:
        ans *= tmp_m
        m_ind += 2
    ans %= mod


ans %= mod
print(ans)

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

int main()
{
    int sx, sy, tx, ty;
    string ans = "";
    cin >> sx >> sy >> tx >> ty;
    for (int i = 1; i <= tx - sx; i++)
        ans += "R";
    for (int i = 1; i <= ty - sy; i++)
        ans += "U";
    for (int i = 1; i <= tx - sx; i++)
        ans += "L";
    for (int i = 1; i <= ty - sy; i++)
        ans += "D";
    ans += "D";
    for (int i = 1; i <= tx - sx + 1; i++)
        ans += "R";
    for (int i = 1; i <= ty - sy + 1; i++)
        ans += "U";
    ans += "L";
    ans += "U";
    for (int i = 1; i <= tx - sx + 1; i++)
        ans += "L";
    for (int i = 1; i <= ty - sy + 1; i++)
        ans += "D";
    ans += "R";
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define INF (1<<29)

struct P{
    int t, c, nt;
    P(){}
    P(int t, int c, int nt) :
        t(t), c(c), nt(nt) {}

    bool operator < (const P &p) const {
        if (t != p.t) {
            return t < p.t;
        }
        return c > p.c;
    }
};


int main()
{
    int n;
    while (cin >> n, n) {
        vector<P> v(n);
        for (int i = 0; i < n; i++) {
            cin >> v[i].t >> v[i].c;
            v[i].nt = v[i].t;
            v[i].c *= 2;
        }
        sort(v.begin(), v.end());
        queue<P> Q[2];
        for (int i = 0; i < n; i++) {
            Q[0].push(v[i]);
        }
        int res = 0;
        while (!Q[0].empty() || !Q[1].empty()) {          
            int f = INF;            
            if (!Q[0].empty()) {
                f = Q[0].front().nt;
            }
            if (!Q[1].empty()) {
                f = min(f, Q[1].front().nt);
            }

            res += f;
            queue<P> nQ[2], nQ2[2];
            for (int i = 0; i < 2; i++) {
                vector<P> v;
                while (!Q[i].empty()) {
                    P p = Q[i].front(); Q[i].pop();
                    if (p.nt-f == 0) {
                        p.nt = p.t;
                        if (--p.c > 0) {
                            v.push_back(p);   
                        }
                    } else {
                        p.nt -= f;
                        nQ[i].push(p);
                    }
                }
                sort(v.begin(), v.end());
                for (int j = 0; j < (int)v.size(); j++) {
                    nQ2[1-i].push(v[j]);
                }
            }
            for (int i = 0; i < 2; i++) {
                while (!nQ2[i].empty()) {
                    nQ[i].push(nQ2[i].front());
                    nQ2[i].pop();
                }
            }

            for (int i = 0; i < 2; i++) {
                int nt = 0;
                while (!nQ[i].empty()) {
                    P p = nQ[i].front(); nQ[i].pop();                  
                    nt = p.nt = max(nt, p.nt);
                    Q[i].push(p);
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    long long int i,j,n,x,y,z;
    cin >> n;
    vector<vector<long long int> >A(n);
    for(i=0;i<n;++i){
        cin >> x >>y >>z;
        A[i].push_back(x);
        A[i].push_back(y);
        A[i].push_back(z);
    }
    vector<vector<long long int> >dp(n,vector<long long int>(3,0));
    dp[0][0]=A[0][0];
    dp[0][1]=A[0][1];
    dp[0][2]=A[0][2];
    for(i=1;i<n;++i){
        dp[i][0]=A[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=A[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=A[i][2]+max(dp[i-1][1],dp[i-1][0]);
    }
    x=0;
    for(i=0;i<3;++i)
    x=max(x,dp[n-1][i]);
    cout << x <<endl;

    return 0;
}

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

int main(){
  int a, b;
  while(cin >> a >> b) {
    int sum, count;
    count = 0;
    sum = a + b;
    for(int i=sum;i>0;i = i/10){
      count++;
    }
    cout << count << endl;
  }
}


Measured memory_bytes: 3088
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

a,b=ml()
print(math.ceil(a/(b*2+1)))

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

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

int main() {
  ll n, m;
  cin >> n >> m;
  ll ans = 0;

  if (n > 2 && m > 2)
    ans = n * m - (n + m) * 2 + 4;
  else if (n == 1 && m == 1)
    ans = 1;
  else if (n == 2 || m == 2)
    ans = 0;
  else if (n == 1)
    ans = m - 2;
  else if (m == 1)
    ans = n - 2;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define M1 1000000007
#define M2 998244353

#define fl(i,a,b)  for(ll i=a;i<b;i++)
#define ifl(i,a,b) for(ll i=b-1;i>=a;i--)
#define f(i,n)     for(int i=0;i<n;i++)
#define bf(i,n)    for(int i=n-1;i>=0;i++)


#define p0(a) cout << a << " "
#define P1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define bn "\n"

//------------------------------------------------------------------------ 
// #define V(a) vector<a>
// #define vt() vector< tuple < int ,int ,int > > ;
// #define vector< int ,int > pv;
// vector< pair <int,int> > vect;


//------------------------------------------------------------------------

ll modI(ll a,ll m);
ll gcd(ll a,ll b);
ll powM(ll x,ll y,ll m);
ll swap(ll a,ll b);

void swap(ll& a,ll& b)
{
    ll tp=a;
    a=b;
    b=tp;
}

ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    ll ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
 
ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

//---------------------------------------------------------------------------

// variable = Expression1 ? Expression2 : Expression3
// max = (n1 > n2) ? n1 : n2; 
// (n>m) ? cout<<"True"<<endl:cout<<"false"<<endl ;

// ---------------------------------------------------------------------------	

// int n;cin>>n;int a[n];for(int i=0;i<n;i++)cin>>a[i];    
// for(int i=0;i<n;i++)cout<<a[i];
// int a,b;cin>>a>>b;   

//---------------------------------------------------------------------------


//----------------------------------------------------------------------------


int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	int tt=1;
   // cin>>tt;
	while(tt--)
	{
	   
	ll a,b,n;
	cin>>a>>b>>n;
	if(a%b!=0)
	{
	    if( b>n)
	    {
	        P1((n*a)/b);
	        return 0;
	    }
	    P1((a*(b-1))/b);
	    return 0;
	}
	
	ll z= a/b;
	
	if(  b>n)
	{
	   P1(z*n);
	    return 0;
	}
	P1(z*(b-1));
	    
	   
	   
	   
	    
	}
	
	return 0;
}


Measured memory_bytes: 3608
// 2020-07-17 05:47:01
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  ll w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << fixed << setprecision(6) << (ld(w*h) / 2.0);
  cout << ' ' << (x == w-x && y == h-y) << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 81;
const ll LINF = 1e18 + 5;
int h, w, a[N][N], b[N][N];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> h >> w;
 	for(int i=1;i<=h;i++)
 		for(int j=1;j<=w;j++)
 			cin >> a[i][j];
 	for(int i=1;i<=h;i++)
 		for(int j=1;j<=w;j++)
 			cin >> b[i][j];
 	vector<vector<bitset<N*N*2>>> dp(N,vector<bitset<N*N*2>>(N));
 	dp[1][1][abs(a[1][1]-b[1][1])] = 1;
 	for(int i=1;i<=h;i++)
 	{
 		for(int j=1;j<=w;j++)
 		{
 			int v = abs(a[i][j]-b[i][j]);
 			for(int k=0;k<=(i+j)*80;k++)
 			{	
 				if(dp[i-1][j][k])
				{
					dp[i][j][k+v] = dp[i-1][j][k];
	 				dp[i][j][abs(k-v)] = dp[i-1][j][k];
 				}
 				if(dp[i][j-1][k])
 				{
	 				dp[i][j][k+v] = dp[i][j-1][k];
	 				dp[i][j][abs(k-v)] = dp[i][j-1][k];
	 			}
 			}
 		}
 	}
 	for(int i=0;i<=(h+w)*80;i++) if(dp[h][w][i]) return cout << i, 0;
	return 0;
}


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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    map<string, int> dict;
    rep(i, n) {
        dict[s[i]]++;
    }
    cout << "AC x " << dict["AC"] << endl;
    cout << "WA x " << dict["WA"] << endl;
    cout << "TLE x " << dict["TLE"] << endl;
    cout << "RE x " << dict["RE"] << endl;

    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x = 0, max = 0;
  
  for (int i=0; i<n; i++) {
    if (s.at(i) == 'I') {
      x++;
      if (x > max) {
        max = x;
      }
    }
    else {
      x--;
    }
  }
  cout << max << endl;
}


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

int main() {
	int N;
	std::cin >> N;
	std::vector<long long> A(N, 0);
	for (auto& a : A) {
		std::cin >> a;
	}
	std::sort(A.begin(), A.end());
	std::vector<long long> edge;
	for (int i = A.size() - 1; i > 0; i--) {
		if (A[i] == A[i - 1]) {
			edge.push_back(A[i]);
			if (edge.size() == 2) break;
			i--;
		}
	}
	if (edge.size() < 2)
		std::cout << "0" << std::endl;
	else
		std::cout << edge[0] * edge[1] << std::endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) begin(x), end(x)
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int main(){
  int n;
  cin>>n;
  int l[105];
  rep(i,n) cin>>l[i];
  sort(l,l+n);

  int ans=0;
  rep(i,n) rep(j,i) rep(k,j){
    if(l[i]==l[j]||l[j]==l[k]) continue;
    if(l[i]<l[j]+l[k]){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3580