akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iostream>
#include<cstdio>
using namespace std;
int dp[41][410][410];
int n,ma,mb;
int a[41],b[41],c[41];
int ans=1e9;
int main()
{
	scanf("%d%d%d",&n,&ma,&mb);
	for(int i=1;i<=n;i++)scanf("%d%d%d",a+i,b+i,c+i);
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=400;j++)
		{
			for(int k=0;k<=400;k++)dp[i][j][k]=1e9;
		}
	}
	dp[0][0][0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=400;j++)
		{
			for(int k=0;k<=400;k++)
			{
				dp[i][j][k]=dp[i-1][j][k];
				if(j>=a[i] && k>=b[i])dp[i][j][k]=min(dp[i][j][k],dp[i-1][j-a[i]][k-b[i]]+c[i]);
				if(!j && !k)continue;
				if(j*mb==k*ma)ans=min(ans,dp[i][j][k]); 
			}
		}
	}
	if(ans==1e9)ans=-1;
	printf("%d",ans);
	return 0;
}

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

int main()
{
	int sum = 0;
	for (int i = 0; i < 5; i++) {
		int tmp;
		cin >> tmp; tmp = max(tmp, 40);
		sum += tmp;
	}
	cout << sum / 5 << endl;
	return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }

ll partition(vector<pair<ll,char>> &a, ll p, ll r){
    ll x=a[r].first;
    ll i=p-1;
    for(ll j=p; j<r; j++){
        if(a[j].first<=x){
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[i+1], a[r]);
    return i+1;
}

void quicksort(vector<pair<ll,char>> &a, ll p, ll r){
    if(p<r){
        ll q=partition(a,p,r);
        quicksort(a,p,q-1);
        quicksort(a,q+1,r);
    }
}

int main(){
    ll n; cin>>n;
    vector<pair<ll,char>> a(n), b(n);
    rep(i,n) cin>>a[i].second>>a[i].first;
    b=a;
    stable_sort(b.begin(), b.end(), [](const pair<ll,char> &x, const pair<ll,char> &y){return x.first<y.first;});
    quicksort(a, 0, n-1);
    bool ifstable=true;
    rep(i,n){
        if(a[i]!=b[i]) ifstable=false;
    }
    if(ifstable) cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    rep(i,n) cout<<a[i].second<<' '<<a[i].first<<endl;
    return 0;
}


Measured memory_bytes: 7592
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>
// 多倍長整数型
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
     
#define INF 1e9
#define LINF 1e19
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;
const ll ZER = 0;

int main(){
    ll k, t;
    cin >> k >> t;
    vector<ll> a(t);
    rep(i, t)cin >> a[i];
    if(t == 1){
      cout << a[0] - 1 << endl;
      return 0;
    }
    sort(ALL(a), greater<ll>());
    ll sum = 0;
    REP(i, 1, t - 1)sum += a[i];
    cout << max(ZER, a[0] - sum - 1);
}





Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll N, K;
    cin >> N >> K;
    ll INF = 1145148931919810;
    ll a[N + 1] = {INF};
    for(ll i = 1; i <= N; i++) cin >> a[i];
    sort(a, a + N + 1);
    ll ok = N + 1, ng = -1;
    while(ok - ng > 1){
        ll mid = (ok + ng) / 2;
        bool dp[K + 1] = {1};
        for(ll i = 0; i < N; i++){
            if(i == mid) continue;
            bool tmp[K + 1];
            for(ll j = 0; j <= K; j++) tmp[j] = dp[j] | (j - a[i] >= 0 ? dp[j - a[i]] : 0);
            for(ll j = 0; j <= K; j++) dp[j] = tmp[j];
        }
        bool update = 0;
        for(ll j = max<ll>(0, K - a[mid]); j < K; j++){
            if(dp[j]){
                update = 1;
                ok = mid;
                break;
            }
        }
        if(!update) ng = mid;
    }
    cout << ok << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
#define maxn 100005
#define INF 2123456789
typedef long long ll;

int main() {
	int temp=0, n, a, b;
	cin >> n;
	cin >> a >> b;
	for (int i = a; i <= b; i++) {
		if (i % n == 0) {
			temp = 1;
			break;
		}
	}
	if (temp)printf("OK\n");
	else cout << "NG" << endl;
}

Measured memory_bytes: 3632
N = (int)(input())

e = [0] * (N+1)

for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j


def num(m):
    return len(list(filter(lambda x: x >= m-1, e)))


print(num(75) + num(25)*(num(3)-1) + num(15) *
      (num(5)-1) + num(5)*(num(5)-1)*(num(3)-2)//2)


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	ll a[114514] = {};
	cin >> N;
	REP(i, N)
		cin >> a[i];
	sort(a, a+N, greater<ll>());
	int now = -1;
	vector<ll> r;
	REP(i, N){
		if(now == a[i]){
			r.push_back(now);
			now = -1;
		}else{
			now = a[i];
		}
		if(r.size() == 2) break;
	}
	if(r.size() == 2) 
		cout << r[0]*r[1] << endl;
	else
		cout << 0 << endl;
}


Measured memory_bytes: 1152
#include<stdio.h>

int main()
{
    int H, N, sum = 0;

    scanf("%d %d", &H, &N);

    int A[N];

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

        sum += A[i];
    }

    if(sum>=H)printf("Yes");

    else printf("No");

    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
main(){
  int n;
  string in;
  while(cin>>n && n){
    cin>>in;
    vector<pair<int,int> > a(n);
    for(int i=0;i<n;i++)cin>>a[i].first>>a[i].second;
    for(int i=n-1;i>=0;i--){
      int b[2]={a[i].first-1,a[i].second-1};
      swap(in[b[0]],in[b[1]]);
      int dif= abs(b[0]-b[1]);
      for(int j=0;j<2;j++){
	in[b[j]]=(in[b[j]]-'a'+dif)%26+'a';
      }
    }
    cout << in << endl;
  }
}

Measured memory_bytes: 0
import sys
from collections import deque


def input():
    return sys.stdin.readline().rstrip()


def main():
    H, W = map(int, input().split())
    ch, cw = map(int, input().split())
    dh, dw = map(int, input().split())
    S = [list(map(str, input())) for _ in range(H)]

    q = deque()
    q.append((ch - 1, cw - 1, 0))

    pathA = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    pathB = []
    for i in range(5):
        for j in range(5):
            pathB.append((i - 2, j - 2))
    visited = [[-1] * W for _ in range(H)]

    while q:
        h, w, d = q.popleft()
        if visited[h][w] !=-1:
            continue
        visited[h][w] =d


        for h1, w1 in pathA:
            newh = h + h1
            neww = w + w1
            if newh >= 0 and newh < H and neww >= 0 and neww < W and S[newh][neww] == ".":
                if visited[newh][neww] == -1:
                    q.appendleft((newh, neww, d))

        for h1, w1 in pathB:
            newh = h + h1
            neww = w + w1
            if newh >= 0 and newh < H and neww >= 0 and neww < W and S[newh][neww] == ".":
                q.append((newh, neww, d + 1))

    print(visited[dh - 1][dw - 1])


if __name__ == "__main__":
    main()


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

int lastDay[]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int a,b;
    cin>>a>>b;
    cout<<(lastDay[a]==b)<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
const int maxn = 1<<20;
int n;
int l[maxn], r[maxn], raw[maxn], dp[maxn];
vector<int> el[maxn];
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for(int x, L, i = 0; i < n; i++) {
		cin >> x >> L;
		tie(x, L) = tuple<int, int>{x-L, x+L};
		raw[2*i+1] = x, raw[2*i+2] = L;
		l[i] = x, r[i] = L;
	}
	raw[0] = -(1<<30);
	sort(raw, raw + 2*n + 1);
	for(int i = 0; i < n; i++) {
		l[i] = lower_bound(raw, raw + 2*n + 1, l[i]) - raw;
		r[i] = lower_bound(raw, raw + 2*n + 1, r[i]) - raw;
		el[r[i]].push_back(l[i]);
	}
	for(int i = 0; i <= 2*n; i++) {
		if(i) dp[i] = dp[i-1];
		for(auto j : el[i]) dp[i] = max(dp[i], dp[j] + 1);
	}
	cout << dp[2*n];
}


Measured memory_bytes: 36096
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N,A,B,C;
vector<int> l;

int dfs(int now,int a,int b,int c){
    if(now==N){
        if(min(a,min(b,c))==0) return MOD;
        else return (abs(a-A)+abs(b-B)+abs(c-C)-30);
    }

    int res0=dfs(now+1,a,b,c);
    int res1=dfs(now+1,a+l[now],b,c)+10;
    int res2=dfs(now+1,a,b+l[now],c)+10;
    int res3=dfs(now+1,a,b,c+l[now])+10;
    return (min(min(res0,res1),min(res2,res3)));
}

int main(){
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    l.push_back(x);
  }

  cout<<dfs(0,0,0,0)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int memo[1000000];

int solve( int ,int ,int );
int main(){
  int n ,m ,total;
  while( true ){
    total = 0;
    memset( memo ,-1 ,sizeof( memo ) );
    cin >> n;
    if( n == 0 ) break;
    cin >> m;
    solve( 1 ,n ,m );
    for( int i=n-1 ; i<=m ; i++ ){
      if( memo[i] != -1 ) total++;
    }
    cout << total << endl;
  }
}

int solve( int ans ,int n ,int m ){
  if( ans <= m ){
    if( n <= ans && memo[ans] == -1) return memo[ans] = ( solve( ans*2 ,n ,m ) + solve( ans*3 ,n ,m ) +
							  solve( ans*5 ,n ,m ) );
    else return ( solve( ans*2 ,n ,m ) + solve( ans*3 ,n ,m ) +  solve( ans*5 ,n ,m ) );
  }
  else return 0;
}

Measured memory_bytes: 5068
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef set<int> si;

int main() {FIN
	
	int n, k, i, j, d, sn;
	cin >> n >> k;
	si sks;
	for (i = 1; i <= k; i++) {
		cin >> d;
		for (j = 0; j < d; j++) {
			cin >> sn;
			sks.insert(sn);
		}
	}
	
	cout << (n - (int)sks.size()) << "\n";
	return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> PL;

vector <int> E[100010];
int n;
int A[100010];
ll U[100010];

void dfs(int x, int fa){
	ll sum = 0, mx = 0;
	for(int e : E[x])if(e != fa){
		dfs(e, x);
		sum += U[e];
		mx = max(mx, U[e]);
	}
	if(sz(E[x]) == 1){
		U[x] = A[x];
	}
	else{
		if(A[x] > sum){
			puts("NO");
			exit(0);
		}
		ll temp = 2LL * A[x] - sum;
		if(temp < 0){
			puts("NO");
			exit(0);
		}
		ll match = sum - A[x];
		if(match > sum - mx){
			puts("NO");
			exit(0);
		}
		U[x] = temp;
	}
}

void solve(){
	scanf("%d", &n);
	for(int i=1;i<=n;i++)scanf("%d", A+i);
	rep(i, n-1){
		int x, y; scanf("%d%d", &x, &y);
		E[x].pb(y);
		E[y].pb(x);
	}
	if(n == 2){
		if(A[1] == A[2])puts("YES");
		else puts("NO");
		return;
	}
	int r = -1;
	for(int i=1;i<=n;i++)if(sz(E[i]) > 1){
		r = i;
		break;
	}
	dfs(r, -1);
	if(U[r] == 0)puts("YES");
	else puts("NO");
}

int main(){
	int Tc = 1; //scanf("%d", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 13568
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
    int y, m, d;
    char S1, S2;
    cin >> y >> S1 >> m >> S2 >> d;
    if (y == 2019 && m <= 4) {
        cout << "Heisei" << endl;
    } else if (y < 2019) {
        cout << "Heisei" << endl;
    } else {
        cout << "TBD" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#

#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop
import math

def main():
    n = int(input())
    al = list(map(int, input().split()))

    ans = [0] * n

    half = math.ceil(n/2)
    for i in range(half, n):
        ans[i] = al[i]

    for i in range(half-1, -1, -1):
        num = i + 1
        val = 0
        for j in range(num * 2 - 1, n, num):
            # print(j)
            val += ans[j]

        val %= 2
        ans[i] = 0 if val == al[i] else 1

    c = ans.count(1)
    print(c)
    if c > 0:
        boxes = []
        for i in range(len(ans)):
            if ans[i] == 1:
                boxes.append(i + 1)
        print(' '.join(map(str, boxes)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 86768
n = int(input())
a = list(map(int,input().split()))
b = [0] * n
ans = 0
while sum(b) < sum(a):
  c = 0
  while c < n:
    tmp = []
    while a[c] !=  b[c]:
      tmp.append(c)
      c+= 1
      if c >= n:
        break
    if tmp:
      ans += 1
    for i in tmp:
        b[i] += 1
    c += 1
print(ans)

Measured memory_bytes: 3064
from collections import deque


def conv_list(n):
    adj_matrix = []
    for _ in range(n):
        adj_list = input().split()
        adj_list = list(map(int, adj_list))
        adj_row = [False] * n
        if adj_list[1] > 0:
            for i in adj_list[2:]:
                adj_row[i - 1] = True
        adj_matrix.append(adj_row)
    return adj_matrix


def depth_first_search(adj_matrix, n):
    visited = [None] * n
    count = 1
    searched = [None] * n
    start = 0
    stack = deque()
    stack.append(start)
    visited[start] = 1
    while count <= 2 * n:
        has_edge = adj_matrix[start]
        i = 0
        while i < n:
            if has_edge[i] and visited[i] is None:
                stack.append(i)
                count += 1
                visited[i] = count
                break
            i += 1
        if i < n:
            start = i
        else:
            searched_node = stack.pop()
            count += 1
            searched[searched_node] = count
            if len(stack) > 0:
                start = stack[-1]
            elif count < 2 * n:
                start = visited.index(None)
                stack.append(start)
                count += 1
                visited[start] = count
            else:
                break
    return visited, searched


def main():
    n = int(input())
    adj_matrix = conv_list(n)
    visited, searched = depth_first_search(adj_matrix, n)
    for i in range(n):
        print("{} {} {}".format(i + 1, visited[i], searched[i]))


if __name__ == "__main__":
    main()



Measured memory_bytes: 6060
/*

_/\_


*/


#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,r,n) for(int i=r; i<=n; i++)
#define sz(v) (int)(v).size()
#define vec(x) vector < x >
using vi = vector < int >;
using mii = map <int , int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
using int64 = long long;
const int inf = 2e9 + 7;
const char nwl = '\n';
const int mxx = 1e6 + 3;
int64 sumV(vi &v) {
	int64 s = 0;
	for (int x : v) {
		s += (int64)x;
	}
	return s;
}
int gcd(int a, int b) {
	if (!b) return a;
	return gcd(b, a % b);
}
//const int64 biGinf = 9e+18;
const string yo = "Yes\n", no = "No\n";


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	bool f = 0;
	if (a < b and b < c) f = 1;
	if (!f) {
		while (k and a >= b) {
			b *= 2;
			k--;
		}
		while (k and b >= c) {
			c *= 2;
			k--;
		}
		if (a < b and b < c) f = 1;
	}


	if (f) cout << yo;
	else cout << no;



	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <bitset>
#include <map>
#include <math.h>
#include <utility>

using namespace std;

int main(){

    int K;
    string S;

    cin >> K >> S;

    if (K >= S.length()) {
        cout << S << endl;
    } else {
        for (int i=0; i<K; i++){
            cout << S[i];
        }
        cout << "..." << endl;
    }

    return 0;
}


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

#define For(i, j, k) for(int i = j; i <= k; i++)

using namespace std;

const int N = 210, M = N * N;
const int oo = 1e8;

namespace Dinic{
	
	int Begin[N], Next[M], to[M], flow[M], e;

	void init(){
		e = 1;
	}

	void addedge(int u, int v, int w){
		to[++e] = v, Next[e] = Begin[u], Begin[u] = e, flow[e] = w;
		to[++e] = u, Next[e] = Begin[v], Begin[v] = e, flow[e] = w;
	}

	int dis[N], cur[N];
	int S, T;

	bool BFS(){
		queue<int> q;
		q.push(S);
		memset(dis, 0, sizeof dis);
		dis[S] = 1;	
		while(!q.empty()){
			int o = q.front(); q.pop();
			for(int i = Begin[o]; i; i = Next[i]){
				int u = to[i];
				if(!dis[u] && flow[i]) dis[u] = dis[o] + 1, q.push(u);
			}
		}
		return dis[T];
	}

	int DFS(int o, int Maxf){
		if(o == T || !Maxf) return Maxf;
		int sumf = 0;
		for(int &i = cur[o]; i; i = Next[i]){
			int u = to[i], f;
			if(dis[u] == dis[o] + 1 && (f = DFS(u, min(Maxf, flow[i])))){
				flow[i] -= f, flow[i ^ 1] += f;
				sumf += f, Maxf -= f;
			}
			if(!Maxf) break;
		}
		return sumf;
	}

	int Maxflow(int _S, int _T){
		S = _S, T = _T;
		int ret = 0;
		while(BFS()){
			For(i, 1, T) cur[i] = Begin[i];
			ret += DFS(S, oo);
		}
		return ret;
	}

};

int n, m;
char Map[N][N];

int main(){

	scanf("%d%d", &n, &m);
	Dinic::init();

	using Dinic::addedge;

	int S = n + m + 1, T = S + 1;
	For(i, 1, n){
		scanf("%s", Map[i] + 1);
		For(j, 1, m)
			if(Map[i][j] == 'o') addedge(i, n + j, 1);
			else if(Map[i][j] == 'S') addedge(S, i, oo), addedge(S, n + j, oo);
			else if(Map[i][j] == 'T') addedge(i, T, oo), addedge(n + j, T, oo);
	}

	int ans = Dinic::Maxflow(S, T);
	printf("%d\n", ans >= oo ? -1 : ans);
	
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){
  int i;
  char s[3];
  for(i=0;i<3;i++)
    scanf("%c",&s[i]);
  if(s[0]==s[1] && s[1]==s[2])
    printf("No\n");
  else
    printf("Yes\n");
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

const int DIGITS = 15;

long long digit_sum(long long x) {
    long long sum = 0;

    while (x != 0) {
        sum += x % 10;
        x /= 10;
    }

    return sum;
}

int main() {
    vector<long long> candidates;

    for (int x = 1; x <= 99; x++)
        candidates.push_back(x);

    for (int digits = 3; digits <= DIGITS; digits++) {
        long long p = 1;

        for (int i = 0; i < digits - 3; i++)
            p *= 10;

        for (int start = 100; start <= 999; start++) {
            long long number = start * p + p - 1;
            candidates.push_back(number);
        }
    }

    sort(candidates.rbegin(), candidates.rend());
    vector<long long> snuke;
    long long min_numer = 1e15, min_denom = 1;

    for (long long x : candidates) {
        long long sum = digit_sum(x);

        if (x * min_denom <= min_numer * sum) {
            snuke.push_back(x);
            min_numer = x;
            min_denom = sum;
        }
    }

    reverse(snuke.begin(), snuke.end());
    int K;
    cin >> K;
    assert(K <= (int) snuke.size());

    for (int i = 0; i < K; i++)
        cout << snuke[i] << '\n';
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#undef DBG

int main()
{
        int souwa;
        int  inputc;
        char numbuff[100000+1];
        int numbers[100000];
        int numnum;
        int i,j;
        int N, L;
        int mini;

        j = 0;

        numnum = 0;
        j = 0;
        while( (inputc = getc(stdin)) != EOF ) {
#ifdef DBG
printf("input char %c\n", inputc);
#endif
                if( inputc == ' ' || inputc == '\n' ) {
                        numbuff[j]  = '\0';
                        numbers[numnum++] = atoi(numbuff);
                        j=0;
                        continue;
                }
                else {
                        numbuff[j++] = inputc;
                }

#ifdef DBG
                for( int k =0; k < numnum; k++ ) { printf("<%d>", numbers[k]); } printf("\n");
#endif
        }
#ifdef DBG
        for( int k =0; k < numnum; k++ ) { printf("<%d>", numbers[k]); } printf("\n");
        printf("get numbuff\n");
#endif

        N = numbers[0];
        L = numbers[1];
#ifdef DBG
        printf("N=%d L=%d\n", N, L);
#endif
        souwa = 0;
        mini = 1000;
        for( i = 0; i < N; i++ ) {
                int ama;
                ama = i +  L;
#ifdef DBG
        printf("ama =%d\n", ama );
#endif
                souwa += ama;
                if( abs(ama) < abs(mini) ) {
                        mini =  ama;
                }


        };

#ifdef DBG
        printf("souwa =%d\n", souwa );
        printf("mini =%d\n", mini );
#endif
        printf("%d\n", souwa-mini);
        return 0;
}


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

using namespace std;
typedef long long ll;

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

    vector<ll> best(w+1,0);

    for(int i = 0; i < n; i++) {
        ll weight, value;
        cin >> weight >> value;

        for(int j = w-weight+1; j >= 0; j--) {
            best[j+weight] = max(best[j+weight], best[j] + value);
        }
    }

    ll ans = 0;
    for(auto& i : best) {
        ans = max(i,ans);
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
#define N 2048
int v[N],i,j,k,ans,n;

int bs (int x){
    if (v[n - 1] < x)
        return n - 1;
    int poz = 0,it;
    for (it = n; it > 0; it >>= 1)
        while (poz + it < n && v[it + poz] < x)
        poz += it;
    return poz;
}

int main()
{
    cin >> n;
    for (i = 0; i < n; ++i)
        cin >> v[i];
    sort (v, v + n);
    for (i = 0; i < n; ++i){
        for (j = i + 1; j < n; ++j){
            k = bs (v[i] + v[j]);
            ans += max (0,k - j);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
    int a[5],k,i,s;
    for(i=0;i<5;i++)
    scanf("%d",&a[i]);
    scanf("%d",&k);
    sort(a,a+5);
    s=a[4]-a[0];
    if(s<=k)
        printf("Yay!\n");
    else
        printf(":(\n");
    return 0;
}


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

using ld = long double;
using ll = int64_t;

bool solve() {
    ll D, E;
    cin >> D >> E;
    if(!(D + E)) return false;
    ld ans = 5e15;
    for(ll x = 0; x <= D; x++) {
        ll y = D - x;
        ld dist = sqrt((ld)(x * x + y * y));
        ld dic = abs(dist - E);
        ans = min(ans, dic);
    }
    printf("%.30Lf\n", ans);
    return true;
}

int main() {
    while(solve());
    return 0;
}



Measured memory_bytes: 3140
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)

int a[100010];

int main() {
    int N;
    cin >> N;
    rep(i, N)cin >> a[i];

    sort(a, a + N);

    int sum = 0;
    int j = 1;
    rep(i, N) {
        int cou = 0;
        while (a[i] == j) {
            cou++;

            if (a[i] < cou) {
                sum++;
            }
            if (a[i] == cou) {
                sum -= a[i] - 1;
            }
            if (a[i] > cou) {
                sum++;
            }
            i++;
        }
        j++;
        i--;
    }
    cout << sum << endl;
}

Measured memory_bytes: 640
"use strict";
function main(input) {
  const inputs = input.split("\n").filter(x => x !== "");
  let output;

  let N = inputs[0];
  let p = inputs.slice(1).map(p => Number(p));

  let max = 0;
  let maxIndex = -1;
  for (let i = 0; i < p.length; i++) {
    if (p[i] > max) {
      max = p[i];
      maxIndex = i;
    }
  }

  output =
    max / 2 +
    p.filter((p, index) => index !== maxIndex).reduce((cur, acc) => cur + acc);

  console.log(output);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
N, M = map(int, input().split())

ans = 0
if N == 1 and M == 1:
    ans = 1
elif N == 1 and M > 1:
    ans = M-2
elif N > 1 and M == 1:
    ans = N-2
else:
    ans = (N-2)*(M-2)

print(ans)


Measured memory_bytes: 9172
n = int(input())
blue_cards = {}
for i in range(n):
    s = input()
    if s in blue_cards:
        blue_cards[s] += 1
    else:
        blue_cards[s] = 1

m = int(input())
red_cards = {}
for i in range(m):
    s = input()
    if s in red_cards:
        red_cards[s] += 1
    else:
        red_cards[s] = 1
        
ans = 0
for k in blue_cards:
    if k in red_cards:
        score = blue_cards[k] - red_cards[k]
    else:
        score = blue_cards[k]
    ans = max(ans, score)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll ans = 0;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll h;
	cin >> h;
	ll t = h , bit = 0;
	while(t) bit++ , t >>= 1ll;
	cout << (1ll << bit) - 1ll << endl;
	return 0;
} 

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

int main()
{
    int n;
    cin>>n;
    vector<int> h(n+1,0);
    for(int i=1;i<=n;i++)
        cin>>h[i];
    vector<int> dp(n+1);
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;i++)
    {
            dp[i]=min(abs(abs(h[i]-h[i-1])+dp[i-1]),abs(abs(h[i]-h[i-2])+dp[i-2]));
    }
   /*for(int i=1;i<=n;i++)
        cout<<dp[i]<<" ";
    cout<<endl;*/
    cout<<dp[n]<<endl;






    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>
#include <complex>

using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const ll MOD = 1000000007;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> ll mod_pow(ll a, ll n, T mod) { mod=(ll)mod; ll res=1, p=a%mod; while(n){ if(n&1) res=res*p%mod; p=p*p%mod; n>>=1; } return res; }
template<int mod>
struct ModInt {
    using ll = long long; ll x;
    ModInt() : x(0) {}
    ModInt(int y) : x(y >= 0 ? ll(y % mod) : (ll)((mod - (-y) % mod))) {}
    ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod)) {}
    ModInt &operator+=(const ModInt &rhs) { if((x += rhs.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &rhs) { if((x += mod - rhs.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &rhs) { x = x * rhs.x % mod; return *this; }
    ModInt &operator/=(const ModInt &rhs) { *this *= rhs.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(const ModInt &rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(const ModInt &rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(const ModInt &rhs) const { return ModInt(*this) /= rhs; }
    ModInt operator==(const ModInt &rhs) const { return x == rhs.x; }
    ModInt operator!=(const ModInt &rhs) const { return x != rhs.x; }
    friend ostream &operator<<(ostream &os, const ModInt &rhs) { return os << rhs.x; }
    friend istream &operator>>(istream &is, ModInt &rhs) { ll t; is >> t; rhs = ModInt<mod> (t); return (is); }
private:
    ModInt inverse() const { ll a = x, u = 1LL, v = 0LL, t, b = (ll)mod; while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); } return  ModInt(u); }
};
using mint = ModInt<MOD>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int ans = 0;
    int N, K;
    cin >> N >> K;
    rep(i, N){
        int x;
        cin >> x;
        ans += min(2*x, 2*(K-x));
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
def resolve():
    import sys
    sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
    to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
    print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

    # 入力を整数に変換して受け取る
    def input_int():
        return int(input())

    def map_int_input():
        return map(int, input())

    MII = map_int_input

    def MII_split():
        return map(int, input().split())

    def MII_to_index():
        return map(to_index, input())

    def MII_split_to_index():
        return map(to_index, input().split())

    # 入力全てを整数に変換したものの配列を受け取る
    def list_int_inputs():
        return list(map(int, input()))

    LII = list_int_inputs

    def LII_split():
        return list(map(int, input().split()))

    # 2次元リスト化
    def LII_2D(rows_number):
        return [LII() for _ in range(rows_number)]

    def LII_split_2D(rows_number):
        return [LII_split() for _ in range(rows_number)]

    N = input_int()
    A = LII_split()

    s = 0
    right_sum = 0
    for i in reversed(range(N - 1)):
        right_sum += A[i + 1]
        s += A[i] * right_sum

        # 2乗は死ぬので累積和を使う（使えることは式を書き出せばわかる）
        # for j in range(i + 1, N):
        #     s += As[j] * As[i]
        if s > 10 ** 9 + 7:
            s %= 10 ** 9 + 7

    print(s)
    
resolve()

Measured memory_bytes: 33020
N=int(input())
A=[int(i) for i in input().split()]
A=[0]+A+[0]
travel=0
for i in range(N+1):
    travel+=abs(A[i+1]-A[i])
ans =[]
for i in range(1,N+1):
    ans.append(travel-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))
print('\n'.join(map(str,ans)))

Measured memory_bytes: 19308
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struct Node{
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while( x != NIL ){
    y = x;
    if( z->key < x->key ){
      x = x->left;
    } else {
      x = x->right;
    }
  }
  
  z->parent = y;
  if( y == NIL ){
    root = z;
  } else {
    if( z->key < y->key ){
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u) {
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node *u) {
  if ( u == NIL ) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main() {
  int n, i, x;
  string com;
  
  scanf("%d", &n);
  
  for( i = 0; i < n; i++ ){
    cin >> com;
    if ( com == "insert" ){
      scanf("%d", &x);
      insert(x);
    } else if ( com == "print" ) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
  return 0;
}


Measured memory_bytes: 26644
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;

template<class T>bool chmax(T &a, const T &b) { if( a < b ) { a = b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) { if( b < a ) { a = b; return 1; } return 0;}

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))
//#define int long long int //dont forget to change int to signed
int main() {
	int N;
	scanf("%d", &N);
	int ary[100100];//-1index
	SET_ZERO(ary);
	for (int i = 0; i < N; i++) {
		int d;
		scanf("%d", &d);
		ary[d]++;
		ary[d+1]++;
		ary[d+2]++;
	}

	int max = -1;
	for (int i = 0; i < 100100; i++) {
		chmax<int>(max, ary[i]);
	}
	printf("%d\n", max);
	return 0;
}


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

int getscore(int n,int k,int *in){
  int ret = 0;
  for(int i=0;i+k <= n;i++){
    int tmp = 1;
    for(int j=0;j<k;j++){
      tmp *= in[i+j];
    }
    ret = max(ret,tmp);
  }
  return ret;
}

main(){
  int n,k;
  int in[500];
  while(cin>>n>>k && n){
    for(int i=0;i<n;i++){
      cin>>in[i];
    }
    int ans = 0;
    int tmp = getscore(n,k,in);
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	swap(in[i],in[j]);
	int t2 = getscore(n,k,in)-tmp;
	ans = max(ans,t2);
	swap(in[i],in[j]);
      }
    }
    cout << ans << endl;
  }
}

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

typedef long long ll;
int main()
{
    int n,m,c;
    cin>>n>>m>>c;
    vector<int>B(m);
    for(auto &x:B)
    {
        cin>>x;
    }
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        int prd=c;
        for(int j=0;j<m;j++)
        {
            int a;
            cin>>a;
            prd+=(a*B[j]);
        }
        if(prd>0)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  ll n;
  cin >>n;
  ll a[n],ans=0,b[n],c=0;
  for(ll i=0;i<n;i++) {
    cin >>a[i];
    ans+=abs(a[i]);
    if(a[i]<0) c++;
    b[i]=abs(a[i]);
  }
  sort(b,b+n);
  if(c%2==0) cout <<ans<<endl;
  else cout <<ans-b[0]*2<<endl;
}


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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> l(m),r(m);
  for(int i=0;i<m;i++) cin>>l[i]>>r[i];
  int dl=0,dr=n;
  for(int i=0; i<m; i++){
    dl = max(dl,l[i]);
    dr = min(dr,r[i]);
  }
  if(dr-dl+1<0) cout<<0;
  else cout<<dr-dl+1;
}

Measured memory_bytes: 1024
X = abs(int(input()))
size = 1000
L = [i**5 for i in range(size)]
if X == 0:
    print(0, 0)
for l in range(size):
    for m in range(l+1):
        if L[l] + L[m] == X:
            print(l, -m)
            exit(0)
        if L[l] - L[m] == X:
            print(l, m)
            exit(0)


Measured memory_bytes: 9112
N, K = map(int, input().split())
mod = 10**9 + 7

def ksum(n):
    return n*(n+1)//2

ans = 0
msum = ksum(N)
for i in range(K, N+2):
    ans += msum - ksum(N - i) - ksum(i-1) + 1
    #print(i, ans)
    ans %= mod

print(ans)

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int w,h,n; cin>>w>>h>>n;
	vector<vector<bool>> white(w, vector<bool>(h,true));
	int x,y,a, ret=w*h;
	for (int i=0; i<n; i++) {
		cin>>x>>y>>a;
		int xmin=0, xmax=w, ymin=0, ymax=h;
		switch(a) {
			case 1: xmax=x; break;
			case 2: xmin=x; break;
			case 3: ymax=y; break;
			default: ymin=y;
		}
		for (int x=xmin; x<xmax; x++)
			for (int y=ymin; y<ymax; y++)
				if(white[x][y])
					white[x][y]=false, ret--;
	}
	cout << ret << endl;
	return 0;
}


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

int main(){
    int N; cin>>N;
    vector<int> H(N);
    for(int i=0;i<N;i++) cin>>H[i];
    vector<int> c(N,0);
    for(int i=N-2;i>=0;i--){
        if(H[i]>=H[i+1]) c[i]=c[i+1]+1;
    }
    int ans=0;
    for(int i=0;i<N;i++){
        ans=max(ans,c[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
/*i-=-1*/
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define in(n) for(int i=0;i<n;i++)
#define inj(n) for(int j=0;j<n;j++)
#define itn int
#define int ll int 
#define ll long long
#define ull unsigned ll
#define int ll int
#define S second 
#define F first 
#define mod 1000000007
#define globalbool 2000000
#define pii pair<int,int>
#define vi vector<int>
#define all(x) x.begin(),x.end()
#define pb push_back
#define pi 3.1415926535897932
using namespace std;
using namespace std::chrono;
int32_t main()
{
	//ios_base::sync_with_stdio(false);
	/*cin.tie(NULL);cout.tie(NULL);
	auto start = high_resolution_clock::now();*/
	double r;
	cin>>r;
	cout<<setprecision(15)<<2*pi*r;
	auto stop = high_resolution_clock::now();
    //auto duration = duration_cast<microseconds>(stop - start); 
  
    //cout << "Time taken by function: "
    //<< duration.count() << " microseconds" << endl;
}
//g++ -DLOCAL -std=c++17 -Wshadow -Wall -o "h" "h.cpp" -fsanitize=address
// -fsanitize=undefined -D_GLIBCXX_DEBUG -g

Measured memory_bytes: 3756
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    double a, b;
    cin >> a >> b;

    printf("%.6lf\n", a*b/3.305785);

    return 0;
}

Measured memory_bytes: 3276
#include <stdio.h>
#include <stdlib.h>
#include <math.h>



int main(void){
	int N=0;
	int M=0;
	scanf("%d",&N);
	scanf("%d",&M);
	int arr[M];
	for (int i = 0; i < M; ++i){
		scanf("%d",&arr[i]);
	}
	int total=0;	
	for (int i = 0; i < M; ++i){
		total=total + arr[i];
	}

	int result = N-total;
	if (result<0){
		result = -1;
	}
	printf("%d\n",result);

	return 0;

}

Measured memory_bytes: 1760
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

## floatは16桁までしか保証しない
## B*100がダメなのは 2.51*100 = 250.99999999999997 のようになる場合があるから
from decimal import Decimal
'''
A, B = map(str, sys.stdin.readline().split())
A = Decimal(A)
B = Decimal(B)
print(A * B//1)
'''

'''
四捨五入で誤差の影響をなくす
A, B = map(str, sys.stdin.readline().split())
A = int(A)
B = int(round(float(B)*100))
print(A*B//100)
'''

'''
#微小な数を足してあげることで誤差の影響をなくす
A, B = map(str, sys.stdin.readline().split())
A = int(A)
B = int(float(B)*100+0.1)
print(A*B//100)
'''


#微小な数を足してあげることで誤差の影響をなくす
A, B = map(str, sys.stdin.readline().split())
A = int(A)
if B[0] == '0':
    B = int(B[2:])
else:
    B = int(B.replace('.', ''))
print(A*B//100)


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

//------------------
using pii = pair<int,int>;
template<class T> inline bool chmax(T& a, T b) {if(a<b) {a=b;return true;} return false;}

struct LevenshteinDistance {
    int LD(string& s, string& t) {
        int ns = s.size(), nt = t.size();
        vector<vector<int>> dp(ns+1, vector<int>(nt+1));
        vector<vector<pii>> prev;
        dp[0][0] = 0;
        for ( int i = 0; i < ns; i++ ) {
            dp[i+1][0] = i+1;
        }
        for ( int j = 0; j < nt; j++ ) {
            dp[0][j+1] = j+1;
        }
        for ( int i = 0; i < ns; i++ ) {
            for ( int j = 0; j < nt; j++ ) {
                int c = s[i] == t[j] ? 0 : 1;
                dp[i+1][j+1] = min({dp[i][j+1] + 1, dp[i+1][j] + 1, dp[i][j] + c});
            }
        }
        return dp[ns][nt];
    }
};

//-----------------------
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_E&lang=jp
int solve() {
    string S, T;
    cin >> S >> T;
    LevenshteinDistance ld;
    int ans = ld.LD(S,T);
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6788
#include "bits/stdc++.h"
#define int long long

using namespace std;

signed main() {
    int K, N;
    cin >> K >> N;
    int max = 0;
    int first = 0;
    cin >> first;
    int prev = first;
    for(auto i = 1LL; i < N; i++) {
        int t;
        cin >> t;
        if(max < t-prev){
            max = t - prev;
        }
        prev = t;
    }
    if(max < K + first - prev){
        max = K + first - prev;
    }
    cout << K - max << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 1000000000;

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

using namespace std;
int main() {
	string s; cin >> s;

	int n = s.size();

	int nl = 0;
	int wl = 0;
	int sl = 0;
	int el = 0;



	rep(i, n) {
		if (s[i] == 'N')nl++;
		if (s[i] == 'W')wl++;
		if (s[i] == 'S')sl++;
		if (s[i] == 'E')el++;
	}

	bool okay = false;
	if (nl > 0 && sl > 0 && wl == 0 && el == 0)okay = true;
	else if (nl == 0 && sl == 0 && wl > 0 && el > 0)okay = true;
	else if (nl > 0 && sl > 0 && wl > 0 && el > 0)okay = true;

	if (okay == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

using namespace std;

typedef long long ll;

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

  int d;
  if (a >= b && a >= c) {
    d = (a - b) + (a - c);
  } else if (b >= a && b >= c) {
    d = (b - a) + (b - c);
  } else if (c >= a && c >= b) {
    d = (c - a) + (c - b);
  }
  if (d % 2 == 0) {
    printf ("%d\n", d / 2);
  } else {
    printf ("%d\n", d / 2 + 2);
  }
}


Measured memory_bytes: 256
//kuch tho karna hai 
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n ;
		int s =0 ;
		map<int,int>mp;
		fn1{
			cin >> ar[i];
			s+=ar[i];
			mp[ar[i]]++;
		}
		int q;
		cin >> q;
		while(q--){
			int x ,y;
			cin >> x >> y;
			s-=mp[x]*x;
			s+=mp[x]*y;
			mp[y]+=mp[x];
			mp[x] = 0;
			cout << s <<endl;
		}
	
	
	}
	return 0;
}

Measured memory_bytes: 10224
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.cpp
 * Author: baisganon
 *
 * Created on 2017/06/04, 20:10
 */

#include<iostream>
using namespace std;

int LinearSearch(int x,int s[],int n){
	s[n] = x;
	for(int i=0;;i++){
		if(s[i]==x){
			if(i<n){
				return i;
			}else{
				return -1;
			}
		}
	}
}

int main(){
	int data1;
	cin >> data1;
	//int* list1 = new int[data1+1];
	int list1[data1+1];
	for(int i=0;i<data1;i++){
		cin >> list1[i];
	}

	int data2;
	cin >> data2;
	//int* list2 = new int[data2];
	int list2[data2];
	for(int i=0;i<data2;i++){
		cin >> list2[i];
	}

	int count=0;
	for(int i=0;i<data2;i++){
		if(LinearSearch(list2[i],list1,data1)!=-1)
			count++;
	}
	
	cout << count << endl;
	//delete[] list1,list2;
	return 0; 
}

Measured memory_bytes: 3092