akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();

            long ans = 1;
            for (int i = 0; i < n; i++) {
                if (ans < k) {
                    ans *= 2;
                } else {
                    ans += k;
                }
            }

            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 22996
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())
K = int(input())
A = sum(map(lambda x: 2 * min(int(x), K - int(x)), input().split()))
print(A)

Measured memory_bytes: 3572
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

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

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main(){
	int n; cin >> n;
	vector<int> a(n);
	rep(i, 0, n) cin >> a[i];
	ll mi, ma;
	ll l = 0, r = 1LL * inf * inf;
	while (r-l>1)
	{
		ll mi = (l + r) / 2;
		ll cnt = mi;
		rep(i, 0, n) {
			cnt = cnt - (cnt % a[i]);
		}
		if (cnt >= 2) r = mi; 
		else l = mi;
	}
	mi = r;
	l = 0, r = 1LL * inf * inf;
	while (r - l > 1)
	{
		ll mi = (l + r) / 2;
		ll cnt = mi;
		rep(i, 0, n) {
			cnt = cnt - (cnt % a[i]);
		}
		if (cnt <= 2) l = mi;
		else r = mi;
	}
	ma = l;
	if (mi > ma) printf("-1");
	else printf("%lld %lld\n", mi, ma);
	return 0;
}


Measured memory_bytes: 640
sx, sy, tx, ty = map(int, input().split())
ans = []
for _ in range(tx-sx):
    ans.append("R")
for _ in range(ty-sy):
    ans.append("U")
for _ in range(tx-sx):
    ans.append("L")
for _ in range(ty-sy):
    ans.append("D")
ans.append("D")
for _ in range(tx-sx+1):
    ans.append("R")
for _ in range(ty-sy+1):
    ans.append("U")
ans.append("L")
ans.append("U")
for _ in range(tx-sx+1):
    ans.append("L")
for _ in range(ty-sy+1):
    ans.append("D")
ans.append("R")
print("".join(ans))

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

int main(){
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<long long> a(x),b(y),c(z);
    for(int i = 0;i < x;i ++){
        cin >> a.at(i);
    }
    for(int i = 0;i < y;i ++){
        cin >> b.at(i);
    }
    for(int i = 0;i < z;i ++){
        cin >> c.at(i);
    }
    vector<long long> ab(x*y);
    int h = 0;
    for(int i = 0;i < x;i ++){
        for(int j = 0;j < y;j ++){
            ab.at(h) = a.at(i) + b.at(j);
            h ++;
        }
    }
    sort(ab.begin(),ab.end(),greater<long long>());
    int m = min(k,x*y);
    vector<long long> abg(k);
    for(int i = 0;i < m;i ++){
        abg.at(i) = ab.at(i);
    }

    vector<long long> abgc(k*z);
    int g = 0;
    for(int i = 0;i < k;i ++){
        for(int j = 0;j < z;j ++){
            abgc.at(g) = abg.at(i) + c.at(j);
            g ++;
        }
    }
    sort(abgc.begin(),abgc.end(),greater<long long>());

    for(int i = 0;i < k;i ++){
        cout << abgc.at(i) << endl;
    }
}

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

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

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

using namespace std;

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

  int m;
  cin >> m;
  int p[m];
  int x[m];
  rep(i, m) {
    cin >> p[i];
    cin >> x[i];
  }

  rep(i, m) {
    int tp = p[i];
    int tx = x[i];

    int result = 0;
    rep(j, n) {
      if (tp - 1 == j)
        result += tx;
      else
        result += t[j];
    }
    cout << result << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
/**
 * Created by PC on 26-Nov-17.
 */
public class Main{
    public static void main(String[] Args){
        Scanner in = new Scanner(System.in);
 
        int n, dig,tempDig, cnt;
 
        while(in.hasNext()){
            n = in.nextInt();
 
            dig = n%10;
            n/=10;
            cnt = 1;
            boolean goodNumber = false;
 
            while(n>0){
                tempDig = n%10;
                n/=10;
 
                if(tempDig == dig){
                    cnt++;
                    if(cnt >= 3) goodNumber = true;
                }
                else{
                    if(cnt >= 3) goodNumber = true;
                    cnt=1;
                    dig = tempDig;
                }
            }
 
            if(goodNumber) System.out.println("Yes");
            else System.out.println("No");
        }
    }
}

Measured memory_bytes: 22864
#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;

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

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

Measured memory_bytes: 256
/* package whatever; // don't place package name! */

import java.io.*;
import java.util.*;

class Main {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        Map<Integer, List<Integer>> tm = new TreeMap<Integer, List<Integer>>();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (tm.containsKey(a)) {
                tm.get(a).add(b);
            } else {
                List<Integer> list = new ArrayList<Integer>();
                list.add(b);
                tm.put(a, list);
            }

        }
        sc.close();

        int ans = 0;
        List<Integer> wages = new ArrayList<Integer>();
        for (int i = 0; i < m; i++) {
            if (tm.containsKey(i + 1)) {
                wages.addAll(tm.get(i + 1));
                Collections.sort(wages, Comparator.reverseOrder());
            }
            if (wages.size() > 0) {
                ans += wages.remove(0);
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 111068
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin >> n;
  ll a[n];
  rep(i,n)cin >> a[i];
  int cnt=0;
  rep(i,n){
    if(a[i]==cnt+1)cnt++;
  }
  if(cnt==0){
    cout << -1 << endl;
    return 0;
  }
  cout << n-cnt << endl;
return 0;}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	string s;

	cin >> s;
	s = "?" + s;

	int a = -1;
	int b = -1;

	int n = s.size();
	for (int i = 2; i < n; i++) {
		if (s[i-1] == s[i]) {
			a = i - 1;
			b = i;
			break;
		}
		if (s[i-2] == s[i]) {
			a = i - 2;
			b = i;
			break;
		}
	}

	cout << a << " " << b << endl;
	return 0;
}


Measured memory_bytes: 512
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		Set<String> NS = new HashSet<String>();
		Set<String> WE = new HashSet<String>();
		for (char c: S.toCharArray()) {
			switch (c) {
			case 'N':
			case 'S':
				NS.add(String.valueOf(c));
				break;
			case 'W':
			case 'E':
				WE.add(String.valueOf(c));
				break;
			}
		}
		if (NS.size()==1 || WE.size()==1) System.out.println("No");
		else System.out.println("Yes");
		sc.close();
	}

}


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

using ll = long long;
constexpr int mod = 1e9 + 7;

int main() {
    int n, k; cin >> n >> k;
    vector<int> a;
    for(int i = 1; i * i <= n; ++i) {
        a.push_back(i);
        a.push_back(n / i);
    }
    sort(a.begin(), a.end());
    a.erase(unique(a.begin(), a.end()), a.end());

    const int m = a.size();
    vector<ll> dp(m);
    for(int i = 0; i < m; ++i) {
        dp[i] = a[i] - (i == 0 ? 0 : a[i - 1]);
    }
    for(int i = 1; i < k; ++i) {
        vector<ll> nxt(m);
        for(int j = 0; j < m; ++j) {
            const int idx = lower_bound(a.begin(), a.end(), n / a[j]) - a.begin();
            (nxt[idx] += dp[j]) %= mod;
        }
        ll sum = 0;
        for(int j = m - 1; j >= 0; --j) {
            sum += nxt[j];
            dp[j] = (sum * (a[j] - (j == 0 ? 0 : a[j - 1]))) % mod;
        }
    }

    int ans = 0;
    for(auto const v : dp) {
        (ans += v) %= mod;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
#define MAX         1000000 //10^5
#define ll          long long
#define bl          printf("\n")
#define pn(a)       printf("%d\n",a)
#define pc(a)       printf("%c\n",a)
#define pd(a)       printf("%lf\n",a)
#define pb(a)       push_back(a)
#define deb         printf("#####\n")
#define si(a)       scanf("%d",&a)
#define sii(a,b)    scanf("%d%d",&a,&b)
#define siii(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sd(a)       scanf("%lf",&a)
#define sdd(a,b)    scanf("%lf%lf",&a,&b)
#define sddd(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define fl(a,n)     for(int i=a; i<n; i++)
#define rfl(n,a)    for(int i=n-1; i>=a; i--)

int t, cs, cnt, m, n, tmp, ans;
int main()
{
    sii(n,m);
    ans = n+1-m;
    pn(ans);
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	vector<int> a(100);

	int n;
	for (; cin >> n;)
	{
		a.at(n - 1)++;
	}

	vector<int> b = a;
	sort(b.begin(), b.end());

	for (int i = 0; i < a.size(); i++)
	{
		if (a.at(i) == b.back())
		{
			cout << i + 1 << endl;
		}
	}
}


Measured memory_bytes: 3084
#include <iostream>
using namespace std;
int main(void){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    for(;;){
        c -= b;
        if(c <= 0){
            puts("Yes");
            return 0;
        }
        a -= d;
        if(a <= 0){
            puts("No");
            return 0;
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef double long dl;
typedef pair < int , int > pii;
typedef pair < pii, pii > p2i;
const int maxn = (int) 3e5 + 1;
const int mod = (int) 1e9 + 7;
const ll inf = (ll)1e18;

#define fi first
#define se second
#define acel ios_base :: sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define next continue

int n;
string s;
map < string , int > m;

bool cmp(pair < char , int > a, pair < char , int > b){
    while(a.first == b.first){
        a.second++;
        b.second++;
        if(a.second == s.size()){
            return 1;
        }
        if(b.second == s.size()){
            return 0;
        }
        a.first = s[a.second];
        b.first = s[b.second];
    }
    return a.first < b.first;
}

int main(){
    cin >> s >> n;
    for(char c = 'a'; c <= 'z'; c++){
        vector < pair < char , int > > p;
        for(int i = 0; i < (int)s.size(); i++){
            if(s[i] == c){
                    p.push_back({s[i], i });
            }
        }
        if((int)p.size() > 0){
            sort(p.begin(), p.end(), &cmp);
            for(int i = 0; i < p.size(); i++){
                string tek = "";
                for(int j = p[i].second; j < s.size(); j++){
                    tek += s[j];
                    n -= (m[tek] ^ 1);
                    m[tek] = 1;
                    if(n == 0){
                        cout << tek;
                        return 0;
                    }
                }
            }
            cout << "\n";
        }
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)


int main (){
    ll a,b,c;
  cin>>a>>b>>c;
    if(b-a+1<=c*2){
        rep(i,a,b+1)cout<<i<<endl;
        return 0;
    }
    rep(i,a,a+c)
      cout << i<< endl;
    rep(i,b-c+1,b+1)
      cout << i<< endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
  double x,min,max;
  min=10000000;
  max=0;
  while(scanf("%lf",&x)!=EOF){
    if(max<x)max=x;
    if(min>x)min=x;
  }
  printf("%.2f\n",max-min);
  return 0;
}

Measured memory_bytes: 652
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int W, H, x, y;
    cin >> W >> H >> x >> y;
    cout << fixed << setprecision(10) << ((double)W * (double)H) / 2.0 << " "
         << (x * 2 == W && y * 2 == H ? 1 : 0);
    return 0;
}

Measured memory_bytes: 256
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define rep(i,b,e) for(ll i=b; i<e; i++)
#define be(vec) vec.begin(),vec.end()
#define print(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define scan(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n;
	scanf("%d", &n);
	V a(n+1), b(n);
	scan(a); scan(b);
	ll ans = 0;
	rep(i, 0, n){
		if(a[i]>b[i]){
			ans += b[i];
			a[i] -= b[i];
			b[i] = 0;
		}else{
			ans += a[i];
			b[i] -= a[i];
			a[i] = 0;
		}

		if(b[i]>a[i+1]){
			ans += a[i+1];
			b[i] -= a[i+1];
			a[i+1] = 0;
		}else{
			ans += b[i];
			a[i+1] -= b[i];
			b[i] = 0;
		}
	}
	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 1792
S = input()

now = 'R'
pos = [0]
ans = ['0'] * len(S)

for i, s in enumerate(S):
    if now =='R':
        if s == 'L':
            pos.append(i)
            now = 'L'

    if now == 'L':
        if s == 'R':
            pos.append(i)
            now = 'R'
pos.append(len(S))
K = len(pos)

for i in range(1, K, 2):
    x = pos[i]
    odd = 0
    even = 0
    for t in range(pos[i-1], pos[i+1]):
        if t % 2 == 0:
            even += 1
        else:
            odd += 1
    if x % 2 == 0:
        ans[x] = str(even)
        ans[x-1] = str(odd)
    else:
        ans[x] = str(odd)
        ans[x-1] = str(even)

print(' '.join(ans))

Measured memory_bytes: 14068
#include<iostream>
using namespace std;
int main() {
    int n, cnt = 0;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
        for (int j = n - 1; j >= i; j--)
            if (a[j] < a[j - 1]) {
                swap(a[j], a[j - 1]);
                cnt++;
            }
    for (int i = 0; i < n - 1; i++) 
        cout << a[i] << ' ';
    cout << a[n - 1] << '\n' << cnt << '\n';
    return 0;
}


Measured memory_bytes: 3088
function Main(input) {
  const arr = input.split(' ').map(x => Number(x));
  var total = 0;

  for (var i = 1; i <= arr[0]; i++) {
    var sum = Array.from(String(i)).map(x => Number(x)).reduce((a,c) => a + c);
    if (arr[1] <= sum && sum <= arr[2]) {
      total += i;
    }
  }

  console.log(total);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11172
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
  int K, N;
  cin >> N >> K;

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

  double e[N];
  for(int i=0; i<N; i++)
    e[i] = (p[i]-1)*0.5+1;  
  
  double sum[N];
  sum[0]=e[0];
  for(int i=0; i<N-1; i++)
    sum[i+1] = sum[i] + e[i+1];
  
  double ans[N];
  double max=0;
  for(int i=0; i+K<N; i++)
    {
      ans[i] = sum[i+K]-sum[i];
      if(ans[i]>max)
	max=ans[i];
    }

  if(N==K)
    max = sum[N-1];

  cout << setprecision(13);
  cout << max << endl;
  
  return 0;
}



Measured memory_bytes: 5760
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll = long long;
const ll MOD = 1000000007; 
using plong = pair<ll,ll>;
 
 
int main(){
    ll N,A,B;
    cin>>N>>A>>B;
    ll res=0;
    ll num = N/(A+B);
    res += A *  num;
    ll zan = N- num*(A+B);
    // cout<<zan<<endl;
    if(zan<A){
        res+=zan;
    }else{
        res+=A;
    }
    cout<<res<<endl;
}

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

using namespace std;

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

typedef long long int ll;

int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;

    int ans = 0;
	rep1(i , n)
	{
		if(i <= 9)	ans++;
		else if(i <= 99);
		else if(i <= 999) ans++;
		else if(i <= 9999);
		else if(i <= 99999)	ans++;
	}
	cout << ans;
	return 0;
}


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

int main(void) {
    string s;
    cin >> s;
    int ans = 0;
    int cur = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        char c = s.at(i);
        if (c == 'A' || c == 'C' || c == 'G' || c == 'T') {
            cur++;
        }
        else {
            ans = max(ans, cur);
            cur = 0;
        }
    }
    ans = max(ans, cur);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3528
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <iterator>
#include <math.h>
#include <cstdlib>
#include <cmath>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

int main(){
  int a ,b;
  cin >> a >> b;
  if(a <= b){
    cout << a << endl;
  }else{
    cout << a-1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import collections

S1 = collections.deque()
s_a = 0

S2 = collections.deque()

for i, j in enumerate(input()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            diff = i - left_edge
            s_a += diff
            new_puddle_a = diff
            while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
            new_puddle = (left_edge, new_puddle_a)
            S2.append(new_puddle)
        else:
            pass


print(s_a)

num_of_puddles = len(S2)
puddles = str(num_of_puddles)

for i in range(num_of_puddles):
    puddle = S2.popleft()
    puddles += ' {0}'.format(str(puddle[1]))
else:
    print(puddles)

Measured memory_bytes: 8280
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

void Main() {
    // input
    u_int64_t N;
    cin >> N;

    // translate
    if (N == 1) {
        cout << 0 << endl;
        return ;
    }

    int ans = 0;
    for (u_int64_t prime = 2; prime * prime <= N; prime++) {
        // 割り切れない
        if (N % prime != 0) {
            continue;
        }
        
        // N = prime ^ f * …… とする
        // 割り切れる
        // ここで, N は prime で割り切れなくまでする必要がある, でないとこの後にでてくる prime の素数性が保たれなくなる
        int f = 0;
        while (N % prime == 0) {
            f++;
            N /= prime;
        }

        // f > 1 + 2 + 3 + … + n となる最大の n は?
        for (int e = 1; e <= f; e++) {
            f -= e;
            ans++;
        }

    }

    if (N != 1) {
        ans++;
    }

    // output
    cout << ans << endl;
    
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3592
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
using namespace std;
typedef long long ll;
struct node {
	int p,y,id;
} a[100011];
int P[100001],h[100001],js[10000001];
void print(int a,int b) {
//	cout<<js[2];
	for(int i=1; i<=6-js[a]; i++)
		cout<<"0";
	cout<<a;
	for(int i=1; i<=6-js[b]; i++)
		cout<<"0";
	cout<<b;
	cout<<"\n";
}
bool cmp(const node & a ,const node & b ) {
	if(a.p==b.p)
		return a.y<b.y;
	return a.p<b.p;
}
int main() {
	//file("a");
	int n,m;
	cin>>n>>m;
	for(int i=1; i<=m; i++)
		cin>>a[i].p>>a[i].y,a[i].id=i,P[i]=a[i].p;
	sort(a+1,a+1+m,cmp);
	int cnt=0;
	for(int i=1; i<=m; i++) {
		if(a[i].p!=a[i-1].p)
			cnt=0;
		cnt++;
		h[a[i].id]=cnt;
	}
//	for(int i=1; i<=m; i++)
//		cout<<h[i];
	int jss=1;
	cnt=1;
	for(int i=1; i<=999999; i++) {
		if(i==jss*10)
			jss*=10,cnt++;
		js[i]=cnt;
	}
	for(int i=1; i<=m; i++)
		print(P[i],h[i]);
}

Measured memory_bytes: 7680
#include<bits/stdc++.h>
using namespace std;
#define mx 1000000000000000000
#define ll long long int
//ll a[2000100];
//ll number[20],used[20];
int main()
{
   string s,t;
   ll i, j,count=0;
   cin>> s >> t;
   for(i=0;i<s.size();i++)
   {
       if(s[i]!=t[i])
        count++;
   }
   cout << count << endl;
    return 0;
}


Measured memory_bytes: 3856
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
struct h {
	double x,y;
} a[1000];
double ans[1000];
const int maxn = 1000000;
int n;
const double pi = acos(-1);
const double eps = 1e-8;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		double xx,b;
		scanf("%lf%lf",&xx,&b);
		a[i].x = xx;
		a[i].y = b;
	}
	double step = pi / maxn * 2;
	double now = 0;
	for(int i=1;i<=maxn ;i++) {
		double _x = cos(now);
		double _y = sin(now);
		_x = _x * maxn * 100000;
		_y = _y * maxn * 100000;
		double minn = 9999999999990000;
		int choose;
		for(int j=1;j<=n;j++) {
			double dis = sqrt((_x - a[j].x) * (_x - a[j].x) + (_y - a[j].y) * (_y - a[j].y));
			if(dis < minn) {
				minn = dis;
				choose = j;
			}
		}
		//cout<<_x<<" "<<_y<<" "<<choose<<endl;
		//printf("%lf %lf %d\n",_x,_y,choose);
		ans[choose] += 1;
		now += step;
	}
	for(int i=1;i<=n;i++) printf("%.7lf\n",ans[i] / maxn);
	return 0;
}

Measured memory_bytes: 512
# coding: utf-8
# Your code here!
import math
n=int(input())
h=list(map(int,input().split()))
dp=[math.inf for _ in range(n)]
dp[0]=0
for i in range(1,n):
    if i==1:
        dp[i]=dp[i-1]+abs(h[i]-h[i-1])
    else:
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Measured memory_bytes: 20676
a, b, k = map(int, input().split())
ans_list = list()
for i in range(a, min(a + k, b + 1)):
    ans_list.append(str(i))
for j in range(max(a, b - k + 1), b + 1):
    if str(j) not in ans_list:
        ans_list.append(str(j))
print("\n".join(ans_list))


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

int main()
{
    int N,x,y;
    int sum = 0;

    cin >> N;
    y = N;

    while (N != 0)
    {
        x = N % 10;
        sum = sum + x;
        N = N/10;
    }
    
    if (y%sum==0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int main(void){
    int n;
    cin >> n;
    
    int a[100];
    int i;
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    
    int cost, min = 4000000;
    int num;
    for(num = -100; num <= 100; num++){
        cost = 0;
        for(i = 0; i < n; i++){
            cost += (a[i] - num) * (a[i] - num);
        }
        if(cost < min){
            min = cost;
        }
    }
    
    cout << min << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int h, w, i;
  scanf("%d %d", &h, &w);

  char arr[h][w+1];
  for (i=0; i<h; i++) {
    scanf("%s", arr[i]);
  }

  for (i=0; i<h*2; i++) {
    printf("%s\n", arr[i/2]);
  }
  return 0;
}

Measured memory_bytes: 128
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: usize,
        _L: u64,
        S: [String; N],
    }
    let mut S = S;
    // Rustも文字列は辞書順でsortしてくれました
    S.sort();
    for s in S{
        print!("{}", s);
    }
}

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

using namespace std;

typedef long long ll;

int a[105],b[105];
vector<int> v[4];
int co[4];
ll sum[4][105];
int n,w;

int main()
{
	cin >> n >> w;
	for(int i=0;i<n;i++) cin >> a[i] >> b[i];
	for(int i=0;i<n;i++)
	{
		v[a[i]-a[0]].push_back(b[i]);
		co[a[i]-a[0]]++;
	}
	for(int i=0;i<4;i++)
		sort(v[i].rbegin(),v[i].rend());
	for(int i=0;i<4;i++)
	{
		for(int j=0;j<co[i];j++)
		{
			sum[i][j+1]=v[i][j]+sum[i][j];
		}
	}
	ll ans=0;
	for(ll i=0;i<=co[0];i++)
	{
		for(ll j=0;j<=co[1];j++)
		{
			for(ll k=0;k<=co[2];k++)
			{
				ll curw=i*a[0]+j*(a[0]+1)+k*(a[0]+2);
				if(w<curw) continue;
				ll x=min((w-curw)/(a[0]+3),1LL*co[3]);
				ans=max(ans,sum[0][i]+sum[1][j]+sum[2][k]+sum[3][x]);
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define pb push_back
#define vi vector<int >
#define vii vector < pair<int ,int > >
#define IO ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define IOfiles freopen("input.txt","r+",stdin) ; freopen("output.txt","w+",stdout)
#define PI 3.14159265
const long long mod = 1e9 + 7LL;
typedef long long ll;
typedef pair<int, int> ii;
typedef double db;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;}
ll pwr(ll x , ll n) { ll ans = 1; while (n) {ans *= x; n--;} return ans;}

void solve(){
    
}

int main()
{
    IO;
    int k,a,b;
    cin>>k>>a>>b;
    int ans=(b/k)-((a-1)/k);
    if(ans>0)
        cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
    
}

Measured memory_bytes: 3608
n = int(input())
arr = list(map(int,input().split()))
arr.append(0)
sum = abs(arr[0])
for i in range(1,n+1):
    sum += abs(arr[i]-arr[i-1])
for i in range(n):
    d = abs(arr[i]-arr[i-1])+abs(arr[i]-arr[i+1])-abs(arr[i+1]-arr[i-1])
    print(sum-d)

Measured memory_bytes: 14048
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <set>

using namespace std;

int main() {
	int x, n, p;
	cin >> x >> n;

	set<int> nums;
	for (int i = 0; i < n; i++) {
		cin >> p;
		nums.insert(p);
	}

	int ans = -1;
	for (int i = -1; i <= 101; i++) {
		if (nums.count(i) > 0) {
			continue;
		}
		if (abs(i - x) < abs(ans - x)) {
			ans = i;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
    int x,t;
    cin >> x >> t;
    cout << max(x-t,0) << endl;
}

Measured memory_bytes: 256
"use strict";

var main = function main(input) {
  var N = parseInt(input.split('\n')[0], 10);
  var S = input.split('\n')[1].split('');
  var init = 0;

  for (var i = 0; i < N; i++) {
    if (S[i] == 'E' && i != 0) {
      init++;
    }
  }

  var tmp = init;
  var min = init;

  for (var _i = 1; _i < N; _i++) {
    if (S[_i] == 'E' && S[_i - 1] == 'E') {
      tmp--;
    } else if (S[_i] == 'W' && S[_i - 1] == 'W') {
      tmp++;
    }

    if (tmp < min) {
      min = tmp;
    }
  }

  console.log(min);
};

main(require('fs').readFileSync('/dev/stdin', 'utf-8'));

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

int main() {
	int h, w;
	cin >> h >> w;
	
	vector<int> sum_h(h, 0), sum_w(w, 0);
	vector<vector<int>> mat(h, vector<int>(w, 0));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> mat[i][j];
			sum_h[i] += mat[i][j];
			sum_w[j] += mat[i][j];
		}
	}
	
	for (int i = 0; i < h; i++) {
		for (int e : mat[i]) cout << e << ' ';
		cout << sum_h[i] << '\n';
	}
	for (int e : sum_w) cout << e << ' ';
	cout << accumulate(sum_w.begin(), sum_w.end(), 0) << '\n';
	
	return 0;
}


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

int main(void)
{
	int m, f, r;
	string ans;
	int total;

	while (true)
	{
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1)
			break;

		total = m + f;
		if (m == -1 || f == -1)
			ans = "F";
		else if (total >= 80)
			ans = "A";
		else if (total >= 65)
			ans = "B";
		else if (total >= 50)
			ans = "C";
		else if (total >= 30)
		{
			ans = "D";
			if (r >= 50)
				ans = "C";
		}
		else
			ans = "F";

		cout << ans << endl;
	}
}



Measured memory_bytes: 3168
using static System.Console;
using static System.Convert;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var result = 0;
        for(var i = 1; i <= num; i+=2)
        {
            var counter = 0;
            for(var j = 1; j <= i; j++)
            {
                if (i % j == 0) counter++;
            }
            if (counter == 8) result++;
        }
        WriteLine(result);
    }
}



Measured memory_bytes: 13268
import java.util.*;
    import java.io.*;

    public class Main {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int n=in.nextInt(),m=in.nextInt();

            Job[] arr=new Job[n];
            for(int i=0;i<n;i++)
                arr[i]=new Job(in.nextInt(),in.nextInt());

            Arrays.sort(arr,new Comparator<Job>(){
                public int compare(Job j1,Job j2){
                    return (j1.days-j2.days)*-1;
                }
            });
            PriorityQueue<Job> pq=new PriorityQueue<>();
            int req=0,i=0;
            while(i<n && arr[i].days>m)
                i++;
            for(int d=0;d<m && i<n;d++){
                pq.add(arr[i++]);
                while(i<n && arr[i].days+d==m)
                    pq.add(arr[i++]);
                while(pq.size()>d+1)
                    pq.poll();
            }
            long totalReward = 0;
            while(!pq.isEmpty())
                totalReward+=pq.poll().reward;
            System.out.println(totalReward);
            
            //System.out.println(Arrays.toString(arr));
        }
        static class Job implements Comparable<Job>{
            int days,reward;
            Job(int days,int reward){
                this.days=days;
                this.reward=reward;
            }
            public int compareTo(Job O){
                return this.reward-O.reward;
            }
            public String toString(){
                return "{ days : "+days+" , "+reward+"}";
            }
        }
    }

Measured memory_bytes: 78912
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
string s;
int main()
{
    LL k;
    cin >> s >> k;
    bool flag = 0;
    if (k <= s.size())
    {for (int i = 0; i < k; i++) if (s[i] != '1') flag = 1;
    if (flag == 0)
    {
        cout << 1 << endl;
        return 0;
    }}
    for (auto i : s) if (i != '1')
    {
        cout << i << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;
const double PI = 3.1415926535;
const int MOD = 1000000007; // 計算してからmodで割る ans = (ans * a) % mod
#define int long long
template <typename T = long long > T in () { T x; cin >> x; return(x);}
// int a = in() のように使うlong long以外の型の時はstirng s = in<string>()のように型を指定する

signed main(void){
    int n = in();
    vector<string> s(n);
    REP(i, n){
        cin >> s[i];
    }
    whole(sort, s);
    vector<pair<int, string>> a;
    string now = s[0];
    int cnt = 0;
    REP(i, n){
        if(now == s[i]) cnt++;
        else{
            a.push_back(make_pair(cnt, now));
            cnt = 1;
            now = s[i];
        }
        if(i == n - 1) a.push_back(make_pair(cnt, now));
    }
    whole(sort, a, greater<>());
    vector<string> ans;
    cnt = a[0].first;
    REP(i, a.size()){
        if(a[i].first == cnt) ans.push_back(a[i].second);
    }
    whole(sort, ans);
    REP(i, ans.size()) cout << ans[i] << endl;
    
}

Measured memory_bytes: 21232
//package atcoder.beginnercontest.r176;

import java.util.Scanner;

/**
 * @author pribic (Priyank Doshi)
 * @since 29/08/20
 */
public class Main {

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

      for (char c : n.toCharArray())
        sum += (c - '0');
      System.out.println(sum % 9 == 0 ? "Yes" : "No");
    }
  }
}

Measured memory_bytes: 40772
n, l = map(int, input().split())
total = 0
total = n*l + n*(n - 1)/2
ref0 = (n - 1)*l + n*(n - 1)/2

for i in range(n):
    ref1 = 0
    ref1 = (n - 1)*l + n*(n - 1)/2 - i
    if abs(total - ref0) > abs(total - ref1):
        ref0 = ref1

print(int(ref0))

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

const int N = 1e5 + 1;
int n, m, used[N], ans;
vector<int> g[N];

void dfs(int x) {
  used[x] = 1;
  for (int i: g[x]) {
    if (!used[i]) {
      dfs(i);
    }
  }
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0, a, b; i < m; ++i) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; ++i) {
    if (!used[i]) {
      ++ans;
      dfs(i);
    }
  }
  cout << ans - 1 << '\n';
}


Measured memory_bytes: 9996
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int sum = 0, longest = 0;
    for (int i=0; i<n; i++) {
        int l;
        cin >> l;
        sum += l;
        longest = max(longest, l);
    }
    cout << ((sum > longest*2) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;
import java.util.ArrayList;
/**
 * Write a description of class Main_B here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */

public class Main
{

    public static void main(String[] args)
    {
        ArrayList<Integer> numeros = new ArrayList<Integer>();
        Scanner scan = new Scanner (System.in);
        int N = scan.nextInt();
        double M = scan.nextFloat();
        int contador = 0;
        int sumaTotal = 0;
        double valor = 0;
        double porcentaje = (1/(4*M));
        while(contador < N){
            int numerito = scan.nextInt();
            numeros.add(numerito);
            sumaTotal += numerito;
            contador++;
        }
        valor = sumaTotal*porcentaje;
        contador = 0;
        for(Integer a: numeros)
        {
            if(a >= valor){
                contador++;
            }
        }
        if(contador >= M)
        {
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23252
MOD = 10**9+7
n, m = list(map(int, input().split()))

def fact(x):
    val = 1
    for i in range(1, x+1): val = val*i%MOD
    return val

if abs(m-n) > 1:
    print(0)
elif abs(m-n) == 1:
    ans = (fact(n)*fact(m))%MOD
    print(ans)
else:
    ans = (2*fact(n)*fact(m))%MOD
    print(ans)


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

int main() {

 int X;
 int d = 0;

 cin >> X;
for(int i=0;i<8;++i){
  if(400+d <= X && X <= 599+d){
    cout << 8 - i << endl;
    return 0;
  }
  d += 200;
}
  return 0;
}


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

int main()
{
  int K,X ;
  cin>>K>>X ;
  
  for(int i=X-K+1;i<X+K;i++){
    if(i<=10000&&i>=-10000){
       cout<<i<<" " ;
    }
  }
  
  return 0 ;
}

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

int main(){
	char c;
	cin >> c;
	
	char b = c + 1;
	
	
	cout << b << endl;
}



Measured memory_bytes: 256
/*****
 * A*i/B=N+C
 *****/
#include <iostream>

int A,B,C;        //入力変数
unsigned long long i=0;//Aの倍数 ~10000000000000000000

int main()
{
  std::cin >> A >> B >> C;

  while(i<1000){
    if(C == (A*i)%B){
      std::cout << "YES\n";
      break;
    }
    ++i;
  }
  if(i==1000)
    std::cout << "NO\n";

  return (0);
}


Measured memory_bytes: 256
using System;
using System.Linq;
namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var sum = 0;
            foreach (var s in input)
            {
                sum += s - '0';
            }
            var ans = sum % 9 == 0 ? "Yes" : "No";
            System.Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 26492
import itertools
N = int(input())
a=tuple(map(int,input().split()))
b=tuple(map(int,input().split()))
cnt = 0
cnt2 = 0
for i in itertools.permutations(range(1,N+1)):
  if a == i:
    break
  cnt += 1
for s in itertools.permutations(range(1,N+1)):
  if b == s:
    break
  cnt2 += 1
print(abs(cnt-cnt2))

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
int i,j,h,n,a,b,r=1e9,f[20001];
int main()
{
	scanf("%d%d",&h,&n);
	memset(f,8,sizeof f);
	for(*f=0;++i<=n;)
	{
		scanf("%d%d",&a,&b);
		for(j=0;j<=h;++j)
			f[j+a]=std::min(f[j+a],f[j]+b);
	}
	for(i=20000;i>=h;--i)r=std::min(r,f[i]);
	printf("%d",r);
}

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

using namespace std;

using ll = long long;

int n, w;
vector<ll> weight, value;
vector<vector<ll>> dp;



ll solve(int i, int cap){
  if(i == n) return 0;
  if(dp[i][cap] != -1) return dp[i][cap];
  ll v = -1;
  if(cap >= weight[i]){
    v = max(solve(i+1, cap), value[i] + solve(i+1, cap-weight[i]));
  }else{
    v = solve(i+1, cap);
  }
  return dp[i][cap] = v;
}


int main() {
  int tmp, tmp1;
  cin>>n>>w;
  for(int i = 0; i < n; i++){
    cin>>tmp>>tmp1;
    weight.push_back(tmp);
    value.push_back(tmp1);
  }
  dp.assign(n+1, vector<ll>(w+1, -1));
//   ll res = solve(0, w);
  ll res;
  for(int i = 0; i <= w; i++) dp[0][i] = 0;
  for(int i = 1; i <= n; i++){
      for(int j = 0; j <= w; j++){
          if(weight[i-1] <= j){
              dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weight[i-1]]);
          }else{
              dp[i][j] = dp[i-1][j];
          }
      }
  }
  res = dp[n][w];
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 80256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){

	int a, b;
	double t;
	cin >> a >> b >> t;

	a = (t+0.5)/a;

	int ans;
	ans = a*b;
	cout << ans <<endl;


	return 0;

}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Pranto
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
//#include<math.h>
//#include <algorithm>
#include <iostream>

int getTheAnswer() {
    return 42;
}
typedef struct node Node;

#define ll long long
#define maximum 1000000
#define q_size 100
using namespace std;


class Task {
public:

	void solve(std::istream& cin, std::ostream& cout) {

	   string s;
	   cin>>s;
	   ll numa=0,numb=0;
	   if(s[0]=='A') numa++;
	   else numb++;
        if(s[1]=='A') numa++;
        else numb++;
        if(s[2]=='A') numa++;
        else numb++;

        if(numa ==0 || numb==0) cout<<"No"<<endl;
        else cout<<"Yes\n";
    }
};


int main() {
	Task solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Official House
 */
public class Main {
    private static Scanner scan;
    // １フロア１０部屋、３階建ての公舎４棟
    private static final int Room = 10;
    private static final int Floor = 3;
    private static final int Building = 4;

    public static void main(String[] args) {
        scan = new Scanner(System.in);
        // n件の情報
        // b棟f階のr番目の部屋にv人
        int n = scan.nextInt();
        int[][][] count = new int[Building][Floor][Room];

        int b,f,r,v = 0;
        for (int i = 0; i < n; i++) {
            b = scan.nextInt();
            f = scan.nextInt();
            r = scan.nextInt();
            v = scan.nextInt();
            for (int p = 0; p < Building; p++) {
                for (int q = 0; q < Floor; q++) {
                    for (int x = 0; x < Room; x++) {
                        if (p + 1 == b && q + 1 == f && x + 1 == r) {
                            count[p][q][x] += v;
                        }
                    }
                }
            }
        }
        for (int p = 0; p < Building; p++) {
            for (int q = 0; q < Floor; q++) {
                for (int x = 0; x < Room; x++) {
                    System.out.print(" ");
                    System.out.print(count[p][q][x]);
                }
                System.out.print("\n");
            }
            if (p < Building - 1) {
                System.out.println("####################");
            }
        }
    }
}

Measured memory_bytes: 21112
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <map>
#define maxn 110
#define maxl 1000000000
#define mod 1000000007
using namespace std;

typedef unsigned long long ull;

int a[maxn];
double ans[maxn];

bool solve(){
	int n,i,j,r,k;
	double b,v,e,f,temp2,temp;
	scanf("%d",&n);
	if(n==0)return false;
	for(i=1;i<=n;++i){
		scanf("%d",&a[i]);
		ans[i]=1e30;
	}
	scanf("%lf%d%lf%lf%lf",&b,&r,&v,&e,&f);
	ans[0]=-b;
	for(i=0;i<n;++i){
		temp=ans[i]+b;
		for(j=i+1;j<=n;++j){
			for(k=a[j-1];k<a[j];++k){
				if(k-a[i]>=r)temp2=1/(v-e*(k-a[i]-r));
				else temp2=1/(v-f*(r-(k-a[i])));
				temp+=temp2;
			}
			ans[j]=min(temp,ans[j]);
		}
	}
	printf("%.4f\n",ans[n]);
	return true;
}

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

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

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

    int a[n];
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }

    int l = 4 * m;
    double k = (double)sum / l;

    sort(a, a + n, greater<int>());

    int flag = 0;
    for(int i = 0; i < m; i++){
        if(a[i] < k){
            flag = 1;
            break;
        }
    }

    if(flag == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256