akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
	string s;
	cin >> s;
	int N = s.size();
	int i;
	int t = 1;
	for (i = 0;i + 1 < N;i++) {
		int j = i + 1;
		while (s.at(j) != s.at(i)) {
			j++;
			if (j == N) break;
		}
		if (j < N) {
			t = 0;
			break;
		}
	}
	if (t) cout << "yes" << endl;
	else cout << "no" << endl;
	return 0;
}


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

int main() {
  int problem_count;
  int submit_count;
  int wa_count[200000] = {0};
  int wa_sum = 0;
  int corrected[200000] = {0};
  int correct_count = 0;

  cin >> problem_count >> submit_count;
  for(int i=0; i<submit_count; i++) {
    int problem_id;
    cin >> problem_id;
    string problem_result;
    cin >> problem_result;

    if(problem_result == "AC") {
      if(corrected[problem_id] == 0) {
        corrected[problem_id] = 1;
        ++correct_count;
      }
    } else {
      if(corrected[problem_id] == 0) {
        wa_count[problem_id]++;
      } 
    }
  }
  ++problem_count;
  for(int j=1; j<problem_count; j++) {
    if(corrected[j] == 1) {
      wa_sum += wa_count[j];
    }
  }

  cout << correct_count << " " << wa_sum;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
pair<int,int> par[3010][3010];
int dp[3010][3010];
string a,b,ansi;

int ans(int curr1 , int curr2){
    if(dp[curr1][curr2] != -1){
        return dp[curr1][curr2];
    }
    int ret = 0;
    pair<int,int> g = {curr1-1,curr2};
    if(a[curr1] == b[curr2]){
        g = {curr1-1,curr2-1};
        if(curr1-1 >= 0 && curr2-1 >= 0){
            ret = 1 + ans(curr1-1,curr2-1);
        }else{
            ret = 1;
        }
    }else{
        if(curr1 - 1 >= 0){
            ret = max(ret , ans(curr1-1,curr2));
        }
        if(curr2 - 1 >= 0){
            int val = ans(curr1,curr2-1);
            if(val > ret){
                ret = val;
                g = {curr1,curr2-1};
            }
        }
    }
    dp[curr1][curr2] = ret;
    par[curr1][curr2] = g;
    return ret;
}

int main()
{
    cin >> a >> b;
    for(int i = 0 ; i <= 3000 ; i += 1){
        for(int j = 0 ; j <= 3000 ; j += 1){
            dp[i][j] = -1;
        }
    }
    ans(a.size()-1,b.size()-1);
    int p1 = a.size()-1,p2 = b.size()-1;
    set<pair<int,int>> x;
    while(p1 >= 0 && p2 >= 0){
        if(a[p1] == b[p2]){
            ansi += a[p1];
        }
        if(x.count({p1,p2})){
            break;
        }
        x.insert({p1,p2});
        pair<int,int> g = par[p1][p2];
        p1 = g.first;
        p2 = g.second;
    }
    for(int i = ansi.size() - 1 ; i >= 0 ; i -= 1){
        cout << ansi[i];
    }
}

Measured memory_bytes: 106880
import Data.List
import Data.Char
main = do
  xs <- map read . lines <$> getContents :: IO [Int]
  let l = fi (tail xs) $ head xs 
  print $ ((sum $ (delete l xs)) + sumrest (map show $ delete l xs) + l)
  
fi :: [Int] -> Int -> Int
fi [] a = a
fi (x:xs) a
  |(last $ show x) == '0' = fi xs a
  |(reverse $ show x) < (reverse $ show a) = fi xs x
  |otherwise = fi xs a

sumrest :: [String] -> Int
sumrest xs = (foldl (\a x -> 10-(digitToInt $ last x)+a) 0) $ filter (\s -> (last s) /= '0') xs

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int max = Math.max(Math.max(a + b, a - b), a * b);
            out.println(max);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pp pop_back
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define f0(i,a,n) for(i=a;i<n;i++)
#define f1(I,a,b) for(i=a;i<=b;i++)
#define stp setprecision
#define nl endl
#define ipt(a) for(i=0;i<n;i++)cin>>a[i];
#define pll pair<ll,ll>
#define vl vector<ll>
#define mp map<ll,ll>
int main()
{
    fast;
    ll t;
    t=1;
    while(t--)
    {
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        ll s=max(a*c,a*d);
        ll k=max(b*c,b*d);
        cout<<max(s,k)<<nl;
    }
}

Measured memory_bytes: 3640
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debugg cout<<"debugged\n";
#define setpr(xval) cout<<fixed<<setprecision(12)<<xval<<endl;
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
ll n,ans;
bool compare(pi &a,pi &b)
{
    return a.first>b.first;
}
void solve()
{
   cin>>n;map<ll,ll>mpe,mpo;
   for(int i=0;i<n;i++)
   {
       ll a;cin>>a;
       if(i%2==0)
        mpo[a]++;
        else
        mpe[a]++;
   }
   vector<pi> ar(n/2+2,{0,0}),are(n/2+2,{0,0});
   ll i=0;
   for(auto it:mpo)
   {
       ar[i].first=it.second;ar[i].second=it.first;i++;
   }i=0;
   for(auto it:mpe)
   {
       are[i].first=it.second;are[i].second=it.first;i++;
   }
   sort(ar.begin(),ar.end(),compare);sort(are.begin(),are.end(),compare);
   if(ar[0].second==are[0].second)
   {
        ll temp=n-max(ar[0].first+are[1].first,ar[1].first+are[0].first);
        cout<<temp<<endl;
   }
   else
   {
       ll temp=n-ar[0].first-are[0].first;
        cout<<temp<<endl;
   }
}

int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))

int main() {
    string field[109][109];
    int white, black;
    cin >> white >> black;
    white--; black--;
    
    rep1( i, 100){
        rep1( j, 100) {
            if ( i>= 50 ) field[i][j] = "#";
            else field[i][j] = ".";
        }
    }
    
    for ( int i = 1; i < 50; i+=2) {
        for ( int j = 1; j <= 100; j+=2) {
            if ( black-- > 0) {
                field[i][j] = "#";
            } else {
                break;
            }
            
        }
    }
    for ( int i = 51; i <= 100; i+=2) {
        for ( int j = 1; j <= 100; j+=2) {
            if ( white-- > 0) {
                field[i][j] = ".";
            } else {
                break;
            }
            
        }
    }
    
    cout << 100 << " " << 100 << endl;
    rep1( i, 100){
        rep1( j, 100) {
            cout << field[i][j];
        }
        cout << endl;
    }
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
#define mx 500001
using namespace std;
ll mi(ll n,ll m){ll pw=n;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define mkp make_pair
//#define d double
void solve(){
int n;cin>>n;
map<pi,int> mp;
for(int i=1;i<=n;i++){
	int v=i;
	int s=i%10;
	while((v/10)) v/=10;
	int fi=v;
	mp[mkp(fi,s)]++;
}
// for(auto it:mp){
// 	cout<<it.f.f<<" "<<it.f.se<<"->"<<it.se<<endl;
// }
ll ans=0;
for(int i=1;i<=n;i++){
	int v=i;
	int s=i%10;
	while((v/10)) v/=10;
	int fi=v;
	pi p=mkp(s,fi);
	if(mp.count(p)) ans+=mp[p];
}
cout<<ans;
}
int32_t main(){
FIO;
int t=1;
//cin>>t;
while(t--){
	solve();
}
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a; cin>>a;
	cout<<(a?0:1)<<"\n";
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
int memo;
int index(int a[], int n, int x){
    for(int i=0; i<n; i++){
        if(a[i]==x)
            return i;
    }
    return -1;
}
void print(int pre[], int in[], int n){
    int m=index(in, n, pre[0]);
    if(m>0){
        print(pre+1, in, m);
    }
    if(m<n-1){
        print(pre+m+1, in+m+1, n-1-m);
    }
    cout<<pre[0];
    if(pre[0]!=memo)  cout<<" ";
}

int main(){
    int n;
    cin>>n;
    int pre[n], in[n];
    for(int i=0; i<n; i++)
        cin>>pre[i];
    for(int i=0; i<n; i++)
        cin>>in[i];
    memo=pre[0];
    print(pre, in, n);
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3116
#include<iostream>
#include<algorithm>
using namespace std;
long long dp[22000], a[22000], n, m, k;
int main() {
	cin >> n >> m >> k; for (int i = 0; i < 22000; i++)dp[i] = 1LL << 62;
	for (int i = 0; i < n; i++)cin >> a[i]; dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		long long minx = 1LL<<62, maxn = 0;
		for (int j = 1; j <= m; j++) {
			if (i - j < 0)break; minx = min(minx, a[i - j]); maxn = max(maxn, a[i - j]);
			dp[i] = min(dp[i], dp[i - j] + k + (maxn - minx)*j);
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1488
#include <cstdio>
#include <cmath>

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

typedef long long   signed int LL;
typedef long long unsigned int LU;

template<typename T> void swap(T &x, T &y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T &a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T &a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int h, w, a[200][600];
int dp[400][200][200];

int main() {
	scanf("%d%d", &h, &w);
	inc(i, h) { 
	inc(j, w) {
		scanf("%d", &a[i][j + 200]);
	}
	}
	
	dp[0][0][0] = a[0][0 + 200];
	inc(i, h + w - 1 - 1) {
		inc(j, h) {
		inc(k, h) {
			int jj[4] = { 0, 0, 1, 1 };
			int kk[4] = { 0, 1, 0, 1 };
			inc(l, 4) {
				int jjj = j + jj[l];
				int kkk = k + kk[l];
				if(0 <= jjj && jjj < h && 0 <= kkk && kkk < h) {
					setmax(dp[i + 1][jjj][kkk], dp[i][j][k] + a[jjj][i+1 - jjj + 200] + (jjj == kkk ? 0 : a[kkk][i+1 - kkk + 200]));
				}
			}
		}
		}
	}
	
	printf("%d\n", dp[h + w - 2][h - 1][h - 1]);
	
	return 0;
}


Measured memory_bytes: 62848
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define dl double long
const int INF=0x3fffffff;
const ll MOD=1000000007;
const ll MODD=998244353;
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }

int main()
{
  dl R;
  cin >> R;
  cout << 2*3.14*R << "\n";
}


Measured memory_bytes: 3792
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    int h = scanner.nextInt();
    
    System.out.println((a + b) * h / 2);
  }
}

Measured memory_bytes: 10064
#include <iostream>
#include <vector>

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

   std::vector<int> R, G, B;
   for(int i=0; i<N; ++i){
      if(S[i]=='R') R.push_back(i);
      else if(S[i]=='G') G.push_back(i);
      else if(S[i]=='B') B.push_back(i);
   }
   const int NR = R.size();
   const int NG = G.size();
   const int NB = B.size();
   int r(0), g(0), b(0);
   long long ans = 0;
   for(int i=0; i<N; ++i){
      if(S[i]=='R'){
	 for(int j=g; j<NG; ++j){
	    ans += NB - b;
	    int k = G[j] - i + G[j];//R, G, B
	    if(k<N && S[k]=='B') --ans;
	    k = (G[j] - i)%2==0 ? (G[j] - i)/2 + i : N;//R, B, G
	    if(k<N && S[k]=='B') --ans;
	 }
	 ++r;	
      }else if(S[i]=='G'){
	 for(int j=b; j<NB; ++j){
	    ans += NR - r;
	    int k = B[j] - i + B[j];//G, B, R
	    if(k<N && S[k]=='R') --ans;
	    k = (B[j] - i)%2==0 ? (B[j] - i)/2 + i : N;//G, R, B
	    if(k<N && S[k]=='R') --ans;
	 }
	 ++g;	
      }else if(S[i]=='B'){
	 for(int j=r; j<NR; ++j){
	    ans += NG - g;
	    int k = R[j] - i + R[j];//B, G, R
	    if(k<N && S[k]=='G') --ans;
	    k = (R[j] - i)%2==0 ? (R[j] - i)/2 + i : N;//B, R, G
	    if(k<N && S[k]=='G') --ans;
	 }
	 ++b;	
      }
   }

   std::cout << ans << std::endl;
   return 0;
}


Measured memory_bytes: 3568
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define lowbit(x) x&(-x)
#define PII  pair<int, int> 
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e5 + 5;
using namespace std;
 
int p[11], c[11];
 
int main()
{
	int D, G; scanf("%d %d", &D, &G);
	for(int i = 0; i < D; i++) scanf("%d %d", p + i, c + i);
	int ans = inf;
	for(int i = 0; i < (1 << D); i++){
		ll sum = 0;
		int cnt = 0;
		for(int j = 0; j < D; j++){
			if((i >> j) & 1){
				sum += p[j] * (j + 1) * 100 + c[j];
				cnt += p[j];
			}
		}
		for(int j = D - 1; j >= 0; j--){
			if((i >> j) & 1) continue;
			if(sum >= G) continue;
			int q = min((G - sum)/((j + 1) * 100), (ll)p[j]);
			cnt += q;
			sum += (j + 1) * 100 * q;
		}
		if(G <= sum) ans = min(ans, cnt);
	}
	printf("%d\n", ans);
	return 0;
}

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

int main() {
	int N;
	int A[20], B[20], C[20];
	cin >> N;
	rep(i, N)cin >> A[i];
	rep(i, N)cin >> B[i];
	rep(i, N - 1)cin >> C[i];

	int cnt = 0;
	rep(i, N)cnt += B[i];
	for (int i = 1; i < N; i++) {
		if (A[i] - A[i - 1] == 1)cnt += C[A[i] - 2];
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Printf("%.6f\n", parseProblem())
}

func parseProblem() float64 {
	n := scanInt(sc)
	vs := nextIntSlice(sc, n)
	sort.Sort(sort.IntSlice(vs))
	v := float64(vs[0])
	for i := 1; i < len(vs); i++ {
		v = (v + float64(vs[i])) / 2.0
	}
	return v
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return int(a)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextIntSlice(sc *bufio.Scanner, n int) (a []int) {

	a = make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt(sc)
	}
	return a
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1756
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N;

    scanf("%d", &N);

    char S[N+1];

    scanf("%s", S);

    int E = 0, W = 0;

    for(int i = 0; i < N; i++){
        if(S[i] == 'E'){
            E++;
        }else{
            W++;
        }
    }

    int e = 0, w = 0;

    int min = N;

    for(int i = 0; i < N; i++){
        if(S[i] == 'E'){
            e++;
        }else{
            w++;
        }
        int c = w + (E-e);
        if(c < min){
            min = c;
        }
    }

    e = 0, w = 0;

    for(int i = N - 1; i >= 0; i--){
        if(S[i] == 'W'){
            w++;
        }else{
            e++;
        }
        int c = e + (W - w);
        if(c < min){
            min = c;
        }
    }

    printf("%d\n", min);

    return 0;
}

Measured memory_bytes: 1992
A, B, K = map(int,input().split())
ans = []
for i in range(K):
    if A + i <= B:
        ans.append(A + i)
for i in range(-K,0):
    if B + i >= A:
        ans.append(B + i + 1)
ans = list(set(ans))
ans = sorted(ans)
for i in range (len(ans)):
    print(ans[i])

Measured memory_bytes: 9088
using System;
using System.Collections.Generic;
using System.Linq;
 
static class MainClass {

  public static void Main (string[] args) {
    //var temp = Console.ReadLine().Split(' ').Select(long.Parse);
    var N = int.Parse(Console.ReadLine());
    var ans = "No";
    for(var i = 0; i <= N/4; i++){
      for(var j = 0; j <= N/7; j++){
        if(i * 4 + j * 7 == N){
          ans = "Yes";
          break;
        }
      }
    }

    Console.WriteLine(ans);

  }
  
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define x real()
#define y imag()
using namespace std;
typedef complex <double> point;
typedef vector <int> V;
string str[101];
vector <point> G[101];
V node[101];
map <string,V> M;
int n,ans;

double dot(point a,point b){return a.x*b.x+a.y*b.y;}
double cross(point a,point b){return a.x*b.y-a.y*b.x;}

int ccw(point a,point b,point c){
  point d = b-a;
  point e = c-a;
  if(cross(d,e)>0) return 1;
  if(cross(d,e)<0) return -1;
  if(dot(d,e)<0) return 2;
  if(abs(d) < abs(e)) return -2;
  return 0;
}

bool intersection(point a,point b,point c,point d){
  if(!(ccw(a,b,c)*ccw(a,b,d)<=0&&ccw(c,d,a)*ccw(c,d,b)<=0))return 0;
  if(abs(ccw(a,b,c))==1||abs(ccw(a,b,d))==1)return 0;
  double AB=abs(a-b)+abs(c-d);
  double D=max(abs(a-c),abs(a-d));
  D=max(D,max(abs(b-c),abs(b-d)));
  if(AB==D) return 0;
  return 1;
}

void mk_node(){
  for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++){
      if(str[i]==str[j])continue;
      int is=G[i].size(),js=G[j].size();
      for(int k=0;k<is;k++)
	for(int l=0;l<js;l++){
	  point a=G[i][k],b=G[i][(k+1)%is];
	  point c=G[j][l],d=G[j][(l+1)%js];
	  if((intersection(a,b,c,d)))node[i].push_back(j),k=is,l=js;
	}
    }
  for(int i=0;i<n;i++) M[str[i]].push_back(i);
}


int col[101];
void check(){
  int c=0;
  for(int i=0;i<n;i++){
    c=max(c,col[i]);
    for(int j=0;j<node[i].size();j++)
      if(col[i]==col[node[i][j]])return;
  }
  ans=min(ans,c);
}
void nxp(map<string,V>::iterator it,int c){
  if(it==M.end()){check();return;}

  V a=it->second;
  for(int i=0;i<=c;i++){
    for(int j=0;j<a.size();j++)col[a[j]]=i;
    if(i==c)nxp(++it,c+1);
    else nxp(++it,c);
    it--;
  }
	 }


int main(){
  while(cin>>n,n){
    M.clear();
    for(int i=0;i<n;i++) G[i].clear(),node[i].clear();

    for(int i=0;i<n;i++){
      cin>>str[i];
      while(1){
	int a,b;
	cin>>a;
	if(a==-1) break;
	cin>>b;
	G[i].push_back(point(a,b));
      }
    }
    mk_node();
    ans=10;
    nxp(M.begin(),0);
    cout <<ans+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 1296
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef unsigned int uint;

int n, a, b, A[100010];

void solve(){
	scanf("%d%d%d", &n, &a, &b);
	rep(i, n) scanf("%d", A+i);
	int low = 0, high = 1e9, res = 1e9;
	while(low <= high) {
		int mid = (low + high) >> 1;
		ll cnt = 0;
		rep(i, n) {
			ll t = (ll)b * mid;
			if(A[i] > t) {
				cnt += (A[i] - t + a - b - 1) / (a - b);
			}
		}
		if(cnt <= mid) {
			res = mid, high = mid - 1;
		}
		else low = mid + 1;
	}
	printf("%d\n", res);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}


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

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

bool comp(pll a,pll b){
	if((a.ff*1.0)/a.ss==(b.ff*1.0)/b.ss){
		return a.ff>b.ff;
	}
	return (a.ff*1.0)/a.ss>(b.ff*1.0)/b.ss;
}

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

ll t,i,x,j,y,z=0,k,n,ii;

cin>>k>>n;	
ll dp[k+1];

rep(i,0,k+1,1){
	dp[i]=infl;
}
rep(i,0,n,1){
	cin>>x>>y;
	rep(j,0,min(k+1,x+1),1){
		dp[j]=min(dp[j],y);
	}
	rep(j,min(k+1,x+1)-1,k+1,1){
		dp[j]=min(dp[j],y+dp[j-x]);
	}
}

ce(dp[k])
}
//139815


Measured memory_bytes: 384
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String M[] ={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
    String N =sc.next();
    for(int A=0;A<25;A++){
      if(N.equals(M[A])){System.out.println(M[A+1]);System.exit(0);}}
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <sstream>

int main(int argc, char const* argv[])
{
    int r, g, b;
    std::cin >> r >> g >> b;

    std::stringstream ss;
    ss << r << g << b;

    auto num = std::stoi(ss.str());

    if (num % 4 == 0) {
        std::cout << "YES" << std::endl;
    }
    else {
        std::cout << "NO" << std::endl;
    }
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"


int main()
{
    int n = 0;
    cin >> n;
    set<string> chk;
    string before = "";
    string word = "";
    REP(i, n)
    {
        cin >> word;
        if (chk.count(word) == 1)
        {
            COUT("No");return 0;
        }
        if (before != "")
        {
            if (word[0] != before.back())
            {
                COUT("No");return 0;
            }
        }
        chk.insert(word);
        before = word;
    }

    COUT("Yes");

    return 0;
}

Measured memory_bytes: 256
#coding:utf-8

n,m = map(int,input().split())
point_s = 0
point_e = n + 1

if n % 2 == 0:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))
        if n % 4 == 0 and (point_e - point_s - 1) * 2 == n:
            point_e -= 1
        elif n % 4 != 0 and (point_e - point_s - 1) * 2 == n + 2:
            point_e -= 1
elif n % 2 == 1:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))

Measured memory_bytes: 9208
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  int h[n];
  rep(i,n)cin >> h[i];
  sort(h,h+n);
  int ans = 1e+9;
  rep(i,n-k+1)ans = min(ans,h[k+i-1]-h[i]);
  cout<<ans;
}
  

Measured memory_bytes: 640
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
#import numpy as np
# sympy as syp(素因数分解とか)
Mod = 1000000007
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1] 
for i in range(2, 10**5 + 1):
    fact.append((fact[-1] * i) % Mod)
    inv.append((-inv[Mod % i] * (Mod // i)) % Mod)
    factinv.append((factinv[-1] * inv[-1]) % Mod)
    
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p
    
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)
import string
def main():  #startline-------------------------------------------
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        x = n // i
        ans += x * (i + i * x) // 2
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 21920
//Keep working hard :)
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 1e5+5;
int a[N];

void fileIO()
{
	#ifndef ONLINE_JUDGE
        freopen("int.txt","r",stdin);
        freopen("out.txt","w",stdout);
        #endif
}
int main()
{
	IOS;
	//fileIO;
	int x = 3,y;
	while(x--)
	{
		cin >> y;
		a[y]++;
	}
	(a[5] == 2 && a[7] == 1) ? cout << "YES": cout << "NO";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  while(1){
    int n,a,b=0,c=0,k[51]={};
    cin>>n>>a;
    if(n+a==0)break;
    while(1){
      for(int i=0;i<n;i++){
	if(a!=0){
	  a--;
	  k[i]++;
	  if(a==0){
	    for(int j=0;j<n;j++)if(k[j]!=0)b++;
	    if(b==1){
	      cout<<i<<endl;
	      c++;
	    }
	    else b=0;
	  }
	}else{
	  a+=k[i];
	  k[i]=0;
	}
      }
      if(c==1)break;
    }
  }
  return 0;
}

Measured memory_bytes: 3012
def constructXOR(A, n): 
    XOR = 0
    for i in range(0, n): 
        XOR ^= A[i] 
    for i in range(0, n): 
        A[i] = XOR ^ A[i] 
  
n=int(input())
A=list(map(int,input().strip().split()))
constructXOR(A, n) 
for i in range(0,n): 
    print(A[i], end =" ")

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	long long n;
	cin>>n;
	if (n & 1) {
		cout<<"0\n";
		return 0;
	}
	long long res = n / 10;
	n /= 10;
	while (n) {
		res += n / 5;
		n /= 5;
	}
	cout<<res;
}


Measured memory_bytes: 256
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> P;
#define X real()
#define Y imag()
ld restant(P p){return abs(p);}
//polar(x,y) mag=l,arg=y
//typedef unordered_set<ll> usll;
//typedef unordered_multiset<ll> umsll;
typedef multiset<ll> msll;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll> > vpll;
typedef priority_queue<ll> pqll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
//typedef unordered_multiset<int> umsi;
//typedef unordered_set<int> usi;
typedef pair<int,int> pi;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<double,double> > vpd;
typedef pair<double,double> pd;
typedef priority_queue<int> pqi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ind_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ind_setll;
#define in insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define be begin
#define en end
#define itr iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mo 1000000007
#define inf 1000000000000000001
#define ninf -1000000000000000001
#define ima INT_MAX
#define imi INT_MIN
#define oncnt __builtin_popcount
#define zerobegin __builtin_clz
#define zeroend __builtin_ctz
#define parity __builtin_parity
#define all(x) x.be(),x.en()
#define eps 1e-9
const ld pii=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return((a-b+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}



int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{	
int n,m;
cin>>n>>m;
int a[n];
for(int i=0;i<n;i++)
a[i]=-1;
bool f=true;

for(int i=0;i<m;i++)
{
	int j,b;
	cin>>j>>b;
	if(j>n)
	f=false;
	j--;
	if(a[j]!=-1&&a[j]!=b)
	f=false;
	else if(j==0&&b==0&&n>1)
	f=false;
	else
	a[j]=b;
}
if(a[0]==-1&&n>1)
a[0]=1;
for(int i=1;i<n;i++)
{
	if(a[i]==-1)
	a[i]=0;
}
if(a[0]==-1)
a[0]=0;

if(f)
{
	for(int i=0;i<n;i++)
	cout<<a[i];
}
else
cout<<-1;
}return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> Point;
typedef pair<Point, Point> Line;
typedef vector<Point> Poly; 
const double EPS = 1e-10;

// 内積 |a||b|cosθ
double dot(Point a, Point b){
	// return a.real() * b.real() + a.imag() * b.imag();
	return (conj(a) * b).real();
}
// 外積、符号付面積の２倍　|a||b|sinθ
double cross(Point a, Point b){
	// return a.real() * b.imag() - a.imag() * b.real();
	return (conj(a) * b).imag();
}
int in_poly(Poly p, Point x){
    int n = p.size();
    bool in = false;
    for(int i = 0; i < n; i++){
        Point a = p[i] - x, b = p[(i + 1) % n] - x;
        if(imag(a) > imag(b)) swap(a, b);
        if(imag(a) <= 0 && 0 < imag(b)){
            if(cross(a, b) < 0) in = !in;
        }
        // 線上判定
        if(cross(a, b) == 0 && dot(a, b) <= 0) return 2;
    }
    return in;
}

int main(){
    int n;
    cin >> n;
    Poly pl(n);
    for(int i = 0; i < n; i++){
        double x, y;
        cin >> x >> y;
        pl[i] = {x, y};
    }
    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
        double x, y;
        cin >> x >> y;
        int res = in_poly(pl, {x, y});
        if(res == 1) res++;
        else if(res == 2) res--;
        cout << res << endl;
    }
}


Measured memory_bytes: 3232
from bisect import bisect_left
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))

zero = bisect_left(x, 0)
rs = n-zero
ls = n-rs
ans = float("INF")

for i in range(min(k, rs)+1):
  if i==0:
    r = 0
  elif zero+i-1>n-1:
    continue
  else:
    r = x[zero+i-1]
  if i==k:
    l = 0
  elif zero-k+i<0:
    continue
  else:
    l = abs(x[zero-k+i])
  ans = min(ans, min(r*2+l, r+l*2))
print(ans)

Measured memory_bytes: 14480
def main():
    from sys import stdin, stdout

    def read():
        return stdin.readline().rstrip('\n')

    def read_array(sep=None, maxsplit=-1):
        return read().split(sep, maxsplit)

    def read_int():
        return int(read())

    def read_int_array(sep=None, maxsplit=-1):
        return [int(a) for a in read_array(sep, maxsplit)]

    def write(*args, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in args) + end)

    def write_array(array, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in array) + end)

    r, g, b, n = read_int_array()
    dp = [0]*(n+1)
    dp[0] = 1
    for c in [r, g, b]:
        for i in range(c, n+1):
            dp[i] += dp[i-c]
    write(dp[-1])

main()


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

using namespace std;

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

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

int main() {
  int n,sum = 0;
  cin >> n;
  vector<int>l(n);
  for(int i = 0;i < n;i++) cin >> l[i];
  sort(l.begin(),l.end());
  for(int i = 0;i < n-1;i++) sum += l[i];
  if(sum > l[n-1]) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String[] ary = n.split("");
        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n.length(); i++) {
            if (map.containsKey(ary[i])) {
                map.put(ary[i], map.get(ary[i]) + 1);
            } else {
                map.put(ary[i], 1);
            }
        }
        for (int cnt : map.values()) {
            if (cnt % 2 != 0) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}

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

int n, a[2][1000], sum[2][1000];
int ans;

int main(){
	scanf("%d", &n);
	for(int i = 0; i < 2; ++i)
		for(int j = 0; j < n; ++j){
		scanf("%d", &a[i][j]);
		sum[i][j] = a[i][j] + ((j == 0) ? 0 : sum[i][j-1]);
	}
	for(int i = 0; i < n; ++i){
		ans = max(ans, sum[0][i] + sum[1][n-1] - ((i == 0) ? 0:sum[1][i-1]));
	}
	printf("%d\n", ans);
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, M; cin >> N >> M;
    vector<vector<ll>> edge(N);
    rep(i, M){
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }

    bool flag = false;
    for (ll first: edge.at(0)){
        for (ll second: edge.at(first)){
            if (second == N - 1){flag = true; break;}
        }
    }
    string ans = flag ? "POSSIBLE" : "IMPOSSIBLE";
    cout << ans << endl;
}

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


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

int main() {
    long long s;

    cin >> s;

    cout << "0 0 1000000000 1 ";
    long long m = 1e+9;
    long long x = (m - s % m)% m;
    long long y = (s + x) / m;

    cout << x << " " << y << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
    ll n, k;
    cin>>n>>k;
    ll x[n];
    scan(x, 0, n);
    ll ans = 0;
    forn(i, 1, n+1){
        ans+=min(abs(x[i-1]), abs(k-x[i-1]));
    }
    cout<<ans*2<<endl;
}

Measured memory_bytes: 3580
#include <stdio.h>
 
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a==1)a=14;
  if(b==1)b=14;
  if(a>b)printf("Alice");
  else if(a==b)printf("Draw");
  else printf("Bob");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
#define N 100005
const ll INF = 1000000001;
const ll MOD = 998244353 ; //1e9+7;
 
using namespace std;
vector<int> adj[100001];
bool visited[100001];
int dp[100001];
void intialize(){
    for(int i=0;i<100001;i++){
        visited[i]=0;
    }
}
void dfs(int s){
    visited[s]=1;
    for(auto u:adj[s]){
        if(visited[u]==0){
            //dp[]
            dfs(u);
        }
        dp[s]=max(dp[s],1+dp[u]);
    }
    //int ans=INT_MIN;
   // for(int i=1;i<=n;i++){
        //ans=max(ans.dp[i]);
    //}
    //return ans;

}

int main() {
   int n,m,x,y,connected=0;
   cin>>n>>m;
   for(int i=0;i<m;i++){
   cin>>x>>y;
   adj[x].push_back(y);
   }
   intialize();
   for(int i=1;i<=n;i++){
       if(visited[i]==0){
           dfs(i);
           //connected++;
       }
   }
   int ans=INT_MIN;
    for(int i=1;i<=n;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;
  

}


Measured memory_bytes: 12244
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */
//codeforces
#include <bits/stdc++.h>
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
void parseArray(ll* A,ll n){ for ( ll K = 0; K < n; K++){ cin >> A[K]; } }
ll modInverse(ll a, ll b){ return 1<a ? b - modInverse(b%a, a)*b/a : 1; }
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
ld dist(ld x, ld y, ld a, ld b){ return sqrt((x-a)*(x-a) + (y-b)*(y-b)); }
void debug(ll* a, ll n) { for ( ll k = 0; k < n; k++ ){ cerr << a[k] << " ";} cout << "\n"; }
#define PI 3.14159265358979323846
#define FF first
#define SS second

const ll mod = 22801763489;
int main(){
	FASTIO;
	ll n; cin >> n;
	ll a[n]; parseArray(a, n);
	ll gcdd = a[0];
	bool flag = true;
	bool div[1111111]; memset(div, 0, sizeof div);
	for ( int k = 0; k < n; k++ ){
		gcdd = gcd(a[k], gcdd);
		if (!flag)
			continue;
		if (div[a[k]] && a[k] != 1)
			flag = false;
		div[a[k]] = true;
		for ( ll j = 2; j * j <= a[k]; j++ ){
			 if (a[k] % j == 0) {
			 	if (div[j])
					flag = false;
				div[j] = true;
				if (a[k] / j != j) {
					if (div[a[k] / j])
						flag = false;
					div[a[k] / j] = true;
				}
			}
		}
	}
	if (flag)
		return cout << "pairwise coprime\n", 0;
	if (gcdd == 1)
		return cout << "setwise coprime\n", 0;
	cout << "not coprime\n";
	return 0;
}

Measured memory_bytes: 12444
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
using namespace std;

int main() {
	double n,a; cin >> n>>a;
	double ans = (n + a) / 2;
	cout << ceil(ans) << endl;
	return 0;
}

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

int main(){
  int N, K;
  vector<int> p(200010);
  vector<double> sum(200010, 0);

  cin >> N >> K;
  for(int i=1; i<=N; i++){
    cin >> p[i];
    sum[i] = sum[i-1] + (p[i]+1)/2.0;
  }

  double ans = 0;
  for(int i=K; i<=N; i++){
    ans = max(ans, sum[i] - sum[i-K]);
  }

  cout << setprecision(10);
  cout << ans << endl;; 
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int k;
string p[12525];
int cnt[26];

int main(){
  cin>>n>>k;
  REP(i,n)cin>>p[i];
  REP(i,n)cnt[p[i][0]-'A']++;
  int ans=0;
  while(true){
    sort(cnt,cnt+26);
    reverse(cnt,cnt+26);
    bool flag=true;
    REP(i,k){
      if(cnt[i]==0){
        flag=false;
        break;
      }
      cnt[i]--;
    }
    if(flag)ans++;
    else break;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
n = int(input())
x = list(map(int, input().split()))
index = []
for i, v in enumerate(x):
    index.append((i, v))
index.sort(key=lambda x: x[1])
ans = [0] * n
for i, w in enumerate(index):
    if i <= n//2 - 1:
        ans[w[0]] = index[n//2][1]
    else:
        ans[w[0]] = index[n//2 - 1][1]

print("\n".join(map(str, ans)))



Measured memory_bytes: 49344