akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string s; cin >> s;
  int n = s.size();
  stack<char> st;
  rep(i, n) {
    if(s[i] == 'S') st.push(s[i]);
    if(s[i] == 'T') {
      if(!st.empty() && st.top() == 'S') st.pop();
      else st.push(s[i]);
    }
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 3728
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long x = in.nextLong(), y = in.nextLong();

			out.println(Math.abs(x-y) <= 1 ? "Brown" : "Alice");

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

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

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 21460
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
//using ll=long long;

int main(){
    string S;
    cin >> S;
    int count = 0;
    int place;
    for(int i = 2; i < S.length()-1; ++i){
        if(S[i] == 'C'){
            count++;
            place = i;
        }
    }
    int flag = 0;
    for(int i = 1; i < S.length(); ++i){
        if((S[i] >= 'a' && S[i] <= 'z') || i == place){
            continue;
        } else {
            flag = 1;
            break;
        }
    }
    if(S.substr(0,1) == "A" && count == 1 && flag == 0) cout << "AC" << endl;
    else cout << "WA" << endl;
    
    return 0;
}

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

#define PI acos(-1)
#define pb push_back
#define int long long int
#define pi pair<int, int>
#define fir first
#define sec second
#define MAXN 200001
#define MAXL 20
#define mod 1000000007

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x, k;
  cin >> n >> x >> k;
  n = abs(n);
  int need = n / k;
  if (n % k)
    need++;
  int ans = LLONG_MAX;
  if (need <= x)
  {
    if ((x - need) & 1)
      need--;
    ans = min(ans, abs(n - (need * k)));
  }
  if (n % k)
    need--;
  if (need <= x)
  {
    if ((x - need) & 1)
      need--;
    ans = min(ans, abs(n - (need * k)));
  }
  if (x < need)
  {
    ans = abs(n - (x * k));
  }
  cout << ans << endl;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;

const int len = 705;
ii edge[len*len];
int dp[len][len], vis[len], mat[len][len], n, m;
vector<int> vec, adj[len];

int dfs(int u, int t){
    vis[u] = t;

    int ans = 0;
    if (t == 1) ans++;
    else ans--;
    for (int v = 1; v <= n; v++){
        if (v != u && mat[u][v] && !vis[v]){
            if (t == 1)
                ans += dfs(v, 2);
            else
                ans += dfs(v, 1);
        }
    }

    return ans;
}

int solve(int i, int j){
    if (i == vec.size()) return j;
    if (dp[i][j] != -1) return dp[i][j];

    int ans = min(solve(i+1, abs(j-vec[i])), solve(i+1, abs(j+vec[i])));
    return dp[i][j] = ans;
}

int main(){
    scanf("%d %d", &n, &m);

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            mat[i][j] = 1;

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

    for (int i = 1; i <= n; i++)
        if (!vis[i]){
            int temp = dfs(i, 1);
            vec.pb(temp);
        }

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++){
            if (i == j || mat[i][j] == 0) continue;

            if (vis[i] == vis[j]){
                printf("-1\n");
                return 0;
            }
        }

    for (int i = 0; i < vec.size(); i++)
        for (int j = 0; j <= n; j++)
            dp[i][j] = -1;

    int a = (n+solve(0, 0))/2, b = n-a;
    printf("%d\n", (a*(a-1))/2 + (b*(b-1))/2);
    return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define int long long
#define rep(i , a , b) for(int i = a ; i <= b ; i ++)
#define P pair<int,int>
#define  sc(a) scanf("%lld",&a)
#define pf(a) printf("%lld ",a)
using namespace std;
struct point
{
	int x;
	int y;
}point [20];
struct xia
{
	int x;
	int y;
}v[10];
int vis[20];
int maxx;
int n, q;
void ju()
{
	int temp = 0;
	for (int i = 0; i < q; i++)
		for (int j = i+1; j < q; j++)
			if (v[i].x * v[j].y == v[i].y * v[j].x)
				temp++;
	maxx = max(temp, maxx);
	return;
}
void dfs(int x)
{
	while (vis[x])x++;
	if (x >= n) {
		ju();
		return;
	}
	vis[x] = 1;
	for (int i = 0; i < n; i++)
	{
		if (!vis[i])
		{
			vis[i] = 1;
			int dy = point[x].y - point[i].y;
			int dx = point[x].x - point[i].x;
			v[q].x = dx, v[q].y = dy;
			q++;
			dfs(x + 1);
			q--;
			vis[i] = 0;
		}
	}
	vis[x] = 0;
	return;
}
signed main()
{
	sc(n);
	MEM(vis, 0);
	rep(i, 0, n - 1)
		sc(point[i].x), sc(point[i].y);
	dfs(0);
	cout << maxx << endl;
}












Measured memory_bytes: 3240
//
// Created by Myabu on 2020/01/23.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;


int main(void){
    string X,Y;
    cin>>X>>Y;


    if(X>Y){
        cout<<">"<<endl;
    }else if(X<Y){
        cout<<"<"<<endl;
    }else{
        cout<<"="<<endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<iomanip>
using namespace std;
int a[5][5],b[5][5];
int main()
{
	int i,j,flag=0;
	for(i=0;i<3;i++)
	{
		for(j=0;j<3;j++)
		cin>>b[i][j];
	}
	int m,x,k;
	cin>>m;
	for(k=0;k<m;k++)
	{
		cin>>x;
		for(i=0;i<3;i++)
    	{
    		for(j=0;j<3;j++)
    		{
    			if(x==b[i][j])
    			a[i][j]=1;
			}
    	}
	}
	for(i=0;i<3;i++)
	{
		if(a[i][0]==1&&a[i][1]==1&&a[i][2]==1)
		{
			flag=1;
			break;
		}
		if(a[0][i]==1&&a[1][i]==1&&a[2][i]==1)
		{
			flag=1;
			break;
		}
	}
	if(flag==0)
	{
		if(a[0][0]==1&&a[1][1]==1&&a[2][2]==1)
		flag=1;
		else if(a[0][2]==1&&a[1][1]==1&&a[2][0]==1)
		flag=1;
	}
	if(flag)
	cout<<"Yes";
	else cout<<"No";
    return 0;
}

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

int A[20];
int n, q;

int solve(int, int);

int main(){
  int m[200];
  int i, j;
  
  scanf("%d",&n);
  if(n > 20) exit(1);

  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
    if(A[i] < 1 || 2000 < A[i]) exit(2);
  }

  scanf("%d",&q);
  if(q > 200) exit(3);

  for(j=0; j<q; j++){
    scanf("%d",&m[j]);
    if(solve(0, m[j]) == 1) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}

int solve(int i, int mi){
  int r;

  if(mi == 0) return 1;
  if(i >= n) return 0;
  r=solve(i+1, mi) || solve(i+1, mi-A[i]);
  return r;
}


  



Measured memory_bytes: 2104
def main():
    n = int(input())
    ary = [int(i) for i in input().split()]
    ary = sorted(ary)

    from math import log2
    lt = log2(10**18)

    if ary[0] == 0:
        print(0)
        return
      
    if any(log2(ary[i]) > lt / (n-i) for i in range(n)):
        print('-1')

    else:
        prod = 1
        for i in range(n):
            prod *= ary[i]
        if prod > 10**18:
            print(-1)
        else:
            print(prod)

main()


Measured memory_bytes: 21660
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")

using namespace std;
using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef gp_hash_table < int, int > fast;

#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, base = 1e9, MOD = 1e9 + 7, N = 1e5 + 5, M = 1e3 + 5;
const int INF = INT_MAX;
const db PI = acos(-1), EPS = 1 / db(1e6);

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

void test();

int main() {
    fast_io();
    cout << fixed << setprecision(15);
    test();
    return 0;
}

void test() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    int ans = 0;
    for (int i = a[0]; i <= a[n - 1]; ++i) {
        int pos = lower_bound(a, a + n, i) - a;
        ans += (pos * 2 == n);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

long long s1[200'010];
long long s2[200'010];
long long emax[200'010];

long long dfs(int n, vector<long long>& a, long long now = 0){
  if(n == 1) return now;
  long long res;
  if(n % 2 == 0){
    long long tmp = emax[n-1];
    res = tmp + now;
    return res;
  }
  long long tmp1 = dfs(n - 2, a, now + a[n-1]);
  long long tmp2 = dfs(n - 1, a, now);
  res = max(tmp1, tmp2);
  return res;
}

int main(){
  //using namespace std;
  int n;
  cin>>n;
  vector<long long> a(n);
  REP(i, n) cin>>a[i];
  REP(i, n){
    if(i == 0){
      s1[i] += a[i];
      continue;
    }
    s1[i] = s1[i-1];
    s2[i] = s2[i-1];
    if(i % 2 == 0){
      s1[i] += a[i];
    }else{
      s2[i] += a[i];
    }
  }
  REP(i, n){
    if(i % 2 == 0) continue;
    if(i == 1){
      emax[i] = max(a[0], a[1]);
      continue;
    }
    emax[i] = s1[i];
    emax[i] = max(emax[i], emax[i-2] + a[i]);
  }
  long long ans = dfs(n, a);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 14028
import Control.Applicative
import Data.List
import Control.Monad
strToInteger s = (read :: String -> Integer) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [x, y] <- map strToInteger . words <$> getLine
    -- 出力
    putStrLn . show . length . takeWhile (<= y) $ zipWith (*) ([2^n | n <- [0,1..]]) (repeat x)


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }

int main(){
    ll N;
    cin >> N;
    vector<ll> T(N);
    rep(i,N)cin>>T[i];
    ll gcdn=T[0];
    ll ans = T[0];
    rep(i,N-1){
        gcdn = __gcd(ans, T[i+1]);
        ans *= (T[i+1]/gcdn);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var s = cin.Read;
          	var flag = 0;
          	for(int i=0;i<s.Length;i++){
              	if(s[i]=='R'){
                  if((i+1)%2==0){
                    flag = 1;
                    break;
                  }
                }else if(s[i]=='L'){
                  if((i+1)%2==1){
                    flag = 1;
                    break;
                  }
                }
            }
          	if(flag==0){
              	WriteLine("Yes");
            }else{
                WriteLine("No");
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13268
package main

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

// Road is 通路構造体
type Road struct {
	to []int
}

// Heya is 部屋構造体
type Heya struct {
	depth int
	prev  int
}

func main() {
	list := getStdinIntArr()
	N := list[0]
	M := list[1]
	road := make([]Road, N) // 通路
	heya := make([]Heya, N) // 部屋

	// 通路初期化
	for i := 0; i < N; i++ {
		road[i].to = make([]int, 0)
	}
	// 通路
	for i := 0; i < M; i++ {
		list2 := getStdinIntArr()
		A := list2[0]
		B := list2[1]
		A = A - 1 // 0スタートに直す
		B = B - 1
		road[A].to = append(road[A].to, B)
		road[B].to = append(road[B].to, A)
	}
	// 部屋初期化
	for i := 0; i < N; i++ {
		if i == 0 {
			heya[i].depth = 0
			heya[i].prev = -1
		} else {
			heya[i].depth = math.MaxInt32
			heya[i].prev = -1
		}
	}
	// 0部屋から幅優先探索する
	parent := []int{0}
	for {
		parentTmp := parent[:]
		parent = parent[len(parent):]

		for _, val := range parentTmp {
			for _, to := range road[val].to {
				if heya[to].prev != -1 {
					continue
				}
				heya[to].depth = heya[val].depth + 1
				heya[to].prev = val
				parent = append(parent, to)
			}
		}

		if len(parent) == 0 {
			break
		}
	}
	// 答え出力
	fmt.Printf("Yes\n")
	for idx, val := range heya {
		if idx == 0 {
			continue
		}
		fmt.Printf("%d\n", val.prev+1) // 1スタートに戻す
	}
}

var sc = bufio.NewScanner(os.Stdin)

func getStdin() string {
	sc.Scan()
	return sc.Text()
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}


Measured memory_bytes: 21124
fun main(args: Array<String>) {
    var k = readLine()!!.toInt()
    var lunlun = mutableListOf<Long>(1, 2, 3, 4, 5, 6, 7, 8, 9)
    var tmpArray = mutableListOf<Long>()
    var q:Long
    var qt:Long
    if (k < 10) {
        println(lunlun[k-1])
    } else {
        k -= 9
        loop@while (true) {
            while (!lunlun.isEmpty()) {
                q = lunlun[0]
                lunlun.removeAt(0)
                qt = q*10
                q %= 10
                when(q) {
                    0L -> {
                        repeat(2){tmpArray.add(qt+it)}
                        k -= 2
                    }
                    9L -> { 
                        repeat(2){tmpArray.add(qt+it+8)}
                        k -= 2
                    }
                    else -> {
                        repeat(3){tmpArray.add(qt+it+q-1)}
                        k -= 3
                    }
                }
                if (k <= 0) {
                    break@loop
                }
            }
            lunlun = tmpArray.toMutableList()
            tmpArray.clear()
        }
        println(tmpArray[tmpArray.size+k-1])
    }
}


Measured memory_bytes: 36620
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e10;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
#define int long long
#define double long double


int a,b,g,ans;

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

map<int, int> prime_factor(int n){
  map<int, int> ret;
  for(int i = 2;i*i <= n;i++){
    while(n % i == 0){
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1){
    ret[n] = 1;
  }
  return ret;
}

////////////////////////////////////////////////////////////////////i

signed main(){
  cin>>a>>b;g = __gcd(a,b);
  cout << prime_factor(g).size()+1 << endl;
}





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

const int MAX = 10000000;
const int MOD = 1000000007;

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int x,y;
  cin >> x >> y;
  int a,b,n = 0;
  ll ans = 1;
  a = 2*x-y;
  b = 2*y-x;
  if(a<0||b<0) {
    cout << 0 << endl;
    return 0;
  }else if(!(a%3==0&&b%3==0)){
    cout << 0 << endl;
    return 0;
  }
  a /= 3; b /= 3;
  if(a>b) swap(a,b);
  n = a+b;
  COMinit();
  cout << COM(n,a) << endl;
  return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  int vsum = 0;
  vector<int> ai(N);
  rep(i, N){
    cin >> ai.at(i);
    vsum += ai.at(i);
  }
  int cnt = 0;
  rep(i, N){
    if(ai.at(i) >= (vsum + 4 * M - 1) / (4 * M))
      cnt++;
    if(cnt == M){
      cout << "Yes" << endl;
      return 0;
    }
  }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;


int main(){
  ll a,b,v,w,t;
  cin>>a>>v>>b>>w>>t;
  
  if(abs(a-b)>t*(v-w)){
    cout<<"NO"<<endl;
    return 0;
  }
  
  cout<<"YES"<<endl;

 
  return 0;

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int mod =1000000007;
const double PI = acos(-1);
vector<string>res;
void dfs(string s,int a,char m){
    if(s.length()==a){
        res.push_back(s);
        return;
    }
    for(char i ='a';i<=m+1;i++){
        dfs(s+i,a,max(i,m));
    }
}
int main(){
   int n;cin>>n;
   dfs("a",n,'a');
   sort(been(res));
   for(auto x:res)cout<<x<<endl;
}

Measured memory_bytes: 7232
from collections import defaultdict
N, M = map(int, input().split())
dic = defaultdict(list)
ls = []
ans = 0
for i in range(M):
  a, b = map(int, input().split())
  dic[a] += [b]
  dic[b] += [a]
  ls += [(a,b)]

for v in ls:
  a, b = v
  stuck = [a]
  log = [True]*(N+1)
  log[a] = False
  count = 1
  while stuck:
    p = stuck.pop()
    if p==a or p==b:
      for e in dic[p]:
        if e==a or e==b:
          continue
        if log[e]:
          log[e] = False
          stuck += [e]
          count += 1
    else:
      for e in dic[p]:
        if log[e]:
          log[e] = False
          stuck += [e]
          count += 1
  if count != N:
    ans += 1

print(ans)

Measured memory_bytes: 3316
n = gets.to_i
t, a = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)

min_diff = (a - (t - h[0] * 0.006)).abs
min_diff_index = 0

(1...n).each do |i|
  diff = (a - (t - h[i] * 0.006)).abs
  if diff < min_diff
    min_diff = diff
    min_diff_index = i
  end
end

puts min_diff_index + 1


Measured memory_bytes: 1788
#include<stdio.h>

int main(void) {
	int a, b, N, s, f, i;
	scanf("%d %d", &a, &b);
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d %d", &s, &f);
		if (a<f&&b>s) {
			printf("1\n");
			return 0;
		}
	}
	printf("0\n");
	return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll n,ans=0;
	in(n);
	vll b(n - 1);

	in(b[0]);
	ans += b[0];

	rep(i, 1, n - 1) {
		in(b[i]);
		if (b[i] > b[i - 1]) {
			ans += b[i - 1];
		}
		else {
			ans += b[i];
		}
	}
	ans += b[n - 2];

	outn(ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    char arr[5];
    int m;
    for ( int i=0 ; i<5 ; i++) {
        scanf("%c ",&arr[i]);
        if ( arr[i] == '0' ) {
            m = i+1;
        }
    }
    printf("%d",m);

    return 0;
}


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

typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl; 
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    //OJ;
    FIO;
    ll n,d;
    cin>>n>>d;
    ll x,y;
    int c(0);
    while(n--){
        cin>>x>>y;
        if(x*x+y*y<=d*d){
            c++;
        }
    }
    cout<<c;
}

Measured memory_bytes: 3164
n,m = list(map(int, input().split()))
manu = []

for i in range(m):
    manu.append(list(map(int, input().split())))

num = [1 for i in range(n+1)]
poss = [0 for i in range(n+1)]
poss[1] = 1

for i in range(m):
    a,b = manu[i][0],manu[i][1]
    if(poss[a]==1):
        poss[b]=1
    num[a]-=1
    num[b]+=1
    if(num[a]==0):
        poss[a]=0

print(sum(poss))


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

int main() {
	ios_base::sync_with_stdio( false );

	double N, K;
	cin >> N >> K;

	double result = 0;
	for( int i = 1; i <= N; ++i ) {
		int t = i;
		double u = 1.0 / N;

		while( t < K ) {
			t *= 2;
			u *= 0.5;
		}

		result += u;
	}

	cout << fixed << setprecision( 12 );
	cout << result << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 2e5;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T> void vout(T s){cout << s << endl;exit(0);}

struct Set{
    ll a, b;
    void insert(ll x){
        if(b > x)b = x;
        if(a > b)swap(a, b);
    }
};

Set t[400010];

void modify(ll v, ll tl, ll tr, ll pos, ll val){
    t[v].insert(val);
    if(tl != tr){
        ll tm = (tl + tr) >> 1;
        if(pos <= tm)modify(v << 1, tl, tm, pos, val);
        else modify((v << 1) + 1, tm + 1, tr, pos, val);
    }
}

Set Ans;

void get(ll v, ll tl, ll tr, ll l, ll r){
    if(l > r)return;
    if(tl == l && tr == r){
        Ans.insert(t[v].a);
        Ans.insert(t[v].b);
        return;
    }
    ll tm = (tl + tr) >> 1;
    get(v << 1, tl, tm, l, min(r, tm));
    get((v << 1) + 1, tm + 1, tr, max(l, tm + 1), r);
}

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

    ll n;
    cin >> n;

    for(int i = 0; i < 400010; i++)t[i].a = t[i].b = n + 1;

    vector <ll> a(n + 1);
    vector <Set> l(n + 1), r(n + 1);

    for(int i = 1; i <= n; i++){
        cin >> a[i];
        modify(1, 1, n, a[i], -i);
        Ans.a = n + 1;
        Ans.b = n + 1;
        get(1, 1, n, a[i] + 1, n);
        l[i] = Ans;
    }

    for(int i = 0; i < 400010; i++)t[i].a = t[i].b = n + 1;

    for(int i = n; i > 0; i--){
        modify(1, 1, n, a[i], i);
        Ans.a = n + 1;
        Ans.b = n + 1;
        get(1, 1 ,n, a[i] + 1, n);
        r[i] = Ans;
    }

    ll ans = 0;

    for(int i = 1; i <= n; i++){
        l[i].a *= -1;
        l[i].b *= -1;
        l[i].a = max(l[i].a, 0ll);
        l[i].b = max(l[i].b, 0ll);
        ans += a[i] * (l[i].a - l[i].b) * (r[i].a - i);
        ans += a[i] * (-r[i].a + r[i].b) * (-l[i].a + i);

    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 10368
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;
// using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
///////////////////////////////////////////////

int dp[1001001], dp2[1001001];

int main() {
    int n;
    int inf = 1e6+10;
    vector<int> a(201);
    repf(i,1,201) {
        a[i] = i*(i+1)*(i+2)/6;
    }
    memset(dp, inf, sizeof(dp));
    memset(dp2, inf, sizeof(dp2));
    dp[0] = dp2[0] = 0;
        
    repf(i,1,201) rep(j,1e6+1) {
        int nj = j+a[i];
        if (nj > 1e6+1) continue;
        chmin(dp[nj] ,dp[j]+1);
        if (a[i]%2==1) chmin(dp2[nj] ,dp2[j]+1);
    }

    while (1) {
        cin >> n;
        if (n == 0) break;
        cout << dp[n] << ' ' << dp2[n] << endl;
    }
    return 0;
}


Measured memory_bytes: 10832
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define MOD 1000000007

int main()
{
  int a, b, t;
  cin >> a >> b >> t;
  cout << (t / a) * b << endl;

  return 0;
}


Measured memory_bytes: 3504
import java.util.Scanner;

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

	int a = scan.nextInt();
	int b = scan.nextInt();

	if(a > 8 || b > 8){
	    System.out.println(":(");
	}else{
	    System.out.println("Yay!");
	}
    }
}


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

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

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

const int INF = 1 << 30;

int main() {
    int N, K; cin >> N >> K;
    int h[N+110];
    for (int i = 1; i <= N; i++) {
        cin >> h[i];
    }
    int dp[N+110];
    for (int i = 0; i < N+110; i++) {
        dp[i] = INF;
    }
    dp[1] = 0;

    for (int i = 1; i <= N; i++) {
        for (int k = 1; k <= K; k++) {
            chmin(dp[i+k], dp[i] + abs(h[i] - h[i+k]));
        }
    }

    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

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

    int r = sc.nextInt();
    int d = sc.nextInt();
    int x2000 = sc.nextInt();

    int x = r * x2000 - d;
    for (int i = 0; i < 10; i++) {
      System.out.println(x);
      x = r * x - d;
    }
  }
}


Measured memory_bytes: 23124
a, b, c, d, e, f = map(int, input().split())
a *= 100
b *= 100

water = []
sugar = []

for i in range(1 + f // a):
    for j in range(1 + f // b):
        if i * a + j * b <= f:
            water.append(i * a + j * b)

for i in range(1 + f // c):
    for j in range(1 + f // d):
        if i * c + j * d <= f:
            sugar.append(i * c + j * d)

max_sugar_percent = 0
max_sugarwater = 0
max_sugar = 0

water.sort()
sugar.sort()

for w in water:
    for s in sugar:
        if w + s > f:
            break

        if s > e * w / 100:
            break

        sugar_percent = w and (100 * s) / (w + s)
        if sugar_percent >= max_sugar_percent:
            max_sugar_percent = sugar_percent
            max_sugar = s
            max_sugarwater = w + s

print(max_sugarwater, max_sugar)


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

int gcd(long long a, long long b){
  long long M = max(a, b), m = min(a, b);
  while(m != 0){
  	long long r = M%m;
    M = m; m = r;
  }
  return M;
}

int digit_sum(long long n){
  long long ans;
  while(n != 0){
  	ans += n%10;
  	n /= 10;
  }
  return ans;
}

int main(){
  int n;
  cin >> n;
  vector<double> a(n);
  
  for(int i = 0; i < n; i++){
  	cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  double ans = (a.at(0) + a.at(1))/2;
  
  for(int i = 2; i < n; i++){
  	ans = (ans + a.at(i))/2;
  }
  cout << fixed << setprecision(10);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
int A[maxn],B[maxn],C[maxn],n;
void init()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&A[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&B[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&C[i]);
}
void work()
{
    sort(A+1,A+n+1);
    sort(B+1,B+n+1);
    sort(C+1,C+n+1);
    int ai=1,ci=1;
    ll sum=0;
    for(int i = 1;i<=n;i++)
    {
        while(A[ai]<B[i]&&ai<=n)ai++;
        while(C[ci]<=B[i]&&ci<=n)ci++;
        sum+=(ll)(ai-1)*(n-(ci-1));
    }
    cout<<sum<<endl;
}
int main()
{
    init();
    work();
    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <map>

using namespace std;

int main(){
	while(1){
		map<char, char> data;
		int n,i;
		scanf("%d", &n);
		if(n==0) break;

		char a,b;
		for(i=0;i<n;i++) {
			scanf(" %c %c", &a, &b);
			data.insert(pair<char,char>(a,b));
			
		}

		scanf("%d", &n);
		for(i=0;i<n;i++){
			scanf(" %c", &a);
			if(data.find(a) != data.end())
				printf("%c", data[a]);
			else
				printf("%c", a);
		}
		puts("");
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    	cin.tie(0);
        ios::sync_with_stdio(0);
    	int n;
    	cin>>n;
        map<int, int> mp;
        for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        mp[x]++;
        mp[x - 1]++;
        mp[x + 1]++;
        }
        int ans = 0;
        for(auto x : mp){
          ans = max(ans, x.second);
        }
    cout << ans;
 	return 0;
}

Measured memory_bytes: 4736
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

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

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};

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

void Solve() {
	
	int n;
	cin >> n;
	int tn = 3 * n;
	int dn = 2 * n;
	ll ar[300010];
	for (size_t i = 0; i < tn; i++)
		cin >> ar[i];
	
	priority_queue<ll,vector<ll>, greater<int>> q;
	priority_queue<ll, vector<ll>> bq;
	ll fsum = 0;
	for (size_t i = 0; i < n; i++)
	{
		q.push(ar[i]);
		fsum += ar[i];
	}
	ll bsum = 0;
	for (size_t i = dn; i < tn; i++)
	{
		bq.push(ar[i]);
		bsum += ar[i];
	}

	ll fb[100010];
	fb[0] = fsum;
	for (int i = 1; i <= n; i++)
	{
		int pi = (i - 1) + n;
		ll p = q.top();
		if (p < ar[pi]) {

			fsum -= p;
			fsum += ar[pi];
			q.pop();
			q.push(ar[pi]);
		}
		fb[i] = fsum;
	}
	ll bb[100010];
	bb[n] = bsum;
	for (int i = 1; i <= n; i++)
	{
		int pi = dn - i;
		ll p = bq.top();
		if (p > ar[pi]) {

			bsum -= p;
			bsum += ar[pi];
			bq.pop();
			bq.push(ar[pi]);
		}
		bb[n - i] = bsum;
	}
	ll best = fb[0] - bb[0];
	for (size_t i = 1; i <= n; i++)
	{
		best = max(best, fb[i] - bb[i]);
	}

	cout << best << endl;
}


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



Measured memory_bytes: 6388
#include    <iostream>
#include    <algorithm>
#include    <vector>
#include    <string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef unsigned long long ll;

int main(){
    int n,k;
    cin >> n>>k;
    ll h[n];
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    sort(h,h+n);
    ll add=0;
    for(int i=0;i<n-k;i++){
        add+=h[i];
    }
    cout << add << endl;
}




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

int main() {
    long long  a, b, c;
    cin >> a >> b >> c;
    long long d = c - a - b;
    if ( d > 0 && 4*a*b < d*d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
typedef long long ll;
using namespace std;

int main(){
	int N;
	cin >> N;
	int t = 0,x= 0,y = 0;
	for(int i=1;i<=N;i++){
		int a,b,c;
		cin >> a >> b >> c;
		int jar = abs(b-x) + abs (y-c);
		if(jar <= a-t){
			jar = (a-t) - jar;
			if(jar % 2 == 1){
				cout << "No\n";
				return 0;
			}
		}
		else {
			cout << "No\n",0;
			return 0;
		}
		t = a;
		x = b;
		y = c;
	}
	cout << "Yes\n";
}
 


Measured memory_bytes: 256
import java.util.Scanner;

//Apple and Peach
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		for(int i=0;i<s.length-4;i++){
			if(s[i]=='a'&&s[i+1]=='p'&&s[i+2]=='p'&&s[i+3]=='l'&&s[i+4]=='e'){
				s[i] = 'p';
				s[i+1] = 'e';
				s[i+2] = 'a';
				s[i+3] = 'c';
				s[i+4] = 'h';
			}
			else if(s[i]=='p'&&s[i+1]=='e'&&s[i+2]=='a'&&s[i+3]=='c'&&s[i+4]=='h'){
				s[i] = 'a';
				s[i+1] = 'p';
				s[i+2] = 'p';
				s[i+3] = 'l';
				s[i+4] = 'e';
			}
		}
		System.out.println(s);
	}
}

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

using namespace std;
int main() {
  int n;
  cin >> n;
  double d = 0;

  for (int i = 0; i < n; i++) {
    double num;
    cin >> num;
    d += 1 / num;
  }
  d = 1 / d;
  cout << d << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
     int a=0, b=0, c=0, t;

     for(;;){
	  if(scanf("%d", &t) == -1)
	       break;

	  if(c<=t){
	       if(b<=t){
		    if(a<=t){
			 c = b;
			 b = a;
			 a = t;
		    }
		    else{ 
			 c = b;
			 b = t;
		    }
		    
	       }
	       else c = t;
	  }
	  
     }
     
     printf("%d\n%d\n%d\n", a, b, c);
     
     return 0;
}

Measured memory_bytes: 600
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

	using i8 = std::int_least8_t;
	using i32 = std::int_least32_t;
	using i64 = std::int_least64_t;
	using u8 = std::uint_least8_t;
	using u32 = std::uint_least32_t;
	using u64 = std::uint_least64_t;
	using isize = std::ptrdiff_t;
	using usize = std::size_t;

	class rep {
		const usize f, l;

	public:
		class itr {
			friend rep;
			usize i;
			constexpr itr(const usize x) noexcept : i(x) {}

		public:
			void operator++() noexcept { ++i; }
			constexpr usize operator*() const noexcept { return i; }
			constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
		};
		constexpr rep(const usize first, const usize last) noexcept
			: f(first), l(last) {}
		constexpr itr begin() const noexcept { return itr(f); }
		constexpr itr end() const noexcept { return itr(l); }
	};
	class revrep {
		const usize f, l;

	public:
		class itr {
			friend revrep;
			usize i;
			constexpr itr(usize x) noexcept : i(x) {}

		public:
			void operator++() noexcept { --i; }
			constexpr usize operator*() const noexcept { return i; }
			constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
		};
		constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
		constexpr itr begin() const noexcept { return itr(l); }
		constexpr itr end() const noexcept { return itr(f); }
	};
	template <class T> using vec_alias = std::vector<T>;
	template <class T> auto md_vec(const usize n, const T &value) {
		return std::vector<T>(n, value);
	}
	template <class... Args> auto md_vec(const usize n, Args... args) {
		return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
	}
	template <class T> constexpr T difference(const T &a, const T &b) {
		return a < b ? b - a : a - b;
	}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cassert>

namespace n91 {

	void stop(){}

	bool solve() {
		usize n, m;
		std::cin >> n >> m;
		std::vector<std::multiset<usize>> g(n);
		std::vector<usize> deg(n);
		while (m--) {
			usize a, b;
			std::cin >> a >> b;
			--a;
			--b;
			g[a].emplace(b);
			g[b].emplace(a);
			++deg[a];
			++deg[b];
		}
		for (const auto e : deg) {
			if (e % 2 == 1) {
				return false;
			}
		}
		usize single_cnt = 0;
		for (const auto i : rep(0, n)) {
			if (g[i].size() == 2) {
				const usize a = *g[i].cbegin(), b = *g[i].crbegin();
				if (a == b) {
					++single_cnt;
					g[a].erase(i);
				}
				else {
					g[a].erase(i);
					g[a].emplace(b);
					g[b].erase(i);
					g[b].emplace(a);
				}
				g[i].clear();
			}
		}
		usize edge_cnt = 0;
		for (const auto &e : g) {
			edge_cnt += e.size();
		}
		edge_cnt /= 2;
		return edge_cnt + single_cnt * 2 >= 6;
	}

	void main_() {
		std::cout << (solve() ? "Yes" : "No") << std::endl;
	}

} // namespace n91

int main() {
	n91::main_();
	return 0;
}


Measured memory_bytes: 15104
N = int(input())
a = list(map(int, input().split()))
t = [0] * N
t[0] = a[0]
for i in range(1, N):
  t[i] = t[i - 1] + a[i]
result = float('inf')
for i in range(0, N - 1):
  result = min(result, abs(t[i] - (t[N - 1] - t[i])))
print(result)


Measured memory_bytes: 24832