akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<algorithm>
#include<iomanip>
#include<bitset>
using namespace std;

const int N = 200100;

int n, m, l[N], r[N], d[N], g[N], poz[N];
vector<pair<int, int> > v[N];
queue<int> q;

int main() {
    int i, j;
    //freopen("ttt", "r", stdin);

    cin >> n >> m;

    if(!m) {
        cout << "Yes";
        return 0;
    }

    for(i = 1; i <= m; ++i) {

        cin >> l[i] >> r[i] >> d[i];
        g[r[i]]++;
        poz[r[i]] = -1;
        v[l[i]].push_back(pair<int, int>(r[i], d[i]));
    }
int nr = 0;
    for(i = 1; i <= n; ++i) if(!g[i]) {
        q.push(i);
        ++nr;
}

    if(q.empty()) {
        cout << "No\n";
        return 0;
    }

    while(!q.empty()) {
        int t = q.front();
        q.pop();

        for(auto it : v[t]) {
            int el = it.first, dis = it.second;

            if(poz[el] == -1) {
                poz[el] = poz[t] + dis;
            }
            else if(poz[el] != poz[t] + dis) {
                cout << "No\n";
                return 0;
            }

            --g[el];
            if(!g[el]) {
                ++nr;
                q.push(el);
            }
        }
    }

    if(nr != n) {
        cout << "No";
        return 0;
    }

    cout << "Yes\n";

    return 0;
}


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

using namespace std;

int main () {

int n;
cin >> n;
string s[n];
int a = 0;
int b = 0;
int c = 0;
int d = 0;


for (int i = 0; i < n; i++) {

  cin >> s[i];
    if (s[i] == "AC") {

        a += 1;
    }
    else if (s[i] == "WA") {

        b+= 1;


    }
    else if (s[i] == "TLE") {

        c +=1;
    }
    else {

        d +=1;


    }
}
cout << "AC x " << a << endl;
cout << "WA x " << b << endl;
cout << "TLE x " << c << endl;
cout << "RE x " << d << endl;

return 0;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}


int main() {
	int n = ri();
	int m = ri();
	int a[m], mask[m];
	for (int i = 0; i < m; i++) {
		a[i] = ri();
		int t = ri();
		mask[i] = 0;
		for (int j = 0; j < t; j++) mask[i] |= 1 << (ri() - 1);
	}
	
	std::vector<int> dp(1 << n, 1000000000);
	dp[0] = 0;
	for (int i = 0; i < 1 << n; i++)
		for (int j = 0; j < m; j++) dp[i | mask[j]] = std::min(dp[i | mask[j]], dp[i] + a[j]);
	std::cout << (dp.back() == 1000000000 ? -1 : dp.back()) << std::endl;
	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++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int count = 0;
  while(a>=b){
    b*=2;
    count++;
  }
  while(b>=c){
    c*=2;
    count++;
  }
  if(count<=k)cout<<"Yes";
  else cout<<"No";

}


Measured memory_bytes: 3556
n = int(input())
v = list(map(int,input().split()))
dic1,dic2 = {},{}
c1,c2=0,0
for i in range(0,n,2):
  if v[i] in dic1.keys():
    dic1[v[i]] += 1
  else:
    dic1[v[i]] = 1
  c1 += 1

for i in range(1,n,2):
  if v[i] in dic2.keys():
    dic2[v[i]] += 1
  else:
    dic2[v[i]] = 1
  c2 += 1

dic1 = sorted(dic1.items(), key = lambda x : x[1], reverse=True)
dic2 = sorted(dic2.items(), key = lambda x : x[1], reverse=True)
if len(dic1) == 1:
  dic1.append((0,0))
if len(dic2) == 1:
  dic2.append((0,0))

ans = 0
if dic1[0][0] != dic2[0][0]:
  ans = c1 - dic1[0][1] + c2 - dic2[0][1]
else:
  x = c1 - dic1[0][1] + c2 - dic2[1][1]
  y = c1 - dic1[1][1] + c2 - dic2[0][1]
  ans = min(x,y)

print(ans)

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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=2e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

int n;
int a[N];
int s;

int main()
{
    read(n);
    Rep(i,1,n)read(a[i]),s^=a[i];
    Rep(i,1,n)printf("%d ",s^a[i]);
    puts("");
    return 0;
}

Measured memory_bytes: 4484
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    for(int i=1;i<=10000;i++)
    {
		if((a*i)%b==c){cout<<"YES"<<endl;return 0;}
	}
	cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
#define MST(vv,x) memset(vv,x,sizeof(vv))
#define ll long long
#define maxn 30
int main()
{
    ll n,m;
    ll s1[100];
    while(scanf("%lld%lld",&n,&m)!=EOF)
    {
        for(int a=1;a<=n;a++)
            cin>>s1[a];
        sort(s1+1,s1+1+n);
        ll sum=0;
        for(int a=n,b=m;a>=1&&b>0;a--,b--)
        {
          sum+=s1[a];
        }
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    x, y = map(int, input().split())
    res = 0
    if abs(x) <= abs(y):
        res += 1 if x < 0 else 0
        res += abs(y) - abs(x)
        res += 1 if y < 0 else 0
    else:
        res += 1 if x > 0 else 0
        res += abs(x) - abs(y)
        res += 1 if y > 0 else 0
    print(res)

main()


Measured memory_bytes: 3444
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static long Mod = (long)1e9 + 7;
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            (long N, long A, long B) = Slice3<long>();
            var Xi = Sarray();
            var ans = 0L;
            for (var i = 1; i < N; ++i)
                ans += Min(B, (Xi[i] - Xi[i - 1]) * A);
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 38556
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
	int n,m;
	cin >> n >> m;
	int a[m];
	for(int i=0; i<m; i++) cin >> a[i];

	ll steps[n+3]={0};
	steps[n+2]=1;
	int p=m-1;
	for(int i=n; i>=0; i--){
		if(p>=0 && i == a[p]){
			p--;
			continue;
		}
		steps[i] = (steps[i+1] + steps[i+2])%1000000007;
	}
	cout << steps[0] << endl;

}

Measured memory_bytes: 1408
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//枚数入力
		int N = sc.nextInt();
		int a[] = new int[N+1];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		//大きい順に並び替え
		int max;
		for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		}
		int A = 0;
		int B = 0;
		for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		}
		//得点差を絶対値化
		int point = Math.abs(A - B);
		System.out.println(point);
		sc.close();
	}
}

Measured memory_bytes: 21332
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(K):
    s = [0] * N
    e = [0] * N

    for j in range(N):
        s[max(j - A[j], 0)] += 1
        e[min(j + A[j], N-1)] += 1

    cur = 0
    for j in range(N):
        cur += s[j]
        A[j] = cur
        cur -= e[j]

    if s[0] == N and e[N-1] == N:
        break

print(' '.join(map(str, A)))


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

int main()
{
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 1; i <= N-1; ++i)
	{
		for (int j = 1; j*j <= i; ++j)
		{
			if (i % j == 0)
			{
				if (j * j == i) ans++;
				else ans += 2;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f,oo = inf;
#define IL inline
#define RG register
#define rep(i,a,b) for(RG int i=(a);i<(b);++i)
#define Rep(i,a,b) for(RG int i=(a);i<=(b);++i)
#define Dep(i,a,b) for(RG int i=(a);i>=(b);--i)
#define pc putchar
#define gc getchar
IL ll read(){
    RG ll x=0;char f=0;RG char c=gc();
    for(;!isdigit(c);c=gc())f|=(c=='-');
    for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
    return f?-x:x;
}
IL double readdb(){
    RG double x=0,p=0.1;RG char f=0,c=gc();
    for(;!isdigit(c);c=gc())f|=(c=='-');
    for(;isdigit(c);c=gc())x=x*10+(c^48);
    if(c=='.')for(c=gc();isdigit(c);c=gc(),p/=10)x=x+(c^48)*p;
    return f?-x:x;
}
IL void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);pc(x%10+'0');}
IL void writeln(ll x){write(x);puts("");}
IL void writeln(ll x,char c,ll y){write(x);pc(c);writeln(y);}
IL void writeln(ll x,char c,ll y,char d,ll z){write(x);pc(c);write(y);pc(d);writeln(z);}
#define debug(x) printf(#x" = %d\n",x);
#define rd() read()
#define rdb() readdb()
#define mem(x,v) memset(x,v,sizeof(x))
#define pb push_back
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define fin(x) freopen(#x".in","r",stdin)
#define fout(x) freopen(#x".out","w",stdout)
#define y1 ____y1
#define hash __hash
#define union _union
ll a[200010];
map<ll,ll>mp;
ll n,ans;
int main(){
	n=read();
	++mp[0];
	Rep(i,1,n){
		a[i]=read()+a[i-1];
		ans+=mp[a[i]]++;
	}writeln(ans);
}

Measured memory_bytes: 14336
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define FOR(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

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

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

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

	string s;
	cin >> s;

	REP(i, s.size()) {
		if (s.size() == 1) break;
		if (s[i] == s[i + 1]) {
			s.erase(i, 1);
			i--;
		}
	}

	cout << s.size() - 1 << endl;
	return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N; cin >> N;
    cout << pow(N, 3) << endstr;
    return 0;
}


Measured memory_bytes: 384
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]

flag = 0
for i in range(n-2):
  if d[i][0] == d[i][1] and d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
    flag = 1
  if flag:
    break

if flag:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 62540
def comb(n, r, mod=10 ** 9 + 7):
    n1 = n + 1
    r = min(n, n - r)
    numer = denom = 1
    for i in range(1, r + 1):
        numer = numer * (n1 - i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod - 2, mod) % mod

x, y = map(int, input().split())

if (x+y) % 3 != 0:
    print(0)
    exit()

n = (2*y-x) // 3
m = (2*x-y) // 3

if n*m < 0:
    print(0)
    exit()

print(comb(n+m, m))

Measured memory_bytes: 3064
#include <algorithm>
#include<bits/stdc++.h>
#include <iomanip>
#pragma GCC optimize("O2")
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(c) c.begin(), c.end()
#define endl "\n"
#define sz(u) (int)(u.size())
#define L(x)(2*x)
#define R(x)(2*x+1)
#define M(x,y)((x+y)/2)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
   	cout.tie(0);
	int n;
	cin>>n;
	double t[n+1];
	for(int i=1;i<=n;i++)
		cin>>t[i];
	double dp[n+1][n+1];
	memset(dp,0,sizeof(dp));
	dp[1][1]=t[1];
	dp[1][0]=1-t[1];
	for(int i=2;i<=n;i++)
		for(int j=0;j<=i;j++)
			if(j==0)
				dp[i][j]=dp[i-1][j]*(1-t[i]);
			else
			dp[i][j]=dp[i-1][j]*(1-t[i])+dp[i-1][j-1]*t[i];
	double ans=0;
	for(int i=ceil(double(n)/2);i<=n;i++)
		ans+=dp[n][i];
	cout<<setprecision(10)<<ans;	
}


Measured memory_bytes: 74100
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int n, m, a;
  cin>>n>>m;
  priority_queue<int> q;
  while(n--) cin>>a, q.push(a);
  while(m--) q.push(q.top()/2), q.pop();
  int res = 0;
  while(!q.empty()) res += q.top(), q.pop();
  cout<<res<<endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int h, w, n;
  cin >> h >> w >> n;
  vector<int> x(n), y(n);
  rep(i, n) {
    cin >> x[i] >> y[i];
    x[i]--, y[i]--;
  }

  vector<int> d(200200, inf);
  rep(i, n) {
    if (x[i] - y[i] < 0) continue;
    chmin(d[x[i] - y[i]], x[i]);
  }
  int idx = 1;
  while (d[idx] > d[idx - 1]) idx++;
  int ans = h;
  FOR(i, idx, 200200) chmin(ans, d[i]);
  cout << ans << '\n';
  




  
  return 0;
}

Measured memory_bytes: 5560
#include<bits/stdc++.h>
using namespace std;
vector<int> g[55];
int s[55],t[55];
void dfs(int used[],int k,int n){
  if(used[n])return;
  used[n]=1;
  for(int i=0;i<g[n].size();i++){
    if(n==s[k]&&g[n][i]==t[k])continue;
    if(n==t[k]&&g[n][i]==s[k])continue;
    dfs(used,k,g[n][i]);
  }
}

int main(){
  int n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int &a=s[i],&b=t[i];
    cin>>a>>b;
    a--,b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int ans=0;
  for(int i=0;i<m;i++){
    int used[55]={};
    dfs(used,i,0);
    for(int i=0;i<n;i++){
      if(used[i]==0){
	ans++;
	break;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import math


def f(a: float, b: float, theta: float) -> float:
    # 求める角度をθとすると三角形の底辺はb*tan(π/2-θ)となる
    # つまり以下の条件を満たす最大のθを求めればよい
    # b*tan(π/2-θ) * b * 1/2 >= x / a
    if theta > (90.0 - 0.0000000001):
        return 0.0
    t = b * math.tan(math.radians(90.0 - theta))
    if t <= a:
        return b * t / 2
    else:
        top = b - (a * math.tan(math.radians(theta)))
        return (b + top) * a / 2


def water_bottle(a: int, b: int, x: int) -> float:
    ok = 90.0
    ng = 0.0
    water = x / a
    for _ in range(10000):
        mid = (ok + ng) / 2.0
        if f(a, b, mid) < water:
            ok = mid
        else:
            ng = mid
    return ok


if __name__ == '__main__':
    abx = list(map(int, input().split()))
    result = water_bottle(abx[0], abx[1], abx[2])
    print(result)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
 int *arr=new int[4]();
  for(int i=0;i<n;i++)
  {
    string s;
    cin>>s;
    if(s=="AC")
      arr[0]++;
    if(s=="WA")
      arr[1]++;
    if(s=="TLE")
      arr[2]++;
    if(s=="RE")
      arr[3]++;
  }
  cout<<"AC x "<<arr[0]<<endl;
  cout<<"WA x "<<arr[1]<<endl;
  cout<<"TLE x "<<arr[2]<<endl;
  cout<<"RE x "<<arr[3]<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

const ll INF = 1LL << 60;

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

  vector<ll> s(n+1);
  rep(i, n) s[i+1] = s[i] + a[i];

  map<ll,ll> nums;// nums[値, 個数] または sums[値] = 個数 で取り出せる
  rep(i, n+1) nums[s[i]]++;

  ll ans = 0;
  for(auto it : nums){
    ll num = it.second;
    ans += num*(num-1)/2;
  }

  std::cout << ans << '\n';
}


Measured memory_bytes: 15104
d = {}
d["a"] = input()
d["b"] = input()
d["c"] = input()
cur = "a"
while True:
    if len(d[cur]) == 0:
        print(cur.upper())
        break
    nex = d[cur][0]
    d[cur] = d[cur][1:]
    cur = nex


Measured memory_bytes: 2940
#include <bits/stdc++.h> /**  I'm Klaus, NicKlaus :v **/
using namespace std;
#define ms(a,v) memset(a,v,sizeof a)
#define ios ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define ll long long
#define ld long double
int n, m, q;
vector<pair<pair<int,int>,pair<int,int>>> mp;
int A[11];
int ans = 0;
void go(int i, int prev){
	if( i == n ){
		int cur = 0;		
		for(auto j : mp ){
			if(A[j.first.second] - A[j.first.first] == j.second.first) cur += j.second.second;
		}
		ans = max(ans, cur);
		
		return;
	}
	for(int j=prev; j<=m; j++){
		A[i] = j;
		go(i+1,j);
	}
	return;
}
int main(){
	ios;
	#ifdef LOCAL_JUDGE
		//freopen("in_out/in.txt", "rt", stdin);
		//freopen("int_out/out.txt", "wt", stdout);
	#endif
	cin>>n>>m>>q;
	for(int i=0; i<q; i++){
		int a, b, c, d;
		cin>>a>>b>>c>>d;
		mp.push_back({{a-1,b-1},{c,d}});
	}
	go(0,1);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
typedef unsigned int uint;
typedef long long llong;
using namespace std;

int main(void) {
    cin.tie(0);
    int N;

    cin >> N;

    int *L = new int[N];

    for(int i=0; i<N; i++) {
        cin >> L[i];
    }

    sort(L,L+N);

    int maxLength = L[N-1];

    int sumLength = 0;

    for(int i=0;i<N-1;i++) {
        sumLength += L[i];
    }

    if(sumLength > maxLength) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
// 2020-08-30 18:03:20
// clang-format off
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

// clang-format on
void answer() {
  int n;
  cin >> n;
  vector<int> t(n), v(n);
  rep(i, n) {
    cin >> t[i];
    t[i] *= 2;
  }
  rep(i, n) {
    cin >> v[i];
    v[i] *= 10;
  }
  vector<int> vm(40040, 0);
  int ti = 0;
  {
    rep(i, n) {
      rep(j, t[i]) {
        int tj = ti + j + 1;
        vm[tj] = min(v[i], vm[tj - 1] + 5);
      }
      ti += t[i];
    }
  }
  vm[ti] = 0;
  {
    REPCM(i, n - 1, 0) {
      rep(j, t[i]) {
        int tj = ti - j - 1;
        chmin(vm[tj], min(v[i], vm[tj + 1] + 5));
      }
      ti -= t[i];
    }
  }
  ld ans = 0;
  rep(i, 40020) { ans += ld(vm[i] + vm[i + 1]) / ld(40); }
  cout << fixed << setprecision(15) << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3764
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3f;

struct node{
	LL id,lr,val;
	bool operator <(const node &nd)const{
		return nd.val > val;
	}
};
priority_queue <node> q;

node make_node(LL id,LL lr,LL val){
	node ret; ret.id = id; ret.lr = lr; ret.val = val; return ret;
}

LL n,l[500005],r[500005],sl = 0,sr = 0;
LL in[500005][2] = {0};
LL h[500005],hd[500005],sum = 0,ans = INF;

int main(){
	cin >> n;
	for(LL i = 1;i <= n;i ++){
		cin >> l[i] >> r[i]; sl += l[i]; sr += r[i];
		in[i][0] = 1; in[i][1] = 1;
		q.push(make_node(i,0,l[i]));
		if(q.size() > n){ in[q.top().id][q.top().lr] = 0; q.pop(); }
		q.push(make_node(i,1,r[i]));
		if(q.size() > n){ in[q.top().id][q.top().lr] = 0; q.pop(); }
	}
	for(LL i = 1;i <= n;i ++){
		h[i] = q.top().val; sum += h[i]; hd[i] = q.top().id;
		q.pop();
	}
	for(LL i = 1;i <= n;i ++){
		LL tmp = sum,tt = 0;
		if(!in[i][0] && !in[i][1]){
			tmp += l[i]; tmp += r[i];
			tmp -= h[1]; tmp -= h[2];
		}
		if(!in[i][0] && in[i][1]){
			tmp += l[i];
			tmp -= (hd[1] == i ? h[2] : h[1]);
		}
		if(!in[i][1] && in[i][0]){
			tmp += r[i];
			tmp -= (hd[1] == i ? h[2] : h[1]);
		}
//		cout << i << ' ' << tmp << ' ' << sum << endl;
		ans = min(ans,tmp);
	}
	ans = min(ans,min(sl,sr));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 18416
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <stack>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <sstream>
#include <iomanip>
using namespace std;


#define int int64_t
#define vi vector<int>
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define all(x) (x).begin(), (x).end()
#define vii vector< vector<int> >
#define rip(dp, n, m) vector< vector<int> > dp(n, vector<int>(m,0))
#define ff first
#define ss second
#define pii pair<int64_t, int64_t>
#define miv map<int, vector<int> >
#define mp make_pair
#define pb push_back
#define prr(x) cout << (#x) <<'	' << (x) << endl
#define pr(x) cout  << (x) << endl
#define f(i,n) for(i=0;i<n;i++)
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int> >
#define setbits(x)  __builtin_popcountll(x)
#define zrobits(x)  __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x) int x; cin>>x; while(x--)
#define FIO  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dr8[] = {1,1,0,-1,-1,-1, 0, 1};
int dc8[] = {0,1,1, 1, 0,-1,-1,-1};
int dr4[] = {1,0,0,-1};
int dc4[] = {0,1,-1,0};

int32_t main()
{
    FIO;
    int i, n, j, m, k, l, t;
    // w(X)
    {
       cin >> n >> k;
       vi graph[n];
       f(i,k)
       {
           int x, y;
           cin >> x >> y;
           x--, y--;
           graph[x].pb(y);
           graph[y].pb(x);
       }

       vb vis(n,true);
       k=0, t=0;
       for(i=0;i<n;i++)
       {
           if(vis[i])
           {
               t=0;
               queue<int> Q;
               Q.push(i);
               vis[Q.front()]=false;
               while(!Q.empty())
               {
                   for(auto it: graph[Q.front()]) 
                   {
                       if(vis[it])
                       {
                           Q.push(it);
                           vis[it]=false;
                       }
                   }
                   t++;
                   Q.pop();
               }

               k = max(t,k);
           }
       }

       cout << k << endl;
    }
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

int N, M, A[101];

int main() {
    cin >> N >> M;
    for_(i,0,N) cin >> A[i];

    double thr = accumulate(A, A+N, double()) / double(4 * M);

    int cnt = 0;
    for_(i,0,N) if (A[i] >= thr) ++cnt;
    puts(M <= cnt ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <cassert>
using namespace std;

//common
#define BR "\n"

#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef long long ll; typedef vector<long long> vl; typedef pair<long long,long long> pll; typedef vector<pair<long long,long long> > vpll;
typedef vector<string> vs; typedef long double ld;

//config
#define MODE_DEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//debug
#ifdef MODE_DEBUG
#define  DUMP(x)  cerr << #x << " = " << (x) <<endl
#define DEBUG(x) DUMP(x) << " (L" << __LINE__ << ")" << " " << __FILE__<<endl
#define CHECK(exp,act)  if(exp!=act){DUMP(exp);DEBUG(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#else
#define DUMP(x)
#define DEBUG(x)
#define CHECK(exp,act)
#define STOP(e)
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}
template<class T> inline string toString(const vector<vector<T>>& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

template<typename T,typename V> inline T mod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}

int encode(int h,int m,int s){
	return h*3600+m*60+s;
}
int getH(int t){
	return t/3600;
}
int getM(int t){
	return (t-getH(t)*3600)/60;
}
int getS(int t){
	return (t-getH(t)*3600-getM(t)*60)/1;
}

int main(){
	int C=3;
	REP(c,C){
		int h1,m1,s1;cin >> h1 >> m1 >> s1;
		int h2,m2,s2;cin >> h2 >> m2 >> s2;
		int t1=encode(h1, m1, s1),t2=encode(h2, m2, s2);
		int t=t2-t1;
		cout <<getH(t)<<" "<<getM(t) <<" "<<getS(t)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5;
struct edge{
    int to,cost;
};
ll ans=0;
const double eps=1-1e-7;
int d[305][305];
int vis[305][305];
int n;
int mp[305][305];
void floyd()
{
    for(int k=1;k<=n;k++)
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++)
            {
                if(i==k||k==j) continue;
              if(mp[i][j]==mp[i][k]+mp[k][j]) vis[i][j]=1;
              else if(mp[i][j]>mp[i][k]+mp[k][j]) ans=-1;
            }
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            int a;
            scanf("%d",&a);
            mp[i][j]=a;
        }
    }
    memset(vis,0,sizeof(vis));

    floyd();
    if(ans==-1)
    cout<<ans<<endl;
    else
    {
        for(int i=1;i<=n;i++)
            for(int j=1;j<i;j++)
        {
            if(vis[i][j]==0) ans+=mp[i][j];
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define UMap        std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd   ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm   ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs   ( llong n )          { return ( n < 0 ) ? -n : n; }
    template<class A, class B>inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B>inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        int r;
        read r;
        if ( r < 1200 ) echo "ABC" fin;
        elif ( r < 2800 ) echo "ARC" fin;
        else echo "AGC" fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); echo std::fixed << std::setprecision(8); int main_result = Rlyeh::call_of_Cthulhu(114514); return main_result;}


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

typedef long long ll;
const ll mod=1e9+7;
const int N=200000;

void Run()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int a[N],b[N];
list<char>v;
map<char,int>mp;
int main()
{
   Run();
   string s,t;
   cin>>s>>t;
   int f=0;
   for(int i=0;i<s.size();i++)
   {
       if(s[i]==t[i])
        f=1;
       else
       {
           f=0;
           break;
       }
   }
   if(f==1)
    cout<<"Yes";
   else
    cout<<"No";
}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int a[MAXN];
int main() {
	int n; read(n);
	for (int i = 1; i <= n; i++) {
		read(a[i]);
		if (a[i] % 2 != i % 2) {
			puts("No");
			return 0;
		}
	}
	int last = 0, Max = 0;
	for (int i = 1; i <= n; i++) {
		chkmax(Max, a[i]);
		if (Max == i) {
			bool flg = true, glg = true;
			for (int j = last + 1; j <= i; j++)
				if (a[j] != j) {
					if (j & 1) flg = false;
					else glg = false;
				}
			if (!flg && !glg) {
				puts("No");
				return 0;
			}
			if (flg && !glg) {
				int Max = 0, Nax = 0;
				for (int j = last + 1; j <= i; j++)
					if (j % 2 == 0) {
						if (a[j] == j) {
							puts("No");
							return 0;
						}
						if (a[j] > j) {
							if (a[j] < Max) {
								puts("No");
								return 0;
							}
							Max = a[j];
						} else {
							if (a[j] < Nax) {
								puts("No");
								return 0;
							}
							Nax = a[j];
						}
					}
			}
			if (glg && !flg) {
				int Max = 0, Nax = 0;
				for (int j = last + 1; j <= i; j++)
					if (j % 2 == 1) {
						if (a[j] == j) {
							puts("No");
							return 0;
						}
						if (a[j] > j) {
							if (a[j] < Max) {
								puts("No");
								return 0;
							}
							Max = a[j];
						} else {
							if (a[j] < Nax) {
								puts("No");
								return 0;
							}
							Nax = a[j];
						}
					}
			}
			last = i;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1408
sx, sy, tx, ty = (int(x) for x in input().split())
print_list = []
# 一回目
for i in range(abs(tx - sx)):
    print_list.append("R")
for i in range(abs(ty - sy)):
    print_list.append("U")
# 二回目
for i in range(abs(tx - sx)):
    print_list.append("L")
for i in range(abs(ty - sy)):
    print_list.append("D")
# 三回目
print_list.append("D")
for i in range(abs(tx - sx) + 1):
    print_list.append("R")
for i in range(abs(ty - sy) + 1):
    print_list.append("U")
print_list.append("L")
# 四回目
print_list.append("U")
for i in range(abs(tx - sx) + 1):
    print_list.append("L")
for i in range(abs(ty - sy) + 1):
    print_list.append("D")
print_list.append("R")
print("".join(print_list))


Measured memory_bytes: 3188
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"i,o,t,j,l,s,z=map(int,input().split())\n"
"a=(i//2+j//2+l//2)*2\n"
"print([a,max(a,((i-1)//2+(j-1)//2+(l-1)//2)*2+3)][not(not(i and j and l))]+o)\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 3280
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    s = input()
    sl = [i for i in s]
    n = len(s)-1
    sublist = [-1]*n
    anslist = []
    ans = []
    for i in range(1<<n):
        for j in range(n):
            if (i>>j)&1:
                sublist[j] = "+"
        anslist.append(sl[0])
        for j in range(n):
            if sublist[j] == "+":
                anslist.append(sublist[j])
                anslist.append(sl[j+1])
            else:
                anslist.append(sl[j+1])
        ans.append(eval("".join(anslist)))
        anslist = []
        sublist = [-1]*n
    print(sum(ans))
if __name__ == "__main__":
    main() #endline===============================================
    

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

int a[101];


int main(void) {

	int i, j;
	int n;
	int min, max;
	int distance;

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

	min = a[0];
	max = a[0];

	for (i = 0; i < n; i++) {
		for (j = i; j < n; j++) {
			if (a[j] < min) {
				min = a[j];
			}
			if (a[j] > max) {
				max = a[j];
			}
		}
	}
	distance = max - min;
	printf("%d", distance);	   	 

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;

    if (u == s)
    {
        cout << --a << " " << b << endl;
    }
    else
    {
        cout << a << " " << --b << endl;
    }
       
}


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

	std::string* in;
	int nline;
	int idx;

int calc(int lv = 0, char kind = '+') {
	int ret = 0;
	if(kind == '*') ret = 1;

	while(true){
	//	std::cout << "idx:" << idx << "\n";
		if(idx >= nline) break;

		std::string& cs = in[idx];
		int clv = 0;
		for(std::string::iterator itr = cs.begin(); itr != cs.end() && *itr == '.'; itr++, clv++);
		if(lv != clv) break;
		idx++;

		char cc = cs[lv];
	//	std::cout << "cc:" << cc << "\n";
		int cnum;

		if(cc == '+' || cc == '*'){
			cnum = calc(lv+1, cc);
		}else{
			cnum = cc - '0';
		}

	//	std::cout << "cnum=" << cnum << "\n";

		if(kind == '*') {
			ret *= cnum;
		}else{
			ret += cnum;
		}

	}
	return ret;
}

int main(void) {

	int ret;

	while(true){
		std::cin >> nline;
		if(!nline) break;

		in = new std::string[nline];
		for(int i=0; i<nline; i++) std::cin >> in[i];
		idx = 0;

		std::cout << calc() << "\n";
	}

	return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n],sum=0;
    map<ll,ll>mp;
    for(ll i=0;i<n;i++){
            cin>>a[i];
            sum+=a[i];
            mp[a[i]]++;
    }
    ll q;
    cin>>q;
    while(q--){
      ll b,c;
      cin>>b>>c;
      sum+=c*mp[b]-b*mp[b];
      mp[c]+=mp[b];
      mp[b]=0;
      cout<<sum<<endl;
    }
    return 0;
}



Measured memory_bytes: 10228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
int main(){
    int n ;
    int mx = 0, mn=10*10*10*10*10*10*10*10*10;
    cin >> n;
    rep(i,n){
    int a ; cin >> a;
    mx=max(a,mx);
    mn=min(a,mn);
    }
   cout << mx-mn << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    ll A[6];
    rep(i,3){
        cin >> A[i];
    }
    //sort(A,A+3);
    cout << (A[2]>=A[0] && A[2]<=A[1] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
N = int(input())
K = int(input())
S = [0]+[int(c) for c in str(N)]
L = len(S)-1
dp0 = [[0]*(K+1) for i in range(L+1)]
dp1 = [[0]*(K+1) for i in range(L+1)]
dp0[0][0] = 0
dp1[0][0] = 1
for i in range(1,L+1):
  for j in range(K+1):
    if j==0:
      if S[i]>0:
        dp0[i][j] = dp0[i-1][j]+dp1[i-1][j]
      else:
        dp0[i][j] = dp0[i-1][j]
    else:
      if S[i]>0:
        dp0[i][j] = dp0[i-1][j]+dp0[i-1][j-1]*9+dp1[i-1][j]+dp1[i-1][j-1]*(S[i]-1)
        dp1[i][j] = dp1[i-1][j-1]
      else:
        dp0[i][j] = dp0[i-1][j]+dp0[i-1][j-1]*9
        dp1[i][j] = dp1[i-1][j]
print(dp1[-1][-1]+dp0[-1][-1])

Measured memory_bytes: 39860
N = int(input())
Xs = list(map(int,input().split()))
ans = 0
ansCandidate = 0
for j in range(min(Xs),max(Xs)):
    ansCandidate = 0
    for i in range(N):
        ansCandidate += (Xs[i] - j)**2
    if j == min(Xs):
        ans = ansCandidate
    ans = min(ans,ansCandidate)
print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
#include<cstdio> 
#define INF 0x3f3f3f3f

using namespace std;

const int N=20;
int c[N];
int n,m,x;
int a[N][N];
int ans=INF;
int main()
{
	cin>>n>>m>>x;
	for(int i=1;i<=n;i++){
		cin>>c[i];
		for(int j=1;j<=m;j++){
			cin>>a[i][j];
		}
	}
	for(int i=1;i<(1<<n);i++){
		int sum=0;//记录每种状态所花的钱 
		int res[N];//记录每种算法掌握程度 
		memset(res,0,sizeof(res));
		for(int j=0;j<n;j++){
			if(i&(1<<j)){//如果选择j+1本书 
				for(int k=1;k<=m;k++){
					res[k]+=a[j+1][k];
				}
				sum+=c[j+1];
			}
		}
		bool flag=0;
		for(int j=1;j<=m;j++){
			if(res[j]<x){
				flag=1;
				break;
			}
		}
		if(!flag) ans=min(sum,ans);
	}
	if(ans==INF) puts("-1");
	else cout<<ans<<endl;	
	return 0;
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int K = int.Parse(str[1]);
		double ans = 0;
		for(var i=1;i<=N;i++){
			int c = i;
			int d = 1;
			while(c < K){
				c *= 2;
				d *= 2;
			}
			ans += (double)1/d/N;
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define lw(vc,num) lower_bound(vc.begin(), vc.end(), num) - vc.begin();
#define hg(vc,num) upper_bound(vc.begin(), vc.end(), num) - vc.begin();
#define bn(v,x) binary_search (v.begin(), v.end(), x)
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
bool isprime(int n)
{
    if(n == 1) return false;
    if(n == 2 || n == 3) return true;
    if(n%2 == 0 || n%3 == 0) return false;
    for(int i=5; i*i<=n; i+=6){
        if((n%i == 0)||(n%(i+2) == 0)) return false;
    }
    return true;
}
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}
int main()
{
    fio;
   int x,y;
   cin>>x>>y;
int k = min(x,y);
int k1 = max(x,y);
loop(i,0,k1)
cout<<k;
cout<<endl;
    return 0;
}



Measured memory_bytes: 3620