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

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e5;

struct node
{
	lld x,y;
	int num;

	bool operator<(const node& q) const
	{
		return x> q.x;
	}
};

struct edge
{
	lld x,y;
	lld c;

	bool operator<(const edge& q) const
	{
		return c < q.c;
	}
};

lld n;
lld par[MAXN] = {0}, r[MAXN] = {0} ;

void init(lld n)
{
	for(int i = 0; i < n; i++)
	{
		par[i] = i;
		r[i] = 0;
	}
}

lld find(lld x)
{
	if (par[x] == x)
	{
		return x;
	}else
	{
		return par[x] = find(par[x]);
	}
}


void unite(lld x,lld y)
{
	x = find(x);
	y = find(y);

	if (x == y)
	{
		return;
	}
	if (r[x] < r[y])
	{
		par[x] = y;
	}else
	{
		par[y] = x;
		if (r[x] == r[y])
		{
			r[x]++;
		}
	}
}

bool same(lld x,lld y)
{
	return find(x) == find(y);
}



int main()
{
	cin >> n;
	vector<node> p(n);
	for(int i = 0; i < n; i++)
	{
		cin >> p[i].x >> p[i].y;
		p[i].num = i;
	}

	vector<node> p_y(n);
	for(int i = 0; i < n; i++)
	{
		p_y[i].x = p[i].y;
		p_y[i].y = p[i].x;
		p_y[i].num = i;
	}

	sort(p.begin(),p.end());
	vector<edge> e;
	for(int i = 0; i < n-1; i++)
	{
		edge eee;
		eee.x = p[i].num;
		eee.y = p[i+1].num;
		eee.c = abs(p[i].x-p[i+1].x);

		e.push_back(eee);
	}

	sort(p_y.begin(),p_y.end());
	for(int i = 0; i < n-1; i++)
	{
		edge eee;
		eee.x = p_y[i].num;
		eee.y = p_y[i+1].num;
		eee.c = abs(p_y[i].x-p_y[i+1].x);

		e.push_back(eee);
	}

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

	// for(int i = 0; i < e.size(); i++)
	// {
	// 	cout << e[i].c << endl;
	// }

	init(n);

	lld sum = 0;

	for(int i = 0; i < e.size(); i++)
	{
		if (!same(e[i].x,e[i].y))
		{
			unite(e[i].x,e[i].y);
			sum += e[i].c;
		}
	}

	cout << sum << endl;


	return 0;
}

Measured memory_bytes: 13168
#include<stdio.h>
int main()
{
    int i,k,n,max;
    scanf("%d %d",&k,&n);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    max=0;
    for(i=1;i<n;i++){
        if(a[i]-a[i-1]>=max) max=a[i]-a[i-1];
    }
    if((k-a[n-1])+a[0]>max) max=(k-a[n-1])+a[0];
    printf("%d",k-max);
    return 0;
}

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

int main(){
    string s;
    cin>>s;
    size_t l=s.length();
    map<string,ll> dict;
    rep(i,26) dict[string(1,'a'+i)]=0;
    bool flag=false;
    string ans;
    rep(i,l) dict[string(1,s[i])]++;
    rep(i,26){
        if(dict[string(1,'a'+i)]==0){
            ans=string(1,'a'+i);
            flag=true;
            break;
        }
    }
    if(flag) cout<<ans<<"\n";
    else cout<<"None"<<"\n";
    return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int N;
	cin >> N;
	vector<long long> A( N );
	vector<long long> B( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i] >> B[i];
	}

	long long ans = 0;
	for( int i = N - 1; i >= 0; i-- ) {
		long long m = (A[i] + ans) % B[i];
		long long d = 0;
		if( m ) d = B[i] - m;
		ans += d;
	}

	cout << ans << endl;
}


Measured memory_bytes: 1792
MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)
from heapq import heapify,heappop,heappush

def main():
    N,M = map(int,input().split())
    works = [tuple(map(int,input().split())) for _ in range(N)]
    works.sort(key = lambda x:x[0])
    q = []
    ans = 0
    j = 0
    for i in range(M):
        while j < N and works[j][0] <= i + 1:
            heappush(q,-works[j][1])
            j += 1
        if q:
            p = heappop(q)
            ans -= p
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 20432
import collections
n = int(input())
a,b = list(map(int,input().split()))
p = list(map(int,input().split()))
p.sort()

count = collections.Counter(p)

nQues = []
nQues.append( sum([count[i] for i in count.keys() if i <= a]) )
nQues.append( sum([count[i] for i in count.keys() if a < i and i <= b]) )
nQues.append( sum([count[i] for i in count.keys() if b < i]) )

print(min( nQues ))


Measured memory_bytes: 3436
H,W,K = map(int,input().split())
grid = [list(map(lambda x: x=='#', input())) for _ in range(H)]

res = [[None]*W for _ in range(H)]
cnt = 1

i = 0
while sum(grid[i]) == 0:
    i += 1

for j in range(W):
    res[i][j] = cnt
    if grid[i][j]:
        cnt += 1
cnt -= 1
j = W-1
while not grid[i][j]:
    res[i][j] = cnt
    j -= 1
cnt += 1

for k in range(i):
    res[k] = res[i]

for k in range(i+1,H):
    if sum(grid[k]) == 0:
        res[k] = res[k-1]
    else:

        for j in range(W):
            res[k][j] = cnt
            if grid[k][j]:
                cnt += 1
        cnt -= 1
        j = W-1
        while not grid[k][j]:
            res[k][j] = cnt
            j -= 1
        cnt += 1

for row in res:
    print(*row)

Measured memory_bytes: 49372
from bisect import bisect

#Aのなかでlより大きな最小の値を得る.Aはソート済み

s = input()
t = input()
a = 'abcdefghijklmnopqrstuvwxyz'
d = {}
for ch in a:
  d[ch] = []
for ch,n in zip(s,range(len(s))):
  d[ch].append(n)

rep = 0
p = -1
for ch in t:
  if len(d[ch])==0:
    print("-1")
    exit()
  else:
    i = bisect(d[ch],p)
    if i!=len(d[ch]):p=d[ch][i]
    else:
      p = d[ch][0]
      rep+=1

print(len(s)*rep + p + 1)

Measured memory_bytes: 7540
import java.util.Scanner;

public class Main{


	/**
	 * 与えられたベクトルの積を求める
	 * @param args　vec_1,vec_2
	 */
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] args){

		int gyo = scan.nextInt();
		int retu = scan.nextInt();
		//		int gyo = Integer.parseInt(args[0]);
		//		int retu = Integer.parseInt(args[1]);


		int[][] vec_1 = new int[gyo][retu];

		//int[] output = new[vec_1];
		//vec_1
		for(int i= 0; i<gyo;i++){
			for(int j= 0;j<retu;j++ ){
				vec_1[i][j] = scan.nextInt();
				//		vec_1[i][j] = Integer.parseInt(args[4*i+(j+2)]);
				//		System.out.print(vec_1[i][j]+" ");
			}
			//	System.out.println("");
		}

		//vec_2
		int[] vec_2 = new int[retu];
		for(int i = 0; i < retu;i++){
			vec_2[i] = scan.nextInt();
			//	vec_2[i] = Integer.parseInt(args[gyo*retu+2+i]);
			//	System.out.println(vec_2[i]);
		}

		//output
		int[] output = new int[gyo];
		for(int i = 0;i< gyo;i++){
			for(int j= 0;j<retu; j++){
				output[i] =output[i] +  vec_1[i][j]*vec_2[j];
			}
			System.out.println(output[i]);
		}

	}
}


Measured memory_bytes: 40348
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(ll &f){
	f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
} 
int n,m;
int main(){
    cin>>n>>m;
    if(n==m){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, K: int):
    common_divisor_list = []
    for i in range(1,min(A, B)+1):
        if A % i == 0 and B % i == 0:
            common_divisor_list.append(i)
    common_divisor_list = sorted(common_divisor_list, reverse=True)
    result = common_divisor_list[K-1]
    print(result)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, K)

if __name__ == '__main__':
    main()


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

#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1

using namespace std;

const int INF = 1e18;

int MIN(int a, int b)
{
    return (a > b) ? b : a;
}



void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    int H, W, K; cin >> H >> W >> K;

    vector<string> c(H); rep(h, H) cin>> c[h];

    int ans = 0;
    for (int h = 0; h < (1<<H); h++) {
        for (int w = 0; w < (1<<W); w++) {

            int cnt = 0;

            for (int hi = 0; hi < H; hi++) {
                for (int wi = 0; wi < W; wi++) {

                    if ((h >> hi) & 1) continue;
                    if ((w >> wi) & 1) continue;

                    if (c[hi][wi] == '#') cnt++;
                }
            }

            if (cnt == K) ans++;

        }
    }

    cout << ans << endl;


}

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


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, ans = 0;
    cin >> n;
    bool f = true;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if((a % 2 == 0) && (a % 3 != 0) && (a % 5 != 0)){
            f = false;
            break;
        }
    }
    cout << (f? "APPROVED":"DENIED") << endl;
    return 0;
}


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

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) a[i]--;
    map<int, int> cnt;
    rep(i, 0, n) cnt[a[i]] ++;
    ll total = 0;
    rep(i, 0, n){
        total += choose2(cnt[i]);
    }
    rep(i, 0, n){
        ll ans = total;
        ans -= choose2(cnt[a[i]]);
        cnt[a[i]]--;
        ans += choose2(cnt[a[i]]);
        cout << ans << endl;
        cnt[a[i]] ++;
    }
    return 0;
}   

Measured memory_bytes: 12800
def main():
    c = input()
    if c.islower():
        print('a')
        return
    print('A')


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


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

int main(){
    ll h, w;
    cin >> h >> w;
    vector< vector<ll> > d(10, vector<ll> (10));
    rep(i, 0, 10) {
        rep(j, 0, 10) cin >> d[i][j];
    }
    rep(i, 0, 10){
        rep(j, 0, 10){
            rep(k, 0, 10){
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
            }
        }
    }
    ll ans = 0;
    rep(i, 0, h){
        rep(j, 0, w) {
            ll a;
            cin >> a;
            if(a == -1) continue;
            ans += d[a][1];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define INF 0x3f3f3f3f
#define INFll 0x3f3f3f3f3f3f3f3f
#define y0 _lxybz_
#define y1 _ljmnzyzhhhoscartxdy_
typedef long double ld;
typedef long long ll;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
#define lo(x) ((x)&(-(x)))
#define trav(a, x) for (auto &a : x)
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
const ld Pi = 4*atan((ld)1);
template<class T> void chmin(T &a,const T&b) { a = min(a, b); }
template<class T> void chmax(T &a,const T&b) { a = max(a, b); }
namespace IO{
template<class T> inline void read(T&ret)
{
	ret=0; int f=1; char c=getchar();
	while(c<48||c>57){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	ret*=f;
}
template<class T> inline void prin(const T&ret)
{
	if(!ret){putchar(48);return;} static T o; o=ret;
	if(o<0){putchar('-');o=-o;}
	static int op[25],tt; tt=0;
	while(o){
		op[++tt]=o%10;
		o/=10;
	}
	for(int i=tt;i;--i)putchar(op[i]+48);
}
template<class T> inline void pri_(const T&ret)
{
	prin(ret);putchar(' ');
}
template<class T> inline void priE(const T&ret)
{
	prin(ret);putchar('\n');
}
}
using namespace IO;

#define N 
#define MO 
int h[105],n;
void dfs(int p, int s)
{
	if(p>n){
		F(i,1,p-1){
			putchar(h[i]+96);
		}
		puts("");return;
	}
	F(i,1,s+1){
		h[p]=i;
		dfs(p+1,max(i,s));
	}
}

inline void _Sol_()
{
	read(n); h[1]=1;
	dfs(2,1);
}

int main()
{
	int T=1; //read(T);
	while(T--)_Sol_();
}

Measured memory_bytes: 1536
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define repn(i,a,b) for (int i=(a);i>=(b);i--)
#define repq(i,a,b) for (int i=(a);i<(b);i++)
#define pa pair<int,int>
#define be begin()
#define en end()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll modInverse(ll a, ll m) 
{ ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0; while (a > 1){ ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } 
    if (x < 0) x += m0; return x; 
}
ll power(ll x, ll y, ll p)  
{  
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)  
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;}
    return res;

}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<ll>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
void solve()
{
    char s;
    cin>>s;
    if(s>='A' && s<='Z')
    {
        cout<<'A';return;
    }
    else
        cout<<'a';return;


}

int main() 
{ 
    


    solve();

        
    
    
    return 0; 
} 

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define inf 1e16
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define M 1000010

ll bit[M];
ll n,m,x,k,invcnt;
void up(ll i,ll val){
	for(;i<=m;i+=(i&-i))bit[i]+=val;
}
ll sum(ll i){
	ll t=0;
	for(;i>0;i-=i&-i)t+=bit[i];
	return t;
}
int main(){
	IOS;
		
		vll v;
		vll f(5000,0);
		m=-1,invcnt=0;
		cin>>n>>k;
		rep(i,0,n){ll x;cin>>x;v.pb(x);m=max(m,x);f[x]++;}
		rep(i,0,m+1)bit[i]=0;
		for(ll i=n-1;i>=0;i--){
			invcnt+=sum(v[i]-1);//tell(i,invcnt);
			up(v[i],1);
		}
		invcnt=(invcnt)%md;
		ll su=0,c=n;
		for(ll i=m;i>=0;i--){
			if(f[i]!=0){
				c-=f[i];
				ll r=(k*(k-1)/2)%md;
				r=(r*c)%md;
				su=(su+f[i]*r)%md;
			}
		}
		invcnt=(invcnt*k+su)%md;
		cout<<invcnt;
	return 0;
}



Measured memory_bytes: 384
#!/usr/bin/env python3
from math import pi, cos, sin

a, b, h, m = map(int, input().split())
ax = a * cos(2 * pi * (h / 12 + m / 720))
ay = a * sin(2 * pi * (h / 12 + m / 720))
bx = b * cos(2 * pi * m / 60)
by = b * sin(2 * pi * m / 60)
print(((bx - ax) ** 2 + (by - ay) ** 2) ** 0.5)


Measured memory_bytes: 9564
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
 
#define N  100005
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n;
		cin>>n;
		ll int arr[n+1];
		for(ll int i=1;i<=n;i++) cin>>arr[i];
		ll int ans=0;
		for(ll int i=1;i<=n;i++)
		{
			for(ll int j=i+1;j<=n;j++)
			{
				ans+=arr[i]*arr[j];
			}
		}
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 256
s = gets.chomp
k = gets.chomp.to_i

XDAY = 5_000_000_000_000_000

sum = 0
s.chars.each do |c|
  case c
  when '1'
    sum += 1
  else
    sum += k + 1
  end
  if sum >= k
    puts c
    exit
  end
end


Measured memory_bytes: 1788
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define F first
#define S second


int main()
{

#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
//ios_base& scientific (ios_base& str);


    ll t, n;
    cin >> t >> n;
    ll out = t * n;
    cout << out << "\n";

    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,w;
    cin>>n;
    cin>>w;
    long long int weight[n+1];
    long long int value[n+1];
    long long int sumvalue=0;
    multiset<pair<int,int>> st;
    for(long long int i=1;i<=n;i++)
    {
        cin>>weight[i];
        cin>>value[i];
        auto x=make_pair(weight[i],value[i]);
        st.insert(x);
        sumvalue+=value[i];
    }
    long long int k=1;
  /*  for(auto it=st.begin();it!=st.end();it++)
    {
        weight[k]=it->first;
        value[k]=it->second;
        k++;
    }*/
    long long int dp[sumvalue+1];
    for(long long int i=0;i<=sumvalue;i++)
    {
        dp[i]=99999999999;
    }
    long long int capacity=0;
    for(long long int i=1;i<=n;i++)
    {
       for(int k=sumvalue;k>=value[i];k--)
       {
           dp[k]=min(dp[k],dp[k-value[i]]+weight[i]);
       }
       for(int k=0;k<=value[i];k++)
       {
           dp[k]=min(dp[k],weight[i]);
       }
    }
    long long int ans=0;
    for(long long int i=0;i<=sumvalue;i++)
    {
        if(dp[i]<=w)
            ans=i;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

struct Node {
    Node *left, *right;

    Node() : left(NULL), right(NULL) {}

    Node* intersect(Node *other) {
        Node *n = new Node;
        if(this->left && other->left) {
            n->left = this->left->intersect(other->left);
        }
        if(this->right && other->right) {
            n->right = this->right->intersect(other->right);
        }
        return n;
    }

    Node* union_(Node *other) {
        Node *n = new Node;
        if(this->left && other->left) {
            n->left = this->left->union_(other->left);
        }
        else {
            n->left = this->left?this->left : other->left;
        }

        if(this->right && other->right) {
            n->right = this->right->union_(other->right);
        }
        else {
            n->right = this->right?this->right : other->right;
        }

        return n;
    }
};
ostream& operator << (ostream &os, const Node &node) {
    os << '(';
    if(node.left) os << *node.left;
    os << ',';
    if(node.right) os << *node.right;
    os << ')';
}

void skip(const string &str, char c, int &pos) {
    if(str[pos] != c) {
        cout << "Expected " << c << " but found " << str[pos] << " near " << str.substr(pos) << endl;
    }
    ++pos;
}

Node *getNode(const string &str, int &pos) {
    skip(str, '(', pos);

    Node *node = new Node;
    if(str[pos] == '(') node->left = getNode(str, pos);
    skip(str, ',', pos);
    if(str[pos] == '(') node->right = getNode(str, pos);
    skip(str, ')', pos);

    return node;
}

int main() {
    char cmd;
    string s1, s2;

    while(cin >> cmd >> s1 >> s2 && !cin.eof()) {
        int pos = 0;
        Node *n1 = getNode(s1, pos);
        pos = 0;
        Node *n2 = getNode(s2, pos);

        if(cmd == 'i') {
            cout << *(n1->intersect(n2)) << endl;
        }
        else {
            cout << *(n1->union_(n2)) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 0
"use strict";
const main = arg => {
  const blocks = arg.split("\n")[0].split("");
  let oneNums = 0;
  let zeroNums = 0;
  let ans = 0;
  // 配列の中で1と0がどれだけあるかをカウント
  blocks.forEach((x)=>{
  	x == 1? oneNums++ : zeroNums++;
  });
  // 小さい方を答えに採用
  ans = Math.min(oneNums,zeroNums);
  // 対になるのでかける2
  console.log(ans*2);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

const int INF = 1001001001;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, p, q;
    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> x.at(i);
    }
    sort(x.begin(), x.end());
    p = INF;
    for (int i = x.at(0); i <= x.at(n - 1); ++i)
    {
        q = 0;
        for (int j = 0; j < n; ++j)
        {
            q += (x.at(j) - i) * (x.at(j) - i);
        }
        p = min(p, q);
    }
    cout << p << endl;

    return 0;
}

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

const ll INF = 1ll << 60;
ll MOD = 998244353;

int main()
{

    char c;
    cin >> c;

    c += 1;

    cout << c << endl;
    return 0;
}

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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	int n;
	cin >> s >> n;
	int ans1 = s[0] - '0';
	FOR(i, 1, s.size()) {
		if (i % 2 == 1) {
			if (s[i] == '+') {
				ans1 += s[i + 1] - '0';
			}
			else {
				ans1 *= s[i + 1] - '0';
			}
		}
		else continue;
	}
	int ans2 = 0, tmp = s[0] - '0';
	int i = 1;
	while (i < s.size()) {
		if (i % 2 == 1) {
			if (s[i] == '+') {
				ans2 += tmp;
				tmp = s[i+1]-'0';
			}
			else {
				tmp *= s[i+1] - '0';
			}
		}
		i += 2;
	}
	ans2 += tmp;


	if (ans1 == n) {
		if (ans2 == n)cout << 'U' << endl;
		else cout << 'L' << endl;
	}
	else {
		if (ans2 == n)cout << 'M' << endl;
		else cout << 'I' << endl;
	}



	return 0;
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;


int main() {
    int A, P; cin >> A >> P;
    cout << (P + A*3) / 2 << endl;
    return 0;

}

Measured memory_bytes: 3632
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    ll N, K; cin >> N >> K;
    ll ub = LONGINF, lb = 0;
    while(ub - lb > 1) {
        ll mid = (ub + lb) / 2;
        ll mon = mid, tot = 0;
        for(ll i=0; i<N and mon>0; i++, mon/=2) {
            tot += mon;
        }
        if(tot <= K) lb = mid;
        else ub = mid;
    }
    cout << lb << endl;
    return 0;
}



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

using namespace std;
const int mod = 1e9 + 7, N = 2e5 + 5;
vector<int> adj[N];


long long fastpower(long long b, long long p) {
    long long res = 1;
    long long v = b;
    while (p) {
        if (p & 1) res = (res * v) % mod;
        p >>= 1;
        v = (v * v) % mod;
    }
    return res;
}

long long hlf = fastpower(2, mod - 2);

int sz[N];

void getsz(int u, int p) {
    sz[u] = 1;
    for (auto v:adj[u]) {
        if (v == p) continue;
        getsz(v, u);
        sz[u] += sz[v];
    }
}

int n;
long long memo[N][2];

long long solve(int l, bool o) {
    if (l == 0) return o;
    long long &res = memo[l][o];
    if (~res) return res;
    res = (hlf * solve(l - 1, o)) % mod;
    res = (res + hlf * solve(l - 1, 1)) % mod;
    return res;
}

long long ans = 0;

long long memo2[N][4];
int vis[N][4], vid = 0;
int l;
vector<long long> arr;

long long solve2(int idx, int c) {
    c = min(c, 2);
    if (idx == l) {
        return c == 2;
    }
    long long &res = memo2[idx][c];
    if (vis[idx][c] == vid) return res;
    vis[idx][c] = vid;
    res = ((1-arr[idx]+mod)*solve2(idx + 1, c)) % mod;
    res = (res + solve2(idx + 1, c + 1) * arr[idx]) % mod;
    return res;
}


void dfs(int u, int p) {
    long long val = hlf;
    int c = 0;
    vector<long long> vec;
    for (auto v:adj[u]) {
        if (v == p) continue;
        vec.push_back(solve(sz[v], 0));
        ++c;
        dfs(v, u);
    }
    if (n - sz[u]) {
        ++c;
        vec.push_back(solve(n - sz[u], 0));
    }
    if (c > 1) {
        arr = vec;
        l = vec.size();
        ++vid;
        val = (solve2(0, 0)) % mod;
        val = (val * hlf) % mod;
        ans = (ans + val) % mod;
    }
}


int main() {

   // freopen("in.txt", "rt", stdin);
    memset(memo, -1, sizeof memo);
    scanf("%d", &n);
    int a, b;
    for (int i = 1; i < n; ++i) {
        scanf("%d %d", &a, &b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    getsz(1, 0);
    dfs(1, 0);
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 41088
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	rep(i,n) cin >> a[i];

	vector<pii> b;
	rep(i,n-1) {
		b.push_back(pii(a[i], (a[i+1]-a[i]+m) %m));
	}
	sort(all(b));
	ll res = 1e15;
	ll tmp = 0;
	rep(i,b.size()) tmp += b[i].se;
	rep(i,n*2) b.push_back(pii(b[i].fi+m, b[i].se));
	priority_queue<pii> q;
	int j = 0;

	rep(i,m*3) {
		while(j < b.size() && b[j].fi <= i-2) {
			if(b[j].fi == i-2) {
				q.push(pii(-(b[j].fi + b[j].se), max(0,b[j].se-1)));
//				cout << "*" << j << " " << b[j].fi << endl;
			}
			j++;
		}
		while(q.size() && -(q.top().fi) < i) {
			tmp += q.top().se;
			q.pop();
		}
		tmp -= q.size();
		res = min(res, tmp);
//		cout << "#" << i << " " << q.size() << " " << tmp << endl;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 6768
N, x, y = map(int, input().split())
x -= 1
y -= 1
dist = [0] * (N)

for i in range(N-1):
  for j in range(i+1,N):
    d = min([abs(j-i), abs(x-i) + 1 + abs(j-y), abs(y-i) + 1 + abs(j-x)])
    dist[d] += 1

for i in range(1,N):
  print(dist[i])

Measured memory_bytes: 3444
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
//これは、頭が悪く競プロが世界で一番できないHIR180が
//IOI2014日本代表になるまでのN日間の記録である。
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define f first
#define s second
#define rep(i,x) for(int i=0;i<x;i++)
vector<P>edge[100005];
vector<P>G[100005];
int d[100005],n,m,k,q,depth[100005];
P1 E[200005];
int doubl[100005][18];
int val[100005][18];
struct UnionFind
{
	int par[100005];
	int ran[100005];
	void init()
	{
		for(int i=0;i<n;i++)
		{
			ran[i]=0;
			par[i]=i;
		}
	}
	int find(int x)
	{
		if(par[x]==x) return x;
		else return par[x]=find(par[x]);
	}
	void unite(int x,int y)
	{
		x=find(x);
		y=find(y);
		if(x==y) return ;
		if(ran[x]<ran[y])
		{
			par[x]=y;
		}
		else
		{
			par[y]=x;
			if(ran[x]==ran[y])
			{
				ran[x]++;
			}
		}
	}
	bool same(int a,int b){  return find(a)==find(b);}
}uf;
void dfs(int v,int u,int c,int d)
{
	doubl[v][0]=u;
	val[v][0]=c;
	depth[v]=d;
	for(int i=0;i<G[v].size();i++)
	{
		if(G[v][i].f==u) continue;
		dfs(G[v][i].f,v,G[v][i].s,d+1);
	}
}
int calc(int u,int v)
{
	if(depth[u]>depth[v]) swap(u,v);
	int res=INF;
	for(int i=0;i<18;i++)
	{
		if((((depth[v]-depth[u])>>i)&1))
		{
			res=min(res,val[v][i]);
			v=doubl[v][i];
		}
	}
	if(u==v) return res;
	for(int i=17;i>=0;i--)
	{
		if(doubl[u][i]!=doubl[v][i])
		{
			res=min(res,min(val[v][i],val[u][i]));
			v=doubl[v][i];
			u=doubl[u][i];
		}
	}
	return min(res,min(val[v][0],val[u][0]));
}
int main()
{
	scanf("%d %d %d %d",&n,&m,&k,&q);
	for(int i=0;i<m;i++)
	{
		int a,b,c;
		scanf("%d %d %d",&a,&b,&c);
		edge[--a].pb(mp(--b,c));
		edge[b].pb(mp(a,c));
		E[i]=mp(c,mp(a,b));
	}
	fill(d,d+n,INF);
	priority_queue<P,vector<P>,greater<P> >que;
	for(int i=0,x;i<k;i++)
	{
		scanf("%d",&x);
		d[--x]=0;
		que.push(mp(0,x));
	}
	while(!que.empty())
	{
		P p=que.top(); que.pop();
		for(int i=0;i<edge[p.s].size();i++)
		{
			if(d[edge[p.s][i].f]>p.f+edge[p.s][i].s)
			{
				d[edge[p.s][i].f]=p.f+edge[p.s][i].s;
				que.push(mp(d[edge[p.s][i].f],edge[p.s][i].f));
			}
		}
	}
	uf.init();
	for(int i=0;i<m;i++) E[i].f=min(d[E[i].s.f],d[E[i].s.s]);
	sort(E,E+m,greater<P1>());
	for(int i=0;i<m;i++)
	{
		if(uf.same(E[i].s.f,E[i].s.s)) continue;
		uf.unite(E[i].s.f,E[i].s.s);
		G[E[i].s.f].pb(mp(E[i].s.s,E[i].f));
		G[E[i].s.s].pb(mp(E[i].s.f,E[i].f));
	}
	for(int i=0;i<n;i++)for(int j=0;j<18;j++) val[i][j]=INF;
	dfs(0,-1,INF,0);
	for(int i=0;i<=16;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(doubl[j][i]==-1)
			{
				doubl[j][i+1]=-1;
				val[j][i+1]=INF;
			}
			else
			{
				doubl[j][i+1]=doubl[doubl[j][i]][i];
				val[j][i+1]=min(val[j][i],val[doubl[j][i]][i]);
			}
		}
	}
	for(int i=0;i<q;i++)
	{
		int u,v;
		scanf("%d %d",&u,&v);
		--u; --v;
		printf("%d\n",calc(u,v));
	}
}

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

int cnt[100][100];
int main() {
  int n;
  cin >> n;
  vp p(n);
  rep(i,n){
    string s;
    cin >> s;
    ll x = 0;
    int d = 9;
    bool f = false;
    rep(i,sz(s)){
      if(s[i] == '.'){
        f = true;
        continue;
      }
      x = x*10 + s[i]-'0';
      if(f)d--;
    }
    rep(i,d)x*=10;
    int p2=0,p5=0;
    while(x%2 == 0){
      x/=2;
      p2++;
    }
    while(x%5 == 0){
      x/=5;
      p5++;
    }
    mins(p2,18);
    mins(p5,18);
    cnt[p2][p5]++;
    p[i] = make_pair(p2,p5);
  }
  ll ans = 0;
  rep(i,n){
    rep(j,19)rep(k,19){
      if((p[i].fi+j)<18 or (p[i].se+k)<18)continue;
      ans+=cnt[j][k]; 
    }
    //remove duplication
    if(p[i].fi>=9 and p[i].se>=9)ans--;
  }
  
  cout<<ans/2<<endl;
  return 0;
}

Measured memory_bytes: 4648
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
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 pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = false;

int N, A[1 << 18];
int ans[1 << 18];
pair<pi, pi> MAX[1 << 18];

void solve() {
    FOR (1 << N) {
        {
            set<pi> S;
            S.insert({-INF, -1});
            S.insert({A[i], i});
            FOR (x, N) {
                if (i & (1 << x)) {
                    int bit = i;
                    bit &= ~(1 << x);
                    S.insert(MAX[bit].first);
                    S.insert(MAX[bit].second);
                }
            }
            auto it = S.end();
            MAX[i].first = *(--it);
            MAX[i].second = *(--it);
        }

        if (i > 0) {
            ans[i] = max(ans[i - 1], MAX[i].first.first + MAX[i].second.first);
            //chmax(ans[i], MAX[i].first + MAX[i].second);
            cout << ans[i] << endl;
        }
    }
}

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

    cin >> N;
    FOR (1 << N)
        cin >> A[i];

    solve();
    return 0;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  string x, y;
  int ans = 0;
  for (int i = 1; i < n; i++) {
    x = s.substr(0, i);
    y = s.substr(i);
    int count = 0;
    for (char i = 'a'; i <= 'z'; i++)
      if (find(x.begin(), x.end(), i) != x.end() &&
          find(y.begin(), y.end(), i) != y.end())
        count++;
    ans = max(ans, count);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
    Scanner scn = new Scanner(System.in);
      
    int A = scn.nextInt();
    int B = scn.nextInt();
    int C = scn.nextInt();
      
    if((B/A)>=C){
    System.out.print(C);
    }else{
    System.out.print(B/A);
    }
    }
}

Measured memory_bytes: 23636
import heapq

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

for i in range(N):
    u, k, *nums = list(map(int,input().split()))
    for j in range(k):
        t = nums[j*2]
        c = nums[j*2+1]
        A[u].append([t, c])

memo = [1E18] * N
memo[0] = 0
qu = []
heapq.heappush(qu, (0,0))
while len(qu) != 0:
    atop = heapq.heappop(qu)
    for ne in A[atop[1]]:
        x = ne[0]
        next_cost = atop[0] + ne[1]
        if(memo[x] > next_cost):
            memo[x] = next_cost
            heapq.heappush(qu, (next_cost, x))
for i in range(N):
    print(i, memo[i])



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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

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

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;
int main() {
    ll H, W, K;
    cin >> H >> W >> K;
    vector<string> table(H);
    for (int i = 0; i < H; ++i) {
        cin >> table[i];
    }

    ll ans = INF;
    for (int mask = 0, all = 1 << (H - 1); mask < all; ++mask) {
        bool is_ok = true;
        ll cnt_yoko = 0;
        ll cnt_tate = 0;

        vector<ll> group(H);
        for (int i = 0; i < (H - 1); ++i) {
            if (mask & (1 << i)) {
                group[i + 1] = group[i] + 1;
                ++cnt_yoko;
            } else {
                group[i + 1] = group[i];
            }
        }

        vector<ll> counter(cnt_yoko + 1);

        for (ll i = 0; i < W; ++i) {
            vector<ll> col(cnt_yoko + 1);
            bool split = false;
            for (ll j = 0; j < H; ++j) {
                col[group[j]] += table[j][i] - '0';
                counter[group[j]] += table[j][i] - '0';
                if (col[group[j]] > K) is_ok = false;
                if (counter[group[j]] > K) split = true;
            }

            if (split) {
                ++cnt_tate;
                counter = col;
            }
            if (!is_ok) break;
        }

        if (is_ok) chmin(ans, cnt_yoko + cnt_tate);
    }

    cout << ans << endl;
}

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

int main() {
    long long a,b,c,d;
    vector<long long> answer(4);
    cin >> a >> b >> c >> d;

    answer.at(0) = a * c;
    answer.at(1) = a * d;
    answer.at(2) = b * c;
    answer.at(3) = b * d;
    
    sort(answer.rbegin(), answer.rend());
    cout << answer.at(0) << endl;
}

Measured memory_bytes: 3628
//1.read question_2.read I/O_3.read test cases_4.read constraints(to decide TC of solution)_5.decide method_6.dry run_
//7.code_8.test_9.submit
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define _READ freopen("input.txt","r", stdin);
#define pb push_back
#define MP make_pair
#define _FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{
    
    lli n,m;cin>>m>>n;vector<lli> ar(n);
    lli sum=0;
    for(auto &i:ar)
    {
        cin>>i;
        sum+=i;
    }
    if(sum>=m)
        cout<<"Yes\n";
    else
        cout<<"No\n";

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int main(){
  // int n, m;
  // cin >> n >> m;
  int N, Q;
  cin >> N >> Q;
  fenwick_tree<long long> fw(N);

  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    fw.add(i,a);
  }

  for (int i = 0; i < Q; ++i) {
    int q;
    cin >> q;
    if (q == 0) {
      int p, x;
      cin >> p >> x;
      fw.add(p, x);
    }else{
      int l, r;
      cin >> l >> r;
      cout << fw.sum(l,r) << "\n";
    }
  }
  return 0;
}


Measured memory_bytes: 8212
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

#define INFTY 1000000001

int compnum = 0;

void merge(vector<int> &A, int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	vector<int> L(n1 + 1);
	for (int i = 0; i < n1; i++) L[i] = A[left + i];
	vector<int> R(n2 + 1);
	for (int i = 0; i < n2; i++) R[i] = A[mid + i];
	L[n1] = INFTY;
	R[n2] = INFTY;
	int i = 0;
	int j = 0;
	for (int k = left; k < right; k++){
		compnum++;
		if (L[i] <= R[j]){
			A[k] = L[i];
			i = i + 1;
		}
		else{
			A[k] = R[j];
			j = j + 1;
		}
	}

}

void mergeSort(vector<int> &A, int left, int right){
	if (left + 1 < right){
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

int main(){

	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; i++) cin >> A[i];

	mergeSort(A, 0, n);

	for (int i = 0; i < n; i++) cout << ((i != 0) ? " " : "") << A[i];
	cout << endl << compnum << endl;

	return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

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

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n ;
  string s;
  cin >> n;
  rep(i,n){
    cin >> s;
    set<string> st;
    string l,r,rl,rr;
    rep(j,s.size()-1){
      rl = l = s.substr(0,j+1);
      rr = r = s.substr(j+1);
      reverse(all(rl));
      reverse(all(rr));
      st.insert(l+r);
      st.insert(l+rr);
      st.insert(rl+r);
      st.insert(rl+rr);
      st.insert(r+l);
      st.insert(r+rl);
      st.insert(rr+l);
      st.insert(rr+rl);
    }
    cout << st.size()<<endl;
  }

  return 0;
}

Measured memory_bytes: 3236