akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (a, b) = scan!(String, String);
    println!(
        "{}",
        match (&a[..], &b[..]) {
            ("H", "H") => "H",
            ("D", "D") => "H",
            (_, _) => "D",
        }
    );
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <functional>
#include <bitset>
#include <queue>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;

#include <boost/function_output_iterator.hpp>

using namespace std;

int main()
{
    int A,B;
    cin >> A >> B;
    if(A>B)
    {
        cout << (A + max(A-1,B)) << '\n';
    }
    else
    {
        cout << (B + max(A,B-1)) << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn input_tuple() -> (f64, f64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<f64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn main() {
    let (a, b) = input_tuple();
    let a: u64 = a as u64;
    let b: u64 = (b * 100f64).round() as u64;
    println!("{}", a * b / 100);
}


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

const int MOD = 1e+9 + 7;


int main()
{
    int N, X;
    cin >> N >> X;
    vector<int> S(N);
    for( int i = 0; i < N; ++i ) cin >> S[i];


    // 黒板に書かれた数が x のとき、それを変化させるのはS[i]の中で x 以下のもののみ
    sort( S.begin(), S.end() );
    // dp[i][j]: 黒板に書かれた文字が i のとき, S[i] の小さい方から j 文字を使って
    //        j回の操作をj!通り行った場合の数の総和
    long long dp[201][100001] = {};
    for( int i = 0; i <= X; ++i ) dp[0][i] = i;
    for( int i = 0; i < N; ++i ){
        for( int j = 0; j <= X; ++j ){
            // 次の 1 文字を加えた場合、
            dp[i+1][j] = ( i*dp[i][j] + dp[i][j%S[i]] ) % MOD;
        }
    }
    cout << dp[N][X] << endl;

    return 0;
}

Measured memory_bytes: 157312
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD (long long)(1e9+7)
int main(){
	ll n,m;
	cin>>n>>m;
	vector<ll>a(m,0);
	for(int i=0;i<n;i++){
		int k,aa;
		cin>>k;
		for(int j=0;j<k;j++){
			cin>>aa;
			a[aa-1]++;
		}
	}
	ll ans=0;
	for(int i=0;i<m;i++){
		if(a[i]==n)ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#! env/bin/local python3
# -*- coding:utf-8 -*-

# -- submit ----

# --- fetch input ---
inputs: list = []
while True:
    try:
        inputs.append(input().strip('\n'))
    except EOFError:
        break

# --- write code below ---

a, b, c, d = [int(i) for i in inputs[0].split(' ')]

takahashi = {
    'attack': b,
    'hp': a
}
aoki = {
    'attack': d,
    'hp': c
}


def battle(direction=True):

    if direction:
        aoki['hp'] -= takahashi['attack']
    else:
        takahashi['hp'] -= aoki['attack']

    if aoki['hp'] <= 0:
        print('Yes')
        return None
    if takahashi['hp'] <= 0:
        print('No')
        return None

    if direction:
        battle(direction=False)
    else:
        battle(direction=True)


battle(direction=True)



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

using namespace std;
typedef long long ll;
ll xs, ys;
ll xt, yt;
double const err = 1e-9;

double cost[1005][1005];

struct Node {
    ll x;
    ll y;
    ll r;
} nodes[1005];

int n;
double d[1005];
int used[1005];

double dij(int s) {
    memset(used, 0, sizeof(used));
    fill(d, d + n + 1, 1e9 * 5);
    d[s] = 0;

    while(true) {
        int v = -1;
        for(int u = 0; u <= n; u++) {
            if(!used[u] && (v == -1 || d[u] < d[v])) v = u;
        }

        if(v == -1) break;

        used[v] = true;

        for(int u = 0; u <= n; u++) {
            d[u] = min(d[u], d[v] + cost[v][u]);
        }
    }
}

int main() {
    scanf("%lld%lld%lld%lld", &xs, &ys, &xt, &yt);
    scanf("%d", &n);

    nodes[0].x = xs;
    nodes[0].y = ys;
    nodes[0].r = 0;

    for(int i = 1; i <= n; i++) {
        scanf("%lld%lld%lld", &nodes[i].x, &nodes[i].y, &nodes[i].r);
    }

    n++;
    nodes[n].x = xt;
    nodes[n].y = yt;
    nodes[n].r = 0;

    for(int i = 0; i <= n; i++) {
        for(int j = i; j <= n; j++) {
            cost[i][j] = sqrt((nodes[i].x - nodes[j].x) * (nodes[i].x - nodes[j].x) +
                           (nodes[i].y - nodes[j].y) * (nodes[i].y - nodes[j].y)) - nodes[j].r - nodes[i].r;
            if(cost[i][j] < err) cost[i][j] = 0;
            cost[j][i] = cost[i][j];
        }
    }

    dij(0);

    printf("%.12f", d[n]);

    return 0;
}


Measured memory_bytes: 8192
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

map<int, int> mp;

void addMp(int tmp) {
  auto itr = mp.find(tmp);
  if (itr != mp.end()) mp[tmp]++;
  else mp[tmp] = 1;
}

int main() {
  int n, a;
  cin >> n >> a;
  P(n * n - a);
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
import numpy as np

N, K, Q = map(int, input().split())
A_list = np.full(N, K)
A_ans = np.zeros(N)
for i in range(Q):
    a = int(input()) - 1
    A_ans[a] += 1
A_list = A_list - Q + A_ans

#print(A_list)

for i in range(N):
    if A_list[i] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 21408
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define ld long double
#define FAST ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define ins insert
#define ph push
#define mmst(x,v) memset(x,v,sizeof(x))
#define all(x) (x).begin(), (x).end()
#define LLINF ((long long)1e18)
#define MAXN 300006
#define FOR(i,s,e) for(ll i=s;i<e;i++)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
ll n,arr[MAXN],sum[MAXN],ans=LLINF;
ll A,B,C,D,L,R;
void getans() {
	ans=min(ans,max({A,B,C,D})-min({A,B,C,D}));
}

int main()
{
	FAST
	cin>>n;
	for(ll i=1;i<=n;++i)cin>>arr[i];
	for(ll i=1;i<=n;++i)sum[i]=sum[i-1]+arr[i];
	ll opt_pos = 0, diff = LLINF; A=arr[1],B=arr[2];
	for(ll i=3;i<=n;++i) {
		if(diff > llabs((sum[n]-sum[i])-(sum[i]-sum[2]))) diff = llabs((sum[n]-sum[i])-(sum[i]-sum[2])), opt_pos = i;
	}
	C=sum[opt_pos]-sum[2];
	D=sum[n]-sum[opt_pos];
	getans();
	L=1,R=opt_pos;
	for(ll mid = 3; mid <= n-2; mid ++) {
		B+=arr[mid]; C-=arr[mid];
		while(L+1 < mid) {
			if(llabs(A-B) >= llabs(sum[L+1]-(sum[mid]-sum[L+1]))) {
				++L; A += arr[L]; B -= arr[L];
			}
			else break;
		}
		while(R+1 < n) {
			if(llabs(C-D) >= llabs((sum[R+1]-sum[mid])-(sum[n]-sum[R+1]))) {
				++R; C += arr[R]; D -= arr[R];
			}
			else break;
		}
		getans();
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 3840
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>

using namespace std;

bool func(const pair<long long, long long> &a, const pair<long long, long long> &b)
{
	return atan2(a.second, a.first) < atan2(b.second, b.first);
}

int main()
{
	int n;
	pair<long long, long long> coord[100];
	double len, lmax = 0.0, cand;
	int i, j, k, pj, pk;
	long long x, y;
	long long nx, ny;

	scanf("%d", &n);

	for (i = 0; i < n; i++)
	{
		scanf("%lld %lld", &x, &y);

		coord[i] = make_pair(x, y);
	}

	if (n == 1)
	{
		printf("%.12lf\n", sqrt(coord[0].first*coord[0].first + coord[0].second * coord[0].second));

		return 0;
	}

	sort(&coord[0], &coord[n], func);

	for (i = 0; i < n; i++)
	{
		len = coord[i].first*coord[i].first + coord[i].second * coord[i].second;
		x = coord[i].first;
		y = coord[i].second;

		if (len > lmax)
		{
			lmax = len;
		}

		j = (i - 1 + n) % n;
		k = (i + 1) % n;

		pj = j;
		pk = k;

		while (1)
		{
			if (j == i)
			{
				break;
			}

			nx = coord[j].first;
			ny = coord[j].second;

			cand = (x + nx)*(x + nx) + (y + ny)*(y + ny);

			if (cand >= lmax)
			{
				lmax = cand;
			}

			if (cand >= len)
			{
				len = cand;

				x = x + nx;
				y = y + ny;

				if (j == k)
				{
					break;
				}

				j = (j - 1 + n) % n;

			}

			nx = coord[k].first;
			ny = coord[k].second;

			cand = (x + nx)*(x + nx) + (y + ny)*(y + ny);

			if (cand >= lmax)
			{
				lmax = cand;
			}

			if (cand >= len)
			{
				len = cand;

				x = x + nx;
				y = y + ny;

				if (j == k)
				{
					break;
				}

				k = (k + 1) % n;
			}

			if (j == pj&&k == pk)
			{
				break;
			}

			pj = j;
			pk = k;
		}
	}

	printf("%.12lf\n", sqrt(lmax));

	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	
	int n = read.to!int;
	int[] ps;
	foreach(i; 0 .. n) ps ~= read.to!int - 1;
	
	debug writeln("ps:", ps);
	
	bool[] xs = new bool[](n); // xs[i]: number i has already appeard
	bool[] ys = new bool[](n); // ys[i]: number (i + 1) appears later than number i in ps
	foreach(p; ps){
		xs[p] = 1;
		ys[p] = (p < n - 1 && !xs[p + 1]);
		}
	
	debug writeln("xs:", xs);
	debug writeln("ys:", ys);
	
	int ans = 0;
	int temp = 0;
	foreach(y; ys){
		temp += 1;
		if(y == 0){
			if(temp > ans) ans = temp;
			temp = 0;
			}
		debug writeln("y:", y, " ans:", ans, " temp:", temp);
		}
	if(temp > ans) ans = temp;
	
	(n - ans).writeln;
	}

Measured memory_bytes: 4476
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<LP> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;


void solve() {
	int r; cin >> r;
	cout << 3 * r*r << endl;
}

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

	//cout << fixed << setprecision(10);
	//init();
	solve();
	//stop
		return 0;
}



Measured memory_bytes: 384
n, m ,c = map(int, input().split())
b = list(map(int, input().split()))
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))

cnt = 0
for i in range(n):
    _sum = c
    for _b, _a in zip(b, a[i]):
        _sum += _b * _a
    if _sum > 0:
        cnt += 1

print(cnt)


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  vector<int> v(n), c(n);
  rep(i, n) cin >> v[i];
  rep(i, n) cin >> c[i];
  int ans = numeric_limits<int>::min();
  rep(s, 1 << n) {
    int x = 0, y = 0;
    rep(i, n) if ((s >> i) & 1) {
      x += v[i];
      y += c[i];
    }
    ans = max(ans, x - y);
  }
  out(ans);
}


Measured memory_bytes: 3572
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		long k = Long.parseLong(sa[1]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		sa = br.readLine().split(" ");
		int[] f = new int[n];
		for (int i = 0; i < f.length; i++) {
			f[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		Arrays.parallelSort(a);
		Arrays.parallelSort(f);

		long start = -1;
		long end = 1000000000000L;

		while (Math.abs(end - start) > 1) {
			long mid = (end + start) / 2;
			if (judge(a, f, mid, k)) {
				end = mid;
			} else {
				start = mid;
			}
		}
		System.out.println(end);
	}

	static boolean judge(int[] a, int[] f, long val, long k) {
		long t = 0;
		for (int i = 0; i < a.length; i++) {
			long v = val / f[i];
			t += Math.max(a[a.length - 1 - i] - v, 0);
		}
		return t <= k;
	}
}


Measured memory_bytes: 61356
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,p,i=1,ans=0;
int main(void){
    cin>>n>>p;
    if(n==1){
        cout<<p<<endl;
        return 0;
    }
    if(n>40){
        cout<<1<<endl;
        return 0;
    }
    while(p>=(ll)pow(i,n)){
        if(p%(ll)pow(i,n)==0){
            ans=i;
        }
        i++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const int NM = 101001;//ここを問題の制約を見ながらいじる．配列の確保に使う．
//int A[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．

// Main program

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

void solve(){
  ll X;
  cin >> X ;

  ll out=X; 
  while(1){
    if(IsPrime(out)){
      break;
    }
    out++;
  }
  cout << out;

  return;

}

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





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

namespace ABC0613
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();
            int ans = 0;
            for(int i=0;i<s.Length;i++)
            {
                if (s.Substring(i, 1) != t.Substring(i, 1)) ans++;
            }
            Console.WriteLine(ans);
        }
    }
}


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}




void _main() {
        int n; cin >> n;
        string a; cin >> a;
        int ans = 0;
        for (int i = 0; i < sz(a); i++) {
                string u = a.substr(0, i + 1);
                string v = a.substr(i + 1);
                assert(sz(u) + sz(v) == sz(a));
                sort(all(u)), sort(all(v));
                int cnt = 0;
                for (char c = 'a'; c <= 'z'; c++) {
                        if (binary_search(all(u), c) && binary_search(all(v), c)) cnt++;
                }

                ans = max(ans, cnt);
        }

        cout << ans;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3616
abcd = str(input())
n = 3
for bits in range(1 << n):
    x1 = '+'
    x2 = '+'
    x3 = '+'
    for i in range(n):
        if (bits >> i & 1) == 1:
            if i == 0:
                x1 = '-'
            if i == 1:
                x2 = '-'
            if i == 2:
                x3 = '-'
    check1 = abcd[0] + x1 + abcd[1] + x2 + abcd[2] + x3 + abcd[3]
    check2 = eval(abcd[0] + x1 + abcd[1] + x2 + abcd[2] + x3 + abcd[3])
    if check2 == 7:
        ans = check1
print(ans+'=7')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second
int ans;
int a[100],n;
void dfs(int x,int p){
  if(p==n){
    if(x%2==0)ans++;
  }
  else{
    dfs((a[p]-1)*x,p+1);
    dfs(a[p]*x,p+1);
    dfs((a[p]+1)*x,p+1);
  }
}
main(){
  cin>>n;
  r(i,n)cin>>a[i];
  dfs(1,0);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] v = new int[n];
        for (int i = 0; i < n; i++) v[i] = sc.nextInt();
        int[] c = new int[n];
        for (int i = 0; i < n; i++) c[i] = sc.nextInt();

        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (v[i] > c[i])
                ans += v[i] - c[i];
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 22868
import copy
n,m=map(int,input().split())
ab=[]
for i in range(m):
    ab.append(list(map(int,input().split())))

ans=0
def dfs(start,finish):
    global ans
   # print(finish)
    if len(finish)==n:#全部回ってたら終了
        ans+=1
    else:
        for i in adlist[start-1]:
            if i not in finish:#通ったところに入っていないなら通れるということ   
                #print(i)
                #print(adlist)
                #print(finish,1)
                finish_1 = set([i]) | finish
                #print(finish_1,2)
                dfs(i,finish_1)#finish=だと繰り返しの時に更新されるのでダメ copyもダメ　addが使えない　和集合出ないとfinishが更新されてしまう
#finishを一回ごとに変えないといけない
adlist=[]
for h in range(n):    
    adlist.append([])
for j in range(m):
    x=ab[j][0]
    y=ab[j][1]
    adlist[x-1].append(y)
    adlist[y-1].append(x)
finish=set()
finish.add(1)
#print(adlist)
dfs(1,finish)#引数がけすノード
print(ans)

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

using namespace std;

struct element {
  int node;
  int step;
};

deque<element> que;
vector<int> edges[100001 + 1];
int n, m, s, t;
bool done[100001][3];

void extend(int node, int step) {
  vector<int> next_nodes = edges[node];
  int next_nstep = step + 1;

  for (unsigned int i = 0; i < next_nodes.size(); i++) {
    int n = next_nodes[i];
    if (done[n][next_nstep % 3]) {
      continue;
    }
    done[n][next_nstep % 3] = true;
    que.push_back(element{n, next_nstep});
  }
  return;
};

int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    (edges[t1]).push_back(t2);
  }
  cin >> s >> t;

  done[s][0] = true;
  que.push_back(element{s, 0});

  while (!que.empty()) {
    element target = que.front();
    que.pop_front();

    if (target.step % 3 == 0 && target.node == t) {
      cout << target.step / 3 << endl;
      return 0;
    }

    extend(target.node, target.step);
  }

  cout << -1 << endl;

  return 0;
}

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

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a); i >= (b); i--)
#define ALL(container) (container).begin(), (container).end()

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  vector<int> W(N);
  int sum = 0;
  REP(i, 0, N) {
    cin >> W[i];
    sum += W[i];
  }
  int half = sum / 2;
  int partial = W[0];
  int pre = W[0];
  int minDiff = abs(sum-pre-pre);
  REP(i, 1, N) {
    partial += W[i];
    if (abs(half-partial) > abs(half-pre)) {
      minDiff = abs(sum-pre-pre);
      break;
    }
    pre = partial;
  }
  cout << minDiff << endl;

  return 0;
}


Measured memory_bytes: 256
import numpy as np
N, K = map(int, input().split())
P = list(map(int, input().split()))

kitai = [None]*(1001)
for i in range(1, 1001):
    kitai[i] = (0.5*i*(i+1))/i

ruiseki = P.copy()
ruiseki[K-1] = sum(ruiseki[0:K])
for i in range(K, N):
    ruiseki[i] = ruiseki[i-1]+P[i]-P[i-K]

ind = np.array(ruiseki).argmax()
temp = P[ind-K+1:ind+1]
ans = 0
for t in temp:
    ans+=kitai[t]
print(ans)


Measured memory_bytes: 34012
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF INT_MAX
#define INFLL _I64_MAX
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
int main(void)
{
	string s;

	cin>>s;

	int size=s.size();

	bool flag=false;

	rep(i, size){
		if(s[i]=='9'){
			flag=true;
		}
	}
	if(flag){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define sz(x) int(x.size())
#define input_code ifstream in("input.txt");cin.rdbuf(in.rdbuf())

using namespace std;

int main(int argc, const char * argv[]) {
    
    //  [erase]
    //
    
    int a, b;
    cin >> a >> b;
    int ma = 0;
    ma = max(a+b, max(a-b, a*b));
    cout << ma << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

vector<bool> sieve(int n) {
    vector<bool> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for (ll j = 4; j <= n; j += 2) {
        is_prime[j] = false;
    }
    for (ll i = 3; i <= n; i++) {
        if (is_prime[i]) {
            for (ll j = i*i; j <= n; j += 2*i) {
                is_prime[j] = false;
            }
        }
    }
    return is_prime;
}

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

    int N = 100000;
    vector<bool> is_prime = sieve(N);
    vector<int> cnt(N+1);
    for (int i = 3; i <= N; i++) {
        cnt[i] = cnt[i-1];
        if (i % 2 == 1 && is_prime[i] && is_prime[(i+1)/2]) cnt[i]++;
    }
    int Q;
    cin >> Q;
    REP(i, Q) {
        int l, r;
        cin >> l >> r;
        cout << cnt[r] - cnt[l-1] << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    ll n; cin>> n;
    string ans = "";
    while(n){
        n--;
        ans += (char)('a' + (n % 26));
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout<< ans << endl;
}


Measured memory_bytes: 3620
// AOJ 2875 Mapping
// 2018.4.16 bal4u

#include <stdio.h>

// バッファを経ずstdinから数値を得る
//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int  a[100002], b[100002];
char f[100002];

int main()
{
	int N, i, cnt;

	N = in();
	for (i = 0; i < N; i++) a[i] = in();
	cnt = 0;
	for (i = 0; i < N; i++) {
		b[i] = in();
		if (!f[b[i]]) cnt++, f[b[i]] = 1;
	}
	if (cnt == N) { puts("Yes"); return 0; }

	puts("No");
	putchar('1');
	for (i = 1; i < N; i++) putchar(' '), putchar('1');
	putchar('\n');

	putchar('2'-f[a[0]]);
	for (i = 1; i < N; i++) putchar(' '), putchar('2'-f[a[i]]);
	putchar('\n');
	return 0;
}


Measured memory_bytes: 2528
#include <stdio.h>

int map[32][32];

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

int count = 0;
int serch(int x, int y)
{
    int i;
    if (map[y][x] == '@' || map[y][x] == '.')
    {
        count++;
        map[y][x] = '#';
        for (i = 0; i < 4; i++)
        {
            serch(x + dx[i], y + dy[i]);
        }
    }
    return 0;
}
int main()
{
    int w, h, i, j, x, y;
    char enter;
    while (1)
    {
        scanf("%d %d", &w, &h);
        scanf("%c", &enter);
        if (w == 0 && h == 0) break;
        for (i = 0; i < 32; i++)
            for (j = 0; j < 32; j++)
                map[i][j] = '#';
        count = 0;
        for (i = 1; i <= h; i++)
        {
            for (j = 1; j <= w; j++)
            {
                scanf("%c", &map[i][j]);
                if (map[i][j] == '@')
                {
                    x = j;
                    y = i;
                }
            }
            scanf("%c", &enter);
        }
        serch(x, y);
        printf("%d\n", count);
    }
    return 0;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

int func(int x){
    int ret=0;
    while(x%2==0){
        ret++;
        x/=2;
    }
    return ret;
}

signed main() {

    int n;
    cin>>n;
    int ma=-INF;
    int ans;
    for(int i=1; i<=n; i++){
        if(func(i)>ma){
            ans = i;
            ma = func(i);
        }
    }
    cout <<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  ll n;
  cin >> n;
  ll ans = 0;
  rep(i, n) { ans += (i + 1 + (i + 1) * (n / (i + 1))) * (n / (i + 1)) / 2; }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
import numpy as np
N = int(input())
H = np.array(list(map(int, input().split())))

count = 0

for i in range(N):
    while True:
        if H[i] < 1:
            break
        indx_tmp = i
        for j in range(i, N):
            if H[j] == 0:
                break
            indx_tmp = j
        H[i:indx_tmp+1] -= 1
        count += 1
print(count)

Measured memory_bytes: 13096
#include<stdio.h>
char primes[10000001];
int a;
int main(){
	int i,j,x;
	for(i=2;i<=4000;i++){
		if(primes[i]==1)continue;
		for(j=i*i;j<=10000000;j+=i)primes[j]=1;
	}
	while(scanf("%d",&a),a){
		for(i=a;i>=13;i--){
			if((primes[i]==0&&primes[i-2]==0&&primes[i-6]==0&&primes[i-8]==0)){
				printf("%d\n",i);
				break;
			}
		}
	}
	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  
  if(a < 6){
    cout << '0' << endl;
  }else if(a < 13 && a > 5){
    int c = b/2;
    cout << c << endl;
  }else{
    cout << b << endl;
  }
}

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

int main(void){
int H, W;
    while(true){
    cin >> H >> W;
    if(H == 0 && W == 0) break;
        for ( int i = 0; i < H; i++ ){
            for ( int j = 0; j < W; j++ ){
                cout << "#";
            }
        cout << endl;
        }
    cout << endl;
    }
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	int a, b;
  	cin >> a >> b;
  	rep(i,10101){
      	if(int(i*0.08) == a && int(i*0.1) == b){
        	cout << i << endl;
			return;
        } 
    }
  	cout << -1 << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long long LL;

const int N = 1e5 + 5;


int main() {
#ifdef ANONYM
  freopen("in", "r", stdin);
  freopen("out", "w", stdout);
#endif

  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  cout << n * n * n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
  int n;
  while(cin >> n, n != 0){
    int s[2][n];
    for(int i = 0; i < n ; i++)
    {
      cin >> s[0][i];
    }
    bool fixed = false;
    int src_index = 0;
    int operation_count = 0;
    while(!fixed)
    {
      map<int, int> appearance_map;
      for(int i = 0; i < n ; i ++)
      {
        ++appearance_map[s[src_index][i]];
      }
      fixed = true;
      for(int i = 0; i < n; i++) {
        s[1-src_index][i] = appearance_map[s[src_index][i]];
        if(s[0][i] != s[1][i]){
          fixed = false;
        }
      }
      if(fixed)break;
      src_index = 1 - src_index;
      ++operation_count;
    }
    cout << operation_count << endl;
    for(int i = 0; i < n; i++) {
      cout << s[0][i];
      if(i < n - 1) cout << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 3096
import math

a, b, degC = [ float( i ) for i in raw_input( ).split( " " ) ]
radC = degC*math.pi/ 180.0
h = math.sin( radC ) * b
S = (a*h)/2
x = math.cos( radC ) * b
x -= a
c = math.sqrt(  x**2 + h**2  ) 
L = a + b + c

print( S )
print( L )
print( h )

Measured memory_bytes: 4436
#include "bits/stdc++.h"
using namespace std;
const int maxn = 300300;
long long f(long long x){
    long long ans = 0;
    while(x){
        ans += x%10;
        x /= 10;
    }
    return ans;
}
int main(){
    string t;
    cin >> t;
    long long res = 0;
    long long val = 0;
    for(auto e : t){
        val = val*10 + e - '0';
    }
    res = max(res, f(val));
    t[0]--;
    for(int e = 1; e < t.size(); e++) t[e] = '9';
    val = 0;
    for(auto e : t){
        val = val*10 + e - '0';
    }
    res = max(res, f(val));
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
a,b = map(int,input().split())
if a != 1 and b != 1:
  if a > b :
   	  print("Alice")
  elif a < b:
      print("Bob")
  else:
      print("Draw")
elif a == 1 and b != 1:
      print("Alice")
elif a != 1 and b == 1:
      print("Bob")
else:
      print("Draw")

Measured memory_bytes: 3060
fun main(arg: Array<String>) {
    val N = nextInt()
    val MOD = 1000000007L
    var P = IntArray(N + 1)
    for (i in 2 .. N)
        for (j in i + i .. N step i) P[j] = 1
    var ans = 1L
    for (i in 2 .. N)
        if (P[i] == 0) {
            var total = 1L
            var j = i
            while (j <= N) {
                total += N / j
                j *= i
            }
            ans = ans * total % MOD
        }
    println(ans)
}

fun next() = readLine()!!
fun nextInt(offset: Int = 0) = Integer.parseInt(next()) + offset
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }


Measured memory_bytes: 33660
from sys import stdin, stdout
import math,sys
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
import heapq 
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d

def main():
    try:
        n=I()
        temp=(math.ceil(n/1000)*1000)-n
        print(temp)
    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

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

typedef long long ll;
typedef long double ld;

const int N=5e5+10;

ll a[90];

int main(){
    //freopen("a.txt", "r", stdin);
    //freopen("answers.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    a[0]=2;
    a[1]=1;
    int n;
    cin>>n;
    for(int i=2;i<=n;i++){
        a[i]=1LL*(a[i-1]+a[i-2]);
    }
    cout<<a[n]<<endl;




    return 0;

}

Measured memory_bytes: 256
def main(str)
  lines = str.split("\n").map { |x| x.split(" ").map(&:to_i) }
  n, m, _q = lines[0]
  abcds = lines[1..-1]
  sub(n, m, [], []).map do |as|
    abcds.sum do |a, b, c, d|
      (as[b - 1] - as[a - 1] == c) ? d : 0
    end
  end.max
end

def sub(n, m, cur, ret)
  if cur.length == n
    ret << cur
    return
  end
  ((cur.last || 1)..m).map do |i|
    sub(n, m, cur + [i], ret)
  end
  ret
end

unless ENV["TEST"]
  puts(main($stdin.read.chomp))
  exit(0)
end

require 'minitest/autorun'

class TestA < Minitest::Test
  def test_main
    assert_equal(110, main("3 4 3
1 3 3 100
1 2 2 10
2 3 2 10"))
    assert_equal(357500, main("4 6 10
2 4 1 86568
1 4 0 90629
2 3 0 90310
3 4 1 29211
3 4 3 78537
3 4 2 8580
1 2 1 96263
1 4 2 2156
1 2 0 94325
1 4 3 94328"))
    assert_equal(1, main("10 10 1
1 10 9 1"))
  end
end




Measured memory_bytes: 31732
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#pragma region
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#pragma endregion


int n;
char s[5050];
int dp[5050][5050];
void solve()
{
    cin>>n>>s;
    forn(j, n) forn(i, j) if (s[i] == s[j]) dp[i][j] = 1;

    for (int len = 1; len <= n; len <<= 1)
    {
        forn(j, n) forn(i, j)
        {
            int now = dp[i][j];
            if (now < len) continue;
            if (i+len < n && j+len < n)
                dp[i][j] = now + dp[i+len][j+len];
        }
    }
    int ans = 0;
    forn(j, n) forn(i, j) ans = max(ans,  min(dp[i][j], j-i) );
    cout << ans << '\n';
}


signed main()
{
    int T = 1;
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << fixed << setprecision(22);
    // cin >> T;
    for(int i=1;i<=T;++i)
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 120356
var
	N,A,x,y,i,j,out,ans,nowt,nowf,ccc:Longint;
	F,T,gF,gT:Array[1..15]of Longint;
procedure dfs(id,nt,nf:Longint);
var
cnt,i:Longint;
begin
	if id=N+1 then begin
		cnt:=0;
		for i:=1 to N do if((nt>>(i-1))and 1)=1 then inc(cnt);
		if ans<cnt then ans:=cnt;
	end else begin
		if((((nt or nf)>>(id-1))and 1)=0)and(((nf or gF[id])and(nt or gT[id]))=0)then dfs(id+1,nt or gT[id],nf or gF[id]);
		dfs(id+1,nt,nf);
	end;
end;
begin
	read(N);
	for i:=1 to N do begin
		read(A);
		for j:=1 to A do begin
			read(x,y);
			dec(x);
			if y=0 then F[i]:=F[i] or (1<<x)else T[i]:=T[i] or (1<<x);
		end;
	end;
	for i:=1 to N do begin
		nowt:=1<<(i-1);
		nowf:=0;
		for ccc:=1 to N do begin
			for j:=1 to N do begin
				if ((nowt>>(j-1))and 1)=1 then begin
					nowt:=nowt or T[j];
					nowf:=nowf or F[j];
				end;
			end;
		end;
		gF[i]:=nowf;
		gT[i]:=nowt;
	end;
	dfs(1,0,0);
	writeln(ans);
end.

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

int main() {

	int nums[10000];

	int n;

	long int sum = 0;
	int max = 0, min = 0;

	cin >> n;

	//入力フェーズ
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	//合計値計算
	for (int i = 0; i < n; i++) {
		sum += nums[i];
	}

	//最大値計算
	max = -1000001;
	for (int i = 0; i < n; i++) {
		if (nums[i] > max)
			max = nums[i];
	}

	//最小値計算
	min = 1000001;
	for (int i = 0; i < n; i++) {
		if (nums[i] < min)
			min = nums[i];
	}

	cout << min << " " << max << " " << sum << endl;

	return 0;
}


Measured memory_bytes: 3148
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
// -fsanitize=undefinedでオーバーフロー検出
#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>n;
    //vector<vector<ll>> v(tate,vector<ll> (yoko));
    vector<ll> v(n);
    rep(i,n)   cin >> v[i];
    vector<ll> rui(n);
    sum=accumulate(all(v),(ll)0);
    rui[0]=sum-v[0];
    for(ll i=1;i<n;i++){
        rui[i]=rui[i-1]-v[i];
        
    }
    /*
    rep(i,n){
        cout<<v[i]<<" ";
        
    }ln;    rep(i,n){
        cout<<rui[i]<<" ";
    }*/
    sum=0;
        rep(i,n-1){
        rui[i]%=mod;

        sum+=v[i]*rui[i];
        sum%=mod;
    }
    cout<<sum<<endl;


    return 0;
}


Measured memory_bytes: 6352
'''
????????£????????????1??????????????????
??\???C++??§????????????????§£?±???????????????????????????????????????§???
??????python??§??????????????????Accept??§??????????????????
????????£??¨optimization??????????????§??????
??§????????????Wrong Answer??§?????????
???????????????????????????????????????????????????
Online Judge???????????????Public Solutions??§????????????nanae?????????python3????????????????????????
????????£??¨?????????????????????
???????????????????????????0.06?§????????????§??????
'''

import queue
v,e,s=map(int,input().split())
edge=[]
inf =1000000100
for i in range(v):
    edge.append([])

for i in range(e):
    vs,vt,d=map(int,input().split())
    edge[vs].append((vt,d))
    
dis=[]
for i in range(v):
    dis.append(inf)

dis[s]=0

q = queue.PriorityQueue()
q.put((0,s))

'''
while(not q.empty()):
    now=q.get()
    nowv=now[1]
    for (vt,d) in edge[nowv]:
        if dis[vt]>dis[nowv]+d:
            dis[vt]=dis[nowv]+d
            q.put((dis[vt],vt))
'''

finished=0
while(finished<v and not q.empty()):
    now=q.get()
    nowv=now[1]
    if now[0]>dis[nowv]: continue
    for (vt,d) in edge[nowv]:
        if dis[vt]>dis[nowv]+d:
            dis[vt]=dis[nowv]+d
            q.put((dis[vt],vt))
    finished+=1       

for i in range(v):
    if dis[i]>=inf:
        print("INF")
    else:
        print(dis[i])

Measured memory_bytes: 90452
n=int(input())
if n<=111:
    print("111")
elif 112<=n<=222:
    print("222")
elif 223<=n<=333:
    print("333")
elif 334<=n<=444:
    print("444")
elif 445<=n<=555:
    print("555")
elif 556<=n<=666:
    print("666")
elif 667<=n<=777:
    print("777")
elif 778<=n<=888:
    print("888")
else:
    print("999")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  string s;
  cin >> s;
  bool ok = true;
  if(s[2]!=s[3])ok = false;
  if(s[4]!=s[5])ok = false;
  if(ok)cout << "Yes" << endl;
  else cout << "No" <<endl;
}






Measured memory_bytes: 256