akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>

static const int N = 100;

int main(){
  int length, i, j,tmp,count=0;
  int A[N];
  
  scanf("%d", &length);
  
  if(length < 1 || length > 100){
    exit(1);
  }

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

  for(i = 0; i < length-1; i++){
    for(j = length-1; j > i; j--){
      if(A[j] < A[j-1]){
	count++;
	tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
      }
    }
  }

  for(i = 0; i < length; i++){
    printf("%d",A[i]);
    if(i == length-1){
      printf("\n");
      break;
    }
    printf(" ");
  }
  printf("%d\n",count);

  return 0;
}

Measured memory_bytes: 604
using System;

namespace ITP1_2_C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strs = Console.ReadLine().Split(' ');
            int a = int.Parse(strs[0]);
            int b = int.Parse(strs[1]);
            int c = int.Parse(strs[2]);

            if (TryPrintMin(a, b, c)) return;
            if (TryPrintMin(b, a, c)) return;
            if (TryPrintMin(c, a, b)) return;
        }

        static bool TryPrintMin(int min, int a, int b)
        {
            if (min <= a && min <= b) { Console.WriteLine("{0} {1} {2}", min, a < b ? a : b, a < b ? b : a); return true; }
            else return false;
        }
    }
}

Measured memory_bytes: 8976
N = int(input())
A = list(map(int, input().split()))
for i in range(1, N+1):
    A[i-1] = A[i-1]-i
A.sort()
number = A[N//2]
ans = 0
for i in range(0, N):
    ans += abs(A[i]-number)
print(ans)


Measured memory_bytes: 26180
function main(input){
  const args=input.split(' ');
  const P=parseInt(args[0], 10);
  const Q=parseInt(args[1], 10);
  const R=parseInt(args[2], 10);
  const arrr=[P+Q, P+R, Q+R];
  console.log(Math.min.apply(null, arrr));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	n, _ := strconv.Atoi(input())
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = strconv.Atoi(input())
	}

	ans := 0
	for i := 1; i < n; i++ {
		if a[i-1] > a[i] {
			ans += a[i-1] - a[i]
			a[i] = a[i-1]
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 6128
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
using namespace std;
const int MOD=1000000007;
const int MOD2=15000007;
const ll MAX=9187201950435737471;
const int N=100005;
const ll INF=1e17;
const long double PI=acos(-1);


void solve(int T){
    int n;
    cin>>n;
    int x=399,j=9;
    while(x<n){
        x+=200;
        j--;
    }
    cout<<j;
}

int main() {
    fastio
    int T=1;
    //cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        //if(i<T)cout<<"\n";
    }
    return 0;
}




Measured memory_bytes: 3612
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  cout<<(ll)sqrt(n)*(ll)sqrt(n)<<endl;

}

int main(){
  solve();
  return 0;
}


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

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

using namespace std;
typedef long long int64;

int64 n,m,v,p;

bool HasPossibility(int64 tgt, vector<int64>& a){
  vector<int64> score(n);
  for(int i=0;i<n;i++){
    if(i==tgt) continue;
    score[i]=a[i];
  }
  score[tgt]=a[tgt]+m;
  int64 tgt_score=score[tgt];
  std::sort(score.begin(), score.end(), std::greater<>());
  int64 r=0;
  for(int i=0;i<n;i++){
    if(score[i]==tgt_score){
      r=i;
      break;
    }
  }

  if(r>=p) return false;

  bool found_tgt=false;
  int64 added=0;
  for(int i=0;i<p;i++){
    if(score[i]==tgt_score){
      if(found_tgt){
        added+=m;
      }else{
        found_tgt=true;
      }
    }else{
      added+=m;
    }
  }
  for(int64 i=p;i<n;i++){
    added+=min((int64)(tgt_score-score[i]),m);
  }

  return (added>=(v-1)*m);
}

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


  cin>>n>>m>>v>>p;
  vector<int64> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }

  std::sort(a.begin(), a.end(), std::greater<>());

  int left=0,right=n,mid=n/2;
  while(right-left>1){
    if(HasPossibility(mid,a)){
      left=mid;
    }else{
      right=mid;
    }
    mid=(left+right)/2;
  }

  cout<<left+1<<endl;



  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 1100

int dp[MAX][MAX];

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	string s1, s2;
	
	cin>>s1>>s2;
	
	for(size_t i = 0; i <= s1.size(); i++) dp[i][0] = i;
	for(size_t i = 0; i <= s2.size(); i++) dp[0][i] = i;
	
	for(size_t i = 0; i < s1.size(); i++){
		for(size_t j = 0; j < s2.size(); j++){
			dp[i+1][j+1] = min(min(dp[i][j+1]+1,dp[i+1][j]+1),dp[i][j]+!(s1[i]==s2[j]));
		}
	}
	
	cout<<dp[s1.size()][s2.size()]<<endl;
	
	return 0;
}


Measured memory_bytes: 11728
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();
        System.out.println((H-h) * (W-w));
    }
}

Measured memory_bytes: 35760
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>

using namespace std;


int n,cnt,x,y,t;
int fie[25][25];

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		cnt=0;
		memset(fie,0,sizeof(fie));
		for(int i=0;i<n;i++){
			scanf("%d %d",&x,&y);
			fie[x][y]=1;
		}
		x=10,y=10;
		if(fie[x][y]==1){
			fie[x][y]=0;
			cnt++;
		}
		scanf("%d",&t);
		for(int i=0;i<t;i++){
			string str;
			int d;
			cin >> str >> d;
			for(int j=0;j<d;j++){
				if(str=="N")y++;
				if(str=="E")x++;
				if(str=="W")x--;
				if(str=="S")y--;
				if(fie[x][y]==1){
					fie[x][y]=0;
					cnt++;
				}
			}
		}
		printf("%s\n",cnt==n?"Yes":"No");
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

ll _gcd(ll a, ll b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

int main(){
  string a,b;cin>>a>>b;
  int an=a.size(),bn=b.size();

  if(an>bn){
    out("GREATER");
    return 0;
  }
  else if(an<bn){
    out("LESS");
    return 0;
  }
  else{
    rep(i,an){
      if(a[i]-'0'>b[i]-'0'){
        out("GREATER");
        return 0;
      }else if(a[i]-'0'<b[i]-'0'){
        out("LESS");
        return 0;
      }
    }
  }
  out("EQUAL");

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	char s[300000];
	unsigned long long int n=0;
	cin>>s;
	for(int i=0;s[i]!='\0';i++)
	{
		n+=s[i]-'0';
		n%=9;
	}
	if(n)
		cout<<"No";
	else
		cout<<"Yes";
	return 0;
}

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

using namespace std;

typedef long long ll;

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;
}

int main(void) {
    int N;
    cin >> N;

    int count = 0;
    N = min(N, 99999);
    if (N >= 10000) {
        count += N - 10000 + 1;
    }
    N = min(N, 999);
    if (N >= 100) {
        count += N - 100 + 1;
    }
    N = min(N, 9);
    if (N > 0) {
        count += N;
    }

    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
int main(){
  float f;
  std::vector<float>v;
  for(;~scanf("%f",&f);)v.push_back(f);
  std::sort(v.begin(),v.end());
  printf("%.2f\n",v[v.size()-1]-v[0]);
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll K;
    cin >> K;
    queue<string> q;
    string lunlun[K + 1];
    for (int i = 1; i <= 9; ++i) q.push(to_string(i));
    for (int i = 1; i <= K; ++i)
    {
        lunlun[i] = q.front();
        q.pop();
        int num = lunlun[i][lunlun[i].size() - 1] - '0';
        for (int j = num - 1; j <= num + 1; ++j)
        {
            if (j >= 0 && j < 10) q.push(lunlun[i] + (char)('0' + j));
        }
    }

    cout << lunlun[K] << endl;
}


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

typedef long long ll;
int main()
{
	ll n; cin >> n;
	ll arr[n];
	for(int i=0;i<n;++i)
	cin>>arr[i];

	map<ll,ll> mp;

	for(auto 
	u: arr){
		mp[u]++;
	}

	set<ll> ss;
	for(auto u:arr){
		ss.insert(u);
	}
	
	ll sum=0;
	for(auto u:ss){
		sum+=(mp[u]*(mp[u]-1))/2;
	}

	//cout << sum << '\n';
	for(auto u:arr)
	cout<<sum-(mp[u]-1)<<'\n';

	return 0;
}


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

int main() {
    long N, M;
    cin>>N>>M;
    long ans = 1;
    long MM = (long) sqrt(M)+1;
    for(long i=1;i<=MM;++i){
        if(M%i==0){
            if(ans < M/i & N <= i){
                ans = M/i;
            }
            if(ans < i & N <= M/i){
                ans = i;
            }
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;
constexpr ll infl = 1ll<<60;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin>>n;
    vector<ll> v(n);
    for(auto &a : v )cin>>a;
    vector<ll> l(n);
    l[0] = v[0];
    for(int i=1;i<n;++i){
        l[i] = l[i-1] + v[i];
    }
    ll ans = infl;
    for(int i=0;i<n-1;++i){
        ans = min(abs(l[n-1] - l[i] - l[i]),ans);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3456
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	int i;
	int ary[4] = {0,0,0,0};
	int n;
	char str[10];
	char name[4][4] = {"AC", "WA", "TLE", "RE"};

	i = scanf("%d", &n);
	while (n > 0)
	{
		i = scanf("%s", str);
		if (strcmp(str, name[0]) == 0)
			ary[0]++;
		else if (strcmp(str, name[1]) == 0)
			ary[1]++;
		else if (strcmp(str, name[2]) == 0)
			ary[2]++;
		else if (strcmp(str, name[3]) == 0)
			ary[3]++;
		n--;
	}
	i = 0;
	while (i < 4)
	{
		printf("%s x %d\n", name[i], ary[i]);
		i++;
	}
	return 0;
}

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

using namespace std;
#define BUF (105)
#define INF (1000000006)
#define ll long long 

int n;
int t[BUF];
int v[BUF];
int g[100*200*2+5];

int f(int x, int y){
	if(y==0) return x;
	if(y==n+1) return -x+2*t[n];

	if(x<2*t[y-1]){
		return -x+2*t[y-1]+2*v[y];
	}else if(x>2*t[y]){
		return x-2*t[y]+2*v[y];
	}else {
		return 2*v[y];
	}
}




int main(void){
	cin >> n;
	int tm=0;

	for(int i=1;i<=n;i++){
		int tmp;
		cin >> tmp;
		tm+=tmp;
		t[i]=tm;
	}

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


	for(int i=0;i<=2*t[n];i++){
		int m = INF;
		for(int k=0;k<=n+1;k++){
			m=min(m,f(i,k));
		}
		g[i]=m;
		//cout << m << " ";
	}

	int ans = 0;
	for(int i=0;i<2*t[n];i++){
		ans += g[i]+g[i+1];
	}

	cout << setprecision(20) <<  (double)ans/(double)8 << endl;
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>

int main(void)
{
	char str[1001]={0,},tmp[1001]={0,},com[10]={0,},p[1024]={0,};
	int i,j,a,b,q;
	scanf("%s", &str);
	scanf("%d", &q);
	for(i=0;i<q;i++){
		scanf("%s %d %d", &com,&a,&b);
		if(strcmp(com,"print")==0){
			for(j=0;j<=b-a;j++) printf("%c",str[j+a]);
			printf("\n");
		}
		else if(strcmp(com,"reverse")==0){
			strcpy(tmp,str);
			for(j=0;j<=b-a;j++) str[j+a]=tmp[b-j];
		}
		else if(strcmp(com,"replace")==0){
			scanf("%s",&p);
			for(j=0;j<=b-a;j++) str[j+a]=p[j];
		}
		fflush(stdin);
	}
	return 0;   
}

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














int N;
int A[201010];
int B[201010];
//---------------------------------------------------------------------------------------------------
bool check(int i) {
	i = (i + N) % N;
	return A[i] <= B[i] - B[(i - 1 + N) % N] - B[(i + 1) % N];
}
ll solve() {
	ll ans = 0;
	queue<int> q;
	rep(i, 0, N) if (check(i)) q.push(i);
	while (!q.empty()) {
		int i = q.front(); q.pop();
		i = (i + N) % N;
		int del = B[(i - 1 + N) % N] + B[(i + 1) % N];
		int delta = B[i] - A[i];
		if (delta == 0) continue;
		if (delta < 0) return -1;

		int c = delta / del;
		ans += c;
		B[i] -= c * del;
		if (check(i - 1)) q.push(i - 1);
		if (check(i + 1)) q.push(i + 1);
	}

	bool ok = true;
	rep(i, 0, N) if (A[i] != B[i]) ok = false;
	if (ok) return ans;
	return -1;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];
	rep(i, 0, N) cin >> B[i];
	cout << solve() << endl;
}





Measured memory_bytes: 2304
<?php
 
$n = trim(fgets(STDIN));

$ans = 'No';


for ($i = 1; $i < 10; $i++) {
     for ($j = 1; $j < 10; $j++) {
          if($i * $j == $n) {
              $ans = 'Yes';
              break;
          }
     }
}

echo $ans;

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

vector<vector<char> > buttons { {'.',',','!','?',' '}, {'a','b','c'}, {'d','e','f'}, {'g','h','i'}, {'j','k','l'}, {'m','n','o'}, {'p','q','r','s'}, {'t','u','v'}, {'w','x','y','z'}};

char push(int button, int times) {
  return buttons[button - 1][(times - 1) % buttons[button - 1].size()];
}

void solve(string s) {
  int t = 0;
  int before = 0;
  for (auto c : s) {
    if (c == '0') {if (t != 0) cout << push(before, t); t = 0;}
    else {
      t++;
      before = atoi(&c);
    }
  }
  if (t!= 0) cout << push(before, t);
  cout << endl;
};

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    solve(s);
  }
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 100000000000000
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

using namespace std;
typedef long long int  ll;
typedef pair<int, int> P;


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

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}


////////////////////////////////////////////////////////////////////

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

ll ans=0;

if(k==0){
	cout<<n*n<<endl;
	return 0;
}


for(ll i=k+1;i<=n;i++){
	ll md=n%i;
ll s=n/i;
ll y=i;

ll u=max((ll)0,md-k+(ll)1);
ans=ans+u+s*(y-k);
}

cout<<ans<<endl;
return 0;


}




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

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP (i, 0, n)
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

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

int main() {
	int n; cin >> n;
	while (n--) {
		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya));
		if (d < ra - rb) cout << "2" << endl;
		else if (d < rb - ra) cout << "-2" << endl;
		else if (ra - rb <= d && d <= ra + rb) cout << "1" << endl;
		else if (d > ra + rb) cout << "0" << endl;
	}
}

Measured memory_bytes: 1228
N = int(input())
a = list(map(int, input().split()))

ans = 10 ** 20

s1 = a[0]
s2 = sum(a[1:])
ans = abs(s1 - s2)
if len(a)==2:
    print(ans)
else:
    for i in range(1, N-1):
        s1 = s1 + a[i]
        s2 = s2 - a[i]
        ans = min(ans, abs(s1 - s2))

    print(ans)


Measured memory_bytes: 24828
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int h,w,n;cin >> h >> w >> n;
    int r,c;cin >> r >> c;
    r--,c--;
    string s,ss;cin >> s >> ss;
    int t = 0;
    for (int i = 0; i < n; i++) {
        if(s[i]=='U') t--;
        if(t+r<0){
            puts("NO");
            return 0;
        }
        if(ss[i]=='D'&&t+r<h-1) t++;
    }
    t=0;
    for (int i = 0; i < n; i++) {
        if(s[i]=='D') t++;
        if(t+r>=h){
            puts("NO");
            return 0;
        }
        if(ss[i]=='U'&&t+r>0) t--;
    }
    t=0;
    for (int i = 0; i < n; i++) {
        if(s[i]=='L') t--;
        if(t+c<0){
            puts("NO");
            return 0;
        }
        if(ss[i]=='R'&&t+c<w-1) t++;
    }
    t = 0;
    for (int i = 0; i < n; i++) {
        if(s[i]=='R') t++;
        if(t+c>=w){
            puts("NO");
            return 0;
        }
        if(ss[i]=='L'&&t+c>0) t--;
    }
    puts("YES");
    return 0;
}


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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

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

int main(){
  int x, a, b;

  scanf("%d %d %d",&x, &a, &b);

  abs(x - a) < abs(x - b) ? printf("A\n") : printf("B\n");
}


Measured memory_bytes: 256
import java.util.Scanner;

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();
        int sum = 0;
        
        for(int x = a; x <= b; x++){
            if(c % x == 0){
                sum ++;
            }else{
                continue;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 26300
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>


using namespace std;

int main() {
    long long int N, A, ans = 1;
    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> A;

       
        if (A == 0) {
            ans = 0;
            break;
        }

        else if (A > 1000000000000000000 / ans) {
            ans = -1;
        }
        else if (ans != -1) {
            ans *= A;
        }

        else {
            if (A == 0) {
                ans = 0;
            }
        }
    }


    cout << ans;
    
    return 0;

}



Measured memory_bytes: 3196
N,D = list(map(int,input().split()))

xy = [map(float,input().split()) for _ in range(N)]
x,y = [list(i) for i in zip(*xy)]

ans = 0

for k in range(N):
    if float((x[k]*x[k] + y[k]*y[k])**(1/2)) <= D:
        ans += 1
    else:
        ans += 0

print(ans)


Measured memory_bytes: 146992
#include<bits/stdc++.h>
using namespace std;
int get1(int n)
{
	int s=0,i;
	for(i=0;i<5;i++)
	{
		if((n>>i)&0x01)
		{
			s++;
		}
	}
	return s;
}
int num[17];
char c[11];
int main()
{
	int n,i,tmp,check=0;
	long long s=0,t;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",c);
		switch(c[0])
		{
			case 'M':
				check|=1<<4;
				num[1<<4]++;
				break;
			case 'A':
				check|=1<<3;
				num[1<<3]++;
				break;
			case 'R':
				check|=1<<2;
				num[1<<2]++;
				break;
			case 'C':
				check|=1<<1;
				num[1<<1]++;
				break;
			case 'H':
				check|=1<<0;
				num[1<<0]++;
				break;
		}
	}
	for(i=0;i<=0x1f;i++)
	{
		if(get1(i)!=3)
		{
			continue;
		}
		if((i&check)!=i)
		{
			continue;
		}
		tmp=i;
		t=1;
		while(tmp)
		{
			t*=num[tmp&-tmp];
			tmp-=tmp&-tmp;
		}
		s+=t;
	}
	printf("%lld",s);
	return 0;
}

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

int main() {
  
  int64_t N, M, K; cin >> N >> M >> K; int ans = 0;
  
  vector<int64_t> vecA(N), vecB(M), sumA(N + 1, 0), sumB(M + 1, 0);
  
  for (int i = 0; i < N; i++) cin >> vecA[i];
  for (int i = 0; i < M; i++) cin >> vecB[i];
  
  for (int i = 0; i < N; i++) sumA[i + 1] = sumA[i] + vecA[i];
  for (int i = 0; i < M; i++) sumB[i + 1] = sumB[i] + vecB[i];
  
  for (int i = 0; i < N + 1; i++) {
    
    if (K < sumA[i]) break;
    
    int64_t dif = K - sumA[i];
    
    auto position = upper_bound(sumB.begin(), sumB.end(), dif);
    
    int number = distance(sumB.begin(), position) - 1;
    
    ans = max(ans, number + i);
    
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 9512
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX INT_MAX
#define MIN INT_MIN
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve() {
	int n, k;
	cin >> n >> k;
	if(n*500 >= k)
		cout << "Yes" << endl;
	else
		cout << "No" << endl; 
    return;
}
int32_t main() {
    FO;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<cassert>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main()
{
    ll x, y;
    cin >> x >> y;
    
    if (y == x || y == x + 1 || y == x - 1) {
        cout << "Brown" << endl;
    } else {
        cout << "Alice" << endl;
    }
    
}


Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)

rui = [0]

A.each do |a|
  rui << rui.last + a
end

ans = Float::INFINITY

l = 1
r = 3
2.upto(N - 2) do |d|
  l_sum = rui[d]
  l_min_diff = Float::INFINITY

  ll_sum = lr_sum = -1

  l.upto(d - 1) do |i|
    diff = (2 * rui[i] - l_sum).abs

    if l_min_diff > diff
      l_min_diff = diff
      ll_sum = rui[i]
      lr_sum = l_sum - ll_sum
      l = i
    else
      break
    end
  end

  r_sum = rui[N] - l_sum
  r_min_diff = Float::INFINITY
  rl_sum = rr_sum = -1

  r.upto(N - 1) do |j|
    rl = rui[j] - l_sum
    rr = r_sum - rl
    diff = (rl - rr).abs

    if r_min_diff > diff
      r_min_diff = diff
      rl_sum = rl
      rr_sum = rr
      r = j
    else
      break
    end
  end

  res  = [ll_sum, lr_sum, rl_sum, rr_sum].minmax.inject(:-).abs
  ans = res if ans > res
end

puts ans


Measured memory_bytes: 23560
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

const int SZ = 1 << 19;
bool tree[26][SZ << 1];

void update(int k, int x, int v) {
	for (tree[k][x += SZ] = v; x >>= 1; )
		tree[k][x] = tree[k][x << 1] | tree[k][x << 1 | 1];
}
bool query(int k, int L, int R, int idx = 1, int s = 0, int e = SZ - 1) {
	if (e < L || R < s) return 0;
	if (L <= s && e <= R) return tree[k][idx];
	int m = s + e >> 1;
	return query(k, L, R, idx << 1, s, m) | query(k, L, R, idx << 1 | 1, m + 1, e);
}
int main() {
	fastio;
	int N;
	cin >> N;

	string S;
	cin >> S;

	for (int i = 0; i < N; ++i) {
		update(S[i] - 97, i, 1);
	}

	int Q;
	cin >> Q;

	for (int q; Q--; ) {
		cin >> q;
		if (q == 1) {
			int a;
			char b;
			cin >> a >> b;
			update(S[a - 1] - 97, a - 1, 0);
			update(b - 97, a - 1, 1);
			S[a - 1] = b;
		}
		else {
			int a, b, cnt = 0;
			cin >> a >> b;
			for (int i = 0; i < 26; ++i) {
				cnt += query(i, a - 1, b - 1);
			}
			cout << cnt << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 27548
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define loop(i) for(int i = 0;true; i++)
#define all(x) (x).begin(), (x).end()
#define mn 1000000007
int main() {
	int N;
	cin >> N;
	vi A(N+1);
	vvi cost(N, vi(N,0));
	for (int i = 0; i < N; i++)
	{
		cin >> A[i] >> A[i + 1];
	}
	for (int i = 2; i <= N; i++)
	{
		for (int left = 0; left <= N-i; left++)
		{
			int right = left + i - 1;
			cost[left][right] =1e9;
			for (int k = left; k < right; k++)
			{
				cost[left][right] = min(cost[left][right], cost[left][k] +cost[k+1][right]+ A[left] * A[k+1] * A[right+1]);
			}
		}
	}
	cout << cost[0][N - 1] << endl;
};




Measured memory_bytes: 3168
import collections
n = int(input())
v = list(map(int, input().split()))
c_odd  = collections.Counter(v[::2])
c_even = collections.Counter(v[1::2])
odd    = c_odd.most_common()[:2]
even   = c_even.most_common()[:2]
if (len(odd) == 1) & (len(even) == 1):
	if odd[0][0] == even[0][0]:
		ans = odd[0][1]
	else:
		ans = 0
elif len(odd) == 1:
	if odd[0][0] == even[0][0]:
		ans = n - odd[0][1] - even[1][1]
	else:
		ans = n - odd[0][1] - even[0][1]
elif len(even) == 1:
	if odd[0][0] == even[0][0]:
		ans = n - odd[1][1] - even[0][1]
	else:
		ans = n - odd[0][1] - even[0][1]
else:
	if odd[0][0] == even[0][0]:
		ans = min(n - odd[0][1] - even[1][1], n - odd[1][1] - even[0][1])
	else:
		ans = n - odd[0][1] - even[0][1]
print(ans)

Measured memory_bytes: 18656
import static java.lang.Long.*;

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

public class Main {
	public static long N;
	public static long X;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		st = new StringTokenizer(br.readLine());
		N = parseLong(st.nextToken());
		X = parseLong(st.nextToken());

		long ans = pn(N,X);
		System.out.println(ans);

	}

	public static long pn(long n, long x) {
		if(n == 0 && x==1) {
			return 1;
		}else if (x == 1) {/*1*/
			return 0;
		} else if (1 < x && x <= 1 + total(n - 1)) {/*2*/
			return pn(n - 1, x - 1);
		} else if (x == 2 + total(n - 1)) {/*3*/
			return pn(n - 1, total(n - 1)) + 1;
		} else if (2 + total(n - 1) < x && x <= 2 + 2 * total(n - 1)) {/*4*/
			return pn(n - 1, total(n - 1)) + 1 + pn(n - 1, x - 2 - total(n - 1));
		} else {/*5*/
			return 2 * pn(n - 1, total(n - 1)) + 1;
		}

	}

	public static long total(long n) {
		if (n == 0)
			return 1;
		return 3 + total(n - 1) * 2;
	}
}

Measured memory_bytes: 22612
#include <math.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define mp(a, b) make_pair(a, b)
#define all(vec) (vec).begin(), (vec).end()
#define yn(formula) (formula) ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(formula) (formula) ? (cout << "YES" << endl) : (cout << "NO" << endl)
#define MIN(a, b) ((a) < (b)) ? (a) : (b)
#define LLONG_MAX     9223372036854775807i64

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pii> vp;
typedef vector<pll> vpl;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vp> vvp;
typedef vector<vpl> vvpl;

constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 29;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };

struct edge { ll to; ll cost; };

ll Pow(ll a, ll b) {
	ll x = 1;
	while (b > 0) {
		if (b & 1) x = x * a;
		a = a * a;
		b = b >> 1;
	}
	return x;
}

/*<ここから>***********************************************************/


int main()
{
	ll NN;
	cin >> NN;
	string N = to_string(NN);

	int S = 0;
	rep(i, N.length()) {
		S += int(N[i]) - '0';
	}

	yn(NN % S == 0);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


int main() {

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

	vector<bool> okashi(N, false);

	for (int i = 0; i < K; i++) {
		int d;
		cin >> d;
		for (int j = 0; j < d; j++) {
			int sunuke;
			cin >> sunuke;
			okashi[sunuke - 1] = true;
		}
	}

	int ans = 0;
	for (int i = 0; i < okashi.size(); i++) {
		if (okashi[i]) ans++;
	}

	cout << N - ans << endl;

	return 0;

}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(void){
    int n,ans,ans2,a,b,c;
    while(cin>>n&&n){
    cin>>a>>b>>c;
    ans=a,ans2=b+c;
    for(int i=0;i<n-1;i++){
      cin>>a>>b>>c;
      if(ans2<b+c)ans=a,ans2=b+c;
    }
    cout<<ans<<' '<<ans2<<endl;
  }
  return 0;
}


Measured memory_bytes: 3056
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
from functools import lru_cache
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=list(map(int,input().split()))

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

for i in range(1,n+1):
    for j in range(n):
        if j+i>n:
            continue
        if (n-i)%2==0:
            dp[j][i+j]=max(dp[j+1][i+j]+a[j],dp[j][i+j-1]+a[i+j-1])
        else:
            dp[j][i+j]=min(dp[j+1][i+j]-a[j],dp[j][i+j-1]-a[i+j-1])
# print(dp)
print(dp[0][n])

Measured memory_bytes: 113628
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextIntSlice(size int) []int {
	re := make([]int, size)
	for i := 0; i < size; i++ {
		re[i] = nextInt()
	}
	return re
}

func max(a []int) int {
	max := a[0]
	for _, v := range a {
		if v > max {
			max = v
		}
	}
	return max
}

func min(a []int) int {
	min := a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
	}
	return min
}

func main() {
	//sc.Split(bufio.ScanWords)
	a, b := nextLine(), nextLine()

	if len(a) > len(b) {
		fmt.Println("GREATER")
	} else if len(a) < len(b) {
		fmt.Println("LESS")
	} else {
		if a > b {
			fmt.Println("GREATER")
		} else if a < b {
			fmt.Println("LESS")
		} else {
			fmt.Println("EQUAL")
		}
	}
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void doIt() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int[] B = new int[M];
		for(int i = 0; i < M; i++) {
			B[i] = sc.nextInt();
		}
		int cnt = 0;
		for(int i = 0; i < N; i++) {
			int num = C;
			for(int j = 0; j < M; j++) {
				num += sc.nextInt() * B[j];
			}
			if(num > 0)cnt++;
		}
		System.out.println(cnt);
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}



Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << (x) << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

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

    int a[n + 1] = {}, b[n + 1] = {}, c[n + 1] = {};
    int x, y, z;
    int num;

    cin >> x;
    REP(i, x) {
        scanf("%d", &num);
        a[num] = 1;
    }
    cin >> y;
    REP(i, y) {
        scanf("%d", &num);
        b[num] = 1;
    }
    cin >> z;
    REP(i, z) {
        scanf("%d", &num);
        c[num] = 1;
    }

    int cnt = 0;
    FOR(i, 1, n + 1) {
        cnt += !a[i] && c[i] || b[i] && c[i];
    }

    OUT(cnt);

    return 0;
}




Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,x,y;
  cin >> a >> b;
  x= (a+b)/2;
  y=(a+b)%2;
    if(y==0){
      cout << x << endl;
    }else{
      cout << x+1 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int N,X;
  cin>>N>>X;
  int L[110];
  for (int i=0; i<N; i++) cin>>L[i];
  int sum=0;
  int counter=0;
  int i=0;
  while (X>=sum){
    sum+=L[i];
      counter++;
    i++;
  }
  cout<<counter<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
const long INF=1000000000000000;
const long MOD=1000000007;

int main(){
    string A,B;
    cin>>A>>B;
    
    if(A.size()>B.size())cout<<"GREATER"<<endl;
    else if(A.size()<B.size()) cout<<"LESS"<<endl;
    else {
        for(int i=0;i<A.size();i++){
            if(A.at(i)>B.at(i)){
                cout<<"GREATER"<<endl;
                return 0;
            }else if(A.at(i)<B.at(i)){
                cout<<"LESS"<<endl;
                return 0;
            }
        }
        
        cout<<"EQUAL"<<endl;
    }
}

Measured memory_bytes: 256
#comb_mod(n, r, mod) = nCr % mod
def comb_mod(n, r, mod):
    ans = 1
    if r <= n/2:
        for i in range(n-r+1, n+1):
            ans *= i
            ans %= mod
        for i in range(1, r+1):
            ans *= pow(i, mod-2, mod)
            ans %= mod
    else:
        for i in range(r+1, n+1):
            ans *= i
            ans %= mod
        for i in range(1, n-r+1):
            ans *= pow(i, mod-2, mod)
            ans %= mod
    return ans

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

ans = 0
pattern = comb_mod(n-1, k-1, 10**9+7)
for i in range(n-k+1):
    ans += (a[-(i+1)] - a[i]) * pattern
    pattern *= (n-k-i) * pow(n-1-i, 10**9+5, 10**9+7)
    pattern %= 10**9 + 7
print(ans % (10**9+7))

Measured memory_bytes: 14416
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
int main(){
    ll n;
    long double ans = 0.0;
    cin>>n;
    vector<long double> p(n+1,1.0);
    /*
    State
    dp[i][j]: Denotes the probability of getting j heads in i tosses
    Recurrence
    dp[i][j]+=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
    i.e it is the sum of probabilities of jth head falling in the ith toss
    and jth head falling in the (i-1)th toss, tail falling in the ith toss
    */
    vector<vector<long double>> dp(n+1,vector<long double> (n+1,0.0));
    dp[0][0] = 1.0;
    //probability of getting 0 heads in 0 tosses = 1
    for(ll i=1;i<=n;i++)
        cin>>p[i];
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<=i;j++){ 
            if(j)
                dp[i][j]+=dp[i-1][j-1]*p[i];
            dp[i][j]+=dp[i-1][j]*(1 - p[i]);
        }
    }
    for(ll i=n/2+1;i<=n;i++){
        ans += dp[n][i];
    }
    cout<<fixed<<showpoint;
    cout<<setprecision(15);
    cout<<ans;
	return 0;
}


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

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#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);i>(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

int main() {
  string S;
  cin >> S;
  int N = SZ(S);
  bool ans = true;
  
  REP(i,N) {
    if(i%2 == 0) {
      if(S.at(i) == 'L') {
        ans = false;
      }
    }
    else {
      if(S.at(i) == 'R') {
        ans = false;
      }
    }
  }
  if(ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(){
  int N;
  scanf("%d", &N);
  long long *A;
  A = (long long *)malloc(sizeof(long long)*N);
  for(int i=0; i<N; i++){
    scanf("%lld", &A[i]);
  }

  int l=0, r=0;
  long long s, x;
  long long cnt=0;
  for(l=0; l<N; l++){

    if(l==0){
      s=x=0;
    }else{
      s -= A[l-1]+A[r];
      x = s;
    }
    
    for(; r<N; r++){
      s += A[r];
      x = x^A[r];
      if(s != x) break;
    }

    cnt+=r-l;
  }

  
  printf("%lld\n", cnt);
  
  return 0;
}

Measured memory_bytes: 1664
A, B, C, D = map(int, input().split())

def gcd(a,b):
    if b>a:
        a,b = b,a
    while b:
        a,b = b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
E = lcm(C,D)

R = (B - A + 1) - ((B//C - (A-1)//C) + (B//D - (A-1)//D) - (B//E - (A-1)//E))

print(R)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
 using namespace std;
 int main(){

int ans=700;
 string s;
 cin>>s;

 for(int i=0;i<3;i++){
 	if(s[i]=='o')
      ans+=100;
 }

cout<<ans<<"\n";
 	return 0;
 }

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<utility>
#include<algorithm>
#include<functional>
#include<deque>
#include<cctype>
#include<time.h>
#include<cstdlib>
#include<iomanip>
using namespace std;

int main(){
   long long a, b;
   cin >> a >> b;
   long long keta = 0;
   long long tmp_b = b;
   while (tmp_b){
      keta++;
      tmp_b /= 10;
   }
   long long c = pow(10, keta) * a + b;
   for (int i = 1; i * i <= c; i++){
      if (c == i * i){
         cout << "Yes" << endl;
         return 0;
      }
   }
   cout << "No" << endl;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> list(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> list[i];
  }
  
  long long total = 0;
  for(int i = 0; i < n; ++i)
  {
    for(int j = i + 1; j < n; ++j)
    {
      total += list[i] * list[j];
    }
  }
  cout << total << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
A=[]
B=[]
for i in range(N):
  a,b=map(int,input().split())
  A+=[a]
  B+=[b]
A.sort()
B.sort()
if N%2==1:
  ans=B[N//2]-A[N//2]+1
else:
  Am=A[N//2]+A[N//2-1]
  Bm=B[N//2]+B[N//2-1]
  ans=(Bm-Am)+1
print(ans)  

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

using namespace std;

int main(){
    string str;
    cin >> str;
    int y, m;
    y = stoi(str.substr(0,4));
    m = stoi(str.substr(5,2));
    if(y < 2019){
        cout << "Heisei" << endl;
    }else if(y > 2019){
        cout << "TBD" << endl;
    }else{
        if(m <= 4){
            cout << "Heisei" << endl;
        }else if(m > 4){
            cout << "TBD" << endl;
        }
    }
    
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	char c;
	cin >> c;

	cout << char(c + 1) << '\n';

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();
		if(N==1 || N==2 || N==3 || N==5 || N==6 || N==9 || N==10 || N==13 || N==17) {
			System.out.println("No");
		}
		else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

using namespace std;

int main(){

    int n,T;
    cin >> n >> T;

    int ans = INT_MAX;

    rep(i,n){
        int c,t;
        cin >> c >> t;

        if(t <= T){
            ans = min(ans,c);
        }
    }

    if(ans == INT_MAX){
        cout << "TLE" << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

int32_t main(){
//	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int k;
	int sum = 0;
	scanf("%d", &k);
	for (int i = 1; i <= k; i++){
		for (int j = 1; j <= k; j++){
			for (int l = 1; l <= k; l++){
				sum += __gcd(__gcd(i, j), l);
			}
		}
	}
	printf("%d", sum);
}


Measured memory_bytes: 3864
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin>>s;
  int n=s.size();
  if(n%2==0){
    if(s[0]!=s[n-1]){
      cout<<"Second"<<endl;
    }else{
      cout<<"First"<<endl;
    }
  }else{
    if(s[0]!=s[n-1]){
      cout<<"First"<<endl;
    }else{
      cout<<"Second"<<endl;
    }
  }

  return 0;
}


Measured memory_bytes: 512