akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

struct LazyContext {
	LazyContext(int v = 0) {
		sum = v;
	}
	
	void reset() {
		sum = 0;
	}
	
	void operator += (LazyContext o) {
		sum += o.sum;
	}
	
	// atributes
	long long sum;
};

struct Node {
	Node(long long v = 0) {
		// init
		ans = v;
	}
	
	Node(Node &l, Node &r) {
		// merge
		ans = std::max(l.ans, r.ans);
	}
	
	void apply(LazyContext lazy) {
		ans += lazy.sum;
	}
	
	// atributes
	long long ans;
};

template <class i_t, class e_t, class lazy_cont = int>
class SegmentTree {
public:
	void init(std::vector<e_t> base) {
		n = base.size();
		h = 0;
		while((1 << h) < n) h++;
		tree.resize(2 * n);
		dirty.assign(n, false);
		lazy.resize(n);
		for(int i = 0; i < n; i++) {
			tree[i + n] = i_t(base[i]);
		}
		for(int i = n - 1; i > 0; i--) {
			tree[i] = i_t(tree[i + i], tree[i + i + 1]);
			lazy[i].reset();
		}
	}
	
	i_t qry(int l, int r) {
		if(l >= r) return i_t();
		l += n, r += n;
		push(l);
		push(r - 1);
		i_t lp, rp;
		for(; l < r; l /= 2, r /= 2) {
			if(l & 1) lp = i_t(lp, tree[l++]);
			if(r & 1) rp = i_t(tree[--r], rp);
		}
		return i_t(lp, rp);
	}
	
	void upd(int l, int r, lazy_cont lc) {
		if(l >= r) return;
		l += n, r += n;
		push(l);
		push(r - 1);
		int l0 = l, r0 = r;
		for(; l < r; l /= 2, r /= 2) {
			if(l & 1) apply(l++, lc);
			if(r & 1) apply(--r, lc);
		}
		build(l0);
		build(r0 - 1);
	}
	
private:
	int n, h;
	std::vector<bool> dirty;
	std::vector<i_t> tree;
	std::vector<lazy_cont> lazy;
	
	void apply(int p, lazy_cont &lc) {
		tree[p].apply(lc);
		if(p < n) {
			dirty[p] = true;
			lazy[p] += lc;
		}
	}
	
	void push(int p) {
		for(int s = h; s > 0; s--) {
			int i = p >> s;
			if(dirty[i]) {
				apply(i + i, lazy[i]);
				apply(i + i + 1, lazy[i]);
				lazy[i].reset();
				dirty[i] = false;
			}
		}
	}
	
	void build(int p) {
		for(p /= 2; p > 0; p /= 2) {
			tree[p] = i_t(tree[p + p], tree[p + p + 1]);
			if(dirty[p]) {
				tree[p].apply(lazy[p]);
			}
		}
	}
};


int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n, m;
	std::cin >> n >> m;
	std::vector<long long> a(n, 0);
	for(int i = 1; i < n; i++) {
		std::cin >> a[i];
		a[i] += a[i-1];
	}
	SegmentTree<Node, long long, LazyContext> tree;
	tree.init(a);
	const long long INF = 1.1e9;
	std::vector<std::vector<std::pair<int, int>>> b(m, std::vector<std::pair<int, int>>(1, std::pair<int, int>(INF, 0)));
	long long ans = 0;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			int pos = i;
			int val;
			std::cin >> val;
			while(b[j].back().first <= val) {
				int sz = b[j].back().second;
				tree.upd(pos-sz, pos, LazyContext(-b[j].back().first));
				pos -= sz;
				b[j].pop_back();
			}
			b[j].emplace_back(val, i - pos + 1);
			tree.upd(pos, i + 1, LazyContext(val));
		}
		ans = std::max(ans, -a[i] + tree.qry(0, i+1).ans);
	}
	std::cout << ans << '\n';
}

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

using namespace std;

int main()
{
  string s;
  cin >> s;
  int red=0, blue=0;
  red = count(s.begin(), s.end(), '0');
  blue = count(s.begin(), s.end(), '1');
 
  cout<<min(red,blue)*2<<endl;

  return 0;
}

Measured memory_bytes: 512
S = input()
A =set()
t = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T':
    t += 1
  else:
    A.add(t)
    t = 0
A.add(t)
print(max(A))

Measured memory_bytes: 3060
require "prime"

def divisors(n)
  n.prime_division.inject([1]) do |ary, (p, e)|
    (0..e).map{ |e1| p ** e1 }.product(ary).map{ |a, b| a * b }
  end.sort
end

num = STDIN.gets.chomp.split(" ").map(&:to_i)[0]
array = divisors(num)
if array[array.size/2] <= 9
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1916
import math

def divisor(num):
    if num < 0:
        return 0
    if num == 1:
        return [1, ]

    divisor_list = [1, ]
    divisor_list_r = [num, ]

    i = 2
    while i * i <= num:
        if num % i == 0:
            divisor_list.append(i)
            if i != num // i:
                divisor_list_r.append(num//i)
        i += 1

    return divisor_list+divisor_list_r[::-1]


N = int(input())
ans = len(divisor(N-1))-1
cand = divisor(N)

for i, num in enumerate(cand[1:]):
    num2 = N
    while num2 >= num:
        tmp1, tmp2 = divmod(num2, num)
        if tmp2 == 0:
            num2 = tmp1
        else:
            num2 = tmp2
    if num2 == 1:
        ans += 1
print(ans)


Measured memory_bytes: 3292
// ------------------
// author: MatsuTaku
// date  : 22/02/2020
// ------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int N, R; cin>>N>>R;
  if (N >= 10) {
    cout << R << endl;
  } else {
    cout << (R+100*(10-N)) << endl;
  }

  return 0;
}


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

#define IOS cin.tie(0);ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    CIN(N,T);
    ll ans=0;
    int cur;cin>>cur;
    rep(i,N-1){
        CIN(t);
        ll time=cur+T;
        if(time<t)ans+=T;
        else ans+=t-cur;
        cur=t;
    }
    ans+=T;
    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        long A = sc.nextInt();
        long B = sc.nextInt();
        long C = sc.nextInt();
        long K = sc.nextInt();
        
        
        if (A>K) {
        	System.out.println(K);
        }else if(A+B>K){
        	System.out.println(A);

        }else {
        	System.out.println(A-(K-A-B));
        }

	}
}


Measured memory_bytes: 35844
#include <iostream>
#include <cfloat>
using namespace std;
int main(){
	double n,max = 0,min = DBL_MAX;
	while(cin >> n){
		if(n>max) max = n;
		else if(n<min) min = n;
	}
	cout << (double)(max - min) << endl;
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")

#include <algorithm>      //sort,二分探索,など
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <iterator>       //集合演算(積集合,和集合,差集合など)
#include <map>            //map(辞書)
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列
#include <list>           //双方向連結リスト

using namespace std;

constexpr int INF = numeric_limits<int>::max();

int merge(vector<int>& s, int left, int mid, int right){
    int cnt = 0;
    int n1 = mid - left;
    int n2 = right - mid;
    vector<int> L(n1 + 1);
    vector<int> R(n2 + 1);
    for(int i = 0; i < n1; ++i){
        L[i] = s[left + i];
    }
    for(int i = 0; i < n2; ++i){
        R[i] = s[mid + i];
    }
    L[n1] = INF;
    R[n2] = INF;
    for(int k = left, i = 0, j = 0; k < right; ++k){
        ++cnt;
        if(L[i] <= R[j]){
            s[k] = L[i++];
        }else{
            s[k] = R[j++];
        }
    }
    return cnt;
}

int merge_sort(vector<int>& s, int left, int right){
    int cnt = 0;
    if(left + 1 < right){
        int mid = (left + right) / 2;
        cnt += merge_sort(s, left, mid);
        cnt += merge_sort(s, mid, right);
        cnt += merge(s, left, mid, right);
    }
    return cnt;
}

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

    int n;
    cin >> n;
    vector<int> s(n);
    for(int i = 0; i < n; ++i){
        cin >> s[i];
    }
    int count = merge_sort(s, 0, n);
    for(int i = 0; i < n; ++i){
        if(i != 0) cout << " ";
        cout << s[i];
    }
    cout << "\n";
    cout << count << "\n";

	return 0;
}


Measured memory_bytes: 6812
// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=1696864#1
// This code is made by sigma425
// I want to watch inputs and outputs!!!
// Sorry


#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int N;
string s;
string mx[50][51];
bool done[50][51];
void change(string& s,string t){
    if(s.size()>t.size()) return;
    if(s.size()<t.size()){
        s=t;
        return;
    }
    if(s<t) s=t;
    return;
}
string calc(int l,int r){
    if(done[l][r]) return mx[l][r];
    string best=mx[l][r];
    if(s[l]=='L'||s[l]=='?'){
        if(r-l>=6) if(s[l+1]=='('||s[l+1]=='?') if(s[r-1]==')'||s[r-1]=='?'){
            for(int c=l+3;c<=r-3;c++) if(s[c]==','||s[c]=='?'){
                string L=calc(l+2,c);
                string R=calc(c+1,r-1);
                if(L[0]!='i'&&R[0]!='i') change(best,L);
            }
        }
    }
    if(s[l]=='R'||s[l]=='?'){
        if(r-l>=6) if(s[l+1]=='('||s[l+1]=='?') if(s[r-1]==')'||s[r-1]=='?'){
            for(int c=l+3;c<=r-3;c++) if(s[c]==','||s[c]=='?'){
                string L=calc(l+2,c);
                string R=calc(c+1,r-1);
                if(L[0]!='i'&&R[0]!='i') change(best,R);
            }
        }
    }
    done[l][r]=1;
    if(best=="") best="invalid";
    return mx[l][r]=best;
}
int main(){
    cin>>s;
    N=s.size();
    rep(l,N){
        string t;
        for(int r=l+1;r<=N;r++){
            if(s[r-1]=='L'||s[r-1]=='R'||s[r-1]=='('||s[r-1]==')'||s[r-1]==',') break;
            if(s[r-1]=='?') t+='9';
            else t+=s[r-1];
            if(t[0]=='0'&&t.size()>1) break;
            mx[l][r]=t;
        }
    }
    cout<<calc(0,N)<<endl;
}

Measured memory_bytes: 3292
#include<iostream>
#include<string.h>

using namespace std;

int main()
{
	int N;
	while (cin >> N && N != 0)
	{
		char f[3];
		char preF[3] = { 'a', 'a', '\0' };
		int right = 0;
		int left = 0;
		int count = 0;

		for (int i = 0; i < N; i++)
		{
			cin >> f;
			if (strcmp(f, "lu") == 0)
			{
				if (right == 1 && strcmp(preF, "ld") != 0)count++;
				strcpy(preF, f);
				left = 1;
			}
			else if (strcmp(f, "ru") == 0)
			{
				if (left == 1 && strcmp(preF, "rd") != 0)count++;
				strcpy(preF, f);
				right = 1;
			}
			else if (strcmp(f, "ld") == 0)
			{
				if (right == 0 && strcmp(preF, "lu") != 0)count++;
				strcpy(preF, f);
				left = 0;
			}
			else if (strcmp(f, "rd") == 0)
			{
				if (left == 0 && strcmp(preF, "ru") != 0)count++;
				strcpy(preF, f);
				right = 0;
			}
		}

		cout << count << endl;
	}

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int a1 = N / 1000;
  int a2 = (N - a1 * 1000) / 100;
  int a3 = (N - a1 * 1000 - a2 * 100) / 10;
  int a4 = N - a1 * 1000 - a2 * 100 - a3 * 10;
  
  if (a1 == a2 && a2 == a3) {
    cout << "Yes" << endl;
  } else if (a2 == a3 && a3 == a4) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
int main(){
    int n,m;
    while(1){
        scanf("%d %d",&n,&m);
        if(n==0 && m==0) break;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if((i==0 || i==n-1)||(j==0 || j==m-1)){
                    printf("#");
                }else {
                    printf(".");
                }
        }
        printf("\n");
    }
    printf("\n");
        
    }
    return 0;
}


Measured memory_bytes: 2612
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,x,y,sum=0,z;
    cin>>n;
     sum=0;
    x=n%500;
    y=n/500;
    sum=sum+(1000*y);
    z=x/5;
    sum=sum+(5*z);
    cout<<sum<<endl;
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n, k;
  vector<int> h, c;
  Solver(LL n) : n(n), h(n + 1), c(n + 1, INF){};

  void solve() {
    cin >> k;
    for (int i = 0; i < n; ++i) {
      cin >> h[i + 1];
    }
    c[1] = 0;
    for (int i = 2; i <= n; ++i) {
      for (int j = i - k; j < i; ++j) {
        if (j >= 1) c[i] = min(c[i], c[j] + abs(h[i] - h[j]));
      }
    }
    cout << c[n] << endl;
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


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

int main() {
  int n; cin>>n;
  map<int,int> memo;
  rep(i,n) {
    int a; cin >> a;
    memo[a] += 1;
  }
  int ans = 0;
  for (auto a : memo) {
    auto value = a.second;
    ans += (value%2);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8092
#関節点(そのノードを除くとグラフが非連結になる点)
import sys
class LowLinks:
    def __init__(self, edges, v, root=0):
        self.edges = edges
        self.root = root
        self.ord = [None] * v
        self.low = [None] * v
        self.cnt = 0
        self.bridges = []
        self.articulations = set()
        self.par = [None] * v

    def build(self):
        self.search(self.root)

    def search(self, x):
        self.ord[x] = self.cnt
        self.low[x] = self.cnt
        self.cnt += 1
        dim = 0
        for to in self.edges[x]:
            if to == self.par[x]:continue
            if self.ord[to] != None:
                self.low[x] = min(self.low[x], self.ord[to])
            else:
                self.par[to] = x
                self.search(to)
                dim += 1
                self.low[x] = min(self.low[x], self.low[to])

                if x != self.root and self.ord[x] <= self.low[to]:
                    self.articulations.add(x)

            if x == self.root and dim > 1:
                self.articulations.add(x)

            if self.ord[x] < self.low[to]:
                self.bridges.append((x, to))

sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
edges=[[] for _ in range(n)]
for _ in range(m):
    s, t = map(int, input().split())
    edges[s].append(t)
    edges[t].append(s)

l=LowLinks(edges,n)
l.build()
ans=[]
for i,j in l.bridges:
    if i>j:
        ans.append((j,i))
    else:
        ans.append((i,j))
ans.sort()
for i,j in ans:
    print(i,j)


Measured memory_bytes: 19236
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    
    let n: usize = read();
    let h: Vec<u16> = (0..n).map(|_| read()).collect();
    let mut max = h[0];
    let mut count = 0;

    for i in h.iter() {
        if max <= *i {
            count += 1;
            max = *i;
        }
    }

    println!("{}", count);
}

Measured memory_bytes: 4352
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
const int N=1e5+10;
int main(){
    int n;
    pair<pair<int,int>,pair<string,pair<long long int,string>>>a[N];
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i].F.F>>a[i].F.S>>a[i].S.F>>a[i].S.S.F>>a[i].S.S.S;
    sort(a,a+n);
    for(int i=0;i<n;i++)cout<<a[i].F.F<<' '<<a[i].F.S<<' '<<a[i].S.F<<' '<<a[i].S.S.F<<' '<<a[i].S.S.S<<endl;
}


Measured memory_bytes: 17128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  string s; cin >> s;
  cout << s.front() << s.size() - 2 << s.back() << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>

int main()
{
	int X,A,B;

	while(std::cin >> X >> A >> B)
	{
		int N;
		std::string s;
		std::cin >> N;

		for(int i = 0; i < N; i++)
		{
			std::cin >> s;

			if(s == "nobiro")
				X += A;
			else if(s == "tidime")
				X += B;
			else if(s == "karero")
				X = 0;


			X = std::max(0,X);
		}

		std::cout << X << std::endl;
	}
}



Measured memory_bytes: 3224
import numpy as np

N = int(input())

values = np.array([list(map(int, input().split(' '))) for _ in range(N)])
dp = np.zeros(shape=(N, 3), dtype=int)

dp[0] = values[0]

for i in range(1, N):
    prev = dp[i - 1]
    dp[i][0] = values[i][0] + max(prev[1], prev[2])
    dp[i][1] = values[i][1] + max(prev[0], prev[2])
    dp[i][2] = values[i][2] + max(prev[0], prev[1])

print(np.max(dp[N - 1]))


Measured memory_bytes: 41812
#include<stdio.h>

int main(void){

int n;
int i;
double ans=0;
float tagans=0;


scanf("%d",&n);
int a[n];
float rev[n];

for(i=0;i<n;i++){
    scanf("%d",&a[i]);
}

for(i=0;i<n;i++){
    rev[i]=(float)1/a[i];
    //printf("%f",rev[i]);
}

for(i=0;i<n;i++){
    tagans=tagans+rev[i];
}

ans=1/tagans;

printf("%f",ans);






return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////

//////////////////////////////////////

int main() {
    
    string T;
    cin >> T;
    
    string ans = "";
    FOR(i, 0, T.size()) {
        if (T[i] == '?') {
            ans += 'D';
        } else {
            ans += T[i];
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3920
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) {
            int count = map.getOrDefault(c, 0);
            map.put(c, ++count);
        }
        Set<Character> cs = map.keySet();
        if (cs.size() != 2) {
            System.out.println("No");
            return;
        }
        for (int i : map.values()) {
            if (i != 2) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
}

Measured memory_bytes: 23764
/* A Graph */

#include<stdio.h>

int main(){
  int i,j;
  int n;
  int A[101][101];
  int u,k,v;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      A[u-1][v-1]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n-1;j++){
      printf("%d ",A[i][j]);
    }
    printf("%d\n",A[i][j]);
  }
  return 0;
}

Measured memory_bytes: 0
# AtCoder
from math import sqrt
N, D = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(N)]
ans = 0

for i in range(N):
    for j in range(i + 1, N):
        dis = 0
        for k in range(D):
            dis += (lst[i][k] - lst[j][k]) ** 2
        r = sqrt(dis)
        if r == int(r):
            ans += 1

print(ans)


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

bool prime(unsigned int n) {
	//if (n == 1) return false;
	if (n == 2) return true;
	if ((n & 1) == 0) return false;
	for (unsigned int i = 3; i * i <= n; i += 2) {
		if (n % i == 0) return false;
	}
	return true;
}

int main(){
	int n; cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		if (prime(a)) ans++;
	}
	cout << ans << endl;
	return 0;
}



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

typedef pair<int, int> P;

int main(){
    int n;
    cin >> n;
    map<int, int> m;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        m[a] += 1;
    }
    vector<P> v;
    for(auto p: m) v.push_back(p);
    sort(v.rbegin(), v.rend());
    long long x = 0, y = 0;
    for(int i=0; i<v.size(); i++){
        if(x != 0 && y != 0) break;
        if(v[i].second >= 4){
            if(x == 0) x = v[i].first;
            else y = v[i].first;
            v[i].second -= 2;
        }
        if(v[i].second >= 2){
            if(x == 0) x = v[i].first;
            else y = v[i].first;
        }
    }
    cout << (long long)(x*y) << endl;
    return 0;
}

Measured memory_bytes: 6136
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	int a, b;

	scanf("%d%d", &a, &b);
	if (a < b) printf("a < b\n");
	else if(a > b) printf("a > b\n");
	else printf("a == b\n");
	return 0;
}


Measured memory_bytes: 2104
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int K; cin >> K;
    string s = "";
    for(int i=0; i<K; i++) s += "ACL";
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3596
import numpy as np
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

list_ = np.array([a, b, c, d, e])

list_min = list_.min()

if n % list_min == 0:
  min_ = n // list_min
else:
  min_ = n // list_min + 1
print(min_+4)



Measured memory_bytes: 14456
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(){cout << -1 << '\n';}
const int INF = 1e18;

struct UnionFind {
    public:
    vector<int> par;
    UnionFind(int n){
        par=vector<int>(n,-1);
    }
    int root(int x){
        if(par[x]<0)return x;
    return par[x]=root(par[x]);
    }
    bool issame(int x,int y){
        return root(x)==root(y);
    }
    bool merge(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y)return false;
        if(par[x]>par[y])swap(x,y);
        par[x]+=par[y];
        par[y]=x;
        return true;
    }
    int size(int x){
        return -par[root(x)];
    }
};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m; cin >> n >> m;
    int p[n];
	UnionFind uf(2*n);
    REP(i,n){
        cin >> p[i];
        p[i] += n-1;
        uf.merge(i,p[i]);
    }
    REP(i,m){
        int x, y; cin >> x >> y; x--; y--;
        uf.merge(p[x],p[y]);
    }
    int ans = 0;
    REP(i,n) if(uf.issame(i,n+i)) ans++;
    cout << ans << '\n';
}

Measured memory_bytes: 5552
#include <stdio.h>

int main(void){
   int k,i;
   char s[101];
   scanf("%d %s",&k,s);
   for(i=0; i<k && s[i]!='\0'; i++){
      printf("%c",s[i]);
   }
   if(s[i]!='\0'){
      printf("...");
   }
}


Measured memory_bytes: 1732
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,num,cnt,max;
  vector<int> h;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> num;
    h.push_back(num);
  }
  cnt=1;
  max=h[0];
  for(int i=1;i<n;i++){
    if(max<=h[i]){
      max=h[i];
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque




def main():
    s = list(input())
    num = int(input())

    for i in range(len(s)):
        now_ind = ord(s[i])
        if now_ind == 97:
            continue
        if now_ind + num > 122:
            num -= 123 - now_ind
            s[i] = 'a'

    last_ind = ord(s[-1]) - 97
    last_ind = (last_ind + num) % 26 + 97
    s[-1] = chr(last_ind)

    print(''.join(s))



if __name__ == '__main__':
    main()



Measured memory_bytes: 50284
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
using lint = long;
using llint = long long;
using namespace std;

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

    int cnt = 0;
    for (int i = a; i <= b; i++) {
        if (c % i == 0)
            cnt++;
    }
    cout << cnt << endl;
}




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

typedef long long ll;

const int maxn = 310;
int N, a[4];
double dp[maxn][maxn][maxn];
bool vis[maxn][maxn][maxn];

double rec(int x, int y, int z) {
    if (x < 0 || y < 0 || z < 0) {
        return 0;
    }
    if (x == 0 && y == 0 && z == 0) {
        return 0;
    }
    double& ret = dp[x][y][z];
    if (vis[x][y][z]) {
        return ret;
    }
    vis[x][y][z] = true;
    int rem = x + y + z;
    double ans = N + x * rec(x - 1, y, z) + y * rec(x + 1, y - 1, z) + z * rec(x, y + 1, z - 1);
    ret = ans / rem;
    return ret;
}

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

    cin >> N;
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        a[x]++;
    }
    double answer = rec(a[1], a[2], a[3]);
    cout << fixed << setprecision(12) << answer;

    return 0;
}

Measured memory_bytes: 129256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    h: usize,
    w: usize,
    _k: usize,
    s: [chars; h],
  }
  let mut id = 1;
  let mut field = vec![vec![0; w]; h];
  for i in 0 .. h {
    let sharps: Vec<_> = s[i].iter().enumerate().filter(|&(_, &c)| c == '#').map(|(i, _)| i).collect();
    if sharps.is_empty() {
      continue;
    }
    let mut j = 0;
    for &s in &sharps {
      while j <= s {
        field[i][j] = id;
        j += 1;
      }
      id += 1;
    }
    while j < w {
      field[i][j] = id - 1;
      j += 1;
    }
  }
  let mut row = field.iter().filter(|&r| r[0] != 0).next().unwrap().clone();
  for i in 0 .. h {
    if field[i][0] == 0 {
      field[i] = row.clone();
    } else {
      row = field[i].clone();
    }
  }
  for row in &field {
    for &x in row {
      puts!("{} ", x);
    }
    puts!("\n");
  }
}


Measured memory_bytes: 4860
#include <bits/stdc++.h>
#include<unordered_map>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;
int main() {
	string S;
	cin >> N >> S;
	int ansind = 0;
	for (int i = 0; i < N; i++) {
		vector<int>chX(26, 0), chY(26, 0);
		for (int j = 0; j < i; j++) {
			chX[S[j]-'a'] = 1;
		}
		for (int j = i; j < N; j++) {
			chY[S[j]-'a'] = 1;
		}
		ll tmp = 0;
		for (int j = 0; j < 26; j++) {
			if (chX[j] ==1&& chY[j]==1)tmp++;
		}
		ans = max(ans, tmp);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, x) for (ll i = 0; i < (x); i++)
#define chmax(x, a)  do { x = max(x, a); } while(0)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

ll Y, X, K;
int main(void) {
  cin >> Y >> X >> K;
  vector<string> a(Y);
  rep(y, Y)
    cin >> a[y];
  ll ans = 0;
  rep(yBit, 1 << Y) rep(xBit, 1 << X) {
    ll t = 0;
    rep(y, Y) rep(x, X) {
      if ((yBit >> y) &1) continue;
      if ((xBit >> x) &1) continue;
      if (a[y][x] == '.') continue;
      t++;
    }
    if (t == K)
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		for(int i=1;i<=9;i++) {
			if(N%i==0) {
				int j = N/i;
				if(String.valueOf(j).length() == 1) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");

	}
}

Measured memory_bytes: 26964
N=int(input())
xy=[list(map(int,input().split()))for _ in range(N)]

import itertools
all_route=list(itertools.permutations(xy))

length=0
for route in all_route:
    i=1
    while i<N:
        length+=((route[i][0]-route[i-1][0])**2+(route[i][1]-route[i-1][1])**2)**0.5
        i+=1

import math
print(length/math.factorial(N))

Measured memory_bytes: 10100
import java.util.*;
import java.util.Arrays;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        String[] a = new String[N];
        for(int i = 0 ; i < N ; i++){
            a[i] = sc.next();
        }

        Arrays.sort(a);
        for(int j = 0 ; j < N ; j++){
            System.out.print(a[j]);
        }
    }
}

Measured memory_bytes: 21716
n = gets.to_i
h = {}
for i in 0...n do
  s = gets.chomp.split("").sort.join("")
  if h.include?(s)
    h[s] += 1
  else
    h[s] = 1
  end
end

count = 0
h.each do |k, v|
  if v >= 2
    count += v * (v - 1) / 2
  end
end
puts count


Measured memory_bytes: 18464
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    x = f()[0]
    ans = (x//11)*2 
    remain = x%11
    add = 0
    if remain!=0:
        add = (2 if remain >6 else 1)
    
    print(ans + add)

solve()


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

using namespace std;
using ll =long long;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using P = pair<int,int>;
//Write From this Line

int main()
{
	ll n, W;
	cin >> n >> W;
	vector<ll> v(n), w(n);
	rep(i,n) cin >> v[i] >> w[i];
	vector<vector<ll>> dp(110,vector<ll> (10010,0));
	rep(i,n) {
		int weight = w[i];
		int val = v[i];
		// dp[i+1]を操作する
		for(int j = 0; j <= 10010; j++){
			dp[i+1][j] = dp[i][j];
			if(j - weight >= 0) {
				dp[i+1][j] = max(dp[i][j], dp[i][j-weight] + val);
			}
		}
	}
	cout << dp[n][W] << endl;
}



Measured memory_bytes: 11612
#include <stdio.h>
int main(){
    int m, f, r;

    while(1){
        scanf("%d %d %d",&m, &f, &r);
        if(m == -1 && f == -1 && r == -1){
            break;
        }

        if(m == -1 || f == -1 || m + f < 30) printf("F\n");
        else if(m + f >= 80) printf("A\n");
        else if(m + f >= 65) printf("B\n");
        else if(m + f >= 50) printf("C\n");
        else if(m + f >= 30 && r >= 50) printf("C\n");
        else printf("D\n");
        
    }
    
    return 0;
}


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

using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<long long, null_type,less<long long>, rb_tree_tag,tree_order_statistics_node_update>
//s.find_by_order(index) returns iterator to the index-th element
//in O(logn) time.



typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vii;
typedef vector<string> vss;
typedef vector<pair<ll, ll> > vpll;
typedef unordered_map<ll ,ll> mpll;
typedef unordered_map<int ,int> mpii;
typedef unordered_map<char ,ll> mpcl;
typedef pair<ll , ll> pll;
typedef complex<double> cd;
typedef vector< complex<double> > vcd;


#define fore(i,n) for(i=0;i<n;i++)
#define forz(i,s,f) for(i=s;i<f;i++)
#define forer(i,n) for(i=n-1;i>=0;i--)
#define forzr(i,s,f) for(i=s;i>=f;i--)
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define pvec(i,vec) fore(i,vec.size())cout<<vec[i]<<" ";cout<<"\n";

const ll mod=1e9+7;
const ll modulo=998244353;
const double pi = 3.14159265358979323846;


ll power(ll x,ll y,ll m)//gives (x^y)%m
{
    ll ans=1;
    while (y>0)
    {
        if(y & 1)
        {
            ans=(ans*x)%m;
        }
        y=y/2;
        x=(x*x)%m;
    }
    return ans;
}

bool sortbysec(pll &a,pll &b)
{
    return(a.ss<b.ss);
}

ll gcd(ll a,ll b)
{
	if(a==0)
		return b;
	else
		return(gcd(b%a,a));
}

ll lcm(ll a,ll b)
{
	ll ans=(a*b)/gcd(a,b);
	return ans;
}

long double logn(long double a,long double n)
{
	return(log(n)/log(a));
}

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
    
	ll te=1,test,i,j,n,m,flag,k,p,temp;
	//cin>>te;
	for(test=1;test<=te;test++)
	{
		char ch;
		cin>>ch;

		char ans;
		if(ch>='A' && ch<='Z')
			ans='A';
		else if(ch>='a' && ch <='z')
			ans='a';

		cout<<ans<<"\n";
		/*vll a(n);
		fore(i,n)
		{
			cin>>a[i];
		}*/
		
		//cout<<"hello\n";
		//cout<<"Case #"<<test<<": ";
	}

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
  #define int long long
  int H,W,M;
  cin>>H>>W>>M;
  vector<int> hh(H);
  vector<int> ww(W);
  vector<pair<int,int>> memo(M);
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    memo.at(i)=make_pair(a,b);
    hh.at(a)++;
    ww.at(b)++;
  }
  int mh=0;
  int mw=0;
  for(int i=0;i<H;i++){
    mh=max(mh,hh.at(i));
  }
  for(int i=0;i<W;i++){
    mw=max(mw,ww.at(i));
  }
  int counth=0;
  int countw=0;
  for(int i=0;i<H;i++){
    if(mh==hh.at(i)){counth++;}
  }
  for(int i=0;i<W;i++){
    if(mw==ww.at(i)){countw++;}
  }
  int count=0;
  for(int i=0;i<M;i++){
    int h=memo.at(i).first;
    int w=memo.at(i).second;
    if(hh.at(h)==mh && ww.at(w)==mw){
      count++;
    }
  }
  if(count==counth*countw){
    cout<<mh+mw-1<<endl;
  }
  else{
    cout<<mh+mw<<endl;
  }
}

Measured memory_bytes: 12752
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>


using namespace std;

int main()
{  
    int h,a,b,ans;
    //int count=0;
        
    cin>>a>>b>>h;
    
    ans = (a+b)*h/2;
    
    cout<<ans<<endl;
    
    
    //cout<<n<<endl;
    
         
    return 0;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>

using namespace std;

int A, B= 0;

int main() {

	cin >> A >> B;

	int P, M, X;
	P = A + B;
	M = A - B;
	X = A * B;

	int tmp,tmp1 = 0;
	tmp = max(P,M);
	tmp1 = max(tmp, X);

	cout << tmp1;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define endl '\n'
#define F first
#define S second
typedef pair<int,int> pii;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int a, b; cin>>a>>b;
	if(a<=5)cout<<0<<endl;
	else if(a>=6 && a<=12)cout<<b/2<<endl;
	else cout<<b<<endl;
	return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  string s;
  cin >> s;
  int n = s.length();
  int cnt = 0;
  for(int i = 0; i < n; i++) {
    if(s[i] == 'g'){
      cnt++;
    }else{
      cnt--;
    }
  }
  cout << cnt / 2 << endl;
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void)          
{
	int a[100][100], b[100], c[100];
	int m, n;
	
	int i, j;


	scanf("%d %d", &m, &n);
	for (i = 0;i < m; i++)
	{
		c[i] = 0;
		for (j = 0; j < n; j++)
		{
			scanf("%d", &a[i][j]);
		}

	}

	for (i = 0; i < n; i++)
	{
			scanf("%d", &b[i]);
	}

	for (i = 0; i < m; i++) 
	{
		for (j = 0; j < n; j++)
		{
			c[i] += a[i][j] * b[j];
		
		}
		printf("%d\n", c[i]);
	}
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=200010;
int a[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int n;
    long long ans=0;
    cin>>n,a[0]=-1;
    for(int i=1;i<=n;i++) {
	a[i]=gi();
	if(a[i]>a[i-1]+1) return puts("-1"),0;
    }
    for(int i=n,la=-1;i;i--) {
	if(a[i]!=la) ans+=a[i];
	la=a[i]-1;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1024
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL A, B, X;
	cin >> A >> B >> X;
	LL ans = B / X;
	if (A > 0)ans -= (A - 1) / X;
	else ans++;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3184
#include <iostream>

using namespace std;

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

    int k[] = { 1, 2, 4, 8, 16, 32, 64 };
    int i = 6;
    while (true) {
        if (k[i] <= n) break;
        i--;
    }

    cout << k[i] << endl;
}

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

int main(){
  int N,M,C;
  cin >>N>>M>>C;
  vector<int> B(M);
  for (int i=0;i<M;i++){
    cin>>B.at(i);
  }
  
  int ans=0;
  
  for (int i=0;i<N;i++){
    vector<int> A(M);
    int sum=C;
    
    for (int j=0;j<M;j++){
    cin >>A.at(j);
    sum += A.at(j)*B.at(j);
    }
    
    if (sum>0){
      ans++;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);
	    int n=gi();
	    int k= gi();
	    int[] x=new int[n];
	    int c=0;
	    for(int i=0; i<n;i++) {
	    	x[i]=gi();
	    	c+= Math.min(x[i], k-x[i]);
	    }

	    System.out.print(c*2);
//	    if (s.contains("AC")) {
//	    	System.out.print("Yes");
//	    }else {
//	    	System.out.print("No");
//	    }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35692
using System;
using System.Linq;
public class Program {
  public static void Main() {
    int[] AB = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    int A = AB[0], B = AB[1];
    Console.WriteLine((A <= 8 && B <= 8) ? "Yay!" : ":(");
  }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define ci(n) cin >> n
#define co(n) cout << n << endl
using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  int a[n], c=0;
  rep(i,0,n) cin >> a[i];
  sort(a, a+n); reverse(a, a+n);
  rep(i,0,k) c+=a[i];
  co(c);
  
  return 0;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; cin >> n;
    string s; cin >> s;
    int len = s.length();
    int left[10], right[10];
    fill(left, left + 10, inf);
    fill(right, right + 10, -1);

    for (int i = 0; i < len; i++) {
        int c = s[i] - '0';
        if (left[c] == inf) left[c] = i;
    }
    for (int i = len - 1; i >= 0; i--) {
        int c = s[i] - '0';
        if (right[c] == -1) right[c] = i;
    }

    int ans = 0;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
                int l = left[i], r = right[j];
                if (l >= len || r < 0) continue;
            for (int k = 0; k < 10; k++) {
                for (int m = l + 1; m < r; m++) {
                    if (s[m] == '0' + k) {
                        ans++;
                        break;
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<stack>
using namespace std;

char s[100005];
int main()
{
    int num=0;
    int i;
    stack<char>c;
    scanf("%s",s);
    int len=strlen(s);
    for(i=0;i<=len-1;i++)
    {
        if(c.empty()||c.top()==s[i])
            c.push(s[i]);
        else
        {
            c.pop();
            num+=2;
        }
    }
    printf("%d",num);
    return 0;
}


Measured memory_bytes: 384
N, M = gets.split.map(&:to_i)
l = Array.new(M)
r = Array.new(M)
M.times do |i|
  l[i], r[i] = gets.split.map(&:to_i)
end
if l.max > r.min
  puts 0
else
  puts [r.min - l.max + 1, N].min
end

Measured memory_bytes: 3324