akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    u32 N, K;
    cin >> N >> K;
    Vec<u64> H(N);
    for (u32 i = 0; i < N; i++) cin >> H[i];
    sort(ALL(H));
    if (N <= K) {
        cout << 0 << endl;
        return;
    }
    u64 c = N - K;
    mp::cpp_int sum = 0;
    for (u32 i = 0; i < c; i++) {
        sum += H[i];
    }
    cout << sum << endl;
}


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

int main(){
	int a,b,c,x,ans = 0;
	cin >> a >> b >> c >> x;
	for(int i = 0;i <= a;i++){
		for(int j = 0;j <= b;j++){
			for(int k = 0;k <= c;k++){
				if(i * 500 + j * 100 + k * 50 == x) ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 1 << 21;
using pii = std::pair<int, int>;
#define SORT(v) std::sort(v.begin(), v.end())
int main(void) {
	int N, K;
	int a;
	std::cin >> N >> K;
	for (int i = 0; i < N; ++i) {
		std::cin >> a;
	}
	std::cout << (N + K - 3) / (K - 1) << std::endl;
	return 0;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin>>n;
  if(n<1200) cout<<"ABC"<<endl;
  else if(n<2800) cout<<"ARC"<<endl;
  else cout<<"AGC"<<endl;
  return 0;
}


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

/**
 * ABC042B
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        /** 空読み */
        sc.nextLine();

        String[] strs = new String[N];
        String ans = "";

        for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        }

        Arrays.sort(strs);
        
        for (String string : strs) {
            ans += string;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=j;i<=k;++i)
#define dep(i,j,k) for(int i=j;i>=k;--i)
#define ser(i,j)   for(int i=e[j].y;i;i=e[i].n)
#define ll         long long
using namespace std;
int read()
{
	int num=0,f=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())num=(num<<1)+(num<<3)+c-48;
	return num*f;
}
const int mn=110;
int n,m,t,H,len,ans,a[mn],cx,cy;
struct point
{
	int x,y,h;
}p[mn];
void fre()
{
	freopen("test.in","r",stdin);
	freopen("test.out","w",stdout);
}
int get(int x,int y)
{
	return abs(x-cx)+abs(y-cy);
}
void init()
{
	n=read();m=read();
}
void bf_work()
{
	
}
void work()
{
	dep(i,m/n,1)
	{
		if(m%i==0)
		{
			printf("%d",i);
			exit(0);
		}
	}
}
void re_zero()
{
	
}
int main()
{
	//fre();
		init();
		bf_work();
		work();
		re_zero();
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		char[] t = sc.nextLine().toCharArray();
		int ns = s.length, nt = t.length;
		if(!check(s, t, ns, nt)) {
			System.out.println("UNRESTORABLE");
			return;
		}
		for(int i = 0 ; i < ns ; i++) {
			if(s[i] == '?') {
				for(char c = 'a' ; c <= 'z' ; c++) {
					s[i] = c;
					if(check(s, t, ns, nt)) {
						break;
					}
				}
			}
		}
		String ans = "";
		for(int i = 0 ; i < ns ; i++) {
			ans += s[i];
		}
		System.out.println(ans);
	}

	public static boolean check(char[] s, char[] t, int ns, int nt) {
		for(int i = 0 ; i < ns - nt + 1 ; i++) {
			boolean ok = true;
			for(int j = 0 ; j < nt ; j++) {
				if(s[i + j] == t[j] || s[i + j] == '?');
				else ok = false;
			}
			if(ok) return true;
		}
		return false;
	}

}

Measured memory_bytes: 22996
N = int(input()); W = [input() for _ in range(N)]; t = W[0][0]
for i in range(N):
  if W.count(W[i]) > 1:
    print("No")
    exit(0)
  if W[i][0] != t:
    print("No")
    exit(0)
  t = W[i][-1]
print("Yes")

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

using namespace std;

double tax_convert = 380000.0;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;
    
    cin >> n;
    
    double tot = 0.0;
    
    for(int i = 0 ; i < n ; i++){
        double val;
        string tp;
        
        cin >> val >> tp;
        
        if(tp == "BTC"){
            val *= tax_convert;
        }
        
        tot += val;
    }
    
    cout << setprecision(6) << fixed << tot << endl;
    
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict


if __name__ == "__main__":
    num_query = int(input())
    d: defaultdict = defaultdict()

    for _ in range(num_query):
        op, *v = input().split()
        if ("0" == op):
            d[v[0]] = v[1]
        elif ("1" == op):
            if d.get(v[0]):
                print(d.get(v[0]))
            else:
                print(0)
        else:
            d[v[0]] = 0



Measured memory_bytes: 42240
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
    for(auto &e:t) fill_v(e,v);
}

int main() {
  ll h, w, n; cin >> h >> w >> n;
  map<pair<int, int>, int> mp;

  function<bool(int, int)> check = [&](int y, int x){
    return x >= 1 && x < w-1 && y >= 1 && y < h-1;
  };

  REP(i, n){
    int a, b; cin >> a >> b;
    --a; --b;
    for(int y=-1; y!=2; y++)for(int x=-1; x!=2; x++){
      if(check(a + y, b + x)) mp[make_pair(a + y, b + x)]++;
    }
  }

  vector<ll> ans(10, 0);
  for(const auto& x: mp) ans[x.second]++;

  ans[0] = (h - 2) * (w - 2) - (ll)mp.size();
  
  REP(i, 10) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 56448
// Author: pankaj_m05 
// Problem: a 
// Created: 21.06.2020 17:31:12

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define f_in(file) freopen(file, "r", stdin)
#define f_out(file) freopen(file, "w", stdout)
#define sz(a) int((a).size())
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) c.begin(), c.end()
#define tr(c,i) for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) (c.find(x) != c.end())  // Set and Maps
#define cpresent(c,x) (find(allc,x) != c.end()) // Vectors
using namespace std;

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

const int mod = 1e9 + 7;

void testcase() {
	char c;
	cin >> c;
	if (isupper(c)) cout << 'A';
	else cout << 'a';	
}

int main(void) { 
	fast
	int t = 1; 
	// cin >> t;
	while (t--) {
		testcase();
	}
	return 0;
}                                          

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

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

int main(){
    string s;
    cin >> s;
    ll sum=0, lcnt=0, rcnt=0;
    bool lflag = true;
    int n = s.size();
    rep(i, n){
        if(lflag){
            if(s[i]=='<'){
                lcnt++;
            }else{
                lflag = false;
            }
        }
        if(!lflag){
            if(s[i]=='>'){
                rcnt++;
            }else{
                ll big = max(lcnt, rcnt);
                ll small = min(lcnt, rcnt);
                // cout << big << " " << small << endl;
                sum += (big * (big + 1) + small * (small - 1)) / 2;
                lcnt = 1;
                rcnt = 0;
                lflag = true;
            }
        }
    }
    ll big = max(lcnt, rcnt);
    ll small = min(lcnt, rcnt);
    // cout << big << " " << small << endl;
    sum += (big * (big + 1) + small * (small - 1)) / 2;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4304
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lli long long int
#define REP1(i, n) for(lli i = 0; i < n; i++)
#define REP2(i, n) for(lli i = 1; i <= n; i++)
#define pb push_back
#define ff first
#define ss second
#define pr pair<lli, lli>
#define mp make_pair
#define vi vector<lli>
#define mii map<lli, lli>
#define mod 1000000007
     
void solution()
{
	lli n;
	cin >> n;
	if(n < 30)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}

int main()
{
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("Input.txt", "r", stdin);
    // for writing output to output.txt 
    freopen("Output.txt", "w", stdout);
  	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	//cin >> t;
	//while(t--)
		solution();
	return 0;
}
	

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<set>
#include<unordered_set>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<tuple>
#include<iomanip>
#include<climits>
#define ll long long int
#define mod 1000000007
#define pi acos(-1)
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n,k;
  cin>>n>>k;
  vector<double>vec;
  double arr[n];
  double sum=0;
  for(int i=0;i<n;i++)
  { 
    cin>>arr[i];
    arr[i] = (arr[i]+1)/2;
   // cout<<arr[i]<<"  ";
    if(i<k)
     sum += arr[i];
  }

  // cout<<sum;
  // vec.push_back(sum);
  int ind=0;
  double max=-1;
  if(sum>max)
      max =sum;
  for(int i=k;i<n;i++)
  {
    sum+= arr[i];
    sum-= arr[ind++];
    if(sum>max)
      max =sum;
    //vec.push_back(sum);
  }

  cout<<fixed<<setprecision(12)<<max;

  return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>


int max( int p, int q ) {
	if( p > q ) return p;
	return q;
}

int main(void){
	int i, j;
	int sum[2] = { 0, 0 }, sub;
	for( i = 0; i < 2; i++) {
		for( j = 0; j < 4; j++) {
			scanf( "%d", &sub );
			sum[i] += sub;
		}
	}
	printf( "%d\n", max( sum[0], sum[1] ) );

	return 0;
}

Measured memory_bytes: 592
import java.util.Scanner;


public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String question = sc.next();
			String answer = sc.next();
			if("00".equals(question + answer)){
				break;
			}
			int hit = 0;
			int blow = 0;
			//ヒット数
			for(int i=0;i<4;i++){
				if(question.charAt(i) == answer.charAt(i)){
					hit++;
				}
			}
			//ブロー数
			for(int i=0;i<4;i++){
				for(int j=0;j<4;j++){
					if(i == j){
						continue;
					}
					if(question.charAt(i) == answer.charAt(j)){
						blow++;
					}
				}
			}
			System.out.println(hit+" "+blow);
		}
	}
}

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

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using pli=pair<ll,int>;

#define testcase int _; cin>>_; while(_--)
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define fi first
#define se second
#define sz(a) int((a).size())

/*B-Judge Status Summary*/
void Solve()
{
	int n;
	cin>>n;
	map<string,int> m;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		m[s]++;
	}
	string s[4]={"AC","WA","TLE","RE"};
	for(int i=0;i<4;i++)
		cout<<s[i]<<" x "<<m[s[i]]<<"\n";
}

int main()
{
	fast
	Solve();
	return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N; cin >> N;
    LL K; cin >> K;
    VL A(N),F(N);
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> F[i];
    sort(A.begin(),A.end(),greater<LL>());
    sort(F.begin(),F.end());

    LL ok = -LINF;
    REP(i,N){
        ok = max(ok,A[i]*F[i]);
    }

    LL ng = -1;
    while(abs(ok-ng) > 1){
        LL mid = (ok+ng) / 2;
        LL acc = 0;
        REP(i,N){
           acc +=  max(A[i]-(mid / F[i] ),0LL);
        }
        if(acc > K) ng = mid;
        else ok = mid;
    }
    cout << ok << endl;


}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, ans = 1e15;

int main(){
	scanf("%lld", &n);
	for(ll i = 1; i*i <= n; i++) if(n%i == 0) ans = min(ans, n/i + i - 2);
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

int main(){
    const double PI=3.14159265358979323846;
    double a,b,x;
    cin >> a >> b >> x;
    double s=x/a;
    double ans=0;
    double a2=0;
    if(s==a*b) ans=0;
    else{
        if(s>b*a/2){
            double bu=2*s/a-b;
            s-=a*bu;
            b-=bu;
            a2=2*s/b;
        }
        else a2=2*s/b;
        double r=atan(b/a2);
        ans=r*(180.0/PI);
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
    
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d %d", $a, $b, $c);
$num = $a;
$max = $a * $b;

while($a < $max) {
    if ($a % $b === $c) {
        $yes = "YES";
    }
    $a +=$num;
}

if (isset($yes)) {
    echo $yes;
} else {
    echo "NO";
}



?>


Measured memory_bytes: 16036
import heapq
l = list()
n,m = map(int,input().split())
a_l = list(map(int,input().split()))
for x in a_l:
    x *= -1
    heapq.heappush(l,x)
for _ in range(m):
    y = heapq.heappop(l)*(-1)
    y = y//2
    heapq.heappush(l,(-1)*y)
print((-1)*sum(l))


Measured memory_bytes: 14180
// I T N O GG\\;

// M_Erfan_S \\;

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

long long m, n, k = 0;

int main(){
    
    cin >> n >> m;
	if(abs(n) > abs(m)){
	    if(n > 0){
    		k ++;
		}
		if(m > 0){
			k ++;
		}
		cout << k+abs(n)-abs(m);
		return 0;
	}
    if(n < 0){
    	n *= -1;
    	k ++;
	}
	if(m < 0){
		m *= -1;
		k ++;
	}
	
	cout << k+m-n;
	
    return 0;
    
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;

int main() {

	string S;
	cin >> S;

	ll N = S.size();

	vector<ll> R(N, 0), L(N, 0);
	ll tmp = 0;

	rep(i, N - 1) {
		if (S[i] == 'R' && S[i + 1] == 'L') {
			R[i] = tmp + 1;
			tmp = 0;
		}
		else if (S[i] == 'R') {
			tmp++;
		}
	}
	for (ll i = N - 1; i > 0; i--) {
		if (S[i - 1] == 'R' && S[i] == 'L') {
			L[i] = tmp + 1;
			tmp = 0;
		}
		else if (S[i] == 'L') {
			tmp++;
		}
	}

	vector<ll> ans(N, 0);

	rep(i, N) {
		if (R[i] > 0) {
			ans[i] += (R[i] + 1) / 2;
			ans[i + 1] += R[i] / 2;
		}
		if (L[i] > 0) {
			ans[i] += (L[i] + 1) / 2;
			ans[i - 1] += L[i] / 2;
		}
	}

	rep(i, N) {
		cout << ans[i] << " ";
	}
	

	return 0;
}

Measured memory_bytes: 5892
/*
  Reference:-
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define PI pair<int,int>
#define all(vec) vec.begin(),vec.end()
ll mod=1000000007;
ll ar[3005];
ll dp[3005][3005];
int in[3005][3005];
ll x,y;
ll cnt=0;
int n;
ll solve(int i,int j,int fl){
    if(i>j){
        dp[i][j]=0;
        in[i][j]=n;
        return dp[i][j];
    }
    cnt++;
    if(dp[i][j])return dp[i][j];
    int x1=0,y1=0;
    if(fl==0){
        if(solve(i+1,j,1)>solve(i,j-1,1)){
            //x1+=ar[j]+dp[i][j-1];
            in[i][j]=j;
            dp[i][j]=ar[j];
            if(in[i][j-1]==i)dp[i][j]+=solve(i+1,j-1,1);
            else dp[i][j]+=solve(i,j-2,1);
            //x+=x1;
        }
        else{
            //x1+=ar[i]+dp[i+1][j];
            in[i][j]=i;
            dp[i][j]=ar[i];
            if(in[i+1][j]==i+1)dp[i][j]+=solve(i+2,j,1);
            else dp[i][j]+=solve(i+1,j-1,1);
        }
        //dp[i][j]=x1;
    }
    else {
        if(solve(i+1,j,0)>solve(i,j-1,0)){
            //y1+=ar[j]+dp[i][j-1];
            in[i][j]=j;
            dp[i][j]=ar[j];
            if(in[i][j-1]==i)dp[i][j]+=solve(i+1,j-1,0);
            else dp[i][j]+=solve(i,j-2,0);
            //y+=y1;
        }
        else {
            //y1+=ar[i]+dp[i+1][j];
            in[i][j]=i;
            dp[i][j]=ar[i];
            if(in[i+1][j]==i+1)dp[i][j]+=solve(i+2,j,0);
            else dp[i][j]+=solve(i+1,j-1,0);
        }
        //dp[i][j]=y1;
    }
    return dp[i][j];
}
int main(){
    std::ios::sync_with_stdio(false);
    //string s1,s2;
    //int n;
    cin>>n;
    //ll ar[n];
    ll sum=0;
    forn(i,n){cin>>ar[i];sum+=ar[i];}ar[n]=0;
    ll ans=solve(0,n-1,0);
    //cout<<in[0][n-1]<<endl;
    int cnt=0;
    int i1=0,j1=n-1;
    if(in[i1][j1]==i1)i1++;
    else j1--;
    ans=ans-(sum-ans);
    cout<<ans;

    return 0;
}
/*
4
10 100 10 10
*/


Measured memory_bytes: 105216
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
//#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200000];
vll v;
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            v.push(p);
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[60];
void power()
{
    powe[0]=1;
    REP(i,1,15)
    {
        powe[i]=2*powe[i-1];
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
} 
ll fact[100005];
void factorial()
{
    fact[0]=1;
    REP(i,1,100002)
    {
        fact[i]=mymod(i*fact[i-1], num);
    }
}
ll lcm(ll a,ll b)
{
    ll ans=mymod(a*b,num);
    ans=mymod(modInverse(__gcd(a,b),num)*ans,num);
    return ans;
}
ll find_lcm(ll A[10005], ll n)
{
    if(n==1)
    return A[0];
    ll a=lcm(A[0],A[1]);
    REP(i,2,n)
    {
        a=lcm(a,A[i]);
    }
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll h[n],dp[n];
    REP(i,0,n)
    {
        cin>>h[i];
    }
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    REP(i,2,n)
    {
        ll minm=dp[i-1]+abs(h[i]-h[i-1]);
        REP(j,2,min(i+1,k+1))
        {
            assmin(minm,dp[i-j]+abs(h[i]-h[i-j]));
        }
        dp[i]=minm;
    }
    cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
 
using namespace std;
 
#define int1(a) scanf("%d",&a)
#define int2(a,b) scanf("%d %d",&a,&b)
#define int3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define int4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
 
#define lint1(a) scanf("%lld",&a)
#define lint2(a,b) scanf("%lld %lld",&a,&b)
#define lint3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define lint4(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define lli long long int
 
#define pint(x) printf("%d",x)
#define plint(x) printf("%lld",x)
#define endl '\n'
#define nl printf("\n");
#define ps printf(" "); 
 
#define all(x) x.begin(),x.end()
#define pb push_back
#define Set(a, s) memset(a, s, sizeof (a))
#define mod1 (lli)(1e9 + 7)
#define mod2 (lli)(1e9 + 9)
#define EPS 1e-9
 
#define fore(i,n) for(int i=n; i>=0; i--)
#define fors(i,a,n) for(int i=a; i<n; i++)
#define fora(i,ele) for(auto i: ele)
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<lli> vli;
 
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
 
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
float roundoff(float val, float p){ return floor(val*pow(10.0,p)+0.5)/pow(10.0,p);}
lli power(lli a, lli b, lli mod){lli x=1,y=a; while(b > 0){if(b&1){x=(x*y)%mod;}y = (y*y)%mod; b /= 2;}return x;}
 
const int INF = 0x3f3f3f3f;
const float pi = 3.14159265;
 
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};
//int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1};
 
int main(void) {
    ios_base::sync_with_stdio(true);
    cin.tie(NULL);
    cout.tie(NULL);
	//srand (time(NULL));
	/*
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	*/
    // cout<<"Execution time : "<<tick()<<"\n";
    
   int n;
   int1(n);
   
   vi arr(n);
   
   fors(i,0,n){
       int1(arr[i]);
   }
    
    
    int ans = 0;
    
    int maxm = 0, curr = arr[0];
    
    fors(i,1,n){
        if(arr[i]<=curr){
            ans++;
        }
        else{
            maxm = max(maxm, ans);
            ans = 0;
            
        }
            curr = arr[i];
        
    }
    
    
    cout<<max(maxm, ans);
	
    return 0;
}

Measured memory_bytes: 640
#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 - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
int main(){
    int n;
    cin >> n;
    vector<pair<int,string>> a;
    vector<string> s(n);
    REP(i,n) cin >> s[i];
    sort(ALL(s));
    int cnt = 0;
    string temp = s[0];
    REP(i,n){
        if(s[i] != temp){
            a.push_back(make_pair(cnt,temp)); 
            temp = s[i];
            cnt = 1;
        }else{
            cnt++;
        }
        if(i == n - 1){
            a.push_back(make_pair(cnt,temp)); 
            temp = s[i];
            cnt = 1;
        }
    }
    sort(ALL(a));
    int index = a[a.size() - 1].first;
    REPR(i,a.size()){
        if(index != a[i].first){
            FOR(j,i + 1,a.size()){
                cout << a[j].second << endl;
            }
            return 0;
        }
    }
    REP(i,a.size()){
        cout << a[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 17908
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;

int main()
{
    ll n,m,i,a=0,b=0,k,t;
    string s;
    cin>>n;
    vl<ll> v(n),w(n);
    vl<ll> p,q;
    for(i=0;i<n;i++) cin>>v[i];
    for(i=0;i<n;i++) cin>>w[i];
    for(i=0;i<n;i++) p.pb(i+1);
    for(i=0;i<n;i++) q.pb(i+1);
    ll count=1;
    do
    {
        if(p==v)
        {
            a=count;
            break;
        }
        count++;
    }while(next_permutation(p.begin(),p.end()));
    
    count=1;
    do
    {
        if(q==w)
        {
            b=count;
            break;
        }
        count++;
    }while(next_permutation(q.begin(),q.end()));
    
    cout<<abs(a-b);
}

Measured memory_bytes: 3576
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        IntStream A = IntStream.of(sc.nextInt(), sc.nextInt(), sc.nextInt());

        System.out.println(A.sum() >= 22 ? "bust" : "win");
    }
}

Measured memory_bytes: 27604
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int n,ans=0; cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(4*i+7*j==n){
        ans=1;
        break;
      }
    }
  }
  if(ans==1) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);



int main () {
  int n;
  cin >> n;
  vl a(n);
  rep (i, n) {
    cin >> a[i];
  }
  ll ans = 1;
  ll cnt = 0;
  ll spa = 0;
  rep (i, n) {
    spa = a[i] + 1;
    cnt++;
    if (spa <= cnt*2 - 1) {
      ans = ans * cnt % MOD;
      cnt--;
    }
  }
  while (cnt) {
    ans = ans * cnt % MOD;
    cnt--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
num16 = ["A", "B", "C", "D", "E", "F"]
x, y = input().split()
xindex = num16.index(x)
yindex = num16.index(y)
if xindex < yindex :
    print("<")
elif xindex == yindex :
    print("=")
elif xindex > yindex :
    print(">")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define lowbit(x)x&-x
#define bug(x) cout<<#x<<" : "<<x<<endl
#define de puts("#")
#define int long long
using namespace std;
const int mod=998244353;
const int maxn=2e5+5;
#define ll long long
int x[maxn],y[maxn],cx,cy,n,P[maxn];

struct node{
	int x,y;
	bool operator<(const node &a){
		return x<a.x;
	}
}a[maxn];

struct BIT{
	int c[maxn];
	void add(int i,int x){
		while(i<=cy){
			c[i]+=x;
			i+=lowbit(i);
		}
	}
	int query(int i){
		int res=0;
		while(i){
			res+=c[i];
			i-=lowbit(i);
		}
		return res;
	}
}sum[2];

signed main() {
	scanf("%lld",&n);
	P[0]=1;
	for(int i=1;i<=n-1;i++)P[i]=P[i-1]*2%mod;
	for(int i=1;i<=n;i++)scanf("%lld %lld",&a[i].x,&a[i].y),x[i]=a[i].x,y[i]=a[i].y;
	sort(x+1,x+n+1),cx=unique(x+1,x+n+1)-x-1;
	sort(y+1,y+n+1),cy=unique(y+1,y+n+1)-y-1;
	for(int i=1;i<=n;i++){
		a[i].x=lower_bound(x+1,x+n+1,a[i].x)-x;
		a[i].y=lower_bound(y+1,y+n+1,a[i].y)-y;
		sum[0].add(a[i].y,1);
	}
	sort(a+1,a+n+1);
	ll ans=0;
	for(int i=1;i<=n;i++){
		sum[1].add(a[i].y,1);
		ll sum1=sum[0].query(a[i].y-1),sum2=sum[1].query(a[i].y-1),sum3=n-i-sum1,sum4=i-1-sum2;
		//sum1为在a[i]上面点的总个数，sum3为下面的总个数，sum2、sum4为对应已算过的点的个数 
		sum1=P[sum1],sum2=P[sum2],sum3=P[sum3],sum4=P[sum4];
//		bug(sum1),bug(sum2),bug(sum3),bug(sum4);
//		de;
		ll t=(((sum1%mod)*sum2%mod)*sum3%mod)*sum4%mod;
		t-=sum1*sum2%mod;
		t-=sum1*sum3%mod;
		t-=sum3*sum4%mod;
		t-=sum2*sum4%mod;
		t+=(sum1+sum2+sum3+sum4+2)%mod;
		t=(t-3)%mod;
		t=(t+P[n-1])%mod;
		ans=(ans+t)%mod;
		sum[0].add(a[i].y,-1);
	}
	printf("%lld\n",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;
static const int MAX_V = 101;
static const int INF = 1e9;

struct edge
{
	int to;
	int cap;
	int revNum;
	edge();
	edge(int to, int cap, int revNum) : to(to), cap(cap), revNum(revNum){};
};

vector<edge> G[MAX_V];
bool used[MAX_V];

int dfs(int v, int t, int f)
{
	if (v == t)
	{
		return(f);
	}
	used[v] = true;
	for (int i = 0; i < G[v].size(); ++i)
	{
		edge& e = G[v][i];
		if (!used[e.to] && e.cap > 0)
		{
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0)
			{
				e.cap -= d;
				G[e.to][e.revNum].cap += d;
				return(d);
			}
		}
	}
	return(0);
}

int maxFlow(int s, int t)
{
	int flow = 0;
	while (true)
	{
		memset(used, 0, sizeof(used));
		int f = dfs(s, t, INF);
		if (f == 0)
		{
			return(flow);
		}
		flow += f;
	}
}

void solve()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int V, E;
	cin >> V >> E;
	for (int i = 0; i < E; ++i)
	{
		int from, to, cap;
		cin >> from >> to >> cap;
		G[from].push_back(edge(to, cap, G[to].size()));
		G[to].push_back(edge(from, 0, G[from].size() - 1));
	}
	cout << maxFlow(0, V - 1) << endl;
}

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

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

int n, l, r, a[50];

int main() {
	int i, j;
	
	while(cin >> n >> l >> r) {
		if (!n) break;
		for (i = 0; i < n; i++) cin >> a[i];
		
		int cnt = 0;
		for (i = l; i <= r; i++) {
			for (j = 0; j < n; j++) if (i % a[j] == 0) break;
			if (j % 2 == 0) { cnt++; }
		}
		cout << cnt << endl;
	}
	return 0;
}


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

#define ll long long
#define t() int t;cin>>t;while(t--)
#define ff first
#define ss second
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>b;i--)
#define pb push_back
#define mp make_pair

 

void solvea(){
 
 	string s,ans="";
 	cin>>s;
 	if(s[(s.size()-1)]=='s')
 		ans+=s+"es";
 	else ans+=s+"s";
 	cout<<ans;
 }

	
	
 
void solveb(){
	t(){
		
	}
}

int main()
{
	#ifndef ONLINE_JUDGE
		//for getting input from input1.txt
		freopen("input1.txt","r",stdin);
		//for getting output from output.txt
		freopen("output.txt","w",stdout);
		#endif

		solvea();
return 0;
}

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

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    map<ll,ll> fig;
    for(int i=0; i<N; i++){
        cin >> A[i];
        fig[A[i]]++;
    }
    
    vector<ll> upper2, upper4;
    for(auto itr = fig.begin(); itr != fig.end(); itr++){
        if(itr->second >= 4){
            //cout << itr->first << endl;
            upper4.push_back(itr->first);
        }
        if(itr->second >= 2){
            upper2.push_back(itr->first);
        }
    }
    if(upper2.empty()) cout << 0 << endl;
    else {
        if(!upper4.empty()){
        sort(upper4.begin(),upper4.end());
        reverse(upper4.begin(),upper4.end());
        }
        sort(upper2.begin(),upper2.end());
        reverse(upper2.begin(),upper2.end());
        
        if(!upper4.empty()){
        if(upper4[0]*upper4[0] >= upper2[0]*upper2[1])
            cout << upper4[0]*upper4[0] << endl;
        else
            cout << upper2[0]*upper2[1] << endl;
        }
        else
            cout << upper2[0]*upper2[1] << endl;
    }
}


Measured memory_bytes: 7296
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = min(a*x + b*y, max(x, y)*c*2);
    if(x < y) ans = min(ans, x*c*2+(y-x)*b);
    else ans = min(ans, y*c*2+(x-y)*a);
    cout << ans << endl;
}



Measured memory_bytes: 256
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    S = input_raw[0]

    new_S = ""
    count = 0
    for i in range(N):
        if S[i] != "#":
            count += 1
    min_count = count
    for i in range(N):
        if S[i] == ".":
            count -= 1
        else:
            count += 1
        min_count = min(min_count, count)
    print min_count


##    new_S1 = ""
##    new_S2 = ""
##    flag = False
##    for i in range(N):
##        if S[i] == "." and flag == False:
##            new_S1 += "."
##        else:
##            new_S1 += "#"
##            flag = True
##
##    flag = False
##    for i in range(N):
##        if S[N - i - 1] == "#" and flag == False:
##            new_S2 += "#"
##        else:
##            new_S2 += "."
##            flag = True
##    count1 = 0
##    count2 = 0
##    new_S2 = new_S2[::-1]
##    for i in range(N):
##        if S[i] != new_S1[i]:
##            count1 += 1
##        if S[i] != new_S2[i]:
##            count2 += 1
##    print min(count1, count2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9648
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
int n,w[105],L[105],R[105];
int minv=INT_MAX;
/*---define function---*/

/*---main code---*/
int main()
{
	FIO;
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>w[i];
		L[i]=w[i]+L[i-1];
	}
	for(int i=1;i<=n;++i)
	{
		R[i]=w[n-i+1]+R[i-1];
	}
	for(int i=1;i<=n;++i)
	{
		int p=n-i;
		minv=min(minv,abs(L[i]-R[p]));
	}
	cout<<minv<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

int main() {
	ll N, K; cin >> N >> K;
	ll c = 1;
	rep(i, 0, N) {
		ll a = c * 2;
		ll b = c + K;
		c = ((a > b) ? b : a);
	}
	cout << c << endl;

	return 0;
}

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

int mark[30], n;
string s;
char ch[5] = {'M', 'A', 'R', 'C', 'H'};
long long ans;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> s;
		mark[s[0] - 'A']++;
	}	
	for (int i = 0; i < 5; i++)
		for (int j = i + 1; j < 5; j++)
			for (int k = j + 1; k < 5; k++)
				ans += (1LL * mark[ch[k] - 'A'] * mark[ch[j] - 'A'] * mark[ch[i] - 'A']);
	cout << ans;
}


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

int main(){
	int a,b,c;
	cin >> a >> b >> c;

	cout << (a+b+c) - max(a, max(b, c)) << endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    T,A = list(map(int, input().split()))
    H = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        anstemperature = T - 0.006 * H[ans]
        nowtemperature = T - 0.006 * H[i]
        if abs(anstemperature - A) > abs(nowtemperature - A):
            ans = i
    print(ans+1)
if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
	bool is_prime[1000000];
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<1000000;i++){
		is_prime[i]=true;
	}
	for(int i=0;i*i<1000000;i++){
		if(is_prime[i]){
			for(int j=i*i;j<1000000;j+=i){
				is_prime[j]=false;
			}
		}
	}
	
	while(1){
	int a=0;
	cin>>a;
	int cun=0;
	if(a==0){
		break;
	}
	int j=0;
	for(int i=0;i<a;i++){
	if(is_prime[j]){
		cun=cun+j;
		j++;
	}
	else{
		i--;
		j++;
	}
	}
	cout<<cun<<endl;
	}
	return 0;
}

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

using namespace std;

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

  vector<int> t(d);
  for (int i = 0; i < d; i++) {
    cin >> t[i];
  }

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

  int dp[210][210];
  fill(dp[0], dp[210], -1);
  for (int i = 0; i < n; i++) {
    if (a[i] <= t[0] && t[0] <= b[i]) {
      dp[0][i] = 0;
    }
  }

  for (int i = 1; i < d; i++) {
    for (int j = 0; j < n; j++) {
      if (!(a[j] <= t[i] && t[i] <= b[j])) continue;
      for (int k = 0; k < n; k++) {
        if (dp[i - 1][k] < 0) continue;
        dp[i][j] = max(dp[i][j], dp[i - 1][k] + abs(c[j] - c[k]));
      }
    }
  }

  int ans = -1;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[d - 1][i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3224
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		String c=s.next();
		
		if(c.charAt(0)=='a'||
		   c.charAt(0)=='i'||
		   c.charAt(0)=='u'||
		   c.charAt(0)=='e'||
		   c.charAt(0)=='o')System.out.print("vowel");
		else System.out.print("consonant");

	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
int n, A[200005];
long long k;

int main() {
#ifdef _0219nice
	freopen("1.in", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	while (cin >> n >> k) {
		for (int i = 0; i < n; i++) {
			cin >> A[i];
			A[i]--;
		}
		unordered_map<int, int> seen;
		vector<int> track;
		int cur = 0;
		while (!seen.count(cur)) {
			track.push_back(cur);
			seen[cur] = track.size() - 1;
			cur = A[cur];
		}
		if (k < track.size()) {
			cout << 1 + track[k] << "\n";
		} else {
			k = (k - seen[cur]) % (track.size() - seen[cur]);
			cout << 1 + track[seen[cur] + k] << "\n";
		}
	}
	return 0;
}


Measured memory_bytes: 12712
#include <stdio.h>

int main(void){
  int i,j,n,taro_p=0,hana_p=0;
  char taro[101], hana[101];

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%s %s", taro, hana);

    for(j=0;;j++){
      if(taro[j] > hana[j]){
        taro_p += 3;
        break;
      }else if(taro[j] < hana[j]){
        hana_p += 3;
        break;
      }else if(taro[j] + hana[j] == 0){
        hana_p++;
        taro_p++;
        break;
      }
    }
  }

  printf("%d %d\n", taro_p , hana_p);
  return 0;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define EB emplace_back

typedef std::vector <int> vector;
typedef long long ll;
const int N = 162, mod = 1000000007;

int n, len, ans = 0;
int fact[N], inv[N], finv[N], C[N][N];
int a[N], b[N];
vector rem[N][N];

inline void add(int &x, const int y) {x += y - mod, x += x >> 31 & mod;}
ll PowerMod(ll a, int n, ll c = 1) {for (; n; n >>= 1, a = a * a % mod) if (n & 1) c = c * a % mod; return c;}

void init() {
	int i, j;
	for (inv[1] = 1, i = 2; i < N; ++i) inv[i] = ll(mod - mod / i) * inv[mod % i] % mod;
	for (*C[0] = i = 1; i < N; ++i)
		for (*C[i] = j = 1; j <= i; ++j) add(C[i][j] = C[i - 1][j], C[i - 1][j - 1]);
}

void dfs(int dep, int last, int cur, int n_r, int prod) {
	int i, s = 0, nxt = cur + 2, n_rb = dep - n_r;
	vector &U = rem[n_r][n_rb];
	if (U.empty()) return;
	for (i = n_rb - 1; i >= 0; --i)
		if ((s += a[i] - 1) > U[n_rb - i]) return;
	ans = (ans + (ll)prod * C[n + 1 + n_rb * 2][(s + n_rb * 2 + n_r) * 2]) % mod;
	prod = prod * (dep + 1ll) % mod;
	if (nxt <= n + 1)
		a[dep] = 0, b[dep] = (last ? 0 : b[dep - 1]) + 1,
		dfs(dep + 1, 0, nxt, n_r + 1, (ll)prod * inv[b[dep]] % mod);
	for (i = 1; i <= last && nxt <= n + 1; ++i, nxt += 2)
		a[dep] = i, b[dep] = (i == last ? b[dep - 1] : 0) + 1,
		dfs(dep + 1, i, nxt, n_r, (ll)prod * inv[b[dep]] % mod);
}

int main() {
	int i, j, k, n_B, c_R, c_RB, poi[N];
	int h, t, que[N];
	bool used[N]; char s[N];
	scanf("%d%d%s", &n, &len, s), init();
	n_B = std::count(s, s + len, 98);
	for (i = 0; i <= len; ++i)
		for (j = 0; j <= n_B; ++j) {
			c_R = c_RB = h = t = 0, memset(used, false, len);
			for (k = 0; k < len && c_RB < j; ++k)
				if (s[k] == 114) que[t++] = k;
				else if (h != t) used[ poi[c_RB++] = k ] = used[ que[h++] ] = true;
			for (k = 0; k < len && c_R < i; ++k)
				if (!used[k] && s[k] == 114) ++c_R, used[k] = true;
			if (c_RB < j || c_R < i) continue;
			vector &res = rem[i][j];
			res.reserve(j + 1), res.EB(0);
			for (t = 0, k = len - 1; k >= 0 && c_RB; --k)
				if (t += !used[k], k == poi[c_RB - 1]) res.EB(t), --c_RB;
			assert((int)res.size() == j + 1);
		}
	dfs(0, INT_MAX, 0, 0, 1);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
    int A, B, C;
    cin >> A >> B >> C;

    int d = A- B;
    int v = min(d, C);
    int ans = C - v;

    cout << ans << endl;

    return 0;
}


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

int main(){
  int n, d, x;
  cin >> n >> d >> x;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  
  int ans = x;
  for(int i = 0; i < n; i++){
    int k = a.at(i);
    ans += (d-1) / k + 1;
  }
  
  cout << ans << endl;
}

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

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int res = 0;
    REP(i, A+1) {
        REP(j, B+1) {
            REP(k, C+1) {
                int total = 500*i + 100*j + 50*k;
                if (total == X) ++res;
            }
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    ll A;
    double B;

    cin >> A >> B;
    ll C = (ll)(B * 100 + 0.5);
    ll ans = A* C / 100;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define REPe(i, n) for(int i = 0; i <= (int)(n); ++i)
#define REPi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define REPei(i, a, b) for(int i = int(a); i <= int(b); ++i)

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

    int x, y;
    cin >> x >> y;
    if(abs(x) < abs(y))
        cout << abs(y) - abs(x) + (x < 0) + (y < 0) << endl;
    else
        cout << abs(x) - abs(y) + (x > 0) + (y > 0) << endl;

}



Measured memory_bytes: 256