akhauriyash/Code-Regression huggingface dataset:
#pragma region Macros

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

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

    int a = 1;
    const int b = 1000000007;
    REP(i, N) {
        a = (a * (i + 1)) % b;
    }
    cout << a;
}

#pragma region main
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	string S;
	cin >> S;

	sort(S.begin(), S.end());

	if (S[0] == S[1] && S[1] !=S [2] && S[2] == S[3]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 256
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.reverse()
ans = 0
for i in range(n):
    tmp = 0
    Tmp = 0
    tmplist = [a[i]]
    index = i
    for _ in range(n-1):
        index += 1
        index %= n
        tmplist.append(a[index])
    for j in range(1,n):
        if tmplist[j] > a[i]:
            tmp += 1
    for j in range(i,n):
        if a[j] > a[i]:
            Tmp += 1
    ans += Tmp*k + tmp * (k-1)*k//2
    #print(tmplist,Tmp,tmp)
ans = ans % (10**9 + 7 )
print(ans)

Measured memory_bytes: 45708
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
      string[] input1 = Console.ReadLine().Split();
      int a = int.Parse(input1[0]);
      int b = int.Parse(input1[1]);
      List<int> l = Console.ReadLine().Split().ToList().ConvertAll(x => int.Parse(x));
      l=l.OrderBy(x => -x).ToList();
      int ans = 0;
      for (int i=0;i<b;i++)
      {
        ans+=l[i];
      }
      Console.WriteLine(ans);
    }
}


Measured memory_bytes: 28112
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from functools import lru_cache


@lru_cache(maxsize=2*10**5)
def f2(x):
    if x == 0: return 0
    y = bin(x).count("1")
    return 1 + f2(x % y)

def resolve():
    N = int(input())
    W = 16
    S = input()
    cnt0 = S.count("1")

    if cnt0 == 0:
        print(*[1]*N, sep="\n")
        return

    X = int(S, 2)

    dc = {}
    for k, v in (("0", 1), ("1", -1)):
        x = cnt0 + v
        y = X % x if x else 0
        dc[k] = (x, v, y)

    ans = []
    for i, si in enumerate(S):
        cnt, v, n = dc[si]

        if cnt == 0:
            ans.append(0)
            continue

        ni = N - i - 1
        n = (n + v * pow(2, ni, cnt)) % cnt

        ans.append(1+f2(n))

    print(*ans, sep="\n")


if __name__ == "__main__":
    resolve()


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

typedef long long ll;

#define rep(i, n) for(ll i=0; i<n; ++i)

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

int main() {

  ll N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];

  ll ans = 0;
  rep(i, N) ans += A[i]-1;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stdexcept>
#include<cmath>
#include<memory>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<deque>
#include<sstream>
#include<iomanip>
#include<sstream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<climits>
#include<map>
#include<set>
#include<list>
#include<cassert>
#include<deque>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<27
#define all(n) n.begin(),n.end()
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define F first
#define S second
#define pb push_back
#define pf push_front
#define LIM 100000
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
typedef long long ll;
typedef unsigned long long ull;
int N,L;



bool cmp(const P &p,const P &q){
  return p.F >= q.F;
}


int main(){

  while(cin >> N >> L){
   
    int *a = new int[N];
    int *tm = new int[N]; 
    deque<int> perm;
    
    vector<P> pres;
    rep(i,N){
      cin >> a[i];
      tm[i] = -1;
      pres.pb(P(a[i],i));
    }
    sort(all(pres),cmp);
   
    rep(i,N){
      perm.push_back(pres[i].S);
   
    }   
   
    while(!perm.empty()){
      int pos = perm.front(); perm.pop_front();
     
      if(pos == 0 || pos == N-1){
	int Le = pos == 0?a[pos+1]:a[pos-1];
	int lorr = pos==0?pos+1:pos-1; 
	if(Le > a[pos]){	 
	  assert(tm[lorr] != -1);
	  tm[pos] = (L-a[pos])+tm[lorr];
	}
	else if(Le < a[pos]){
	  tm[pos] = (L-a[pos]);
	}
	else assert(false);
      }
      else {
	if(a[pos-1]  < a[pos] && a[pos] > a[pos+1]){
	  tm[pos] = (L-a[pos]); 
	}
	else if(a[pos-1] > a[pos] && a[pos] < a[pos+1]){
	  assert(tm[pos+1] != -1 && tm[pos-1] != -1);
	  tm[pos] = max(tm[pos+1],tm[pos-1]) + (L-a[pos]);
	}
	else{
	  if(a[pos-1] > a[pos]){
	    assert(tm[pos-1] != -1);
	    tm[pos] = (L-a[pos]) + tm[pos-1];
	  }
	  else if(a[pos+1] > a[pos]){
	    assert(tm[pos+1] != -1);
	    tm[pos] = (L-a[pos]) + tm[pos+1];
	  }
	  else assert(false);

	}
      }      
     
    }    

    int mex = 0;
    rep(i,N){
      mex = max(tm[i],mex); 
    
    }
    cout << mex << endl;

    delete [] a;
    delete [] tm;
  }
    
return 0;
}

Measured memory_bytes: 3088
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cctype>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=200005;
int n,vis[N],ans;
struct edge{int v,n;};

int getint()
{
	char ch;
	while(!isdigit(ch=getchar()));
	int x=ch-48;
	while(isdigit(ch=getchar())) x=x*10+ch-48;
	return x;
}

struct tree
{
	int h[N],cnt,dep[N],fa[N],root;
	edge e[N<<1];

	void addedge(int u,int v)
	{
		e[cnt]=(edge){v,h[u]},h[u]=cnt++;
		e[cnt]=(edge){u,h[v]},h[v]=cnt++;
	}
	
	void dfs(int x,int f,int d)
	{
		dep[x]=d,fa[x]=f;
		for(int i=h[x]; i!=-1; i=e[i].n)
			if(e[i].v!=f) dfs(e[i].v,x,d+1);
	}

	void build()
	{
		memset(h,-1,sizeof(h));
		rep(i,1,n-1) addedge(getint(),getint());
		dfs(root,0,0);
	}

	bool query(int x,int y)
	{
		int rt=0;
		while(x!=y)
		{
			if(++rt,dep[x]>dep[y]) x=fa[x];
			else y=fa[y];
			if(rt>2) return 1;
		}
		return 0;
	}
} t1,t2;

void dfs(int x,int fa)
{
	if(t1.dep[x]>=t2.dep[x]) return;
	vis[x]=1;
	for(int i=t1.h[x]; i!=-1; i=t1.e[i].n)
		if(t1.e[i].v!=fa) dfs(t1.e[i].v,x);
}

int main()
{
	n=getint(),t1.root=getint(),t2.root=getint();
	t1.build(),t2.build(),dfs(t1.root,0);
	rep(i,1,n) if(vis[i])
	{
		ans=max(ans,t2.dep[i]);
		for(int j=t1.h[i]; j!=-1; j=t1.e[j].n)
			if(t2.query(i,t1.e[j].v))
				return puts("-1"),0;
	}
	printf("%d\n",ans*2);
	return 0;
}

Measured memory_bytes: 15872
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String s3 = s.substring(2,3);
        String s4 = s.substring(3,4);
        String s5 = s.substring(4,5);
        String s6 = s.substring(5,6);
        if (s3.equals(s4) && s5.equals(s6))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 25172
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
//#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll l,a,b,MOD;

vector<vector<ll>> matpow(vector<vector<ll>> a, ll b){
	vector<vector<ll>> ret;
	rep(i,4){
		ret.push_back(vector<ll>());
		rep(j,4){
			ret[i].push_back(0);
		}
	}
	if(b == 0){
		rep(i,4){
			ret[i][i] = 1;
		}
	}else if(b%2==0){
		vector<vector<ll>> memo = matpow(a, b/2);
		rep(i,4){
			rep(j,4){
				rep(h,4){
					ret[i][j] += memo[i][h] * memo[h][j] % MOD;
					ret[i][j] %= MOD;
				}
				
			}
		}
	}else{
		vector<vector<ll>> memo = matpow(a, b - 1);
		rep(i,4){
			rep(j,4){
				rep(h,4){
					ret[i][j] += a[i][h] * memo[h][j] % MOD;
					ret[i][j] %= MOD;
				}
			}
		}
	}

	return ret;
}

vector<ll> matmulti(vector<vector<ll>> A, vector<ll> b){// A * b
	vector<ll> ret;
	rep(i,4){
		ret.push_back(0);
	}
	rep(i,4){
		rep(h,4){
			ret[i] += A[i][h] * b[h] % MOD;
			ret[i] %= MOD;
		}
	}
	return ret;
}

ll howketa(ll x){
	ll ret = 0;
	ll x_ = a + b*x;
	//cout<<x_<<"hoge"<<endl;
	while(true){
		x_ /= 10;
		ret++;
		if(x_ == 0) break;
	}
	return ret;
}

ll ketabegin(ll keta){
	ll start = -1;
	ll end = l;
	while(end - start >= 2){
		ll aida = (start + end) / 2;
		if(howketa(aida) >= keta){
			end = aida;
		}else{
			start = aida;
		}
	}
	//cout<<end<<endl;
	return end;
}

ll ketaend(ll keta){
	ll start = -1;
	ll end = l;
	while(end-start >= 2){
		ll aida = (start + end) / 2;
		if(howketa(aida) <= keta){
			start = aida;
		}else{
			end = aida;
		}
	}
	//cout<<start<<endl;
	return start;
}

int main(void){
	
	cin>>l>>a>>b>>MOD;
	vector<ll> vec;
	vec.push_back(0);
	vec.push_back(a%MOD);
	vec.push_back(a%MOD);
	vec.push_back(b%MOD);
	vector<vector<ll>> F;
	F.push_back(vector<ll>{1,0,0,1});
	F.push_back(vector<ll>{1,10,1,1});
	F.push_back(vector<ll>{0,0,1,0});
	F.push_back(vector<ll>{0,0,0,1});
	ll start,end;
	bool first = true;
	reps(i,18){
		start = ketabegin(i);
		end = ketaend(i);
		if(howketa(0) > i || howketa(l-1) < i) continue;
		if(first){
			start++;
			first = false;
		}
		//cout<<start<<" "<<end<<" "<<i<<endl;
		F[1][1] = (ll)pow((ll)10, i)%MOD;
		/*rep(i,4){
			rep(j,4){
				cout<<F[i][j]<<" ";
			}
			cout<<endl;
		}
		cout<<endl;*/
		//cout<<F[1][1]<<endl;
		vector<vector<ll>> F2 = matpow(F,end-start+1);
		/*rep(i,4){
			rep(j,4){
				cout<<F2[i][j]<<" ";
			}
			cout<<endl;
		}
		cout<<endl;*/
		vec = matmulti(F2, vec);
		/*cout<<"vec ";
		rep(i,4){
			cout<<vec[i]<<" ";
		}
		cout<<endl;*/
	}
	cout<<vec[1]<<endl;
	return 0;
}


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

int main() {
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; ++i) cin >> a[i];

    int Alice = 0, Bob = 0;
    sort(a, a+N, greater<int>());

    for(int i = 0; i < N; i += 2) Alice += a[i];
    for(int i = 1; i < N; i += 2) Bob += a[i];

    cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        char[] s = sc.next().toCharArray();

        for (int i = 0; i < s.length; i++) {
            s[i] += n;
            if (s[i] > 'Z') {
                s[i] = (char) ('A' + (s[i] - 'Z' - 1));
            }
        }

        System.out.println(String.valueOf(s));
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 23252
N = int(input())

ans = ''
while N != 0:
    if N % 2 == 0:
        ans = '0' + ans
        N //= (-2)
    else:
        ans = '1' + ans
        N = (N-1)//(-2)

if ans == '':
    print(0)
else:
    print(ans)

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



#define pp pair<int,int>
#define oo 100000000
#define RRR ios_base::sync_with_stdio(false);cin.tie(0);
#define ll long long
#define int ll


int ar[200000];
int ar2[200000];
int32_t main()
{
    vector <int> ar;
    int a,b,c;
    cin >> a >> b >> c;
    ar.push_back(a);
    ar.push_back(b);
    ar.push_back(c);
    sort(ar.begin(),ar.end());
    cout << ar[0] + ar[1];
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var nab = Console.ReadLine().Split(' ');
        var n = int.Parse(nab[0]);
        var a = int.Parse(nab[1]);
        var b = int.Parse(nab[2]);

        var ans = 0L;
        for (int i = 1; i <= n; i++)
        {
            var sum =
                i / 10000 +
                i / 1000 % 10 +
                i / 100 % 10 +
                i / 10 % 10 +
                i % 10;

            if (a <= sum && sum <= b)
            {
                ans += i;
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

int N;
pair<Int, Int> V[100050];

int main() {
  N = in();
  for (int i = 0; i < N; ++i) {
    V[i].first = lin();
    V[i].second = lin();
  }
  sort(V, V + N, [] (const pair<Int, Int>& a, const pair<Int, Int>& b) {
    return a.first + a.second > b.first + b.second;
  });

  Int res = 0;
  for (int i = 0; i < N; ++i) {
    if (i % 2 == 0) {
      res += V[i].first;
    } else {
      res -= V[i].second;
    }
  }
  printf("%lld\n", res);
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#define inf 1145141819810364364
 
int main(void){
	long long d[1024],n,m,a[2048],b[2048],c[2048],i,j,f;
	for(i = 0;i < 1024;i++){
		d[i] = -inf;
	}
	d[1] = 0;
	scanf("%lld%lld",&n,&m);
	for(i = 1;i <= m;i++){scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);}
	for(i = 1;i <= n;i++){
		f = 0;
		for(j = 1;j <= m;j++){
			if(d[(b[j])] < d[(a[j])]+c[j]){d[(b[j])] = d[(a[j])]+c[j];if(i >= n){if(b[j] == n){f = 1;}}else{f=1;}}
		}
		if(f==0){break;}
		if(i == n){printf("inf\n");return 0;}
	}
	printf("%lld\n",d[n]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7ll;

int n,k;
long double e[100005];
long double ans;

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>n>>k;

for(int i=1; i<=n; i++){
  if(i<=k-1){
    int t=i;
    int c=0;
    while(t<k){
      t=2*t;
      c++;
    }
    e[i]=1.0/pow(2,c);
  }
  else{
    e[i]=1.0;
  }
}

for(int i=1; i<=n; i++){
  ans+=e[i];
}

ans*=(1.0/n);

cout<<fixed<<setprecision(20)<<ans<<endl;

}



Measured memory_bytes: 1792
n = int(input())
a = input().split()
if n==1:
    print(a[0])
elif n%2==0:
    tmp=a[1::2][::-1] + a[0::2]
    print((" ").join(tmp))
else:
    tmp=a[2::2][::-1] + [a[0]]  +a[1::2]
    print((" ").join(tmp))
 

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

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        boolean first=true;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            int i=0;
            while ((line = br.readLine()) != null) {

            	String[] str=line.split(" ");
            	int a=Integer.parseInt(str[0]);
            	int b=Integer.parseInt(str[1]);
            	double x=Integer.parseInt(str[0]);
            	double y=Integer.parseInt(str[1]);
            	String n=String.format("%.5f", (x/y));
            	System.out.println(a/b+" "+a%b+" "+n);
            	
            	break;
            }
        }
    }
}

Measured memory_bytes: 24624
n = STDIN.gets.to_i
while n > 0

	line = STDIN.gets
	line =~ /(\d+)/
	a = $1.to_i
	
	line = STDIN.gets
	line =~ /(\d+)/
	b = $1.to_i
	
	sum = a + b
	
	if(sum >= 10**80)
		puts "overflow"
	else
		puts sum
	end

	n -= 1
end

Measured memory_bytes: 2352
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, d, a;
pair<int, int> p[maxn];
int main() {
	scanf("%d%d%d", &n, &d, &a);
	for(int i = 1; i <= n; ++i) {
		scanf("%d%d", &p[i].first, &p[i].second);
		p[i].second = (p[i].second + a - 1) / a;
	}
	sort(p + 1, p + n + 1);
	int cnt = 0;
	long long ans = 0;
	for(int i = 1, j = 1; i <= n; ++i) {
		while(p[i].first - p[j].first > 2 * d) {
			cnt -= p[j].second;
			++j;
		}
		ans += max(0, p[i].second - cnt);
		p[i].second = max(0, p[i].second - cnt);
		cnt += p[i].second;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[100000],dp[100][100];

int main(){
  vi vec;
  rep(i,0,3){
    cin >> n;
    vec.pb(n);
  }
  sort(all(vec));
  if(vec[0]+vec[1] == vec[2])puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
    //type
    int H, W;
    std::cin >> H >> W;
    vt<std::string> C(H);
    rep(i,H)  std::cin >> C[i];

    rep(i,H) {
        rep(j,2)
            std::cout << C[i] << '\n';
    }
return 0;
}


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

from sys import stdin

def load():
    n = stdin.readline()
    return n

n = int(load())
s = load()

red = 0
for i in s:
    if i == 'R':
        red += 1

if red > n/2.0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<string, string> P;

string s;

void dfs(int i, int end, const string lTemp, const string rTemp, vector<P> &x)
{
    if (i == end)
    {
        x.push_back(make_pair(lTemp, rTemp));
        return;
    }

    dfs(i + 1, end, lTemp + s[i], rTemp, x);
    dfs(i + 1, end, lTemp, s[i] + rTemp, x);
}

int main(void)
{
    int n;
    cin >> n;
    cin >> s;
    reverse(s.begin() + n, s.end());

    vector<P> vl;
    vector<P> vr;
    dfs(0, n, "", "", vl);
    dfs(n, 2 * n, "", "", vr);
    sort(vl.begin(), vl.end());
    sort(vr.begin(), vr.end());

    long long score = 0;
    auto ir_lower = vr.begin();
    for (auto il = vl.begin(); il < vl.end(); ++il)
    {
        ir_lower = lower_bound(ir_lower, vr.end(), *il);
        auto ir_upper = upper_bound(ir_lower, vr.end(), *il);

        score += ir_upper - ir_lower;
    }

    cout << score << endl;
    return 0;
}


Measured memory_bytes: 62444
#include<stdio.h>
#include<math.h>

int isprime(int n);

int main(void){
  int i,n,sum=0;
  int num;
  
  scanf("%d", &n);

  for(i = 0 ; i < n ; i++){
    scanf("%d",&num);
     sum += isprime(num);
  }
  /*
  for(i = 0 ; i < n ; i++){
    if(num[i] == 2){
      sum++;
      //sum += isprime(n);
    }
  }
  */
  
  printf("%d\n",sum);
  
  
  return 0;
}

int isprime(int n){
  int i;
 
  if(n == 2) return 1;
  else if (n % 2 == 0) return 0;
  
  
  for(i = 3 ; i <= sqrt(n) ; i+=2){
    if(n % i == 0){
      return 0;
    }
  }
  return 1;
  
}

  
/*
 
  scanf("%d", &n);

  for(i = 0 ; i < n ; i++){
  scanf("%d",&num[i]);
  if(num[i] == 1){
      printf("2~10^8までの数を入力してください");
      break;
    }
  }
  
  for(i = 0 ; i < n ; i++){
    if(num[i] == 2){
      k++;
    }
  }
    
  for(i = 0 ; i <= n ; i++){
    for(j = 3 ; j <= sqrt(i) ; j+=2){
      if(num[i] % j == 0){
	k++;
	break;
      }
    }
  }
  printf("%d",k);
  printf("\n");
  
  
  return 0;
}
  */



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

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

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

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

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(char, c);
    c++;

    output(c);

    return 0;
}


Measured memory_bytes: 768
k = int(input())
lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k -= 1
print(int(lst[k]))

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

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

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

    int n;
    cin>>n;
    vector<int> as(n);
    rep(i, n) as[i] = i + 1;
    do {
        rep(i, n) cout<<as[i]<<(i != n - 1 ? ' ' : '\n');
    } while (next_permutation(as.begin(), as.end()));
}


Measured memory_bytes: 3232
#include<stdio.h>
int main(){
    int n,v[20],c[20],sum=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&v[i]);
    }
    for(int i=0;i<n;i++){
        scanf("%d",&c[i]);
    }
    for(int i=0;i<n;i++){
        if(v[i]-c[i]>0){
            sum+=v[i]-c[i];
        }
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

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

typedef long long ll;

using namespace std;



/*
class LightSwitchingPuzzle
{
public:
	int minFlips(string s)
	{

	}
}
*/


int main()
{
	int N, K, S[100], B[100][100];
	int sum;
	bool ret;
	
	while (cin >> N >> K)
	{
		if (N == 0 && K == 0) break;
		
		ret = true;
		
		REP(K) cin >> S[i];
		rep(i, N) rep(j, K) cin >> B[i][j];
		for (int i=0; i<K; i++)
		{
			sum = 0;
			for (int j=0; j<N; j++)
			{
				sum += B[j][i];
			}
			if (sum > S[i]) ret = false;
		}
		
		if (ret)
		{
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
		/*
		//テスト出力
		rep(i, N)
		{
			rep(j, K)
			{
				cout << B[i][j] << " ";
			}
			cout << endl;
		}
		*/
	}
	
	return 0;
}

Measured memory_bytes: 1192
import java.util.Scanner;

class Main {

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

        int D = scan.nextInt();
        int L= scan.nextInt();
        int h;
        int y;
        h = D/L;
        y=D-(h*L);
        System.out.println(h+y);
        
        }

    }





Measured memory_bytes: 26328
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String s = sc.next();
		int idx = s.indexOf("C");
		if (idx != -1) {
			int idx2 = s.indexOf("F", idx);
			if (idx2 != -1) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}

Measured memory_bytes: 23764
// D - Triangles
// 累積和による方法
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
#define rp(i,s,e) for(ll i=(s);i<(e);++i)

ll solve(int N, vl &L){
	vl csum(2000+1); //[length]<count>: 累積和: cumulative sum
	rp(i, 0, N) csum[L[i]]++;
	rp(i, 1, csum.size()) csum[i] += csum[i-1]; // その長さまでの棒の個数
	ll ans = 0;
	rp(ia, 0, N-1){
		rp(ib, ia+1, N){
			ll a = L[ia], b = L[ib];
			ll minL = abs(a - b), maxL = a + b; // |a-b| < c < a+b : cの範囲
			ans += csum[maxL-1] - csum[minL]; // maxL-1 に注意！cの範囲に(等号はない)
			if(minL<a && a<maxL) ans--; // cの範囲にaがあれば一本不要
			if(minL<b && b<maxL) ans--; // cの範囲にbがあれば一本不要
		}
	}
	return ans/3; //3本で△1つ
}

int main(){
	int N; cin>>N;
	vl L(N); rp(i, 0, N) cin>>L[i];
	cout<< solve(N, L) <<endl;
}

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

using namespace std;

#define MOD 1000000007
typedef long long int ll;

ll dp[100001]={0};

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
        
	ll n,k;
	cin>>n>>k;
	ll a[n+1]={0};
	for(int i=1;i<=n;i++){
		cin>>a[i];
		dp[i]=LLONG_MAX/2;
	}
	dp[1]=0;
	for(int i=2;i<=n;i++){
		for(int j=1;j<=k;j++){
			if(i-j>=1){
				dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
			}
		}
	}
	cout<<dp[n]<<endl;



	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set; 

#define     int                 ll
#define     pb                  push_back
#define     mp                  make_pair
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     init(x, a)          memset(x, a, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     cpy(a,b)            memcpy(a,b,sizeof(b))
#define     is(a)               to_string(a)
#define     ci(a,c)             a-c
#define     debug(i)            cout<<"point :"<<i<<'\n';
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int x,y,a,b,c; cin>>x>>y>>a>>b>>c;
    vi p(a),q(b),r(c);
    for(int i = 0; i < a; ++i) cin>>p[i];
    for(int i = 0; i < b; ++i) cin>>q[i];
    for(int i = 0; i < c; ++i) cin>>r[i];
    sort(all(p));
	sort(all(q));
	sort(all(r));
	reverse(all(p));
	reverse(all(q));
	reverse(all(r));
	int i1=x-1,i2=y-1, ans = 0;
	for(int i = 0; i < x; ++i) ans+=p[i];
	for(int i = 0; i < y; ++i) ans+=q[i];
	for(int i = 0; i < c; ++i){
		if(i1>=0 && i2>=0){
			if(ans <= ans-p[i1]+r[i] && ans-p[i1]+r[i] >= ans-q[i2]+r[i]){
				ans=ans-p[i1]+r[i];
				i1--;
			}
			else if(ans <= ans-q[i2]+r[i] && ans-p[i1]+r[i]<=ans-q[i2]+r[i]){
				ans=ans-q[i2]+r[i];
				i2--;
			}
			else break;
		}
		else if(i1>=0){
			if(ans-p[i1]+r[i]>=ans){
				ans=ans-p[i1]+r[i];
				i1--;
			}
			else break;
		}
		else if(i2>=0){
			if(ans-q[i2]+r[i]>=ans){
				ans=ans-q[i2]+r[i];
				i2--;
			}
			else break;	
		}
		else break;
	}
	cout<<ans<<'\n';
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}

Measured memory_bytes: 2560
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

public class Main {
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
//       while(true) {
    	   int n = sc.nextInt();
    	   int k = sc.nextInt();
    	   String s = sc.next();
    	   if(k==1) 
    		   s = s.substring(0, 1).toLowerCase()+s.substring(1);
    	   else
    		   s = s.substring(0, k-1)+s.substring(k-1, k).toLowerCase()+s.substring(k);
    	   System.out.println(s);
//      }
    }
}

Measured memory_bytes: 21844
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])
 
def main():
    n = inp()
    a = inpl()
    ans = 1
    a.sort()
    for i in range(n):
        if a[i] == 0:
            print(0)
            return
        ans *= a[i]
        if ans > 10**18:
            print(-1)
            return
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 24508
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;
const double pi=2*acos(0.0);
//abc169c

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    long double a,b;
    cin>>a>>b;
    ll ans=(ll)a*b;
    cout<<ans<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O2")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 
template <typename T> 
void DEBUG_ARR(vt<T> a,char c)
{
	f(i,0,a.size())cout<<a[i]<<c;
	cout<<"\n";
}

lli tmod(lli x,lli m){return (x%m+m)%m;}//USE AT YOUR OWN RISK
lli power(lli x, lli y) 
{
    lli res = 1;  
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;  
    }
    if(res<0)
       res+=mod; 
    return res; 
}
lli modInverse(lli a, lli m) 
{
    lli m0 = m; 
    lli y = 0, x = 1; 
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    {  
        lli q = a / m; 
        lli t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }  
    if (x < 0) 
       x += m0; 
    return x; 
} 
const int N=(1<<20);

int main() 
{ 
  fastio;
  int n;
  cin>>n;
  int ans=MAXN;
  int x[n];f(i,0,n)cin>>x[i];
  f(i,0,100){
      int temp=0;  
      f(j,0,n){
          temp+=(x[j]-i)*(x[j]-i);  
      }
      ans=min(ans,temp);
  }  
  cout<<ans<<"\n";
  return 0; 	
}


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

typedef long long ll;

int main(){
	int n, k;
	cin>>n>>k;
	vector<pair<int, int> > arr(n);
	for(auto &x : arr){
		cin>>x.second>>x.first;
		x.second -= 1;
	}
	sort(arr.rbegin(), arr.rend());
	vector<int> mask(n, 0);
	map<int, int> mp;
	ll sum = 0, cnt = 0;
	for(int i = 0; i < k; i++){
		if(mask[arr[i].second]){
			mp[arr[i].first]++;
		}else{
			mask[arr[i].second] = 1;
			cnt++;
		}
		sum += arr[i].first;
	}
	ll ans = sum + cnt*cnt;
	for(int i = k; i < n; i++){
		if(cnt == k)break;
		if(mask[arr[i].second])continue;
		mask[arr[i].second] = 1;
		int val = (*mp.begin()).first;
		mp[val]--; if(mp[val] == 0)mp.erase(val);
		sum += arr[i].first - val; cnt++;
		ans = max(ans, sum + cnt*cnt);
	}
	cout<<ans<<endl;
}

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

int main() {
  vector<int> x(5);
  for (int i = 0; i < 5; i++) {
    cin >> x.at(i);
    if (x.at(i) == 0) {
      cout << i + 1 << endl;
      break;
    }
  }
}

Measured memory_bytes: 3592
n,m,x = (int(x) for x in input().split())

la=[]
for i in range(n):
  la.append(list(map(int, input().split())))

y = 0
for i in range(2 ** n):
  lb = [0]*(m+1)
  for j in range(n):
    if ((i >> j) & 1):
      lb = [x + y for (x, y) in zip(lb, la[j][:])] 
  frg=1
  for h in range(m):
    if lb[h+1]<x:
      frg=0
  if frg==1:
    if lb[0] <= y or y==0:
      y=lb[0]
  del lb[:]
print(y if y>0 else -1)

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


int main(){
  ll n;
  cin>>n;
  ll a1[n];
  ll a2[n];
  REP(i,n){
    ll a;
    cin>>a;
    if(i==0){
      a1[i] = a;
    }else{
      a1[i] = a+a1[i-1];
    }
  }
  REP(i,n){
    ll a;
    cin>>a;
    if(i==0){
      a2[i] = a;
    }else{
      a2[i] = a+a2[i-1];
    }
  }
  ll ans = 0;
  REP(i,n){
    ll koho;
    if(i==0){
      koho = a1[i]+a2[n-1];
    }else{
      koho = a1[i]+a2[n-1]-a2[i-1];
    }
    ans = max(ans,koho);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int n,a=0;
    cin>>n;
    if (n%2==0){cout<<"0.5";}
    else{
        for (int i=1;i<=n;i++){
            if(i%2!=0){a++;}
        }
    }
    cout<<a/(n*1.0)<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
#define rep(i, n) for(ll i = 0; i < ll(n); ++i)
#define rep2(i, n) for(ll i = 1; i <= ll(n); ++i)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); ++i)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); ++i)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  string S;
  cin >> S;
  if(S == "ABC") cout << "ARC" << newl;
  if(S == "ARC") cout << "ABC" << newl;
  return 0;
}

Measured memory_bytes: 3616
using System;
using System.Linq;

namespace ARC102
{
    class C
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int K = input[1];

            long[] num = new long[K];
            for (int i = 1; i <= N; i++) num[i % K]++;

            long res = 0;
            for (int a = 0; a < K; a++)
            {
                int b = (K - a) % K;
                int c = (K - a) % K;

                if ((b + c) % K != 0) continue;
                res += num[a] * num[b] * num[c];

            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 13268
// https://atcoder.jp/contests/abc137/tasks/abc137_d

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(i, n) printf("%d%c", a[i], i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(i, n) REP(j, m) printf("%d%c", a[i][j], j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1e5;
const int M_MAX = 1e5;
const int A_I_MAX = 1e5;
const int B_I_MAX = 1e4;

int N, M;
int A[N_MAX];
int B[N_MAX];

pair<int, int> T[N_MAX];

void solve() {
  REP(i, N) T[i] = make_pair(A[i], B[i]);
  sort(T, T + N);
  int ans = 0;
  priority_queue<int, vector<int> > que;
  int k = 0;
  FOR(i, 1, M) {
    for(; k < N && T[k].first <= i; k++) {
      que.push(T[k].second);
    }
    if (!que.empty()) {
      ans += que.top();
      que.pop();
    }
  }

  printf("%d\n", ans);
}

void input() {
  scanf("%d%d", &N, &M);
  REP(i, N) scanf("%d%d", A + i, B + i);
}

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


Measured memory_bytes: 2428
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define f(p,n) for(ll i=p;i<n;i++)
ll exp(ll a,ll b,ll m);

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

 	ll n,m;
 	cin>>n>>m;
 	ll a[n],b[m];
 	f(0,n) cin>>a[i];
 	f(0,m) cin>>b[i];

 	ll po[n*m+1][2];
 	memset(po,0,sizeof(po));
 	ll tp=0,lx=0,ly=0,us=0;
 	f(0,n)
 	{
 		po[a[i]][0]=i+1;
	}
	f(0,m)
 	{
 		po[b[i]][1]=i+1;
	}
	ll ans=1;
	for(ll j=n*m;j>=1;j--)
	{
		if(po[j][0]!=0 && po[j][1]!=0)
		{
			tp+=(ly+lx+1);
			ly++;
			lx++;
		}
		else if(po[j][0]==0 && po[j][1]==0)
		{
			ans=(ans*(tp-us));

		}
		else if(po[j][0]!=0)
		{
			tp+=(ly);
			lx++;
			ans*=ly;
		}
		else
		{
		tp+=(lx);
			ly++;
			ans*=lx;
		}
		if(ans<0) break;
		ans=(ans%mod);
		us++;
	}

	if(ans<0) ans=0;
	ans=ans%mod;
	cout<<ans<<endl;
return 0;
}

ll exp(ll a,ll b,ll m)
{
	if(b==0)
	{
		return 1;
	}
	ll temp =exp(a,b/2,m);
	temp=(temp*temp)%m;
	if(b&1)
	{
		return (temp*(a%m))%m;
	}
	return temp;
}



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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll N;
    cin >> N;

    for(ll i = 0; i < N; i++){
        ll t; cin >> t;
        vec.push_back(t);
    }

    sort(vec.begin(), vec.end());
    vec.push_back(INF);

    //累積わ
    // start r[0] = 0
    vector<ll > r(N + 2, 0);
    for(ll i = 0; i < N + 1; i++){
        r[i+1] = r[i] + vec[i];
    }

    //確認
    ll ans = 0;
    for(ll i = 0; i < N; i++){
        ll num = vec[i] * 2;
        while(true){
            ll choka = upper_bound(vec.begin(), vec.end(), num) - vec.begin();
            //ll ika = choka - 1;
            num = r[choka] * 2;
            //cout << ":" <<  num << endl;
            if(vec[choka] > num){
                if(vec[choka] == INF){
                    ans++; 
                }
                break;
            }
        }        
        //cout << num << " " << r[ika] << endl;
    }

    cout << ans << endl;

}

Measured memory_bytes: 1908
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define brep(i,n) for(int i =n-1;i>=0;i--)

int main(void){
    long long n;
    cin >> n;
    long long ct = -2;
    vector<int> ans;
    if(n%2){
        ans.push_back(1);
        n--;
    }
    else ans.push_back(0);
    while(n != 0){
        if(n%(2*ct) != 0 &&n%ct == 0){
            ans.push_back(1);
            n -= ct;
        }
        else ans.push_back(0);
        ct *= -2;
    }
    brep(i,(int)ans.size()){
        cout << ans[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int dp[n][10];
    int s[n][11];
    for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
            cin>>dp[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<11;j++){
            cin>>s[i][j];
        }
    }
    int ansr=-1*(1<<30);
    for(int i=1;i<(1<<10);i++){
        int ans=0;
        for(int j=0;j<n;j++){
            int cnt=0;
            for(int k=0;k<10;k++){
                if(dp[j][k]&&i&(1<<k))cnt++;
            }
            //cout<<j<<cnt<<endl;
            ans+=s[j][cnt];
        }
        ansr=max(ans,ansr);
    }
    cout<<ansr<<endl;
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

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

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int c = 0;
    ll n, d;
    cin >> n >> d;
    d = d * d;
    for(int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        if(x * x + y * y <= d) {
            c++;
        }
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#define _USE_MATH_DEFINES
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
typedef long long ll;
#define Rep(i,n) for(int i = 0;i < (n);i++)	

int gcd(int a, int b) { if (b == 0)  return a;  else  return gcd(b, a % b);  }
int lcm(int a, int b) { return a * b / gcd(a, b); }
void swap(int& a, int& b) { int temp = a; a = b; b = temp; return; }
int ncr(int n, int r) { int a = 1; Rep(i, r) a = (a * (n - i)) / (i + 1); return a; }
int npr(int n, int r) { int a = 1; Rep(i, r) a *= n - i; return a; }
int mod(int a, int b) { return a % b; }

int main() {
	/*int s, w;
	std::cin >> s >> w;
	if (s <= w) {
		std::cout << "unsafe" << std::endl;
	}
	else {
		std::cout << "safe" << std::endl;
	}*/
	int a, b, c, d;
	std::cin >> a >> b >> c >> d;
	if ((a-1) / d >= (c-1) / b) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 3624