akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.C
{
    public class Program
    {
        public static long H { get; private set; }
        public static long W { get; private set; }
        public static long K { get; private set; }

        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            (H, W, K) = Read3Longs();
            var c_isBlack = new bool[H, W];
            for (int i = 0; i < H; i++)
            {
                var t = ReadText();
                for (int j = 0; j < W; j++)
                {
                    c_isBlack[i, j] = t[j] == '#';
                }
            }

            var count = 0L;
            var maxH = Math.Pow(2, H); // 最大値の指定
            var maxW = Math.Pow(2, W); // 最大値の指定
            for (var i = 0; i < maxH; i++)
            {
                var bitH = Convert.ToString(i, 2).PadLeft((int)H, '0');
                for (int j = 0; j < maxW; j++)
                {
                    var bitW = Convert.ToString(j, 2).PadLeft((int)W, '0');
                    if (GetBlackCount(c_isBlack, bitH, bitW) == K)
                    {
                        count++;
                    }
                }
            }

            return count;
        }

        private static long GetBlackCount(bool[,] c_isBlack, string bitH, string bitW)
        {
            var count = 0L;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (bitH[i] == '1' || bitW[j] == '1') continue;
                    if (c_isBlack[i, j]) count++;
                }
            }

            return count;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28788
N = int(input())
L = []
for _ in range(2):
    l = list(map(int,input().split()))
    L.append(l)
candidate = []

for i in range(N):
    cand = sum(L[0][:i+1]) + sum(L[1][i:])
    candidate.append(cand)
print(max(candidate))



Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1000000007;
const int INF=1001001001;

int main() {
  int N;
  cin>>N;
  int64_t t=1e18;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  
  for(int i=0;i<N;i++){
    if(A[i]==0){cout<<0<<endl;return 0;}
  }
  int64_t sum=1;
  for(int i=0;i<N;i++){
    if(t%A[i]==0){
      if(sum<=t/A[i]){sum*=A[i];}
      else {cout<<-1<<endl;return 0;}
    }
    else {
      if(sum<t/A[i]){sum*=A[i];}
      else{cout<<-1<<endl;return 0;}
    }
  }
  cout<<sum<<endl;
  return 0;  
}

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

int main(void)
{
    string S, T;
    cin >> S >> T;
    long long ans = 0;
    for (long long i = 0; i < S.size(); i++)
    {
        if (S[i] != T[i])
        {
            ans ++;
        }
    }
    cout << ans << endl;
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  string s;
  cin >> s;

  int ans = 0;
  for (int i = 0; i < 6; ++i) {
    ans += s[i] - '0';
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
def solve():
    import bisect
    A, B, Q = map(int, input().split())
    INF = 10 ** 13
    s = [-INF] + [int(input()) for i in range(A)] + [INF]
    t = [-INF] + [int(input()) for i in range(B)] + [INF]
    for q in range(Q):
        x = int(input())
        b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
        res = INF
        for S in [s[b - 1], s[b]]:
            for T in [t[d - 1], t[d]]:
                d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
                res = min(res, d1, d2)
        print(res)
if __name__ == '__main__':
  	solve()

Measured memory_bytes: 14244
#include <stdio.h>

int main(void) {
  int fig[100] = {0}, i, ans = 0;
  char rome[100] = {'\0'};

  while (scanf("%s", rome) != EOF) {
    for (i = 0; rome[i] != '\0'; i++) {
      switch (rome[i]) {
      case 'I': fig[i] = 1; break;
      case 'V': fig[i] = 5; break;
      case 'X': fig[i] = 10; break;
      case 'L': fig[i] = 50; break;
      case 'C': fig[i] = 100; break;
      case 'D': fig[i] = 500; break;
      case 'M': fig[i] = 1000; break;
      }
    }
    for (i = 0; fig[i] != 0; i++) {
      if (fig[i] >= fig[i+1])
	ans += fig[i];
      else {
	ans += fig[i+1]-fig[i];
	i++;
      }
    }
    printf("%d\n", ans);
    for (i = 0; i < 100; i++) {
      rome[i] = '\0';
      fig[i] = 0;
    }
    ans = 0;
  }
  return 0;
}

Measured memory_bytes: 540
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	a, b = map(int, input().split(" "))
	
	takasa = []
	takasa.append(0)
	sa = []
	sa.append(0)
	for i in range(1, 1000):
		tmp = takasa[i-1] + i
		takasa.append(tmp)
	
	tmp = b - a
	
	print(takasa[tmp]-b)
	
	
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 13328
N = int(input().rstrip())
l1 = [int(i) for i in input().rstrip().split()]
l2 = sorted(l1)
result = 'YES'
dnum = 0
for i in range(N):
    if l1[i] != l2[i]:
        dnum = dnum + 1

    if dnum > 2:
        result = 'NO'
        break

print(result)


Measured memory_bytes: 9180
/*
h s, d't skp th si tll i's sved
 * ABC141 E
 * ABC145 D
 * ABC147 F
 * ABC174 F
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int n;
cin>>n;
int mx=0;
map<string,int> mp;
string s[n];
for(int i=0;i<n;i++)
{
cin>>s[i];
mp[s[i]]++;
mx=max(mx,mp[s[i]]);
}
vector<string> ans;
for(int i=0;i<n;i++)
{
if(mp[s[i]]==mx)
{
ans.push_back(s[i]);
mp[s[i]]=0;
}
}
sort(ans.begin(),ans.end());
for(int i=0;i<ans.size();i++)
{
cout<<ans[i]<<endl;
}
}



/*
 * ||||


 */

Measured memory_bytes: 33428
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>

using namespace std;

int main()
{
    vector<vector<int>> c;
    int sum = 0;
    int s;
    bool b = true;
    c.resize(4);
    for(int i=1; i<=3; ++i){
        c[i].resize(4);
        cin >> c[i][1] >> c[i][2] >> c[i][3];
    }
    for(int i=1; i<=3; ++i){
        for(int j=1; j<=3; ++j){
            sum += c[i][j];
        }
    }
    if(sum % 3 == 0){
        for(int i=0; i<6; ++i){
            switch(i){
                case 0:
                    s = c[1][1] + c[2][2] + c[3][3];
                    if(3 * s != sum){
                        b = false;
                    }
                    break;
                case 1:
                    s = c[1][2] + c[2][3] + c[3][1];
                    if(3 * s != sum){
                        b = false;
                    }
                    break;
                case 2:
                    s = c[1][3] + c[2][1] + c[3][2];
                    if(3 * s != sum){
                        b = false;
                    }
                    break;
                case 3:
                    s = c[1][1] + c[2][3] + c[3][2];
                    if(3 * s != sum){
                        b = false;
                    }
                    break;
                case 4:
                    s = c[1][2] + c[2][1] + c[3][3];
                    if(3 * s != sum){
                        b = false;
                    }
                    break;
                case 5:
                    s = c[1][3] + c[2][2] + c[3][1];
                    if(3 * s != sum){
                        b = false;
                    }
                    break;
            }
            if(!b){
                break;
            }
        }
        if(b){
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    else {
        cout << "No" << endl;
    }
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

using pii = pair<int,int>;
vector<pii> ary;

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

	int cur = n;

	if(cur % 2 == 1){
		ary.push_back(pii(cur, - 1));
		cur--;
	}

	rep(i, cur / 2) ary.push_back(pii(i + 1, cur - i));

	vector<pii> ans;
	const int all = ary.size();
	rep(i, all) rep(j, i + 1, all){
		for(auto &a: {ary[i].first, ary[i].second}){
			for(auto &b:  {ary[j].first, ary[j].second}){
				if(a == -1 or b == -1) continue;
				ans.push_back(pii(a,b));
			}
		}
	}

	const int m = ans.size();
	cout << m << endl;
	rep(i, m) cout << ans[i].first << " " << ans[i].second << endl;

	vector<int> val(n);
	rep(i, n){
		int total = 0;
		rep(j, m){
			if(ans[j].first == (i + 1)){
				total += ans[j].second;
			}
			if(ans[j].second == (i + 1)){
				total += ans[j].first;
			}
		}
		val[i] = total;
	}

	rep(i, n) assert(val[0] == val[i]);

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    ll x;
    cin >> x;
    ll INF = 1001001001001001001;
    vector<ll> p(10000, 0);
    int mx = 0;
    for(ll a = 1; pow(a, 5) <= INF; a++){
        p[a] = pow(a, 5);
        mx = a;
    }

    for(int i = 0; i <= mx; i++){
        for(int j = 0; j <= mx; j++){
            if(p[j] - p[i] == x){
                cout << j << ' ' << i << endl;
                return 0;
            }else if(p[j] + p[i] == x){
                cout << j << ' ' << -i << endl;
                return 0;
            }
        }
    }
    
}

Measured memory_bytes: 4316
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
vector<int>g[N];
int d[N],ans[N]={0},vis[N]={0};
void bfs(int u)
{
	queue<int>q;
	q.push(u);
	while(!q.empty())
	{
		int a=q.front();
		q.pop();
		for(int b:g[a])
		{
			if(!vis[b])
			{
				if(d[b]>d[a]+1)
				{
					d[b]=d[a]+1;
					ans[b]=a;
				}
				vis[b]=1;
				q.push(b);
			}
		}
	}
}
int main()
{
	int n,m;
	cin>>n>>m;
	fill(d,d+n+1,10000000);
	while(m--)
	{
		int x,y;
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	d[1]=0;
	bfs(1);
	for(int i=2;i<=n;i++)
	{
		if(ans[i]==0)
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	for(int i=2;i<=n;i++)
		cout<<ans[i]<<'\n';
	return 0;
}

Measured memory_bytes: 11268
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define P pair<int,int>
#define enld endl


int main() {
	lint N;
	cin >> N;
	vector<lint>A(N - 1);
	rep(i, N - 1) {
		cin >> A[i];
	}
	sort(A);
	rep(i, N) {
		cout << upper(A, i + 1) - lower(A, i + 1) << endl;
	}
}

Measured memory_bytes: 4840
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = np.array(lr())
A -= np.arange(1, N+1)
A.sort()

def check(i):
    ret = np.abs(A - A[i]).sum()
    return ret

answer = min(check(0), check(-1))
left = 0; right = N-1
l_mid = (left*2 + right) // 3
r_mid = (left + right*2) // 3
while abs(right-left) > 2:
    l_mid = (left*2 + right) // 3
    r_mid = (left + right*2) // 3
    if check(l_mid) < check(r_mid):
        right = r_mid
    else:
        left = l_mid

cand = min(check(l_mid), check(r_mid))
answer = min(answer, cand)
print(answer)


Measured memory_bytes: 34216
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int a = Integer.parseInt(line[0]),
            b = Integer.parseInt(line[1]),
            c = Integer.parseInt(line[2]);
        int max;
        if(a>b && a>c) max=a;
        else if(b>c) max=b;
        else max = c;
        
        if(max*2==a+b+c)System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 8276
# ABC043 B - バイナリハックイージー / Unhappy Hacking (ABC Edit)
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

S = si()
ans = ''
for s in S:
    if s == '0':
        ans += '0'
    elif s == '1':
        ans += '1'
    elif s == 'B':
        n = len(ans)
        if n > 0:
            ans = ans[0:n-1]
print(ans)



Measured memory_bytes: 3060
s=-1e9
(1..gets.to_i).map{a=[];gets.split.map{|i|i=i.to_i;(a.map!{|j|j+i}<<i).dup}}.transpose.each{|l|l.transpose.each{|i|a=[];i.each{|j|m=(a.map!{|k|k+j}<<j).max;s<m&&s=m}}}
p s

Measured memory_bytes: 16400
/*
// Author -> Preeyadarshee Dev
//
// train hard win easy :D
// nik is love
// nik is motivation
//
// do modulo operations very carefully
// try to avoid binary search, use linear search preferrably to make calculations easier
// always make your custom binary search and watch out for overflows
// read the problems carefully
// never rely on floating point calculations
*/
/*
*/
#include <bits/stdc++.h>
#define mp                    make_pair
#define pb                    push_back
#define ll                   long long
#define ss                       second
#define ff                        first
#define fr(i,a,b)   for(ll i=a;i<b;i++)
#define f(i,n)                fr(i,0,n)
#define rf(i,b,a) for(ll i=b-1;i>=a;i--)
#define r(i,n)                rf(i,n,0)
#define inf                   1000000007
#define eps                  0.000000000000001
#define endl                       '\n'
#define sz(a)                int((a).size())
#define all(c)               (c).begin(),(c).end()
#define tr(c,i)              for(typeof(c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)         ((c).find(x) != (c).end())
#define cpresent(c,x)        (find(all(c),x) != (c).end())
#define pi                   pair<int,int>
#define PI                   3.141592653589793238462643383279502884197169399375105820974944592307816406286
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int> ii;
typedef vector< int > vi;
typedef vector< vi > vvi;
int dx[8]={1,-1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};
vector<int> adj[100010],vis(100010,0),dis(100010,0),par(100010,0);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //ifstream fin;
    //ofstream fout;
    //fin.open("input.txt");
    //fout.open("output.txt");
    int n;
    cin>>n;
    vector<int> v(n);
    f(i,n)
    {
        cin>>v[i];
    }
    int cnt=0;
    for(int i=1;i<n-1;i++)
    {
        vector<int> t={v[i-1],v[i],v[i+1]};
        sort(all(t));
        if(t[1]==v[i])
            cnt++;
    }
    cout<<cnt<<endl;
}



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

int main()
{	
	int a,b;
	cin>>a>>b;
	if(a<10 && b<10 && a>=1 && b>=1)
		cout<<a*b<<endl;
	else cout<<-1<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

int dp[2][5010];

signed main() {
	int N, L; cin >> N >> L;
	vector<int> x(N); rep(i, 0, N) { cin >> x[i]; }
	vector<int> a(N); rep(i, 0, N) { cin >> a[i]; }

	fill(dp[0], dp[0] + L, 1);
	rep(i, 0, N) {
		int curr = i & 1, next = !curr;
		for (int j = x[i]; j < L; j += a[i]) {
			if (j > 0) 
				dp[next][j] += dp[curr][j - 1];
			else 
				dp[next][j] = dp[curr][j];
			dp[next][j] %= MOD;
			if (a[i] == 0) break;
		}
		rep(j, x[i], L) {
			dp[next][j + 1] += dp[next][j];
			dp[next][j + 1] %= MOD;
		}
		fill(dp[curr], dp[curr] + L, 0);
	}
	cout << dp[N & 1][L - 1] << endl;
	return 0;
}

Measured memory_bytes: 3176
import java.util.Scanner;

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

        long gcd = gcd(a, b);
        System.out.println((long) a * b / gcd);
    }

    private static long gcd(long i, long j) {
        if (j == 0) {
            // recursive divide complete
            return i;
        }
        if (i % j == 0) {
            return j;
        } else {
            return gcd(j, i % j);
        }
    }
}


Measured memory_bytes: 21844
#!/usr/bin/perl
use strict;
use warnings;

sub main {
    my $x = <>;
    my $ns = <>;
    my @n = split(/ /, $ns);

    my $max = 0;
    my $t = 0;
    for my $i(@n) {
        $t += $i;
        if($max < $i){
            $max = $i;
        }
    }
    $t -= $max;
    if($max >= $t){
        print "No\n";
    } else {
        print "Yes\n";
    }
}

&main();

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

int main()
{
    int N, K;
    std::cin >> N >> K;
    std::string S;
    std::cin >> S;

    for (int i = 0; i < N; i++) {
        char c = S[i];
        if (i+1 == K) {
            if (c == 'A') S[i] = 'a';
            else if (c == 'B') S[i] = 'b';
            else if (c == 'C') S[i] = 'c';    
        }
    }

    std::cout << S << std::endl;

    return 0;
}

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

int main(void) {

	// TODO: submit前にprintf-debugの削除確認！
	int N;
	//long long N, M;
	//double d, e;
	string A, B, C;
	//vector<int> v;
	//vector<pair<int, int>> pl;

	//while() {}
	//for(int i=0; i<N; i++) {}
	
	cin >> N;
	cin >> A;
	cin >> B;
	cin >> C;

	int ans = 0;
	for(int i=0; i<N; i++) {
		if(A[i] == B[i] && A[i] == C[i])
			continue;
		if(A[i] == B[i] || A[i] == C[i] || B[i] == C[i])
			ans++;
		else
			ans += 2;
	}
	cout << ans;
	// cout << "[deb: val ]" << val <<endl;
	return 0;
}



Measured memory_bytes: 256
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            var result = new int[N];
            for (int i = 0; i < N; i++)
            {
                result[A[i] - 1] = i + 1;
            }
            Console.WriteLine(string.Join(" ", result));
        }
    }
}


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

int main(void)
{
  double a,b,c, S,L,H, pi=3.141592653589293;

  cin >> a >> b >> c;
  S = a*b*sin(c/180*pi)/2;
  L = a + b + sqrt(a*a+b*b-2*a*b*cos(c/180*pi));
  H = 2*S/a;
  cout << fixed << setprecision(6) << S << endl;
  cout << fixed << setprecision(6) << L << endl;
  cout << fixed << setprecision(6) << H << endl;
   
  return 0;
}

Measured memory_bytes: 3508
#include<iostream>
#include<algorithm>
#include<string>
#include<cctype>

using namespace std;

int K;
int ans = 0;
int cnt;
int cnt2;

int main() {

	cin >> K;
	for (int i = 1; i <= K; i++) {
		if (i % 2 == 0) {
			cnt++;
		}
		else {
			cnt2++;
		}
	}
	ans = cnt * cnt2;
	cout << ans << endl;

	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

#define int long long
signed main(){
//int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> cnt(n+1,1);

    int ans=0;
    for(int i = 1; i <= n; i++) {
        int j=n/i;
        ans+=(j+1)*j*i/2;
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 81320
# -*- coding: utf-8 -*-


def main():
    n, a, b = map(int, input().split())
    value_max = 2 * (10 ** 5)
    com = [0 for _ in range(value_max + 1)]
    com[1] = n
    mod = 10 ** 9 + 7
    mod_inverse = [pow(i, mod - 2, mod) for i in range(1, value_max + 1)]
    ans = pow(2, n, mod)

    # KeyInsight:
    # 全体 - 条件を満たす場合
    # modの世界では割り算の代わりに逆元を使う
    # See:
    # https://www.youtube.com/watch?v=lzAMKPMLdtU&feature=youtu.be
    for i in range(2, min(n, value_max) + 1):
        if (n - i + 1) == 0:
            break

        com[i] = com[i - 1] * (n - i + 1)
        com[i] *= mod_inverse[i - 1]
        com[i] %= mod

    diff = (com[a] + com[b] + 1) % mod
    print((ans - diff) % mod)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18976
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//  freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
  int n, m; cin >> n >> m;
  vector<vector<int> > a(n+1, vector<int> (m+1));
  for (int i = 1; i <= n; ++i)
  for (int j = 1; j <= m; ++j) cin >> a[i][j];

  int ans = 0;
  for (int i = 1; i <= n; ++i)
  for (int op = i + 1; op <= n; ++op) {
    int t = 0;
    for (int j = 1; j <= m; ++j)
      t = t + (a[i][j] - a[op][j]) * (a[i][j] - a[op][j]);

    int st = sqrt(t);
    if (st * st == t) ++ans;
  }
  cout << ans;
  return 0;
}



Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 1147483600;
const ll infl = 1e18 + 5;
const char ENDL = '\n';
//cout << fixed << setprecision(17) << res << endl;
int n, q;
vii edges[200005];
int prt[200005];
ll ans[200005];
ll weight[200005];
void dfs(int now){
    ans[now] += weight[now];
    for (auto nex:edges[now]){
        if (nex==prt[now])
            continue;
        prt[nex] = now;
        ans[nex] += ans[now];
        dfs(nex);
        
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> q;
    rep(i,n-1){
        prt[i] = -1;
        weight[i] = 0;
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        edges[u].eb(v);
        ans[i] = 0;
    }
    ans[n - 1] = weight[n - 1] = 0;
    prt[n - 1] = -1;
    rep(xx,q){
        int p, x;
        cin >> p >> x;
        p--;
        weight[p] += x;
    }
    dfs(0);
    rep(i, n) cout << ans[i] << " ";
    cout << ENDL;
}


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

    char a;
    cin >> a;

    //*
    if(a == 'a' || a == 'i' || a == 'u' || a == 'e' || a == 'o' ){
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
    //*/
    
    //cout << a.at(0) << b.at(0) << c.at(0) << endl;

    return 0; 
}


Measured memory_bytes: 3592
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
  int N;
  int out;
  cin >> N;
  if(N%10 == 9 || N >= 90 ) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

const ll INF = 1LL << 50;

void dfs(vvll& to, vector<bool>& rblFrom1, ll v) {
  if (rblFrom1[v]) return;
  rblFrom1[v] = true;
  for (auto u : to[v]) {
    dfs(to, rblFrom1, u);
  }
}

void rdfs(vvll& ot, vector<bool>& rblToN, ll v) {
  if (rblToN[v]) return;
  rblToN[v] = true;
  for (auto u : ot[v]) {
    rdfs(ot, rblToN, u);
  }
}

int main() {
  ll n, m, p;
  cin >> n >> m >> p;

  vector<bool> rblFrom1(n, false);
  vector<bool> rblToN(n, false);
  vvll to(n);
  vvll ot(n);

  vT eds(m);
  rep(i, m) {
    ll a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    c = -c + p;
    eds[i] = T(a, b, c);
    to[a].push_back(b);
    ot[b].push_back(a);
  }

  dfs(to, rblFrom1, 0);
  rdfs(ot, rblToN, n - 1);

  vector<bool> ok(n);
  rep(i, n) ok[i] = rblFrom1[i] && rblToN[i];

  vll d(n, INF);
  d[0] = 0;
  bool upd = true;
  ll step = 0;
  while (upd) {
    upd = false;
    for (auto e : eds) {
      ll a, b, c;
      tie(a, b, c) = e;
      if (!ok[a]) continue;
      if (!ok[b]) continue;
      ll newD = d[a] + c;
      if (newD < d[b]) {
        d[b] = newD;
        upd = true;
      }
    }
    step++;
    if (step > n) {
      puts("-1");
      return 0;
    }
  }

  ll ans = -d[n - 1];
  chmax(ans, 0LL);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 768
import java.util.*;

public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		long n = sc.nextLong();
		long ret = Long.MAX_VALUE;
		for (int i = 1;i <= Math.sqrt(n);i++) {
			if (n%i==0) {
				int l1 = String.valueOf(i).length();
				int l2 = String.valueOf(n/i).length();
				ret = Math.min(ret, Math.max(l1, l2));
			}
		}
		System.out.println(ret);
	}
}

Measured memory_bytes: 23892
# dfs
import collections,sys
sys.setrecursionlimit(10**9)
n,m,k = map(int, input().split())

friend = [[]*(n+1) for _ in range(n+1)]
block = [[]*(n+1) for _ in range(n+1)]
teams = [0]*(n+1)
for _ in range(m):
  a,b = map(int, input().split())
  friend[a].append(b)
  friend[b].append(a)
for _ in range(k):
  c,d = map(int, input().split())
  block[c].append(d)
  block[d].append(c)
  
def dfs(i):
  teams[i] = team
  for j in friend[i]:
    if teams[j] != 0:
      continue
    dfs(j)

team=1
for i in range(1,n+1):
  if teams[i] != 0:
    continue
  dfs(i)
  team+=1

c = collections.Counter(teams)

for i in range(1,n+1):
  temp = c[teams[i]]-len(friend[i])-1
  for j in block[i]:
    if teams[j] == teams[i]:
      temp -= 1
  print(temp, end='')
  if i != n:
    print(" ", end='')

Measured memory_bytes: 64816
#include <iostream>
#include <vector>
#include <algorithm>
int main(){
    using namespace std;
    int n,k,a,i,ans;
    ans = 0;
    cin >> n >> k;
    vector<int> v(n, 0);
    for(i=0;i<n;i++){
        cin >> a;
        v[a-1] = v[a-1]+1;
    }
    sort(v.begin(), v.end(), greater<int>());
    for(i=k;i<n;i++){
        ans = ans + v[i];
    }
    cout << ans << endl;
    return 0;
}

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

public class Main {

	static Scanner scanner;

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

        int n=gi();

        //System.out.println("No");
        
        int c=0;
        for (int i=1; i<=n; i+=2) {
			if (yakusuC(i)==8) {
				c++;
			}
		}


        System.out.print(c);
	}
	
	public static int yakusuC(int n) {
		StringBuilder sb = new StringBuilder();
		int c=0;
		for (int i=1; i<=n; i++) {
			if (n%i==0) {
				c++;
			}
		}

		return c;
	}


	public static long d(long n) {
		String a=String.valueOf(n);
		return (long)a.length();
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35768
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CCoins {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int x, y, z; cin >> x >> y >> z;
      int n = x+y+z;
      vector<ll> a(n), b(n), c(n);
      rep(i, n) {
        cin >> a[i] >> b[i] >> c[i];
      }
      vector<P> xy(n);
      rep(i, n) {
        xy[i].first = a[i]-b[i];
        xy[i].second = i;
      }
      sort(xy.rbegin(), xy.rend());

      ll ans = 0;
      set<P> stX, stY;
      set<P> stZL, stZR;
      ll sumX = 0;
      ll sumY = 0;
      ll sumZ = 0;
      for(int i=0; i<x; i++) {
        int idx = xy[i].second;
        stX.emplace(a[idx]-c[idx], idx);
        sumX += a[idx];
      }
      for(int i=x; i<n; i++) {
        int idx = xy[i].second;
        stY.emplace(b[idx]-c[idx], idx);
        sumY += b[idx];
      }
      auto it = stY.begin();
      while(stZR.size() < z) {
        int idx = (*it).second;
        sumY -= b[idx];
        sumZ += c[idx];
        it = stY.erase(it);
        stZR.emplace(c[idx]-b[idx], idx);
      }
      chmax(ans, sumX+sumY+sumZ);

      for(int i=x; i<x+z; i++) {
        int idx = xy[i].second;
        if (stZR.find({c[idx]-b[idx], idx}) != stZR.end()) {
          stZR.erase({c[idx]-b[idx], idx});
          sumZ -= c[idx];
        } else {
          stY.erase({b[idx]-c[idx], idx});
          sumY -= b[idx];
          auto itz = stZR.begin();
          int idxz = (*itz).second;
          itz = stZR.erase(itz);
          stY.emplace(b[idxz]-c[idxz], idxz);
          sumZ -= c[idxz];
          sumY += b[idxz];
        }

        stX.emplace(a[idx]-c[idx], idx);
        sumX += a[idx];
        auto itx = stX.begin();
        int idxx = (*itx).second;
        stX.erase(itx);
        stZL.emplace(c[idxx]-a[idxx], idxx);
        sumZ += c[idxx];
        sumX -= a[idxx];
        debug(stX.size(), stY.size(), stZL.size()+stZR.size());
        debug(sumX, sumY, sumZ);
        chmax(ans, sumX+sumY+sumZ);
      }
      cout << ans << endl;
    }
};

signed main() {
  CCoins solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 13512
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9)
        cout<<"hon"<<endl;
    else if(n%10==0 || n%10==1 || n%10==6 || n%10==8)
        cout<<"pon"<<endl;
    else
        cout<<"bon"<<endl;
}


Measured memory_bytes: 3596
def resolve():
    n,k = map(int,input().split())
    p = tuple(map(int,input().split()))
    s = [(i+1)/2 for i in p]
    a = sum(s[:k])
    ans = a
    for i in range(1,n-k+1):
        a = a - s[i-1] + s[k+i-1]
        ans = max(ans,a)
    print(ans)
resolve()

Measured memory_bytes: 32048
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> S(M);
    for (int i = 0; i < M; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int s;
            cin >> s;
            s--;
            S[i].push_back(s);
        }
    }
    vector<int> p(M);
    for (int i = 0; i < M; i++) {
        cin >> p[i];
    }

    int ans = 0;
    for (int i = 0; i < (1 << N); i++) {
        int n = i;
        vector<bool> on(N, false);
        for (int j = 0; j < N; j++) {
            if (n % 2 == 1) {
                on[j] = true;
            }
            n /= 2;
        }

        bool ok = true;
        for (int m = 0; m < M; m++) {
            int cnt = 0;
            for (int s : S[m]) {
                if (on[s]) {
                    cnt++;
                }
            }
            if (cnt % 2 != p[m]) {
                ok = false;
            }
        }
        if (ok) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
N = gets.to_i
sss = {}
['M', 'A', 'R', 'C', 'H'].each do |k|
  sss[k] = 0
end
N.times do
  s = gets.chomp[0]
  if ['M', 'A', 'R', 'C', 'H'].include?(s)
    sss[s] += 1
  end
end
sss.reject! { |k,v| v == 0 }
ans = 0
sss.values.combination(3).to_a.each do |x|
  ans += x.inject(:*)
end
puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cin(int, m);
    vector<int> d1, d2;
    for(int i = 1; i*i <= m; i ++){
        if(m % i == 0){
            d1.push_back(i);
            d2.push_back(m/i);
        }
    }
    d1.insert(d1.end(), d2.rbegin(), d2.rend());

    while(true){
        ll a = d1.back();
        d1.pop_back();
        if(a*n <= m){
            Cout(a);
            return 0;
        }
    }
}


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

using namespace std;

using int64 = long long;
using vint = vector<int>;

#define FOR(i, a, b) for(int64 i=(a); i<(b); i++)
#define ROF(i, a, b) for (int64 i=(a)-1; i>=(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define PRE(i, n) ROF(i, n, 0)

#define ALL(x) (x).begin(),(x).end()
#define OUT(x) cout << (x) << endl;
#define DUMP(x) cerr << (x) << endl;

#define INF INT_MAX
#define eps 1e-14

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


class node {
public:
    int p;
    int cost;

    node(int t, int c) {
        p = t;
        cost = c;
    }
};

int main() {
    int N, M;
    cin >> N >> M;

    vector<int> E[N + 1];

    REP(i, M) {
        int u, v;
        cin >> u >> v;

        E[u].push_back(v);
    }

    int S, T;

    cin >> S >> T;


    int cost[N + 1][3];

    REP(i, N + 1) REP(j, 3) cost[i][j] = INF;

    queue<node> q;

    q.push(node(S, 0));

    while (!q.empty()) {
        node n = q.front();
        q.pop();

        int p = n.p;
        int c = n.cost;

        REP(i, E[p].size()) {
            int v = E[p][i];
            int nc = c + 1;

            if (cost[v][nc % 3] > nc) {
                cost[v][nc % 3] = nc;
                q.push(node(v, nc));
            }

        }
    }

    if (cost[T][0] < INF) {
        cout << cost[T][0] / 3 << endl;
    } else {
        cout << -1 << endl;
    }


    return 0;
}

Measured memory_bytes: 6912
def solve():
    n,m,x = map(int,input().split())
    a = list(map(int,input().split()))
    l = [1 if i in a else 0 for i in range(n+1)]
    print(min(sum(l[:x+1]),sum(l[x+1:])))
if __name__=='__main__':
    solve()

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

int a[105],b[105];

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++) cin >> a[i];
	for(int j=0;j<n;j++) cin >> b[j];
	for(int i=1;i<n;i++) a[i] += a[i-1];
	for(int i=n-2;i>=0;i--) b[i] += b[i+1];
	int ans = 0;
	for(int i=0;i<n;i++){
		ans = max(ans,a[i]+b[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <fstream>
#include <vector>
#include <utility>
#include <climits>

using namespace std;

struct flood {
	vector <int> heights={0};
	vector <pair<int, int>> areas;
	vector <int> sum;
	int total = 0;
	flood(char oinput[]){
		transform(oinput);
		findAll();
		calAll();
		print();
	}
	void transform(char oinput[]){
		char before = oinput[0];
		int level = 0;
		for (int i = 0; oinput[i] != '\0'; i++) {
//			printHeight();
//			printf(" get char %c\ level = %d \n",oinput[i], level);
			switch (oinput[i]) {
				case '\\':
					if (before == '/') {
						heights.push_back(level);
					}
					level--;
					before = '\\';
					break;
				case '/':
					if (before == '\\') {
						heights.push_back(level);
					}
					level++;
					before = '/';
					break;
				case '_':
					if (before != '_') {
						heights.push_back(level);
					}
					heights.push_back(level);
					before = '_';
					break;
			}
		}
		heights.push_back(level);
	}

	int findNextPoint(int starti){
		int init = heights[starti];
		int max = INT_MIN;
		int index = 0;
		for (int i = starti + 1; i < heights.size(); i++) {
			if (heights[i] >= init) {
				return i;
			}
			if (heights[i] > max) {
				max = heights[i];
				index = i;
			}
		}
		if (index == 0) {
			index = heights.size() - 1;
		}
		return index;
	}

	void findAll() {
		pair <int, int> mark;
		int starti = 0;
		while (starti < heights.size()-1) {
			mark.first = starti;
			starti = findNextPoint(starti);
			mark.second = starti;
			areas.push_back(mark);
//			printf("%d, %d\n", mark.first, mark.second);
		}
	}

	double calArea1(int topLevel, int starti){
		int start = heights[starti];
		int end = heights[starti+1];
		if(start==end){
			return (topLevel-start);
		}
		if(end>start){
			int m=start;start=end;end=m;
		}

		int width = start - end;
		if(topLevel>start){
			return (topLevel - end) * width - width * width / 2.0;
		}else {
			return (topLevel - end) * (topLevel - end) / 2.0;
		}
	}
	double cal1Area(pair <int, int> area) {
		int topLevel=heights[area.first];
		double sum = 0.0;
		if(heights[area.first]>heights[area.second]){topLevel=heights[area.second];}
		for (int i = area.first; i < area.second; i++) {
			sum += calArea1(topLevel, i);
		}
		return sum;
	}
	void calAll() {
		double temp = 0.0;
		for (int i = 0; i < areas.size(); i++) {
			temp = cal1Area(areas[i]);
//			printf("i= %d, area=%f\n",i,temp);
			if (temp > 0) {
				sum.push_back(temp);
				total += temp;
			}
		}

	}

	void print() {
//		printf("[");
//		for (int i = 0; i < heights.size(); i++) {
//			printf(" %d", heights[i]);
//		}
//		printf("]\n");
//
//		printf("[");
//		for (int i = 0; i < areas.size(); i++) {
//			printf("pair: %d %d ", areas[i].first, areas[i].second);
//		}
//		printf("]\n");

		printf("%d\n", total);
		printf("%d", sum.size());
		for (int i = 0; i < sum.size(); i++) {
			printf(" %d", sum[i]);
		}
		printf("\n");
	}
};

int main() {
	char oinput[20000];
	scanf("%[^\n]%*c", oinput);
//	FILE *fp = fopen("myinput.txt", "r");  fscanf(fp, "%[^\n]%*c", oinput);        fclose(fp);

	flood *m = new flood(oinput);
//	m->calculation();

}



Measured memory_bytes: 3140
#include<stdio.h>
int MAX = 2000000;
int main(){
  int i,R[MAX],n;
 
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&R[i]);
 
  int maxv = -2000000000;
  int minv = R[0];
 
  for(i = 1; i < n; i++){
    if(maxv<R[i]-minv) maxv = R[i]-minv;
    if(minv>R[i]) minv = R[i];
  }
  printf("%d\n",maxv);
  return 0;
}



Measured memory_bytes: 2532
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (#x) << " is " << (x) << endl;
#define SPD_emergency ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1000000007;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " "; cout << endl;}
void PA(int v[], int n) { for (int i = 0 ; i < n ; i++)cout << v[i] << " " ; cout << endl;}
void IN(int a[], int n) {for (int i = 0; i < n; i++)cin >> a[i];}



signed  main() {
  SPD_emergency

  //int t; cin >> t; int tt = 1; while (t--)
  {
    int n, m;
    cin >> n >> m;
    int pre[240007] = {0};
    int i, j, k, l, ans = 0;
    for (i = 1; i < 230000; i++) {
      pre[i] = (pre[i] + pre[i - 1]%M + i)%M;
    }
    for (i = m; i <= n + 1; i++) {
      k = pre[i - 1];
      j = max(0ll,n-i);
      l = pre[n] - pre[j];
      ans = (ans % M + (l - k + 1 + M) % M ) % M;
    }
    cout << ans % M << endl;
  }
  return 0;
}

Measured memory_bytes: 5564
#include<stdio.h>
int n,a,i;
int main(void){
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        if(i <= 9||i >= 100&&i<=999||i >= 10000&&i<=99999){
            a += 1;
        }
        //if(i >= 100&&i<=999)
    }
    printf("%d",a);
}

Measured memory_bytes: 128
X = int(input())
y = {pow(i, 5):i for i in range(100000)}

for val in y:
  if (X + val) in y:
    print(y[X + val], y[val])
    exit()
  elif (X - val) in y:
    print(y[X - val], -1 * y[val])
    exit()
  elif -1 * (X + val) in y:
    print(-1 * y[X + val], y[val])
    exit()
  elif -1 * (X - val) in y:
    print(-1 * y[X - val], -1 * y[val])
    exit()

Measured memory_bytes: 23592
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int num,cnt=0,j,a=0;
        for(int i=0;i<n;i++){
            num=sc.nextInt();
            j=2;
            a=0;
            while(j<=Math.sqrt(num)){
                if(num%j==0){
                    a++;
                    break;
                }
                j++;
            }
            if(a==0){
                cnt++;
            }
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 40672