akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))
#define LLONG_MAX numeric_limits<long long>::max()
#define INT_MAX numeric_limits<int>::max()

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<vb>		vvb;
typedef vector<vs>		vvs;
typedef vector<vc>		vvc;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " " << p.second << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}


template <typename T>
void vecOutPadding(vector<T>& vec, string pad = " ") {
	for (const T& elem : vec)
		cout << elem << pad;
}

template <typename T>
void matOut(vector<vector<T>>& mat) {
	for (const auto& row : mat) {
		for (const T& col : row)
			cout << col << " ";
		cout << endl;
	}
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	string s;
	cin >> s;
	yn(s.substr(0, 4) == "YAKI");

	return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) cout << #var << ": " << var << endl
using namespace std;
using Int = int64_t;
using Uint = uint64_t;
constexpr Uint mod = 1e9 + 7;
constexpr Int INF = LLONG_MAX;
constexpr Int Int_max = LLONG_MAX;
constexpr Int Int_min = LLONG_MIN;
using Container = vector<Int>;
template<typename T>
using Grid = vector<vector<T>>; // 二次元配列。[y][x]
template<typename T, typename U>
using Umap = unordered_map<T, U>;
template<typename T>
using Uset = unordered_set<T>;
template<typename T>
using P = pair<T, T>;


int main() {

	Int N, K; cin >> N >> K;
	Container H(N);
	rep(i, N)cin >> H[i];
	sort(H.rbegin(), H.rend());
	Int sum = 0;
	for (int i = min(K, N); i < N; ++i) {
		sum += H[i];
	}

	cout << sum << endl;

}

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
using namespace std;

typedef pair<int,int> pii;

inline void dec(map<int,int> &mp, int x){
	if(!--mp[x]){ mp.erase(x); }
}

inline int dif(map<int,int> &mp){
	map<int,int>::iterator it = mp.end();
	--it;
	return it->first - mp.begin()->first;
}

bool check(const vector<pii> &v, int y0, int th){
	int n = v.size();
	map<int,int> mpx, mpy;
	for(int i = 0; i < n; ++i){
		++mpx[v[i].first];
		++mpy[v[i].second];
	}
	if(dif(mpx) <= th && dif(mpy) <= th){ return true; }

	int lt = 0;
	for(int i = 0; i < n; ++i){
		while(v[lt].first < v[i].first - th){
			if(v[lt].second <= y0 + th){
				++mpx[v[lt].first];
				++mpy[v[lt].second];
			}
			++lt;
		}
		if(v[i].second <= y0 + th){
			dec(mpx, v[i].first);
			dec(mpy, v[i].second);
			if(dif(mpx) <= th && dif(mpy) <= th){ return true; }
		}
	}
	return false;
}

int main(){
	int n;
	scanf("%d", &n);
	vector<pii> v(n);
	int y0 = 1 << 30;
	for(int i = 0; i < n; ++i){
		int x, y;
		scanf("%d%d", &x, &y);
		v[i] = pii(x + y, x - y);
		y0 = min(y0, v[i].second);
	}
	sort(v.begin(), v.end());
	
	int left = 1, right = 300000;
	while(left < right){
		int mid = (left + right) >> 1;
		if(check(v, y0, mid)){
			right = mid;
		}
		else{
			left = mid + 1;
		}
	}
	printf("%d\n", left);
}

Measured memory_bytes: 9716
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

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

    int N;
    cin >> N;

    vector<int> odd(N / 2);
    vector<int> even(N / 2);
    REP(i, N / 2) { cin >> odd.at(i) >> even.at(i); }

    int ans = 0;
    map<int, int> odd_m;
    REP(i, N / 2) { odd_m[odd[i]]++; }
    int e1v, e1k, e2v, e2k;
    e1v = e1k = e2v = e2k = 0;
    for (auto itr = odd_m.begin(); itr != odd_m.end(); ++itr) {
        if (e1v < itr->second) {
            e2v = e1v;
            e2k = e1k;
            e1v = itr->second;
            e1k = itr->first;
        } else if (e2v < itr->second) {
            e2v = itr->second;
            e2k = itr->first;
        }
    }
    map<int, int> even_m;
    REP(i, N / 2) { even_m[even[i]]++; }
    int o1v, o1k, o2v, o2k;
    o1v = o2v = o1k = o2k = 0;
    for (auto itr = even_m.begin(); itr != even_m.end(); ++itr) {
        if (o1v < itr->second) {
            o2v = o1v;
            o2k = o1k;
            o1v = itr->second;
            o1k = itr->first;
        } else if (o2v < itr->second) {
            o2v = itr->second;
            o2k = itr->first;
        }
    }
    // cout << "e1k e1v e2k e2v" << e1k << e1v << e2k << e2v << endl;
    // cout << "o1k o1v o2k o2v" << o1k << o1v << o2k << o2v << endl;
    if (e1k != o1k) {
        cout << N - e1v - o1v << "\n";
    } else {
        cout << min((N - e1v - o2v), (N - e2v - o1v)) << endl;
    }

    return 0;
}


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

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

    char s[10000];
    scanf("%s", s);

    int t = strlen(s);
    for(int i=0; i<t; i++){
        if(s[i] + n > 90){
            s[i] = s[i] + n -26;
        }else{
            s[i] = s[i] + n;
        }
    }
    printf("%s", s);
}

Measured memory_bytes: 1744
fun main() {
  val S = readString()
  val T = readString()

  fun f(i: Int): Int {
    if (S.length - i < T.length) return Int.MAX_VALUE
    var cnt = 0
    for (j in T.indices) {
      if (S[i + j] != T[j]) cnt++
    }
    return cnt
  }

  val result = (S.indices).map { f(it) }.min()
  println(result)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 38108
#include <iostream>
#include <string>
#include <vector>

using namespace std;

long sum_all(string& S, int op)
{
    vector<string> tasite_list;
    string x=string(1, S[0]);
    for (int i=0;i<S.size()-1;i++) {
        if ( (op>>i)&1 ) {
            tasite_list.push_back(x);
            x=string(1,S[i+1]);
        } else {
            x+=string(1,S[i+1]);
        }
    }
    
    tasite_list.push_back(x);
    
    long sum=0;
    for (int i=0;i<tasite_list.size();i++) {
        sum+=stol(tasite_list[i]);
    }
    
    return sum;
}

int main()
{
    string S;
    cin>>S;
    long sum=0;
    
    for (int op=0;op<1<<(S.size()-1);op++) {
        sum+=sum_all(S, op);
    }
    
    cout<<sum<<endl;
    
    return 0;
}

Measured memory_bytes: 256
h, w = (int(x) for x in input().split())
s = []
ans = []
rev = ""
for row in range(1, h+1):
    for col, t in enumerate(input()):
        s.append([(row,col+1),t])

for index, factor in enumerate(s):
    count =0
    if factor[1] != "#":
        if w == 1:
            for point in [index-1, index+1]:
                if 0 <= point and point < len(s) and s[point][1] == "#":
                    count += 1
        elif (index+1)%w == 1:
            for point in [index +1,index -w+1, index -w, index +w, index +w+1]:
                if 0 <= point and point < len(s) and s[point][1] == "#":
                    count += 1
        elif (index+1)%w == 0:
            for point in [index -1,index -w, index -w-1, index +w-1, index +w]:
                if 0 <= point and point < len(s) and s[point][1] == "#":
                    count += 1
        else:
            for point in [index -1, index +1,index -w+1, index -w, index -w-1, index +w-1, index +w, index +w+1]:
                if 0 <= point and point < len(s) and s[point][1] == "#":
                    count += 1
        ans.append(count)
    else:
        ans.append("#")

while(ans != []):
    for num in range(w):
        rev += str(ans[0])
        del ans[0]
    rev += "\n"

print(rev)

Measured memory_bytes: 9184
use std::collections::HashSet;

fn f(mut x:i32) -> i32{
    if x%2 == 0 { x/2 } else { 3*x+1 }
}

fn main(){
    let mut x:i32 = getline().trim().parse().unwrap();
    let mut h = HashSet::new();
    let mut i = 1;
    loop{
        h.insert(x);
        i += 1;
        let x2 = f(x);
        if h.contains(&x2) {
            println!("{}", i);
            break;
        }
        x = x2;
    }
}

fn getline() -> String{
    let mut __ret=String::new();
    std::io::stdin().read_line(&mut __ret).ok();
    return __ret;
}


Measured memory_bytes: 4352
"""
from itertools import product
n = input()
ans = 0

for i in range(3,len(n)+1):
    for p in product("357",repeat=i):
        if int("".join(list(p))) > int(n): continue
        if p.count("3")*p.count("5")*p.count("7") != 0: ans += 1

print(ans)
"""

n = int(input())

def bfs(x):
    if int(x) > n: return 0
    cnt = 0
    if x.count("3")*x.count("5")*x.count("7") != 0: cnt = 1
    return cnt + bfs(x+"3") + bfs(x+"5") + bfs(x+"7")

print(bfs("0"))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};
/*
const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
*/

int main(){
    int N,K; cin >> N >> K;
    string s; cin >> s;
    //Lmax
    vector<int> L(0),R(0),sz(0);
    int tmp = 1;
    for (int i = 1; i < s.size(); i++){
        if (s[i-1] == s[i]){
            tmp++;
        } else {
            if (s[i] == 'R'){
                sz.push_back(tmp);
            } else {
                sz.push_back(tmp);
            }
            tmp = 1;
        }
    }
    if (tmp >= 1) sz.push_back(tmp);
    if (sz.size() % 2 == 0){
        if (sz.size()/2 <= K){
            cout << N-1 << endl;
            return 0;
        } 
    } else {
        if (sz.size()-1 <= 2*K){
            cout << N-1 << endl;
            return 0;
        }
    }

    int length = 0,mx = 0;
    for (int i = 0; i < 2*K+1; i++){
        length += sz[i];
    }
    length--;
    
    for (int i = 2*K+1; i < sz.size(); i++){
        length += sz[i]-1;
    }
    //cout << "check : " << length << endl;
    mx = max(length,mx);

    int in = 1;
    for (int i = 2*K+1; i < sz.size(); i++){
        length -= sz[in];
        length += sz[in]-1;
        length -= sz[in-1];
        length += sz[in-1]-1;
        in += 2;

        length -= sz[i]-1;
        length += sz[i];
        i++;
        mx = max(mx,length);
        //cout  << "check : " << length << endl;
    }
    cout << mx << endl;
}

Measured memory_bytes: 1020
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string S = cin.ReadLine;
            DateTime t =  new DateTime(2019,4,30);
            DateTime sTime;
            DateTime.TryParse(S, out sTime);
            if (sTime <= t)
            {
                Console.WriteLine("Heisei");
            }
            else
            {
                Console.WriteLine("TBD");
            }

        }

    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13664
#include <bits/stdc++.h>
int n,k,cnt,a[10000],b[10000],ans;
const int mu=1000000007;
int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=x*1ll*x%mu)
		if (y&1) ans=ans*1ll*x%mu;
	return ans;
}
int main(){
	scanf("%d%d",&n,&k);
	int x=(int)sqrt(n);
	for (int i=1;i<=x;i++) 
		if (n%i==0) a[++cnt]=i;
	int t=cnt;
	if (a[cnt]*a[cnt]==n) t--;
	for (int i=t;i>=1;i--) a[++cnt]=n/a[i];
	for (int i=1;i<=cnt;i++){
		b[i]=ksm(k,(a[i]+1)/2);
		for (int j=1;j<i;j++) 
			if (a[i]%a[j]==0) b[i]=(b[i]-b[j])%mu;
		b[i]=(b[i]+mu)%mu;
		if (a[i]%2==0) ans=(ans+a[i]/2*1ll*b[i])%mu;
		else ans=(ans+a[i]*1ll*b[i])%mu;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
a = [int(input()) for i in range(4)]
ans = 0;
for i in range(a[0]+1):
    for j in range(a[1]+1):
        for k in range(a[2]+1):
            b = i * 500 + j * 100 + k * 50
            if b == a[3]:
                ans += 1
print(ans)

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

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n,A[100100],id[100100],bl[100100];
ll tot,las;
inline bool cmp(const int a,const int b)
{
	return A[a]==A[b]? a>b:A[a]<A[b];
}
signed main()
{
	n=read();
	for(int i=1;i<=n;i++) A[i]=read(),id[i]=i;
	sort(id+1,id+1+n,cmp);
	for(int i=1;i<=n;i++) bl[id[i]]=i;
	for(int i=1,j=1;i<=n;i++)
	{
		if(bl[i]<j) {printf("0\n"); continue;}
		while(j<=bl[i]) tot+=A[id[j]],j++;
		printf("%lld\n",tot+(n-j+1)*A[i]-las);
		las=tot+(n-j+1)*A[i];
	}
	return 0;
}

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

public class Main {

    void solve() {
        int N = in.nextInt();
        int A = in.nextInt();
        out.println(N*N - A);
    }


    FastScanner in;
    PrintWriter out;

    void run() {
        in = new FastScanner();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

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

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

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }

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

}

Measured memory_bytes: 21204
#include<iostream>
#include<cmath>

using namespace std;


int main(){

	long long N,x[2],y[2],time[2];

	cin >> N;

	time[0]=x[0]=y[0]=0; 

	bool can=1;
	for(int i=0; i<N; i++){

		cin >> time[1]>>x[1]>>y[1]; 

		if(abs( x[1]-x[0] )+ abs(y[1]-y[0] ) <= time[1]-time[0]  && (abs( x[1]-x[0] )+abs(y[1]-y[0] ))%2 == (time[1]-time[0])%2){

		

		}

		else{
			
			can=0;
			break;


		}
	//	cout<<abs(x[1]-x[0] )+abs(y[1]-y[0])<<" "<<time[1]-time[0] <<" "<<(abs(x[1]-x[0]) +abs(y[1]-y[0]) )%2<<" "<< (time[1]-time[0])%2<<endl;

		time[0]=time[1];
		x[0]=x[1];
		y[0]=y[1];

	}

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





}

Measured memory_bytes: 256
from functools import reduce
x, y = map(int, input().split())
mod = pow(10,9)+7

min_value = min(x, y)
max_value = max(x, y)
#print(min_value, max_value)
dif_value = max_value - min_value
#print(dif_value)
a_value   = min_value - dif_value
a_num     = int(a_value*2*(1/3))
#print(a_value, a_num)
n = dif_value + a_num
r = int(a_num*0.5)
#print(n, r)

def nCr(n,r,DIV):
  if r<n-r:
    r=n-r
  if r==0:
    return 1
  f=lambda x,y:x*y%DIV
  X=reduce(f,range(n-r+1,n+1))
  Y=reduce(f,range(1,r+1))
  return X*pow(Y,DIV-2,DIV)%DIV

if a_value % 3 == 0:
    print(nCr(n, r, mod))
else:
    print(0)

Measured memory_bytes: 3828
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BChristmasEveEve {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n;
	    in >> n;
	    vector<int> p(n);
	    int res = 0;
        for(int i=0; i<n; i++){
            in >> p[i];
            res += p[i];
        }

        sort(p.begin(), p.end());

        res -= p[n-1]/2;
        out << res << endl;
	}
};


int main() {
	BChristmasEveEve solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#define LL long long int
LL a[100001];
int main() {
	LL n, x, cnt = 0, t1, t2;
	t1 = t2 = 0;
	scanf("%lld %lld", &n, &x);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", a + i);
		t1 = t1 + a[i];
	}
       a[1] = a[1] > x ? x : a[1];
	t2 = a[1];
	for (int i = 1; i < n; i++) {
		if (a[i] + a[i + 1] > x)
			a[i + 1] = x - a[i];
		t2 = t2 + a[i + 1];
	}
	//for (int i = 1; i <=n; i++) {
	//	printf("%lld ", a[i]);
	//}
	printf("%lld", t1 - t2);
 
	return 0;
}

Measured memory_bytes: 896
from bisect import bisect_left
from itertools import product

inf = float('inf')

a, b, q = map(int, input().split())
s = [-inf] + [int(input()) for _ in range(a)] + [inf]
t = [-inf] + [int(input()) for _ in range(b)] + [inf]
x = [int(input()) for _ in range(q)]

for xx in x:
    ret = inf

    sr = bisect_left(s, xx)  # xx以上の最小値
    sl = max(0, sr - 1)

    tr = bisect_left(t, xx)
    tl = max(0, tr - 1)

    for ss, tt in product(s[sl:sr + 1], t[tl:tr + 1]):
        ret = min(
            ret,
            abs(xx - ss) + abs(ss - tt),
            abs(xx - tt) + abs(tt - ss)
        )
    print(ret)


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

int main(){
    for(int i = 0; i < 50; i++){
        int a, b, c;
        cin >> a >> b >> c;

        if(a == -1 && b == -1 && c == -1){
            break;
        }
        else if(a == -1 || b == -1){
            cout << "F" << endl;
        }
        else if(a + b >= 80){
            cout << "A" << endl;
        }
        else if(a + b >= 65){
            cout << "B" << endl;
        }
        else if(a + b >= 50){
            cout << "C" << endl;
        }
        else if(a + b >= 30){
            if(c >= 50){
                cout << "C" << endl;
            }
            else{
                cout << "D" << endl;
            }
        }
        else{
            cout << "F" << endl;
        }
    }
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    ll n=0;
    cin>>n;
    ll ar[n+1]={0};
    map<ll,ll>pos;
    ll x=0;
    for(ll i=1;i<=n;++i){
        cin>>ar[i];
        pos[ar[i]]=i;
    }
    for(ll i=1;i<=n;++i){
        cout<<pos[i]<<" ";
    }
    return 0;
}


Measured memory_bytes: 7808
N = int(input())
Nminus1 = N - 1
# lines = []

C = [0 for _ in range(Nminus1)]
S = [0 for _ in range(Nminus1)]
F = [0 for _ in range(Nminus1)]

for i in range(Nminus1):
    c, s, f = input().split()

    C[i] = int(c)
    S[i] = int(s)
    F[i] = int(f)

# for line in lines:
#     c, s, f = line.split()
#     C.append(int(c))
#     S.append(int(s))
#     F.append(int(f))

for i in range(Nminus1):
    a = C[i] + S[i]
    for j in range(i + 1, Nminus1):
        if a <= S[j]:
            n = S[j] - a
        else:
            mod = a % F[j] 
            n = F[j] - mod if mod != 0 else 0
        a = a + C[j] + n
    print(a)

print(0)


Measured memory_bytes: 3188
import Control.Monad
import Data.List
main = do
    n <- readLn
    if n == 0 then return ()
              else do
                  nums <- replicateM n readLn
                  print $ totalWaitTime n.sort $ nums
                  main

totalWaitTime :: Int -> [Int] -> Int
totalWaitTime n = sum . zipWith (*) [n-1,n-2..0]



Measured memory_bytes: 7532
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
#define PI 3.141592653589

int main(){
    int n, a, b, c, d;
	char ss;
    //int num[4][3][10]={0};
	while(1){
		cin >> a >> b >> c;
		if(a == -1 && b == -1 && c == -1)break;
		if(a == -1 || b == -1){
			a = 0;
			b = 0;
		}
		//if()b = 0;
		if(80 <= a + b)ss = 'A';
		else if(65 <= a + b)ss = 'B';
		else if(50 <= a + b)ss = 'C';
		else if(30 <= a + b)ss = 'D';
		else ss = 'F';
		
		if(ss == 'D' && 50 <= c)ss = 'C';
		cout << ss << endl;
	}

    //cin>>n;
    return 0;
}

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

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


int main(){
    string s;
    cin >> s;
    for(LL i = 0; i < s.size(); ++i){
        if(s[i] == '?') s[i] = 'D';
    }
    cout << s << endl;
    return 0;
}



Measured memory_bytes: 3364
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    n= int(sys.stdin.readline())
    a= list(map(float, sys.stdin.readline().split()))
    l=[]
    for i in a:
        t=1/i
        l.append(t)
    ans=1/sum(l)
    print(ans)

Measured memory_bytes: 5712
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  int co=0;
  string in;
  while(cin>>in!='\0'){
    string rev=in;
    reverse(in.begin(),in.end());
    if(in==rev)co++;
  }
  cout<<co<<endl;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int W,H;
bool inrange(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define MP make_pair
struct Edge{
    int to,cap,cost,rev;
    Edge(int _to,int _cap,int _cost,int _rev){
        to=_to;
        cap=_cap;
        cost=_cost;
        rev=_rev;
    }
};
typedef vector<Edge> ve;
typedef vector<ve> vve;
class MCF{    //Minimum Cost Flow
    int inf = INF;
public:
    int n;
    vve G;
    vi h,dist,prev,pree;
    MCF(int size){
        n=size;
        G=vve(n);
        h=dist=prev=pree=vi(n);
    }
    void add_edge(int s,int t,int ca,int co){
        Edge e=Edge(t,ca,co,G[t].size());
        G[s].push_back(e);
        Edge ee=Edge(s,0,-co,G[s].size()-1);
        G[t].push_back(ee);
    }
    int mcf(int source,int sink,int f){
        int out=0;
        h=vi(n);
        while(f>0){
            priority_queue<pii,vector<pii> >q;
            dist=vi(n,inf);
            dist[source]=0;
            q.push(pii(0,source));
            while(!q.empty()){
                pii p=q.top();q.pop();
                int v=p.second;
                if(dist[v]<-p.first)continue;
                rep(i,G[v].size()){
                    Edge &e=G[v][i];
                    if(e.cap>0&&dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
                        dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
                        prev[e.to]=v;
                        pree[e.to]=i;
                        q.push(pii(-dist[e.to],e.to));
                    }
                }
            }
            if(dist[sink]==inf)return -1;
            rep(i,n)h[i]+=dist[i];
            int d=f;
            for(int v=sink;v!=source;v=prev[v])d=min(d,G[prev[v]][pree[v]].cap);
            f-=d;
            out+=d*h[sink];
            for(int v=sink;v!=source;v=prev[v]){
                Edge &e=G[prev[v]][pree[v]];
                e.cap-=d;
                G[v][e.rev].cap+=d;
            }
        }
        return out;
    }
};

signed main(){
    int v,e,f; cin>>v>>e>>f;
    MCF hoge(v);
    rep(i,e){
        int a,b,c,d; cin>>a>>b>>c>>d;
        hoge.add_edge(a, b, c, d);
    }
    cout<<hoge.mcf(0, --v, f)<<endl;
}



Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin >> n;
    vector< long long > a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long l = 0, r = 0;
    long long tmp = a[0], ans = 0;
    while (l < n && r < n) {
        bool candec = false;
        r++;
        while (r < n && (tmp + a[r] == (tmp ^ a[r]))) {
            tmp = (tmp ^ a[r]);
            r++;
            candec = true;
        }
        ans += r - l;
        r--;
        //        cout << l << " " << r << " " << tmp << " " << ans << endl;
        tmp = (tmp ^ a[l]);
        if (r == l) {
            r++;
            l++;
            tmp = a[l];
        } else {
            l++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
n,m=gets.split.map(&:to_i)

boxes=Array.new(n+1,1)
likely=Array.new(n+1,false)
likely[1]=true
m.times{
	x,y=gets.split.map(&:to_i)
	if likely[x]
		if boxes[x]==1
			likely[x]=false
			likely[y]=true
		else
			likely[y]=true
		end
	end
	boxes[x]-=1
	boxes[y]+=1
}

puts likely.count(true)

Measured memory_bytes: 3324
#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define REV(v) reverse(v.begin(),v.end())
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll> A(n+1);
    vector<ll> B(m+1);
    FOR(i,1,n+1){
        cin>>A[i];
        A[i] += A[i-1];
    }
    FOR(i,1,m+1){
        cin>>B[i];
        B[i] += B[i-1];
    }


    ll b = m;    
    ll res = 0;
    FOR(i,0,n+1){
        while(A[i] + B[b] > k && b>0) b--;
        if(A[i] + B[b] <= k) res = max(res, i+b);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 6344
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> hoge(n);
    vector<int> p(n);
    vector<int> q(n);
    for(int i=0;i<n;i++) hoge.at(i)=i+1;
    for(int i=0;i<n;i++) cin>>p.at(i);
    for(int i=0;i<n;i++) cin>>q.at(i);
    
    int a=0,b=0;
    int count=1;
    
    while(next_permutation(hoge.begin(), hoge.end())){
        if(p==hoge) a=count;
        if(q==hoge) b=count;
        count++;
    }
    
    int ans=a-b;
    if(ans<0) ans*=-1;
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>

using namespace __gnu_pbds;
using namespace std;

typedef tree<int64_t, null_type, less<int64_t>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	int64_t flag = 0;

	int64_t n;
	cin>>n;

	vector<int64_t> values;

	int64_t temp;
	for(int64_t x=0;x<n;x++)
	{
		cin>>temp;
		values.push_back(temp);
	}
	values[0] -= 1;
	for(int64_t x=0;x<values.size()-1;x++)
	{
		if(values[x]>values[x+1])
		{
			values[x]-=1;
		}
		else
		{
			if(x>0)
			{
				if(values[x]-1 >= values[x-1])
				{
					values[x] = values[x]-1;
				}
			}
		}
	}

	//for(int x=0;x<values.size();x++)
	//	cout<<values[x]<<" ";

	for(int64_t x=0;x<values.size()-1;x++)
	{
		if(values[x]>values[x+1])
			flag+=1;
	}

	if(flag==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;


}

Measured memory_bytes: 1400
#include <stdio.h>

int main(){

	int X,Y,Z;

	scanf("%d %d %d",&X,&Y,&Z);

	int ans;

	for(ans=1;;ans++){
		if((ans*Y)+(ans+1)*Z>X){break;}
	}

	printf("%d\n",ans-1);

	return 0;
}

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

int flag=0;


int main(){
	int a;
	cin>>a;
	int n;
	for(int i=1;i<=a;i++){
		cin>>n;
		if(i==n){
			continue;
		}
		
		if(flag<2){
			flag++;
		}else{
			cout<<"NO";
			return 0;
		}
	}
	cout<<"YES";
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
        
#define pb push_back
#define ll long long
#define f first
#define s second
#define ld long double
#define fa fflush(stdout); 
#define mp make_pair
using namespace std;
void data() {
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);;                                                      
} 
const int N = 1e5 + 100;
const ll mod = 1e9 + 7;
const ll big = 1e16;
const int p = 37;

int main() 
{
	data();   
	int n;
	cin >> n;
	int a[n + 1];
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = i + 1; j <= n; j++)
		{
			if (a[i] == a[j])
			{
				continue;
			}
			for (int k = j + 1; k <= n; k++)
			{
				if (a[i] == a[k] || a[j] == a[k])
				{
					continue;
				}
				if (a[i] + a[k] <= a[j] || a[i] + a[j] <= a[k] || a[j] + a[k] <= a[i])
				{
					continue;
				}
				ans++;
			}
		}
	}
	cout << ans;
}


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

int n, m;
int p[10010];
int c[500], e[500];
int dp[10010];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++) cin >> p[i];
	for (int i = 0; i < m; i++) cin >> c[i] >> e[i];

	fill_n(dp, 10010, 1e9);
	dp[0] = 0;
	for (int i = 0; i < m; i++){
		for (int j = 10000; j >= 0; j--){
			if (j - c[i] < 0) dp[j] = min(dp[j], e[i]);
			else dp[j] = min(dp[j], dp[j - c[i]] + e[i]);
		}
	}

	int res = 0, s = 0;
	sort(p, p + n, greater<int>());
	for (int i = 0; i <= n; i++){
		res = max(res, s - dp[i]);
		s += p[i];
	}

	cout << res << endl;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
using namespace std;

const long long INF=9000000000000000;
int main(){
  int n,ans=0,x=0,y=0;
  int ok[100010]={};
  cin>>n;
  long long num[n];
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  sort(num,num+n);
  for(int i=0;i<n;i++){
    if(x!=num[i]){
      x=num[i];
      y++;
      ok[y]++;
    }
    else
      ok[y]++;
  }
  for(int i=0;i<100010;i++){
    if(ok[i]%2==1)
      ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1408
n, m = map(int, input().split())
list_vote = list(map(int, input().split()))
list_vote_copy = list_vote[:]
total_votes = sum(list_vote)
check = (total_votes / (4 * m))
count = 0
for ele in list_vote_copy:
    if ele >= check:
        count += 1

if count >= m:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include<list>
#include<iomanip>
#include<cmath>
#include <random>
#include<queue>
#include <functional>
#include<stdio.h>
#include<assert.h>
#include<stack>
#include<sstream>
#include <cstdlib>
#include<map>
#include<algorithm>
#include<iostream>
#include<set>
#include<utility>
#include<memory.h>
#include<string>
#include<vector>
#include <unordered_map>
#include<numeric>
using namespace std;
#define ios std::ios_base::sync_with_stdio(false);
#define ll  long long
#define pb push_back
#define fi(ss) freopen (ss,"r",stdin)
#define fo(ss) freopen (ss,"w",stdout)
#define sz(v)               ((int)((v).size()))
#define all(x)          (x).begin(),(x).end()
#define REP(i, v)       for(int i=0;i<sz(v);i++)
#define lp(i,n) for(int i = 0 ; i < n ; ++i)
typedef pair<ll,ll> pii;
typedef pair<pii,int> tri;
const int maxn = 400005;
int n,m,s,t;
ll DIS[maxn];
ll DIS2[maxn];
vector<pii> g[maxn];
vector<pii> g2[maxn];
void runDiji(int s) {
	priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > > PQ;
	fill(DIS,DIS + n, 1LL << 59);
	DIS[s] = 0;
	PQ.push(pii(0,s));
	while(!PQ.empty())
	{
		pair<ll,ll> out = PQ.top(); PQ.pop();
		int index = out.second;
		ll dis = out.first;
		if(DIS[index] < dis) continue;
		int sz = (int)(g[index].size());
		for(int i = 0 ; i < sz ; i++)
		{
			pair<ll,ll> next = g[index][i];
			ll cost = (ll)(1LL*next.second + DIS[index]);
			if(cost >= DIS[next.first]) continue;
			DIS[next.first] = cost;
			PQ.push(make_pair(cost,next.first));

		}
	}
}
void runDiji2(int s) {
	priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > > PQ;
	fill(DIS2,DIS2 + n, 1LL << 59);
	DIS2[s] = 0;
	PQ.push(pii(0,s));
	while(!PQ.empty())
	{
		//cerr << "here\n";
		pair<ll,ll> out = PQ.top(); PQ.pop();
		int index = out.second;
		ll dis = out.first;
		if(DIS2[index] < dis) continue;
		int sz = (int)(g2[index].size());
		for(int i = 0 ; i < sz ; i++)
		{
			pair<ll,ll> next = g2[index][i];
			ll cost = (ll)(1LL*next.second + DIS2[index]);
			if(cost >= DIS2[next.first]) continue;
			DIS2[next.first] = cost;
			PQ.push(make_pair(cost,next.first));

		}
	}
}
ll yen = 100000LL * 100000LL * 100000LL;
ll ans[maxn];
int main() {
	ios
	int s,t;
	cin >> n >> m >> s >> t;
	for (int i = 0 ; i < m ; ++i) {
		int u,v,a,b;
		cin >> u >> v >> a >> b;
		--u,--v;
		g[u].pb(pii(v,a));
		g[v].pb(pii(u,a));
		g2[u].pb(pii(v,b));
		g2[v].pb(pii(u,b));
	}
	--s,--t;
	runDiji(s);
	runDiji2(t);
	fill(ans,ans + n,1LL<<59);
	for (int i = 0 ; i < n ; ++i) {
		//cerr << DIS[i] << " " << DIS2[i] << "\n";
		ll rem = yen - DIS[i] - DIS2[i];

		ans[i] = rem;
	}
	for (int i = n - 2 ; i >= 0 ; --i) {
		ans[i] = max(ans[i],ans[i + 1]);
	}
	for (int i = 0 ; i < n ; ++i) {
		cout << ans[i] << "\n";
	}

}


Measured memory_bytes: 37500
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<int, int> mp;
map<int, int>mm;
#define ll long long

int main(void) {
    int n, h, w;
    cin >> n >> h >> w;
    h = n - h + 1;
    w = n - w + 1;
    int ans = h * w;
    cout <<ans<< endl;

}

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

using namespace std;

int main()
{
int A, B, C, D;
cin >> A>> B>> C>> D;
int a,s , d ,f ;
a=A+D;
s=A+C;
d=B+C;
f=B+D;
if (s<=a&&s<=d&&s<=f)
cout <<s;
else
    if (a<=s&&a<=d&&a<=f)
cout <<a;
else
    if (d<=s&&d<=a&&d<=f)
cout <<d;else
    if (f<=s&&f<=d&&f<=a)
cout <<f ;




    return 0;
}


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

int main() {
  string w;
  cin >> w;
  string hantei="abcdefghijklmnopqrstuvwxyz";
  for (int i=0 ;i<hantei.size();i++) {
    int cnt=0;
    for (int j=0 ; j < w.size(); j++) {
      if (hantei.at(i)==w.at(j)) cnt++;
    }
    if (cnt % 2 != 0) {
      cout << "No" << endl;
      break;
    }
    if (i==hantei.size()-1) cout << "Yes" << endl;
  } 
}

Measured memory_bytes: 256
/*
   Author : BabaYaga42,
   BITS Pilani, Hyderabad.
   Don't give up ;)
   */  
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);
#define int long long
 
int32_t main()
{
	IOS;	
	int D,N;
  cin >> D >> N;
  int ans = 1;
  for(int i = 0; i < D; i++){
    ans *= 100;
  }
  if(N != 100) cout << ans * N << endl;
  else cout << ans * 101 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define v vector<ll>
#define vv vector<v>
ll MOD=1e9+7;
int main() 
{ 
    int n;string s;cin>>n>>s;
    vv dp(n+1,v(n+1,0));
    dp[1][1]=1;
    for (int i=2; i<=n; i++)
        for (int j=1; j<=i; j++)
            dp[i][j]=(s[i-2]=='<') ? (dp[i-1][j-1]+dp[i][j-1])%MOD : dp[i][j]=(MOD+dp[i-1][i-1]-dp[i-1][j-1]+dp[i][j-1])%MOD;
    cout<<dp[n][n]<<endl;
    return 0;
} 

Measured memory_bytes: 70784
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

c=input()
s=ord(c)
print(chr(s+1))

Measured memory_bytes: 38384
while True:
	n = int(raw_input())
	if n == 0:
		break
	data = {}
	order = []
	for i in range(n):
		id,price,quant = map(int, raw_input().split())
		if id in data:
			data[id] += price*quant
		else:
			data[id] = price*quant 
			order.append(id)
	if max(data.values()) <  1000000:
		print "NA"
	else:
		for k in order:
			if data[k] >=  1000000:
				print k

Measured memory_bytes: 4332
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: usize,
        mut l: [u32; n],
    }

    l.sort();
    let mut ans = 0;
    for i in 0..n - 2 {
        for j in i + 1..n - 1 {
            for k in j + 1..n {
                if l[i] < l[j] + l[k] && l[j] < l[k] + l[i] && l[k] < l[i] + l[j] {
                    ans += 1;
                } else {
                    continue;
                }
            }
        }
    }
    println!("{}", ans);
}


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

int main(){
    int a, b;
    cin >> a >> b;
    int c = stoi(to_string(a) + to_string(b));
    for (int i=1; i<c; i++){
        if (i * i == c){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import math
a=[[0,0] for i in range(5)]
for i in range(5):
    a[i][0]=int(input())
    a[i][1]=abs(10*math.ceil(a[i][0]/10)-a[i][0])
a2=sorted(a,key=lambda x:x[1])
ans=0
for i in range(4):
    ans+=10*math.ceil(a2[i][0]/10)
ans+=a2[4][0]
print(ans)

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

int main() {
  ll n, k;
  cin >> n >> k;
  map<int, ll> mp;
  for (int i = 0; i < n; i++) {
    int a;
    ll b;
    cin >> a >> b;
    mp[a] += b;
  }

  for (auto np : mp) {
    if (np.second < k) {
      k -= np.second;
    } else {
      cout << np.first << '\n';
      break;
    }
  }

  return 0;
}


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

int main()
{
  int N;
  int result=0;
  cin >> N;
  int B[N];
  for(int i=0; i<N-1; i++){
    cin >> B[i];
  }B[N-1] = 1000000;
  for(int i=N-1; i>0; i--){
    int tmp = min(B[i], B[i-1]);
    result += tmp;
  }result += B[0];
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
import Control.Applicative

main = do
  (n:m:_) <- (map read) . words <$> getLine
  print $ f n m

  where
    f :: Int -> Int -> Int
    f n m = a + b
      where
        a = minimum [n, m`div`2]
        b = (m - a*2) `div` 4


Measured memory_bytes: 508
import java.util.*;
import java.lang.*;
import java.io.*;
 
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
	
		Scanner blank = new Scanner(System.in);
		int a = blank.nextInt();
		int b = blank.nextInt();
		if((a + b) % 2 == 0){
		    System.out.println((a + b) / 2);
		}
		else{
		    System.out.println("IMPOSSIBLE");
		}
	}
}

Measured memory_bytes: 21716
s = list(input())
sum = 0
for i in range(len(s)):
    if i % 2 != 0:
        if "R" == s[i]:
            sum += 1

    elif i % 2 == 0:
        if "L" == s[i]:
            sum += 1

if sum > 0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3060
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    a,b = map(int,input().split())

    c = min(a,b)
    d = max(a,b)

    res = ''

    for i in range(d):
        res += str(c)

    print(res)



main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long
template <class Q>
void clearQueue(Q & q) {
    q = Q();
}
double dp[3001][3001];
void solve(){
	int n;cin>>n;
	vector<double>p(n);
	for(int i=0;i<n;i++){
		cin>>p[i];
	}
	memset(dp,0,sizeof(dp));
	dp[0][0]=(1-p[0]);
	dp[0][1]=p[0];
	for(int i=1;i<n;i++){
		for(int j=0;j<3000;j++){
			//tails
			dp[i][j]+=(1-p[i])*dp[i-1][j];
			//heads
			if(j>0)
			dp[i][j]+=p[i]*dp[i-1][j-1];
		}
	}
	double ans=0;
	for(int i=n/2+1;i<3000;i++){
		ans+=dp[n-1][i];
	}
	printf("%0.9lf",ans);
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 74136