akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

int H,W,A,B;
class FermatCombination {
private:
    long long factrial[201010]; //階乗を保持
    long long inverse[201010];  //逆元を保持
    long long MOD;

public:
    FermatCombination(int size, long long mod);
    long long combine(int n, int k);
    long long fast_pow(long long x, int n);
};


FermatCombination::FermatCombination(int size, long long mod) {

    MOD = mod;

    factrial[0] = 1;
    inverse[0] = 1;

    for (int i = 1; i <= size; i++) {
        factrial[i] = (factrial[i - 1] * i) % MOD;  //階乗を求める
        inverse[i] = fast_pow(factrial[i], (int) MOD - 2) % MOD; // フェルマーの小定理で逆元を求める
    }
}

long long FermatCombination::combine(int n, int k) {
    return factrial[n] * inverse[k] % MOD * inverse[n - k] % MOD;
}

long long FermatCombination::fast_pow(long long x, int n) { //x^n 計算量O(logn)
    long long ans = 1;
    while (n > 0) {
        if ((n & 1) == 1) {
            ans = ans * x % MOD;
        }
        x = x * x % MOD; //一周する度にx, x^2, x^4, x^8となる
        n >>= 1; //桁をずらす n = n >> 1
    }
    return ans;
}

ll ans;

int main() {
    cin>>H>>W>>A>>B;
    FermatCombination fc(200010, mod);//初期化 と nCi % mod の計算
    REP(i,B+1,W+1){
        ans += fc.combine(H-A-1+i-1,i-1) * fc.combine(A-1+W-i,A-1); //nCr % modの値の取得
        ans %= mod;
    }
    p(ans);

    return 0;
}

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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    vector<pair<ll, ll>> C(N);
    rep(i, N) {
        cin >> A[i] >> B[i];
        C[i] = make_pair(- A[i] - B[i], A[i]);
    }
    sort(C.begin(), C.end());
    ll Ta = 0, Ao = 0;
    rep(i, N) {
        if (i & 1) Ao += - C[i].first - C[i].second;
        else Ta += C[i].second;
    }
    cout << Ta - Ao << "\n";
}

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

int sumlen(int a){
  int ret = 0;
  while(a!=0){
    ret += a%10;
    a /= 10;
  }
  return ret;
}
int main(){
  int n;cin>>n;
  int ans = 1e8;
  for (int i=1;i<=n/2;i++){
    ans = min(ans,sumlen(i)+sumlen(n-i));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s,an;
int n;
void dfs(int x){
  int t=0;
  for(int i=x,c=0;i<s.size()&&0<=c;i++){
    if(s[i]=='('){
      while(!c&&t>0&&t--&&an.size()<=n)dfs(i+1);
      c++;
    }
    if(s[i]==')')c--;
    if(!c&&'0'<=s[i]&&s[i]<='9')t*=10,t+=s[i]-'0';
    if(!c&&'A'<=s[i]&&s[i]<='Z')an+=s[i];
  }
}

int main(){
  while(cin>>s>>n&&s[0]!='0'){
    an.clear();
    for(int i=0;i<s.size();i++)
      if('0'<=s[i]&&s[i]<='9'&&'A'<=s[i+1]&&s[i+1]<='Z')
    	s=s.substr(0,i+1)+'('+s[i+1]+')'+s.substr(i+2,s.size());
     dfs(0);
    if(an.size()>n)cout<<an[n]<<endl;
    else cout<<0<<endl;
  }
  return 0;
}

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

int main(){
  int A,B,C,X,Y;  cin >> A >> B >> C >> X >> Y;
  long long min = 1LL << 60;
  for(int c=0;;c = c + 2){
    int a = X - c/2;
    int b = Y - c/2;
    if(a < 0 && b < 0)  break;
    if(a < 0) a = 0;
    if(b < 0) b = 0;
    if(min > a*A + b*B + c*C){
      min = a*A + b*B + c*C;
    }
  }
  cout << min << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

ll arr[5001];

void sum_arr(int pos, long long a[], int s, ll sum){
	if(pos == s) return;
	else{
		sum_arr(pos+1, a, s, sum);
		if(sum+a[pos] <= 5000){
			++arr[sum+ a[pos]];
			sum_arr(pos+1, a, s, sum + a[pos]);
		}
	}
}

int main() {
	ll n, p, ans=0, l=0, s=0, tmp;
	cin >> n >> p;
	REP(i, 0, n){
		cin >> tmp;
		if(tmp % 2 == 0) ++s;
		else ++l;
	}
	
	if(p == 0){
		if(l > 0) ans = pow(2, n-1);
		else ans = pow(2, n);
	}
	else{
		if(l > 0 ) ans = pow(2, n-1);
		else ans = 0;
	}
	cout << ans;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
pair<int,int> pii;
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fastio() ios::sync_with_stdio(0);cin.tie(0);
#define nl "\n"
#define wi(x) cerr << #x << " is " << x << nl

void solve(){
	int x,y; cin>>x>>y;
	if(y&1){cout<<"No";return;}
	int t = y/2 - x;
	int c = (2*x)-y/2;
	if(c >=0 && t>=0) cout<<"Yes";
	else cout<<"No";
}

int main(){
	fastio()
	
	int T = 1; //cin>>T;
	while(T--)solve();

	return 0;
}


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

int main() {
	int a,b;
	scanf("%d%d",&a,&b);
	int A = 0, B = 0;
	for (int i = 0; i < a; i++) {
		A = A + b * pow(10, i);
	}
	for (int i = 0; i < b; i++) {
		B = B + a * pow(10, i);
	}
	if (a<=b) {
		printf("%d",B);
	}
	else {
		printf("%d",A);
	}
	return 0;
}

Measured memory_bytes: 128
n = int(input())
d = {}
for _ in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1

sorted_d = sorted(d.items(), key=lambda x:x[1], reverse=True)
ma = sorted_d[0][1]

res = []

for i in range(len(sorted_d)):
    if sorted_d[i][1] == ma:
        res.append(sorted_d[i][0])

res.sort()

for i in range(len(res)):
    print(res[i])

Measured memory_bytes: 45788
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <functional>
#include <unordered_set>
using namespace std;

int main(void) {
    char A[102] = {};
    cin >> A;
    for(int i=0; i<3; ++i)
    {
        cout << A[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3624
N = int(input())
P = list(map(int, input().split()))

cnt = 0
ans = 0
t = 'o' if P[0] == 1 else 'x'
for i, p in enumerate(P):
    s = 'o' if p == (i + 1) else 'x'
    if s == t:
        cnt += 1
    else:
        if t == 'o':
            ans += (cnt + 2 - 1) // 2
        cnt = 1
        t = s
else:
    if t == 'o':
        ans += (cnt + 2 - 1) // 2

print(ans)


Measured memory_bytes: 14008
import java.util.Scanner;

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

        if (n%k == 0) System.out.println(0);
        else System.out.println(1);
    }
}


Measured memory_bytes: 35744
import java.util.*;
import java.lang.*;
 
 //O(100000000)
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);
        long X = Long.parseLong(sc.next());
        long Y = Long.parseLong(sc.next());
        long Z = Long.parseLong(sc.next());


        System.out.print( (X-Z)/(Y+Z));
        System.out.println();
    }

}



Measured memory_bytes: 22228
#include<stdio.h>
#include<string.h>
int main()
{
    char s[30];
    int ln,x,y,z=1;
    scanf("%s",s);
    ln=strlen(s);
    for(x=0; x<ln; x++)
    {
        for(y=x+1; y<ln; y++)
        {
            if(s[x]==s[y])
            {
                z=0;
                break;
            }
        }
    }
    if(z==0)
        printf("no\n");
    else if(z==1)
        printf("yes\n");

    return 0;
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int,input().split()))

MX = 8
R = [0] * 9

for a in A:
  if 1 <= a < 400:
    R[0] += 1
  elif 400 <= a < 800:
    R[1] += 1
  elif 800 <= a < 1200:
    R[2] += 1
  elif 1200 <= a < 1600:
    R[3] += 1
  elif 1600 <= a < 2000:
    R[4] += 1
  elif 2000 <= a < 2400:
    R[5] += 1
  elif 2400 <= a < 2800:
    R[6] += 1
  elif 2800 <= a < 3200:
    R[7] += 1
  elif 3200 <= a:
    R[8] += 1

cnt = 0
for i in range(8):
  if R[i]:
    cnt += 1

el = R[8]
print(max(cnt,1),cnt+el)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int maxn = 2e5 + 5;

map <int, bool> mp[maxn];

vector <int> v[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	int h, w, n;
	cin >> h >> w >> n;
	for (int i = 0; i < n; i++){
		int x, y;
		cin >> x >> y;
		mp[y][x] = 1;
		v[y].push_back(x);
	}
	for (int i = 1; i <= w; i++){
		sort(v[i].begin(), v[i].end());
		v[i].push_back(h + 1);
	}
	int ans = h, last = 0;
	for (int i = 1; i <= w; i++){
		int idx = last + 1;
		for (; idx <= h + 1; idx++){
			if (!mp[i].count(idx)){
				last = idx;
				break;
			}
		}
		idx = lower_bound(v[i].begin(), v[i].end(), last) - v[i].begin();
		ans = min(ans, v[i][idx] - 1);
	}
	cout << ans << endl;
}


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

int main(){
  int N;
  cin>>N;
  vector<int> dp(1000005);
  dp.at(0)=0;
  for(int i=1;i<=N;++i){
    int s=0,t=0;
    int next_dp=N;
    while(pow(6,s+1)<=i){
      next_dp=min(next_dp,dp.at(i-pow(6,s)));
      ++s;
    }
    while(pow(9,t+1)<=i){
      next_dp=min(next_dp,dp.at(i-pow(9,t)));
      ++t;
    }
    dp.at(i)=min(next_dp,min(dp.at(i-pow(6,s)),dp.at(i-pow(9,t))))+1;
  }

  cout<<dp.at(N)<<endl;
}


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

using ll = long long;
using pii = pair<int, int>;
constexpr int M = 1e9 + 7;
constexpr int INF = 1e9;

int main() {
    string s;
    cin >> s;
    int const n = s.size();
    vector<int> state(n + 1);
    for(int i = 0; i < n; ++i) {
        state[i + 1] = state[i] ^ (1 << (s[i] - 'a'));
    }

    vector<int> dp2(1 << 26, INF);
    vector<int> dp(n + 1, INF);
    dp[0] = dp2[0] = 0;
    for(int i = 0; i < n; ++i) {
        dp[i + 1] = dp2[state[i + 1]];
        for(int j = 0; j < 26; ++j) {
            int jj = state[i + 1] ^ (1 << j);
            dp[i + 1] = min(dp[i + 1], dp2[jj] + 1);
        }
        dp2[state[i + 1]] = min(dp2[state[i + 1]], dp[i + 1]);
    }
    if(dp[n] == 0) {
        cout << dp[n] + 1 << endl;
    } else {
        cout << dp[n] << endl;
    }
}


Measured memory_bytes: 264452
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
   string s;
	cin>>s;
	ll l=s.size();
	
    ll half=l/2,c=0;
	
	for(ll i=0;i<half;i++)
	 {
	 	if(s[i]!=s[l-i-1])
	 	  c++;
	 	else 
	 	continue;
		 }	
 	cout<<c<<endl;
 	
 }
 
 

Measured memory_bytes: 256
//abc106_c.cpp
//Sat Aug 18 19:56:05 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	string s;
	cin >> s;
	ll k;
	cin >> k;

	int onenum = 0;
	char thenum = 0;
	for (int i=0;i<s.size();i++){
		if (s[i] == '1'){
			onenum++;
		}else {
			thenum = s[i];
			break;
		}
	}

	if (k<=onenum){
		cout << 1 << endl;
	}else{
		cout << thenum << endl;
	}
}

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

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))

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

template <class T> inline T gcd(T a, T b) { while (b) { a = a%b; swap(a, b); } return a; }




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

	string s;
	cin >> s;

	string res;

	for (int i = 0; i < s.size(); i++)
	{
		if (res == "")
		{
			res.push_back(s[i]);
		}
		else
		{
			char last = res[res.size() - 1];

			if (last == s[i])
			{
				res.push_back(s[i]);
			}
			else
			{
				res.pop_back();
			}
		}
	}

	cout << s.size() - res.size() << endl;
	

	return 0;
}


Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<"\n"

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

  // dp[i][j] = i枚目まで投げたとき、表の枚数がj枚になる確率
  vector<vector<double>> dp(N+1, vector<double>(N+1, 0.0));
  dp[0][0] = 1.0;
  REP(i, N) {
    double p;
    cin >> p;
    REP(j, N) {
      dp[i+1][j+1] += dp[i][j] * p;
      dp[i+1][j] += dp[i][j] * (1.0 - p);
    }
  }
  double ans = 0;
  REP(i, N) {
    if (N - i < i)
      break;
    ans += dp[N][N-i];
  }
  OUT(fixed << setprecision(11) << ans);

  return 0;
}


Measured memory_bytes: 70656
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((int64_t *)a) < *((int64_t *)b) ? -1 : 1;
}

int compare_f2(const void *a, const void *b) {
	return *((uint64_t *)a) > *((uint64_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
	uint64_t result = 1;

	for (uint64_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

int main(void) {
	size_t A, B, C;

	scanf("%zu %zu %zu", &A, &B, &C);

	if (C <= A + B + 1) {
		printf("%zu", B + C);
	}
	else {
		printf("%zu", A + 2 * B + 1);
	}

	return 0;
}


Measured memory_bytes: 128
/*
 * 2417.cc: Flick Input
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

char bs[] = {'w', '-', 'k', 's', 't', 'n', 'h', 'm', 'y', 'r'};

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  string s;
  cin >> s;
  int n = s.size();

  map<char,char> ss;
  ss['T'] = 'a';
  ss['L'] = 'i';
  ss['U'] = 'u';
  ss['R'] = 'e';
  ss['D'] = 'o';
  
  for (int i = 0; i < n; i += 2) {
    if (s[i] == '0' && s[i + 1] == 'U') cout << "nn";
    else if (s[i] == '1') cout << ss[s[i + 1]];
    else cout << bs[s[i] - '0'] << ss[s[i + 1]];
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

int main() {
	int n, m;
	while (cin >> n >> m && n + m) {
		vector<pair<int,int> > pd(n);
		int ans = 0;
		for (int i = 0; i < n; ++i) {
			cin >> pd[i].second >> pd[i].first;
			ans += pd[i].first * pd[i].second;
		}
		sort(pd.begin(), pd.end(), greater<pair<int, int> >());
		int tmp = 0;
		while (m--) {
			if (pd[tmp].second == 0) tmp++;
			if(tmp >= n) break;
			ans -= pd[tmp].first; pd[tmp].second--;
		}
		cout << ans << endl;
	}
	
	return 0;
}


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

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

  ll n,k;
  cin >> n >> k;

  ll ans = 0;
  for(ll b = k + 1; b <= n; b++) {
    ll p = n / b;
    ll r = n % b;
    ans += max(b - k, 0ll) * p;
    ans += max(r - k + 1ll, 0ll);
  }

  if (k == 0) {
    ans -= n;
  }

  cout << ans << endl;
}


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

//Optimizations
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//save time
#define endl '\n'
#define db(x) cerr << "> " << #x << ": " << x << endl
typedef long long ll;

//for sorting
#define all(a) a.begin(),a.end()

//Constants
#define PI   3.141592653593
#define MOD  1000000007LL
#define EPS  0.000000001
#define INF  0X3f3f3f3f

//loops
#define REP(i,n)      for(int i=0;i<(n);++i)
#define FOR(i,a,b)      for(int i=(a);i<(b);++i)
#define DFOR(i,a,b)     for(int i=(a);i>=(b);--i)

//vectors
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<int,int>>
#define vlll vector<pair<ll,ll>>
#define pb  push_back
#define vb vector<bool>

//pairs
#define pi pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define F first
#define S second

//fast I/O
#ifndef _WIN32
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
#define gc getchar
#define pc putchar

//If using cin and cout
#define IOS ios::sync_with_stdio(false)
#define TIE cin.tie(NULL);cout.tie(NULL)

//queue
#define di deque<int>
#define dll deque<ll>
#define qi queue<int>
#define PQ priority_queue

//general
#define E empty()

const int MAXN=0;

int main(){

    int n ; cin >> n ;
    vi ar(n);
    REP(i,n)
        cin >> ar[i];
    int res = 0;
    sort(all(ar));
    REP(i, n){
        FOR(j ,i+1, n){
            FOR(k,j+1, n){
              
                if(ar[i]+ar[j] > ar[k] && ar[i]!=ar[j] && ar[j]!= ar[k] && ar[k] != ar[i])
                    res++;
            }
        }
    }
    cout << res << endl;

}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		int n = s.length();
		int count = 0;
		for (int i = 0; i < n / 2; i++) {
			if (s.charAt(i) != s.charAt(n - 1 - i))
				count++;
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 25684
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Split(' ');
            int iN = int.Parse(sS[0]);
            int iM = int.Parse(sS[1]);
            int iX = int.Parse(sS[2]);
            sS = Console.ReadLine().Split(' ');
            List<int> lstM = new List<int>();
            for (int i = 0; i < sS.Length; i++) { lstM.Add(int.Parse(sS[i])); }


            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            List<int> lstC = new List<int>() { 0, 0 };
            for (int i = 000001; i < iX; i++) { if (lstM.Contains(i)) { lstC[0] += 1; } }       // 先頭からXまで
            for (int i = iX + 1; i < iN; i++) { if (lstM.Contains(i)) { lstC[1] += 1; } }       // Xから末尾まで
            lstC.Sort();                                                                        // 小さい方

            // 出力
            Console.WriteLine("{0}", lstC[0].ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13268
import sys

n = int(sys.stdin.readline().rstrip())
s = sys.stdin.readline().rstrip()

def main():
    l = 0
    r = s.count('E')
    res = r
    for i in range(n):
        cur = s[i]
        if cur == 'E':
            r -= 1
        res = min(res, l + r)
        if cur == 'W':
            l += 1
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3700
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	while(1){
		long q;
		scanf(" %ld", &q);
		if(q==-1) break;
		
		double x=q/2.0;
		while( fabs(x*x*x-q) >= q*pow(10,-5) ){
			x = x-(x*x*x-q)/(3*x*x);
			//printf("now:%lf\n", x);
		}
		
		printf("%lf\n", x);
	}
	
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 405;
const int MOD = 1e9+7;
const ll  INF = 4557430888798830399LL;
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

ll dp[MX][MX],ac[MX];

ll solve_dp(int L, int R) {
    if (L == R) return 0LL;

    ll& res = dp[L][R];
    if (res != -1) return res;

    res = INF;
    FOR(i,L,R+1) {
        res = min(res,solve_dp(L,i)+solve_dp(i+1,R));
    }

    res += (ac[R]-ac[L-1]);
    return res;
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    memset(dp,-1,sizeof dp);

    int N; cin >> N;

    FOR(i,1,N+1) {
        ll x; cin >> x; ac[i] = ac[i-1]+x;
    }

    cout << solve_dp(1,N) << "\n";

}


Measured memory_bytes: 1536
#include <iostream>
#include <vector> 
#include <algorithm>
using namespace std;
int main(void){
    long long int n,max=0,sum=0,ans=1000000000000;
    cin>>n;
    vector<long long int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        max+=a[i];
    }
    for(int i=0;i<n;i++){
        sum+=a[i];
        if(ans>abs(max-2*sum)&&i+1<n)ans=abs(max-2*sum);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

const int MOD = 998244353;

int main() {
    int N,S; cin >> N >> S;
    vector<ll> A(N);
    REP(i,N){
        cin >> A[i];
    }
    vector<vector<ll>> dp(N+1,vector<ll>(S+1,0));
    dp[0][0] = 1;
    REP(i,N){
        REP(j,S+1){
            dp[i+1][j] += 2*dp[i][j];
            dp[i+1][j] %= MOD;

            if(j+A[i] <= S){
                dp[i+1][j+A[i]] += dp[i][j];
                dp[i+1][j+A[i]] %= MOD;
            }
        }
    }
    
    cout << dp[N][S] << endl;

    return 0;
}

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

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

	int ans = 0;
	if (N % 2 == 1)
	{
		cout << ans << endl;
		return 0;
	}

	vector<int> vec(N);
	for (auto& v : vec)
	{
		cin >> v;
	}
	sort(vec.begin(), vec.end());
	ans = vec[N / 2] - vec[N / 2 - 1];

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


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

    int n;
    while(cin>>n){
        if(n==0)break;
        char tile[1000];
        int dp[2][1000];
        int most = 0;
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                cin>>tile[j];
                if(tile[j]=='.')dp[1][j] = 1;
                else dp[1][j] = 0;
                if(dp[1][j]!=0&&i!=0&&j!=0){
                    int least = n;
                    int x=dp[1][j-1],y=dp[0][ j ],z=dp[0][j-1];
                    x<y ? (x<z ? least = x : least = z) : (y<z ? least = y : least = z);
                    dp[1][j] = least + 1;
                }
                if(dp[1][j] > most)most = dp[1][j];
            }
            for(int j=0;j<n;j++)dp[0][j] = dp[1][j];
        }
        cout<<most<<endl;
    }
    return 0;
}

Measured memory_bytes: 1168
n,m = gets.chomp.split(' ').map(&:to_i)
hoge = []
fuga = []
m.times do
  a,b = gets.chomp.split(' ').map(&:to_i)
  if (a == 1)
    hoge << b
  elsif (b == n)
    fuga << a
  end
end
puts (hoge & fuga).length > 0 ? 'POSSIBLE' : 'IMPOSSIBLE'

Measured memory_bytes: 9832
import java.util.Scanner;

public class Main {
	static final double ESP = 0.0000000001;
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int Q = in.nextInt();
		long[][] obs = new long[N][5];
		for(int i=0;i<N;i++){
			for(int j=0;j<5;j++){
				obs[i][j] = in.nextLong();
			}
		}
		
		for(int k=0;k<Q;k++){
			long ans = 0;
			int[] start = {in.nextInt(),in.nextInt(),in.nextInt()};
			int[] goal = {in.nextInt(),in.nextInt(),in.nextInt()};
			for(int i=0;i<N;i++){
//				System.out.println("l: "+obs[i][3]*obs[i][3]);
				if(dis_p2(start,goal,obs[i]) < obs[i][3]*obs[i][3]+ESP){
					ans += obs[i][4];
				}
			}
			System.out.println(ans);
		}
	}
	
	public static double dis_p2(int[] s,int[] g,long[] p){
		double[] h = new double[3];
		long[] sg = {g[0]-s[0],g[1]-s[1],g[2]-s[2]};
		long[] sp = {p[0]-s[0],p[1]-s[1],p[2]-s[2]};
		double exp = ((double)(sg[0]*sp[0] + sg[1]*sp[1] + sg[2]*sp[2]))
				/ (sg[0]*sg[0] + sg[1]*sg[1] + sg[2]*sg[2]);
		if(exp<0 || exp>1) return Double.MAX_VALUE;
		h[0] = s[0] + exp*sg[0];
		h[1] = s[1] + exp*sg[1];
		h[2] = s[2] + exp*sg[2];
/*		System.out.println("dis: "+(Math.pow(h[0]-p[0],2)
		+Math.pow(h[1]-p[1],2)
		+Math.pow(h[2]-p[2],2)));*/
		return Math.pow(h[0]-p[0],2)
				+Math.pow(h[1]-p[1],2)
				+Math.pow(h[2]-p[2],2);
	}
}

Measured memory_bytes: 27380
#import math

listc = [0]*1001
cnt = [0]*1001
n = 0

while True:
    try:
        c, d = list(map(int, input().split(',')))
    except:
        break
    listc[c] = 1
    cnt[c] += 1

while True:
    try:
        c, d = list(map(int, input().split(',')))
    except:
        break
    if listc[c] == 1:
        listc[c] = 2
    cnt[c] += 1

for c in range(1,1001):
    if listc[c] == 2:
        print(c,cnt[c])



Measured memory_bytes: 5612
import numpy as np

a, b, x = list(map(int, input().split()))

xlim = a*b/2*a
if x<xlim:
    theta = np.arctan(a*b*b/2/x)/np.pi*180
else:
    theta = np.arctan(2*(a*a*b-x)/a**3)/np.pi*180

print(theta)

Measured memory_bytes: 13668
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	int firstC=0,Flast=0,k=0;
	getline(cin,a);
	for(int i=0;i<a.size();i++){
	    if(a[i]=='C')
	    	k=1;
	    if(a[i]=='F'&&k==1){
	    	cout<<"Yes";
	    	return 0;
	    }
	}
	cout<<"No";
	return 0;
}


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

int main()
{
   int x,n;
   cin>>x>>n;
   vector<int>v;
   for(int i = 0 ; i < n ; i++)
   {
       int temp;
       cin>>temp;
       v.push_back(temp);
   }
   int near = x, index;
   sort(v.begin(),v.end());
   vector<int>::iterator it,it1,it2;
   it = find(v.begin(), v.end(), x); 
   if( it != v.end())
   {
       int less = x-1 , more = x+1;
       int index = it - v.begin();
       // cout<<index<<endl;
       while(true)
       {    
           // cout<<less<<" "<<more<<endl;
           it1 = find(v.begin(),v.begin()+index , less);
           it2 = find(v.begin() + index + 1 ,v.end() , more);
           // cout<<(it1 - v.begin())<<" "<<(it2 - v.begin())<<endl;
           if((it1 - v.begin()) == index && it2 == v.end())
           {
               cout<<less<<endl;
               break;
           }
           else if((it1 - v.begin()) == index)
           {
               cout<<less<<endl;
               break;
           }
           else if(it2 == v.end())
           {
               cout<<more<<endl;
               break;
           }
           less--;
           more++;
       }
   }
    else
        cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(void) {
	int n, a, b;
	cin >> n >> a >> b;
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		int num = 0;
		int t = i;
		for (int j = 0; j < 5; j++) {
			num += t % 10;
			t /= 10;
		}
		if (a <= num && num <= b) {
			sum += i;
		}
	}
	cout << sum;
	return 0;
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

int main(){
  int N, H;
  cin >> N >> H;
  vector<int>a(N);
  vector<int>b(N);
  int furi = -1;
  REP(i, N){
    cin >> a.at(i);
    furi = max(furi, a.at(i));
    cin >> b.at(i);
  }
  sort(all(b));
  reverse(all(b));
  
  ll cnt = 0;

  REP(i, N){
    if(furi < b.at(i)) {
      H -= b.at(i);
      cnt++;
    }
    if(H <= 0){
      print(cnt);
      return 0;
    }
  }
cnt += (H + (furi - 1)) / furi;
print(cnt);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5;
struct node
{
    int mode,va,p;
};
node d[maxn<<1];
    int c,r,n;
int calc(int x,int y)
{
    if(y==0)return x;
    else if(x==r)return  r+y;
    else if(y==c)return r+c+r-x;
    else if(x==0)return r+r+c+c-y;
    else return -1;
}
vector<node>a;
bool cmp(node x,node y)
{
    return x.va<y.va;
}
stack<int>s;
int main()
{
    int x1,y1,x2,y2;
    scanf("%d%d%d",&r,&c,&n);
    for(int i=0;i<n;++i)
    {
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        int t1=calc(x1,y1);
        int t2=calc(x2,y2);
        if(t1==-1||t2==-1)continue;
        if(t1>t2)swap(t1,t2);
        a.push_back({1,t1,t2});
        a.push_back({2,t2,t1});
    }
    sort(a.begin(),a.end(),cmp);
    for(int i=0;i<a.size();++i)
    {
        if(a[i].mode==1)
        {
            s.push(a[i].p);
        }
        else if(s.top()==a[i].va)
            s.pop();
        else
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 4980
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
ll mod = 1e9 + 7;

int A, B;
//int x[111];
ll coudp[111][111][5555];
string divide[4] = { "dream","dreamer","erase","eraser" };
int N;
int x[10], y[10];

double dist(int i, int j)
{
	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	return pow(dx * dx + dy * dy, 0.5);
}
void solve()
{
	cin >> N;
	for (int i = 1; i <= N; i++)cin >> x[i] >> y[i];
	double sum = 0.0;
	vector<int> v(N);
	for (int i = 0; i < N; i++)
	{
		v[i] = i + 1;
	}
	do
	{
		for (int i = 0; i < N - 1; i++)
			sum += dist(v[i], v[i + 1]);
	} while (next_permutation(v.begin(), v.end()));
	int Factorial = 1;
	for (int i = 2; i <= N; i++)
	{
		Factorial *= i;
	}
	cout << fixed << setprecision(10) << sum / Factorial << endl;
	return;
}

int main()
{
	int N, M;
	cin >> N >> M;
	vector<vector<char>> A(200, vector<char>(200));
	vector<vector<char>> B(M, vector<char>(M));
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			cin >> A[i][j];
		}
	}
	for (int i = 0; i < M; i++)
	{
		for (int j = 0; j < M; j++)
		{
			cin >> B[i][j];
		}
	}
	bool can = false;
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			if (A[i][j] != B[0][0])continue;
			bool can2 = true;
			for (int k = 0; k < M; k++)
			{
				for (int l = 0; l < M; l++)
				{
					if (A[i + k][j + l] != B[k][l])
					{
						can2 = false;
					}
				}

			}
			if (can2)can = true;
		}
	}

	if (can)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define p 1000000007;

int main() {
	
	ll n,m;
	cin>>n>>m;
	char a[n][m];
	ll ans[n][m];
	for(ll i=0;i<n;i++)
	{
	    for(ll j=0;j<m;j++)
	    {
	        cin>>a[i][j];
	    }
	}
	ans[0][0]=0;
	for(ll i=0;i<n;i++) ans[i][0]=0;
	for(ll j=0;j<m;j++) ans[0][j]=0;
	for(ll i=1;i<n;i++)
	{
	    if(a[i][0]=='#') break;
	    ans[i][0]=1;
	}
	for(ll j=0;j<m;j++)
	{
	    if(a[0][j]=='#') break;
	    ans[0][j]=1;
	}
	for(ll i=1;i<n;i++)
	{
	    for(ll j=1;j<m;j++)
	    {
	        if(a[i][j]=='#') ans[i][j]=0;
	        else ans[i][j]=ans[i-1][j]+ans[i][j-1];
	        ans[i][j]=ans[i][j]%p;
	    }
	}
	cout<<ans[n-1][m-1]<<endl;
	
	return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const string sss = "diverta";

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

    ll n, k;
    cin >> n >> k;
    ll res = n - k + 1;
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {
	double R;
	cin >> R;
	cout <<2* R * 3.141592 << endl;
}



Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int n;
	cin>>n;
	int ans=0;
	if(n>=400 && n<=599)
	    ans=8;
	else if(n>=600 && n<=799)
	    ans=7;
	    else if(n>=800 && n<=999)
	    ans=6;
	    else if(n>=1000 && n<=1199)
	    ans=5;
	    else if(n>=1200 && n<=1399)
	    ans=4;
	    else if(n>=1400 && n<=1599)
	    ans=3;
	    else if(n>=1600 && n<=1799)
	    ans=2;
	    else if(n>=1800 && n<=1999)
	    ans=1;
	 cout<<ans<<endl;
}


Measured memory_bytes: 3632
n, k = map(int, input().split())
x = list(map(int, input().split()))
num = 1000000000


def cal_num(a, b):
    if x[a] * x[b] < 0:
        return min(abs(x[a]), abs(x[b])) * 2 + max(abs(x[a]), abs(x[b]))
    else:
        return max(abs(x[a]), abs(x[b]))

for i in range(n-k+1):
    c = cal_num(i, i+k-1)
    if num >= c:
        num = c

print(num)


Measured memory_bytes: 14512
using System;

namespace AOJ.Volume1
{
    public class TrackAndFieldCompetition
    {
        public static int Main()
        {
            // 各レース3位の中での上位2名
            int no_1 = 0, no_2 = 0;
            double tm_1 = double.MaxValue, tm_2 = double.MaxValue;

            for (int r = 0; r < 3; r++)
            {
                // レース内での1位?3位
                int f_no = 0, s_no = 0, t_no = 0;
                double f_tm = double.MaxValue;
                double s_tm = double.MaxValue;
                double t_tm = double.MaxValue;
                for (int n = 0; n < 8; n++)
                {
                    var input = Console.ReadLine().Split(' ');
                    int tmp_no = int.Parse(input[0]);
                    double tmp_time = double.Parse(input[1]);
                    // 入力と3位の比較
                    if (tmp_time < t_tm)
                    {
                        t_no = tmp_no;
                        t_tm = tmp_time;
                    }
                    // 3位と2位を比較
                    if (t_tm < s_tm)
                    {
                        // 入れ替え
                        tmp_no = s_no;
                        tmp_time = s_tm;
                        s_no = t_no;
                        s_tm = t_tm;
                        t_no = tmp_no;
                        t_tm = tmp_time;
                    }
                    // 2位と1位を比較
                    if (s_tm < f_tm)
                    {
                        tmp_no = f_no;
                        tmp_time = f_tm;
                        f_no = s_no;
                        f_tm = s_tm;
                        s_no = tmp_no;
                        s_tm = tmp_time;
                    }
                }
                // 1位と2位を出力
                Console.WriteLine(string.Format("{0} {1:N2}", f_no, f_tm));
                Console.WriteLine(string.Format("{0} {1:N2}", s_no, s_tm));
                // 3位同士の比較
                if (t_tm < tm_2)
                {
                    no_2 = t_no;
                    tm_2 = t_tm;
                }
                if (tm_2 < tm_1)
                {
                    int tmp_no = no_1;
                    double tmp_tm = tm_1;
                    no_1 = no_2;
                    tm_1 = tm_2;
                    no_2 = tmp_no;
                    tm_2 = tmp_tm;
                }
            }
            // 3位の出力
            Console.WriteLine(string.Format("{0} {1:N2}", no_1, tm_1));
            Console.WriteLine(string.Format("{0} {1:N2}", no_2, tm_2));

            return 0;
        }
    }
}

Measured memory_bytes: 9188
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
ll n,k;
ll a[210000];
ll cntmtk(ll l,ll r,ll z){ //k以上の要素の個数
  ll lb=l-1,ub=r+1;
  while(ub-lb>1){
    ll mid=(lb+ub)/2;
    if(a[mid]>=z) ub=mid;
    else lb=mid;
  }
  return n-ub;
}

ll cntltk(ll l,ll r,ll z){ //k以下の要素の個数
  ll lb=l-1,ub=r+1;
  while(ub-lb>1){
    ll mid=(lb+ub)/2;
    if(a[mid]<=z) lb=mid;
    else ub=mid;
  }
  return lb+1;
}

bool C(ll x){
  ll cnt = 0;
  ll cnt2=0;
  rep(i,n){
    if(x>=0){
      if(a[i]>0) cnt += cntltk(0,n-1,x/a[i]);      
      else if(a[i]<0) cnt += cntmtk(0,n-1,x/a[i]);      
      else cnt += n;
    }
    else{
      if(a[i]>0) cnt += cntltk(0,n-1,(x-a[i]+1)/a[i]);      
      else if(a[i]<0) cnt += cntmtk(0,n-1,(x+a[i]+1)/a[i]);      
    }
    if(a[i]*a[i]<=x) cnt2++;
  }
  return (cnt-cnt2)/2>=k;
}
ll upper(ll l,ll r){//条件を満たす中で最小のものを返す
  ll lb=l-1,ub=r+1;
  while(ub-lb>1){
    ll mid=(lb+ub)/2;
    if(C(mid)) ub=mid;
    else lb=mid;
  }
  return ub;
}

int main()
{
  cin >> n >> k;
  rep(i,n) cin >> a[i];

  sort(a,a+n);
  
  ll in=-1e+18;
  ll ax=1e+18;;
  cout << upper(in,ax) << "\n";
  
  return 0;
}


Measured memory_bytes: 1792
N = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))

maxim = 0
for i in range(N):
    count = 0
    count += sum(a1[:i+1]) + sum(a2[i:])
    if count > maxim:
        maxim = count
print(maxim)

Measured memory_bytes: 9136
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない


int main() {

	int i, t = 1;
	cin >> i;

	while (1) {
		if (i == 4||i==2||i==1) {
			cout << t + 3 << endl;
			return 0;
		}
		if (i % 2 == 0) i /= 2;
		else i = i * 3 + 1;

		t++;
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;

int beki(int M){
    int a = 1;
    rep(i,M){
        a *= 2;
    }
    return a;
}


int main(){
  int N,M; cin >> N >> M;
  int ans = beki(M) * (1800 * M + 100 * N);
  cout << ans << endl;
}
  


  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define MN 100005
int f[15][MN],c[MN],n,m,q,hr[MN],cnt;
struct edge{int to,nex;}e[MN*2];
inline void ins(int f,int t){
	e[++cnt]=(edge){t,hr[f]};hr[f]=cnt;
	e[++cnt]=(edge){f,hr[t]};hr[t]=cnt;	
}
int main(){
	n=read();m=read();
	for(int i=1;i<=m;++i) ins(read(),read());
	q=read();
	for(int i=1;i<=q;++i){
		int x=read(),d=read();c[i]=read();
		f[d][x]=i;
	}
	for(int i=10;i;--i)
		for(int j=1;j<=n;++j){
			f[i-1][j]=max(f[i-1][j],f[i][j]);
			for(int k=hr[j];k;k=e[k].nex)
				f[i-1][e[k].to]=max(f[i-1][e[k].to],f[i][j]);	
		}
	for(int i=1;i<=n;++i) printf("%d\n",c[f[0][i]]);
	return 0;
}

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

int main(){

	int n;
	cin >> n;

	int a[1000];

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

	for (int i = 1; i < n; i++){

		for (int j = 0; j < n; j++){
			cout << a[j];
			if (j != n - 1)cout << " ";
			else cout << endl;
		}

		int v = a[i], j = i - 1;
		while (j >= 0 && a[j] > v){
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
	}

	for (int j = 0; j < n; j++){
		cout << a[j];
		if (j != n - 1)cout << " ";
		else cout << endl;
	}

	return 0;

}

Measured memory_bytes: 1160
I=raw_input()
O=str()
list_upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#list_lower="abcdefghijklmnopqrstuvwxyz"
for i in I:
	if i in list_upper:
		O+=i.lower()
	else:
		O+=i.upper()
print O

Measured memory_bytes: 6408
#!/usr/bin/env python3

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, l = map(int,input().split())
    s = []

    for i in range(N):
        s.append(input())

    s_sorted = sorted(s)
    answer = "".join(s_sorted)
    
    print(answer)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int a, b, c, d, e;
int main() {
	cin >> a >> b >> c >> d >> e;
	int r = 0;
	if (a < 0) {
		r = -a*c + d + b*e;
	}
	if (a > 0) {
		r = (b - a)*e;
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 3088
lines = $stdin.read
array = lines.split("\n")
N = array[0].to_i
X = N/1.08

if ((X.to_i) * 1.08).to_i == N
  puts (X.to_i)
elsif ((X.to_i + 1) * 1.08).to_i == N
  puts (X.to_i + 1)
else
  puts ":("
end

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

int gcd3(int a,int b,int c){
  // a>b>c の順に並べる
  if(c>b){swap(b,c);}
  if(b>a){swap(a,b);}
  if(a%c==0 && b%c==0){ return c;}    // ベースケース
  else{
    if (a%c==0){return gcd3(a,b%c,c);}
    else { return gcd3(a%c,b,c);}
    }
}

int main() {
  int K;cin >> K; // 周回数
  int Ans = 0;  // 回答：
  rep1(i,K){
    rep1(j,K){
      rep1(k,K){
        Ans += gcd3(i,j,k);
      }
    }
  }
  cout << Ans << endl;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main
{
	public static void main(String args[])
	{
		int a;
		Scanner sc=new Scanner(System.in);
		a=sc.nextInt();
		int c=0;
		int b[]=new int[a];
		for(int i=0;i<a;i++)
		{
			b[i]=sc.nextInt();
		}
		Arrays.sort(b);
		for(int j=0;j<a-1;j++)
		{
			if(b[j]==b[j+1])
			{ c=c+1; }
		}
		if(c>0)
		{System.out.println("NO");}
		else
		{System.out.println("YES");}
	
	}
}

Measured memory_bytes: 63788
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n,n1,n2;
    cin >> n;

    vector<int>v(n);
    vector<int>v2(n);

    for(int i = 0;i < n;i++){
        cin >> v[i];
        v2[i] = v[i];
    }

    sort(v2.begin(),v2.end(),greater<int>());

    n1 = v2[0];
    n2 = v2[1];

    for(int i = 0;i < n;i++){
        if(v[i] == n1)
            cout << n2 << endl;
        else if(v[i] == n2)
            cout << n1 << endl;
        else   
            cout << n1 << endl;
    }
    

    return 0;
}

Measured memory_bytes: 3200
#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def IIR(n): return [II() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
mod = 1000000007

#A
"""
a,b = LS()
c = int(a+b)
for i in range(1,1000):
    if i * i == c:
        print("Yes")
        quit()
print("No")
"""

#B
"""
a,b = LI()
if a*b <= 0:
    print("Zero")
else:
    if b < 0:
        if (a-b) %2 == 1:
            print("Positive")
        else:
            print("Negative")
    else:
        print("Positive")
"""

#C
"""
n = II()
s = SR(n)
march = [[] for i in range(5)]
ch = list("MARCH")
for i in s:
    for j in range(5):
        if i[0] == ch[j]:
            march[j].append(i)
ans = 0
for i in range(5):
    for j in range(i):
        for k in range(j):
            if len(march[i])*len(march[j])*len(march[k]) == 0:
                break
            ans += len(march[i])*len(march[j])*len(march[k])
print(ans)
"""

#D
"""
n = II()
d = LIR(n)
q = II()
p = IIR(q)
d.insert(0,[0 for i in range(n+1)])
for i in range(n):
    d[i+1].insert(0,0)
for i in range(n):
    for j in range(n):
        d[i+1][j+1] += d[i+1][j]+d[i][j+1]-d[i][j]
ans = [0 for i in range(n**2+1)]

for a in range(n+1):
    for b in range(n+1):
        for c in range(a):
            for e in range(b):
                ans[(a-c)*(b-e)] = max(ans[(a-c)*(b-e)],d[a][b]-d[c][b]-d[a][e]+d[c][e])

for i in p:
    an = 0
    for a in range(i+1):
        an = max(an, ans[a])
    print(an)
"""
#E

"""
s = list(S())
ans = -1
s.insert(0,0)
d = 0
for i in range(1,len(s)):
    if s[i] != d:
        d = s[i]
        ans += 1
print(ans)
"""

#F
"""
n = II()
x,y = LI()
for _ in range(n-1):
    a,b = LI()
    if a == b:
        x = max(x,y)
        y = x
    else:
        i = max(x//a,y//b)
        while 1:
            if a*i >= x and b*i >= y:break
            i += 1
        x = a*i
        y = b*i
print(x+y)
"""
#G
"""
s = list(S())
p = 0
g = 0
for i in s:
    if i == "g":
        g += 1
    else:
        p += 1
ans = (g-p)//2
print(ans)
"""
#H
n,t = LI()
a = LI()
b = []
for i in range(n):
    b.append([i,a[i]])
b.sort(key = lambda x:x[1])
b = b[::-1]
m = []
if n == 1:
    print(1)
    quit()
i = 0
for j in range(n):
    while i < b[j][0]:
        m.append(b[j][1])
        i += 1
ans = 0
ma = 0
for i in range(n-1):
    ma = max(ma,m[i]-a[i])
for i in range(n-1):
    if m[i]-a[i] == ma:
        ans += 1
print(ans)
#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


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

int main()
{
	int K;
  cin >> K;
  int x = 7 % K;
  set<int> S;
  for(int i = 1; i <= K; ++i){
  	if(x == 0){
    cout << i << endl;
      return 0;
    }
    x = (x * 10 + 7) % K;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3604
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,w = readline() |> split |> parseMap
	vw = Array{Int}(2,n)
	for i in 1:n
		vw[:,i] = readline() |> split |> parseMap
	end
	dp = zeros(Int,n,w+1)
	dp[1,vw[1,1]+1] = vw[2,1]
	for i in 2:n
		for j in 1:w
			if j-vw[1,i] >= 0
				dp[i,j+1] = max(dp[i-1,j+1],dp[i-1,j+1-vw[1,i]]+vw[2,i])
			else
				dp[i,j+1] = dp[i-1,j+1]
			end
		end
	end
	println(maximum(dp))
end

main()


Measured memory_bytes: 191820