akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

//        int n=sc.nextInt();
        long k=sc.nextLong();
        long a=sc.nextLong();
        long b=sc.nextLong();
        long ans=k+1,ans2=0;
        if(b>a) {
        	k-=a-1;
        	if(k%2==0)
        		ans2 = k/2*(b-a)+a;
        	else 
        		ans2 = k/2*(b-a)+a+1;
        }

        out.println(max(ans,ans2));
        out.flush();
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//        this.a=a;
//        this.b=b;
//    }
//    public int compareTo(P p){
//        return b-p.b; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 23252
#include<stdio.h>

char a[105][105];
char b[205][105];

int main(){
	int w,h;
	scanf("%d %d",&h,&w);
	for(int i = 1; i <= h; i++){
		scanf("%s",&a[i]);
	}
	for(int i = 1; i <= 2*h; i++){
		for(int j = 0; j < w; j++){
			b[i][j] = a[(i+1)/2][j];
			printf("%c",b[i][j]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <iomanip>

using namespace std;
vector<vector<double>> DP;

double solve(int pos , int len , int head , vector<double>& val){
	if(pos == len){
		int tail = pos - head;
		if(head > tail) return DP[pos][head] = 1.0;
		return DP[pos][head] = 0.0;
	}
	if(DP[pos][head] != -1.0) return DP[pos][head];
	double o1 = val[pos] * solve(pos + 1, len , head + 1 , val);
	double o2 =  (1.0 - val[pos]) * solve(pos + 1 , len , head , val);
	return DP[pos][head] = o1 + o2;
}

int main(){
	int n;
	cin >> n;
	vector<double> val;
	DP.resize(n + 1 , vector<double>(n + 1 , -1.0));
	double x;
	for(int i = 1 ; i <= n ; i++){
		cin >> x;
		val.push_back(x);
	}
	double ans = solve(0 , n , 0 , val);
	cout << setprecision(10);
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 72704
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  string a;
  cin >> a;
  int p = 0;
  REP(i,4){
    if(a[i] == '+' ){
      p ++;
    }
  }
  cout << 2*p - 4 << endl; 
}


Measured memory_bytes: 256
n = int(input())
tmp = input()
h = tmp.split(" ")
for i in range(len(h)):
    h[i] = int(h[i])
mh = h[0]
i = 0
c = 0
ans = 0
while(i < n-1):
    i += 1
    if(mh >= h[i]):
        mh = h[i]
        c += 1
    else:
        if(ans < c):
            ans = c
        c = 0
        mh = h[i]
if(ans < c):
    ans = c
print(ans)


Measured memory_bytes: 11132
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+3;
vector<int>adj[maxn];
int dp[maxn];

int  dfs(int v)
{
	if(dp[v]!=-1) return dp[v];
	int res=0;
	for(auto j:adj[v])
	{
		res=max(res,1+dfs(j));
	}
	dp[v]=res;
	return dp[v];
}
int main ()
{
	int n,m;
	cin>>n>>m;
	int x,y;
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d",&x,&y);
		adj[x].push_back(y);
	}
	memset(dp,-1,sizeof(dp));
	int max_path=0;
	for(int i=1;i<=n;i++)
	{
		max_path=max(max_path,dfs(i));
	}
	cout<<max_path<<endl;

}

Measured memory_bytes: 8192
N, M, Q = map(int, input().split())
reqs = [list(map(int, input().split())) for _ in range(Q)]

As = []

def make(A):
  global As, N, M
  # print(A)
  if len(A) == N+1:
    As.append(A)
  else:
    for i in range(A[len(A)-1], M+1):
      make(A+[i])

make([1])

maxs = 0
for A in As:
  score = 0
  for req in reqs:
    if A[req[1]] - A[req[0]] == req[2]:
      score += req[3]
  maxs = max(score, maxs)

print(maxs)

Measured memory_bytes: 24248
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, S, q, T;
    int uS[100000];
    cin >> n;
    int k = 0;
    for (int i=0; i<n; ++i) {
        cin >> S;
        if (k == 0 || uS[k] != S) {
            uS[k] = S;
            k ++;
        }
    }

    int ans = 0;
    cin >> q;
    for (int i=0; i<q; ++i) {
        cin >> T;
        if (binary_search(uS, uS + k, T)) ans ++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1584
N,M=map(int,input().split())
import collections
e =[]
for i in range(M):
    ta,tb =map(int,input().split())
    e.extend([ta,tb])
c = collections.Counter(e)
#print(c)
ans = "YES"
for i in c:
    if c[i]%2 != 0:
        ans = "NO"
print(ans)


Measured memory_bytes: 16004
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
// const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

const int64_t LINF=(1ll << 50);
int main() {
	int64_t n; cin >> n;
	int64_t a[n + 1]; rep(i,n+1) cin >> a[i];
	if(a[0] != 0) {
		if(n == 0 and a[0] == 1) {
			cout << 1 << '\n';
		} else {
			cout << -1 << '\n';
		}
		return 0;
	}
	int64_t maxi[n + 1];
	maxi[0] = 1;
	int64_t now_ = 1;
	for(int64_t i = 1; i <= n; ++i) {
		if(now_ <= 0) {
			cout << -1 << '\n';
			return 0;
		}
		now_ <<= 1ll;
		now_ -= a[i];
		now_ = min(now_, LINF);
		maxi[i] = now_;
	}
	int64_t ans = 0;
	int64_t now = 0;
	for(int64_t i = n; i > 0; --i) {
		now += a[i];
		ans += now;
		if(now / 2 > maxi[i - 1]) {
			cout << -1 << '\n';
			return 0;
		}
		now = min<int64_t>(now, maxi[i - 1]);
	}
	cout << ans + 1 << '\n';
	return 0;
}

Measured memory_bytes: 5144
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N, M, R;
int r[10];
int d[210][210];


void warshallFloyd(){
	rep(i, 0, N)
		rep(j, 0, N)
			if(!d[i][j] && i != j) d[i][j] = INF;
	rep(k, 0, N)
		rep(i, 0, N)
			rep(j, 0, N) chmin(d[i][j], d[i][k]+d[k][j]);
}


int solve(){
	int ans = INF;
	sort(RNG(r, 0, R));
	do {
		int sum = 0;
		rep(i, 0, R-1) sum += d[r[i]][r[i+1]];
		chmin(ans, sum);
	} while(next_permutation(RNG(r, 0, R)));
	return ans;
}


signed main(){
	cin >> N >> M >> R;
	rep(i, 0, R) cin >> r[i], r[i]--;
	rep(i, 0, M){
		int A, B, C;
		cin >> A >> B >> C, A--, B--;
		d[A][B] = d[B][A] = C;
	}

	warshallFloyd();

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 640
var int = x=>parseInt(x,10);var spln = x=>x.split(/\n/g);var spsp = x=>x.split(/\s/g);
function main(input) {
  var a = input.split(/\n|\s/g).map((v)=>parseInt(v,10)).slice(0,3).sort()
  console.log(a[2]*10+a[1]+a[0])
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

#define MAX 100002

int n;

vector<int> v[MAX];

bool ng1[MAX];
int p[MAX];

int having_must[MAX];


inline void dfs(int b,int pr=-1){
	p[b] = pr;
	int siz = 0;
	int z = 0;
	for (int i = 0; i < v[b].size(); i++){
		int go = v[b][i];
		if (go == pr)continue;
		dfs(go,b);
		siz++;
		if (v[go].size() == 1){
			z++;
		}
	}
	if (pr != -1 && v[pr].size() == 1){
		z++;
	}
	if (z > 1){
		puts("First");
		exit(0);
	}
	having_must[b] = z;
}
map<int, int> dp[MAX][2];  //0 white 1 black

int ex[MAX][2];
inline bool dfs2(int b, int pr,int flag){
	if (v[b].size() == 1){
		if (flag == true){
			return true;
		}
		return false;
	}
	if (dp[b][flag].count(pr)){
		if (flag == false){
			return dp[b][flag][pr];
		}
		else{
			return dp[b][flag][pr] == v[b].size() - 1;
		}
	}
	if (dp[b][flag].size() == 0){
		ex[b][flag] = pr;
		dp[b][flag][pr] = 0;
		for (int i = 0; i < v[b].size(); i++){
			if (v[b][i] == pr)continue;
			int go = v[b][i];
			int nex = dfs2(go, b, flag ^ true);
			dp[b][flag][pr] += nex;
		}
	}
	else{
		dp[b][flag][pr] = dp[b][flag][ex[b][flag]] - dfs2(pr, b, flag ^ true) + dfs2(ex[b][flag], b, flag ^ true);
	}
	if (flag == false){
		return dp[b][flag][pr];
	}
	else{
		return dp[b][flag][pr] == v[b].size() - 1;
	}
}
int main(){
	cin >> n;
	if (n == 2){
		puts("Second");
		return 0;
	}
	for (int i = 1; i < n; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	dfs(0);
	for (int i = 0; i < n; i++){
		int sum = 0;
		for (int j = 0; j < v[i].size(); j++){
			int go = v[i][j];
			if (dfs2(go, i, false)){
				sum++;
			}
		}
		if (sum == v[i].size()){
			puts("First");
			return 0;
		}
	}
	puts("Second");
	return 0;
}

Measured memory_bytes: 30848
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
lst1 = list(map(int,readline().split()))
ans = []
lst1.sort()
i = 0
while True:
    if i >= n-1:
        break
    if lst1[i] == lst1[i+1]:
        ans.append(lst1[i])
        i += 1
    i += 1
if len(ans) < 2:
    print(0)
else:
    print(ans[-1]*ans[-2])

Measured memory_bytes: 56944
#include <stdio.h>
#include <stdlib.h>

#define SIZE 250
#define NUM 401

typedef struct {
	int t, h;
	long long num;
} edge;

int main()
{
	int i, N, M, u, w, *adj[100001], deg[100001] = {}, q[100001] = {};
	long long *block[100001] = {};
	edge e[200001];
	scanf("%d %d", &N, &M);
	for (i = 0; i < N - 1; i++) {
		scanf("%d %d", &u, &w);
		e[i*2].t = u;
		e[i*2].h = w;
		e[i*2+1].t = w;
		e[i*2+1].h = u;
		e[i*2].num = -1;
		e[i*2+1].num = -1;
		deg[u]++;
		deg[w]++;
	}
	for (i = 1; i <= N; i++) {
		adj[i] = (int*)malloc(sizeof(int) * deg[i]);
		if (deg[i] > SIZE) block[i] = (long long*)malloc(sizeof(long long) * ((deg[i] + SIZE - 1) / SIZE));
	}
	for (i = 0; i < N - 1; i++) {
		u = e[i*2].t;
		w = e[i*2].h;
		adj[u][q[u]++] = i * 2;
		adj[w][q[w]++] = i * 2 + 1;
	}
	
	int par[100001] = {}, head, tail;
	long long dp[100001] = {};
	par[1] = 1;
	q[0] = 1;
	for (head = 0, tail = 1; head < tail; head++) {
		u = q[head];
		for (i = 0; i < deg[u]; i++) {
			w = e[adj[u][i]].h;
			if (par[w] == 0) {
				par[w] = u;
				q[tail++] = w;
			}
		}
	}
	for (head--; head >= 0; head--) {
		u = q[head];
		dp[u] = 1;
		for (i = 0; i < deg[u]; i++) {
			w = e[adj[u][i]].h;
			if (w == par[u]) continue;
			else {
				if (e[adj[u][i]].num == -1) e[adj[u][i]].num = dp[w];
				dp[u] = dp[u] * (e[adj[u][i]].num + 1) % M;
			}
		}
	}
	printf("%lld\n", dp[1]);
	
	int j, k;
	for (head = 0; head < tail; head++) {
		u = q[head];
		if (deg[u] > SIZE) {
			for (i = 0; i <= (deg[u] - 1) / SIZE; i++) {
				for (j = 0, block[u][i] = 1; j < SIZE && i * SIZE + j < deg[u]; j++) block[u][i] = block[u][i] * (e[adj[u][i*SIZE+j]].num + 1) % M;
			}
		}
		for (i = 0; i < deg[u]; i++) {
			if (e[adj[u][i]^1].num >= 0) continue;
			else e[adj[u][i]^1].num = 1;
			if (deg[u] > SIZE) {
				for (k = 0; k < i / SIZE; k++) e[adj[u][i]^1].num = e[adj[u][i]^1].num * block[u][k] % M;
				for (j = i / SIZE * SIZE; j < deg[u] && j < (i / SIZE + 1) * SIZE; j++) if (j != i) e[adj[u][i]^1].num = e[adj[u][i]^1].num * (e[adj[u][j]].num + 1) % M;
				for (k = i / SIZE + 1; k <= (deg[u] - 1) / SIZE; k++) e[adj[u][i]^1].num = e[adj[u][i]^1].num * block[u][k] % M;
			} else {
				for (j = 0; j < deg[u]; j++) if (j != i) e[adj[u][i]^1].num = e[adj[u][i]^1].num * (e[adj[u][j]].num + 1) % M;
			}
		}
	}
	
	long long ans;
	for (u = 2; u <= N; u++) {
		ans = 1;
		for (i = 0; i < deg[u]; i++) ans = ans * (e[adj[u][i]].num + 1) % M;
		printf("%lld\n", ans);
	}
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 11836
#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    ll N , Q ;
    cin >> N >> Q ;
    string S ;
    cin >> S ;
    vector<int> vec(N + 1);
    int cnt = 0;
    for(ll i = 0 ; i < N ; i++) {
        vec[i] = cnt;
        if (S[i] == 'A' && S[i + 1] == 'C') {
            cnt += 1;
        }
    }
    for(ll j = 0 ; j < Q ;j++) {
        int l, r;
        cin >> l >> r;
        cout << vec[r - 1] - vec[l - 1] << endl;
    }
    return 0 ;
}

 


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e5+10;
const int INF=1e9+7;

int N, W;
int w[MAX];
ll v[MAX];
void input(){
	cin>>N>>W;
	rep1(i,N)cin>>w[i]>>v[i];
}

ll dp[105][MAX];
void solve(){
	rep(i,N)rep(we,W+1){
		dp[i+1][we]=max(dp[i+1][we], dp[i][we]);
		if(we+w[i+1]<=W)dp[i+1][we+w[i+1]]=max(dp[i+1][we+w[i+1]], dp[i][we]+v[i+1]);
	}
}

void output(){
	ll ans=0;
	rep(we, W+1)ans=max(ans, dp[N][we]);
	cout<<ans<<endl;
}

int main(){
  input();
  solve();
  output();
}

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

d = []
s = input().split()
sum = 0
for i in range(n):
  d.append(int(s[i]))
  sum += int(s[i])

d.sort()

if (d[int(n/2)-1]==d[int(n/2)]):
  print(0)
else:
  print(d[int(n/2)] - d[int(n/2)-1])

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int main() {
    ll n;
    cin >> n;

    if (n%2 == 1) {
        std::cout << 0 << '\n';
        return 0;
    }

    ll cnt = 0;
    int i = 1;
    while (true) {
        ll c = (ll)pow(5, i) * 2;
        if (c > n) break;
        cnt += n / c;
        i++;
    }
    std::cout << cnt << '\n';

    return 0;
}


Measured memory_bytes: 256
S = list(input())
Even = ["L","U","D"]
Odd = ["R", "U", "D"]
for i in range(len(S)):
  if (i+1) % 2 == 0 and S[i] not in Even:
    print("No")
    exit()
  elif (i+1) % 2 != 0 and S[i] not in Odd:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 3064
# 1  2   3  4   5   6     7   8  9 
# 男　女　男　女　男　（空）　女　男　女
# 1が男であれば、奇数は男になるが、それが入れ替わる点を探す
# 0 〜 N-1　を二分探索
# midが0と同じ性別であれば、分岐点はmid〜N-1にある
# 違う性別であれば分岐点は0〜midにある

N=int(input())

print(0,flush = True)
point0 = input()

if point0 == "Vacant":
  exit(0)

print(N-1,flush = True)
if input() == "Vacant":
  exit(0)
  
left = 0
right = N-1
while True:
  mid = abs(left + right) // 2
  print(mid,flush = True)
  val = input()
  if val == "Vacant":
    exit(0)
  if (mid%2 == 0 and point0 == val) or (mid%2 == 1 and point0 != val):
    left = mid
  else:
    right = mid


Measured memory_bytes: 3660
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

max1 = max(a)
max2 = sorted(a)[-2]

if a.count(max1) >= 2:
    for i in range(n):
        print(max1)
elif a.count(max1) == 1:
    for i in range(n):
        if a[i] == max1:
            print(max2)
        else:
            print(max1)

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#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 INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,X; cin>>N>>X;
    ll res = 0;
    vector<ll> m(N);
    rep(i,N){
        cin>>m[i];
        res += m[i];
    }
    ll ans = N;
    sort(m.begin(),m.end());
    ans += (X-res)/m[0];
    cout<<ans<<endl;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
 #define PI acos(-1)
typedef long long     ll;
 
//-*-*-*-*-*-*-*-*-
 
 

 
const int N=2e5+100;
//ll a[200000];
 
 
map<int,int>mr[1200],mc[1200];
#define lop(i,n) for(int i=0;i<n;++i)
//ll n,m,mod;

int dx[4] = {1 , 0 , 0 , -1} ;
int dy[4] = {0 , 1 , -1 , 0} ;
ll vis[70][60];

void finis(){cout<<-1;}

int main()
{  ios::sync_with_stdio(0);
    cin.tie(0);
  
     ll a[9];ll x,y;
     cin>>x>>y; if((x*4)<y||(x*2)>y||(y%2)==1){cout<<"No";}else{cout<<"Yes";}
       
   

      
   
  
 
 
 
 
 
 
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define ll long long int


using namespace std;

int main()
{
    ll t,n,item,temp,a,b,c,x,y,z,sum,flag;
    vector<ll>v;
    map<ll,ll>mp;
    cin>>a>>b>>c;
    mp[a]++;
    mp[b]++;
    mp[c]++;
    if(mp[5]==2 && mp[7]==1)
        cout<<"YES"<<endl;
        else
    cout<<"NO"<<endl;

    return 0;
}


Measured memory_bytes: 3608
import sys
input = sys.stdin.readline
from heapq import heappushpop

N = int(input())
A = [int(x) for x in input().split()]

# B_x = max {A_y | y\subset x}
# と思ったが、2元ずつ持つ必要がある。
# (値、何番から来たか)
B = []
for n,a in enumerate(A):
    arr = [(0,0),(a,n)]
    m = n
    while m:
        bit = m & (-m)
        (x,i),(y,j) = B[n-bit]
        if (x,i) != arr[-1]:
            heappushpop(arr,(x,i))
        if (y,j) != arr[-1]:
            heappushpop(arr,(y,j))
        m -= bit
    B.append(arr)

answer = [0]
for (x,i),(y,j) in B[1:]:
    z = answer[-1]
    if z < x + y:
        z = x + y
    answer.append(z)
print('\n'.join(map(str,answer[1:])))



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

using namespace std;

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

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    int h;
    cin >> h;

    if (h >= K) cnt++;
  }

  cout << cnt << endl;
  return 0;
}


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


int main(){
    int a,b;
    char op;
    cin>>a>>op>>b;

    cout<< ((op == '+') ? a+b : a-b) <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void sol(){
 	int n;
 	cin >> n;
 	int rem;
 	rem=n% 1000;
 	if (rem==0){
 		cout << 0<< endl;
 	}
 	if ( rem >0){
 		cout<< 1000-rem<< endl;
 	}
}
int main()
{
	sol();
}

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

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    sort(H.rbegin(), H.rend());
    ll ans = 0;
    for (int i=K; i<N; ++i) {
        ans += H[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
// V solo
#include <bits/stdc++.h>

#define forn(i, a, b) for (int i = a; i <= b; ++i)
#define forr(i, a, b) for (int i = a; i >= b; --i)

using namespace std;

const int N = (int)1e5 + 1;
const long long INF = 1e13 + 7;

typedef long long ll;
typedef long double ld;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

string s;
int k;
int main (){
  cin >> s >> k;
  set < string > st;
  forn (pos, 0, s.size()){
    forn (i, 0, s.size() - 1){
      if (i + pos > s.size()) break;
      string cur = s.substr (i, pos);
      if ((int)cur.size() <= k) st.insert(cur);
    }
  }
  int cnt = -1;
  for (auto i : st){
    cnt++;
    if (cnt == k) return cout << i << "\n", 0;
  }
  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int faccnt;
ll factor[35][2]; 
void getfactor(ll x)
{
	faccnt = 0;
	for(ll i=2; i*i<=x; i++)
	{
		if(x%i==0)
		{
			factor[faccnt][1] = 0;
			factor[faccnt][0] = i;
			while(x%i==0) x /= i, factor[faccnt][1]++;
			faccnt++;
		}
	}
	if(x!=1) factor[faccnt][0] = x, factor[faccnt++][1] = 1;
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	ll x, y;
 	cin >> x >> y;
 	getfactor(__gcd(x, y));
 	factor[faccnt++][1] = 1;
 	cout << faccnt;
	return 0;
}


Measured memory_bytes: 256
import sys,string
t = string.maketrans('abcdefghijklmnopqrstuvwxyz','bcdefghijklmnopqrstuvwxyza')
for s in sys.stdin:
	s = s.strip()
	while not ('the' in s or 'this' in s or 'that' in s):
		s = s.translate(t)
	print s

Measured memory_bytes: 4372
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  vector<int>p(M);
  vector<string>S(M);
  for (int i = 0; i < M; i++) {
    cin >> p.at(i) >> S.at(i);
  }
  vector<int>AC(N,-1);
  for (int i = M-1; i >= 0; i--) {
    if (S.at(i) == "AC"){
      AC.at(p.at(i)-1) = i;
    }
  }
  int ACcount = 0;
  for (int i = 0; i < N; i++) {
    if (AC.at(i) != -1){
      ACcount++;
    }
  }
  
  int WAcount = 0;
  for (int i = 0; i < M; i++) {
    if (AC.at(p.at(i)-1) != -1 && AC.at(p.at(i)-1) > i){
      WAcount++;
    }
  }
  cout << ACcount << ' ' << WAcount << endl;
}
  



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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

bool check(const char &x) {
    return x != 'A' && x != 'C' && x != 'G' && x != 'T';
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string S; cin >> S;

    int res = 0;
    int start, end;
    REP(i, S.size()) {
        if (check(S[i])) {
            continue;
        }

        start = i;
        end = i;
        while(end < S.size()) {
            if (check(S[++end])) break;
        }

        res = max(res, end - start);

        i = end;
    }

    cout << res << endl;

}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
for i in range(N-1):
    ans += B[A[i] - 1]
    if (A[i+1] - A[i]) == 1:
        ans += C[A[i]-1]
ans += B[A[N-1] - 1]
print(ans)

Measured memory_bytes: 3064
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::cmp::max;

fn f(u: usize, p: usize, pc: u32, edges: &mut Vec<Vec<(usize, usize, u32)>>) -> u32 {
    let mut c: u32 = 0;
    let mut ans = 0;
    for i in 0..edges[u].len() {
        let v = edges[u][i].1;
        if v == p {
            continue;
        }

        c += 1;
        if c == pc {
            c += 1;
        }

        edges[u][i].2 = c;
        let tmp = f(v, u, c, edges);
        if tmp > ans {
            ans = tmp;
        }
    }
    max(c, ans)
}

fn main() {
    let n: usize = read();
    let abv: Vec<Vec<usize>> = read_vec2(n - 1);
    let mut edges: Vec<Vec<(usize, usize, u32)>> = vec![vec![]; n];
    for i in 0..n - 1 {
        let ab = &abv[i];
        let a = ab[0] - 1;
        let b = ab[1] - 1;
        edges[a].push((i, b, 0));
        edges[b].push((i, a, 0));
    }
    let ans = f(0, n, n as u32, &mut edges);

    println!("{}", ans);

    let mut v = vec![];
    for i in 0..n {
        v.append(&mut edges[i]);
    }

    v.sort_by(|x, y| x.0.partial_cmp(&y.0).unwrap());

    for i in 0..n - 1 {
        println!("{}", max(v[2 * i].2, v[2 * i + 1].2));
    }
}


Measured memory_bytes: 33020
#include<iostream> 
#include<string> // for string class
#include <math.h> 
#include<bits/stdc++.h> 
using namespace std; 
int main() 
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
    sort(a,a+n);
    int flag=0;
    for(int i=0;i<n-1;i++)
    {
    	if(a[i+1]-a[i]==0)
    	{
    		flag=1;
    	break;
    }

    }
    if(flag==1)cout<<"NO";
    else cout<<"YES";


 return 0;

}

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

using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  
  vector<int> h(N);
  
  for (int i = 1; i <= N; i++) {
    if (A[i] >= A[i - 1]) continue;
    h[i] = A[i - 1] - A[i];
    A[i] += h[i];
  }
  
  ll ans = 0;
  rep(i, N) ans += h[i];
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 4732
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();
        int a = nextInt(), b = nextInt();
        for (int i = 1; i <= 3; i++) {
            if (i != a && i != b) System.out.println(i);
        }
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

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

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

using namespace std;

int main(void) {
  int n;
  cin >> n;
  vector <pair<int, int>> ab;
  for(int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    ab.push_back(pair<int, int> (x, y));
  }

  sort(ab.begin(), ab.end());
  reverse(ab.begin(), ab.end());
  long long ans = ab[0].second;
  for(int i = 1; i < n; i++) {
    ans += ab[i - 1].first - ab[i].first;
  }
  ans += ab[n - 1].first;
  cout << ans << endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <tuple>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

using T = tuple<ll,ll>;
using Graph = vector<vector<T>>;

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

    ll n,k;
    ll d;
    cin >> n >> k;
    vector<ll> snk(n, 0);
    rep(i,0,k)
    {
        cin >> d;
        ll h;
        rep(j,0,d)
        {
            cin >> h;
            --h;
            ++snk[h];
        }
    }

    ll ans(0);
    rep(i,0,n)
    {
        if (snk[i]==0)
            ans++;
    }    

    cout << ans << endl;

    return 0;
}


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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)

int d, g;
vector<int> p, c;

int sel (int k, vector<bool> l) {
  int mi = 0;

  if (k < d) {
    l.pb(true);
    mi = sel(k + 1, l);
    l[k] = false;
    mi = min(mi, sel(k + 1, l));
    //cout << mi << endl;;
    return mi;
  } else {
    //REP(i, d) cout << l[i] << " ";
    // cout << endl;
    int po = 0;
    int x = 0;
    for(int i=d-1;i>=0;i--) {
      if(x == 0 && l[i] == false) {
        x = i;
      }
      if(l[i] == true) {
        po += p[i] * (i+1) * 100 + c[i];
        mi += p[i];
      }
    }

    //    cout << "mi " << mi << endl;
    
    if (po >= g) {
      return mi;
    } else {
      int y = p[x]-1;
      REP(i, p[x]) {
        if(po + 100 * (x+1) * (i+1) >= g) {
          return mi + i + 1;
        }
        if(i == p[x]-1 && (po + 100 * (x+1) * p[x] + c[x] >= g)) {
          return mi + p[x];
        }
      }
      return INT_MAX;
    }
  }
}

signed main () {
  // 01:41~
  cin.tie(0);
  cin >> d >> g;
  int tmpp, tmpc;
  REP(i, d) {
    cin >> tmpp >> tmpc;
    p.pb(tmpp);
    c.pb(tmpc);
  }

  vector<bool> l;
  int ans = sel(0, l);
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const ll mx=1000010;
const ll mod=1e9+7;


int main(){
  int n;
  cin >> n;
  vector<ll> a(n),b(n);
  rep(i,n){
    cin >> a[i] >> b[i];
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  ll amid,bmid;
  ll ans;
  if(n%2==1){
    amid = a[(n/2)];
    bmid = b[(n/2)];
    ans = bmid-amid+1;
  } else {
    amid = (a[n/2]+a[n/2-1]);
    bmid = (b[n/2]+b[n/2-1]);
    ans = bmid-amid+1;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6380
N = int(input())
T, A = map(int, input().split())
H_list = list(map(int, input().split()))

kouho = 100000000000
'''
3
21 -11
81234 52141 94124
'''
for i, h in enumerate(H_list):
    if i == 0:
        ans = i
        kouho = T - h * 0.006
        continue
    kion = T - h * 0.006
    #print(A)
    if abs(A - kion) < abs(A - kouho):
        #print(kion)
        #print(pre)
        #print(abs(A - kion),'kion')
        #print(abs(A - pre),'pre')
        ans = i
        kouho = T - h * 0.006
print(ans + 1)

Measured memory_bytes: 3064
import java.util.Scanner;
class Main {
	public static void main(String[] args){
		 Scanner scn = new Scanner(System.in);
		    int a = scn.nextInt();
		    int b = scn.nextInt();
		
		  System.out.print(a*b +" ");
		  System.out.println(2*(a+b));
		
	}

}

Measured memory_bytes: 26196
#include<iostream>
#include<vector>
#include<complex>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n)   REP(i,0,n)

typedef complex<double> P;
const double eps = 1e-10;

bool isin(P &a,double r,P &tar){
  return abs(a-tar) < r+eps;
}

int is_intersected_circle(P a,P b,double r1,double r2){
  double d = abs(a-b);
  if (d<eps && abs(r1-r2)<eps)return 3;
  if (d+r2 < r1)return 0;
  if (d+r1 < r2)return 1;
  if (d > r1+r2)return 4;
  return 2;
}

const int N = 1000;
int dp[N];
vector<int> edge[N];
bool vis[N];

void tsort(int now,vector<int> &ord){
  if (vis[now])return;
  vis[now]=true;
  rep(i,edge[now].size())tsort(edge[now][i],ord);
  ord.push_back(now);
}

int make(int n,vector<int> &a,P &s,P *in,double *r){
  rep(i,a.size()){
    int &ind1 = a[i];
    rep(j,a.size()){
      int ind2 = a[j];
      if (ind1 == ind2)continue;
      if (is_intersected_circle(in[ind1],in[ind2],r[ind1],r[ind2]) == 0){
	edge[ind1].push_back(ind2);
      }
    }
  }
  
  vector<int> ord;
  rep(i,a.size())if (!vis[a[i]])tsort(a[i],ord);
  //reverse(ord.begin(),ord.end());
  //rep(i,ord.size())cout << ord[i] <<" "; cout << endl;
  //cout << "ord.size() "<< ord.size() << endl;
  rep(i,a.size())dp[a[i]]=0;
  int ret=0;
  rep(i,ord.size()){
    int &now = ord[i];
    dp[now]=1;
    rep(i,edge[now].size())dp[now]=max(dp[now],dp[edge[now][i]]+1);
    ret=max(ret,dp[now]);
  }
  return ret;
}

int solve(int n,P *s,P *in,double *r){
  vector<int> a[2];
  rep(i,n){
    bool iscon[2]={false};
    rep(j,2)iscon[j]=isin(in[i],r[i],s[j]);
    if (iscon[0]&&iscon[1])continue;
    else if (iscon[0])a[0].push_back(i);
    else if (iscon[1])a[1].push_back(i);
  }

  int ret=0;
  rep(i,2)ret=max(ret,make(n,a[i],s[i],in,r));
  /*
  rep(i,2){
    rep(j,a[i].size())cout << a[i][j]<<" ";
    cout << endl;
  }
  rep(i,n)cout << "dp[i] " << dp[i] << endl;
  */
  rep(i,a[0].size()){
    int &ind1=a[0][i];
    P &a1=in[ind1];
    double &r1=r[ind1];
    rep(j,a[1].size()){
      int &ind2=a[1][j];
      P &a2=in[ind2];
      double &r2=r[ind2];
      //cout << is_intersected_circle(a1,a2,r1,r2) << endl;
      if (is_intersected_circle(a1,a2,r1,r2) == 2)continue;
      //cout << ind1 <<" " << ind2 << " " << dp[ind1] <<" " << dp[ind2] << endl;
      ret=max(ret,dp[ind1]+dp[ind2]);
    }
  }
  return ret;
}

main(){
  int n;
  P tar[2];
  static double r[N];
  static P in[N];
  while(cin>>n && n){
    rep(i,n)edge[i].clear(),vis[i]=false;
    rep(j,2)cin>>tar[j].real()>>tar[j].imag();
    rep(i,n)cin>>in[i].real()>>in[i].imag()>>r[i];
    cout << solve(n,tar,in,r) << endl;
  }
  return false;
}

Measured memory_bytes: 5240
# include<bits/stdc++.h>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 1000000007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
# define AU(i,x)    for(auto i=x.begin(); i!=x.end(); ++i)
# define ALL(A) A.begin(),A.end()
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
inline char nc(){
    static char buf[1000000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int Scan(){
    char ch=nc();int sum=0, f=1;
    if (ch=='-') f=-1, ch=nc();
    while(!(ch>='0'&&ch<='9'))ch=nc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
    return sum*f;
}
int ps4[4][2]={0,1,0,-1,1,0,-1,0};
int ps8[8][2]={0,1,0,-1,1,0,-1,0,1,1,1,-1,-1,-1,-1,1};
inline int min(int a,int b,int c) {return min(a,min(b,c));}
inline int max(int a,int b,int c) {return max(a,max(b,c));}
inline int min(int a,int b,int c,int d){return min(min(a,b,c),d);}
inline int max(int a,int b,int c,int d){return max(max(a,b,c),d);}
//struct Edge{int p, next, w;}edge[maxn];
//inline add_edge(int u, int v, int w){edge[cnt]=Edge{v,head[u],w}; head[u]=cnt++;}
const int N=100005;
///Code begin..................................................................


int main ()
{
    int n, m;
    scanf("%d%d",&n,&m);
    int cnt=1;
    FOR(i,1,m) cnt<<=1;
    printf("%lld\n",(LL)(m*1900+(n-m)*100)*cnt);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
//typedef vector<pair<ll,ll>> vp;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
const ll INF=99999999999999999;
ll a,b,c,d,e,f,ans=0;
int main(){
    ll n,x;
    cin>>n>>x;
    while(n>0){
    rep(i,n){
        rep(j,i){
            rep(k,j){
                if(i+j+k==x-3)ans++;
              //cout<<"a"<<endl;
            }
        }
    }
    cout<<ans<<endl;
    ans=0;

    cin>>n>>x;
    }
}


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

int main(){
	string w;
  	cin >> w;
  	bool res = true;
  	sort(begin(w),end(w));
  	if(w.size()%2 == 1) {
      	res = false;
      	cout << "No" << endl;
    }
  	else{	
    	for(int i =0;i < w.size();i++){
          	if(w[i-1] == w[i] && w[i] != w[i+1]){
              	if((i+1)%2 != 0){
                  	cout << "No" << endl;
                    res = false;
                    break;
             	}
            }
            else if(w[i-1] != w[i] && w[i] != w[i+1]){
              		cout << "No" << endl;
                  	res = false;
                  	break;
       		}
     	}
    }
  	if(res) cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
//ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
//ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
int a[maxn];
int solve(int x)
{
    if(x%10 != x/10000)return 0;
    if(x/10%10 != x/1000%10)return 0;
    return 1;
}
void init()
{
    a[9999] = 0;
    for(int i = 10000; i <= 99999; ++i)
    a[i] = a[i-1] + solve(i);
}
int main()
{
   init();
   int x,y;
   while(cin>>x>>y)
   {
       cout<<a[y] - a[x-1]<<endl;
   }
}
















Measured memory_bytes: 640
import math
A,B,H,M = [int(x) for x in input().split()]
p = math.pi * 2

hx = A*math.sin((H/12 + 1/12 * M/60) * p)
hy = A*math.cos((H/12 + 1/12 * M/60) * p)
mx = B*math.sin(M/60 * p)
my = B*math.cos(M/60 * p)

ans2 = (hx - mx)**2 + (hy - my)**2
print(math.sqrt(ans2))


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

using namespace std;
typedef pair<int, int> P;
// input


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
    int num, ans = 0;
    cin >> num;
    vector<int> number(num);
    rep(i,num) cin >> number[i];
    
    vector<int> buf(3);
    rep(i, num-2) {
        buf[0] = number[i];
        buf[1] = number[i+1];
        buf[2] = number[i+2];
        sort(buf.begin(),buf.end());

        if(buf[1] == number[i+1])ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool checked[110][110];

int main()
{
  int H, W;
  cin >> H >> W;
  char c;
  vector<int> A(26, 0);
  for (int i = 0; i < H * W; i++)
  {
    cin >> c;
    A.at((int)(c - 'a'))++;
  }
  int cnt = 0;
  vector<int> v(5, 0);
  if (H % 2 && W % 2)
  {
    v.at(1)++;
    cnt++;
  }
  if (H % 2)
  {
    for (int i = 0; i < W / 2; i++)
    {
      v.at(2)++;
      cnt += 2;
    }
  }
  if (W % 2)
  {
    for (int i = 0; i < H / 2; i++)
    {
      v.at(2)++;
      cnt += 2;
    }
  }
  for (int i = 0; i < (H * W - cnt) / 4; i++)
  {
    v.at(4)++;
  }
  for (int i = 0; i < (int)(A.size()); i++)
  {
    if (A.at(i) == 0)
      continue;
    if (A.at(i) % 2 == 1)
    {
      if (v.at(1) == 0)
      {
        cout << "No" << endl;
        return 0;
      }
      else
      {
        A.at(i)--;
        v.at(1)--;
      }
    }
    while (A.at(i) >= 4 && v[4] >= 1)
    {
      A.at(i) -= 4;
      v[4]--;
    }
    while (A.at(i) >= 2 && v[2] >= 1)
    {
      A.at(i) -= 2;
      v[2]--;
    }
    if (A.at(i) > 0)
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3604
#include <iostream>
    #include <string>
    #include <set>  
    #include <stack>
    #include <algorithm>
    #include <vector>
    #include <cmath>
    #include <queue>
    #include <deque>
    #include <cstring>
    #include <cstdio>
    #include <map>
    #include <numeric>
    #include <cassert>
    #include <iomanip>
    #include <sstream>
    #include <ctime>
    #include <bitset> 
using namespace std;
#define for1(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,maxn) for1(i,0,maxn)
#define ford(i,b,a) for(int i=(int)(b)-1;i>=a;--i)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,pii > piii;
#define inf 0x3f3f3f3f
#define mod 1000000007
#define st first
#define nd second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define dprintf(...) printf(__VA_ARGS__)
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll a,b,c,d;
		cin>>a>>b>>c>>d;
		if(a<b||d<b)
		{
			cout<<"No"<<endl;
			continue;
		}
		else if(c>=b)
		{
			cout<<"Yes"<<endl;
			continue;
		}
		ll g=__gcd(b,d);
		ll res=((a-c)/g)*g;
		if(res==(a-c))res-=g;
		cout<<(res>(a-b)?"No":"Yes")<<endl;
	//	system("pause");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int a=0,b=0,c=0,d=0,e,f,g,j,i;
vector<int> h,w;
int main() {
     while(cin>>e&&e!=0){
h.push_back(0);
w.push_back(0);
for(int ii=1;ii<e;ii++){
cin>>f>>g;
if(g==0){j=h[f];i=w[f]-1;}else
if(g==1){j=h[f]-1;i=w[f];}else
if(g==2){j=h[f];i=w[f]+1;}else{j=h[f]+1;i=w[f];}
h.push_back(j);
w.push_back(i);
a=max(a,j);b=min(b,j);c=max(c,i);d=min(d,i);
}
cout<<c-d+1<<" "<<a-b+1<<endl;
a=0;b=0;c=0;d=0;h.clear();w.clear();}
    return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;

signed main() {
    int A,B,C,D,E;
    cin >> A >> B >> C >> D >> E;
    int now_time = 0;
    now_time += (A/10) * 10;
    now_time += (B/10) * 10;
    now_time += (C/10) * 10;
    now_time += (D/10) * 10;
    now_time += (E/10) * 10;

    int min_rest = 10;
    int count_rest = 0;
    if(A%10 != 0){
        count_rest++;
        min_rest = min(min_rest, A%10);
    }
    if(B%10 != 0){
        count_rest++;
        min_rest = min(min_rest, B%10);
    }
    if(C%10 != 0){
        count_rest++;
        min_rest = min(min_rest, C%10);
    }
    if(D%10 != 0){
        count_rest++;
        min_rest = min(min_rest, D%10);
    }
    if(E%10 != 0){
        count_rest++;
        min_rest = min(min_rest, E%10);
    }

    if(count_rest > 0){
        now_time += min_rest;
        now_time += (count_rest -1 ) * 10;
    }
    cout << now_time << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string S;
	cin>>S;
	if (S.compare("2019/04/30")<=0){
		cout<<"Heisei"<<endl;
	}else{
		cout<<"TBD"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
 
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
 
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;
deque<int> a;
int main()
{
    //freopen("in.txt", "r", stdin);
    //ios::sync_with_stdio(false); cin.tie(0);
    int n,temp;
    bool addback = false;
    cin >> n;
    FOR(i,0,n)
    {
        cin >> temp;
        if (addback)
        {
            a.push_back(temp);
        }else{
            a.push_front(temp);
        }
        
        addback ^= 1;
    }
    
    if (n & 1){
            while (!a.empty())
            {
                cout << a.front() << " ";
                a.pop_front();
            }

        return 0;
    };
    
        while (!a.empty())
        {
            cout << a.back() << " ";
            a.pop_back();
        }
}

Measured memory_bytes: 2944
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	int[] v = ReadIntArray();
	Array.Sort(v);
	double ans = (double) v[0];
	for (int i = 1; i < n; i++)
	{
	    ans = (ans + v[i]) / 2.0;
	}
	WriteLine(ans);
    }
}


Measured memory_bytes: 13396