akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(){
    int n,c,k;
    cin >> n >> c >> k;

    vector<int> t(n);
    for ( int i = 0 ; i < n ; i++ ){
        cin >> t.at(i);
    }
    sort(t.begin(),t.end());

    int bus = 0;
    for ( int i = 0 ; i < n ;){
        int cnt = 0;
        if ( i == n-1 ){
            bus++;
            break;
        }
        else{
            for ( int j = 1 ; j < c ; j++ ){
                if ( i + j > n-1 ){
                    break;
                }
                if ( t.at(i+j) - t.at(i) <= k ){
                    cnt++;
                }
            }
            i += cnt + 1;
            bus++;
        }
    }
    cout << bus << endl;
}

Measured memory_bytes: 768
//https://codeforces.com/contest/1293/problem/C
//BROWNIE TK

#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()

#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en

#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second

#define pll pair<lli, lli>
#define pii pair<int, int>
#define pil pair<int, lli>

#define forz(i, n) for (int i = 0; i < n; i++)
#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)

#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

#define lb lower_bound
#define ub upper_bound
#define er equal_range

#define findnot find_first_not_of

#define maxe *max_element
#define mine *min_element

#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetlli tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements sbtriectly lesser than k
//2. find_by_order(k) : k-th element in the set
#define ofk order_of_key
#define fbo find_by_order
using namespace std;

/*STD funcions*/
lli power(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli modi(lli a, lli m) { return power(a, m - 2, m); }
/*CODE BEGINS*/
int main()
{
    kira;
    lli n;
    cin>>n;
    lli ans=0;
    lli c=floor(log2(n))+1;
    lli p=1;
    forz(i,c)
    {
        ans+=p;
        p*=2;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 512
N = int(input())
A = list(map(int,input().split()))
B = [abs(i) for i in A]
ans1 = sum(B) - 2 * min(B)
for i in range(N - 1):
    if A[i] < 0:
        A[i] = -A[i]
        A[i + 1] *= -1
ans2 = sum(A)
ans = max(ans1, ans2)
print(ans)

Measured memory_bytes: 90924
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
using namespace std;

int main(){
    int n;
    long long sum=0;
    cin>>n;
    vector<long long>a(n+2);
    a[0]=0;
    for(int i=1;i<=n;i++) cin>>a[i];
    a[n+1]=0;
    for(int i=0;i<n+1;i++){
        sum+=abs(a[i+1]-a[i]);
    }
    for(int i=1;i<=n;i++){
        if(a[i-1]<=a[i] && a[i]<=a[i+1]){
            cout<<sum<<"\n";
            continue;
        }
        if(a[i-1]>=a[i] && a[i]>=a[i+1]){
            cout<<sum<<"\n";
            continue;
        }
        if(a[i]<=a[i-1] && a[i-1]<=a[i+1]){
            cout<<sum-2*abs(a[i-1]-a[i])<<"\n";
            continue;
        }
        if(a[i+1]<=a[i-1] && a[i-1]<=a[i]){
            cout<<sum-2*abs(a[i-1]-a[i])<<"\n";
            continue;
        }
        if(a[i]<=a[i+1] && a[i+1]<=a[i-1]){
            cout<<sum-2*abs(a[i]-a[i+1])<<"\n";
            continue;
        }
        if(a[i-1]<=a[i+1] && a[i+1]<=a[i]){
            cout<<sum-2*abs(a[i]-a[i+1])<<"\n";
            continue;
        }
    }
}

Measured memory_bytes: 2048
#include<stdio.h>
int main(void) {
	int n, l[100], i, j, k, ans = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &l[i]);
	}


	for (i = 0; i < n-2; i++) {
		for (j = i + 1; j < n-1; j++) {
			for (k = j + 1; k < n; k++) {
				if (l[i] != l[j] && l[j] != l[k]&&l[i]!=l[k])
					if (l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[j] + l[k] > l[i]) { ans++; }
			}

		}
	}
	
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 1708
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;
constexpr int64_t kMod1 = 1000000007LL;
constexpr int64_t kMod2 = 998244353LL;
constexpr int64_t kMod3 = 3571L;

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

  constexpr int64_t kN = 26;
  int64_t D;
  cin >> D;
  vector<int64_t> C(kN + 1, 0);
  for (int64_t c = 1; c <= kN; ++c) {
    cin >> C[c];
  }
  vector<vector<int64_t>> S(D + 1, vector<int64_t>(kN + 1));
  for (int64_t d = 1; d <= D; ++d) {
    for (int64_t c = 1; c <= kN; ++c) {
      cin >> S[d][c];
    }
  }
  vector<vector<int64_t>> last(D + 1, vector<int64_t>(kN + 1, 0));
  vector<int64_t> contests(D + 1);
  for (int64_t d = 1; d <= D; ++d) {
    cin >> contests[d];
  }

  auto Score = [&](const int64_t day) -> int64_t {
    int64_t score = 0;
    for (int64_t d = 1; d <= day; ++d) {
      last[d] = last[d - 1];
      last[d][contests[d]] = d;
      score += S[d][contests[d]];
      for (int64_t c = 1; c <= kN; ++c) {
        score -= C[c] * (d - last[d][c]);
      }
    }
    return score;
  };

  auto OutputResults = [&]() {
    for (int64_t d = 1; d <= D; ++d) {
      cout << contests[d] << endl;
    }
  };

  for (int64_t d = 1; d <= D; ++d) {
    int64_t best_score = INT64_MIN;
    int64_t best_conte = -1;
    for (int64_t c = 1; c <= kN; ++c) {
      contests[d] = c;
      int64_t temp_score = Score(d);
      if (temp_score > best_score) {
        best_score = temp_score;
        best_conte = c;
      }
    }
    contests[d] = best_conte;
  }

  int64_t day_index = 123;
  int64_t contest_index = 2034;
  int64_t ignore_index = 34234;
  int64_t prev_score = Score(D);
  constexpr int64_t kIgnoreBunbo = 100;
  constexpr int64_t kIgnoreBunshi = 3;

  for (int64_t i = 0; i < 1000; ++i) {
    const int64_t day_candidate = (day_index % D) + 1;
    const int64_t original_contest = contests[day_candidate];
    const int64_t contest_candidate = (contest_index % kN) + 1;
    contests[day_candidate] = contest_candidate;
    const int64_t temp_score = Score(D);
    if (ignore_index <= kIgnoreBunshi || temp_score > prev_score) {
      // KEEP
    } else {
      contests[day_candidate] = original_contest;
    }
    day_index = day_candidate + kMod1;
    contest_index = contest_candidate + kMod2;
    ignore_index += kMod3;
    ignore_index %= kIgnoreBunbo;
  }

  OutputResults();
  return 0;
}


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

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

    ll X;
    cin>>X;
    ll N = 1e9;
    unordered_map<ll,ll> mp;
    ll n= 1;
    ll s;
    ll ans1,ans2;
    while(true){
        s = n*n*n*n*n;
        if(s == X){
            ans1 = n;
            ans2 = 0;
            goto fin;
        }
        auto itr = mp.find(s);
        if(itr !=mp.end()){
            if(s<=X){
                ans1 = itr->second;
            }else{
                ans1 = -itr->second;
            }
            ans2 = -n;
            goto fin;
        }
        mp[X+s] = n;
        mp[X-s] = n;
        ++n;
    }

    fin:
    cout<<ans1<<" "<<ans2<<"\n";
    
	
	return 0;
}

Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

L, R = map(int, input().split())

MOD2019 = 2019

ans = INF

right = min(R+1, L+2019+1)
for l in range(L, right):
    for r in range(l+1, right):
        ans = min(ans, (l*r) % MOD2019)

print(ans)

Measured memory_bytes: 3064
N,K=map(int,input().split())
if K==0:
    print(N*N)
else:
    no=N*K+(N-K)*(K-1)
    for b in range(K+1,N+1):
        q=N//b
        r=N%b
        no+=q*K
        if r>=K-1:
            no+=0
        else:
            no-=(K-r-1)
 
    print(N*N-no)

Measured memory_bytes: 39152
#include<bits/stdc++.h>
#define ll long long 
#define ull unsigned long long 
#define ld long double
#define ui unsigned int 
using namespace std;

int main() {
	int arr[3];
	cin >> arr[0] >> arr[1] >> arr[2];
	sort(arr, arr + 3);
	cout << arr[0] << " " << arr[1] << " " << arr[2] << endl;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  REP(i, N) {
    cin >> H[i];
  }
  int tmp = 0, result = 0;
  REP(i, N-1) {
    if (H[i] >= H[i+1]) {
      tmp++;
    } else {
      if (tmp > result) {
        result = tmp;
      }
      tmp = 0;
    }
  }
  if (tmp > result) {
    result = tmp;
  }
  cout << result << endl;
  return 0;
}


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

int main()
{
    string a;
    cin>>a;
    if(a[0]=='a'|| a[0]=='e' || a[0]=='i' ||a[0]=='o' || a[0]=='u')
    {
        cout<<"vowel\n";
    }
    else
    {
        cout<<"consonant\n";
    }
    return 0;
}


Measured memory_bytes: 3552
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,i,a[30],b[30],c[30],ans=0;
  cin >> n;
  for (i=0;i<n;i++) cin >> a[i];
  for (i=0;i<n;i++) cin >> b[i];
  for (i=0;i<n-1;i++) cin >> c[i];
  for (i=0;i<n;i++){
    ans+=b[i];
    if (i<n-1 && a[i+1]-a[i]==1) ans+=c[a[i]-1];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int n=s.length();
  long long int count=0;
  for(int i=0;i<n;i++){
     count+=(int)(s[i]-'0');
  }
  if(count%9==0){
  cout<<"Yes"<<endl;
  }else{
  cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    LL n,x,t;cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;


void solve(long long N, std::vector<long long> A){
	LL c=1;
	LL s=0;
	auto B=A;
	for(int i=B.size()-2;i>=0;i--){
		B[i]+=B[i+1];
	}
	for(int i=0;i<A.size();i++){
		s+=c;
		if(c<A[i]){
			cout << -1<< endl;
			return;
		}
		c-=A[i];
		c*=2;
		if(i+1<A.size()){
			c=min(c,B[i+1]);
		}
	}
	cout << s << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N-0+1);
    for(int i = 0 ; i < N-0+1 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4868
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i > n; --i)
const int MOD = 1000000007;

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(n * a, b) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string>
#include <string.h>
#include <math.h>
#include <iomanip>
#include <stdio.h>
using namespace std;

#define int64 long long
#define pii pair <int64, int64>
#define fr first
#define sc second
#define heap priority_queue
struct piii{
    int64 fr, sc, th;
    bool operator < (const piii &b){
        if (fr != b.fr) return fr < b.fr;
        if (sc != b.sc) return sc < b.sc;
        return th < b.th;
    }
};
///////////////////////////////////////////////
///////////////////////////////////////////////

const double pi = 3.14159265359;

double a, b, x;

double mtan(double a){
    return tan(a / 180 * pi);
}

double matan(double a){
    return atan(a) * 180 / pi;
}

int main(){
    cout << setprecision(10) << fixed;
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> a >> b >> x;
    if (a * b / 2 <= x / a)
        cout << matan((a * b - x / a) / (a * a) * 2);
    else
        cout << 90 - matan(2 * x / (a * b * b));
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
int main(){
    char *S;
    char *T;
    int N=0;

    scanf("%d",&N);

    S = (char *)malloc(sizeof(char)*N+1);
    T = (char *)malloc(sizeof(char)*N+1);

    scanf("%s %s",S,T);

    for(int i=0;i<N;i++){
        printf("%c",S[i]);
        printf("%c",T[i]);
    }

    free(S);
    free(T);
    return 0;
}


Measured memory_bytes: 128
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=5e5+5;
struct eg{int v,nx,w;}e[N<<1];int head[N],tot;
inline void add(R int u,R int v,R int w){e[++tot]={v,head[u],w},head[u]=tot;}
ll dis[N],xmn,ymn;int vis[N],vv[N],fl,n,m,c;
void dfs(int u){
	vis[u]=1;
	go(u)if(!vis[v])dis[v]=e[i].w-dis[u],dfs(v);
		else if(dis[u]+dis[v]!=e[i].w)fl=0;
}
void find(int u){
	vv[u]=1;
	u<=n?cmin(xmn,dis[u]):cmin(ymn,dis[u]);
	go(u)if(!vv[v])find(v);
}
int main(){
	scanf("%d%d%d",&n,&m,&c);
	for(R int i=1,u,v,w;i<=c;++i){
		scanf("%d%d%d",&u,&v,&w);
		add(u,v+n,w),add(v+n,u,w);
	}
	fp(i,1,n+m)if(!vis[i]){
		fl=1;dfs(i);if(!fl)return puts("No"),0;
		xmn=ymn=1e18,find(i);
		if(xmn+ymn<0)return puts("No"),0;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 14464
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define F first
#define S second
#define mt make_tuple
#define pb push_back


string s;
int n, m;
set<int> c[200005][2];
bool deleted[200005];
vector<int> adj[200005];
int32_t main(){
	cin>>n>>m>>s;
	for(int i = 0 ; i < m ; i ++){
		int x , y;
		cin>>x>>y;
		x-- , y--;
		adj[x].pb(y);
		adj[y].pb(x);
		c[x][s[y] - 'A'].insert(y);
		c[y][s[x] - 'A'].insert(x);
	}
	queue<int> q;
	for(int i = 0 ; i < n; i ++){
		if(c[i][0].size() > 0 && c[i][1].size() > 0){
			continue;
		}
		q.push(i);
	}
	bool can = true;
	while(!q.empty()){
		int u = q.front();
		q.pop();
		deleted[u] = true;
		for(auto p : adj[u]){
			if(!deleted[p]){
				c[p][s[u] - 'A'].erase(u);
				if(c[p][0].size() > 0 && c[p][1].size() > 0){
					continue;
				}
				q.push(p);
			}
		}
	}
	can = false;
	for(int i = 0 ; i < n ; i++){
		if(!deleted[i]) can = true;
	}
	if(can) cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 47620
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;

int modpow(int x, int n, int mod) {
    int res = 1;
    while (n > 0) {
        if (n & 1) {  // nが奇数のとき
            res *= x;
            res %= mod;
        }
        x *= x;
        x %= mod;
        n >>= 1;
    }
    return res;
}

int comb(int a, int b, int p) {
    if (b > a - b) {
        return comb(a, a - b, p);
    }
    int c = 1, d = 1;
    for (int i = 0; i < b; i++) {
        c *= (a - i);
        d *= (b - i);
        c %= p;
        d %= p;
    }
    return c * modpow(d, p - 2, p) % p;
}

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  COMinit();

  int N, A, B;
  cin >> N >> A >> B;

  int ans = modpow(2, N, MOD);
  --ans;
  int co = 1;
  for(int i=0;i<A;i++){
    co *= N-i;
    co %= MOD;
  }
  co *= finv[A];
  co %= MOD;
  ans -= co;

  co = 1;
  for(int i=0;i<B;i++){
    co *= N-i;
    co %= MOD;
  }
  co *= finv[B];
  co %= MOD;
  ans -= co;

  while(ans < 0){
    ans += MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 12160
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N,W;
  cin>>N>>W;
  ll w[N],v[N];
  rep(i,N){
    cin>>w[i]>>v[i];
  }
  ll dp[N][100001];
  rep(i,N){
    rep(j,100001){
      dp[i][j]=INF;
    }
  }
  dp[0][0]=0;
  dp[0][v[0]]=w[0];
  rep(i,N-1){
    rep(j,100001){
       dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
       if(dp[i][j]+w[i+1]<=W&&j+v[i+1]<=100000)
          dp[i+1][j+v[i+1]]=min(dp[i+1][j+v[i+1]],dp[i][j]+w[i+1]);
    }
  }
  ll ans=INF;
  rep(i,100001){
    if(dp[N-1][i]!=INF&&dp[N-1][i]!=0)
      ans=i;
  }
  cout<<ans<<endl;
  

}
  


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

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

    vector<vector<int>> adj_matrix(n, vector<int>(n, 0));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin >> adj_matrix[i][j];
        }
    }

    const int INF = 1e9 + 7;
    vector<bool> use(n, false);
    vector<int> key(n, INF);
    vector<int> parent(n, -1);
    key[0] = 0;
    int cnt = 0;
    while (true)
    {
        int mn = INF;
        int u = -1;
        for (int i = 0; i < n; i++)
        {
            // keyが最小のノードを選択
            if (use[i] == 0 && key[i] < mn)
            {
                mn = key[i];
                u = i;
            }
        }

        // 選択先がなければ終了
        if (u == -1)
        {
            break;
        }
        use[u] = 1;

        // uに隣接するノードで未訪問かつ辺の重みがkeyより小さいものを選び、keyを辺の重みで更新し、訪問したことにする
        for (int j = 0; j < n; j++)
        {
            if (use[j] == 0 && adj_matrix[u][j] >= 0 && adj_matrix[u][j] < key[j])
            {
                key[j] = adj_matrix[u][j];
                parent[j] = u;
            }
        }
    }

    cout << accumulate(key.begin(), key.end(), 0) << endl;

    return 0;
}


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



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

    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    int a,b,c;
    cin>>a>>b>>c;

    if((b-a)==(c-b)){
        cout<<"YES";
    }else{
        cout<<"NO";
    }

}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';

const int MOD = 1000 * 1000 * 1000 + 7;
int mod(int n) {
    n %= MOD;
    if (n < 0) return n + MOD;
    else return n;
}   
int fp(int a, int p) {
    int ans = 1, c = a;
    for (int i = 0; (1ll << i) <= p; ++i) {
        if ((p >> i) & 1) ans = mod(ans * c);
        c = mod(c * c);
    }   
    return ans;
}   
int dv(int a, int b) { return mod(a * fp(b, MOD - 2)); }
const int N = 2e5+7;
int f[N], inv[N];
void prec() {
    f[0] = 1;
    for (int i = 1; i < N; ++i)
        f[i] = mod(f[i - 1] * i);
    inv[N - 1] = fp(f[N - 1], MOD - 2);
    for (int i = N - 2; i >= 0; --i)
        inv[i] = mod(inv[i + 1] * (i + 1));
}
int C(int n, int k) {
    return mod(f[n] * mod(inv[k] * inv[n - k]));
}   

vector <int> pos[N];
int ans[N];

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    int n;
    cin >> n;
    vector <int> a(n+1);
    for (int i = 0; i <= n; ++i) {
        cin >> a[i];
        pos[a[i]].app(i);
    }        

    int l = -1, r = -1;
    for (int i = 1; i <= n; ++i) {
        if (pos[i].size() == 2) {
            l = pos[i][0];
            r = pos[i][1];
        }   
    }   

    prec();
    for (int i = 1; i <= n + 1; ++i)
        ans[i] = C(n+1, i);

    int rs = n - r;
    int sum = l + rs;
    for (int i = 1; i <= n + 1; ++i) {
        ans[i] = mod(ans[i] - C(sum, i - 1));
    }   

    for (int i = 1; i <= n + 1; ++i)
        cout << ans[i] << endl;
}

Measured memory_bytes: 15920
from itertools import permutations
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from math import factorial
from math import sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


#ここから書き始める
n = int(input())
a = []
for i in range(n):
    x, y = map(int, input().split())
    a.append([x, y])
total = 0
for i in permutations(a):
    # print(i)
    for j in range(1, n):
        x_distance = i[j][0] - i[j - 1][0]
        y_distance = i[j][1] - i[j - 1][1]
        d = sqrt(x_distance ** 2 + y_distance ** 2)
        total += d
ans = total / factorial(n)
print(ans)

Measured memory_bytes: 5044
#include <stdio.h>
int main()
{
	int a;
	scanf("%d",&a);
	int num[a],b=0;
	for(int i=0;i<a;i++)
	{
		scanf("%d",&num[i]);
	}
	for(int i=0;i<a-1;i++)
	{
		for(int j=i+1;j<a;j++)
		b=b+num[i]*num[j];
	}
		printf("%d",b);
	return 0;
} 

Measured memory_bytes: 128
{-# LANGUAGE OverloadedStrings #-}
import Data.Char
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as UV

main :: IO()
main = do
  n <- readLn
  ns <- UV.fromList . sort <$> getIntList
  let f x k = (subtract k) . fst . bisearch ((< x) . (ns UV.!)) $ (k, n) 
  print . sum $ [ f x j | i <- [0..n-3], j <- [i+1..n-2], let x = (ns UV.! i) + (ns UV.! j)]


readInt :: BS.ByteString -> Maybe (Int, BS.ByteString)
readInt = BS.readInt . BS.dropWhile isSpace

getIntList :: IO [Int]
getIntList = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine


-- 二分探索(整数)
bisearch :: (Int -> Bool) -> (Int, Int) -> (Int, Int)
bisearch check (left, right) = go (left, right)
 where
  go (l, r) | r - l == 1 = (l, r)
            | check mid  = go (mid, r)
            | otherwise  = go (l, mid)
    where mid = l + (r - l) `div` 2


Measured memory_bytes: 1148
#設定
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

#ライブラリインポート
from collections import defaultdict
import bisect
INF = float("inf")

#入力受け取り
def getlist():
	return list(map(int, input().split()))


class Graph(object):
	def __init__(self):
		self.graph = defaultdict(list)

	def __len__(self):
		return len(self.graph)

	def add_edge(self, a, b):
		self.graph[a].append(b)

	def get_nodes(self):
		return self.graph.keys()

def Euler_tour(G, node, visit, DP, prev, ans, A):
	for i in G.graph[node]:
		if visit[i] != "Yes":
			visit[i] = "Yes"
			#LIS更新
			x = bisect.bisect_left(DP, A[i])
			prev.append([x, DP[x]])
			DP[x] = A[i]
			ans[i] = bisect.bisect_left(DP, INF)
			# print(DP, i)
			# print(prev)
			Euler_tour(G, i, visit, DP, prev, ans, A)

	#LIS戻す
	x, val = prev.pop()
	DP[x] = val

#処理内容
def main():
	N = int(input())
	A = getlist()
	G = Graph()
	for i in range(N - 1):
		a, b = getlist()
		a -= 1; b -= 1
		G.add_edge(a, b)
		G.add_edge(b, a)

	#DFS初期化
	DP = [INF] * N
	DP[0] = A[0]
	prev = [[0, A[0]]]
	ans = [None] * N
	ans[0] = 1
	visit = ["No"] * N
	visit[0] = "Yes"
	Euler_tour(G, 0, visit, DP, prev, ans, A)
	for i in range(N):
		print(ans[i])


if __name__ == '__main__':
	main()

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

using namespace std;

int main(){

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

    string x;
    cin >> x;

    int counter = 0;
    for(int i=0;i<x.size()/2;++i)
        if(x[i] != x[x.size()-1-i])
            counter++;

    cout << counter << '\n';

    return 0;
}

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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

lli n,m;
graph g;
vll p;

bool dfs(lli x,lli q){
  if(p[x] == 0) p[x] = q;
  else return p[x] == q;
  bool ret = true;
  for(auto y : g[x]){
    ret = ret && dfs(y.first, -q);
  }
  return ret;
}

int main(){
  cin >> n >> m;
  for(lli i = 0;i < m;i++){
    lli a,b;
    cin >> a >> b;
    g[a][b] = g[b][a] = 1;
  }
  p = vll(n+1);
  if(dfs(1,1)){
    lli k=0,l=0;
    for(lli i = 1;i <= n;i++){
      if(p[i] > 0) k++;
      else l++;
    }
    cout << k*l-m << endl;
  }else{
    cout << n*(n-1)/2-m << endl;
  }
}


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

int main(){
	int n;
	cin>>n;
	int ar[n];
	int dp[n];
	for (int i=0;i<n;i++){
		cin>>ar[i];
	}
	dp[0]=0;
	dp[1]=abs(ar[1]-ar[0]);
	dp[2]=min(abs(ar[2]-ar[0]),dp[1]+abs(ar[2]-ar[1]));
	for (int i=3;i<n;i++){
		int min1=dp[i-2]+abs(ar[i-2]-ar[i]);
		int min2=dp[i-1]+abs(ar[i-1]-ar[i]);
		dp[i]=min(min1,min2);
	}
	cout<<dp[n-1]<<endl;
}


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

int main()
{ 
  int n,k,a[100006],dp[100006];    
  cin>>n>>k;
  for(int i=1;i<=n;i++){ 
      cin>>a[i];
  } 
  for(int i=0;i<=n;i++)dp[i]=1e9;
  dp[1]=0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=k;j++){
      if(i+j<=n)dp[i+j]=min(dp[i+j],dp[i]+abs(a[i]-a[i+j]));
    } } 
    cout<<dp[n]<<"\n";
    
 
    return 0;
}

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

ll maxHappiness(vector<vector<ll>> abc) {
    int n = abc.size();
    vector<vector<ll>> dp(3, vector<ll>(n+1, 0));
    for (int i = 1; i <= n; i++) {
        dp[0][i] = abc[i-1][0] + max(dp[1][i-1], dp[2][i-1]);
        dp[1][i] = abc[i-1][1] + max(dp[0][i-1], dp[2][i-1]);
        dp[2][i] = abc[i-1][2] + max(dp[0][i-1], dp[1][i-1]);
    }
    return max(max(dp[0][n], dp[1][n]), dp[2][n]);
}

int main() {
    int n; cin >> n;
    vector<vector<ll>> abc(n, vector<ll>(3));
    for (int i = 0; i < n; i++)
        cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
    cout << maxHappiness(abc) << endl;
    return 0;
}

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

int main(void)
{
	string s;
	cin >> s;
	int flag = 1;
	int i, j;
	for (i = 0; i < s.length(); i++) {
		for (j = i + 1; j < s.length(); j++) {
			if (s[i] == s[j]) {
				flag = 0;
				break;
			}
		}
	}

	if (flag == 1) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}

	return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	int N;
	cin >> N;
	VV<ll> A(N,V<ll>(N));
	
	rep(i,N) rep(j,N) if(i!=j){
		cin >> A[i][j];
	}
	

	const ll inf = 1e18;
	VV<ll> dp(N,V<ll>(N,inf)),ndp(N,V<ll>(N,inf));
	dp[0][0] = 0;
	rep1(i,N-1){
		V<ll> Rs(N+1),Ls(N+1);
		rep1(x,N) Rs[x] = Rs[x-1] + A[x-1][i];
		rep1(x,N) Ls[x] = Ls[x-1] + A[i][x-1];
		auto R = [&](int l,int r,int i){	//[l,r) -> i
			return Rs[r] - Rs[l];
		};
		auto L = [&](int l,int r,int i){	//[l,r) <- i
			return Ls[r] - Ls[l];
		};
		rep(j,N) rep(k,N) ndp[j][k] = inf;
		rep(j,i) rep(k,max(j,1)){
			chmin(ndp[j][k],dp[j][k] + R(j,i,i) + L(0,k,i));
			chmin(ndp[i][j],dp[j][k] + L(0,j,i));
		}
		swap(dp,ndp);
	}
	ll ans = inf;
	rep(j,N) rep(k,N) chmin(ans,dp[j][k]);
	cout << ans << endl;
}


Measured memory_bytes: 6144
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int MOD;
int add(int x, int y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
const int N = 77;
int dp[2][N][N][N];
int n, k;

ll solveEven(int m) {
	int a[N + 5];
	for (int i = 0; i <= m + 1; i++)
		a[i] = 0;
	a[0] = 1;
	for (int i = 1; i <= m + 1; i++) {
		for (int j = 0; j < i; j++) {
			if (i - j > k + 1) continue;
			a[i] = add(a[i], a[j]);
		}
	}
//	cerr << m << " " << a[m + 1] << endl;
	return a[m + 1];
}
void solveEven() {
	k /= 2;
	printf("%lld\n", ((ll)solveEven(n / 2) * solveEven(n - n / 2)) % MOD);
}

bool goodPos(int x, int y, int z) {
	if (max(x, y) >= z) return false;
	if (2 * y - 1 - k >= 2 && 2 * x - k >= 1) return false;
	return true;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d%d", &n, &k, &MOD);
	if (k % 2 == 0) {
		solveEven();
		return 0;
	}
	dp[0][0][0][N - 1] = 1;
	for (int pos = 0; pos < n; pos++) {
		for (int x = 0; x < N; x++)
			for (int y = 0; y < N; y++)
				for (int z = 0; z < N; z++)
					dp[1][x][y][z] = 0;
		for (int x = 0; x < N; x++)
			for (int y = 0; y < N; y++)
				for (int z = 0; z < N; z++) {
					if (!goodPos(x, y, z)) continue;
					if (dp[0][x][y][z] == 0) continue;
					dp[1][x + 1][y][z] = add(dp[1][x + 1][y][z], dp[0][x][y][z]);
					int zz = N - 1;
					if (2 * y - 1 - k >= 2 && x > 0)
						zz = min(zz, 1 + (2 * y - 1 - 2 * x + k) / 2);
					if (zz <= y) throw;
					if (x < y) zz = min(zz, z);
					dp[1][0][y][zz] = add(dp[1][0][y][zz], dp[0][x][y][z]);
				}
		for (int x = 0; x < N; x++)
			for (int y = 0; y < N; y++)
				for (int z = 0; z < N; z++)
					dp[0][y][x][z] = dp[1][x][y][z];
	}
	int ans = 0;
	for (int x = 0; x < N; x++)
		for (int y = 0; y < N; y++)
			for (int z = 0; z < N; z++)
				if (goodPos(x, y, z))
					ans = add(ans, dp[0][x][y][z]);
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

// constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
// constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n,k;
    cin >> n >> k;
    VI a(n);
    REP(i,0,n) cin >> a[i];
    sort(all(a));
    int sum = 0;
    REP(i,0,k) sum += a[i];
    cout << sum << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
struct ${$(){ios_base::sync_with_stdio(0);cin.tie(0);}}$;

const int N = 200005;

int main() {
   int a, b;
   cin >> a >> b;
   cout << (a + b + 1) / 2 << endl;
   return 0;
}


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

int main(){
	int a,b;
  	string s;
  	cin >> a >> b >> s;
  	bool x=true;
  	for (int i=0; i<a+b+1;i++){
    	if(i!=a && (s[i]<'0' || s[i]>'9')) x=false;
      	if(s[a]!='-') x=false;
    }
  	if (x==true) cout <<"Yes" <<endl;
  	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int n;
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n;
 	if(n&1) cout << n/2;
 	else cout << n/2-1;
	return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  Graph G(n);
  for(int i = 0; i < m; i++){
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for(int i = 0; i < G[0].size(); i++){
    for(int j = 0; j < G[G[0][i]].size(); j++){
      if(G[G[0][i]][j] == n-1) {
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 14988
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		float x=in.nextFloat(),y=in.nextFloat();
		float a=y/(2*x);
		List<point> cx=new ArrayList<>();
		for(int i=0;i<=x;i++) {
			point p=new point();
			p.x=(float)(i*2);
			p.y=y-(a*(p.x));
			//System.out.println(p.y);
			cx.add(p);
		}
		
		for(int i=0;i<=y;i++) {
			point p=new point();
			p.y=(float)i;
			p.x=(y-p.y)/a;
			//System.out.println(p.x);
			boolean same=false;
			for(int j=0;j<cx.size();j++) {
				if(p.x==cx.get(j).x && p.y==cx.get(j).y) {
					same=true;
					//System.out.println(p.x+" "+p.y+"same");
					break;
				}
			}
			if(same==false)cx.add(p);
		}
		
		System.out.println(cx.size());
	}

}
class point{
	float x=0,y=0;
}



Measured memory_bytes: 28404
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
using namespace std;
typedef long long ll;

int main(){
  string s;
  cin >> s;
  if(s <= "2019/04/30") {
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#include <string>

int main() {
    int c[3] = {0};
    string s;   cin >> s;
    c[s[1] - 'a']++;
    c[s[0] - 'a']++;
    c[s[2] - 'a']++;

    if (c[0] == c[1] && c[1] == c[2])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 2000000;
int main(int argc, char *argv[]) {
	int R[MAX], n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> R[i];
	}
	
	int maxv = -2000000000;
	int minv = R[0];
	
	for(int i = 1; i < n; i++)
	{
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}
	
	cout << maxv << endl;
	
	return 0;
}


Measured memory_bytes: 3892
import java.util.*;

class Main {
	public static void main(String[] args){
		int a, b, n;
		Scanner scan = new Scanner(System.in);
		while(scan.hasNextInt()){
			a = scan.nextInt();
			b = scan.nextInt();
			n = scan.nextInt();
			System.out.println("" + aoj0054(a,b,n));
		}
	}
	static int aoj0054(int a,int b,int n){
		int res = 0;
		a %= b;
		for(int i = 0;i < n;i++){
			a *= 10;
			res += a / b;
			a %= b;
		}
		return res;
	}
}

Measured memory_bytes: 20000
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ii> P;
typedef unsigned long long int ull;
const int MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e9;

int main(){
    int n;cin>>n;
    int dp[n+1];
    for(int i=0;i<=n;i++) dp[i]=INF;
    dp[0]=0;
    for(int i=0;i<=n;i++){
        for(int j=1;i+j<=n;j*=6){
            dp[i+j]=min(dp[i+j],dp[i]+1);
        }
        for(int j=1;i+j<=n;j*=9){
            dp[i+j]=min(dp[i+j],dp[i]+1);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 3940
using System;

namespace Application
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split();
            var a = int.Parse(ab[0]);
            var b = int.Parse(ab[1]);

            if (0 <= a && a < 10 &&
                0 <= b && b < 10)
            {
                Console.WriteLine(a * b);
            }
            else
            {
                Console.WriteLine(-1);
            }
        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<string, int> P;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}


int main()
{
	ios_base::sync_with_stdio(false);
	ll n, a, b, ans = 0;
	cin >> n >> a >> b;
	vi v(n);
	rep(i, n) {
		cin >> v[i];
	}
	ll sa = a - b;
	ll mi = 0, ma = 1000000000, mid;
	while (ma - mi > 1) {
		mid = (mi + ma) / 2;
		ll cnt = 0;
		rep(i, n) {
			if (v[i] > b*mid) {
				cnt += (v[i] - b * mid - 1) / sa + 1;
			}
		}
		if (cnt > mid) mi = mid;
		else ma = mid;
	}
	cout << ma << endl;
	return 0;
}

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

int main()
{
	int r;
	cin >> r;

	if (r < 1200)
	{
		cout << "ABC" << endl;
	}
	else if (1200 <= r && r < 2800)
	{
		cout << "ARC" << endl;
	}
	else
	{
		cout << "AGC" << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<cstdio>
#include<string.h>
#include<cmath>
using namespace std;

int main() {
	int n, x, d;
	cin >> n >> d >> x;
	int a;
	int ans = x;
	for (int i = 0; i < n; i++) {
		cin >> a;
		ans += (d - 1) / a+1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3584
#include"bits/stdc++.h"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill( (T*)array, (T*)(array+N), val ); }
#define INF 1e9
#define PI (acos(-1))
#define mod (int)1e9+7
int main() {
    int x;
    cin >> x;
    if (x)cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 3588
//PseudoName

    #pragma GCC optimize("O3")
    #include <bits/stdc++.h>
/*
	#include <ext/pb_ds/assoc_container.hpp>
	#include <ext/pb_ds/tree_policy.hpp>
	using namespace __gnu_pbds;
	template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/
    #define FOR(i,n) for(i=0;i<n;i++)
    #define FOR1(i,n) for(i=1;i<=n;i++)
    #define FOR2(I, A, B) for (int I = (A); I <= (B); ++I)
    #define pb push_back
    #define unique_sort(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
    #define print(v) for(auto it:v)cout<<it<<" ";cout<<endl
    #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define endl "\n"
    #define min3(a,b,c) min(a,min(b,c))
    #define forr(n) for(int i=0;i<n;i++)
    #define frr(n) for(int i=1;i<=n;i++)
    #define MAX 200005
    #define inf 200008

    using namespace std;

    typedef long long ll;
    typedef long li;
    typedef vector<int> vi;
    typedef vector<ll> vli;
    typedef vector<vi> vvi;
    typedef vector<vli> vvli;
    typedef pair<int,int> pi;
    typedef pair<ll,ll> pli;
    typedef vector<pi> vpi;
    typedef vector<pli> vpli;




    int main() {
        fast();
        int n,m;cin>>n>>m;
        int ans=0;

        ans=(n*(n-1))/2+(m*(m-1))/2;
        cout<<ans<<endl;

    }


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

const int inf = 0xfffffff;


double p[101][55],T[101][55];
int n,m;
double l;
double c[55][55],pp[101],t[101],v[101];
void init()
{
	c[0][0]=1;
	for(int i=1;i<55;i++){
		c[i][0]=1;
		for(int j=1;j<=i;j++){
			c[i][j]=c[i-1][j]+c[i-1][j-1];
		}
	}
	for(int i=0;i<=m;i++){
		for(int j=0;j<n;j++){
			p[j][i]=c[m][i]*pow(pp[j],i)*pow((1-pp[j]),m-i);
			T[j][i]=l/v[j]+i*t[j];
			//cout<<j<<" "<<i<<" "<<p[j][i]<<" "<<T[j][i]<<endl;
		}
	}
}
double Ans[101];
double tmp=0;
void dfs(int cur,double cmp,int N,double P){
	if(N==n){
		tmp=P;
		return ;
	}
	if(cur==N){
		dfs(cur,cmp,N+1,P);return ;
	}
	double O=0;
	for(int i=0;i<=m;i++){
		if(T[N][i]>cmp)O+=p[N][i];
	}
	//cout<<O<<" "<<N<<endl;
	dfs(cur,cmp,N+1,P*O);
}
int main()
{
	cin>>n>>m>>l;
	for(int i=0;i<n;i++){
		scanf("%lf%lf%lf",&pp[i],&t[i],&v[i]);
		pp[i]/=100.0;
	}
	init();
	for(int i=0;i<n;i++){
		for(int j=0;j<=m;j++){
			tmp=0;
			dfs(i,T[i][j],0,p[i][j]);
			//cout<<tmp<<" "<<T[i][j]<<" "<<p[i][j]<<endl;
			Ans[i]+=tmp;
		}
		printf("%.10f\n",Ans[i]);
	}
}

Measured memory_bytes: 1404