akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define PB(a,num) FOR(i,0,num) {ll x; scanf("%lld",&x); a.pb(x); }
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef set<ll> SET;
typedef map<ll, ll> MAP;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[8] = { 1,-1,0,0,1,1,-1,-1 }, ddy[8] = { 0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 111111



int main(void) {
  cin >> n;
  MAP mp;
  FOR(i, 0, n) {
	cin >> tmp;
	tmp /= 400;
	if (tmp > 8) tmp = 8;
	mp[tmp]++;
  }

  tmp = 0;
  for (auto it : mp) {
	cnt++;
	if (it.first == 8) {
	  tmp = it.second;
	  cnt--;
	}
  }

  if (cnt == 0) {
	cout << "1 " << tmp << endl;
	return 0;
  }
  cout << cnt << " " << cnt+tmp << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
const double pi=3.1415926535897932384626;

int main(){
    int n;
    std::cin >> n;
    VEC(ll,a,n+1);
    VEC(ll,b,n);
    ll ans=0;
    rep(i,n){
        ll d=min(b[i],a[i]);
        a[i]-=d;
        b[i]-=d;
        ans+=d;
        if(b[i]){
            d=min(b[i],a[i+1]);
            a[i+1]-=d;
            b[i]-=d;
            ans+=d;
        }
    }
    //std::cout << ans << std::endl;
    
    std::cout << ans << std::endl;
    
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<deque>
#define ll long long
using namespace std;
#define BUF_SIZE 1048576
char _buf[BUF_SIZE],*_is=_buf,*_it=_buf;
inline char rdc(){
	if (_is==_it) _it=(_is=_buf)+fread(_buf,1,BUF_SIZE,stdin);
	return *_is++;
}
inline void rdi(int &x){
	int f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	if(f) x=-x;
}
inline void rdi(ll &x){
	int f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	if(f) x=-x;
}
inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(int x){
	write(x);
	putchar(' ');
}
inline void print(int x){
	write(x);
	putchar('\n');
}
int n;
ll k;
const int md=1000000007;
struct matrix{
	ll a[55][55];
	inline matrix operator *(matrix o)const{
		matrix r={};
		for(int i=0;i<n;++i) for(int k=0;k<n;++k) for(int j=0;j<n;++j) r.a[i][j]=(r.a[i][j]+a[i][k]*o.a[k][j])%md;
		return r;
	}
}b,r;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	rdi(n),rdi(k);
	int i,j;
	for(i=0;i<n;++i) for(j=0;j<n;++j) rdi(b.a[i][j]);
	for(i=0;i<n;++i) r.a[i][i]=1;
	while(k){
		if(k&1) r=r*b;
		b=b*b;
		k>>=1;
	}
	ll ans=0;
	for(i=0;i<n;++i) for(j=0;j<n;++j) ans+=r.a[i][j];
	cout<<ans%md<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long int
#define p 100000000007
using namespace std;
int main(void)
{
	ll n;
	scanf("%lld", &n);
	ll sum = 0;
	for(ll i=1; i<=n;i++)
	{
		if((i%15) !=0 && (i%3) != 0 && (i%5) != 0)
			sum = sum + i;
	}
	printf("%lld\n", sum);

}

Measured memory_bytes: 3828
#include <iostream>

using namespace std;


int main(){
while(1){
	int n,m;
	bool P=false;
	cin>>n>>m;
	if(n==0&&m==0) break;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int max=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i!=j&&a[i]+a[j]<=m&&a[i]+a[j]>max){
				max=a[i]+a[j];
				P=true;
			}
		}
	}

	if(P==false) cout<<"NONE"<<endl;
	else cout<<max<<endl;

}
	return 0;
}

Measured memory_bytes: 3068
import java.util.*;
import java.io.File;
public class Main {
    public static void main(String[] args){
        try {
            //File file = new File("./tx1.txt");
            Scanner scan = new Scanner(System.in);
            while (scan.hasNext()) {
                String s = scan.nextLine();
                //System.out.println(s);
                if(s.equals(".")){break;}
                String[] slist = s.split("");
                StringStack2 stack = new StringStack2(100);
                boolean flg=true;
                for (String item : slist) {
                    if (item.equals("(") || item.equals("[")) {
                        stack.push(item);
                    } else if (item.equals(")")) {
                        if (stack.empty()||!(stack.pop().equals("("))) {
                            System.out.println("no");
                            flg=false;
                            break;
                        }
                    } else if (item.equals("]")) {
                        if (stack.empty()||!(stack.pop().equals("["))) {
                            System.out.println("no");
                            flg=false;
                            break;
                        }
                    }
                }
                if(flg==true&&!(stack.empty())){
                    System.out.println("no");
                    flg=false;
                }
                if(flg==true){
                System.out.println("yes");
                }

            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}

class StringStack2 {
    private String[] data;
    private int size;
    private int capacity;

    public StringStack2(int capacity) {
        this.data = new String[capacity];
        this.size = 0;
    }

    public void push(String item) {
        size += 1;
        data[size] = item;
    }

    public String peek() {
        return data[size];
    }

    public String pop() {
        size -= 1;
        return data[size + 1];
    }

    public boolean empty() {
        if (size == 0) {
            return true;
        } else {
            return false;
        }
    }

    public int size() {
        return size;
    }

}




Measured memory_bytes: 74204
#include<bits/stdc++.h>
using namespace std;
int dp[1 << 20][2];
int main() {
    int n;
    cin >> n;
    for(int i = 0; i < (1 << n); i++) {
        cin >> dp[i][0];
    }
    for(int j = 0; j < n; j++) {
        for(int i = 0; i < (1 << n); i++) {
            if(i & (1 << j)) {
                int a = dp[i ^ (1 << j)][0], b = dp[i ^ (1 << j)][1];
                if(a >= dp[i][0]) {
                    dp[i][1] = max(dp[i][0], b);
                    dp[i][0] = a;
                }
                else {
                    dp[i][1] = max(dp[i][1], max(a, b));
                }
            }
        }
    }
    int ans = 0;
    for(int i = 1; i < (1 << n); i++) {
        ans = max(ans, dp[i][0] + dp[i][1]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 7168
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline void myassert(bool a,string s){ if(!a)cerr<<s<<endl,exit(0);}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=200;
const int MAX=20;

int n,m;
char str[maxn][maxn];
short f[MAX+1][maxn][maxn][maxn];

inline void init()
{
	n=read();m=read();
	REP(i,1,n)scanf("%s",str[i]+1);
}

inline void doing()
{
	REP(len,1,m)for(int l=1,r=len;r<=m;l++,r++)
	{
		DREP(h,n,1)
		{
			if(l==r)f[0][l][r][h]=h;
			else f[0][l][r][h]=str[h][l]==str[h][r] && f[0][l][r-1][h] && f[0][r][r][h]?h:0;
			if(f[0][l][r][h] && f[0][l][r][h+1] && str[h][l]==str[h+1][l])f[0][l][r][h]=f[0][l][r][h+1];
		}
	}
	REP(d,1,MAX)
	{
		DREP(h,n,1)
		{
			REP(l,1,m)
			{
				short k=l;
				REP(r,l+1,m)
				{
					while(k<r-1 && f[d-1][l][k][h]>f[d-1][k+1][r][h] ) k++;
					chkmax(f[d][l][r][h],min(f[d-1][l][k][h],f[d-1][k+1][r][h]));
					if(k>l)chkmax(f[d][l][r][h],min(f[d-1][l][k-1][h],f[d-1][k][r][h]));
				}
			}
		}
		REP(l,1,m)REP(r,l,m)
		{
			short k=n;
			DREP(h,n-1,1)
			{
				while(k>h && f[d-1][l][r][h]<k-1)k--;
				if(k>h)chkmax(f[d][l][r][h],max((short)(k-1),f[d-1][l][r][k]));
			}
		}
		
		REP(l,1,m)REP(r,l,m)REP(h,1,n)chkmax(f[d][l][r][h],f[d-1][l][r][h]);
	}
	REP(d,0,MAX)if(f[d][1][m][1]>=n)printf("%d\n",d),exit(0);
}

int main()
{
	init();
	doing();
	return 0;
}


Measured memory_bytes: 327680
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define INF (ll)1e9+5
#define dif 0.0000000001
#define pp pair<ll,ll> 
#define vv vector< pair<ll ,ll> > 
#define vi vector<ll> 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

ll n;
vector<ll> adj[100005];

void bfs(ll x,ll dist,vector<ll> &distance)
{
	distance[x]=dist;
	
	for(auto y:adj[x])
	{
		if(distance[y]==-1)
		{
			bfs(y,dist+1,distance);
		}
	}
}

int main() {
	fastio;
	cin>>n;
	
	ll u,v,i,a,b;
	vector<ll> f(100005,-1),l(100005,-1);
	
	for(i=1;i<n;i++)
	{
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	
	bfs(1,0,f);
	bfs(n,0,l);
	
	a=b=0;
	
	/*for(i=1;i<n;i++)
	{
		cout<<f[i]<<' ';
	}
	cout<<'\n';
	
	for(i=1;i<n;i++)
	{
		cout<<l[i]<<' ';
	}
	cout<<'\n';*/
	for(i=2;i<n;i++)
	{   
		
		if(f[i]<=l[i])
			a++;
		else
			b++;
	}
	//cout<<a<<' '<<b<<'\n';
	if(a>b)
		cout<<"Fennec";
	else
		cout<<"Snuke";
	// your code goes here
	return 0;
}

Measured memory_bytes: 12032
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 4;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int h, w;
	cin >> h >> w;
	vii c(10, vi(10));
	int i, j, k;
	for (i = 0; i < 10; i++) {
		for (j = 0; j < 10; j++) {
			cin >> c[i][j];
		}
	}
	vii hyou = c;
	for (i = 0; i < 10; i++) {
		for (j = 0; j < 10; j++) {
			for (k = 0; k < 10; k++) {
				if (hyou[j][k] > hyou[j][i] + hyou[i][k]) {
					hyou[j][k] = hyou[j][i] + hyou[i][k];
				}
			}
		}
	}
	int ans = 0;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			int a;
			cin >> a;
			if (a >= 0) {
				ans += hyou[a][1];
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
main(f,x){unsigned u;for(scanf("%d",&x);~scanf("%x",&u);printf("%s%d.%0*d\n",u&1<<31?"-":"",u<<1>>8,x,f))for(f=(u&0x7f)*78125,x=8;--x&&!(f%10);f/=10);exit(0);}

Measured memory_bytes: 616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String str="";

		str=bfr.readLine();
		int souwa=Integer.parseInt(str);

		int kuraiwa=114514;

		int wa1=0,wa2=0;
		int tmp1=0,tmp2=0;
		for(int i=1; i<=(souwa+1)/2; i++) {
			tmp1=i;
			tmp2=souwa-i;
			while(tmp1>0) {
				wa1=wa1+tmp1%10;
				tmp1=tmp1/10;
			}
			while(tmp2>0) {
				wa2=wa2+tmp2%10;
				tmp2=tmp2/10;
			}
			if(kuraiwa>wa1+wa2) {
				kuraiwa=wa1+wa2;
			}
			wa1=0; wa2=0;
		}
		System.out.println(kuraiwa);
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

struct fenwick_tree {
  typedef int T;
  T n;
  vector<T> bit;

  // 各要素の初期値は 0
  fenwick_tree(T num) : bit(num+1, 0) { n = num; }

  // a_i += w
  void add(T i, T w) {
    for (T x = i; x <= n; x += x & -x) {
      bit[x] += w;
    }
  }
  // [1, i] の和を計算.
  T sum(T i) {
    T ret = 0;
    for (T x = i; x > 0; x -= x & -x) {
      ret += bit[x];
    }
    return ret;
  }
  // [left+1, right] の和を計算.
  T sum(T left, T right) {
    return sum(right) - sum(left);
  }
};

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
  ll N,k;
  cin >> N >> k;
  mint K=k;

  vector<int> A(N);
  REP(i, N) cin >> A[i];
  fenwick_tree f_tree(2010);

  mint ans = 0;
  for (int j = 0; j < N; j++) {
    ans += j - f_tree.sum(A[j]);
    f_tree.add(A[j], 1);
  }
  mint ans2 = 0;
  for (int j = 0; j < N; j++) {
    if(A[j]>1){
      ans2 += f_tree.sum(A[j]-1);
    }
  }
  mint x = ans*K+ans2*K*(K-1)/2;
  cout << x << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), K = sc.nextInt();
    int ans = 0;
    while (N != 0) {
      N /= K;
      ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
  ll n, m, k, x, y = 0, z = 0, h, ans=0, w, sum = 0, Max = -1, Min = 1e9+1;
  string u= "";
  bool ok=true;
  cin >> n;
  string s[50];
  VII a(50,VI(26)); 
  rep(i,n){ cin >> s[i]; }

  rep(i,n){
    rep(j, s[i].size()){
      a[i][s[i][j]-'a']++;
    }
  }

  rep(j,26){
    sum=0; Min = 1e9+1;
    rep(i,n){
      if(a[i][j]==0){ break; }
      else{
        sum++;
        chmin(Min,a[i][j]);
      }
    }
    if(sum == n && Min != 1e9+1){
      u += string(Min, j+'a');
    }
  }
  pri(u);
  return 0;
}


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


int main()
{
    int A[50] = {1,2,3,4,5,6,7,8,9,12,23,34,45,56,67,78,89,123,234,345,456,567,678,789,1234,2345,3456,4567,5678,6789,12345,23456,34567,45678,56789,123456,234567,345678,456789,1234567,2345678,3456789,12345678,23456789,123456789};



    int N;
   while( scanf("%d",&N)==1)
   {
       int B[N];
       int C[45];
       int D[45] = {0};
       for(int i=0;i<N;i++)
       {
           scanf("%d",&B[i]);
       }


       int p=0;
       for(int i = 0 ;i<N-1;i++)
       {
           for(int j=i+1;j<N;j++)
           {
               long int M = B[i]*B[j];

               for(int k=0;k<45;k++)
               {
                   if(A[k] == M && D[k] == 0)
                   {
                       D[k] = 1;
                       C[p] = M;
                       p++;
                       break;
                   }
               }
           }
       }


       sort(C,C+p);

       if(p==0)
        printf("-1\n");
       else
        printf("%d\n",C[p-1]);

   }


//   for(int i=0;i<45;i++)
//        printf("%d\n",A[i]);

   return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define rep(i,a,b) for (int i=(a); i<(b); i++)
#define per(i,a,b) for (int i=(b-1); i>=(a); i--)
#define debug(x) cout << #x << " => " << x << endl
using namespace std;

#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;

#define pb push_back
typedef vector<int> vi;

typedef long long ll;
typedef long double ld;

const int MAX_N = 7 + 100000;
const int g[9][2] = { {-1,-1}, {-1,0}, {-1,1}, {0,-1}, {0,0}, {0,1}, {1,-1}, {1,0}, {1,1} };
///----------------------------------------------
//map<ll, int> val;
ll tab[MAX_N*10], tn=0;
ll ans[10];
int main() {

	///read
	int n,m,k; cin>>n>>m>>k;
	
	///prework
	ans[0] = 1ll*(n-2)*(m-2);
	//debug(ans[0]);
	rep(i,0,k) {
		int x,y; scanf("%d%d",&x,&y);
		rep(j,0,9) {
			int dx = x + g[j][0];
			int dy = y + g[j][1];
			if (dx<=1 || dx>=n) continue;
			if (dy<=1 || dy>=m) continue;
			//cout << dx << " ," << dy << endl;
			tab[tn++]=1ll*dx*m+dy;
			//--ans[val[1ll*dx*n+dy]];
			//ans[++val[1ll*dx*n+dy]]++;
		}
		//debug("=====");
	}

	///work
	sort(tab,tab+tn);
	for (int l=0,r; l<tn; l=r+1) {
		for (r=l; r+1<tn&&tab[r+1]==tab[l]; r++);
		ans[0]--; ans[r-l+1]++;
	}
	
	//print
	rep(i,0,10) cout << ans[i] << endl;



}


Measured memory_bytes: 7296
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,m,q = map(int,readline().split())
lst1 = []
for i in range(q):
    a,b,c,d = map(int,readline().split())
    lst1.append([a-1,b-1,c,d])

def func(lst):
    res = 0
    for a,b,c,d in lst1:
        if lst[b]-lst[a] == c:
            res += d
    return res
lst2 = []
def func2(lst,now,num):
    if now == -1:
        lst2.append(lst)
        return
    else:
        for i in range(1,num+1):
            res = lst.copy()
            res[now] = i
            func2(res,now-1,i)

func2([1]*n,n-1,m)

def dfs(lst):
    ans = 0
    for i in lst2:
        ans = max(ans,func(i))
    return ans

print(dfs([1]*n))

Measured memory_bytes: 86804
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int>a(n),f(n,0);
    ll ans=1;
    for(int i=0;i<n;++i){
      cin>>a[i];
      if(a[i]==0){
        ans*=3-f[0];
      }else{
        ans*=f[a[i]-1]-f[a[i]];
      }
      ans%=1000000007;
      f[a[i]]++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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 sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

vl d;
void dijkstra(v(vp) &G,int V,int s) {
// G[f][i] = P(t,c) means that from `f` to `t` 's cost is `c` 
  d = vl(V,LINF);
  priority_queue<pair<ll,ll>,vector<pair<ll,ll>>, greater<pair<ll,ll>>> que;
  d[s] = 0;
  que.push(pair<ll,ll>(0,s));
  while(!que.empty()) {
    pair<ll,ll> p = que.top();
    que.pop();
    int tar = p.second;
    if(d[tar] < p.first) continue;
    rep(i,sz(G[tar])) {
      pair<ll,ll> e = G[tar][i];
      if(d[e.first] > d[tar] + e.second) {
        d[e.first] = d[tar] + e.second;
        que.push(pair<ll,ll>(d[e.first],e.first));
      }
    }
  }
}
  
int main() {
  int N,M;
  cin >> N >> M;
  v(vp) G(N);
  rep(i,N-1) {
    G[i+1].push_back(P(i,0));
  }
  rep(i,M) {
    int l,r,c;
    cin >> l >> r >> c;
    l--;
    r--;
    G[l].push_back(P(r,c));
  }
  dijkstra(G,N,0);
  if(d[N-1] == LINF) {
    cout << -1 << endl;
  } else {
    cout << d[N-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 8568
#include <bits/stdc++.h>
#define int long long 
using namespace std;
int32_t main(){
    int n,k;cin>>n>>k;
    vector<int> arrmv;
    for(int i=0;i<n;i++){
        int t;cin>>t;
        arrmv.push_back(t);
    }
    sort(arrmv.begin(),arrmv.end(),greater<int>());
    int sz=arrmv.size();
    if(sz<=k)cout<<0<<endl;
    else{
        int ans=0;
        for(int i=k;i<sz;i++){
            ans+=arrmv[i];
        }
        cout<<ans<<endl;
    }
	return 0;
}

Measured memory_bytes: 2420
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String n = scanner.nextLine();
        String x = scanner.nextLine();
        String[] coordinates = x.split(" ");
        int[] numbers = new int[coordinates.length];

        int min = Integer.parseInt(coordinates[0]);
        int max = Integer.parseInt(coordinates[0]);
        for (int i = 0; i < coordinates.length; i++) {
            numbers[i] = Integer.parseInt(coordinates[i]);
            if (numbers[i] > max) {
                max = numbers[i];
            }
            if (numbers[i] < min) {
                min = numbers[i];
            }
        }

        int minStamina = 1000000;
        for (int i = min; i <= max; i++) {
            int stamina = 0;
            for (int j: numbers) {
                stamina += Math.pow((j-i), 2);
            }
            if (stamina < minStamina) {
                minStamina = stamina;
            }
        }
        System.out.println(minStamina);

    }

}


Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	for (int i = 0; ; i++) {
		if (A + (A - 1) * (i - 1) >= B) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
mod = 10**9 + 7
n = int(input())
ab = [[int(x) for x in input().split()] for _ in range(n)]
from collections import defaultdict, Counter
import math

double_zero_cnt = 0 # [0, 0]の個数
a_b = [] # a/bを、約分した形で保持(a/gcd(a, b), b/gcd(a, b), 符号)
for a, b in ab:
    if a == 0 and b == 0: 
        double_zero_cnt += 1
        continue
    g = math.gcd(a, b)
    a //= g
    b //= g
    sign = 1 if a*b > 0 else -1 if a*b < 0 else 0
    a_b.append((abs(a), abs(b), sign))

c = Counter(a_b) # ベクトルごとにグループ分け
key_list = list(c.keys())

d = defaultdict(list) # [a, b] あるngなペアのそれぞれの要素の個数
for key in key_list:
    a, b, sign = key
    if d[(b, a, -sign)]: # ダブルカウントしないように
        continue 
    if c[(b, a, -sign)] != 0:
        d[(a, b, sign)] = [c[(a, b, sign)], c[(b, a, -sign)]]

ans = 1 # 積算の単位元
used_cnt = double_zero_cnt # 組めないものがあるイワシの個数
for key in d.keys():
    if d[key] == []: # 前のループで調べると[]が生まれてしまう
        continue
    x, y = d[key]
    used_cnt += (x + y)
    mul = (pow(2, x, mod) + pow(2, y, mod) - 1) % mod # このグループからは、片方ずつからしか出せない。何も選ばないがダブルカウントになる。
    ans *= mul
    ans %= mod

ans *= pow(2, n - (used_cnt), mod) # まだ使われていないイワシは好きな組み合わせ可能
ans += double_zero_cnt # 両方0のものは1つにつき自分のみの1通り
ans -= 1 # 0匹は選べない
ans %= mod
print(ans)







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

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

int main(){
  int n;
  float t,a;
  cin>>n>>t>>a;
  float arr[n];
  for(int i=0;i<n;++i){
    cin>>arr[i];
  }
  vector<pair<float,int>>v;
  int i=0;
  for (auto x : arr){
    float ans = t-x*0.006;
    ans = abs(ans-a);
    v.push_back({ans,i});
    ++i;
  }
  sort(v.begin(),v.end(),rev);
  for (auto x : v){
      cout<<x.second+1;
      break;
  }
  
}
 

Measured memory_bytes: 3840
// C++ program to count number of factors 
// of an array of integers 
#include <bits/stdc++.h> 
#define ll long long
#define int long long
using namespace std; 

const int MAX = 10000001; 

// array to store prime factors 
int factor[MAX] = { 0 }; 

// function to generate all prime factors 
// of numbers from 1 to 10^6 
void generatePrimeFactors() 
{ 
	factor[1] = 1; 

	// Initializes all the positions with their value. 
	for (int i = 2; i < MAX; i++) 
		factor[i] = i; 

	// Initializes all multiples of 2 with 2 
	for (int i = 4; i < MAX; i += 2) 
		factor[i] = 2; 

	// A modified version of Sieve of Eratosthenes to 
	// store the smallest prime factor that divides 
	// every number. 
	for (int i = 3; i * i < MAX; i++) { 
		// check if it has no prime factor. 
		if (factor[i] == i) { 
			// Initializes of j starting from i*i 
			for (int j = i * i; j < MAX; j += i) { 
				// if it has no prime factor before, then 
				// stores the smallest prime divisor 
				if (factor[j] == j) 
					factor[j] = i; 
			} 
		} 
	} 
} 

// function to calculate number of factors 
int calculateNoOFactors(int n) 
{ 
	if (n == 1) 
		return 1; 

	int ans = 1; 

	// stores the smallest prime number 
	// that divides n 
	int dup = factor[n]; 

	// stores the count of number of times 
	// a prime number divides n. 
	int c = 1; 

	// reduces to the next number after prime 
	// factorization of n 
	int j = n / factor[n]; 

	// false when prime factorization is done 
	while (j != 1) { 
		// if the same prime number is dividing n, 
		// then we increase the count 
		if (factor[j] == dup) 
			c += 1; 

		/* if its a new prime factor that is factorizing n, 
		then we again set c=1 and change dup to the new 
		prime factor, and apply the formula explained 
		above. */
		else { 
			dup = factor[j]; 
			ans = ans * (c + 1); 
			c = 1; 
		} 

		// prime factorizes a number 
		j = j / factor[j]; 
	} 

	// for the last prime factor 
	ans = ans * (c + 1); 

	return ans; 
} 

// Driver program to test above function 
signed main() 
{ 
	// generate prime factors of number 
	// upto 10^6 
	generatePrimeFactors(); 

	

	ll n;
	cin>>n;
	ll ans=0;
	for (int i = 1; i <=n; i++) 
		ans+=i*calculateNoOFactors(i); 
cout<<ans<<endl;

	return 0; 
} 


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

void main(void)
{
  int a,b,c,d,t,aoki;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  
  if(c<=b){
    t=1;
  }else{
     t=c/b;
    if(c%b>0){
      t++;
    }
  }
  if(a<=d){
    aoki=1;
  }else{
     aoki=a/d;
    if(a%d>0){
      aoki++;
    }
  }
  
  if(t>aoki){
    printf("No");
  }else{
    printf("Yes");
  }
  //printf("%d %d",t,aoki);
  
  
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define N 105
#define M 100005
#define inf 1000000000
using namespace std;
int i,j,k,l,s,n,m,tot,last[N],S,T,Next[M],to[M],flow[M],q[N],dis[N],a[N];
long long ans;
inline void add(int x,int y,int z) {
	Next[++tot]=last[x]; last[x]=tot; to[tot]=y; flow[tot]=z;
}
inline bool bfs() {
	int l=0,r=1; q[1]=S; 
	for (int i=S;i<=T;i++) dis[i]=inf;
	dis[S]=0;
	while (l<r) {
		int k=q[++l];
		for (int i=last[k];i;i=Next[i]) {
			if (!flow[i]||dis[to[i]]!=inf) continue;
			dis[q[++r]=to[i]]=dis[k]+1;
		}
	}
	return dis[T]!=inf;
}
inline int dfs(int x,int y) {
	if (x==T) return y;
	int sum=0;
	for (int i=last[x];i;i=Next[i]) {
		if (!flow[i]||dis[to[i]]!=dis[x]+1) continue;
		int temp=dfs(to[i],min(y-sum,flow[i]));
		if (temp) {
			sum+=temp;
			flow[i]-=temp;
			flow[i^1]+=temp;
		}
		else dis[to[i]]=inf;
		if (sum==y) return y;
	}
	return sum;
}
inline void dinic() {
	while (bfs()) {
		ans-=dfs(S,inf);
	}
}
int main() {
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	tot=1;
	S=0,T=n+1;
	for (i=1;i<=n;i++) {
		if (a[i]<0) add(i,T,-a[i]),add(T,i,0);
		else add(S,i,a[i]),add(i,S,0),ans+=a[i];
	}
	for (i=1;i<=n;i++) for (j=2;j*i<=n;j++) add(i,i*j,0),add(i*j,i,inf);
	dinic();
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <stdio.h>


int main() {
	int Max = -1000000, Min = 1000000, n, a;
	long long int SUM = 0;
	scanf("%d",&n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		if (Max < a)Max = a;
		if (Min > a)Min = a;
		SUM += a;
	}
	printf("%d %d %lld\n", Min,Max,SUM);
	

	return 0;
}

Measured memory_bytes: 2740
#include <cstdio>

typedef long long ll;

int psum[20][200005];
ll ans;

int main() {
	int N; scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		int x; scanf("%d", &x);
		for (int j = 0; j < 20; j++) {
			psum[j][i] = psum[j][i - 1] + bool(x & (1 << j));
		}
		int l = 0, r = i;
		while (l + 1 < r) {
			int mid = l + r >> 1;
			int flag = 0;
			for (int j = 0; j < 20; j++) {
				flag |= psum[j][i] - psum[j][mid - 1] > 1;
			}
			if (!flag) r = mid;
			else l = mid;
		}
		ans += i - r + 1;
	}
	printf("%lld", ans);
}

Measured memory_bytes: 15744
#include <iostream>
#include <bits/stdc++.h>
#define scan(n)      scanf("%I64d",&n);
#define scan2(a,b)   scanf("%I64d%I64d",&a,&b);
#define scan3(a,b,c) scanf("%I64d%I64d%I64d",&a,&b,&c);
#define sc(n)        scanf("%c",&n);
#define sf(n)        scanf("%lf",&n);
#define ss(n)        scanf("%s",n);
#define forall(i,a,b)for(long long int i=a;i<b;i++)
#define all(a)       a.begin(), a.end()
#define pb           push_back
#define mp           make_pair
#define FAST_IO      ios_base::sync_with_stdio(false); cin.tie(NULL);
#define minimum(a)   *min_element(a.begin(),a.end())
#define maximum(a)   *max_element(a.begin(), a.end())
#define display(a)   for(auto i : a) cout<<i<<" ";
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
using namespace std;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
vector<ll> scanVector(ll n, vector<ll> &v)
{
  ll temp;
  for(ll i = 0; i < n ; i++)
  {
     cin>>temp;
     v.pb(temp);
  }
  return v;
}
ll fun(ll n)
{
    return (n*(n-1))/2;
}
int main() {
    FAST_IO
    ll t;
    //cin>>t;
    t = 1;
    while(t--)
    {
        ll n;
        cin>>n;
        vector<ll> v;
        v=scanVector(n,v);
        map<ll,ll> m;
        for(auto i : v)
        {
            m[i]++;
        }
        ll pdt = 0;
        map<ll,ll> m1;
        for(auto i : m)
        {
            pdt += fun(i.second);
        }
        for(ll i = 0; i < v.size(); i++)
        {
            ll curr = pdt - fun(m[v[i]]) + fun(m[v[i]]-1);
            cout<<curr<<endl;
        }
    }
    return 0;
}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    LL n,k;
    cin>>n>>k;
    LL x=n%k;
    cout<<min(x,k-x);
}


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

vector<ll> pos, neg, zero;


ll count_below(ll x){
    ll ans = 0, p = pos.size(), n = neg.size(), z = zero.size();

    if(x == 0){
        return p*n;
    }
    else if(x < 0){
        x = -x;
        for(ll y : pos){
            ans += n - (upper_bound(neg.begin(), neg.end(), x/y) - neg.begin());
        }

        return ans;
    }
    else{
        ans += p*n + z * (p+n) + z * (z-1)/2;


        for(int i = 1; i<p ; i++){
            ans += upper_bound(pos.begin(), pos.begin()+i, (x-1)/pos[i]) - pos.begin();
        }

        for(int i = 1; i<n ; i++){
            ans += upper_bound(neg.begin(), neg.begin()+i, (x-1)/neg[i]) - neg.begin();
        }

        return ans;
    }
}

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

    int n;
    ll k;
    cin>>n>>k;
    k--;

    for(int i = 0; i<n; i++){
        ll x;
        cin>>x;
        if(x == 0) zero.push_back(x);
        if(x > 0) pos.push_back(x);
        if(x < 0) neg.push_back(-x);
    }

    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());

    ll lo = -1e18, hi = 1e18;

    while(lo <= hi){
        ll mid = (lo + hi) / 2;

        if(count_below(mid) <= k)
            lo = mid + 1;
        else
            hi = mid - 1;
    }

    cout<<hi<<endl;

    return 0;
}
///

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

string s;
void mul(const set<int> &a, const set<int> &b, char op, set<int> &ret){
    for(auto e1:a){
        for(auto e2:b){
            if(op=='+')ret.insert(e1+e2);
            if(op=='-')ret.insert(e1-e2);
            if(op=='*')ret.insert(e1*e2);
            if(op=='/'){
                if(e2==0)continue;
                ret.insert(e1/e2);
            }
        }
    }
}


set<int> dfs(int l, int r){
    vector<int> br(300,-1);
    stack<int> stk;
    for(int i=l;i<r;i++){
        if(s[i]=='(')stk.push(i);
        else if(s[i]==')'){
            br[stk.top()] = i;
            stk.pop();
        }
    }
    while(1){
        if( s[l]=='(' && br[l]==r-1 )l++,r--;
        else break;
    }
    
    set<int> ret;
    int c = 0;
    
    bool ops=true;
    for(int i=l;i<r;i++){
        if(s[i]=='(')c++;
        else if(s[i]==')')c--;
        else if( (s[i]=='+' || s[i]=='-' || s[i]=='*' || s[i]=='/') && c==0 ){
            ops = false;
            mul( dfs(l,i) , dfs(i+1,r), s[i], ret);
        }
    }
    
    if(ops)return set<int>{stoi(s.substr(l,r-l))};
    else return ret;
}


int main(){
    while(cin>>s && s!="#"){
        set<int> res = dfs(0,s.size());
        cout<<res.size()<<endl;
    }
}

Measured memory_bytes: 3224
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; cin >> n; int m; cin >> m;
	int key = (n - m) * 100 + m * 1900;
	int d = pow(2, m);
	cout << key*d << endl;
	return 0;
}

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

int main(void){
    int n, a[100010], kisu=0, gusu=0, ni=0;
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> a[i];
        if(a[i]%2==0){
            if(a[i]%4!=0){
                ++ni;
            }else{
                ++gusu;
            }
        }else{
            ++kisu;
        }
    }
    if((gusu+1)>=(kisu+ni%2)) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
    int N,X;
    int m[1100];
    scanf("%d%d", &N, &X);
    for(int i=0;i<N;i++){
        scanf("%d", &m[i]);
        X-=m[i];
    }
    int min=1000;
    for(int i=0;i<N;i++){
        if(min>m[i]) min=m[i];
    }
    int c=0;
    for(int i=0;X-min>=0;i++){
        X-=min;
        c++;
    }
    printf("%d\n",N+c);
    return 0;
}

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

int main(){
    long long n,ans=0;
    string s;
    cin >> n >> s;
    
    for(int i=0;i<1000;i++){
        string pass = to_string(i);
        if(int(pass.size()) == 1) pass = "00" +pass;
        else if(int(pass.size()) == 2) pass = "0" +pass;
        auto pos1 = s.find(pass[0]);
        if(pos1 == string::npos)continue;
        auto pos2 = s.find(pass[1], pos1+1);
        if(pos2 == string::npos)continue;
        auto pos3 = s.find(pass[2], pos2+1);
        if(pos3 == string::npos)continue;
        ans++;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3748
import numpy
N, K = map(int, input().split())
d = 0
l = list(numpy.zeros(N))

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    
    for j in range(len(A)):
        l[A[j]-1] += 1

print(l.count(0))

Measured memory_bytes: 27140
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define int long long
using namespace std;

signed main() {
	string str;
	cin >> str;
	int size = str.size();
	bool ans = true;
	vector<char> vec;
	if (size % 2 == 1) ans = false;
	map<char, int> letter;
	for (int i = 0; i < size; i++) {
		letter[str[i]]++; vec.push_back(str[i]);
	}
	for (int i = 0;i < letter.size(); i++) {
		if (letter[str[i]] % 2 == 1) ans = false;
	}
	if (ans == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main() {
	int n, k; cin >> n >> k;
	vector<int>a(n); for (int i = 0; i < n; i++) cin >> a[i];
	int cnt = 0; n--; k--;
	while (n > 0) {
		n -= k;
		cnt++;
	}
	cout << cnt << endl;

	return 0;
}

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

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

    vector<double> x(n);
    vector<string> u(n);

    rep(i, n) {
        cin >> x[i];
        cin >> u[i];
    }

    double otoshidama_sum = 0;

    for (int i = 0; i < n; ++i) {
        if (u[i] == "BTC")otoshidama_sum += x[i] * 380000.0;
        else otoshidama_sum += x[i];
    }
    print(otoshidama_sum);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;

int w[1234567],v[1234567];
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
void mins(int &a,int b){
  if(a>MOD)a%=MOD;if(b>MOD)b%=MOD;
  a-=b;if(a<0)a+=MOD;
}
void add(int &a,int b){
  if(a>MOD)a%=MOD;if(b>MOD)b%=MOD;
  a+=b;if(a>=MOD)a-=MOD;
}
int kake(int a,int b){
  if(a>MOD)a%=MOD;
  if(b>MOD)b%=MOD;
  if(a*b>MOD)return a*b%MOD;
  return a*b;
}
int ru(int a){
  if(a>MOD)a%=MOD;
  if(a*a>MOD)return a*a%MOD;
  return a*a;
}

signed main(){
  int n;cin>>n;
  while(n--){
    int a;cin>>a;v[a]++;
  }
  for(int i=1;i<1234567;i++)w[i]=pw(i,MOD-2);
  int wa2=w[2];
  for(int i=1;i<1234567;i++)
    for(int j=i*2;j<1234567;j+=i)
      mins(w[j],w[i]);
  int ans=0;
  for(int i=1;i<1234567;i++){
    int tmp1=0,tmp2=0;
    for(int j=i;j<1234567;j+=i)add(tmp1,kake(j,v[j])),add(tmp2,kake(v[j],ru(j)));
    tmp1*=tmp1;tmp1%=MOD;
    mins(tmp1,tmp2);
    tmp1*=wa2;tmp1%=MOD;
    add(ans,kake(tmp1,w[i]));
  }
  cout<<ans<<endl;
}

/*
解説AC
制約的に倍数ごとの操作でNlogNをしたくなるけど、過不足なく数えるの無理では？みたいな気持ちになる
でも倍数ごとに見てやると言う強い気持ちを持つと、wの存在が見える、かなぁ？
何をやっているのかは理解したけど考察フローはよくわからんな
d|Aの言い換えと和の線型性とかの雑さが良い感じに上手くいっているんだけど
競プロキャンプで橙がみんなのレートを吸い取って赤になった時のやつ（吸い取られた）
*/


Measured memory_bytes: 19584
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int[][] array = new int[3000][2];
        int x, y;
        int counter = 0;
        while(true){
            x = scanner.nextInt();
            y = scanner.nextInt();
            if(x == 0 && y == 0)break;
            array[counter][0] = x;
            array[counter][1] = y;
            counter++;
        }
        for(int i = 0; i < counter; i++){
            if(array[i][0]>array[i][1])
                System.out.println(array[i][1]+" "+array[i][0]);
            else
                System.out.println(array[i][0]+" "+array[i][1]);
        }
    }
}



Measured memory_bytes: 36420
import math
import sys
from operator import itemgetter

# N, K = map(int, input().split())
# h = list(map(int, input().split()))
# S = [input() for _ in range(H)]
# X = [[0 for j in range(100)] for i in range(200)]

# if __name__ == '__main__':


N, K = map(int, input().split())
if ((N+1) // 2 >= K):
	print("YES")
else:
	print("NO")



Measured memory_bytes: 3060
#include<iostream>
#include<bits/stdc++.h>
#include<climits>
#include<math.h>

#define forn(x,n,s) for(int i = x; i < n; i += s )
#define forr(x,n,s) for(int i = x; i>=n; i -= s)
#define PI 3.14159265358979323846264338327950L
#define MOD 1e9+7

using namespace std;

void go(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);

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

int main(){
    go(); 

    // code here
    string s;cin>>s;
    int n = s.length();
    int suf = 0;
    int pow_ten = 1;
    map<int,int> mp;
    forr(n-1,0,1){
        int value = s[i] - '0';
        suf = (suf + value*pow_ten)%2019;
        pow_ten = (pow_ten * 10)%2019;
        mp[suf]++;
    }
    long long ans = 0;
    for(auto node:mp){
        ans += (long long)node.second*(node.second-1)/2;
    }
    ans += mp[0];
    cout<<ans;
    
} 



Measured memory_bytes: 3744