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

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


typedef long long ll;
typedef pair<ll, ll> P;

ll dp[110][110000];
int main()
{
  REP(i, 110) REP(j, 110000) dp[i][j] = LLINF;
  int N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  REP(i, N) cin >> w[i] >> v[i];

  dp[0][0] = 0;
  REP(i, N) {
    REP(j, 100001) {
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
    }
  }

  int ans;
  REP(i, 100001) {
    if (dp[N][i] <= W) ans = i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 94720
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<string> vs;
int n;
void dfs(string s,int cnt,char c){
  if(cnt==n){
    cout << s << endl;
    return;
  }
  for(int i=0;i<c-'a'+2;i++){
    char x=i+'a';
    dfs(s+x,cnt+1,max(c,x));
  }
}
int main(){
  cin >> n;
  string s="a";
  dfs(s,1,'a');
  sort(vs.begin(),vs.end());
  for(auto& x:vs)cout << x << endl;
}


Measured memory_bytes: 1536
#include <iostream>
using namespace std;
 
int main() {
	int n; cin >> n; bool OK = false;
	for (int j = 0; j <= n / 4; j++) {
		for (int k = 0; k <= n / 7; k++) {
			if (4 * j + 7 * k == n) OK = true;
		}
	}
	if (OK == false) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 256
main :: IO ()
main = do
  [w,h,x,y] <- map (read :: String -> Int) . words <$> getLine
  putStrLn $ show ((fromIntegral w)*(fromIntegral h)/2) ++ " " ++ show (ans w h x y)

ans :: Int -> Int -> Int -> Int -> Int
ans w h x y
  | w == 2*x && h == 2*y = 1
  | otherwise = 0

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  ll h, w, x, y;
  cin >> w >> h >> x >> y;
  printf("%.9f ", double(h) * double(w) / 2.0);
  if (x + x ==  w && y + y ==  h)
    puts("1");
  else
    puts("0");
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define Rep1(i,k,n) for(int i=k ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

double inverse(int x){
    return (1.0)/x;
}

bool isPrime(int x){
    if(x == 1) return false;

    for(int i=2;i*i <= x; i++){
        if(x%i == 0) return false;
    }

    return true;
}

class UnionFind{
private:
        vector<int> par,rank,sizes;
        int tree;

public:
        explicit UnionFind(const int n) : tree(n){
            par.resize(n+1);
            rank.resize(n+1);
            sizes.resize(n+1);
            rep(i,n){
                par[i] = i;
                sizes[i] = 1;
            }
        }

        ~UnionFind() = default;

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

        int find(int x){ return root(x);}

        void unite(int x, int y) {
            x = root(x);
            y = root(y);
            if (x == y) return;

            if (rank[x] < rank[y]) swap(x, y);
            par[y] = x;
            tree--;
            sizes[x] += sizes[y];
            if (rank[x] == rank[y]) rank[x]++;
        }

        bool same(int x, int y){
            return root(x) == root(y);
        }

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

        int sumTree(){
            return tree;
        }
};
int n,q; 
vector<vector<int>> e;
vector<bool> visit;
vector<int> ans;
vi s;

void dfs(int x,int start){
    //cout << x << endl;
    int score = start + s[x];
    visit[x] = true;
    rep(i,e[x].size()){
        if(!visit[e[x][i]]) dfs(e[x][i],score);
    }
    ans[x] = score;
}


int main(){
    cin >> n >> q;
    
    e.resize(n+1);
    s.resize(n+1);
    visit.assign(n,false);
    ans.resize(n);
    rep(i,n-1){
        int a,b;  cin >> a >> b;
        e[a-1].push_back(b-1);
        e[b-1].push_back(a-1);
    }
    
    rep(i,q){
        int x,q; cin >> x >> q;
        s[x-1] += q;
    }
    //cout << "reach" << endl;

    dfs(0,0);

    rep(i,n){
        cout << ans[i] << (i == n-1 ? '\n' :  ' ');
    }

}


Measured memory_bytes: 24320
N = int(input())
a = [int(_) for _ in input().split()]
a = sorted(a)
s = set(a)

if len(s) == 1:
    if a[0] == 0:
        print("Yes")
    else:
        print("No")
elif len(s) == 2:
    if N % 3 != 0:
        print("No")
    else:
        if a.count(0) == N//3:
            print("Yes")
        else:
            print("No")
elif len(s) == 3:
    if a[0] == 0:
        print("No")
    else:
        L = []
        for i in s:
            L.append(i)
        
        if L[0] ^ L[1] == L[2]:
            p = a.count(L[0])
            q = a.count(L[1])
            r = a.count(L[2])
            if p == q and q == r:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
else:
    print("No")

Measured memory_bytes: 14116
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  ll h;
  cin >> h;
  ll ans = 0;
  ll num = 1;
  while(h!=1) {
    ans += num;
    h = h/2;
    num *= 2;
  }
  ans+=num;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N, X = map(int, input().split())
x_list = [int(e) for e in input().split()]

#数直線上に N 個の都市があり、i 番目の都市は座標 xiにあります。
#あなたの目的は、これら全ての都市を 1度以上訪れることです。
#あなたは、はじめに正整数 Dを設定します。
#その後、あなたは座標 Xから出発し、以下の移動 1、移動 2を好きなだけ行います。

#移動 1: 座標 y から座標 y+D に移動する
#移動 2: 座標 y から座標 y−D に移動する

#全ての都市を 1度以上訪れることのできる D の最大値を求めてください。

x_list = [abs(x_list[i]-X) for i in range(N)]

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors

for divisors in make_divisors(min(x_list)):
  devided_list = [x_list[i]%divisors for i in range(N)]
  if sum(devided_list)==0:
    print(divisors)
    break

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

int main()
{
    ll N, Y; cin >> N >> Y;

    for (int i = 0; i <= N; ++i) {
        for (int j = 0; j <= N; ++j) {
            int k = N - i - j;
            if (k < 0) continue;
            if (i * 10000 + j * 5000 + k * 1000 == Y) {
                cout << i << " " << j << " " << k << endl;
                exit(0);
            }
        }
    }
    cout << "-1 -1 -1" << endl;


}


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

int main() {
    int h, w, n, cnt = 0;
    cin >> h >> w >> n;
    int maxv = max(h, w);
    int minv = min(h, w);
    for (int i = 0; i < minv; i++)
    {
        n -= maxv;
        cnt++;
        if(n <= 0) {
            cout << cnt << endl;
            return 0;
        }
    }
    for (int i = 0; i < maxv; i++)
    {
        n -= minv;
        cnt++;
        if(n <= 0) {
            cout << cnt << endl;
        }
    }
    
    
    return 0;
}

Measured memory_bytes: 3564
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
ll n,m,ans;
void f()
{
	if((m/2)<n) 
	{
		ans=m/2;
		return;
	}
	ans=n;
	m=m-n*2;
	ans+=m/4;
}
int main()
{
	scanf("%lld%lld",&n,&m);
	f();
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int N;
	if(scanf("%d",&N)<1)
		return -1;

	int A[N];
	int B[N];
	for(int i=1;i<N;i++)
	{
		if(scanf("%d",&A[i])<1)
			return -1;
		B[i]=0;
	}

	for(int i=1;i<N;i++)
	{
		B[A[i]]++;
	}

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

Measured memory_bytes: 3252
N = int(input())
import itertools

d = {}
k = 1
while k*(k-1)/2 < 10**5:
    d[int(k*(k-1)/2)] = k
    k += 1

if N not in d.keys():
    print("No")

else:
    print("Yes")
    k = d[N]
    output = [[] for _ in range(k)]
    print(k)

    comb_list = list(itertools.combinations(list(range(k)), 2))
    for n, comb in zip(range(1, N+1), comb_list):
        output[comb[0]].append(n)
        output[comb[1]].append(n)

    length = len(output[0])
    for l in output:
        print(length, *l)

Measured memory_bytes: 16684
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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



ll N;
ll M;

vector<ll> divisor(ll n) {
  vector<ll> ret;

  for (ll i=1;i*i<=n;i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }

  sort(All(ret));
  return ret;
}

int main () {
  cin >> N >> M;

  vector<ll> d = divisor(M);
  auto iter = lower_bound(All(d), N);

  cout << M / (*iter) << "\n";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

mint dp[100005][2];

int main(){
    string l;
    cin >> l;
    int n = l.size();
    dp[0][0] = mint(1);

    rep(i, n+1) {
        if (i==0) continue;
        if (l[i-1]=='0') {
            dp[i][0] = dp[i-1][0];
            dp[i][1] = dp[i-1][1] * 3;
        }
        else {
            dp[i][0] = dp[i-1][0] * 2;
            dp[i][1] = dp[i-1][1] * 3;
            dp[i][1] += dp[i-1][0];
        }
    }

    mint ans = dp[n][0] + dp[n][1];
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2048
public class Main {
  private static void solve() {
    int n = ni();
    char[] s = ns();

    int cnt = 0;
    for (int i = 0; i <= n - 3; i++) {
      if (new String(s, i, 3).equals("ABC")) {
        cnt++;
      }
    }
    System.out.println(cnt);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 22740
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 100000;
int main()
{
  int n,i;
  long long t,u,s=0;
  int a[N_MAX];
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a[i];
    s+=a[i];
  }
  s/=2;
  t=s;
  for(i=1;i<n;i+=2)
    t-=a[i];
  cout << t*2;
  for(i=1;i<n;i++){
    u=t;
    t=a[i-1]-u;
    cout << " " << t*2;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<string>
using namespace std;
 
int main(){
  string s;
  int a;
  cin >> s;
  a = s.size();
  if(s.at(a - 1) == 's'){
    cout << s << "es";
  }
  else{
    cout << s << "s";
  }
}

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

using namespace std;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int k, x;
    cin >> k >> x;

    if(500*k >= x) cout << "Yes\n";
    else cout << "No\n";
 
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vector<int64_t> a(n);
  rep(i, n) {
    int64_t num;
    cin >> num;
    a.at(i) = num;
  }
  int count = 1;
  string now = "end";
  for (int i = 0; i < n-1; i++) {
    if (now == "end") {
      if (a.at(i) < a.at(i+1)) {
        now = "increase";
      }
      else if (a.at(i) > a.at(i+1)) {
        now = "decrease";
      }
    }
    else if (now == "increase") {
      if (a.at(i) > a.at(i+1)) {
        count++;
        now = "end";
      }
    }
    else if (now == "decrease") {
      if (a.at(i) < a.at(i+1)) {
        count++;
        now = "end";
      }
    }
  }
  cout << count << endl;
}



Measured memory_bytes: 3988
H,W = gets.split.map(&:to_i)

r = *0..W # k 段目の状態。[落水点] -> 最近蛇口位置、もしくはスキップ情報。
r[0] = 1 # 位置 0 は欠番
dmin = 0 # 横移動距離 = 落水点 - 最近蛇口位置
nmin = [0]*W
nmin[dmin] = W # r に横移動距離 0 が W 個

puts $<.map.with_index(1){|ln,k|
	next -1 if dmin < 0
	a,b = ln.split.map(&:to_i)

	i,c = a
	until b < i
		j = r[i]
		if i < j
			i = j # スキップ
		else
			c = j # 最近蛇口メモ
			nmin[i-c] -= 1 # 落水点消滅につき距離カウント減算
			i += 1
		end
	end

	if c && b+1 < (r[b+1]||b) # b+1 に新しい落水点
		r[b+1] = c
		nmin[b+1-c] += 1
	end
	r.fill([r[b+1]||b+1,b+1].max,a..b)

	dmin = (dmin...W).find{|d| 0<nmin[d] }||~k
	next k+dmin
}


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

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

	int N = s.size();

	sort(s.begin(), s.end());

	int z = 0, o = 0;

	for (int i = 0; i < N; ++i) {
		if (s[i] == '0') {
			++z;
		}
		if (s[i] == '1') {
			++o;
		}
	}

	cout << min(z, o) * 2 << endl;
}


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

int main()
{
    string s;
    cin >> s;
    for(int i = 0; i < s.size()-1; i++)
    {
        if(s[i] == s[i+1])
        {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	vector<int> vs(n), cs(n);
	for (auto &v : vs)
	{
		cin >> v;
	}
	for (auto &c : cs)
	{
		cin >> c;
	}

	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans += max(0, vs[i] - cs[i]);
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

using ll = long long;

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 9; ++i) {
        if (n % i == 0 && n / i <= 9) {
            cout << "Yes" << endl;
            return 0;
        } 
    }
    cout << "No" << endl;

    return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int s, f = 0;
  s = S.size();
  for (int i = 0; i < s; i++) if (S.at(i) != T.at(i)) f++;
  cout << f << endl;
  return 0;
}

Measured memory_bytes: 3912
import numpy as np

D = int(input())
c = np.array( list(map(int, input().split())) )
#
s = [[] for i in range(D)]
for i in range(D):
  s[i] = np.array( list(map(int, input().split())) )
#
v = 0
cc =  np.array( [0]*26 )
last = np.array( [-1]*26 )
for d in range(D):
  cc += c
  av = s[d] - sum( cc ) + cc
  av2 = av + cc + c
  m = max(av2)
  for t in range(26):
    if av2[t] == m:
      cc[t] = 0
      v += av[t]
      print(t+1)
      break
#
#print( v )


Measured memory_bytes: 27012
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>; // intの2次元の型に vvi という別名をつける
const ll llMAX=9223372036854775807LL; 
const ll llMIN=-9223372036854775808LL;

void myprint1D(vi &data)
{
  REP(i,data.size())
    cout<<data[i]<<" ";
  cout<<endl;
}

//配列を[y][x]で表示
void myprint2D_T(vvi &data)
{
  REP(i,data.size())
    myprint1D(data[i]);
}

//配列を[x][y]で表示
void myprint2D(vvi &data)
{
  ll l1=data.size();
  ll l2=data[0].size();
  REP(j,l2){
    REP(i,l1)
      cout<<data[i][j]<<" ";
    cout<<endl;
  }
}

//print(a,b...)って使い方
void print1(ll a){cout<<a<<endl;}
void print2(ll a,ll b){cout<<a<<" "<<b<<endl;}
void print3(ll a,ll b,ll c){cout<<a<<" "<<b<<" "<<c<<endl;}
void print4(ll a,ll b,ll c,ll d){cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;}
void print5(ll a,ll b,ll c,ll d,ll e){cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;}


ll n,k,x,y;


//moddivとnCk
//c剰余下でaをbで割った値
ll moddiv(ll a,ll b,ll c){
	ll x0=c,x1=b,x2,n0=0LL,n1=1LL,n2,t=a%b,m,ans;
	if (t==0LL) return a/b;
		for(int i=0;i<900;i++){
      m=x0/x1;
      x2=x0-x1*m;
      n2=(n0-m*n1)%c;
      if (x2==1LL){
        ans=(n2+c)%c;
        break;
      }
      x0=x1;x1=x2;
      n0=n1;n1=n2;
    }
	return (a+((t*ans)%c)*b-t)/b;
}
//剰余の割ざん

//aのn乗 mod c
ll expmod(ll a,ll n,ll c){
  ll ans=1LL,aa=a,beki=n;
  for(int i=0;i<64;i++){
    if (beki%2==1LL) ans=ans*aa%c;
    aa=aa*aa%c;
    beki/=2LL;
    if (beki==0LL)break;
  }
  return ans;
}

//nCk
vi mulmod(500001);//0!,1!,2!,3!,4!,,,,
void first_nCk(){
  mulmod[0]=1LL;
  for(ll i=1;i<500001;i++){
    mulmod[i]=mulmod[i-1]*i%MOD;
  }
}
ll nCk(ll nn,ll kk){
  return moddiv(mulmod[nn],mulmod[kk]*mulmod[nn-kk]%MOD,MOD);
}

ll modinv(ll a,ll b){
  return moddiv(1,a,b);
}

ll garner(ll a,ll b,ll ar,ll br){
  return ar+(br-ar+b)%b*modinv(a,b)%b*a;
}
ll garner2(ll a,ll b,ll ar,ll br){
  ar%=a;
  br%=b;
  ll ret=ar+  ( ((br-ar)%b)*(moddiv(1,a,b)%b) +b )%b *a;
  return ret;
}

ll gcd(ll a,ll b){
  ll r = a % b;
  while(r!=0LL){
    a = b;
    b = r;
    r = a % b;
  }
return b;
}





int main(){
  ll ans=0;
  cin >> n;

  if (n==1){
    cout<<1<<endl;
    return 0;
  }
  if (n%2==0){
    ans=2*n-1;
  }else{
    ans=n-1;
  }

  n*=2;
  for(ll i=2;i<=n+2;i++){
    if (i*i>n)break;
    if (n%i==0){
      ll val0=i;
      ll val1=n/i;
      if (val0==1)continue;
      if (val1==1)continue;
      if (gcd(val0,val1)==1){
        ll ans0=garner2(val0,val1,1,0)-1;
        ll ans1=garner2(val0,val1,0,1)-1;
        //ans0%=val0*val1;
        //ans1%=val0*val1;
        if (ans0>1)
          ans=min(ans,ans0);
        if (ans1>1)
          ans=min(ans,ans1);
      }
    }
  }


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

Measured memory_bytes: 7064
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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;
}

int main(void) {
    ll A, B, C;
    char c;
    cin >> A >> B >> c >> C;
    // printf("%lld, %lld, %lld\n", A, B, C);

    ll x = A * (B * 100 + C);
    // printf("%lld\n", x);
    x = x / 100;
    cout << x << endl;

    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
// template<class T> T gabs(const T& x) { return max(x, -x); }
// #define abs gabs

i64 n;
string s;

// false: S, true: W
vector<bool> f(bool c, bool d) {
    vector<bool> t(n);
    t[0] = c;
    t[1] = d;
    for (int i = 1; i < n + 1; ++i) {
        int l = (i - 1 + n) % n, m = i % n, r = (i + 1) % n;
        bool a = s[m] == 'x';
        bool b = a ^ t[m];
        bool x = b ^ t[l];
        if (i >= n - 1) {
            if (t[r] != x) {
                return vector<bool>();
            }
        } else {
            t[r] = x;
        }
    }
    return t;
}

int main() {
    cin >> n >> s;
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
            auto t = f(i, j);
            if (!t.empty()) {
                for (int i = 0; i < n; ++i) {
                    cout << "SW"[t[i]];
                }
                cout << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 576
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
#define int ll
signed main(){
    int n; cin>>n;
    vi v(n);rep(i,n)cin>>v[i];
    map<int,int>mp;
    sort(all(v),greater<int>());
    vector<int>hoge;
    rep(i,n){
        if(mp[v[i]]==0)hoge.push_back(v[i]);
        mp[v[i]]++;
    }
    int cnt=0;
    for(int i=0;i<hoge.size();i++){
        if(mp[hoge[i]]<2)continue;
        if(mp[hoge[i]]>=4&&cnt==0){cout<<hoge[i]*hoge[i]<<endl; return 0;}
        if(cnt!=0){cout<<cnt*hoge[i]<<endl; return 0;}
        cnt=hoge[i];
    }
    cout<<0<<endl;
}

Measured memory_bytes: 8052
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll dp[4000][1 << 13];

void init()
{
    for (int i = 0; i < 4000; i++)
    {
        for (int j = 0; j < (1 << 13); j++)
        {
            dp[i][j] = LLINF;
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    init();
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    vector<int> c(m);
    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
        for (int j = 0; j < b[i]; j++)
        {
            int tmp;
            cin >> tmp;
            tmp--;
            c[i] |= (1 << tmp);
        }
    }
    dp[0][0] = 0;
    for (int i = 0; i < m; i++)
    {
        for (int S = 0; S < (1 << n); S++)
        {
            int next = S | c[i];
            chmin(dp[i + 1][S], dp[i][S]);
            chmin(dp[i + 1][next], dp[i][S] + a[i]);
        }
    }
    if (dp[m][(1 << n) - 1] == LLINF)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << dp[m][(1 << n) - 1] << endl;
    }
}


Measured memory_bytes: 256384
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int k;
    cin >> k;
    int ans[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    cout << ans[k - 1] << "\n";

    return 0;
}



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

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    lucas0 = 2
    lucas1 = 1
    lucas = lucas0 + lucas1
    prev_lucas = lucas1
    for i in range(2, n):
        next_lucas = lucas + prev_lucas
        prev_lucas = lucas
        lucas = next_lucas
    print(lucas)


Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<complex>
#define lol(i,n) for(int i=0;i<n;i++)
#define out(x) cout<<(x?"AC":"WA")<<endl;
#define mod 1000000007
typedef long long ll;

using namespace std;

int main(){
    string s;cin>>s;
    bool ok=false;
    if(s[0]=='A')ok=true;
    int cnt=0;
    for(int i=2;i<s.size()-1;i++)if(s[i]=='C')cnt++;
    if(cnt!=1)ok=false;
    for(int i=1;i<s.size();i++){
	if(s[i]!='C'){
	    if(!('a'<=s[i]&&s[i]<='z'))ok=false;
	}
    }
    out(ok);
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
    ans += min(A[i],B[i]) + min(A[i+1],B[i]-min(A[i],B[i]))
    A[i+1] = A[i+1] - (min(A[i+1],B[i]-min(A[i],B[i])))
print(ans)

Measured memory_bytes: 18624
// " --- IN THE NAME OF ALLAH --- " // ;)
// ------------sphr_agz------------ // ;)
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

typedef long double ld;
typedef long long int lli;
typedef pair <lli, lli> pii;
#define pb push_back
#define recout(x) return cout << (x), 0
#define f first
#define s second
#define fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define stp(x) cout << setprecision(x) << fixed
#define mk make_pair
#define all(x) x.begin(), x.end()
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
const lli N = 3e3 + 10, N2 = 2e5, delta = 46639, mod = 1e9 + 7, oo = 1e18, LOG = 20, SQ = 300;
const ld PI = 3.141592653589793;

lli dp[N][N], a[N];

int32_t main() {
	fast;
	lli n;
	cin >> n;
	for (lli i = 0; i < n; i++) {
		cin >> a[i];
		dp[i][1] = a[i];
	}
	for (lli j = 2; j <= n; j++)
		for (lli i = 0; i + j <= n; i++)
			dp[i][j] = max (a[i] - dp[i + 1][j - 1], a[i + j - 1] - dp[i][j - 1]);
	cout << dp[0][n] << '\n';
	return 0;
}


Measured memory_bytes: 70016
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

#define REP(i,m,n) for(int i=(m); i<(n); i++)
#define RREP(i,n,m) for(int i=(n);i>=(m); i--)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30)-1);
const ll linf = (1LL<<60);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll wa[200005];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    wa[0] = 0;
    REP(i,1,n+1) wa[i] = wa[i-1]+i;
    REP(i,k,n+1)
    {
        ans += (wa[n] - wa[n-i]) - wa[i-1] + 1;
        ans %= mod;
    }
    cout << ans+1 << endl;
    return 0;
}


Measured memory_bytes: 5168
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	//iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll
void solve() {
	int n;
	cin >> n;
	ll geko = 1;
	for (int q = 1;; ++q) {
		geko *= 3;
		if (n <= geko) {
			cout << q << endl;
			return;
		}
	}
}
#undef int
int main() {
	init();
	solve();
}


Measured memory_bytes: 3108
#include <iostream>
using namespace std;
int main(void){
    
  int a, b;
  cin >> a >> b;
  if (a > b){
      cout << a-b << endl;
  }
  else if(a < b){
      cout << b-a << endl;
  }
    else if(a==b){
        cout << a-b << endl;
    }
}



Measured memory_bytes: 3092
#include<stdio.h>

int main(){
  int A[100],N,i,j,a,count=0,temp;
  scanf("%d",&N);
  for(a=0;a<N;a++){
    scanf("%d",&A[a]);
  }
    for(i=0;i<N;i++){
      for(j=N-1;j>=i+1;j--){
      if(A[j]<A[j-1]){
	temp=A[j];
	A[j]=A[j-1];
	A[j-1]=temp;
	count++;
      }
     
    }
      if(i!=N-1){
       printf("%d ",A[i]);
      }
      else printf("%d",A[i]);
  }
    printf("\n%d",count);
    printf("\n");
  return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

vector<string> split(const string &s, char delim) {
    vector<string> elems;
    stringstream ss(s);
    string item;
    while (getline(ss, item, delim)) {
    if (!item.empty()) {
            elems.push_back(item);
        }
    }
    return elems;
}

int main() {
  ll a;
  cin >> a;
  string b;
  cin >> b;
  auto sp = split(b,'.');
  ll c = stoi(sp[0]);
  ll d = stoi(sp[1]);
  ll ans = a*c;
  ans+= a*d/100;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;

int main(){
    while(1){
        int ans;
        ans = 0;
        string num;
        cin >> num;
        if(num[0] == '0')break;

        for (int i = 0; i < num.size(); i++)

        {
            ans += num[i]-'0';
        }
        printf("%d\n",ans);
        
    }

    return 0;
}


Measured memory_bytes: 3356
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<node> li = new ArrayList<node>();
        for(int i = 0; i < n; i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            node nd = new node(x,y);
            li.add(nd);
        }
        Boolean[] bools = new Boolean[n];
        Arrays.fill(bools,false);
        double ans = 0;
        for(int i = 0 ; i < n; i++){
            bools[i] = true;
            ans += totalLength(li,bools,i,(double)0);
            bools[i] = false;
        }
        System.out.println(ans/totalDivide(n));
    }
    
    private static double totalLength(List<node> li, Boolean[] bools, int now, double len){
        if(!Arrays.asList(bools).contains(false)){
            return len;
        }
        double ans = 0;
        for(int i = 0; i < li.size(); i++){
            if(bools[i]){
                continue;
            }
            double tmp = Calc2Roads(li.get(now), li.get(i));
            bools[i] = true;
            len += tmp;
            ans += totalLength(li,bools,i,len);
            bools[i] = false;
            len -= tmp;
        }
        return ans;
    }

    private static double totalDivide(int n){
        double ret = 1;
        for(int i = 1; i <= n; i++){
            ret *= i;
        }
        return ret;
    }

    private static double Calc2Roads(node n1,node n2){
        double x = Math.abs(n1.getX()-n2.getX());
        double y = Math.abs(n1.getY()-n2.getY());
        double len = Math.pow(x,2) + Math.pow(y,2);
        return Math.pow(len, 0.5);
    }
}

class node{
    private int x,y;
    public node(int x, int y){
        this.x = x;
        this.y = y;
    } 
    public int getX(){
        return this.x;
    }
    public int getY(){
        return this.y;
    }
}

Measured memory_bytes: 25636
#include <stdio.h>

int main()
{
  int w;
  while(scanf("%d", &w), w != -1){
    int bill = 0;
    if(w < 10){
      bill = 1150;
    }else if(w < 20){
      bill = 1150 + (w-10) * 125;
    }else if(w < 30){
      bill = 2400 + (w-20) * 140;
    }else{
      bill = 3800 + (w-30) * 160;
    }
    printf("%d\n", 4280-bill);
  }
  return 0;
}

Measured memory_bytes: 600
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var array = new int[3][];
            
            for(int i=0; i<3; i++){
                array[i] = cin.ReadIntArray(3);
            }
            
            var a2 = 0; var a3 = 0; var b1 = 0; var b2 = 0; var b3 = 0;
            
            var end = array[0][0];
            
            for(int a1 = 0; a1<=end; a1++){
                
                b1 = array[0][0] - a1;
                b2 = array[0][1] - a1;
                b3 = array[0][2] - a1;
                
                a2 = array[1][0] - b1;
                
                if(a2 <0 || a2 + b2 != array[1][1] || a2 + b3 != array[1][2]) continue;
                
                a3 = array[2][0] - b1;
                
                if(a3 < 0 || a3 + b2 != array[2][1] || a3 + b3 != array[2][2]) continue;
                
                WriteLine("Yes");
                return;
                
            }
            
            WriteLine("No");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#define ll long long
using namespace std;
map<int,int>mp;
int main()
{
    string s;
    while(cin>>s){
      int n=s.size();
      mp.clear();
      for(int i=0;i<n;i++)mp[s[i]-'a']++;
      n=0;
      for(int i=0;i<26;i++)n+=(mp[i]%2);
      n?puts("No"):puts("Yes");
    }
    return 0;
}


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

int main(void){
    int n, m, sum[101] = {};
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int t;
        cin >> t;
        sum[i] += sum[i - 1] + t;
    }
    cin >> m;
    for (int i = 1; i <= m; i++) {
        int p, x;
        cin >> p >> x;
        cout << sum[n] - (sum[p] - sum[p - 1]) + x << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define N 100050
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define READ(f) freopen (f, "r", stdin)
#define WRITE(f) freopen (f, "w", stdout)
#define mapiter map<int, int>::iterator
#define pii pair<int, int>
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define btw cout << "bad\n"
#define pf push_front
#define elif else if

const int inf = 1e9;
const ll modw = 1e8;
  
using namespace std;
using namespace __gnu_pbds;



int main()
{
	barnarnar
	int k;
	cin >> k;
	string t;
	cin >> t;
	if(k >= t.si)	cout << t;
	else
	{
		cout << t.substr(0, k) << "...";
	}
	r0;
}










Measured memory_bytes: 3676
a,b,c,d = (str(x) for x in input())
list = [int(a),int(b),int(c),int(d)]

def calcurate(list,opn):
    ans = 0
    if opn[0]=="+":
        ans = list[0] + list[1]
    else:
        ans = list[0] - list[1]
    if opn[1]=="+":
        ans = ans + list[2]
    else:
        ans = ans - list[2]
    if opn[2]=="+":
        ans = ans + list[3]
    else:
        ans = ans - list[3]
    return ans


for i in range(8):
    opn = ["-","-","-"]
    for j in range(3):
        if ((i>>j)&1):
            opn[j] = "+"
    ans = calcurate(list,opn)
    if ans==7:
        print("".join([a,opn[0],b,opn[1],c,opn[2],d,"=7"]))
        break


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

using namespace std;

struct Node {
    double t, v;
    Node() {}
    Node(double _t, double _v) : t(_t), v(_v) {}
    Node& operator+=(const Node& _oth){
        t = (t*v + _oth.t*_oth.v)/(v+_oth.v);
        v += _oth.v;
        return *this;
    }
};

void solve() {
    int n; double L;
    cin >> n >> L;
    cout << fixed << setprecision(7);

    deque<Node> past;
    double E = 0, V = 0;
    for (int _ = 0; _ < n; _++) {
        double t, v;
        cin >> t >> v;
        while (!past.empty() && V+v > L) {
            double depre = min(V+v-L, past[0].v);
            E -= depre * past[0].t;
            past[0].v -= depre;
            V -= depre;
            if (past[0].v <= 0.0000001) past.pop_front();
        }
        E += t*v; V += v;
        cout << E/V << "\n";

        past.emplace_back(t,v);
        int m = past.size();
        while (m>1 && past[m-2].t >= past[m-1].t) {
            past[m-2] += past[m-1];
            m--;
            past.pop_back();
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 17296
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define mod 1000000007
unordered_map<ll,vector<ll>> adj;
vector<ll> vis(300005,0);
vector<ll> p(100005,0);
ll c[100005];
ll cnt;
void dfs(ll node)
{
  if(vis[node])
    return;
  vis[node]=1;
  cnt++;
  for(auto i:adj[node])
    {
      dfs(i);
    }
}

int main()
{
   ll a,b,c,d,ans;
   cin>>a>>b>>c>>d;
    ll mx=max(a*c,a*d);
    mx=max(mx,b*d);
    mx=max(mx,b*c);
    cout<<mx;
}

Measured memory_bytes: 6228