akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<string>

using namespace std;

const double eps = 1e-12;
#define REP(i, x) for (int i=0;i<x;i++)

double tmp[107][107];
double rest[107][107],rsum[107][107];
int N,M,L;
int p[107],t[107],v[107];
double pp[107];

int main()
{
    while (scanf("%d%d%d",&N,&M,&L) != EOF)
    {
        REP(i,N) scanf("%d%d%d",&p[i],&t[i],&v[i]);
        REP(i,N) pp[i] = p[i] / 100.0;
        REP(i,N)
        {
            REP(j,M+1) REP(k,M+1) tmp[j][k] = 0;
            tmp[0][0] = 1.00;
            for (int j = 1;j <= M;++j)
                for (int k = 0;k <= j;++k)
                {
                    tmp[j][k] = tmp[j-1][k] * (1-pp[i]);
                    if (k) tmp[j][k] += tmp[j-1][k-1] * pp[i];
                }
            for (int j = M;j >= 0;--j)
            {
                rest[i][j] = tmp[M][j];
                rsum[i][j] = tmp[M][j];
           //     cout<<rest[i][j]<<" ";
                if (j!=M) rsum[i][j] += rsum[i][j+1];
            }
        }
        REP(i,N)
        {
            double ans = 0;
            for (int times = 0;times <= M && v[i] != 0;++times)
            {
                double part = 1.00;
                double use = L / (double)v[i] + t[i] * times;
                for (int k = 0;k < N;++k)
                    if (k != i)
                    {
                        if (v[k] == 0) continue;
                        int l = 0,r = M;
                        while (l < r)
                        {
                            int mid = (l+r)>>1;
                            double total = L / (double) v[k] + t[k] * mid;
                            if (total <= use)
                                l = mid+1;
                            else r = mid;
                        }
                        double total = L / (double) v[k] + t[k] * l;
                        
                      //  --l;
                        if (total <= use)
                        {
                            part = 0.00;
                            break;
                        } else
                            part *= rsum[k][l];
                    }
                ans += rest[i][times] * part;
            }
            printf("%.8f\n",ans);
        }
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,X,Y;cin >> N >> X >> Y;
  cout << min(X,Y) SP max(0,X+Y-N) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

int main()
{
	int N, K;
	cin >> N >> K;
	// vector<vector<int>> A(N, vector<int>(K, 0));
	vector<bool> memo(N, false);
	rep(i, K)
	{
		int d;
		cin >> d;
		rep(j, d)
		{
			int A;
			cin >> A;
			memo[A-1] = true;
		}
	}
	int ans = 0;
	for (auto&& m : memo)
	{
		if (!m)
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
A=input()
B=int(A[:2])
C=int(A[2:4])
  
if(1<=B<=12):
    if(1<=C<=12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif(1<=C<=12):
    print('YYMM')    
else:
    print('NA')
    

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()
#define MP make_pair

int main() {
	int n, op[110][10], vo[110][11], ans = 0,f = 0;
	cin >> n;
	REP(i, n) REP(j, 10) cin >> op[i][j];
	REP(i, n) REP(j, 11) cin >> vo[i][j];
	for (int bit = 1; bit < (1 << 10); ++bit) {
		int c = 0, a[110] = {};
		REP(i,10){
			if (bit & (1 << i)) {
				REP(j, n) if (op[j][i] == 1) a[j]++;
			}
		}
		REP(j, n) c += vo[j][a[j]];
		if (f == 0 && bit != 0) {
			ans = c;
			f++;
		}
		else ans = max(c, ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template< class T>
T pow_ (T x, uint64_t n, uint64_t M){
    T u = 1;
    if(n > 0){
        u = pow_(x, n/2, M);
        if (n % 2 == 0) u = (u*u) % M;
        else u = (((u * u)% M) * x) % M;
    }
    return u;
};

bool suspect(__uint128_t a, uint64_t s, uint64_t d, uint64_t n){
    __uint128_t x = pow_(a, d, n);
    if (x == 1) return true;
    for (int r = 0; r < s; ++r) {
        if(x == n-1) return true;
        x = x * x % n;
    }
    return false;
}

template<class T>
bool miller_rabin(T m){
    uint64_t n = m;
    if (n <= 1 || (n > 2 && n % 2 == 0)) return false;
    uint64_t d = n - 1, s = 0;
    while (!(d&1)) {++s; d >>= 1;}
    vector<uint64_t> v = {2, 325, 9375, 28178, 450775, 9780504, 1795265022};
    if(n <= 4759123141LL) v = {2, 7, 61};
    for (auto &&p : v) {
        if(p >= n) break;
        if(!suspect(p, s, d, n)) return false;
    }
    return true;
}

int main() {
    int x;
    cin >> x;
    for (int i = x; ; ++i) {
        if(miller_rabin(i)){
            cout << i << "\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s[n+1];
    int i,j;
    int d=0,f=0,g=0;
    int c=0;
    for(i=1;i<=n;i++)
    {
        cin>>s[i];
        if(s[i][0]=='B'&&s[i][s[i].size()-1]=='A')
        {
            d++;
        }
        else if(s[i][0]=='B')
        {
            f++;
        }
        else if(s[i][s[i].size()-1]=='A')
        {
            g++;
        }
        for(j=1;j<s[i].size();j++)
        {
            if(s[i][j]=='B'&&s[i][j-1]=='A')
            {
                c++;
            }
        }
    }
    //cout<<c<<" "<<d<<" "<<f<<" "<<g<<endl;
    long long ee=0;
    if(d>0)
    {
        if(f!=g)
            ee=1;
        if(f==g&&f>0)
        {
            ee=2;
            f--;
            g--;
        }
        ee+=(d-1);
    }
    cout<<c+min(f,g)+ee<<endl;
}


Measured memory_bytes: 768
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	k := scanInt()
	x := scanInts(n)

	ans := 1 << 50
	for i := 0; i < n-k+1; i++ {
		t := x[i : i+k]
		a, b := t[0], t[len(t)-1]
		if a*b < 0 {
			ans = min(ans, abs(a)+abs(b)+min(abs(a), abs(b)))
		} else {
			ans = min(ans, max(abs(a), abs(b)))
		}
		// debug(ans, t)
	}
	fmt.Fprintln(wr, ans)
}


Measured memory_bytes: 2944
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
vint adj[100001];
int p[100001];
bool visited[100001]={};
vint ko[100001];
int depthmax=0;
vint edgedepth[100001];
void dfs(int u,int depth){
	visited[u]=1;
	edgedepth[depth].push_back(u);
	depthmax=max(depthmax,depth);
	int flag=0;
	rep(i,adj[u].size()){
		int v=adj[u][i];
		if(visited[v]==0){
			flag=1;
			p[v]=u;
			ko[u].push_back(v);
			dfs(v,depth+1);
		}
	}
}
int main(){
	int N;
	int a[100001],b[100001];
	scan(N);
	rep(i,N-1){
		scan(a[i]>>b[i]);
		a[i]--; b[i]--;
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	p[0]=-1;
	dfs(0,0);
	int grundy[100001];
	brep(d,depthmax+1){
		rep(i,edgedepth[d].size()){
			int v=edgedepth[d][i];
			grundy[v]=0;
			rep(j,ko[v].size()){
				int u=ko[v][j];
				grundy[v]^=(grundy[u]+1);
			}
		}
	}
	if(grundy[0]==0) prin("Bob");
	else prin("Alice");
	return 0;
}


Measured memory_bytes: 24576
import java.lang.Math.*

fun main(args: Array<String>) {
  val (n, k) = readLine()!!.split(" ").map { it.toInt() }
  val x = readLine()!!.split(" ").map { it.toInt() }
  var ans = 1000000000
  for (i in 0..n - k) {
    val l = x[i]
    val r = x[i + k - 1]
    ans = arrayOf(ans, abs(l) + abs(r - l), abs(r) + abs(l - r)).min()!!
  }
  println(ans)
}


Measured memory_bytes: 53700
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n;
    cin >> n;
    vector<P> info[n]; //info[i]: i人目の証言(i<=0 <= n-1)
    rep(i, n){
        int num; cin >> num;
        rep(j, num){
            int x, y;
            cin >> x >> y;
            info[i].emplace_back(--x, y);
        }
    }

    int ans = 0;
    rep(i, 1ll<<n){
        int cnt = 0;
        bool isok = true;
        rep(j, n){
            if(i>>j & 1){
                rep(k, info[j].size()){
                    if (info[j][k].second && !(i>>info[j][k].first & 1)){
                        isok = false; break;
                    } else if (!info[j][k].second && (i>>info[j][k].first & 1)){
                        isok = false; break;
                    }
                }
                cnt++;
            }
            if(!isok) break;
        }
        if(isok) ans = max(ans, cnt);
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
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)++)
typedef long long ll;

int main(){
    int n; cin >> n;
    vector<int> color(9,0);
    rep(i,n){
        int late; cin>>late;
        if(late>=3200)color[8]++;
        else color[late/400]++;
    }
    int res=0;
    rep(i,8){
        if(color[i]>0)res++;
    }
    cout << max(res,1) << ' ';
    cout << res+color[8] << endl;
    return 0;
}

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

int main() {
    int H, W;
    cin >> H >> W;
    char field[60][60];
    int num_wall = 0;
    REP(i, H) { REP(j, W) {
        cin >> field[i+1][j+1];
        if (field[i+1][j+1] == '#') num_wall++;
    }};

    int distance[60][60];
    REP(i, H) { REP(j, W) distance[i+1][j+1] = -1; };
    distance[1][1] = 0;

    queue<pair<int, int> > q;
    q.push(make_pair(1, 1));

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

    while (!q.empty()) {
        int y = q.front().first;
        int x = q.front().second;
        if (y == H && x == W) {
            break;
        }
        q.pop();
        REP(i, 4) {
            int ny = y + dy[i];
            int nx = x + dx[i];
            if (0 < ny && ny <= H && 0 < nx && nx <= W
                    && field[ny][nx] == '.'
                    && distance[ny][nx] == -1)
            {
                q.push(make_pair(ny, nx));
                distance[ny][nx] = distance[y][x] + 1;
            }
        }
    }

    int ans = -1;
    if (distance[H][W] != -1) {
        ans = H * W - distance[H][W] - num_wall - 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
class ASHKJA{static void Main(){
int n=int.Parse(Console.ReadLine());
int []a=new int[2];
for(int i=0;i<n;i++)
{  
string []s=Console.ReadLine().Split();
if(s[0]==s[1]){a[0]++;a[1]++;continue;}
string []x=new string[2];
x[0]=s[0];
x[1]=s[1];
Array.Sort(x);
if(x[1]==s[1]){a[1]+=3;}
else{a[0]+=3;}
  
  
}Console.WriteLine(a[0]+" "+a[1]);
 }
  
  
  
}

Measured memory_bytes: 9956
#include<bits/stdc++.h>
using namespace std;
#define iso ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define make_pair mp
#define clr(x,n) memset((x), n, sizeof(x))
#define mod 1000000007
#define MAX 1000005
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll ,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_tree;*/
ll dp[1005][1005];
char arr[1005][1005];
int m,n;
ll fun(int i,int j)
{
   // cout<<i<<" "<<j<<"\n";
    if(i>=m||j>=n)
        return 0;

    if(i==m-1&&j==n-1)
        return 1;

    if(dp[i][j]!=-1)
        return dp[i][j];

    ll ans=0;
    if(arr[i+1][j]=='.'&&arr[i][j+1]=='.')
        ans= (fun(i+1,j)+fun(i,j+1))%mod;
    else if(arr[i+1][j]=='.')
        ans= fun(i+1,j)%mod;
    else if(arr[i][j+1]=='.')
        ans= fun(i,j+1)%mod;
    else
        ans= 0;
    return dp[i][j]=ans;
}
int main()
{
    iso;
    int i,j;
    cin>>m>>n;
    for(i=0;i<=m;i++)
        for(j=0;j<=n;j++)
            dp[i][j]=-1;
    for(i=0;i<m;i++)
        for(j=0;j<n;j++)
            cin>>arr[i][j];
    cout<<fun(0,0);
    return 0;
}


Measured memory_bytes: 9216
require "optparse"
require "pp"

params = ARGV.getopts("")

def root_of x, parent
  ret = parent[x]
  unless ret == parent[ret]
    ret = root_of(ret, parent)
    parent[x] = ret
  end
  return ret
end


N, M = gets.split.map(&:to_i)
ps = [0] + gets.split.map(&:to_i)
parent = Array.new(N+1){ |i| i }
rank = Array.new(N+1,0)

M.times do |i|
  x, y = gets.split.map(&:to_i)
  # unless parent.has_key? x
  #   parent[x] = x
  #   rank[x] = 0
  # end
  # unless parent.has_key? y
  #   parent[y] = y
  #   rank[y] = 0
  # end
  xrt = root_of(x, parent)
  yrt = root_of(y, parent)
  rt, lf = xrt, yrt
  rt, lf = lf, rt if rank[xrt] < rank[yrt]
  parent[lf] = rt
  rank[rt] += rank[lf]
  
#   nx = ps[x-1]
#   ny = ps[y-1]
#   gx = gp[nx]
#   gx = gp[gx] while gx != gp[gx]
#   gy = gp[ny]
#   gy = gp[gy] while gy != gp[gy]
#   if gx != gy
#     marged = [gx,gy].min
#     ue = gp[nx]
#     gp[nx] = marged
#     ue, gp[ue] = gp[ue], marged while ue != marged
#     ue = gp[ny]
#     gp[ny] = marged
#     ue, gp[ue] = gp[ue], marged while ue != marged
#     # if gx < gy
#     #   gp[gy] = gx
#     #   gp[ny] = gx
#     # else
#     #   gp[gx] = gy
#     #   gp[nx] = gy
#     # end
#   end
# #  pp [x,y].join(" ")
# #  x, y = y, x if  gp[ps[x-1]] > gp[ps[y-1]]
# #  gp[ps[y-1]] = gp[ps[x-1]]
# #  pp gp
end

ret = 0
N.times do |i|
  n = i+1
  m = ps[n]
  if root_of(n, parent) == root_of(m, parent)
    ret += 1
  end
  # n_ue = gp[n]
  # while n_ue != gp[n_ue]
  #   n_ue = gp[n_ue]
  # end
  # m_ue = gp[m]
  # while m_ue != gp[m_ue]
  #   m_ue = gp[m_ue]
  # end
  # if n_ue == m_ue
  #   ret += 1
  # end
end

# N.times do |i|
#   ue = gp[i+1]
#   while gp[ue] != ue
#     gp[i+1] = gp[ue]
#     ue = gp[i+1]
#   end
# end



#pp gp
# ps.each_with_index do |p,i|
#   ret += 1 if gp[ps[p-1]] == gp[p]
# end
# pp parent
# pp rank
puts ret


Measured memory_bytes: 13988
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a == b && b == n){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

using namespace std;

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

int main()
{
	int h, w;
	string s[50];
	cin >> h >> w;
	for(int i = 0; i < h; i++)cin >> s[i];
	for(int x = 0; x < h; x++)
		for(int y = 0; y < w; y++)
		{
			if(s[x][y] != '#')
			{
				int tmp = 0;
				for(int i = 0; i < 8; i++)
				{
					if(-1 < x + dx[i] && x + dx[i] < h&&-1 < y + dy[i] && y + dy[i] < w && s[x + dx[i]][y + dy[i]] == '#')tmp++;
				}
				s[x][y] = '0' + tmp;
			}
		}
	for(int i = 0; i < h; i++)cout << s[i] << endl;

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	R := nextInt()

	fmt.Println(2.0 * float64(R) * math.Pi)
}


Measured memory_bytes: 1760
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int n, k, q;
  cin >> n >> k >> q;
  
  vector<int> v(q);
  for(int i; i < q; i++)
    cin >> v.at(i);
  
  vector<int> w(n);
  for(int i; i < n; i++)
    w.at(i) = k - q;
  
  for(int i; i < q; i++)
    w.at(v.at(i) - 1)++;
  
  for(int i; i < n; i++){
    if(w.at(i) > 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  } 
}

Measured memory_bytes: 1536
#include<stdio.h>
int main()
{
    int n,m, a, i=1, sum=0;

    scanf("%d %d", &n, &m);

    while(i<=m)
    {
        scanf("%d", &a);

        sum = sum + a;

        i++;
    }

    if(sum>n)
    {
        printf("-1");
    }

    else
    {
        printf("%d", (n-sum));
    }

}


Measured memory_bytes: 1732
n=gets.to_i
as=gets.split.map(&:to_i)
bs=gets.split.map(&:to_i)
cs=gets.split.map(&:to_i)
ans=0
n.times do |i|
  ans+=bs[as[i]-1]
  ans+=cs[as[i]-2] if i>0 && as[i]-as[i-1]==1
end
puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int D, T, S;
  cin >> D >> T >> S;
  yes(T*S >= D);
}

Measured memory_bytes: 3636
package main

import "fmt"

var A, B, C int

func main() {
	fmt.Scan(&A, &B, &C)

	remain := A % B
	remains := make(map[int]bool)
	for i := 0; i < B; i++ {
		remains[i] = false
	}

	i := 1
	for {
		tmpRemain := i * remain % B
		if tmpRemain == C {
			fmt.Println("YES")
			return
		} else {
			if remains[tmpRemain] == false {
				remains[tmpRemain] = true
			} else {
				fmt.Println("NO")
				return
			}
		}
		i += 1
	}
}


Measured memory_bytes: 512
# include <bits/stdc++.h>
# define rep(i,n) for (int i = 0; i < n; i++)
# define all(v) v.begin() ,v.end()
using namespace std;
using ll = long long;


int main()
{
  int N;
  cin >> N;
  vector<int> B(N);
  rep(i,N){
    cin >> B[i];
  }
  vector<int> ans;
  while (B.size() > 0){
    int z = -1;
    rep(i,B.size()){
      if(B[i] == i + 1){
        z = i + 1;
      }
    }
    if(z == -1){
      cout << -1 << endl;
      return 0;
    }
    B.erase(B.begin() + z - 1);
    ans.push_back(z);
  }
  reverse(all(ans));
  rep(i,ans.size()){
    cout << ans[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int

struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
ll euclidean_gcd(ll a, ll b) {
  if(a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
ll euclidean_lcm(ll a, ll b) {
  return a/euclidean_gcd(a,b)*b;
}
int main(void){
  ll n,ans=0;
  cin >> n;
  ll a[n];
  rep(i,n){
    cin >> a[i];
    if(i%2==0&&a[i]%2==1)ans++;
  }
  cout << ans;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	int n;
	cin>>n;
	n%=1000;
	if(n==0){
		cout<<0<<endl;
	}else{
		cout<<1000-n<<endl;
	}
	
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n-1; i++) {
      int num = scanner.nextInt();
      a[num-1]++;
    }
    for (int i = 0; i < n; i++) {
      System.out.println(a[i]);
    }

  }
}


Measured memory_bytes: 52796
#!/usr/bin/env python3
# スペース区切りの整数の入力

def dfs(seq):
    ans = 0
    if len(seq) == N:
        score_ret = 0
        for a, b, c, d in data:
            if seq[b-1] - seq[a-1] == c:
                score_ret += d
        return score_ret
    else:
        for i in range(seq[-1], M+1):
            seq_next = seq + (i,)
            score = dfs(seq_next)
            ans = max(ans, score)
    
    return ans

# スペース区切りの整数の入力
N, M, Q = map(int, input().split())
#配列の入力
data = [list(map(int, input().split())) for _ in range(Q)]

ans = -1
score = dfs((1,))
ans = max(ans, score)
print(ans)


Measured memory_bytes: 9104
/*
AizuOnline A1249
Title Make a Sequence
*/
#include <stdio.h>
#include <string.h>
#define SIZ 11

char board[SIZ][SIZ][SIZ];
char height[SIZ][SIZ];

// n-roban 3d m-moku-narabe hantei routine
int check_bannai(int x,int y,int z,int n)
{
  return((1<=x)&&(x<=n)&&(1<=y)&&(y<=n)&&(1<=z)&&(z<=n));
}
char check_seq(int n,int m,int x,int y,int z,char col)
{
  int i,j,k,l,s;
#ifdef DEBUG
  printf("XYZ=%d %d %d\n",x,y,z);
#endif
  for(i=-1;i<=1;i++)
    for(j=-1;j<=1;j++)
      for(k=-1;k<=1;k++)
	{
	  if(i==0 && j==0 && k==0)
	    continue;
	  for(l=-m+1;l<=0;l++)
	    {
	    for(s=l;s<l+m;s++)
	      {
#ifdef DEBUG
		printf("%d %d %d:",
		       x+i*s,y+j*s,z+k*s);
		//printf("(%c)",board[x+i+s][y+j+s][z+k+s]);
#endif

		if(!check_bannai(x+i*s,y+j*s,z+k*s,n))
		  goto NEXT;

		if(board[x+i*s][y+j*s][z+k*s]!=col)
		  goto NEXT;
	      }
	    return(col);
	    NEXT:
;
	    }
	}
  return(0);
}
print_ban(int n)
{
  int i,j,k;
  
  printf("-----------------\n");

    for(j=1;j<=n;j++)
      {
	for(k=1;k<=n;k++)
	    {
	      for(i=1;i<=n;i++)
		printf("%c",board[i][j][k]);
	      printf("   ");
	    }
	  printf("\n");
      }
}
main()
{
  int i;
  int x,y,z;
  char col;
  int m,n,p;
  int hantei;


  while(EOF!=scanf("%d %d %d",&n,&m,&p) && (m||n||p))
    {
      //printf("%d %d %d\n",m,n,p);
      memset(board,'.',SIZ*SIZ*SIZ);
      memset(height,0,SIZ*SIZ);
      hantei=0;
      for(i=1;i<=p;i++)
	{
	  scanf("%d %d",&x,&y);

	  height[x][y]++;
	  z=height[x][y];
	  //printf("%d %d\n",x,y);
	  col=(i & 1)?'B':'W';
	  board[x][y][z]=col;
#ifdef DEBUG
	  print_ban(n);
#endif
	  if(hantei==0)
	    if(hantei=check_seq(n,m,x,y,z,col))
	      printf("%s %d\n",(hantei=='B')?"Black":"White",i);

	}
      if(hantei==0)
	printf("Draw\n");
    }
return(0);
}

Measured memory_bytes: 612
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

//動的計画法を使うといいらしい。
//ちゃんとその発想を思いつけるようにしたい...
//計算量が多いがパラメーター自体は少ない、そして左から順番に読んでいく、
//という点が動的計画法の発想のポイントか...

int main()
{
    string s;
    cin >> s;
    ll dp[s.size() + 1][4];
    dp[s.size()][0] = 0;
    dp[s.size()][1] = 0;
    dp[s.size()][2] = 0;
    dp[s.size()][3] = 1;

    for (int i = s.size() - 1; i >= 0; i--)
    {
        for (int j = 0; j < 3; j++)
        {
            if (s[i] == '?')
            {
                dp[i][j] = 3 * dp[i + 1][j] + dp[i + 1][j + 1];
            }
            else
            {
                dp[i][j] = dp[i + 1][j];
                if ((s[i] - 'A') == j)
                {
                    dp[i][j] += dp[i + 1][j + 1];
                }
            }
        }
        if (s[i] == '?')
        {
            dp[i][3] = 3 * dp[i + 1][3];
        }
        else
        {
            dp[i][3] = dp[i + 1][3];
        }
        for (int j = 0; j < 4; j++)
        {
            dp[i][j] %= INF;
        }
    }

    cout << dp[0][0] << endl;
}

Measured memory_bytes: 3584
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int D = sc.nextInt();
    int N = sc.nextInt();

    int base = 1;
    for (int i = 0; i < D; i++) {
      base *= 100;
    }

    if (N % 100 == 0) {
      System.out.println(base * (N + 1));
    } else {
      System.out.println(base * N);
    }
  }
}

Measured memory_bytes: 21332
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication14
{


    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] msg = Console.ReadLine().Split(' ');
            bool isOdd = ((N & 0x00000001) == 1) ? true : false;
            Dictionary<int, int> dic = new Dictionary<int, int>();

            //各絶対値は
            //人数が偶数ならば1～(N-1)のペア(ただし１つとび)
            //人数が奇数ならば0を１つ含む2～(N-1)のペア(ただし一つとび)
            //で構成されるはず
            //逸脱の場合は0人と判定してよい
            bool valid = true;
            for (int i = 0; i < N; i++)
            {
                int num = int.Parse(msg[i]);
                if (num >= N) { valid = false; break; }
                if ((isOdd) && ((num & 0x00000001) != 0)) { valid = false; break; }
                if ((!isOdd) && ((num & 0x00000001) == 0)) { valid = false; break; }

                if (dic.ContainsKey(num)) dic[num]++;
                else dic.Add(num, 1);

                if (dic[num] > 2) { valid = false; break; }
            }

            //一応辞書のカウントが合っているかどうかをザックリ見る
            if ((isOdd) && (dic.Count != ((N / 2) + 1))) { valid = false; }
            if ((!isOdd) && (dic.Count != (N / 2))) { valid = false; }

            //Nが奇数の場合に限り0という絶対値が一回だけ出現するはず
            if (isOdd){
                if (!dic.ContainsKey(0)) valid = false;
                else if (dic[0] != 1) valid = false;
            }

            if(!valid)
            {
                //該当なし
                Console.WriteLine("0");
            }
            else
            {
                //人数より一意に組み合わせ数が確定するはず
                //オーバーフローしない様にする
                UInt64 result = 1;
                for (int i = 0; i < (N / 2); i++) result = (result * 2) % 1000000007;
                Console.WriteLine(result.ToString());
            }

            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11992
// HTTF.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define int LL
#define pb emplace_back
#define eb pb

using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef long long LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr, Vpr, greater<pr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 3010;
const int SIZE3 = 330;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 7 + 1e9;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
typedef pair<ld, ut> pld;

#define endl "\n" //インタラクティブでは消す
ut N, M, K, L, Q, D, H, W;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE], maps2[SIZE2][SIZE2], answer = zero;
LL maps[SIZE2][SIZE2];
LL DP[SIZE][2];
bool finished[SIZE][2];
LL A[SIZE2][SIZE2];
LL solve2(LL now,LL c,LL from) {
	if (finished[now][c]) return DP[now][c];
	finished[now][c] = true;
	LL ans = 1;
	for (auto next : edges[now]) {
		if (next == from) continue;
		if(c) ans *= solve2(next,0, now);
		else ans *= (solve2(next, 0, now) + solve2(next, 1, now))%p;
		ans %= p;
	}
	ans %= p;
	return DP[now][c] = ans;
}
LL solve() {
	cin >> N;
	REP(i, N-1) {
		int a, b;
		cin >> a >> b;
		edges[a].pb(b);
		edges[b].pb(a);
	}
	cout << (solve2(1,0,-1)+solve2(1,1,-1))%p << endl;
	return 0;
}




//!!!!!!!!!!!!!!!!!!!実装を詰める!!!!!!!!!!!!!!!!!!!!!!!!!
signed main() {

	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(0);
	solve();
	cin >> N;
	return 0;

}

Measured memory_bytes: 28032
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		if(A-2*B<=0) {
			System.out.println(0);
			return;
		}
		System.out.println(A-2*B);
	}

}


Measured memory_bytes: 21844
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
//AtCoderC++.cpp

using namespace std;


inline int ceileing(int a, int b) {
	return a % b == 0 ? a / b : a / b + 1;
}

int main() {
	int W, a, b; cin >> W >> a >> b;
	if (b + W < a) {
		cout << a - (b + W) << endl;
	} else if (a + W < b) {
		cout << b - (a + W) << endl;
	} else {
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
import sys
from heapq import heappush, heappop
from operator import itemgetter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, Q = map(int, readline().split())
    work = [0] * N
    for i in range(N):
        s, t, x = map(int, readline().split())
        work[i] = (x, s - x, t - x)
    query = list(map(int, read().split()))

    work.sort(key=itemgetter(1))
    hq = []
    ans = [0] * Q

    idx = 0
    for i, d in enumerate(query):
        while idx < N and work[idx][1] <= d:
            heappush(hq, work[idx])
            idx += 1
        while hq and hq[0][2] <= d:
            heappop(hq)
        if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

    print(*ans, sep='\n')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 66000
n=int(input())
f=[list(map(int, input().split())) for i in range(n)]
p=[list(map(int, input().split())) for i in range(n)]
ans=-10**9
cnt=0
count=0


for i in range(1,2**10):
    x=[0]*10
    for j in range(10):
        if ((i >> j) & 1):
            x[j]=1
    for i in range(n):
        for j in range(10):
            if x[j]==f[i][j]==1:
                count+=1
        cnt+=p[i][count]
        count=0
    ans=max(ans,cnt)
    cnt=0
    
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    long long ans =0;
    for(int i = 1; i < N + 1; i++){
        if(i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
int main(){
  ll a;
  ld b;
  cin>>a>>b;
  ll b2=round(b*100);
cout<<(a*b2)/100<<endl;
return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


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

    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    for(ll i = 0; i < N; i++) cin >> w[i] >> v[i];

    vector<ll> dp(100000+5, INF64);
    dp[0] = 0; 
    
    for(ll i = 0; i < N; i++){
        for(ll j = 100000; j >= v[i]; j--){
            dp[j] = min(dp[j], dp[j-v[i]]+w[i]);
        }
    }
    
    ll ans =100000;
    while(dp[ans]>W) ans--;
    cout << ans << endl;
}


Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a;i<=b;i++)
#define endl '\n'
#define mod 1000000007

bool sorttt(const pair<int, pair<char, int> > &a, 
              const pair<int, pair<char, int> > &b) 
{ 
    return (a.first > b.first); 
}

int power(int x,int n){
    int res=1;
    while(n>0){
        if(n&1)
            res=res*x;
        x*=x;
        n>>=1;
    }
    return res;
}

int bin(int x,int n){
    int res=1;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}

signed main()
{
    fast
    int n,y,ans=0; cin>>n>>y;
    int dp[n+1][y+1], w[n], v[n];
    rep(i,0,n){
        cin>>w[i]>>v[i];
    }
    rep(i,0,n){
        if(i==0){
            rep(j,0,w[i]){
                dp[i][j]=0;
            }
            rep(j,w[i],y+1){
                dp[i][j]=v[i];
            }
        }
        else
        {
            rep(j,0,w[i]){
                dp[i][j]=dp[i-1][j];
            }
            rep(j,w[i],y+1){
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
            }
        }  
    }
    rep(i,0,n){
        rep(j,0,y+1) ans=max(ans,dp[i][j]);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 78336
#include "bits/stdc++.h"
using namespace std;
const int INF = 1 << 30;

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	for (int i = 0; i < N; ++i) {
		int x;
		cin >> x;
		A[x - 1]++;
	}
	sort(A.begin(), A.end());
	vector<int>S(N + 1);
	for (int i = 0; i < N; ++i) {
		S[i + 1] = S[i] + A[i];
	}
	for (int i = 1; i <= N; ++i) {
		int l = 0;//ok
		int r = N / i + 1;//ng
		while (l +1 <r) {
			int c = (l+r) / 2;
			bool b = false;
			int j = lower_bound(A.begin(),A.end(),c)-A.begin();
			int sum = c * (N - j) + S[j];
			if (sum >= c*i) {
				b = true;
			}
			if (b) {
				l = c;
			}
			else {
				r = c;
			}
		}
		cout << l << endl;
	}
	return 0;
}

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

int main(){
  string S;
  cin >> S;
  long long ans = 0;
  int N = S.length();
  bool f = false;
  long long t = 0;
  for(int i = N-1; i >= 0; --i){
    if(S[i] == 'C'){
      if(i < 1 or S[i-1] != 'B') f = false, t = 0;
      else f = true, ++t, --i;
    }else if(S[i] == 'A' and f){
      ans += t;
    }else{
      f = false;
      t = 0;
    }
  }
  cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
const ll mx = 10000007;
using pii = pair<ll, ll>;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
#define ull unsigned long long
#define    ss   second
#define    ff   first
#define    pb   push_back
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))

///--------------Graph Moves--------------------------------------
///const ll fx[] = {+1,-1,+0,+0};
///const ll fy[] = {+0,+0,+1,-1};
///const ll fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const ll fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const ll fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const ll fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

#define FIO ios_base::sync_with_stdio(false);  cin.tie(NULL);


int main() {
    FIO;

    ll n; cin >> n;
    for(ll i = 1; i <= 9; i++) {
        for(ll j = 1; j <= 9; j++) {
            if((i * j) == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	std::ios::sync_with_stdio(false);
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='C')
        {
            for(int j=i+1;j<s.size();j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

int main()
{
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  vector<int> dp(n + 1, INT_MAX);
  dp[1] = 0;
  dp[2] = abs(a[0] - a[1]);
  for(int i = 3; i <= n; i++)
  {
    dp[i] = min(dp[i - 1] + abs(a[i  -1] - a[i - 2]), dp[i - 2] + abs(a[i - 1] - a[i - 3]));
  }
  cout << dp[n];
  
  return 0;
}


Measured memory_bytes: 1024
def track(P,w):
    ans = 1
    p = P
    for i in w:
        if i > P:
            return 0
        if p - i >= 0:
            p = p - i
        else:
            ans += 1
            p = P - i
    return ans


nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
w = []
for i in range(n):
    w.append(int(input()))
left = max(w)
right = sum(w) + 1
while left < right:
    mid = (left + right) // 2
    track_mid = track(mid, w)
    if track_mid <= k:
        right = mid
    else:
        left = mid + 1
print(left)



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

using namespace std;

int dp[3000][3000], p1, p2;
string s, t, ans;

int main()
{
  cin >> s >> t;
  for(int i = 0; i<s.length(); i++)
    for(int j = 0; j<t.length(); j++)
    {
      dp[i][j] = int(s[i]==t[j]);
      if(i)
        dp[i][j] = max(dp[i][j],dp[i-1][j]);
      if(j)
        dp[i][j] = max(dp[i][j],dp[i][j-1]);
      if((i&&j)&&(s[i]==t[j]))
        dp[i][j] = max(dp[i][j],dp[i-1][j-1]+1);
    }
  p1 = s.length()-1, p2 = t.length()-1;
  while(ans.length()<dp[s.length()-1][t.length()-1])
  {
    if(s[p1]==t[p2])
      ans = s[p1]+ans, p1--, p2--;
    else if(p1&&(!p2||(dp[p1-1][p2]>=dp[p1][p2-1])))
      p1--;
    else
      p2--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 35456
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		
		long[][] dp = new long[n][3];
		dp[0][0] = a[0];
		dp[0][1] = b[0];
		dp[0][2] = c[0];
		
		for (int i = 1; i < n; i++) {
			dp[i][0] = a[i] + Math.max(dp[i-1][1], dp[i-1][2]);
			dp[i][1] = b[i] + Math.max(dp[i-1][0], dp[i-1][2]);
			dp[i][2] = c[i] + Math.max(dp[i-1][0], dp[i-1][1]);
		}
		
		long max = 0;
		for (int i = 0; i < 3; i++)
			max = Math.max(max, dp[n-1][i]);
		
		System.out.println(max);
 		
		sc.close();
	}
}



Measured memory_bytes: 51764
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N;
  while(cin >>N && N){
    vector<int> v(N);
    REP(i, N) cin >>v[i];
    string s; cin >>s;
    REP(i, s.length()){
      int n = v[i % N];
      char c = s[i];
      REP(j, n){
        if(c == 'a') c = 'Z';
        else if(c == 'A') c = 'z';
        else --c;
      }
      cout <<c;
    }
    cout <<endl;
  }
  return 0;
}

Measured memory_bytes: 1204
fun main(args: Array<String>) {
    abc090c()
}

fun abc090c() {
    val (n, m) = readLine()!!.split(" ").map { it.toLong() }

    val answer = if (n == 1L && m == 1L) {
        1
    } else {
        if (n == 1L || m == 1L) {
            Math.max(n, m) - 2
        } else {
            Math.max(0, n - 2) * Math.max(0, m - 2)
        }
    }

    println(answer)
}


Measured memory_bytes: 37708
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x:i64 = read();

    'outer: for i in 0..10000 {
        for j in 0..10000 {
            if (i as i64).pow(5u32) - (j as i64).pow(5u32) == x {
                println!("{} {}",i,j);
                break'outer;
            }
            if (i as i64).pow(5u32) - (-j as i64).pow(5u32) == x {
                println!("{} {}",i,-j);
                break'outer;
            }

        }
    }

}


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


int recur(int arr[][3],int n,int dp[][3]){
    
    dp[0][0]= arr[0][0];
    dp[0][1]=arr[0][1];
    dp[0][2]=arr[0][2];

    for(int i=1;i<n;i++){
    	dp[i][0]= arr[i][0]+max(dp[i-1][1],dp[i-1][2]);
    	dp[i][1]= arr[i][1]+max(dp[i-1][0],dp[i-1][2]);
    	dp[i][2]= arr[i][2]+max(dp[i-1][1],dp[i-1][0]);
    }

return max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

int main(){
   int n;
   cin>>n;
   int arr[100005][3];
   for(int i=0;i<n;i++){
   	for(int j=0;j<3;j++){
   		cin>>arr[i][j];
   	}
   }
   int dp[100005][3];
   for(int i=0;i<n;i++){
          for(int j=0;j<3;j++){
          	dp[i][j]=0;
          }
   }

   cout<<recur(arr,n,dp)<<endl;
return 0;
}


Measured memory_bytes: 2560
N=int(input())
a=list(map(int,input().split()))
m=max(a)
c=[0]*(m+3)

for i in a:
    c[i]=c[i]+1

if len(c)==1:
    T=1
else:
    T=c[0]+c[1]+c[2]
    for i in range(m):
        T=max(T,c[i-1]+c[i]+c[i+1])
print(T)

Measured memory_bytes: 14092