akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

long long int W, H;

int main() {
    cin >> W >> H;
    
    long long int x, y;
    cin >> x >> y;
    
    if(x*2==W || y*2==H) {
        if(x*2==W && y*2==H) {
            cout << (long double)W*H/2 << " " << 1 << endl;
        } else {
            cout << (long double)W*H/2 << " " << 0 << endl;
        }
    } else {
        cout << (long double)W*H/2 << " " << 0 << endl;
    }

    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll  long long int
#define loop(i,a,b) for(i=a;i<b;i++)
#define mod 100000007
#define INF 1000000000000
#define pb push_back
#define lim 500001
using namespace std;

char opposite(char x)
{
	if(x=='0')
		return '1';
	else
		return '0';
}

ll power(ll x,ll y)
{
	ll res=1;

	while(y){
		if(y%2)
			res=(res*x)%mod;
		x=(x*x)%mod;
	}

	return res;
}
int main()
{
	ll i,j,k,n,m,x,ans=INF;

	cin>>n>>m>>x;

	ll lev[n+1][m+1],cost[n+1];

	loop(i,0,n)
	{
		cin>>cost[i];

		loop(j,0,m) cin>>lev[i][j];
	}

	ll last=(1<<n);

	loop(i,0,last)
	{ll tot=0;
		vector<ll> temp(m,0);
		loop(j,0,n)
		{
			if((i>>j)&1)
			{
				tot+=cost[j];

				loop(k,0,m)
				temp[k]+=lev[j][k];
			}
		}

		loop(j,0,m)
		if(temp[j]<x)
			break;

		if(j==m){
		    ans=min(ans,tot);
		}}

		if(ans==INF) ans=-1;

		cout<<ans<<endl;
		return 0;
	}


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

int main(){
    long N;
    cin >> N;
    vector<LL> a,b,c;
    LL bm[N],bt[N];
    for(int i=0;i<N;i++){
        bm[i]=0;
        bt[i]=0;
    }
    for(int i=0;i<N;i++){
        LL s;
        cin >> s;
        a.push_back(s);
    }
    for(int i=0;i<N;i++){
        LL s;
        cin >> s;
        b.push_back(s);
    }
    for(int i=0;i<N;i++){
        LL s;
        cin >> s;
        c.push_back(s);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    LL count=0;
    LL it,it1;
    auto bitr=lower_bound(b.begin(),b.end(),a[0]+1);
    for(it1=bitr-b.begin();bitr!=b.end();bitr++){
        auto citr=lower_bound(c.begin(),c.end(),*bitr+1);
        count+=c.end()-citr;
        it=bitr-b.begin();
        bm[it]=count;
    }
    for(int i=it1;i<N;i++){
            if(i==0) bt[i]=count;
            else bt[i]=count-bm[i-1];
    }
    for(int i=1;i<N;i++){
        auto bitr=lower_bound(b.begin(),b.end(),a[i]+1);
        it=bitr-b.begin();
        if(it<N&&0<=it)count+=bt[it];
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 4852
#include <iostream>

using namespace std;

const int nmax = 8;
bool graph[nmax][nmax];

int dfs(int v, int N, bool visited[nmax])
{
    bool all_visited = true;
    for (int i = 0; i < N; i++)
    {
        if (visited[i] == false)
        {
            all_visited = false;
        }
    }
    if (all_visited)
    {
        return 1;
    }

    int ret = 0;
    for (int i = 0; i < N; i++)
    {
        if (graph[v][i] == false)
        {
            continue;
        }
        if (visited[i])
        {
            continue;
        }
        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }
    return ret;
}

int main(int argc, const char *argv[])
{
    int N, M;
    cin >> N >> M;

    for (int i = 0; i < M; i++)
    {
        int A, B;
        cin >> A >> B;
        graph[A - 1][B - 1] = graph[B - 1][A - 1] = true;
    }

    bool visited[nmax];
    for (int i = 0; i < N; i++)
    {
        visited[i] = false;
    }

    visited[0] = true;
    cout << dfs(0, N, visited) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
using namespace std;
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define rep(i,t,n) for(int i=t;i<n;i++)
#define nd "\n"
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>




/*ll power(ll x,ll t){
if(t<=0){
    return 1;
}
ll y=(power(x,t/2));
y=(y*y)%ma;
if(t%2)
    y=(y*x)%ma;
return y;

}*/
/*ll ph[100001];
void E_phi(int n){

ph[0]=0;
ph[1]=1;
for(int i=2;i<=n;i++){
    ph[i]=i;
}
for(int i=2;i<=n;i++){
    if(ph[i]==i){
        for(int j=i;j<=n;j+=){
            ph[j]-=ph[j]/i;
        }
    }
}


}*/
/*string s,t;
vector<int>  z_fun(string s){

int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}*/

/*struct st{
ll sum,pre,suf,ans;
st(){}
st(ll k){
ans=k,pre=k,suf=k,sum=0;
}

};
ll t[4*200001+4];
ll a[200001];
ll lazy[4*200001+4];
ll mx=1e14;



void push(int ind){
int l=2*ind+1,r=2*ind+2;
t[l]+=lazy[ind];
t[r]+=lazy[ind];
lazy[l]+=lazy[ind];
lazy[r]+=lazy[ind];
lazy[ind]=0;

}

void build(int ind,int l,int r){
if(l==r){
    t[ind]=a[l];
return;
}
int mid=(l+r)/2;
build(2*ind+1,l,mid);
build(2*ind+2,mid+1,r);

  t[ind] =min(t[ind*2+1] , t[ind*2+2]);



}
ll query(int ind,int l,int r,int p,int q){

if(l>q || r<p )
    return mx;
    int mid=(l+r)/2;

if(l>=p && r<=q )
    {
      return t[ind];
    }
    push(ind);
ll x=query(2*ind+1,l,mid,p,q);
ll y=query(2*ind+2,mid+1,r,p,q);


return min(x,y);
}

void update(int ind,int l,int r,int p,int q,int val){
if(l>q || r<p )
    return;

if(l>=p && r<=q )
    {
      t[ind]+=val;
      lazy[ind]+=val;
      return;
    }
push(ind);
int mid=(l+r)/2;
    update(2*ind+1,l,mid,p,q,val);
     update(2*ind+2,mid+1,r,p,q,val);
    t[ind]=min(t[2*ind+1],t[2*ind+2]);



}


ll mod(ll a){
if(a>=0)
    return a;
else return -a;
}
*/


ll ma=998244353;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  int n;
  cin>>n;
  int k;
  cin>>k;
  int l[k],r[k];
  for(int i=0;i<k;i++)
  cin>>l[i]>>r[i];
  vector<ll>dp(n+1);
  dp[1]=1;
  for(int i=2;i<=n;i++){
        ll x=0;
    for(int j=0;j<k;j++){
        if(i-l[j]<1)continue;
        int r1=i-l[j];
        int l1=max(1,i-r[j]);
        x=(x+dp[r1]-dp[l1-1]+2*ma)%ma;
    }
  dp[i]=(dp[i-1]+x)%ma;
  }
  cout<<(dp[n]-dp[n-1]+ma)%ma<<endl;

}


Measured memory_bytes: 4788
#!python3

LI = lambda: list(map(int, input().split()))

# input
A, B, C, D, E, F = LI()


def main():
    ans = (0, 0, 0)
    for b in range(F // 100 // B + 1):
        water = 100 * B * b
        for a in range((F - water) // 100 // A + 1):
            water += 100 * A * a
            if water == 0:
                continue
            # 砂糖の許容量
            s = min(F - water, water // 100 * E)
            for d in range(s // D + 1):
                sugar = d * D
                sugar += (s - sugar) // C * C
                t = (sugar / (water + sugar), water + sugar, sugar)
                if ans < t:
                    ans = t
    print(*ans[1:])


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
package main

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

/*
const (
	N = 10000
	MAX_NUMBER = 100000000
)
*/

func isPrime(n int) bool {
	limit := int(math.Sqrt(float64(n)))
	if n == 1 {
		return false
	}
	if n == 2 {
		return true
	}
	if n % 2 == 0 {
		return false
	}
	for i := 3; i <= limit; i += 2 {
		if n % i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	var count int
	for i := 0; i < n; i++ {
		x, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		if isPrime(x) {
			count++
		}
	}
	fmt.Println(count)
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}


Measured memory_bytes: 1140
#include<stdio.h>
int main()
{
  int a[1000], n, i, j, k, v;
  scanf("%d", &n);
  for(k = 0; k < n; k++)
    {
      scanf("%d",&a[k]);
    }
  for(k = 0; k < n-1; k++)
    {
      printf("%d ",a[k]);
    }
  printf("%d", a[n-1]);
  printf("\n");
  for(i = 1; i < n; i++)
    {
      v = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > v)
	{
	  a[j+1] = a[j];
	  j--;
	  a[j+1] = v;
	}
      for(k = 0; k < n-1; k++)
	{
	  printf("%d ",a[k]);
	}
      printf("%d", a[n-1]);
      printf("\n");
    }
  return 0;
}



Measured memory_bytes: 2124
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int inf = 1e9 + 7;
const ll mod = 1e9 + 7;

int main() {
	ll n;
	cin >> n;
	
	cout << n*(n-1)/2 << endl;
	return 0;
}

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

#define VMAX    10000

int calc_max(const int *A, const int n)
{
    int max = A[0];
    for (int i = 1; i < n; i++) {
        if (A[i] > max) max = A[i];
    }
    return max;
}

void counting_sort(int *A, int *B, const int n)
{
    int *C = new int[VMAX];
    for (int i = 1; i <= VMAX; i++) {
        C[i] = 0;
    }

    for (int j = 0; j < n; j++) {
        C[A[j+1]]++;
    }

    for (int i = 1; i <= VMAX; i++) {
        C[i] = C[i] + C[i-1];
    }

    for (int j = 1; j <= n; j++) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }

    return;
}


int main (void) {

    int n;

    scanf("%d", &n);
    int* A = new int[n+1];
    int* B = new int[n+1];

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

    counting_sort(A, B, n);

    for (int i = 1; i <= n; i++) {
        printf("%d", B[i]);
        if (i == n) printf("\n");
        else printf(" ");
    }
}



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

using namespace std;

//typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

int N;
double p[3000];
double dp[3000][3000];

signed main(){

	cin >> N;
	for (int i = 0; i < N; i++) cin >> p[i];

	// x枚目まででy枚表
	dp[0][0] = 1-p[0];
	dp[0][1] = p[0];

	for (int i = 1; i < N; i++){
		for (int h = 0; h <= i+1; h++){
			if (h>0)
				dp[i][h] = dp[i - 1][h] * (1 - p[i]) + dp[i - 1][h-1] * p[i];
			else
				dp[i][h] = dp[i - 1][h] * (1 - p[i]);
		}
	}

	double ans = 0.0;
	for (int h = (N + 1) / 2; h <= N; h++)
		ans += dp[N-1][h];
	cout << std::setprecision(15) << ans << endl;
	return 0;
}


Measured memory_bytes: 68864
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y,sx,sy,cost;
};
ll dp[10001];
int a[1001],b[1001];
int main() {

	int h,n;
	cin>>h>>n;
	rep(i,n)cin>>a[i]>>b[i];
	rep(i,10001)dp[i]=INF;
	dp[0]=0;
	rep(i,n){
		for(int j=0; j<h; j++){
			dp[min(j+a[i],h)]=min(dp[min(j+a[i],h)],dp[j]+b[i]);
		}
	}
	cout<<dp[h]<<endl;
	return 0;
}


Measured memory_bytes: 384
# importing the sys module 
import sys 
  
# the setrecursionlimit function is 
# used to modify the default recursion 
# limit set by python. Using this,  
# we can increase the recursion limit 
# to satisfy our needs 
  
sys.setrecursionlimit(10**6) 
n = int(input())
h = [int(x) for x in input().split()]
memo = [-1]*n

def dp(i):
    if i == 0:
        return 0
    if i < 0:
        return 10**10
    if memo[i] != -1:
        return memo[i]
    if i == 1:
        memo[i] = abs(h[i] - h[i-1])
        return memo[i]
    memo[i] = min(dp(i-1)+abs(h[i]-h[i-1]), dp(i-2)+abs(h[i]-h[i-2]))
    return memo[i]

print(dp(n-1))

Measured memory_bytes: 100940
const main = lines => {
  console.log(solve(lines));
};

const solve = (lines: string[]): string => {
  const [N] = parseLines(lines);

  return ((+N) ** 3).toString();
};

const parseLines = (lines: string[]) => {
  const obj = lines;
  debug(obj);
  return obj;
};

const debug = (message?: any, ...optionalParams: any[]) => {
  if (!!process.env.LOCAL_DEBUG) console.log(message, ...optionalParams);
};

if (!process.env.LOCAL_DEBUG) {
  const { stdin: input, stdout: output } = process;
  input.resume();
  input.setEncoding('utf8');
  const lines = [];
  require('readline')
    .createInterface({ input, output })
    .on('line', line => lines.push(line))
    .on('close', () => main(lines));
}

export default solve;


Measured memory_bytes: 7500
#include <stdio.h>
int main(void){
  int member[50];
  int m,f,r;
  int count = 0;

  for(int i = 0; i < 50; i++){
    scanf("%d %d %d\n",&m,&f,&r);
    if(m == -1 && f == -1 && r == -1){
      break;
    }

      if(m >= 0 && f >= 0 && m + f >= 80){
        member[i] = 0;
      }else if(m >= 0 && f >= 0 && m + f < 80 && m + f >= 65){
        member[i] = 1;
      }else if(m >= 0 && f >= 0 && m + f < 65 && m + f >= 50){
        member[i] = 2;
      }else if(m >= 0 && f >= 0 && m + f < 50 && m + f >= 30){
        if(r >= 50){
          member[i] =2;
        }else{
          member[i] = 3;
        }
      }else if(m == -1 || f == -1 || m + f < 30){
        member[i] = 4;
      }
      count++;
    }

    for(int i = 0; i < count; i++){
      if(member[i] == 0){
        printf("A\n");
      }else if(member[i] == 1){
        printf("B\n");
      }else if(member[i] == 2){
        printf("C\n");
      }else if(member[i] == 3){
        printf("D\n");
      }else{
        printf("F\n");
      }
    }

    return 0;
  }


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


int main(){
	string S;
	cin >> S;
	int N = S.size();
	int ans = 0;
	rep(i,N){
		string t;
		rep(j,N){
			t = S.substr(i,N-j-i);
			int tmp = 0;
			rep(k,N-j-i){

				if(t[k] != 'A'&&t[k] != 'T'&&t[k] != 'C'&&t[k] != 'G')break;
				tmp++;
			}
			ans = max(ans, tmp);
		}
	}
	cout << ans << endl;	
}













Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
ll a[500005];
ll dp[500006];
int main()
{
    ll n,i,j,k,l,m;
    scanf("%lld",&n);
    for(i=1;i<=n;i++){
    	scanf("%lld",&a[i]);
	}
	for(i=2;i<=n;i++){
		if(i==2){
			dp[i]=abs(a[i]-a[i-1]);
		}
		else{
			dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
		}
	}
	cout<<dp[n];
    return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    string s; cin >> s;
    int r = 0, g = 0;
    REP(i, N){
        if(s[i] == 'R') r++;
        else g++;
    }
    Ans(r > g, "Yes", "No");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

signed main() {
    int n;
    cin >> n;
    int a[n];
    rep(i, 0, n) cin >> a[i];
    bool p = 1, s = 1;

    map<int, int> mp;
    rep(i, 0, n) {
        int q = a[i];
        for (int j = 2; j * j <= q; j++) {
            if (q % j == 0) {
                mp[j]++;
                if (mp[j] > 1) {
                    p = 0;
                    break;
                }
                while (q % j == 0) {
                    q /= j;
                }
            }
        }
        mp[q]++;
        if (q != 1 && mp[q] > 1) p = 0;
        if (!p) break;
    }
    if (p) {
        for (auto m : mp) {
            if (m.first != 1 && m.second > 1) p = 0;
        }
    }

    int now = a[0];
    rep(i, 0, n) { now = gcd(now, a[i]); }
    if (now != 1) s = 0;

    if (p) {
        cout << "pairwise coprime\n";
    } else if (s) {
        cout << "setwise coprime\n";
    } else {
        cout << "not coprime\n";
    }
}

Measured memory_bytes: 11408
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



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

    int n;
    cin>>n;
    double ans=0;
    vi v(n);
    rep(i,n)cin>>v[i];
    Sort(v);
    ans=v[0];
    for(int i=1;i<n;i++){
        ans=(ans+v[i])/2;
    }
    printf("%7f\n",ans);

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))

def solve():
    return


def main():
    n = getN()
    for i in range(1, 10):
        for j in range(1, 10):
            if i * j == n:
                print("Yes")
                return
    print("No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 38384
import sys
def input(): return sys.stdin.readline().rstrip()

R, C, k = (int(x) for x in input().split())
V = [[0] * (C + 5) for _ in range(R + 5)]
for _ in range(k):
    r, c, v = (int(x) for x in input().split())
    V[r][c] = v

# dp[3][i][j]
dp = [[[0] * (C + 5) for _ in range(R + 5)] for _ in range(4)]
for i in range(R + 3):
    for j in range(C + 3):
        for k in range(4):
            # 行移動
            dp[0][i + 1][j] = max(dp[0][i + 1][j], dp[k][i][j])
            dp[1][i + 1][j] = max(dp[1][i + 1][j], dp[k][i][j] + V[i + 1][j])
            # 列移動
            dp[k][i][j + 1] = max(dp[k][i][j + 1], dp[k][i][j])
            if k < 3:
                dp[k + 1][i][j + 1] = max(dp[k + 1][i][j + 1], dp[k][i][j] + V[i][j + 1])
print(max(dp[k][R][C] for k in range(4)))


Measured memory_bytes: 429860
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		// スペース区切りの整数の入力
		int y = sc.nextInt();

		int[] a = new int[n];
		for( int i=0 ; i<y ; i++ ) {
			a[i] = sc.nextInt();
		}
		Calc res = new Calc(n,y, a);
		System.out.println( res.toString() );
	}
	public static class Calc {
		int K;
		int N;
		
		int[] A;
		
		int start;
		int end;
		
		int dist;
		public Calc(int k, int n, int[] a) {
			K = k;
			N = n;
			A = a;
			
			int dist = K - a[n-1] + a[0];
			start = 0;
			for( int i=0 ; i<n-1 ; i++ ) {
				if( dist < a[i+1] - a[i] ) {
					start = i+1;
					dist = a[i+1] - a[i];
				}
			}
//			
//			dist = (K + a[start -1] - a[start]) % K;
			
			this.dist = K - dist;
		}



		@Override
		public String toString() {
			return ""+ dist;
		}
		
		

	}
	
}

Measured memory_bytes: 88352
/**
 *      ABC 99 B
 *      author  : kyomukyomupurin
 *      created : 2018/08/22
**/

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    int diff = b - a;
    int sum = 0;
    for (int i = 0; i < diff; ++i) {
        sum += i;
    }
    cout << sum - a << endl;

    return 0;
    
}


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

int main(){
	int num;
	int score[105];
	int max = 0;
	int min = 10000;
	int sum=0;


	while(1){
		max = 0; min = 10000; sum = 0;
		for(int i=0; i < 100; i++){score[i] = 0;}

		cin >> num;

		if(num == 0) break;

		for(int i=0; i < num; i++){
			cin >> score[i];
			if(max <= score[i]) max = score[i];
			if(score[i] <= min) min = score[i];
			sum += score[i];
		}

		sum -= max; sum -= min;

		cout << sum/(num-2) << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
n=int(input())
h=list(map(int,input().split()))

cost=[]

cost.append(0)
cost.append(abs(h[1]-h[0]))


for i in range(2,n):
    step= min( cost[i-2]+abs(h[i]-h[i-2]),cost[i-1]+abs(h[i]-h[i-1]))

    cost.append(step)


print(cost[n-1])


Measured memory_bytes: 13980
import sys
p,t,q='+X='
for e in sys.stdin:
 for i in'0123456789'[(e[0]==t)*(e[1]!=p)or(p+t in e)*('+X='not in e):]:
  l,r=e.replace(t,i).split(q)
  if sum(map(int,l.split(p)))==int(r):print(i);break
 else:print('NA')


Measured memory_bytes: 5616
import java.util.Scanner;

//Greatest Common Divisor
public class Main{

	public static long gcd(long a, long b){
		if(a < b){
			long tmp = a;
			a = b;
			b = tmp;
		}
		while(b!=0){
			long r = a%b;
			a = b;
			b = r;
		}
		return a;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext())
			System.out.println(gcd(sc.nextLong(), sc.nextLong()));
	}
}

Measured memory_bytes: 12000
n, k = gets.chomp.split.map(&:to_i)
h_list=[]
n.times do
    h_list.push(gets.chomp.to_i)
end
h_sorted = h_list.sort!
ans = h_sorted[-1] - h_sorted[0]
0.upto(n-k) do |i|
    diff = h_sorted[i+k-1] - h_sorted[i]
    ans = diff if diff < ans
end

puts ans

Measured memory_bytes: 3576
N = int(input())
sort_a_list = sorted(list(map(int, input().split())))

sort_dict = {}
for i in sort_a_list:
    if i not in sort_dict.keys():
        sort_dict[i] = [i]
    else:
        sort_dict[i].append(i)
        
remove_counter = 0
for key, value in sort_dict.items():
    if len(value) < key:
        remove_counter += len(value)
    elif len(value) == key:
        pass
    else:
        remove_counter +=(len(value) - key)
        
print(remove_counter)

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

int N, K;
vector<int> a, dp;

int rec(int k) {
	if (dp[k] != -1) {
		return dp[k];
	}
	dp[k] = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] > k) {
			break;
		}
		int f = (rec(k - a[i]) == 0)? 1 : 0;
		dp[k] |= f;
	}
	return dp[k];
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> N >> K;
	a.resize(N);
	dp.resize(K + 1, -1);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int ans = rec(K);
	(ans == 1)? cout << "First" : cout << "Second";
	
	return 0;
}


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

#pragma warning(disable:4996)

int min(int a, int b) {
	if (a < b) return a;
	return b;
}

int main(void) {
	char s[4 + 1];
	scanf("%s", &s[0]);
	int n[4];
	for (int i = 0; i < 4; ++i) {
		n[i] = s[i] - '0';
	}
	int i0 = n[0] * 10 + n[1];
	int i1 = n[2] * 10 + n[3];
	if ((i0 >= 1) && (i0 <= 12)) {
		if ((i1 >= 1) && (i1 <= 12)) {
			printf("AMBIGUOUS");
			return 0;
		}
		else {
			printf("MMYY");
			return 0;
		}
	} else if ((i1 >= 1) && (i1 <= 12)) {
		printf("YYMM");
		return 0;
	}
	else {
		printf("NA");
		return 0;
	}
	return 0;
}

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

int main() {
  int N; cin >> N;  // 個数：レストラン
  vector<tuple<string,int,int>> A(N);  // 情報配列
  int wk_int = 0; // 点数（×－１して保管する）

  // 初期タプルの作成：第１項には、ソート用に点数を文字化して入れる。
  rep(i,N){
    cin >> get<0>(A.at(i)) >> wk_int ;
    get<1>(A.at(i)) = wk_int * -1;     // 点数は×－１して昇順に並べる。
    get<2>(A.at(i)) = i+1;
  }
  // 名前の順にソート
  sort(A.begin(),A.end());

  // 結果出力
  rep(i,N){
    // cout << get<0>(A.at(i)) << " " << get<1>(A.at(i)) << " " << get<2>(A.at(i)) << endl;
    cout << get<2>(A.at(i)) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define eb emplace_back
#define mp make_pair
using namespace std;
const int MAX_N=1e6+10;
const int mod=1e9+7;
ll fac[MAX_N],inv[MAX_N];
int n,m,l,r;
ll power(ll x,ll y,ll mod=mod){
    ll res=1;
    while(y){
        if(y&1)
            (res*=x)%=mod;
        y>>=1,(x*=x)%=mod;
    }
    return res%mod;
}
void getFac(){
    fac[0]=1LL;
    for(ll i=1;i<MAX_N;i++){
        fac[i]=fac[i-1]*i%mod;
    }
}
void getFacInv(){
    inv[MAX_N-1]=power(fac[MAX_N-1],mod-2);
    for(ll i=MAX_N-2;i>=0;i--){
        inv[i]=inv[i+1]*(i+1)%mod;
    }
}
void init(){
    getFac();
    getFacInv();
}
ll getBinomial(int n,int m){
    if(m>n||m<0) return 0;
    return fac[n]*inv[n-m]%mod*inv[m]%mod;
}
//A[m+1]...A[n]<y
ll solve3(int y,int r){
    ll res=0,coef=1;
    // use the inclusion-exclusion principle to calc
    for(int i=0;i*y<=r&&i<=n-m;i++){
        (res+=coef*getBinomial(n-m,i)%mod*getBinomial(r-i*y+n,n))%=mod;
        coef*=-1;
    }
    return res;
}
//A1,A2...Am>=x A[m+1]...A[n]<y(it opposite to A[m]!=A[m+1])
ll solve2(int y,int r){
    return solve3(y,r)*getBinomial(n,m)%mod;
}
ll solve(int r){
    // A1+A2+..+An<=r without A[m]==A[m+1]
    ll res=getBinomial(n+r,r);
    for(int i=1;i*m<=r;i++){
        (res-=solve2(i,r-i*m)-solve2(i,r-(i+1)*m))%=mod;
        (res+=mod)%=mod;
    }
    return res;
}
int main(){
    init();
    cin>>n>>m>>l>>r;
    cout<<(solve(r)-solve(l-1)+mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 16000
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int asci[128] = {0};
    cin >> s;
    for(int i = 0; s[i]; i++)
    {
        asci[s[i]] ++;
    }
    if(asci[97] == 1 && asci[98] == 1 && asci[99] == 1)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
import Control.Monad

main :: IO ()
main = do
  q <- readLn
  ls <- replicateM q getLine
  let ls' = map (map read . words) ls
  mapM_ print $ solve ls'

solve :: [[Int]] -> [Int]
solve = map count
  where
    count :: [Int] -> Int
    count [c,a,n]
      | all (1 <= ) [c,a,n] = 1 + (count [c-1,a-1,n-1])
      | c >= 2 && a >= 1 = 1 + (count [c-2,a-1,n])
      | c >= 3 = 1 + (count [c-3,a,n])
      | otherwise = 0
      

Measured memory_bytes: 4204
#include <iostream>

using namespace std;
 
int main(){
    char c;
    int b,ans;
     
    cin >> ans;
    while(1){
        cin >> c;
         
        if(c == '=') break;
        cin >> b;
        switch(c){
	case '+':
	    ans += b;
	    break;
                 
	case '-':
	    ans -= b;
	    break;
                 
	case '*':
	    ans *= b;
	    break;
                 
	case '/':
	    ans /= b;
	    break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3092
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <stdio.h>
#include <stdlib.h>
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define abs(a) ((a) > 0 ? (a) : (-1 * (a)))
#define rep(i, n) for ((i) = 0; (i) < (n); (i)++)
#define rep2(i, s, e) for ((i) = (s); (i) < (e); (i)++)

void marge(int *, int);

int a[200010], p[200010], m[200010];
int main(void)
{

    int i, j, n, pi = 1, mp = 0, mi = 0, p1;
    long long total = 0;
    scanf("%d", &n);
    rep(i, n)
    {
        scanf("%d", a + i);
        p[i] = i + a[i];
        m[i] = i - a[i];
    }
    marge(p, n);
    marge(m, n);
    p[n] = p[n - 1] + 1;
    rep2(i, 1, n + 1)
    {
        p1 = p[i - 1];
        if (p[i] < m[mp])
            continue;
        while (p1 > m[mp] && mp < n)
            mp++;
        if (p[i] == p[i - 1])
        {
            pi++;
            continue;
        }
        while (p1 == m[mp] && mp < n)
        {
            total += pi;
            mp++;
        }
        pi = 1;
    }

    printf("%lld", total);
    return 0;
}

void marge(int *a, int n)
{

    if (n == 1)
        return;

    int *tmp;
    tmp = (int *)malloc((n) * sizeof(int));
    marge(a, n / 2);
    marge(a + n / 2, n - n / 2);

    for (int i = 0; i < n / 2; i++)
        tmp[i] = a[i];
    for (int i = n / 2; i < n; i++)
        tmp[i] = a[n / 2 + n - i - 1];

    int lp = 0, rp = n - 1, p = 0;
    int l3, r3;
    while (p < n)
    {
        l3 = tmp[lp];
        r3 = tmp[rp];
        if (l3 < r3)
        {
            a[p] = l3;
            lp++;
            p++;
        }
        else
        {
            a[p] = r3;
            rp--;
            p++;
        }
    }

    return;
}

Measured memory_bytes: 39000
N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
R = []
M = 1000000007


def main():
    global R
    global A
    p = -1
    for t in T:
        if t > p: # new
            R.append(t)
            p = t
        else:
            R.append(-t)

    # reverse direction
    R = list(reversed(R))
    A = list(reversed(A))

    p = -1
    for i, t in enumerate(A):
        r = R[i]
        if r < 0:
            max_h = -r
            if t > p: # new
                p = t
                if t <= max_h:
                    R[i] = t
                else:
                    return 0
            else:
                R[i] = -min(max_h, t)
        else:
            if t > p: # new
                p = t
                if t != r:
                    return 0
            else:
                if r > t:
                    return 0

    answer = 1
    for r in R:
        if r > 0:
            answer *= 1
        else:
            max_h = -r
            answer *= max_h
            answer %= M
    return answer
print(main())


Measured memory_bytes: 19012
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include <limits>
#include <numeric>
#include <type_traits>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)*/

//ここから書き始める
//実験

int main(){
	ll w, h, x, y;
	cin >> w >> h >> x >> y;
	//正確にxがwの半分 y がhの半分なら複数ある。
	int way = 0;
	//wとhの半分を正確にとる それって、w/xが2.0になっればいいんじゃね？

	if(x!=0&&y!=0){
		if((w/x)==2&&w%x==0&&(h/y)==2&&h%y==0){
			way = 1;
		}
	}
	cout << 1. *(w * h) / 2. <<" "<< way<<endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int sum = 0;

		for (int i=0; i<n.length();i++) {
			char c = n.charAt(i);
			switch (c) {
			case '+':
				sum += 1;
				break;
			case '-':
				sum -= 1;

			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 22100
#include<iostream>
using namespace std;
int main(){
    string S;
    cin >> S;
    if(S[0] == S[1] && S[1] == S[2]){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
    
    
    
    
    
    
    
    
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long int n,ans=1,mod=1e9+7;
    cin>>n;
    int a[n+1];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(int j=0;j<n;j++){
        if(n%2==0){
            if(a[j]%2!=1){
                ans=0;
                break;
            }
            else{
            if(j%2==0){
                if(a[j]!=j+1){
                    ans=0;
                    break;
                }
            }
            else{
                if(a[j]!=j){
                    ans=0;
                    break;
                }
            }
            }
        }
        else{
            if(a[j]%2!=0){
                ans=0;
                break;
            }
            else{
            if(j%2==0){
                if(a[j]!=j){
                    ans=0;
                    break;
                }
            }
            else{
                if(a[j]!=j+1){
                    ans=0;
                    break;
                }
            }
            }
        }
    }
    if(ans!=0){
        if(n%2==0){
            for(int l=0;l<(n/2);l++){
                ans*=2;
                if(ans>mod){
                    ans%=mod;
                }
            }
        }
        else{
            for(int k=0;k<(n/2);k++){
                ans*=2;
                if(ans>mod){
                    ans%=mod;
                }
            }
        }
    }
    
    cout<<ans;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include<queue>

using namespace std;
typedef pair<int,int> P;
typedef pair<P, int> PP;

const int INF=10000000;
int hosu[101][2];
int kab[101][2];
int n;
int ans=INF;

void jump(){
	queue<PP> que;
	for(int i=0;i<=100;i++){
		for(int j=0;j<=1;j++){
			hosu[i][j]=INF;
		}
	}
	hosu[0][0]=0;
	hosu[0][1]=0;
	que.push(PP(P(0,0),0));
	que.push(PP(P(0,1),0));
	while(que.size()){
		PP p=que.front();que.pop();
		int y=p.first.first,x=p.first.second,c=p.second;
		if(y>=n)continue;
		else if(kab[y][x]==1 && kab[y+1][x]==1)que.push(PP(P(y+1,x),c));
		else if(kab[y][x]==2)que.push(PP(P(y-1,x),c));
		else if(y==n-1)ans=min(ans,c);
		else{
			for(int i=0;i<=2;i++){
				if(x==0)if(hosu[y+i][1]>c)hosu[y+i][1]=c,que.push(PP(P(y+i,1),c+1));
				if(x==1)if(hosu[y+i][0]>c)hosu[y+i][0]=c,que.push(PP(P(y+i,0),c+1));
			}
		}
	}
	return;
}

int main(void){
	int a,b;
	while(1){
		cin >> n;
		if(n==0)break;
		ans=INF;
		for(a=0;a<2;a++){
			for(b=0;b<=100;b++){
				kab[b][a]=0;
			}
		}
		for(a=0;a<2;a++){
			for(b=0;b<n;b++){
				cin >> kab[b][a];
			}
		}
		jump();
		if(ans==INF)cout << "NA" << endl;
		else cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    int k;
    cin >> N >> k;
    vector<int> h(N,0);
    for(int i=0;i<N;i++) cin >> h[i];
    sort(h.begin(),h.end());
    int min = 1000000000;
    for(int i=0;i<N-k+1;i++){
        if(h[k+i-1]-h[i] < min) min = h[k+i-1]-h[i];
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,ans;
ll d;
int main()
{
    scanf("%d%lld",&n,&d);
    for(int i=0;i<n;i++)
    {
        ll x,y;
        scanf("%lld%lld",&x,&y);
        if(x*x+y*y<=d*d)
        {
            ans++;
        }
    }
    printf("%d",ans);
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

    ll a,b,c;
    cin>>a>>b>>c;

    ll e = min(a,min(b,c));
    ll d = max(a,max(b,c));
    cout<<(e*(a+b+c-d-e))/2;

    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
int main(){
    int h, n;
    long long s=0, a=1;
    cin >> h >> n;
    for(int i=0; i<max(h,n); i++){
        s=s+(a*min(h,n));
        a*=10;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


X = int(read())
money =  100
flag = False
i = 0
while(not flag):
    money = money + int(money//100)
    i+=1
    if(money >= X) : flag = True

print(i)

Measured memory_bytes: 9120
#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=1e4+5;
int dp[MAXN];
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int h,n;
	scanf("%d%d",&h,&n);
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	for(int i=1;i<=n;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		for(int j=0;j<=h;j++)
		{
			int nxt=j+a;
			if(nxt>h) nxt=h+1;
			dp[nxt]=min(dp[j]+b,dp[nxt]);
		}
	}
	cout<<min(dp[h],dp[h+1])<<endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
A = tuple(map(int, input().split()))
U = 10**6
D = list(range(U+1))
i = 2
while i*i <= U:
  if D[i] != i:
    i += 1
    continue
  for j in range(i*i, U+1, i):
    D[j] = min(D[j], i)
  i += 1
C = [0]*(U+1)
is_pairwise = True
for a in A:
  while a > 1:
    d = D[a]
    while a%d == 0:
      a //= d
    if C[d]:
      is_pairwise = False
    C[d] += 1
if max(C) == n:
  print("not coprime")
else:
  if is_pairwise:
    print("pairwise coprime")
  else:
    print("setwise coprime")

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

int main(void)
{
    
    char strBallA[11];
    char strBallB[11];
    char strInputData[11];
    int intBallA;
    int intBallB;

    scanf("%s%s", strBallA, strBallB);
    scanf("%d%d", &intBallA, &intBallB);
    scanf("%s", strInputData);

    if (strcmp(strInputData, strBallA) == 0)
    {
        intBallA -= 1;
    }
    else
    {
        intBallB -= 1;
    }
    
    printf("%d %d", intBallA, intBallB);

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn = 510;
int a[maxn][maxn],dp[maxn][maxn];

int main(){
    int n,m,q;
    while(~scanf("%d%d%d",&n,&m,&q)){
        memset(a,0,sizeof(a));
        memset(dp,0,sizeof(dp));
        int l,r;
        for(int i = 0; i < m; i++){
            scanf("%d%d",&l,&r);
            a[l][r]++;
        }
        for(int i = n; i > 0; i--){
            for(int j = 1; j <= n; j++){
                dp[i][j] = a[i][j] + dp[i+1][j] + dp[i][j-1] - dp[i+1][j-1];
            }
        }
        while(q--){
            scanf("%d%d",&l,&r);
            printf("%d\n",dp[l][r]);
        }
    }
    return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int nn = n;
		int sum = 0;
		
		for(int i = 0; n >= 1; i ++) {
			sum += (n % 10);
			n = n /10;
		}
		if(nn % sum == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
 
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
 
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
 
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#define T int t = 0; cin >> t; while(t--)
#define pr(a) for(int i = 0; i < (int)a.size(); ++i)cout << a[i] << " ";cout << endl;
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef long double lld;
const ll mod = 1e9 + 7;
const ll mx = 2e5 + 1;
const ll inf = 1e9;
const int sz = 20;

void input(){
    IOS;
    ll n;
    cin >> n;
    string ans("\0");
    while(n){
        ans += (char)((n - 1) % 26LL + 'a');
        n = (n - 1) / 26LL;
    }
    reverse(b_e(ans));
    cout << ans << endl;
}
int main(){
    input();
    return 0;
} 
/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/

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

using namespace std;

int main()
{
        int x;
        int y;
        string s;
        stack<int> temp;

        while(cin >> s){
                if(s[0] == '+'){
                        x = temp.top();
                        temp.pop();
                        y = temp.top();
                        temp.pop();
                        temp.push(x+y);
                }else if(s[0] == '-'){
                        x = temp.top();
                        temp.pop();
                        y = temp.top();
                        temp.pop();
                        temp.push(y-x);
                }else if(s[0] == '*'){
                        x = temp.top();
                        temp.pop();
                        y = temp.top();
                        temp.pop();
                        temp.push(x*y);
                }else{
                        x = atoi(s.c_str());
                        temp.push(x);
                }
        }

        cout << temp.top() << endl;

        return 0;
}

Measured memory_bytes: 3188
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n,m = inpl()
if n*2 >= m:
    print(m//2)
else:
    m -= n*2
    print(n+m//4)
    

Measured memory_bytes: 3952
#include<bits/stdc++.h>
typedef long long ll;
#define X first
#define Y second
typedef double dbl;
#define forn(i,n,k) for(int i=0;i<n;i=i+k)
#define forpn(p,n,k) for(int i=p;i<n;i+=k)

using namespace std;
long long gcd(int a,int b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
int main()
{
    ll x;
    cin>>x;
    ll a,b;
    for(a=0;a<=1000;a++)
        for(b=-10000;b<=10000;b++)
        {
            if(x==pow(a,5)-pow(b,5)) {cout<<a<<" "<<b<<endl;return 0;}
        }
    
    return 0;
}


Measured memory_bytes: 4188