akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;

#define double long double
double EPS = 1e-12;


double g(double x,double A,double B,double C){

	return A*x*x+B*x+C;
}
double f(double x,double A,double B){
	double t = 2*A*x+B;
	return sqrt(1+t*t);
	//return 0.5*(t*sqrt(t*t+1)+log(abs(t+sqrt(1+t*t))))/(2.*A);
}
double integral(double a,double b,double A,double B){
	double S = 1000;
	double d = (b-a) / S;
	double ans = 0;
	for(int i = 0 ; i < S ; i++){
		double aa = a + d * i;
		double bb = a + d * (i+1);
		ans += d * ( f(aa,A,B) + f((aa+bb)*0.5,A,B) + f(bb,A,B) ) / 3.0;
	}
	return ans;
	return f(b,A,B) - f(a,A,B);
}
vector<double> cp;
void crosspoint(double a,double b,double c){
	if( fabs(a) < EPS ){ cp.push_back(-c/b); return; }
	if( b*b-4*a*c < EPS ) return;
	cp.push_back((-b-sqrt(b*b-4*a*c))/(2*a));
	cp.push_back((-b+sqrt(b*b-4*a*c))/(2*a));
}
double A[100] = {} , P[100] = {} , Q[100] = {};
double B[100] , C[100] = {};
int main(){
	double W,H;
	int N;
	cin >> W >> H >> N;
	for(int i = 0; i < N; i++){
		cin >> A[i] >> P[i] >> Q[i];
		B[i] = -2.0*P[i]*A[i];
		C[i] = A[i] * P[i] * P[i] + Q[i];
		
	}
	for(int i = 0 ; i < N ; i++){
		crosspoint(A[i],B[i],C[i]);
	}
	
	for(int i = 0 ; i < N ; i++)
		for(int j = i+1 ; j < N ; j++)
			crosspoint(A[i]-A[j],B[i]-B[j],C[i]-C[j]);
	cp.push_back(0);
	cp.push_back(W);
	sort(cp.begin(),cp.end());
	double previous_x = 0;
	double ans = 0;
	for(int i = 0 ; i < cp.size() ; i++){
		if( cp[i] < -EPS || cp[i] > W + EPS) continue;
		double height = 0;
		int idx = -1;
		double a = previous_x;
		double b = cp[i];
		for(int j = 0 ; j < N ; j++){
			if( g(a+(b-a)*0.1,A[j],B[j],C[j]) > height + EPS ){
				idx = j;
				height = g(a+(b-a)*0.1,A[j],B[j],C[j]);
			}
		}
		if( idx >= 0 ){
			//cout <<  integral(a,b,A[idx],B[idx]) << endl;
			ans += integral(a,b,A[idx],B[idx]);
		}
		previous_x = cp[i];
	}
	printf("%.15Lf\n",ans);
}

Measured memory_bytes: 1380
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define YES(n) cout << (n?"YES":"NO")<<endl;
#define Yes(n) cout << (n?"Yes":"No")<<endl;

int main() {
    int R, G;
    cin >> R >> G;
    int tag = 2 * G - R;
    cout << tag<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main(){
   ll n;
   cin>>n;
   ll ans=INF;
   for (int i = 1; i*i <=n; i++)
   {
       if(n%i==0){
           chmin(ans,i+n/i-2);
       }
   }
   cout<<ans<<endl;
   
    return 0;
}

Measured memory_bytes: 384
X=int(input())

import math
P=[0,1]
X0=90
for i in range(1,361):
    X0+=X
    P[0]+=math.cos(X0/180*math.pi)
    P[1]+=math.sin(X0/180*math.pi)
    if abs(P[0])<1e-10 and abs(1-P[1])<1e-10:
        print(i)
        break

Measured memory_bytes: 9280
#include <iostream>
#include <cmath>

using namespace std;

int const NMAX = 1e5;
int const INF = 2e9;

int nStones;
int dp[NMAX+1];
int h[1+NMAX]; //this is an indication that your array is starting from index 1

int costOfHop(int from, int to) {
  return abs(h[from]-h[to]);
}

int main() {
  cin >> nStones;
  for(int i=1; i<=nStones; i++) {
    cin >> h[i];  //stones are 1..nStones
  }

  /*
    dp[i] = minimum cost of getting to ith stone
  */
  for(int i=0; i<=nStones; i++) {
    dp[i] = INF;
  }

  //Bottom-up: we start from a subproblem that we know is optimal.
  dp[1] = 0; //the initial case is an abstract case
  for(int i=1; i<=nStones; i++) {  //you start from a SOLVED problem in bottom-up
    int startingOptimalCost = dp[i];
    for(int j=1; j<=2; j++) {
      dp[i+j] = min(dp[i+j], startingOptimalCost + costOfHop(i, i+j));
    }
  }
  cout << dp[nStones];
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<cctype>
#include<ctime>
#include<cstdlib>
#include<map>
#include<set>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define il inline
#define rg register
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define rep(i,st,ed) for(rg int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(rg int i=(ed);i>=(st);--i)
#define rep0(i,n) for(rg int i=0;i<(n);++i)
#define per0(i,n) for(rg int i=(n)-1;i>=0;--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &x,const T &y){return x<y?x:y;}
template<typename T> il T qmax(const T &x,const T &y){return x>y?x:y;}
template<typename T> il void getmin(T &x,const T &y){if(y<x) x=y;}
template<typename T> il void getmax(T &x,const T &y){if(y>x) x=y;}
il void fileio(const string &s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e18+7;
const int N=2e5+7;

int a[N],n;
ll sum[N];

int main(){
//	fileio("test");
	scanf("%d",&n);
	rep(i,1,n){
		scanf("%d",a+i);
		sum[i]=sum[i-1]+a[i];
	}
	sort(sum,sum+n+1);
	ll ans=0;
	for(int i=0,j;i<=n;i=j){
		for(j=i;j<=n&&sum[j]==sum[i];++j);
		ans+=(ll)(j-i)*(j-i-1)/2;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
int main(){
  int i;
  char O[51],E[51],OE[102],*p,*q,*r;
  p=O;--p;
  q=E;--q;
  r=OE;--r;
  gets(O);gets(E);
  while(*++p){
    *++r=*p;
    *++r=*++q;
  }
  *++r^=*r;
  puts(OE);
}

Measured memory_bytes: 128
n = int(input())
s_list = []
for _ in range(n):
     s = sorted(input())
     s_list.append(s)

s_list.sort()
same_dict = {}
for i in range(n-1):
    if s_list[i] == s_list[i+1]:
        mojiretsu = ''.join(s_list[i])
        if not mojiretsu in same_dict.keys():
            same_dict[mojiretsu] = 1
        same_dict[mojiretsu] += 1
same_dict_values = same_dict.values()
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans = 0
for value in same_dict_values:
    ans += combinations_count(value, 2)
print(ans)


Measured memory_bytes: 26428
#include<iostream>
#include<cstdio>
#include<climits>
using namespace std;
// 完成版。

int tree[(1 << 18)];

void Update(int s, int t, int m, int left = 0, int right = (1 << 17), int key = 0){
    if(t < left || right <= s) return;
    if(s <= left && right - 1 <= t){ tree[key] = max(tree[key], m); return; }
    Update(s, t, m, left, (left + right) / 2, 2 * key + 1);
    Update(s, t, m, (left + right) / 2, right, 2 * key + 2);
}

int Find(int i){
    i += (1 << 17) - 1;
    int m = tree[i];
    while(i){
        i = (i - 1) / 2;
        m = max(tree[i], m);
    };
    return m;
}

int main(){
    int i;
    for(i = 0; i < (1 << 18); i++) tree[i] = 0;
    int n, q;
    int x[100000];
    for(i = 0; i < 100000; i++) x[i] = INT_MAX;
    int s, t, value, m;
    m = 1;
    
    cin >> n >> q;
    int query;
    while(q){
        q--;
        cin >> query;
        if(query){
            cin >> i;
            //cout << x[Find(i)] << endl;
            printf("%d\n", x[Find(i)]);
        }else{
            cin >> s >> t >> value;
            x[m] = value;
            Update(s, t, m);
            m++;
        }
    };
    return 0;
}


Measured memory_bytes: 4616
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] arrays;
		int a, b;
		while ((line = br.readLine()) != null) {
			arrays = line.split(" ");
			a = Integer.parseInt(arrays[0]);
			b = Integer.parseInt(arrays[1]);
			System.out.println(String.valueOf(a+b).length());
		}
	}
}

Measured memory_bytes: 17000
# source: http://drken1215.hatenablog.com/entry/2019/04/27/224100_1
# verify: https://atcoder.jp/contests/abc125/tasks/abc125_c
class SegmentTree
  # n is the size of array or array itself
  def initialize(n, unity, &func)
    raise ArgumentError if !n || !unity || !block_given?
    @size_r = 1
    @n = (n.is_a?(Array) ? n.size : n)
    while @size_r < @n
      @size_r <<= 2
    end
    @func = func
    @unity = unity
    @data = Array.new(@size_r * 2, @unity)
    if n.is_a?(Array)
      @n.times { |i| @data[i + @size_r] = n[i] }
      self.build()
    end
  end

  # set value at index, index is 0-indexed
  def set(index, value)
    raise IndexError if index >= @n
    @data[index + @size_r] = value
  end

  def build
    (@size_r - 1).downto(1) do |k|
      @data[k] = @func.call(@data[k * 2], @data[k * 2 + 1])
    end
  end

  # update the previous value at index to value, index is 0-indexed
  def update(index, value)
    raise IndexError if index >= @n
    index += @size_r
    @data[index] = value
    index >>= 1
    while index > 0
      @data[index] = @func.call(@data[index * 2], @data[index * 2 + 1])
      index >>= 1
    end
    true
  end

  # get [a, b), a and b are 0-indexed
  def get(a, b)
    raise IndexError if a > @n || b > @n || a > b
    vleft = vright = @unity
    left = a + @size_r
    right = b + @size_r
    while (left < right)
      if (left & 1) == 1
        vleft = @func.call(vleft, @data[left])
        left += 1
      end
      if (right & 1) == 1
        right -= 1
        vright = @func.call(@data[right], vright)
      end
      left >>= 1
      right >>= 1
    end
    return @func.call(vleft, vright)
  end

  def [](k)
    @data[@size_r + k]
  end
end

# __END__
N = gets.to_i
a = gets.split.map(&:to_i)

seg = SegmentTree.new(a, 0) { |x, y| x.gcd(y) }
ans = 0
N.times do |i|
  left = seg.get(0, i)
  right = seg.get(i + 1, N)
  ans = [ans, left.gcd(right)].max
end

puts ans


Measured memory_bytes: 15252
N = int(input())
dp = [float('inf')]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    dp[i] = 1 + dp[i-1]
    j, k = 1, 1
    while pow(6, j) <= i:
        dp[i] = min(dp[i], 1 + dp[i - pow(6, j)])
        j += 1
    while pow(9, k) <= i:
        dp[i] = min(dp[i], 1 + dp[i - pow(9, k)])
        k += 1
print(dp[-1])

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

#ifdef DEBUG
#define debug(...) __VA_ARGS__
#else
#define endl '\n'
#define debug(...)
#endif
#define debugf(...) debug(printf(__VA_ARGS__))

using ll = long long;

map<int, int> f;

int (((((main)))))() <%
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

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

    int q; cin >> q;
    while (q--) {
        int x, y;
        cin >> x >> y;

        sum += ll(y - x) * f[x];
        f[y] += f[x];
        f[x] = 0;

        cout << sum << endl;
    }

    return 0;
%>

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  ll A, B;
  cin >> A >> B;
  cout << A * B / __gcd(A, B) << endl;
  return 0;
}

Measured memory_bytes: 3588
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0113
"""
import sys



def solve(p, q):
    quotients = []
    mods = []
    cyclic = False
    cycle_start = 0
    cycle_length = 0

    while True:
        mods.append(p)
        p *= 10
        quotients.append(p // q)
        p = p % q

        if p == 0:
            break
        if p in mods:
            cyclic = True
            cycle_start = mods.index(p)
            cycle_length = len(quotients) - mods.index(p)
            break

    return cyclic, quotients, cycle_start, cycle_length


def main(args):
    for line in sys.stdin:
        p, q = [int(x) for x in line.strip().split(' ')]
        cyclic, quotients, cycle_start, cycle_length = solve(p, q)
        if cyclic:
            print(''.join(map(str, quotients)))
            print(' '*cycle_start + '^'*cycle_length)
        else:
            print(''.join(map(str, quotients)))


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7688
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	cost := 0
	for i := 1; i < len(s); i++ {
		if s[i] == 'E' {
			cost++
		}
	}
	min := cost
	for i := 1; i < len(s); i++ {
		if s[i-1] == 'W' {
			cost++
		}
		if s[i] == 'E' {
			cost--
		}
		if cost < min {
			min = cost
		}
	}

	fmt.Println(min)
}


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

int main(void) {
    int n;
    long long ans = 0;
    vector<int> a, b, c;
    cin >> n;
    a.resize(n);
    b.resize(n);
    c.resize(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n; i++) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    for (int i = 0; i < n; i++) {
        vector<int>::iterator low = lower_bound(a.begin(), a.end(), b[i]), up = upper_bound(c.begin(), c.end(), b[i]);
        ans += (long long)distance(a.begin(), low) * distance(up, c.end());
    }
    cout << ans << endl;
}


Measured memory_bytes: 1408
A = input()
n = len(A)
ans = ''
for i in range(2**(n-1)):
    tmp = ''
    for j in range(n-1):
        tmp += A[j]
        if i & (1 << j):
            tmp += '+'
        else:
            tmp += '-'
    tmp += A[-1]
    if eval(tmp) == 7:
        ans = tmp
        break

print(tmp + '=7')

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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 h, w, n;
    cin >> h >> w >> n;
    i64 sr, sc;
    cin >> sr >> sc;
    string s, t;
    cin >> s >> t;
    map<char, i64> cnt;
    bool f = true;
    for (i64 i = 0; i < n; i++) {
        cnt[s[i]]++;

        if (sc - cnt['L'] < 1 || sc + cnt['R'] > w
            || sr - cnt['U'] < 1 || sr + cnt['D'] > h) {
            f = false;
            break;
        }

        switch (t[i]) {
        case 'L':
            if (sc + cnt['R'] > 1) cnt['R']--;
            break;
        case 'R':
            if (sc - cnt['L'] < w) cnt['L']--;
            break;
        case 'U':
            if (sr + cnt['D'] > 1) cnt['D']--;
            break;
        case 'D':
            if (sr - cnt['U'] < h) cnt['U']--;
            break;
        }
    }

    cout << (f ? "YES" : "NO") << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


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

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

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int N, M;
    cin >> N >> M;
    
    vector<int> A(M);
    for (auto &i : A) cin >> i;
    
    ll ans = -1;
    ll sum = accumulate(A.begin(), A.end(), 0L);
    if (sum <= N) ans = N - sum;

    cout << ans << endl; 
}

Measured memory_bytes: 3668
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        for(int i=0;i<=n/7;i++){
            if((n-7*i)%4==0){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll A, B, C, K;
        cin >> A >> B >> C >> K;

        if (even(K)) {
                ll ans = A - B;
                if (abs(ans) > 1e18) {
                        cout << "Unfair" << endl;
                } else {
                        cout << ans << endl;
                }
        } else {
                ll ans = B - A;
                if (abs(ans) > 1e18) {
                        cout << "Unfair" << endl;
                } else {
                        cout << ans << endl;
                }
        }
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    double n,t,a; cin >> n >> t >> a;
    double minnum = INF;
    int ans = 0;
    vector<double> v(n);
    for(int i = 0; i<n; i++){
        cin >> v[i];
    }
    for(int i = 0; i<n; i++){
        if(minnum>abs((t-v[i]*0.006)-a)){
            minnum = abs((t-v[i]*0.006)-a);
            ans = i;
        }
    }
    cout << ans + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main () {
  int N, W;
  cin >> N >> W;
  vector<vector<long long>>dp(N + 1, vector<long long>(W + 1, 0));
  //dp[i][j] = i番めまで処理したときの重さjの最大値
  for (int i = 1; i <= N; i ++) {
    int w;
    long long v;
    cin >> w >> v;
    for (int j = 0; j <= W; j ++) dp[i][j] = dp[i - 1][j];
    for (int j = 0; j <= W - w; j ++) {
      long long k = dp[i - 1][j] + v;
      if (k > dp[i][j + w]) dp[i][j + w] = k;
    }
  }
  long long ans = 0;
  /*for (int i = 0; i <= N; i ++) {
    for (int j = 0; j <= W; j ++) {
      cout << dp[i][j] << ' ';
    }
    cout << endl;
  }*/
  for (int i = 0; i <= W; i ++) {
    if (ans < dp[N][i]) ans = dp[N][i];
  }
  cout << ans << endl;
}
  
  



Measured memory_bytes: 80256
import math

epsilon = 5 * 10 ** (-7)

N = int(input())
xys = [tuple(map(int, input().split())) for _ in range(N)]
xs, ys = zip(*xys)

lsd = 0  #longest squared distance
for i in range(0, N):
    for j in range(i+1, N):
        sd = (xs[i] - xs[j]) ** 2 + (ys[i] - ys[j]) ** 2 
        if lsd < sd:
            lsd = sd
            farthest_2_points = (i, j)

#try a circle that has a line connecting farthest 2 points as a diameter.
p, q = farthest_2_points
center_x = (xs[p] + xs[q]) / 2
center_y = (ys[p] + ys[q]) / 2
all_in_circle = True
for i in range(N):
    if (xs[i] - center_x)**2 + (ys[i] - center_y)**2 > lsd / 4 + epsilon:
        all_in_circle = False

if all_in_circle:
    #We want the radius, not the diameter.
    print(lsd ** 0.5 / 2)
    exit()

#If failed, then try any circles that has 3 or more points on the edge.
smallest_radius = 10 ** 9
for p in range(0, N):
    for q in range(p+1, N):
        for r in range(q+1, N):
            #vec1 = (xs[p] - xs[r], ys[p] - ys[r])
            #vec2 = (xs[q] - xs[r], ys[q] - ys[r])
            pq = ((xs[q] - xs[p])**2 + (ys[q] - ys[p])**2)**0.5
            v1x = xs[p] - xs[r]
            v1y = ys[p] - ys[r]
            v2x = xs[q] - xs[r]
            v2y = ys[q] - ys[r]
            vec1_len = (v1x**2 + v1y**2)**0.5
            vec2_len = (v2x**2 + v2y**2)**0.5
            vecs_dot = v1x*v2x + v1y*v2y
            theta = math.acos(min(1.0, max(-1.0, vecs_dot / (vec1_len * vec2_len))))
            if theta == 0:
                continue
            radius = pq / (2 * math.sin(theta))

            #calculate where the center is
            det = v1x * v2y - v1y * v2x
            if det == 0:
                continue
            center_x = xs[r] + (   v2y  * vec1_len**2 + (-v1y) * vec2_len**2) / (2 * (det))
            center_y = ys[r] + ( (-v2x) * vec1_len**2 +   v1x  * vec2_len**2) / (2 * (det))
            all_in_circle = True
            for s in range(N):
                if ((xs[s] - center_x)**2 + (ys[s] - center_y)**2)**0.5 > radius + epsilon:
                    all_in_circle = False
            if all_in_circle:
                smallest_radius = min(smallest_radius, radius)
print(smallest_radius)

Measured memory_bytes: 9760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		sc.close();

		if(b % a == 0) {
			System.out.println((a+b));
		}else {
			System.out.println((b-a));
		}

	}

}


Measured memory_bytes: 23636
//  思维+贪心
// Aizu - 2681 
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
typedef long long ll;
#define lowbit(x) (x&(-x))
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
using namespace std;
const int N=1e2+9;
int n;
char s[N];
typedef pair<int,int>P;
P p[N];
P solve(char s[])
{
    int l=0,r=0;
    int i;
    for(i=0;s[i];i++){
        if(s[i]=='(')  l++;
        else if(l)  l--;
        else r++;
    }
    return P(l,r);//l为( 数目，r为)数目
}
bool vis[N];
int main()
{
    scanf("%d",&n);
    int  cnt=0;
    for(int i=0;i<n;i++)
    {
        scanf("%s",s);
        p[i]=solve(s);
        if(!p[i].second) cnt+=p[i].first,i--,n--;
        // cnt 为只有(的字符串的（的和
    }
     int ans=0,ret=1;
     memset(vis,0,sizeof(vis));
     int mx,id;
     for(int i=0;i<n&&ret;i++){
         id=-1,mx=-120;
         for(int j=0;j<n;j++)
         {
             if(vis[j]||ans<p[j].first) continue;
             int k=p[j].second-p[j].first;
             if(mx<k) mx=k,id=j;
         }
         //第一个放在最右边 ，依次往左（前）放。
        // mx 提供最多的右括号，（贪心）
         if(id==-1)  ret=0;
         vis[id]=1;
         ans+=mx;//ans 为这个字符串的净提供右括号数目。
     }
    // printf("%d %d %d\n",ret,ans,cnt);
     if(ret&&ans==cnt)  printf("Yes\n");
     else printf("No\n");
     return 0;
}


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

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)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin >> n;
  int m;
  cin >> m;
  pint pp[n];
  priority_queue<int> p;
  rep(i,n){
    int x,y;
    cin >> x >> y;
    pp[i].first=x;
    pp[i].second=y;
  }
  sort(pp,pp+n);
  int temp=0;
  int ans=0;
  for(int i=1;i<=m;i++){
    while(temp<n && pp[temp].first<=i){
      p.push(pp[temp].second);
      temp++;
    }
    if(p.size()==0)continue;
    int z=p.top();
    ans+=z;
    p.pop();
  }
  cout << ans << endl;
return 0;}


Measured memory_bytes: 1660
while True:
    n = int(input())
    if n == 0: break
    w, h = map(int, input().split())
    trees = [[0 for i in range(h+1)] for j in range(w+1)]
    dis = [[0 for i in range(h+1)] for j in range(w+1)]
    for i in range(n):
        x, y = map(int, input().split())
        trees[x][y] = 1

    for i in range(1, w+1):
        for j in range(1, h+1):
            dis[i][j] = trees[i][j] + dis[i-1][j] \
                    + dis[i][j-1] - dis[i-1][j-1]

    s, t = map(int, input().split())

    ans = 0
    for i in range(1, w - s + 2):
        for j in range(1, h - t + 2):
            num = dis[i+s-1][j+t-1] - dis[i+s-1][j-1] \
                    - dis[i-1][j+t-1] + dis[i-1][j-1]
            ans = max(ans, num)

    print(ans)

Measured memory_bytes: 6916
/*  -*- coding: utf-8 -*-
 *
 * 2930.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

int as[MAX_N], bs[MAX_N];
int ds[MAX_N], os[MAX_N * 2];

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", as + i);
  for (int i = 0; i < m; i++) scanf("%d", bs + i);

  int dn = 0, on = 0;
  int ai = 0, bi = 0;
  while (ai < n && bi < m) {
    if (as[ai] < bs[bi])
      os[on++] = as[ai++];
    else if (as[ai] > bs[bi])
      os[on++] = bs[bi++];
    else
      ds[dn++] = os[on++] = as[ai++], bi++;
  }
  while (ai < n) os[on++] = as[ai++];
  while (bi < m) os[on++] = bs[bi++];

  printf("%d %d\n", dn, on);
  for (int i = 0; i < dn; i++) printf("%d\n", ds[i]);
  for (int i = 0; i < on; i++) printf("%d\n", os[i]);
  return 0;
}



Measured memory_bytes: 5060
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

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, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        sticks: [usize;n]
    }

    let mut sticks = sticks.clone();
    sticks.sort();

    let mut ans = 0;

    for i in 0..n - 1 {
        for j in i + 1..n - 1 {
            let sub = sticks[j] - sticks[i];
            let sum = sticks[j] + sticks[i];

            let a = binsearch(&sticks[j + 1..], sub);
            let b = binsearch(&sticks[j + 1..], sum);

            ans += b - a;
        }
    }

    println!("{}", ans);
}

fn binsearch(v: &[usize], q: usize) -> usize {
    if v.is_empty() || q <= v[0] {
        return 0;
    }
    let mut min = 0;
    let mut max = v.len();
    while max - min > 1 {
        let c = (min + max) / 2;
        if v[c] < q {
            min = c;
        } else {
            max = c;
        }
    }
    max
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 8572
#include <atcoder/all>
#include <bits/stdc++.h>

using namespace atcoder;
using namespace std;

using mint = modint998244353;

struct S {
  mint val;
  int sz;
};

S op(S l, S r) { return S{l.val + r.val, l.sz + r.sz}; }
S e() { return S{0, 0}; }

struct F {
  mint m, c;
};

S mapping(F val, S node) { return S{node.val * val.m + node.sz * val.c, node.sz}; }
F composition(F f, F g) { return F{g.m * f.m, g.c * f.m + f.c}; }
F id() { return F{1, 0}; }

int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  vector<S> a(n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    a[i] = S{x, 1};
  }

  lazy_segtree<S, op, e, F, mapping, composition, id> tree(a);

  while (q--) {
    int t, l, r;
    scanf("%d %d %d", &t, &l, &r);
    if (t == 0) {
      int b, c;
      scanf("%d %d", &b, &c);
      tree.apply(l, r, F{b, c});
    } else if (t == 1) {
      printf("%d\n", tree.prod(l, r).val.val());
    }
  }
  return 0;
}


Measured memory_bytes: 19272
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pci pair<char, int>
#define pic pair<int, char>
#define plvl pair<long long, vector<long long> >
#define pcvc pair<char, vector<char> >


using namespace std;

const int mod = 1e9 + 7;

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

template <typename T>
void show1(vector<T> dp) {
	for(auto d : dp) {
		cout << d << " ";
	}
	cout << "\n";
}

template <typename T>
void show2(vector<vector<T> > dp) {
	for(auto d : dp) {
		for(auto dd : d) {
			cout << dd << " ";
		}
		cout << "\n";
	}
}

void executeCode() {
	ll n;
	cin >> n;
	map<string, ll> mp;
	while(n--) {
		string str;
		cin >> str;
		mp[str]++;
	}
	cout << "AC" << " x " << mp["AC"] << "\n";
	cout << "WA" << " x " << mp["WA"] << "\n";
	cout << "TLE" << " x " << mp["TLE"] << "\n";
	cout << "RE" << " x " << mp["RE"] << "\n";
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int tt = 1;
	// cin >> tt;
	while(tt--) {
		executeCode();	
	}
	return 0;
}

Measured memory_bytes: 3660
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 998244353
#define INF2 1000000000000000000
#define int long long

int dp[3010][6010];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, S;
    cin >> N >> S;
    int A[3010];
    rep(i, N) cin >> A[i];
    dp[0][0] = 1;
    REP(i, 0, N) dp[i][0] = 1;
    rep(i, N) {
        RREP(j, S, 0) {
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j + A[i]] += dp[i][j];
            dp[i + 1][j] %= mod;
            dp[i + 1][j + A[i]] %= mod;
        }
    }
    int ans = 0;
    rep(i, N + 1) ans = (ans + dp[i][S]) % mod;
    cout << ans << endl;

    return 0;
}
// (1, 1) (1, 2) (1, 3)
// ()


//

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

#define MAX 2000001
#define VMAX 10000

int main()
{
  unsigned short *A, *B;
  
  int C[VMAX+1];
  int n, i, j;
  scanf("%d",&n);
  
  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);
  
  for(i=0;i<=VMAX;i++) C[i] = 0;
  
  for(i=0;i<n;i++) {
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  
  for(i=1;i<=VMAX;i++) C[i] = C[i] + C[i-1];
  
  for(j=1;j<=n;j++) {
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  
  for(i=1;i<=n;i++) {
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  
  return 0;
}


Measured memory_bytes: 9588
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;

typedef long long ll;
ll MOD = 1e9+7;

int main()
{
	int a[6];
	int b[3];
	for(int i=0;i<6;i++)
		cin>>a[i];
	
	int cnt[5];
	fill(cnt,cnt+5,0);
	for(int i=0;i<6;i++)
		cnt[a[i]]++;
	bool ans=true;
	for(int i=1;i<5;i++)
	{
		if(cnt[i]>=3)
			ans=false;
	}
	if(ans)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int [] v = new int [n];
        int [] c = new int [n];

        for(int i=0; i<n; i++){
            v[i] = stdIn.nextInt();
        }
        for(int i=0; i<n; i++){
            c[i] = stdIn.nextInt();
        }
        int a = 0;

        for(int i=0; i<n; i++){
            if(v[i]>c[i]){
                a += (v[i]-c[i]);
            }
        }

        System.out.println(a);

    }
}


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

using namespace std;

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

int s = a.size();
int cnt = 0;
for(int i = 0;i < s;i++){
	if(a[i] != b[i]){
		cnt++;
	}
}

cout << cnt <<endl;
}

Measured memory_bytes: 3916
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();
		char[] array = s.toCharArray();
		Arrays.sort(array);
		StringBuilder sb = new StringBuilder();
		boolean isNone = true;
		for (int c = 'a'; c <= 'z'; c++) {
			if (Arrays.binarySearch(array, (char)c) < 0) {
				sb.append((char)c);
				isNone = false;
				break;
			}
		}
		if (isNone) {
			System.out.println("None");
		} else {
			System.out.println(sb.toString());
		}
	}
}

Measured memory_bytes: 26300
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <stack>
using namespace std;
using ll = long long;

int main(){
  string S;
  cin >> S;

  stack<char> s;
  int ans=0;

  for(int i=0;i<S.size();i++){
    if(s.empty()){
      s.push(S.at(i));
      continue;
    }
    if(s.top()!=S.at(i)){
      ans+=2;
      s.pop();
    }
    else s.push(S.at(i));
  }

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


Measured memory_bytes: 3824
N = int(input())
A = list(map(int, input().split(' ')))
mod = 10 ** 9 + 7
c = [0, 0, 0]
ans = 1
for i in A:
    ans *= c.count(i)
    if i == c[0]:
        c[0] += 1
    elif i == c[1]:
        c[1] += 1
    else:
        c[2] += 1
    ans %= mod
print(ans)


Measured memory_bytes: 52716
#include <iostream>
using namespace std;
int N, Q, tp, a, b, c, d[109][109];
int main() {
	while (scanf("%d%d", &N, &Q), N) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (i == j) d[i][j] = 0;
				else d[i][j] = 999999999;
			}
		}
		while (Q--) {
			scanf("%d%d%d", &tp, &a, &b); a--, b--;
			if (tp == 1) {
				scanf("%d", &c);
				for (int i = 0; i < N; i++) {
					for (int j = 0; j < N; j++) {
						int dist2 = d[i][a] + c + d[b][j];
						if (d[i][j] > dist2) d[i][j] = dist2;
					}
				}
				swap(a, b);
				for (int i = 0; i < N; i++) {
					for (int j = 0; j < N; j++) {
						int dist2 = d[i][a] + c + d[b][j];
						if (d[i][j] > dist2) d[i][j] = dist2;
					}
				}
			}
			else printf("%d\n", d[a][b] != 999999999 ? d[a][b] : -1);
		}
	}
	return 0;
}

Measured memory_bytes: 3224
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    VEC(string) S(3);
    READVEC(S);
    VEC(int) pos(3, 0);

    int turn = 0;
    while (pos[turn] < S[turn].size()) {
        turn = S[turn][pos[turn]++] - 'a';
    }

    cout << "ABC"[turn] << endl;
    return 0;
};


Measured memory_bytes: 256
import collections

N = int(input())
A = [int(i) for i in input().split()]

count = collections.Counter(A).most_common()

candidate = [(i,j) for i,j in count if j >= 2]

if len(candidate) == 0:
    print(0)
    exit()

candidate = sorted(candidate)

if candidate[-1][1] >= 4:
    print(candidate[-1][0] ** 2)
else:
    print(candidate[-1][0] * candidate[-2][0])


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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    int x,a,b; cin >> x >> a >> b;
    if(abs(a-x) <= abs(b-x)) cout << "A" << endl;
    else cout << "B" << endl;
    return 0;
}

Measured memory_bytes: 256
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.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author SimplyDivine
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(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, FastReader in, PrintWriter out) {
            String s = in.next();
            int n = s.length() - 2;
            String ans = "" + s.charAt(0) + n + s.charAt(s.length() - 1);
            out.println(ans);
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream i) {
            br = new BufferedReader(new
                    InputStreamReader(i));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 23380
# -*- coding: utf-8 -*-


def judge_class(s):
    if s <= 48.00:
        return 'light fly'
    elif 48.00 < s <= 51.00:
        return 'fly'
    elif 51.00 < s <= 54.00:
        return 'bantam'
    elif 54.00 < s <= 57.00:
        return 'feather'
    elif 57.00 < s <= 60.00:
        return 'light'
    elif 60.00 < s <= 64.00:
        return 'light welter'
    elif 64.00 < s <= 69.00:
        return 'welter'
    elif 69.00 < s <= 75.00:
        return 'light middle'
    elif 75.00 < s <= 81.00:
        return 'middle'
    elif 81.00 < s <= 91.00:
        return 'light heavy'
    elif 91.00 <= s:
        return 'heavy'


while True:
    try:
        weight = float(input())
        print(judge_class(weight))
    except:
        break

Measured memory_bytes: 7424
import java.util.Scanner;

public class Main {
	public static void main(String [] args){
		Scanner scan = new Scanner(System.in);
		
		double r = scan.nextDouble();
		double s=0.0, l=0.0;
		
		s = r * r * Math.PI;
		l = 2 * Math.PI * r;
		
		System.out.println(String.format("%5f", s)+" "+String.format("%5f", l));	
	}
}

Measured memory_bytes: 18892
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
int main(){
  ll n,ii,sum,sum2;
  vector<ll> a,b;
  
  cin >> n;

  a.resize(n+1);
  b.resize(n+1);

  sum = 0;
  sum2 = 0;
  
  for(ii=0;ii<n;ii++){
    cin >> a[ii];
    sum += a[ii];
  }
  
  b[0] = 0;
  
  for(ii=1;ii<=n;ii++){
    if(ii!=n){
      b[ii] = 2*a[ii-1] - b[ii-1];
    }
    else{
      b[ii] = 2*a[ii] - b[0];
    }
    sum2 += b[ii-1];
  }
  
  b[0] = sum - sum2;
  //cout << "sum:" <<  sum  << "sum2:" << sum2 << endl;
  for(ii=1;ii<=n;ii++){
    if(ii!=n){
      b[ii] = 2*a[ii-1] - b[ii-1];
    }
    else{
      b[ii] = 2*a[ii] - b[0];
    }
    sum2 += b[ii];
  }
  
  for(ii=0;ii<n;ii++){
    cout << b[ii] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)) {

			int x = sc.nextInt();
			for(int i = 0 ; i <= x / 100 ; i++) {
				for(int j = 0 ; j <= x / 101 ; j++) {
					for(int k = 0 ; k <= x / 102 ; k++) {
						for(int l = 0 ; l <= x / 103 ; l++) {
							for(int m = 0 ; m <= x / 104 ; m++) {
								for(int n = 0 ; n <= x / 105 ; n++) {
									if((i * 100 + j * 101 + k * 102 + l * 103 + m * 104 + n * 105) == x) {
										System.out.println(1);
										return;
									}
								}
							}
						}
					}
				}
			}
			System.out.println(0);

		}

	}

}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
char a[110000];
int n,ans;
int main() {
  scanf("%d",&n);
  for(int i=1;i<=n;++i) {
  	a[i] = getchar();
  	while (a[i] < 'a' || a[i] > 'z') a[i] = getchar();
  }
  ans = 1;
  for(int i=2;i<=n;++i) {
  	if (a[i] ^ a[i - 1]) ++ ans;
  }
  printf("%d",ans);
  return 0;
}

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

#define INF 2e9

int A,B;

int main(){

    scanf("%d %d", &A, &B);


    int c = 1;
    int ans = 0;

    if(B == 1){
        printf("%d",0);
        return 0;
    }

    while(true){
        c--;
        ans++;
        c += A;
        if(c >= B){
            break;
        }
    }

    printf("%d",ans);


    return 0;
}

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

int top, S[1000];

void push(int x)
{
    S[++top] = x;
}

int pop()
{
    top--;
    return S[top + 1];
}

int main()
{
    int a, b;
    top = 0;
    char s[100];

    while (scanf("%s", s) != EOF)
    {
        if (s[0] == '+')
        {
            a = pop();
            b = pop();
            push(a + b);
        }
        else if (s[0] == '-')
        {
            b = pop();
            a = pop();
            push(a - b);
        }
        else if (s[0] == '*')
        {
            a = pop();
            b = pop();
            push(a * b);
        }
        else
        {
            push(atoi(s));
        }
    }

    printf("%d\n", pop());

    return 0;
}


Measured memory_bytes: 2768