akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Main{

	public static double calc_convex(double l1x,double l1y,double l2x,double l2y,double p1x,double p1y,double p2x,double p2y){
		return ((l1x-l2x)*(p1y-l1y)+(l1x-p1x)*(l1y-l2y))*((l1x-l2x)*(p2y-l1y)+(l1x-p2x)*(l1y-l2y));
	}

	public static void check_convec(ArrayList<Double> list){
		double xa,ya,xb,yb,xc,yc,xd,yd,p1,p2;
	
		xa = list.get(0);
		ya = list.get(1);
		xb = list.get(2);
		yb = list.get(3);
		xc = list.get(4);
		yc = list.get(5);
		xd = list.get(6);
		yd = list.get(7);
				
		p1 = calc_convex(xa,ya,xc,yc,xb,yb,xd,yd);
		p2 = calc_convex(xb,yb,xd,yd,xa,ya,xc,yc);

		if(p1 < 0 && p2 < 0) System.out.println("YES");
		else System.out.println("NO");
		
	}
	

	public static void print_convex(ArrayList<Double> list){
		ArrayList <Double> inp = new ArrayList<Double>();
		
		for(int i=0;i<list.size()/8;i++){
			for(int j=0;j<8;j++){
				inp.add(list.get(i*8+j));
			}
			check_convec(inp);
			inp.clear();
		}

	}
		
	public static void main(String args[]) throws IOException{
		String str;
		ArrayList <Double> inp = new ArrayList<Double>();

		Scanner scan = new Scanner(System.in);

		while(scan.hasNext()){
			str = scan.next();
			String [] strAry = new String[str.length()];
			strAry = str.split(",");
			for(int j=0;j<strAry.length;j++){
				Pattern p = Pattern.compile("-?[0-9]*.[0-9]*");
				Matcher m = p.matcher(strAry[j]);
				if(m.find()){
					double x = Double.parseDouble(m.group(0));
					inp.add(x);
				}
			}
		}
		print_convex(inp);
	}
}

Measured memory_bytes: 11000
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const ll INF = 10000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

int n;
void dfs(string s, char max_c) {
    if (s.size() == n) {
        cout << s << endl;
        return;
    }
    for (char c = 'a'; c <= max_c + 1; c++) {
        string t = s;
        t += c;
        dfs(t, max(max_c, c));
    }
}

int main()
{
    cin >> n;
    dfs("", 'a'-1);
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

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);
}
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;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vi X(N),Y(N);
    REP(i,N)cin >> X[i] >> Y[i];
    vi P(N);
    REP(i,N)P[i] = i;
    double ans = 0;
    int cnt = 0;
    do{
        double cur = 0;
        REP(i,N-1){
            cur += sqrt((X[P[i]] - X[P[i + 1]]) * (X[P[i]] - X[P[i + 1]]) + (Y[P[i]] - Y[P[i + 1]]) * (Y[P[i]] - Y[P[i + 1]]));
        }
        ans += cur;
        cnt++;
    } while (next_permutation(ALL(P)));
    printf("%.10f\n",ans / cnt);
    return 0;
}

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

dic = {}
m = 1
for i in range(N):
    st = input()
    if st not in dic:
        dic[st] = 1
    else:
        dic[st] += 1
        if dic[st] > m:
            m = dic[st]

ans = []
for s in dic:
    if dic[s] == m:
        ans.append(s)
ans.sort()
for i in range(len(ans)):
    print(ans[i])




Measured memory_bytes: 32096
#include<iostream>

using namespace std;

int main() {
	int A, B;

	cin >> A >> B;

	if (A <= 8 && B <= 8) {
		cout << "Yay!" << endl;
		return 0;
	}
	else {
		cout << ":(" << endl;
		return 0;
	}
}

Measured memory_bytes: 764
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {
    static int n;
    static int[]v,w;
    static long[][]memo;
    static long dp(int id,int W) {
        if (id == n) return 0;
        if (memo[id][W] != -1) {
            return memo[id][W];
        }
        long take = 0l;
        if (w[id] <= W){
             take = v[id]*1l+dp(id+1,W-w[id]);
    }
        return memo[id][W]=Math.max(dp(id+1,W),take);
    }
    public  static void main(String[]args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        n= sc.nextInt();
        int remw = sc.nextInt();
        v= new int[n];
        w= new int[n];
        memo= new long[n][remw+1];
        for (long[]x:memo){
            Arrays.fill(x,-1);
        }
        for (int i =0;i<n;i++){
            w[i]=sc.nextInt();
            v[i]=sc.nextInt();
        }
        pw.println(dp(0,remw));
       // pw.println(Arrays.deepToString(memo));

      pw.flush();
    }
    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException
        {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if(x.charAt(0) == '-')
            {
                neg = true;
                start++;
            }
            for(int i = start; i < x.length(); i++)
                if(x.charAt(i) == '.')
                {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                }
                else
                {
                    sb.append(x.charAt(i));
                    if(dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg?-1:1);
        }

        public boolean ready() throws IOException {return br.ready();}


    }
}

Measured memory_bytes: 126676
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n,a int
	var s, as, bs []int
	var aTotal, bTotal int

	fmt.Scan(&n)

	for i := 1; i < n+1; i++ {
		fmt.Scan(&a)
		s = append(s, a)
	}
	sort.Slice(s, func(i, j int) bool { return s[i] > s[j] })

	t := "a"

	for i := 0; i < len(s); i++ {
		if t == "a" {
			as = append(as, s[i])
			t = "b"
		} else {
			bs = append(bs, s[i])
			t = "a"
		}
	}

	for _, a := range as {
		aTotal += a
	}
	for _, b := range bs {
		bTotal += b
	}
	fmt.Println(aTotal - bTotal)
}


Measured memory_bytes: 1852
/*Shivam Bhalla */
/* f2016941@pilani.bits-pilani.ac.in */



#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iostream>
#include <string>
#include <cmath>
#include <cassert>
#include <bits/stdc++.h>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
long long maxv = 1e9;

int main()
{
  int A,B;
  cin>>A>>B;
  if(B%A==0)
    cout<<A+B;
  else
    cout<<B-A;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string.h>
#include<string>
#include<functional>
#include<iomanip>
using namespace std;

#define INF 1<<21
#define DIV 1000000007

int main() {
  int n;
  while (1) {
	cin >> n;
	if (n == 0) {
	  return 0;
	}
	else {
	  vector<int> v;
	  for (int i = 0; i < n; i++) {

		string s;
		cin >> s;
		v.push_back(s.size());
	  }
	  int cnt = 0;
	  int sum = 0;
	  while (1) {
		for (int i = cnt; i < n; i++) {
		  sum = 0;
		  int j = cnt;
		  while (sum < 5) {
			sum += v[j];
			j++;
		  }
		  if (sum != 5) {
			break;
		  }
		  sum = 0;
		  while (sum < 7) {
			sum += v[j];
			j++;
		  }
		  if (sum != 7) {
			break;
		  }
		  sum = 0;
		  while (sum < 5) {
			sum += v[j];
			j++;
		  }
		  if (sum != 5) {
			break;
		  }
		  sum = 0;
		  while (sum < 7) {
			sum += v[j];
			j++;
		  }
		  if (sum != 7) {
			break;
		  }
		  sum = 0;
		  while (sum < 7) {
			sum += v[j];
			j++;
		  }
		  if (sum == 7) {
			goto NEXT;
		  }

		}

		cnt++;
	  }
	NEXT:
	  cout << cnt + 1 << endl;
	}
  }
}

Measured memory_bytes: 3008
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>

const int MAXN = 200000;

int N, K, A[MAXN + 5];
double Sum[MAXN + 5];

int main() {
	scanf("%d%d", &N, &K);
	double Ans = 0;
	for (int i = 1; i <= N; i++) {
		scanf("%d", &A[i]);
		Sum[i] = Sum[i - 1] + (A[i] + 1) * A[i] / 2.0 / A[i];
		if (i >= K)
			Ans = std::max(Ans, Sum[i] - Sum[i - K]);
	}
	printf("%.9f", Ans);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(ll key, ll value){
      this->key = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;

double exp_value(ll D1, ll D2, ll D3, ll N, vector<vector<vector<double>>>& dp){
  if(D1<0 || D2<0 || D3<0) return (double)0.0;
  if(D1==0 && D2==0 && D3==0) return (double)0.0;
  if(dp[D1][D2][D3]>=-0.5) return dp[D1][D2][D3];
  /*
  exp_value(D1, D2, D3, N, dp)
  = (N-D1-D2-D3)*exp_value(D1, D2, D3, N, dp)/N
  + D1*exp_value(D1-1, D2, D3, N, dp)/N
  + D2*exp_value(D1+1, D2-1, D3, N, dp)/N
  + D3*exp_value(D1, D2+1, D3-1, N, dp)/N
  + 1
  */
  ll sum = D1+D2+D3;
  double tmp1 = (double)D1*exp_value(D1-1, D2, D3, N, dp)/sum;
  double tmp2 = (double)D2*exp_value(D1+1, D2-1, D3, N, dp)/sum;
  double tmp3 = (double)D3*exp_value(D1, D2+1, D3-1, N, dp)/sum;
  return dp[D1][D2][D3] = tmp1+tmp2+tmp3+(double)N/sum;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  cin >> N;
  vll Dishes(4, 0);
  ll a;
  rep(i, 0, N){
    cin >> a;
    ++Dishes[a];
  }
  vector<vector<vector<double>>> dp(Dishes[1]+Dishes[2]+Dishes[3]+1, vector<vector<double>>(Dishes[2]+Dishes[3]+1, vector<double>(Dishes[3]+1, -1.0)));

  printf("%.10lf\n", exp_value(Dishes[1], Dishes[2], Dishes[3], N, dp));

  return 0;
}

Measured memory_bytes: 216960
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

int main(){
	char s[1001];
	int n,r,m;
	int w[1000],h[1000],a[2][1000];
	for(;;){
		scanf("%d",&n);
		if(!n)break;
		rep(i,1000){
			rep(j,2)a[j][i]=0;
			w[i]=h[i]=0;
		}
		r=0;
		rep(i,n){
			scanf("%s",s);
			rep(j,n){
				if(s[j]=='.'){
					a[i%2][j]=1;
					if(j>0){
						w[j]=w[j-1]+1;
						a[i%2][j]+=min(a[(1+i)%2][j-1],min(w[j-1],h[j]));
					}else w[j]++;
					h[j]++;
					r=max(r,a[i%2][j]);
				}else a[i%2][j]=h[j]=w[j]=0;
			}
		}
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 1208
n_str = input()  # 3***
k = int(input())

dp1 = [[0] * (k + 2) for _ in range(len(n_str) + 1)]
dp2 = [[0] * (k + 2) for _ in range(len(n_str) + 1)]
# dp1[i][j] : 上から i 桁はnと一致していて、0でない数が j 個現れているような数
# dp2[i][j] : 上から i 桁が既にnより小さく、0でない数が j 個現れているような数

dp1[0][0] = 1
# dp2[0][1] = int(n_str[0]) - 1
# dp2[0][0] = 1

for i in range(len(n_str)):
    for j in range(k + 1):
        if n_str[i] != '0':
            dp1[i + 1][j + 1] += dp1[i][j]

            dp2[i + 1][j + 1] += dp1[i][j] * (int(n_str[i]) - 1)
            dp2[i + 1][j + 1] += dp2[i][j] * 9

            dp2[i + 1][j] += dp1[i][j]
            dp2[i + 1][j] += dp2[i][j]
        else:
            dp1[i + 1][j] += dp1[i][j]

            dp2[i + 1][j + 1] += dp2[i][j] * 9
            dp2[i + 1][j] += dp2[i][j]

# print(*dp1, sep='\n')
# print(*dp2, sep='\n')
ans = dp1[len(n_str)][k] + dp2[len(n_str)][k]
print(ans)


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

int main()
{
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); ++i)
    {
        cout << "x";
    }
    cout << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
using namespace std;

int main(){
	string S;
	cin>>S;
	long ans = 0;
	for(int bit=0;bit<pow(2,S.size()-1);++bit){
		int start = 0;
		/*
		cout<<"bit";
		cout<<bit<<endl;
		*/
		for(int i=0;i<S.size()-1;++i){
			if(bit&(1<<i)){
				//cout<<atol(S.substr(start,i+1-start).c_str())<<endl;
				ans += atol(S.substr(start,i+1-start).c_str());
				start = i+1;
			}
		}
		//cout<<atol(S.substr(start,S.size()-start).c_str())<<endl;
		ans += atol(S.substr(start,S.size()-start).c_str());
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream> pre processor directive
#include <string>
#include <iomanip>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    string S;
    cin>>S;
    for(int i=0;i<S.length();i++){
        cout<<"x";
    }
    cout<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){

  int n;
  cin >>n;
 
  int *arry = new int[n];

  for(int i=0; i<n; i++){
      cin >> *(arry+i);
  }
  
  for(int i=n-1; i>0; i--){
      cout << *(arry+i) << " ";
  }
  cout << *(arry) << endl;

  delete[] arry;
  return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>

int main () {
	
	int a,b;
	
	
	scanf("%d %d", &a, &b);
	
	//a = idade
	if ( a >= 13 ){
		printf("%d", b);
	}
	else if( a >= 6 && a < 13){
		printf("%d", b/2);
	}
	else{
		printf("0");
	}
	
	
	
	
	
	
	
	
	return 0;
}





Measured memory_bytes: 128
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b, c, d = M()
x = a*b
y = c*d
print(max(x, y))

Measured memory_bytes: 68560
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
#define  B   begin()
#define  E   end()
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    int t,i,j,n,m=INT_MAX,l=0,r=0,a[105];
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        l+=a[i];
    }
    for(i=0;i<n-1;i++)
    {
        r+=a[i];
        l-=a[i];
        m=min(m,abs(l-r));
    }
    cout<<m<<"\n";
    return 0;
}



Measured memory_bytes: 3624
#include <stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    if(n>=400&&n<=599){
        printf("8\n");
    }
    else if(n>=600&&n<=799){
        printf("7\n");
    }
    else if(n>=800&&n<=999){
        printf("6\n");
    }
    else if(n>=1000&&n<=1199){
        printf("5\n");
    }
    else if(n>=1200&&n<=1399){
        printf("4\n");
    }
    else if(n>=1400&&n<=1599){
        printf("3\n");
    }
    else if(n>=1600&&n<=1799){
        printf("2\n");
    }
    else{
        printf("1\n");
    }
    return 0;
}

Measured memory_bytes: 1656
N = int(input())
bars = list(map(int,input().split()))

bars.sort(reverse=True)

flag = 0
l = 0
l1 = 0
l2 = 0

for x in bars:
    if flag==0:
        l = x
        flag = 1
    elif flag==1 and x==l and l1==0:
        l1 = x
        l = 0
        flag = 0
    elif flag==1 and x==l and l1!=0:
        l2 = x
        break
    else:
        l = x
        flag = 1

print(l1 * l2)


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

const int INF = 1001001001;
vector<int> to[100005];      //インデックスに対応する部屋が隣接している部屋

int main() {
    char c;
    cin >> c;
    char ans = c + 1;
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    double a, b, x;
    cin >> a >> b >> x;
    double ans;
    if(x < (a*a*b)/2.0){
        double l = (2.0*x)/(b*a);
        double t = atan2(b, l);
        
        ans = 180*t/(M_PI);     
    }else{
        double y = a*a*b-x;
        double l = (2.0*y)/(a*a);
        double t = atan2(l, a);
        ans = 180*t/(M_PI);     
    }
    cout << ans << endl;
}

Measured memory_bytes: 888
#include <iostream>

using namespace std;

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

    int a, b, c, d, e, k;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> k;

    if (e - a <= k)
    {
        cout << "Yay!" << endl;
    }
    else
    {
        cout << ":(" << endl;
    }

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
 
using namespace std;
#define sz(x) (int)(x).size()
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
const int N=3e5+5;
 
 int n;

int main()
{	
	

	int a,b;

	cin>>a>>b;

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

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

//Membership Management
public class Main{

	class R{
		String s;
		Set<R> adj;
		boolean u;
		public R(String s) {
			this.s = s;
			adj = new HashSet<R>();
		}
		int f(){
			if(u)return 0;
			u = true;
			if(adj.isEmpty())return 1;
			int res = 0;
			for(R r:adj)res+=r.f();
			return res;
		}
	}
	
	Map<String, R> ref;
	R get(String s){
		if(ref.containsKey(s))return ref.get(s);
		R r = new R(s);
		ref.put(s, r);
		return r;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int n = sc.nextInt();
			if(n==0)break;
			ref = new HashMap<String, R>();
			String g = "";
			while(n--!=0){
				String t = sc.next();
				String[] s = t.substring(0, t.length()-1).split(":");
				if("".equals(g))g=s[0];
				R r = get(s[0]);
				for(String v:s[1].split(","))r.adj.add(get(v));
			}
			System.out.println(get(g).f());
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

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

using namespace std;

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

    ll N;
    cin >> N;
    vector<ll> H(N);
    Rep (i, N) {
        cin >> H[i];
    }

    ll sub = 0, ans = 0;
    Rep (i, N-1) {
        if (H[i] >= H[i+1]) {
            sub++;
        } else {
            ans = max(ans, sub);
            sub = 0;
        }
    }
    ans = max(ans, sub);
    
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

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

#define bil ((ll)1e9)
#define mod ((ll)1e9+7)

int main(int argc,char* argv[]){
    int n;
    cin >> n;

    vector<int> h(n);
    for(auto &x:h)
        cin >> x;
    
    vector<int> dp(n);
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);

    for(int i=2;i<n;i++){
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    }

    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 3996
#include <stdio.h>
int main()
{
    int n, m, i, j, min, max, f;
    int a[100005], b[100005], c[200005];
    scanf("%d %d", &n, &m);
    for (i = 0, j = 0, max = 0, min = 5000000, f = 0; i < m; i++)
    {
        scanf("%d %d", &a[i], &b[i]);
        c[j++] = a[i];
        c[j++] = b[i];
        if (b[i] < min)
            min = b[i];
        if (a[i] > max)
            max = a[i];
    }
    if (max > min)
    {
        printf("0\n");
        return 0;
    }
    f = min - max;
    printf("%d\n", f + 1);
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cctype>
#include <map>
#include <stdio.h>
#include <string.h>


#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using namespace std;

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

    int n;
    int p[200001];
    int Min = 300000;
    int ans = 0;
    
    
    cin >>n;
    for(int i = 0; i < n; i ++){
        cin >> p[i];
    }
    
    for(int i = 0; i < n; i ++){
        if(p[i] <= Min) ans++;
        Min = min(Min,p[i]);
    }
    cout << ans;
    return 0;
}









Measured memory_bytes: 4372
#include<stdio.h>

int main(void)
{
   int i, a=0, b=0, c=0;
   char s[3];

   scanf("%s", s);

   for(i=0;i<3;i++){
      if(s[i]=='a') a++;
      else if(s[i]=='b') b++;
      else if(s[i]=='c') c++;
   }

   if((a==1)&&(b==1)&&(c==1)) printf("Yes\n");
   else printf("No\n");

   return 0;
}

Measured memory_bytes: 128
n,m,x = map(int,input().split())
pr = []
score = []
for i in range(n):
    L = list(map(int,input().split()))
    pr.append(L[0])
    score.append(L[1:])

ans = 10**10
for i in range(1<<n):
    li = []
    
    cost = 0
    for j in range(n):
        if (i>>j)&1:
            li.append(score[j])
            cost +=pr[j]

    score_all = [0 for l in range(m)]
    for k in range(len(li)):
        for j in range(m):
            score_all[j] +=li[k][j]
    if all([y>=x for y in score_all]):
        ans = min(ans,cost)

if ans != 10**10:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 9268
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll n;cin>>n;
	ll a[n+1];for(ll i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	ll res=a[n/2];
	ll r1=a[n/2-1];
	cout<<res-r1;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <array>
#include <climits>

using namespace std;

int main() {
	int n, cl[9]{}, sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int r;
		cin >> r;
		if (r < 3200)
			cl[r / 400]=1;
		else
			cl[8]++;
	}
	for (int i = 0; i < 8; i++) {
		sum += cl[i];
	}
	if (sum == 0)cout << 1;
	else cout << sum;
	cout << " " << sum + cl[8] << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A = []
    temp = 0
    sum = 0
    i = 1
    while True:
        temp = 0
        i += 1
        sum += 1
        for j in range(1,i,1):
            temp += 26**j
        if N <= temp:
            break
    #print(sum)
    if sum == 1:
        N = N-1
    else:
        temp = 0
        for j in range(1,sum):
            temp += 26**j
        N -= (temp+1)

    for j in range(sum):
        #print(N)
        amari = N % 26
        N = N // 26
        A.append(amari)
        #print(A)
    #print(A)

    B = [0]*len(A)
    for i in range(len(A)-1,-1,-1):
        dict = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k',11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s',19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'}
        B[i] = dict[A[i]]

    ans = [0]*len(B)
    for j in range(len(B)):
        ans[j] = B[len(B)-1-j]

    print(''.join(ans))

main()


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

N = int(input())
P = list(map(int, input().split()))

cnt = 0
for i in range(2, N):
    tmp = [P[i-2], P[i-1], P[i]]
    tmp.remove(max(tmp))
    tmp.remove(min(tmp))
    if tmp[0] == P[i-1]:
        cnt += 1

print(cnt)

Measured memory_bytes: 3060
require 'set'
class Peek
  attr_accessor :paths, :height

  def initialize(height)
    self.height = height
    self.paths = Set.new
  end

  def is_good?
    return true if paths.empty?
    height > paths.map(&:height).max
  end
end
H, M = gets.chomp.split.map(&:to_i)
peeks = gets.chomp.split.map(&:to_i).each_with_object([nil]) do |h, pks|
    pks << Peek.new(h)
  end

M.times do
  a, b = gets.chomp.split.map(&:to_i)
  peeks[a].paths.add peeks[b]
  peeks[b].paths.add peeks[a]
end
peeks.shift
puts peeks.count(&:is_good?)


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

int main() {
  int H, W;
  cin >> H >> W;

  // ここにプログラムを追記
  string x;
  char map[H][W];
  int sum = 0;
  for(int i = 0; i < H;i++){
    cin >> x;
    for(int j = 0; j <W; j++){
      map[i][j] = x.at(j);
    }
  }
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(map[i][j] == '.'){
        sum = 0;
        int upper,downer,left,right;
        if(i == 0){upper = 0;}else{upper = i-1;}
        if(i == H-1){downer = H-1;}else{downer = i+1;}
        if(j == 0){left = 0;}else{left = j-1;}
        if(j == W-1){right = W-1;}else{right = j+1;}
        
        for(int x = upper; x <= downer; x++){
          for(int y = left; y <= right; y++){
            if(map[x][y] == '#'){
              sum++;
            }
          }
        }
        if(sum == 0){
          map[i][j] = '0';
        }else if(sum == 1){
          map[i][j] = '1';
        }else if(sum == 2){
          map[i][j] = '2';
        }else if(sum == 3){
          map[i][j] = '3';
        }else if(sum == 4){
          map[i][j] = '4';
        }else if(sum == 5){
          map[i][j] = '5';
        }else if(sum == 6){
          map[i][j] = '6';
        }else if(sum == 7){
          map[i][j] = '7';
        }else if(sum == 8){
          map[i][j] = '8';
        }else if(sum == 9){
          map[i][j] = '9';
        }
        
      }
    }
  }
  
  for(int i = 0; i<H; i++){
    for(int j = 0; j < W;j++){
      cout << map[i][j];  
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
n = int(input())

name_len = [0]
while True:
  name_len.append(name_len[-1]+26**(len(name_len)))
  if name_len[-1] > 1000000000000001:
    break

#print(name_len) 

number = 0
for i in range(len(name_len)):
  if name_len[i] < n and n <= name_len[i+1]:
    number = i+1
    break

#print(number)
#print(n)
n -= name_len[number-1]
#print(n)

ans = ""
li = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
#print(len(li))

for i in range(number,0,-1):
  #print(i,n)
  #print(int(n/26**(i-1)))
  #print(li[25])
  if i == 1:
    ans += li[int(n / 26**(i-1))-1]
  else:
    if n%26**(i-1) == 0:
      ans += li[int(n / 26**(i-1))-1]
    else:
      ans += li[int(n / 26**(i-1))]
  n = n% 26**(i-1)

print(ans)

  

Measured memory_bytes: 9228
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
using namespace std;
const int MOD=1000000007;
const int MOD2=15000007;
const ll MAX=9187201950435737471;
const int N=100005;
const int INF=1e17;
const long double PI=acos(-1);


void solve(int T){
    string s;
    cin>>s;
    int n=s.size();
    for(int i=0;i<n;i++){
        cout<<'x';
    }
}

int main() {
    fastio
    int T=1;
    //cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        //if(i<T)cout<<"\n";
    }
    return 0;
}





Measured memory_bytes: 3600
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (Math.abs((x - a)) < Math.abs((x - b )) ) {
            System.out.println("A");
        } else {
            System.out.println("B");
        }
    }
}

Measured memory_bytes: 21844
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    a = list(map(int, input().split()))
    cnt = 1
    for i in a:
        if i==cnt:
            cnt += 1
    if cnt == 1:
        print(-1)
    else:
        print(n-cnt+1)


if __name__ == '__main__':
    main()

Measured memory_bytes: 25244
//#include <ext/pb_ds/assoc_container.hpp> 
 //#include <ext/pb_ds/tree_policy.hpp>
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power(((((a)%mod)*((a)%mod))%mod),b/2)%mod;
    else return (((a)%mod)*(power(((((a)%mod)*((a)%mod))%mod),b/2)%mod))%mod;
}
inline ll inverse(ll a,ll md) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
  
  
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution
const int ce=1e9+7;
ll fast_mod(ll input)
{
    return input < ce ? input : input%ce;
}
int fre[100001];
int co[11];
int n,k;
int f[100001];
int maxi;
int dp[501][5001];
int solve(int i,int rem)
{
	if(rem==0)
		return 0;
	if(i==maxi)
		return 0;
	int &res=dp[i][rem];
	if(res!=-1)
		return res;
	res=0;
	for(int j=1;j<=min(rem,k);j++)
	{
		res=max(res,co[j]+solve(i+1,rem-j));
	}
	return res;
}
int32_t main()
{
    IOS
   
    
    int n;
    cin>>n;
    vector<int> v;
    while(n)
    {
    	if(n%26==0)
    	{
    		v.push_back(26);
    		n-=26;
    		n/=26;
    		continue;
    	}
    	v.push_back(n%26);
    	n/=26;
    }
    reverse(v.begin(),v.end());
    for(int i=0;i<v.size();i++)
    {
    	if(v[i]==0)
    	{
    		cout<<"z";
    	}
    	else
    	{
    		cout<<(char)('a'+v[i]-1);
    	}
    }

}       

Measured memory_bytes: 3604
#include <cstdio>

int main(void){
		int a, b;
		scanf("%d %d", &a, &b);
		while(a != 0 || b != 0){
				if(a > b)printf("%d %d\n", b, a);
				else printf("%d %d\n", a ,b);
				scanf("%d %d", &a, &b);
				
		}

		return 0;
}



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

void dfs(string &s, string sub,
    vector<string> &result, map<char,bool> &changed){
    if(s.size() == sub.size()){
        result.push_back(sub);
        return;
    }
    char c = s[sub.size()];
    if(!changed[c] && c!='z'){
        changed[c] = true;
        dfs(s,sub+char(c+1),result,changed);
        changed[c] = false;
    }
    if(changed[c-1] || c=='a'){
        dfs(s,sub+char(c),result,changed);
    }
}

int main(void){
    string s;
    while(cin>>s, s!="#"){
        vector<string> result;
        map<char,bool> changed;
        dfs(s,"",result,changed);
        sort(all(result));
        int m = result.size();
        cout<<m<<endl;
        rep(i,m){
            if(i<5 || m-5<=i) cout<<result[i]<<endl;
        }
    }
    return 0;
}



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

using namespace std;

static const int MMAX = 20;
static const int NMAX = 50000;
static const int INFTY = (1 << 29);

main() {
  int n, m;
  int C[MMAX];
  int T[NMAX + 1];

  cin >> n >> m;

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

  for ( int i = 0; i <= n; i++ ) T[i] = INFTY;
  T[0] = 0;
  for ( int i = 0; i < m; i++ ) {
    for ( int j = C[i]; j <= n; j++ ) {
      T[j] = min(T[j], T[j - C[i]] + 1 );
    }
  }

  cout << T[n] << endl;

  return 0;
}

Measured memory_bytes: 3268
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y;
    cin >> x >> y;
    cout << x + y - (__gcd(x, y) - 1) << endl;
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
const ll INF = 1e10;
const ll MOD = 1e9 + 7;


int main() {
    int x,y,a,b,c; cin >> x >> y >> a >> b >> c;
    vector<int> R(a);
    vector<int> G(b);
    vector<int> M(c);
    rep(i,a) cin >> R[i];
    rep(i,b) cin >> G[i];
    rep(i,c) cin >> M[i];

    sort(R.begin(),R.end(),greater<int>());
    sort(G.begin(),G.end(),greater<int>());
    rep(_,a - x) R.pop_back();
    rep(_,b - y) G.pop_back();
    rep(i,x) M.push_back(R[i]);
    rep(i,y) M.push_back(G[i]);
    sort(M.begin(),M.end(),greater<int>());
    ll ans = 0;
    rep(i,x + y) ans += M[i];
    cout <<  ans << endl;
}



Measured memory_bytes: 2552
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <numeric>
#include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <bitset>
#include <queue>
#include <map>
#include <utility>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define MOD 1000000007           //10億　= 10^9になってる
#define juu 100000               //10万 10e5
#define hyaku 1000000            //100万　10e6
#define mINF -922337200085470000 //llのmax-1桁の小さい方
#define pINF 922337203600070000  //llのmax-1桁のデカい方
#define uINF 1844674407300000000 //ullのmax-1桁してる
#define pi 3.1415926535897932384
#define all(v) v.begin(), v.end()
ll factor[300];
ll memory[300];
/*素朴法で計算
factorは必ずmemset(factor,0,sizeof(factor));
グローバルであるmemoryに個数を書き込む
memory配列の走査にはfactorの要素を使う*/
void primefac(ll num)
{
    int i = 0, kosuu = 0;
    while (*(factor + i) != 0)
    {
        while (num % *(factor + i) == 0)
        {
            num /= *(factor + i);
            memory[*(factor + i)] += 1;
        }
        if (num == 1)
            break;
        i++;
    }
}
/*グローバルにあるfactorに素数書き込む.個数を返すので配列は-1しろforは<*/
int elast(ll number)
{
    ll tmp = 0;
    int flag = 0;
    *factor = 2;
    for (int i = 3; i <= number; i++)
    {
        flag = 0;
        for (int j = 0; j <= tmp; j++)
        {
            if (i % (*(factor + j)) == 0)
            {
                flag = 1;
                break;
            }
        }
        if (flag)
            continue;
        tmp += 1;
        *(factor + tmp) = i;
    }
    return tmp + 2;
}

/*intで収まる範囲であってくれ*/
ll nCr(ll n, ll r)
{
    ll val = 1;
    ll i;
    if (r == 0)
        return 1;
    for (i = 0; i < n - r; i++)
    {
        val *= (n - i);
        val /= (i + 1);
    }
    return val;
}
/*intで収まる範囲であってくれ*/
ll nPr(ll n, ll r)
{
    ll val = 1;
    ll i;
    for (i = 0; i < r; i++)
    {
        val *= (n - i);
    }
    return val;
}
template <typename T>
bool chmin(T &a, const T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
bool chmax(T &a, const T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

/*ソートして被りを無くす*/
template <typename T>
void eraseSame(T &a)
{
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

/*aとbで大きい方を後ろにする。変更なしならtrue、ありならfalse */
template <typename T>
bool swapmax(T &a, T &b)
{
    T temp;
    temp = a;
    if (a > b)
    {
        a = b;
        b = temp;
        return false;
    }
    return true;
}
ull gcd(ull x, ull y) { return (x % y) ? gcd(y, x % y) : y; }
ull lcm(ull x, ull y) { return x / gcd(x, y) * y; }

/*一行に入力が何個あるかを1,ぶち込むvectorを2*/
template <typename T>
void splitIn(ll N, vector<T> &array)
{
    T temp;
    int i = 0;
    array.resize(N);
    while (cin >> temp)
    {
        array[i] = temp;
        i++;
        if (i >= N)
        {
            break;
        }
    }
    return;
}
int main()
{
    ll N, ans = 0, out = 0;
    cin >> N;
    vector<ll> v;
    splitIn(N, v);
    for (auto &x : v)
    {
        ans +=  x-1;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int ara[5];
    int i;
    for (i=0; i<5; i++)
    {
        scanf("%d",&ara[i]);
    }
    for(i=0; i<5; i++)
    {
        if(ara[i]==0)
            printf("%d",i+1);
    }
    return 0;
}


Measured memory_bytes: 1652
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <string>
#include <functional>
#include <cassert>
#include <cmath>
#define SIZE 505
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main()
{
    int n;
    scanf("%d", &n);

    for(int i=0; i<n-1; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            int x = i^j;
            int level = 0;
            while(x > 0)
            {
                x /= 2;
                level++;
            }
            printf("%d ", level);
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 384
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll n = inl(), k = inl();
        string s = ins();

        vector<pair<ll, ll>> zeros;
        rep(i, s.size()) {
            if (s[i] == '0') {
                ll l, r;
                l = i;
                while (i < s.size() - 1 && s[i] == '0' && s[i] == s[i + 1]) i++;
                r = i;
                zeros.eb(P(l, r));
            }
        }
        ll d[n];
        rep(i, s.size()) {
            if (s[i] == '0') d[i] = 0;
            else d[i] = (i == 0 ? 1 : d[i - 1] + 1);
        }
        ll dd[n];
        repr(i, n) {
            if (d[i] == 0) dd[i] = 0;
            else if (i == n - 1) dd[i] = d[i];
            else dd[i] = max(dd[i + 1], d[i]);
        }

        ll ans = 0;
        k = min<ll>(zeros.size(), k);
        if (k == 0) {
            cout << n << endl;
        } else {
            rep(i, zeros.size() - k + 1) {
                ll s = zeros[i].F, t = zeros[i + k - 1].S;
                ans = max((s == 0 ? 0 : dd[s - 1]) + t - s + 1 +
                          (t == n - 1 ? 0 : dd[t + 1]), ans);
            }
            cout << ans << endl;
        }


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 2932
#include <stdio.h>
#include <string.h>

#define SLENGTH 1001

int LCSLength(char *,char *);

int main()
{
  int i, q;
  char X[SLENGTH],Y[SLENGTH];
  
  scanf("%d",&q);

  for(i = 0; i < q; i++) {
    scanf("%s%s",X,Y);
    printf("%d\n",LCSLength(X,Y));
  }

  
  
  return 0;
}

int LCSLength(char *X,char *Y)
{
  int i, j, m, n;
  int c[SLENGTH][SLENGTH];
  
  m = strlen(X);
  n = strlen(Y);

  for(i = 1; i <= m; i++) {
    c[i][0] = 0;
  }
  for(j = 1; j <= n; j++) {
    c[0][j] = 0;
  }

  for(i = 1; i <= m; i++) {
    for(j = 1; j <= n; j++) {
      if(X[i-1] == Y[j-1]) {
	c[i][j] = c[i-1][j-1] + 1;
      }
      else if(c[i-1][j] >= c[i][j-1]) {
	c[i][j] = c[i-1][j];
      }
      else c[i][j] = c[i][j-1];
    }
  }

  return c[m][n];
}




Measured memory_bytes: 5652
#include<bits/stdc++.h>
using namespace std;
int n,k,ans,i,j;
string s;
int main(){
	cin>>n>>k>>s;
	while(j<n){
		while(j<n&&s[j]=='1')++j;
		ans=max(ans,j-i);
		while(j<n&&s[j]=='0')++j;
		--k;
		if(k<0){
			while(i<n&&s[i]=='1')++i;
			while(i<n&&s[i]=='0')++i;
		}
		ans=max(ans,j-i);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main() {
  int n,ans=0;
  cin >> n;
  for(int i = 1;i<=n;i++){
    if(1<=i && i<=9) ans++;
    else if(100<=i && i<=999) ans++;
    else if(10000<=i && i<=99999) ans++;
  }
  cout << ans;
  return 0;
}

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

using namespace std;

int main(){
    long long int N;
    cin >> N;
    vector<string> S(N);
    map<string,int> mp;
    for(int i=0;i<N;i++){
        cin >> S[i];
        mp[S[i]]++;
    }

    cout << mp.size() << endl;


}

Measured memory_bytes: 25096
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int M = scan.nextInt();
        int Q = scan.nextInt();
        List<Pair> list = new ArrayList<>();
        for (int i = 0; i < Q; i++) {
            int a = scan.nextInt()-1;
            int b = scan.nextInt()-1;
            int c = scan.nextInt();
            long d = scan.nextInt();
            Pair p = new Pair(a, b, c, d);
            list.add(p);
        }
        long[] a = new long[N];
        long ans = dfs(N, M, list, a, 1, 0);
        System.out.println(ans);
    }
    private long dfs(int N, int M, List<Pair> query, long[] a, int min, int current) {
        if (N == current) {
            long t = 0;
            for (Pair p : query) {
                if (a[p.b] - a[p.a] == p.c) {
                    t += p.d;
                }
            }
            return t;
        }
        long ans = Long.MIN_VALUE;
        for (int i = min; i <= M; i++) {
            a[current] = i;
            ans = Math.max(ans, dfs(N, M, query, a, i, current + 1));
        }
        return ans;
    }
    class Pair {
        int a;
        int b;
        int c;
        long d;
        Pair(int a, int b, int c, long d) {
            this.a = a;
            this.b = b;
            this.c = c;
            this.d = d;
        }
    }
}


Measured memory_bytes: 29368
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
  int x;
  cin >> x;
  int res = x;

  if (x > 2)
  {
    while (true)
    {
      bool flag = true;
      for (int i = 2; i < sqrt(res); i++)
      {

        if (res % i == 0)
        {
          flag = false;
          break;
        }
      }
      if (flag)
      {
        break;
      }
      res++;
    }
  }
  cout << res << "\n";

  return 0;
}

Measured memory_bytes: 256