akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int n;
    cin >> n;
    vector<pair<int,int> > g;
    if(n%2==0){
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(i+j!=n+1){
                    g.PB(MP(i,j));
                }
            }
        }
    }else{
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(i+j!=n){
                    g.PB(MP(i,j));
                }
            }
        }
    }
    cout << g.size() << endl;
    rep(i,g.size()){
        cout << g[i].first << " " << g[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 888
#define _USE_MA_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    string s;
    cin>>s;
    int n=s.length();
    stack<char> st;
    rep(i,n){
        if(!st.empty()&&st.top()!=s[i])st.pop();
        else st.push(s[i]);
    }
    cout<<n-st.size()<<endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=305;
const int MOD=998244353;
int n,m;
char s[N];
int a[N];
int sum[N];
long long dp[N][N][N];
int main()
{
    scanf("%s%d",s+1,&m);
    n=strlen(s+1);
    s[++n]='0';
    int cnt=0;
    for(int i=1;i<=n;i++) cnt+=s[i]-'0';
    m=min(m,cnt);
    cnt=0;
    for(int i=1;i<=n;i++)
        if(s[i]=='0') cnt++;
        else a[cnt+1]++;
    for(int i=1;i<=cnt;i++)
        sum[i]=sum[i-1]+a[i];
    dp[0][0][0]=1;
    for(int i=1;i<=cnt;i++)
        for(int j=sum[i];j<=n-cnt;j++)
            for(int k=0;k<=m;k++)
                for(int p=0;p<=min(j,n-sum[i-1]-cnt);p++)
                    if(k>=max(p-a[i],0)) dp[i][j][k]=(dp[i][j][k]+dp[i-1][j-p][k-max(p-a[i],0)])%MOD;
    long long ans=0;
    for(int k=0;k<=m;k++)
        ans=(ans+dp[cnt][n-cnt][k])%MOD;
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 57036
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
s=[0]*(n+1)
ans=0
for i in range(n):
  s[i+1]=s[i]+a[i]
c=Counter(s)
for num in c.values():
  ans+=num*(num-1)/2
print(int(ans))

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

int main(){
	int x, y;
	while (1){
		cin >> x >> y;
		if(x == 0 && y == 0)break;

		if (x < y) 
			cout << x << " " << y << endl;
		else
			cout << y << " " << x << endl;

	}
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;

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

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 2e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


class Bit {
public:
	int n;
	vl bit;

	Bit(int _n) { n = _n; bit.resize(n + 1); }

	ll sum(int i) {
		ll s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}

	void add(int i, ll x) {
		while (i <= n) {
			bit[i] += x;
			i += i & -i;
		}
	}

	// 1,2,...,nを並び替えた順列をバブルソートで
	// 順番通りにするための交換回数
	ll bubble(vi p) {
		int n = p.size();
		ll ans = 0;
		for (int j = 0; j < n; j++) {
			ans += (j - sum(p[j]));
			add(p[j], 1);
		}
		return ans;
	}

	// bitに入ってる中でx番目に小さい数を求める
	// bitに3を入れる→add(3, 1), 3を出す→add(3, -1)
	ll min_xth(int x) {
		int left = 0, right = 200000;
		while (left + 1 < right) {
			int mid = (left + right) / 2;
			int temp = sum(mid);
			if (temp < x) {
				left = mid;
			}
			else {
				right = mid;
			}
		}
		return right;
	}

};


int main() {
	string s;
	cin >> s;
	int n = s.size();
	int i, j;
	vi num(26);
	for (i = 0; i < n; i++) {
		num[s[i] - 'a']++;
	}
	int ki = -1;
	for (i = 0; i < 26; i++) {
		if (num[i] % 2) {
			if (ki == -1) {
				ki = i;
			}
			else {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	vi p(n, -1);
	vi cnt(26);
	vi place(n);
	for (i = 0; i < n; i++) {
		int alpha = s[i] - 'a';
		cnt[alpha]++;
		if (alpha == ki) {
			if (cnt[alpha] <= num[alpha] / 2) {
				place[i] = 0;
			}
			else if (cnt[alpha] == num[alpha] / 2 + 1) {
				place[i] = 1;
			}
			else {
				place[i] = 2;
			}
		}
		else {
			if (cnt[alpha] <= num[alpha] / 2) {
				place[i] = 0;
			}
			else {
				place[i] = 2;
			}
		}
	}
	j = 0;
	for (i = 0; i < n; i++) {
		if (place[i] == 0) {
			p[j++] = i;
		}
		else if (place[i] == 1) {
			p[n / 2] = i;
		}
	}
	vi right(26);
	for (i = 0; i < n; i++) {
		right[s[i] - 'a'] = i;
	}
	for (i = 0; i < n / 2; i++) {
		int alpha = s[p[i]] - 'a';
		p[n - 1 - i] = right[alpha];
		for (j = right[alpha] - 1; j >= 0; j--) {
			if (s[j] - 'a' == alpha) {
				right[alpha] = j;
				break;
			}
		}
	}
	for (i = 0; i < n; i++) {
		p[i]++;
	}
	Bit bit(n);
	cout << bit.bubble(p) << endl;
}

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

using namespace std;

int main(){
    
    string s, t;

    cin >> s >> t;

    for(size_t i = 0; i < s.size(); i++){
        rotate(s.begin(), s.begin() + 1, s.end());
        if(s == t){
            cout << "Yes" << endl;
            return 0; 
        }
    }

    cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
w=input().split(" ")
a=int(w[0])
b=int(w[1])
c=int(w[2])
d=int(w[3])
ans=0
for t in range(100):
    sum=0
    if t>=a and t<b:
        sum+=1
    if t>=c and t<d:
        sum+=1
    if sum==2:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;

int main(){
  int h,w;
  while(1){
    cin >> h >> w;
    if(h==0&&w==0) break;
    for(int i = 0;i < h;i++){
      for(int j = 0;j < w;j++){
    cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
int main(void){
    int N, X;
    int D = 0;
    int bound = 1;
    cin >> N >> X;
    
    for (int i = 0; i < N; i++)
    {
        int l;
        cin >> l;
        if (D + l <= X) {
            ++bound;
            D = D + l;
        } else {
            break;
        }
    }
    cout << bound;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

pll A[3005];
ll dp[3005][3005][2];

int main()
{
    ll N, T;
    cin >> N >> T;
    REP(i, N)
    {
        cin >> A[i].first >> A[i].second;
    }
    // sort(A, A + N, [](pll a, pll b) { return a.first < b.first; });
    memset(dp, 0, sizeof(dp));

    REP(i, N)
    {
        REP(t, T + 1)
        {
            //! 普通に頼む
            {
                dp[i + 1][t][0] = std::max(dp[i][t][0], dp[i + 1][t][0]);
                if (t - A[i].first >= 0)
                    dp[i + 1][t][0] = std::max(dp[i + 1][t][0], dp[i][t - A[i].first][0] + A[i].second);
            }

            {
                dp[i + 1][t][1] = std::max(dp[i][t][1], dp[i + 1][t][1]);
                if (t - A[i].first >= 0)
                    dp[i + 1][t][1] = std::max(dp[i + 1][t][1], dp[i][t - A[i].first][1] + A[i].second);
            }
            //! ラストオーダー
            {
                dp[i + 1][t][1] = std::max(dp[i][t][1], dp[i + 1][t][1]);
                if (t < T)
                {
                    dp[i + 1][t][1] = std::max(dp[i + 1][t][1], dp[i][t][0] + A[i].second);
                }
            }
        }
    }

    ll max = 0;
    REP(i, T + 1)
    {
        max = std::max(max, dp[N][i][0]);
        if (i < T)
            max = std::max(max, dp[N][i][1]);
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 141440
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using static System.Console;
using static System.Math;


namespace templete
{
    class abc96_a
    {
        static void Main(string[] args)
        {
            int[] input = ReadLine().Split().Select(int.Parse).ToArray();
            int x = input[0];
            int y = input[1];

            if(x > y)
            {
                WriteLine(x-1);
            }
            else
            {
                WriteLine(x);
            }
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,k,a[200010];
    cin>>n>>k;
    rep(i,n)cin>>a[i];
    for(int i=k;i<n;i++){
        if(a[i-k]<a[i])puts("Yes");
        else puts("No");
    }
    return 0;
}


Measured memory_bytes: 5216
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define fr(i,n) for(int i = 0;i < n;i++)
#define pb push_back
using namespace std;

int main() {
  int h,w;
  cin>>h>>w;
  char a[h][w];
  vector<bool> rows(h, true), cols(w, true);
  fr(i,h){
    fr(j,w) {
      cin>>a[i][j];
    }
  }
  fr(i,h) {
    bool hash = false;
    fr(j,w) {
      if(a[i][j] == '#') {
        hash = true;
        break;
      }
    }
    if(!hash) rows[i] = false;
  }

  fr(j,w) {
    bool hash = false;
    fr(i,h) {
      if(a[i][j] == '#') {
        hash = true;
        break;
      }
    }
    if(!hash) cols[j] = false;
  }

  fr(i,h) {
    if(!rows[i]) continue;
    fr(j,w) {
      if(!cols[j]) continue;
      cout<<a[i][j];
    }
    nl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair

const int N = 102;
typedef pair<int, int> info;
int n;
vector <info> a;
int main() {
    cin >> n;
    int s = n;
    if (s % 2 == 0) s++;
    for (int i = n; i >= 1; i--) {
        for (int j = i - 1; j >= 1; j--) {
            if (i + j != s) {
                a.emplace_back(mp(i, j));
            }
        }
    }
    cout << a.size() << "\n";
    for (auto x: a) {
        cout << x.X << " " << x.Y << "\n";
    }
    return 0;
}

Measured memory_bytes: 384
A,B,K=map(int,input().split())
for i in range(K):
  if i%2==0:
    if A%2==0:
      A=A-A//2
      B=B+A
    else:
      A=(A-1)//2
      B=B+A
  else:
    if B%2==0:
      B=B-B//2
      A=B+A
    else:
      B=(B-1)//2
      A=B+A
print(str(A)+" "+str(B))

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define ll long long
#define mk make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
using namespace std;
const int MAXN=1e5+9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a,b,n;
	cin>>a>>b>>n;
	ll ans=((a*n)/b)-a*(n/b);
	if((n/b)>=1)
	{
		ans=max(ans,(a*(b-1))/b);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3648
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

bool isPal(string s){
  F0R(i,s.length()/2){
    if(s[i] != s[s.length()-i-1])
      return false;
  }
  return true;
}


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;
    ll a,b;
    cin >> a >> b;
    ll ans = 0;
    FOR(i,a,b+1){
      if(isPal(to_string(i))) ++ans;
    }
    cout << ans << endl;




    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, A := sc.nextInt(), sc.nextInt()

	if N%500 <= A {
		fmt.Fprintln(wtr, "Yes")
	} else {
		fmt.Fprintln(wtr, "No")
	}
	wtr.Flush()
}


Measured memory_bytes: 640
#include <stdio.h>

void swap(int *a,int *b){
  *a^=*b;
  *b^=*a;
  *a^=*b;
  return;
}

int main(){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);
  if(A<B) swap(&A,&B);
  if(A<C) swap(&A,&C);
  printf("%d\n",A*10+B+C);
  return 0;
}

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

const int max_n = 8 + 1;
bool edge[max_n][max_n];
int n, m;

int dfs(int v, bool visited[max_n])
{
    bool visited_all = true;
    for (int i = 1; i <= n; i++)
    {
        if (!visited[i])
        {
            visited_all = false;
        }
    }
    if (visited_all)
    {
        return 1;
    }

    int cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        if (!visited[i] && edge[v][i])
        {
            visited[i] = true;
            cnt += dfs(i, visited);
            visited[i] = false;
        }
    }
    return cnt;
}

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

    for (int i = 0; i < m; i++)
    {
        int a, b;
        scanf("%d %d", &a, &b);
        edge[a][b] = true;
        edge[b][a] = true;
    }

    bool visited[max_n];
    for (int i = 1; i <= n; i++)
    {
        visited[i] = false;
    }
    visited[1] = true;

    cout << dfs(1, visited) << endl;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        string str1 = Console.ReadLine();
        string[] strMD1 = str1.Split(' ');
        int M1 = Int32.Parse(strMD1[0]);
        int D1 = Int32.Parse(strMD1[1]);

        string str2 = Console.ReadLine();
        string[] strMD2 = str2.Split(' ');
        int M2 = Int32.Parse(strMD2[0]);
        int D2 = Int32.Parse(strMD2[1]);

        if( M1 + 1 != M2 || D2 != 1)
        {
            Console.WriteLine("0");
            return;
        }
        if (M1 == 2)
        {
            if( D1 == 28 )
            {
                Console.WriteLine("1");
                return;
            }
            Console.WriteLine("0");
            return;
        }
        if( M1 == 4 || M1 == 6 || M1 == 9 || M1 == 11 )
        {
            if (D1 == 30)
            {
                Console.WriteLine("1");
                return;
            }
            Console.WriteLine("0");
            return;
        }
        else
        {
            if (D1 == 31)
            {
                Console.WriteLine("1");
                return;
            }
            Console.WriteLine("0");
            return;
        }
    }
}

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

def main():
    #入力
    n = int(input())
    lists = []
    for i in range(n):
        lists.append(int(input()))
    
    #リストからダブりを消す
    lists = list(set(lists))
    print(len(lists))

if __name__ == '__main__':
    main()
    

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

int main(void){
	int a;
	int b;
	int c;
	
	cin >> a >> b >> c;
	int max=a;
	
	if(b>max) max=b;
	if(c>max) max=c;
	
	cout << a+b+c-max << endl;
	
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.regex;
import std.range;

void main() {
	auto ip = readln.split.to!(ulong[]), N = ip[0], M = ip[1];
	/*auto a = new bool[][](N, M);
	//N: tate, M: yoko
	// omote: false, ura: true

	foreach(i; 0..N) { //tate
		foreach(j; 0..M) { //yoko
			foreach(k; -1..2) { //tate
				if(i+k < 0 || i+k >= N) continue;
				foreach(l; -1..2) { //yoko
					if(j+l < 0 || j+l >= M) continue;
					a[i+k][j+l] = !a[i+k][j+l];
				}
			}
		}
	}
	//a.writeln;
	uint count;
	foreach(b; a) {
		foreach(c; b) {
			if(c) count++;
		}
	}
	count.writeln;
	*/
	if(N == 1 && M == 1)	1.writeln;
	else if(N == 1) 		(M - 2).writeln;
	else if(M == 1) 		(N - 2).writeln;
	else 					((N-2)*(M-2)).writeln;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;
#define MAXN 1000000
bitset<MAXN> bs;

int32_t main(){
	ios::sync_with_stdio(0);
	int x;
	cin >> x;
	bs[0] = bs[1] = true;
	for(int i=2; i<MAXN; ++i){
		if(!bs[i]){
			if(i>=x){
				cout << i << endl;
				return 0;
			}
			for(int j=i*i; j<MAXN; j+=i) bs[j] = true;
		}
	}	
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+5;
struct P {
	int pos,x;
	bool operator <(const P &t)const {
		return pos<t.pos;
	}
}p[N];
int cnt;
ll b[N*3],sum[N*12],lazy[N*12];
void push_down(int l,int r,int rt) {
	if(!lazy[rt]) return;
	lazy[rt<<1]+=lazy[rt];
	lazy[rt<<1|1]+=lazy[rt];
	int mid=(l+r)>>1;
	sum[rt<<1]+=lazy[rt]*(mid-l+1);
	sum[rt<<1|1]+=lazy[rt]*(r-mid);
	lazy[rt]=0;
}
void update(int L,int R,int val,int l,int r,int rt) {
	if(L<=l&&r<=R) {
		sum[rt]+=1LL*val*(r-l+1);
		lazy[rt]+=val;
		return;
	}
	push_down(l,r,rt);
	int mid=(l+r)>>1;
	if(L<=mid) update(L,R,val,l,mid,rt<<1);
	if(R>mid) update(L,R,val,mid+1,r,rt<<1|1);
	sum[rt]=sum[rt<<1]+sum[rt<<1|1];
}
ll query(int L,int R,int l,int r,int rt) {
	if(L<=l&&r<=R) return sum[rt];
	push_down(l,r,rt);
	int mid=(l+r)>>1;
	ll ans=0;
	if(L<=mid) ans+=query(L,R,l,mid,rt<<1);
	if(R>mid) ans+=query(L,R,mid+1,r,rt<<1|1);
	return ans;
}
int main() {
	int n,d,a;
	scanf("%d%d%d",&n,&d,&a);
	for(int i=0;i<n;i++) {
		scanf("%d%d",&p[i].pos,&p[i].x);
		p[i].x=(p[i].x+a-1)/a;
		b[++cnt]=p[i].pos;
		b[++cnt]=p[i].pos+d;
		b[++cnt]=1LL*p[i].pos+2*d;
	}
	sort(p,p+n),sort(b+1,b+cnt+1);
	int m=unique(b+1,b+cnt+1)-b-1;
	ll ans=0;
	for(int i=0;i<n;i++) {
		int L=lower_bound(b+1,b+m+1,p[i].pos)-b;
		ll t=query(L,L,1,m,1);
		if(p[i].x<=t) continue;
		ans+=p[i].x-t;
		int R=lower_bound(b+1,b+m+1,1LL*p[i].pos+2*d)-b;
		update(L,R,p[i].x-t,1,m,1);
	}
	printf("%lld\n",ans);
 	return 0;
}

Measured memory_bytes: 43648
<?php
    # 整数の入力
    fscanf(STDIN, "%d %d", $N, $M);
	$input = explode(" ", trim(fgets(STDIN)));
	
	sort($input);
	$p = [];
	$total = 0;
	$count = $N - 1;

	for ($i=0; $i < $M-1; $i++) { 
		$num = $input[$i+1] - $input[$i];
		$total += $num;
		$p[$i] = $num;
	}
	rsort($p);
	for ($j=0; $j < $count; $j++) { 
		$total -= $p[$j];
	}
	echo $total;
    ?>

Measured memory_bytes: 18932
import math
A,B = map(int,input().split())

gcd = math.gcd(A,B)
d = []
if A == 1 or B == 1 :
    print(1)
    exit()
ans = [1]
while gcd %2 == 0 :
    gcd //= 2
    ans.append(2)
i = 3
while i * i <= gcd :
    if gcd %i == 0 :
        ans.append(i)
        gcd //= i
    else :
        i += 2
if gcd != 1 :
    ans.append(gcd)
print(len(set(ans)))


Measured memory_bytes: 9036
n = int(input())
a = list(map(int, input().split()))
b = [0,0,0]
for i in range(n):
    j = 0
    while True:
        if a[i]%2==0:
            a[i] = a[i]//2
            j +=1
        else:
            b[j]+=1
            break

        if j>1:
            b[2]+=1
            break
if b[1]==0 and b[0]-1<=b[2]:
    print("Yes")
elif b[0]<=b[2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
using System;
using System.Linq;
using System.Text;

namespace ITP1_6_A_Reversing_Numbers
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            Console.WriteLine(
                Console.ReadLine().Split( ' ' ).Reverse()
                    .Aggregate( new StringBuilder(), (acc, s) => acc.AppendFormat( " {0}", s ), result => result.ToString().Substring( 1 ) ) );
        }
    }
}

Measured memory_bytes: 5640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            double x=sc.nextDouble();
            double h=sc.nextDouble();
            if(x==0&&h==0) {
                break;
            }
            System.out.println(Math.sqrt(h*h+x*x/4)*x*2+x*x);
        }
    }
}


Measured memory_bytes: 28060
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for h in range(H):
        for w in range(W):
            if (h+w)%2 == 0:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()    
                


Measured memory_bytes: 7004
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const lli inf = 1e18;
const lli mod = 1e9 +7;
typedef pair<lli, lli> pll;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> ac(n, 0);

    int acnum=0, wanum=0;
    for(int i=0; i<m; i++){
        int p;
        string s;
        cin >> p >> s;
        p--;
        if(ac[p] != -1){
            if(s == "AC"){
                acnum++;
                wanum += ac[p];
                ac[p] = -1;
            }
            if(s == "WA"){
                ac[p]++;
            }
        }
    }
    cout << acnum << " " << wanum << endl;
    return 0;
}

Measured memory_bytes: 640
def makediv(n):
  ret=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ret.append(i)
      if i!=n//i:
        ret.append(n//i)
  return ret
 
n=int(input())
arr=sorted(makediv(n),reverse=True)
ans=0
for i in arr:
  q=n//i
  if i-1<=q:
    break
  ans+=i-1
print(ans)

Measured memory_bytes: 3296
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 
    int n;
    cin>>n;
    
    for(int i = 1000;i<= 10000;i+=1000){
        if(n<=i) {
            cout<<i-n;
            return 0;
        }
    }
    
    
 return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n,L,p;
	p=-1;
	int a[100001];
	cin >> n >>L;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int j=0;j<(n-1);j++){
		if(a[j+1]+a[j]>=L){
			p=j+1;
			break;
		}
	}
	if(p==-1)cout << "Impossible"<<endl;
	else{
		cout <<"Possible"<<endl;
		for(int k=1;k<p;k++){
			cout << k <<endl;
		}
		for(int s=n-1;s>p;s--){
			cout << s <<endl;
		}
		cout << p <<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
from collections import Counter
n = int(input())
s = input()
cnt = Counter(s)
ans = cnt["R"] * cnt["G"] * cnt["B"]

# 端固定
rgb = 0
for i in range(n-1):
    for j in range(i+1, n):
        if 2 * j > n - 1 + i:
            break
        if s[i] != s[j] and s[j] != s[2 * j - i] and s[i] != s[2 * j - i]:
            rgb += 1

print(ans-rgb)


Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;


int main(){
  string s;
  cin >> s;

  int sum = 0;
  int size_ = s.size();
  REP(i, 0, size_){
    if ( ((i % 2 == 0) and (s.substr(i, 1) == "0")) or ((i % 2 == 1) and (s.substr(i, 1) == "1")) )
      sum++;
  }

  cout << min(sum, size_ - sum) << endl;

  return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();

        long[] a = new long[n+1];
        long[] b = new long[m+1];
        for(int i=0; i<n; i++) {
            a[i+1] = a[i] + sc.nextInt();
        }
        for(int i=0; i<m; i++) {
            b[i+1] = b[i] + sc.nextInt();
        }

        int res = 0;
        int j = m;
        for(int i=0; i<=n; i++) {
            long rem = k - a[i];
            if(rem < 0) break;
            while(j>0 && b[j] > rem) j--;
            res = Math.max(res, i + j);
        }



        System.out.println(res);

    }

}

Measured memory_bytes: 63096
N = int(input())
S = input()
acc0 = [0]
acc1 = [0]
acc2 = [0]

for i in range(N):
    if S[i]=='R':
        acc0.append(acc0[-1]+1)
        acc1.append(acc1[-1])
        acc2.append(acc2[-1])
    elif S[i]=='G':
        acc0.append(acc0[-1])
        acc1.append(acc1[-1]+1)
        acc2.append(acc2[-1])
    else:
        acc0.append(acc0[-1])
        acc1.append(acc1[-1])
        acc2.append(acc2[-1]+1)
        
ans = 0

for i in range(N):
    for j in range(i+1, N):
        if S[i]==S[j]:
            continue
        
        if (S[i]=='R' and S[j]=='G') or (S[i]=='G' and S[j]=='R'):
            ans += acc2[N]-acc2[j+1]
            
            if j+(j-i)<N and S[j+(j-i)]=='B':
                ans -= 1
                
        elif (S[i]=='R' and S[j]=='B') or (S[i]=='B' and S[j]=='R'):
            ans += acc1[N]-acc1[j+1]
            
            if j+(j-i)<N and S[j+(j-i)]=='G':
                ans -= 1
                
        elif (S[i]=='G' and S[j]=='B') or (S[i]=='B' and S[j]=='G'):
            ans += acc0[N]-acc0[j+1]
            
            if j+(j-i)<N and S[j+(j-i)]=='R':
                ans -= 1

print(ans)

Measured memory_bytes: 68872
from sys import stdin

N = int(stdin.readline().rstrip())
W = []
for k in range(N):
    w = stdin.readline().rstrip()
    if k >= 1:
        if w[0] != W[k - 1][len(W[k - 1]) - 1] or len([x for x in W if x == w]) > 0:
            print('No')
            break
    W.append(w)
if len(W) == N:
    print('Yes')

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

long long calc(int n, const vector<int>& options, const vector<int>& cost,
               const vector<array<int, 26>>& s, int dd, int nt, int ot) {
  //long long x(total);
  int before(dd-1), after(dd+1);
  while (before >= 0 && options[before] != nt) before--;
  while (after < n && options[after] != nt) after++;
  int a(dd - before - 1), b(after - dd - 1), c(after - before - 1);
  int diff = c * (c+1) / 2 - a * (a+1) / 2 - b * (b+1) / 2;
  int before2(dd-1), after2(dd+1);
  while (before2 >= 0 && options[before2] != ot) before2--;
  while (after2 < n && options[after2] != ot) after2++;
  int a2(dd - before2 - 1), b2(after2 - dd - 1), c2(after2 - before2 - 1);
  int diff2 = c2 * (c2+1) / 2 - a2 * (a2+1) / 2 - b2 * (b2+1) / 2;
  return - (long long) diff * cost[nt] + (long long) diff2 * cost[ot] + s[dd][nt] - s[dd][ot];
}
int main() {
  int n;
  cin >> n;
  vector<int> c(26);
  vector<array<int, 26>> s(n);
  
  vector<int> last(26, -1);
  
  for (int i = 0; i < 26; ++i)
    cin >> c[i];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 26; ++j)
      cin >> s[i][j];
  
  long long total(0);
  vector<int> options(n);
  
  for (int i = 0; i < n; ++i) {
    int neg(0), test(-1);
    for (int j = 0; j < 26; ++j) {
      neg -= c[j] * (i - last[j]);
    }
    //cout << neg << 'n' << endl;
    int max_score = -1e9;
    for (int j = 0; j < 26; ++j) {
      int ss = s[i][j] + neg + c[j] * (i - last[j]);
      if (ss > max_score) {
        max_score = ss;
        test = j;
      }
    }
    total += max_score;
    //cout << test + 1 << endl;
    options[i] = test;
    //cout << test + 1 << ' ' << max_score << endl;
    last[test] = i;
  }
  //cout << total << endl;
  for (int t = 1; t <= 500; ++t) {
    for (int dd = n - 1; dd >= 0; --dd) {
      for (int tt = 25; tt >= 0; --tt) {
        if (tt == options[dd]) continue;
        int ot = options[dd];
        
        long long ns = calc(n, options, c, s, dd, tt, ot);
        //cout << ns << endl;
        if (ns > 0) {
      		total += ns;
          options[dd] = tt;
    	}
      }
    }
  }
  for (const int& i: options) cout << i + 1 << endl;
  //cout << total << endl;
  return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cstring>
#include <queue>
#include <algorithm>
#include <climits>
#include <string>
#include <cstdlib>
#include <sstream>
#include <cmath>
#include <cassert>
#include <iomanip> // cout << setprecision(9) << fixed;

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;

#define umap unordered_map
#define uset unordered_set
#define pqueue priority_queue

int main() {
    int N, A, B;
    string s;
    cin >> N >> A >> B;
    cin >> s;
    int a = 0, b = 0;
    for (char c: s) {
        if (c == 'a') {
            if ((a + b) < (A + B)) {
                a++;
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else if (c == 'b') {
            if (((a + b) < (A + B)) && b < B) {
                b++;
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 896
from math import floor
import decimal
x,k,d=map(int,input().split())
if x==0:
	if k%2==0:
		print(0)
	else:
		print(d)
	exit(0)	
with decimal.localcontext() as ctx:
    ctx.prec = 150
    t=floor(decimal.Decimal(abs(x))/decimal.Decimal(d))
    

if (k<=t):
	if (x>0):
		print(abs(x-k*d))
	else:
		print(abs(x+k*d))
else:
	if (x>0):
		x=x-t*d
		k-=t
		if k%2==0:
			print(abs(x))
		else:
			print(abs(x-d))
	else:
		x=x+t*d
		k-=t
		if k%2==0:
			print(abs(x))
		else:
			print(abs(x+d))

Measured memory_bytes: 71432
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define MX 100005
#define oo 123123123

using namespace std;

struct NODE
{
	int l, r;
	NODE () {l = -oo, r = +oo;}
	NODE (int l0, int r0) : l(l0), r(r0) {}
	NODE operator + (const NODE& t)
	{
		if(l <= -oo) return t;
		else if(t.l <= -oo) return *this;
		else if((l&1) != (t.l&1)) return NODE(1, 0);
		else return NODE(max(l, t.l), min(r, t.r));
	}
	NODE expand()
	{
		return NODE(l-1, r+1);
	}
} ;

int n, m;
int fst[MX], nxt[MX*2], v[MX*2], lnum;
NODE rag[MX];

void addeg(int nu, int nv)
{
	nxt[++lnum] = fst[nu];
	fst[nu] = lnum;
	v[lnum] = nv;
}

void updfs(int x, int f)
{
	for(int i=fst[x]; i; i=nxt[i])
		if(v[i] != f)
		{
			updfs(v[i], x);
			rag[x] = rag[x] + rag[v[i]].expand();
		}
}

void downdfs(int x, int f)
{
	rag[x] = rag[x] + rag[f].expand();
	for(int i=fst[x]; i; i=nxt[i])
		if(v[i] != f)
			downdfs(v[i], x);
}

int main()
{
	int a, b;
	scanf("%d", &n);
	for(int i=1; i<n; i++)
	{
		scanf("%d%d", &a, &b);
		addeg(a, b);
		addeg(b, a);
	}
	scanf("%d", &m);
	for(int i=1; i<=m; i++)
	{
		scanf("%d%d", &a, &b);
		rag[a] = NODE(b, b);
	}
	updfs(1, 0);
	bool flg = 1;
	for(int i=1; i<=n; i++)
		if(rag[i].l > rag[i].r)
			flg = 0;
	if(!flg) printf("No\n");
	else
	{
		printf("Yes\n");
		rag[1].r = rag[1].l;
		downdfs(1, 0);
		for(int i=1; i<=n; i++) printf("%d\n", rag[i].l);
	}
	return 0;
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define inf (int)(3e18)

template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}

int H,W,K;
char c[10][1000];

signed main() {
	cin>>H>>W>>K;
	rep(i,H)rep(j,W)cin>>c[i][j];
	int ans=inf;
	rep(i,1<<(H-1)){
		int cnt=__builtin_popcount(i);
		int sum[10];memset(sum,0,sizeof(sum));
		rep(j,W){
			int now=0;
			bool flag=false;
			rep(k,H){
				if(c[k][j]=='1'){
					sum[now]++;if(sum[now]>K)flag=true;
				}
				if(i>>k&1)now++;
			}
			if(flag){
				cnt++;
				memset(sum,0,sizeof(sum));
				int now=0;
				rep(k,H){
					if(c[k][j]=='1'){
						sum[now]++;
						if(sum[now]>K)goto ng;
					}
					if(i>>k&1)now++;
				}
			}
		}
		chmin(ans,cnt);
		ng:;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

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

        String s = scan.next();

        String[] str = new String[7];
        str[0] = "SAT"; 
        str[1] = "FRI";
        str[2] = "THU";
        str[3] = "WED";
        str[4] = "TUE";
        str[5] = "MON";
        str[6] = "SUN";

        for(int i = 1; i <= 7; i++){
            if(s.equals(str[i - 1])){
                System.out.println(i + " ");
                break;
            }
        }
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define FOR(i,a,b) for (register ll i=(a);i<=(b);i++)
#define For(i,a,b) for (register ll i=(a);i>=(b);i--)
#define mem(i,j) memset(i,j,sizeof(i))
#define GO(u) for (register ll j=f[u];j!=-1;j=nxt[j])
using namespace std;
typedef long long ll;
const ll N=2e5+5;
ll n,a[N],b[N],tmp,Ans=0;
ll read()
{
	ll x=0,f=1;
	char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') {x=(x<<1)+(x<<3)+c-'0';c=getchar();}
	return f*x;
}
int main()
{
	n=read();
	FOR(i,1,n+1) a[i]=read();
	FOR(i,1,n) b[i]=read();
	FOR(i,1,n)
	{
		if (a[i]&&b[i])
		{
			tmp=min(a[i],b[i]);
			a[i]-=tmp;
			b[i]-=tmp;
			Ans+=tmp;
		}
		if (a[i+1]&&b[i])
		{
			tmp=min(b[i],a[i+1]);
			a[i+1]-=tmp;
			b[i]-=tmp;
			Ans+=tmp;
		}
	}
	printf("%lld\n",Ans);
	return 0;
}

Measured memory_bytes: 1792
def solve(H,W):
    p1 = [H//3*W, (H-H//3)*(W//2), (H-H//3)*(W-W//2)]
    p2 = [ceil(H/3)*W, (H-ceil(H/3))*(W//2), (H-ceil(H/3))*(W-W//2)]
    S1 = max(p1)-min(p1)
    S2 = max(p2)-min(p2)
    S3 = 0 if H%3==0 else W
    return min(S1,S2,S3)

from math import ceil
H, W = map(int, input().split())
print(min(solve(H,W), solve(W,H)))

Measured memory_bytes: 62212
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll N, A;
double sum = 0;

int main() {
	cout << fixed << setprecision(10);
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A;
		sum += (double)1 / A;
	}
	cout << (double)1 / sum << endl;
	return 0;
}

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

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

    int n,m;
    cin >> n >> m;
    vector<vector<int>> v(m);
    int k[m];
    
    rep(i,m){
        cin >> k[i];
        rep(j,k[i]){
            int a;
            cin >> a;
            v[i].push_back(a);
        }
    }
    
    int p[m];
    rep(i,m) cin >> p[i];
    
    int all = 1;
    rep(i,n) all *= 2;
    
    int ans = 0;
    
    rep(i,all){
        bitset<10> b(i);
        
        bool flag = true;
        
        rep(j,m){
            int sum = 0;
            rep(kk,k[j]){
                sum += b[v[j][kk] - 1];
            }
            if(sum % 2 == p[j] && flag){
                flag = true;
            }else{
                flag = false;
            }
        }
        
        if(flag){
            ans++;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c;
	while(~scanf("%d%d%d",&a,&b,&c))
	{
		int t;
		if(a<b) {
			t = a;
			a = b;b = t;
		}
		if(a < c)
		{
			t = a;a = c;c = t;
		 } 
		if(a == b+c) printf("Yes\n");
		else printf("No\n");
	}
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	ull cnt[5];
	for(int i=0; i<5; i++) cnt[i]=0;
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		string s;
		cin >> s;
		if(s[0]=='M') cnt[0]++;
		else if(s[0]=='A') cnt[1]++;
		else if(s[0]=='R') cnt[2]++;
		else if(s[0]=='C') cnt[3]++;
		else if(s[0]=='H') cnt[4]++;
		else ;
	}
	ull ans=0;
	for(int i=0; i<3; i++){
		for(int j=i+1; j<4; j++){
			for(int k=j+1; k<5; k++){
				ans+=cnt[i]*cnt[j]*cnt[k];
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if ( a + b > c + d) {
    cout << "Left" << endl;
  }
  
  else if ( a + b < c + d) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

#define INF 1e9
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (n); i++)
#define each(x, v) for (auto& x: (v))
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl

void solve();
void in(){} template<class T, class... U> void in(T &t, U &...u){ cin >> t; in(u...); }
int main() { cin.tie(0); ios::sync_with_stdio(0); solve(); }

void solve() {
  int N;
  cin >> N;
  map<string, int> mp;
  int mx = 0;
  rep(i, N) {
    string s;
    cin >> s;
    mp[s]++;
    mx = max(mx, mp[s]);
  }

  each(x, mp) {
    if (x.second == mx) {
      print(x.first);
    }
  }
}


Measured memory_bytes: 23808
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
   char a[255], b[255] , u[255];
   int x , y;
   cin>>a >> b;
   
   cin>>x>>y;
   cin>>u;
   if( strcmp(a,u) == 0)
      cout<<x-1<<" "<<y;
      else if(strcmp(b,u) == 0) cout<<x<<" "<<y-1;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  string S, A;
  cin >> S >> A;
  if(S.at(0) == A.at(2) && S.at(1) == A.at(1) && S.at(2) == A.at(0))cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
import * as fs from 'fs'
import {debug} from '../../util'

const output = (x: any) => console.log(x)

const input = fs.readFileSync('/dev/stdin', 'utf8').split('\n')
const [N, M] = input[0].split(' ').map(n => parseInt(n, 10))
const A = input[1].split(' ').map(n => parseInt(n, 10))
// debug(input)
// debug(N)
// debug(M)
// debug(A)
// const A = fs.readFileSync('/dev/stdin', 'utf8').split(' ').map(n => parseInt(n, 10))
//
// const N = +input[0]
// const M = +input[1]
//
//
//
const sum = A.reduce((previousValue, currentValue) => previousValue + currentValue, 0)
// debug(sum)
//
N - sum >= 0 ? output(N - sum) : output(-1)

Measured memory_bytes: 30572
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        
        PriorityQueue<Integer> a = new PriorityQueue<>();
        for(int i = 0; i < n; i++){
            a.offer(Integer.parseInt(sc.next()));
        }
        
        List<BC> list = new ArrayList<>();
        for(int i = 0; i < m; i++){
            list.add(new BC(Integer.parseInt(sc.next()), Integer.parseInt(sc.next())));
        }
        Collections.sort(list);
        
        int count = 0;
        int b, c;
        for(int i = 0; i < m; i++){
            b = list.get(i).b;
            c = list.get(i).c;
            for(int j = 0; j < b; j++){
                if(a.peek() >= c){
                    break;
                }
                a.poll();
                a.offer(c);
                count++;
                if(count >= n){
                    break;
                }
            }
            if(c <= a.peek() || count >= n){
                break;
            }
        }
        
        long ans = 0;
        for(int i = 0; i < n; i++){
            ans += a.poll();
        }
        System.out.println(ans);
    }
}

class BC implements Comparable<BC>{
    int b;
    int c;
    
    BC(int b, int c){
        this.b = b;
        this.c = c;
    }

    @Override
    public int compareTo(BC bc) {
        
        if(this.c > bc.c){
            return -1;
        }else if(this.c < bc.c){
            return 1;
        }else{
            return 0;
        }
    }
}

Measured memory_bytes: 68440
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int mod=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(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); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k])%mod;
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}


int main() {
	int n;
	cin>>n;
	while(n>0){
		if(n%10==7){
			print("Yes");
			return 0;
		}
		else n/=10;
	}
	print("No");
	return 0;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int X = sc.nextInt();
    int[] m = new int[N];

    for (int i = 0; i < N; i++) {
      m[i] = sc.nextInt();
    }
    Arrays.sort(m);
    int sum = (int) Arrays.stream(m).sum();
    int ans = m.length + (X - sum) / m[0];

    System.out.println(ans);
  }
}


Measured memory_bytes: 30412