akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ii pair<int, int>
#define iii tuple<int, int, int>
#define iiii tuple<int, int, int, int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define fi first
#define se second
#define eb emplace_back

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int M = 1e9 + 7;

int fpow(int x, int y) {
    int res = 1;
    while (y) {
        if (y & 1) res = (1LL * res * x) % M;
        y >>= 1;
        x = (1LL * x * x) % M;
    }
    return res;
}

void solve() {
    int n;
    cin >> n;
    vi a(n);
    for (auto& i : a) cin >> i;

    int N = 1e6 + 1;
    vi chk(N);
    vvi fact(N);
    for (int i = 2; i < N; ++i) {
        if (!chk[i]) {
            int j = i;
            while (j < N) {
                chk[j] = 1;
                fact[j].eb(i);
                j += i;
            }
        }
    }

    chk.assign(N, 0);
    for (auto& i : a) {
        for (auto& fi : fact[i]) {
            int cnt = 0, j = i;
            while (j % fi == 0) {
                j /= fi;
                cnt++;
            }
            chk[fi] = max(chk[fi], cnt);
        }
    }

    // for (int i = 2; i < N; ++i)
    //     if (chk[i]) cout << i << ' ' << chk[i] << '\n';

    int x = 1;
    for (int i = 2; i < N; ++i)
        if (chk[i]) x = (1LL * x * fpow(i, chk[i])) % M;
    int res = 0;
    for (auto& i : a) res = (res + (1LL * x * fpow(i, M - 2)) % M) % M;
    cout << res << '\n';
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // freopen("in", "r", stdin);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}

Measured memory_bytes: 59648
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
  ll W,H;cin>>W>>H;
  ll x,y;cin>>x>>y;
  double ans=0;
  ans=W*H*1.0/2;
  cout<<ans<<" ";
  if(2*x==W and 2*y==H) cout<<1<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int h, m, s;
	int second;
	scanf("%d",&second);
	h = second / 3600;
	second = second % 3600;
	m = second / 60;
	s = second % 60;
	printf("%d:%d:%d\n",h,m,s);
}

Measured memory_bytes: 1840
import numpy as np

h, w = map(int, input().split())

ar = [["."] * w for i in range(h)]

for i in range(h):
    st = input()
    for j, s in enumerate(st):
        ar[i][j] = s

for i in range(h):
    for j in range(w):
        if ar[i][j] == ".":
            sum = 0
            for ii in range(3):
                for jj in range(3):
                    if i+ii >h or j + jj > w:
                        continue
                    elif (i == 0 and ii ==0) or(j ==0 and jj==0):
                        continue
                    
                    if ar[i + ii-1][j + jj-1] == "#":
                        sum += 1
            ar[i][j] = str(sum)



for i in ar:
    print("".join(i))
            
            
                


Measured memory_bytes: 12396
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N, T;
    cin >> N >> T;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    
    int ans = 0;
    rep(i, N - 1){
        ans += min(T, A[i + 1] - A[i]);
    }
    ans += T;
    output(ans);
    
    return 0;
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<int, int> P;

int main(){
    ll n, s;
    cin >> n >> s;
    vector<ll> divisor;

    if(n == s) {
        cout << s + 1 << endl;
        return 0;
    }

    ll tmp = n - s;
    REPN(i, 1, sqrt(tmp) + 1) if(tmp % i == 0) {
        divisor.push_back(i);
        divisor.push_back(tmp / i);
    }

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

    REP(i, divisor.size()) {
        ll tmp1 = divisor[i]+1, tmp2 = n, sum = 0;
        while(tmp2 > 0) {
            sum += tmp2 % tmp1;
            tmp2 /= tmp1;
        }

        if(sum == s) {
            cout << tmp1 << endl;
            return 0;
        }
    }

    cout << "-1" << endl;

    return 0;
}

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

#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const ld eps = 1e-9;
const db PI = atan(1) * 4;

template<typename T, typename S>inline bool upmin(T&a, const S&b) { return a > b ? a = b, 1 : 0; }
template<typename T, typename S>inline bool upmax(T&a, const S&b) { return a < b ? a = b, 1 : 0; }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }
namespace SOLVE {
	VI id;
	
	int find_id(int a) {
		if (id[a] == a) {
			return a;
		}
		id[a] = find_id(id[a]);
		return id[a];
	}

	void unite(int a, int b) {
		id[find_id(a)] = find_id(b);
	}

	void main() {
		int n, m, a, b, c;
		cin >> n >> m;
		id.resize(n + 5);
		REP(i, 1, n + 1) {
			id[i] = i;
		}

		REP(i, 0, m) {
			cin >> a >> b >> c;
			unite(a, b);
		}

		set<int> ans;
		REP(i, 1, n + 1) {
			ans.insert(find_id(i));
		}
		cout << ans.size();
	}
}


signed main() {

	int t;
	//    in(t);
	t = 1;
	while (t--) {
		SOLVE::main();

	}

	return 0;
}


Measured memory_bytes: 5376
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

N = int(input())
s = 0
ans = set()
for i in range(1,N+1):
    s += i
    ans.add(i)
    if s == N:
        break
    if s > N:
        ans.remove(s - N)
        break
for a in ans:
    print(a)




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

using namespace std;

int main(){
  int n;
  string s;
  cin >> n >> s;
  if(n % 2 == 0 && s.substr(0, n/2) == s.substr(n/2, n/2)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main() {
  string s;
  std::cin >> s;

  int minv = 1000;
  for (int i = 0; i < s.size() - 2; ++i) {
    minv = min(minv, abs(stoi(s.substr(i, 3)) - 753));
  }

  std::cout << minv << std::endl;
  return 0;
}


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

const int B = 30;

void getAC() {	
	ios_base :: sync_with_stdio(false); cin.tie(0);
	char c; cin >> c;
	c += 1;
	cout << c << endl;



}
 
int main() {	
	getAC();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;

ll dp[2010][2010];

int main(){
ll N,M; cin >> N >> M;
  vector<ll> S(N); vector<ll> T(M);
  for(ll i = 0; i < N; i++){ cin >> S[i];}
    for(ll j = 0; j < M; j++){cin >> T[j];}
  
 for(ll i  =0; i < 2010; i++){
   for(ll j = 0; j < 2010; j++){
     dp[i][j] = 0;}}
  
   dp[0][0] = 1;
  
  for(ll i = 0; i <= N; i++){
    for(ll j = 0; j <= M; j++){
      if( i - 1 >= 0 && j - 1 >= 0 && S[i-1] == T[j-1]){ dp[i][j] += dp[i-1][j-1];}
      if( i-1 >= 0){ dp[i][j] += dp[i-1][j]; }
      if( j-1 >= 0){ dp[i][j] += dp[i][j-1]; }
      if( i - 1 >= 0 && j - 1 >= 0){ dp[i][j] -= dp[i-1][j-1];}
      dp[i][j] = (MOD + dp[i][j]) % MOD;
    }}
 
  cout << dp[N][M] << endl; return 0;}

Measured memory_bytes: 31872
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int a, b;
	for (; cin >> a >> b;)
	{
		cout << ::to_string(a + b).length() << endl;
	}
}


Measured memory_bytes: 3216
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Read();
            var n = s.Count();

            for (int i = 0; i < n; i+=2)
            {
                Write(s[i]);
            }
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数
        
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

    }
}


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

int main(){
  string T;
  cin >>T;
  for(int i = 0;i<T.size();i++){
    if(T.at(i)=='?'){
      T.at(i)='D';
    }
    
  }
  cout<<T<<endl;
}

Measured memory_bytes: 3756
#include<iostream>
#include<set>
using namespace std;
int main(){
	int x;
	set<int> box;
	for(int i=1;i<=30;i++)
	box.insert(i);
	for(int i=0;i<28;i++){
		cin>>x;
		box.erase(x);
	}
	set<int>::iterator ite=box.begin();
	cout<<*ite<<endl;
	ite++;
	cout<<*ite<<endl;
	return 0;
}

Measured memory_bytes: 0
// Problem : B - String Palindrome
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("-1");exit(0);}

	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int MM=5e6+10;
	ll fac[MM],facinv[MM],Inv[MM];ll Comb(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
		facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}

	const int N=1e6+10;
	//------------------FIXED------------------
	
	void main()
	{
		string a;cin>>a;int n=sz(a);string aa=a;reverse(all(aa));
		string b=a.substr(0, (n-1)/2 ),bb=b;reverse(all(bb));
		string c=a.substr((n+3)/2-1, n-(n+3)/2+1 ),cc=c;reverse(all(cc));
		if(a==aa and b==bb and c==cc) puts("Yes"); else puts("No");
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	// freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::main();
	//debug("\n------------------------------------------\nTime: %.2lf s\n",1.0*clock()/CLOCKS_PER_SEC);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
    int n,j=0,m=0,h=0;
    ll a[100005];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    sort(a,a+n);
    for(int i=0;i<n;i+=h)
    {
        h=0;
        j=i;
        while(a[i]==a[j])
        {
            h++;
            j++;
        };
        if(h%2==1)
            m++;
    }
    printf("%d\n",m);
    return 0;
}


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

int main(void){
    
    for(int i = 0 ; i < 301 ; i++){
        int h = 0;
        int w = 0;
        
        cin >> h >> w;
        
        if( (h == 0) && (w == 0)){
            break;
        }
        for(int j = 0 ; j < h ; j++){
            for(int k = 0 ; k < w ; k++){
                if( (j == 0) || (j == (h - 1)) || (k == 0) || (k == (w -1)) ){
                    cout << '#';
                }else{
                    cout << '.';
                }
            }
            cout << endl;
        }        
        cout << endl;
    }
    
    return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL d,t,s;cin>>d>>t>>s;
    if(t*s >= d){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
    
	return;
}

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

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

typedef long long ll;

int n;
ll ans;
bool flg[12];
string s;

void calc() {
  vector<string> v;
  int idx = 0;
  string tmp;

  while (true) {
    if (idx > 0 && flg[idx - 1]) {
      v.push_back(tmp);
      tmp = "";
    }
    
    if (idx == n) {
      break;
    }
    tmp += s[idx];
    idx++;
  }

  for (int i = 0; i < v.size(); i++) {
    ans += atoll(v[i].c_str());
  }
}

void dfs(int idx) {
  if (idx == n - 1) {
    calc();
    return;
  }

  flg[idx] = true;
  dfs(idx + 1);
  flg[idx] = false;
  dfs(idx + 1);
}

int main() {
  while (cin >> s) {
    n = s.size();
    ans = 0;
    memset(flg, 0, sizeof(flg));
    flg[n - 1] = true;
    dfs(0);
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>                
using namespace std;
int s;
int number, i, arr[1000000];
int main(void){
	cin >> s;
	number = s;
	i = 1;

	while(1){
    if(arr[number]) break;
		else arr[number]++;

		if(number % 2)number = 3 * number + 1;
		else number /= 2;

		++i; 	
	}
	cout << i << endl;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 



int main(){
    int A,B;
    cin >> A >> B;
    int ans=0;
    int num_A=0,num_B=0;
    bool exist=false;
    for(int i=0;i<=10000;++i){
        num_A=floor(i*0.08);
        num_B=floor(i*0.1);
        if(num_A==A && num_B==B){
            ans=i;
            exist=true;
            break;
        }
    }
    if(exist){
    cout << ans;
    }
    else{
        cout << -1;
    }
    } 


Measured memory_bytes: 256
// Pana2020 C
// 2020.3.14 bal4u

#include <stdio.h>

typedef long long ll;

int main()
{
	ll a, b, c;
	int ans;

	scanf("%lld%lld%lld", &a, &b, &c);
	ans = 0;
	c -= (a+b);
	if (c > 0) {
		c = c*c;
//		printf("a*b=%lld, c=%lld, %lld\n", a*b, c, c/4);
		if (a*b < c/4) ans = 1;
		else if (a*b == c/4 && c%4) ans = 1;
	}
	puts(ans? "Yes": "No");
	return 0;
}


Measured memory_bytes: 128
a,b,c,x,y = map(int,input().split())
res = 10**10
for i in range(0,2*max(x,y)+1,2):
    if x-i//2<0:
        na=0
    else:
        na=x-i//2
    if y-i//2<0:
        nb=0
    else:
        nb=y-i//2
    cost = a*na+b*nb+c*i
    if cost < res:
        res = cost
    else:
        break
print(res)

Measured memory_bytes: 3064
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int D[K];
    rep(i, K) {
        cin >> D[i];
    }
    for (int i = N; i <= 100000; i++) {
        int flag = 0;
        string tmp = std::to_string(i);
        rep(k, tmp.length()) {
            rep(j, K) {
                //cout << tmp[k] - '0' << " " << D[j] << endl;
                if (tmp[k] - '0' == D[j]) {
                    flag = 1;
                    break;
                }
            }
            if (flag == 1) break;
        }
        if (flag == 0) {
            cout << i << endl;
            return 0;
        }
    }


    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int cnt = 0;
  int ans = 0;
  bool start = false;
  int idx = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'A' && !start) {
      start = true;
      idx = i;
    }
    if (s[i] == 'Z' && start) {
      ans = max(ans, i - idx + 1);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 720
#include <stdio.h>

int f(int N){
  int ret = 0;
  for(int i = 0; i < 10; i++){
    ret += N%10;
    N /= 10;
  }
  return ret;
}

int main(){
  int N;
  scanf("%d", &N);
  if(N%f(N) == 0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline
from heapq import heappush,heappop

n,m=map(int,input().split())
l=[]
for i in range(m):
    p,y=map(int,input().split())
    heappush(l,[p,y,i])
ans=[0]*m
k=l[0][0]
i=1
for _ in range(m):
    L=heappop(l)
    if L[0]!=k:
        i=1
        k=L[0]
    ans[L[2]]=str(L[0]).rjust(6,'0')+str(i).rjust(6,'0')
    i+=1
print(*ans,sep='\n')

Measured memory_bytes: 24076
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#if defined(_MSC_VER)
#pragma warning(disable : 4996)  // VSでscanfを使う．
#endif

signed main() {
  int n;
  cin >> n;
  vector<int> a(n);

  int cnt = 0;

  for (int i = 0; i < n; i++) {
    cin >> a[i];

    if (a[i] != i + 1) {
      cnt++;
    }
  }

  if (cnt <= 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>











char s[8];



void solve()
{
	cin>>s;
	if((s[0]==s[1]&&s[0]==s[2])||(s[1]==s[2]&&s[1]==s[3]))cout<<"Yes\n";
	else cout<<"No\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

class union_find {
public:
	union_find(int n)
		: par_(n, -1)
	{}
	void init(int n) {
		par_.assign(n, -1);
	}

	int root(int x) {
		return par_[x] < 0 ? x : par_[x] = root(par_[x]);
	}

	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) {
			return false;
		}
		else {
			if (par_[x] < par_[y]) {
				par_[x] += par_[y];
				par_[y] = x;
			}
			else {
				par_[y] += par_[x];
				par_[x] = y;
			}
			return true;
		}
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	int size(int x) {
		return -par_[root(x)];
	}

private:
	std::vector<int> par_;
};

struct Kruskal {
	ll cost, from, to;
	bool operator<(const Kruskal& another) const {
		return cost < another.cost;
	}
};

int main() {
	ll n;
	ll x, y;
	ll cos;
	ll sum = 0;
	vector<pair<ll, ll>> v1;
	vector<pair<ll, ll>> v2;
	vector<Kruskal> vv;

	cin >> n;

	union_find uf(n);

	REP(i, n) {
		cin >> x >> y;

		v1.push_back({ x, i });
		v2.push_back({ y, i });
	}

	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());

	REP(i, n - 1) {
		//FOR(j, i, n) {
			//cos = min(abs(v[i].first - v[j].first), abs(v[i].second - v[j].second));
		cos = v1[i + 1].first - v1[i].first;
		Kruskal kru1 = { cos, v1[i].second, v1[i+1].second };
		vv.push_back(kru1);

		cos = v2[i + 1].first - v2[i].first;
		Kruskal kru2 = { cos, v2[i].second, v2[i + 1].second };
		vv.push_back(kru2);
		//}
	}

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

	REP(i, vv.size()) {
		if (uf.same(vv[i].from, vv[i].to) == false) {
			uf.unite(vv[i].from, vv[i].to);
			sum += vv[i].cost;
		}
	}

	cout << sum << endl;
}

Measured memory_bytes: 13536
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
//    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector <int> A(n,0);
    vector <int> B(n+1,0);
    for(int i=0;i<n;i++){
        cin >> A[i];
        B[A[i]]++;
    }
    int sum=0;
    for(int i=0;i<n+1;i++){
        sum+=(B[i]*(B[i]-1))/2;
    }
    vector<int> C(n,0);
    for(int i=0;i<n;i++){
        C[i]=sum-B[A[i]]*(B[A[i]]-1)/2+(B[A[i]]-1)*(B[A[i]]-2)/2;
        cout << C[i] << endl;
    }
    return 0;
}

//    sort(A, A + N, greater<int>()); 降順

Measured memory_bytes: 7296
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
#a = []
#b = []

result = [True] * n

for i in range(m):
    aa, bb = list(map(int, input().split()))
    if h[aa-1] == h[bb-1]:
        result[bb-1] = False
        result[aa-1] = False
    elif h[aa-1] > h[bb-1]:
        result[bb-1] = False
    else:
        result[aa-1] = False

#print(result)
s = 0
for i in range(n):
    if result[i]:
        s += 1
print(s) 

Measured memory_bytes: 20128
#include <iostream>
#include<cmath>
#include<set>
#include<cstdio>
#include<algorithm>
#include<utility>
#include<queue>
#include<vector>
#include<cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x7fffffff;
const double pi = acos(-1.0);

int main() {
	int a, b, c, x, y;
	int ans;
	scanf("%d%d", &x, &y);
	a = x - y;
	b = x + y;
	c = x * y;
	ans = max(a, max(b, c));
	printf("%d", ans);
	return 0;
}


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



int main(){
  string N;
  cin>>N;
  int date=(N[0]-48)*100000;
  date+=(N[1]-48)*10000;
  date+=(N[2]-48)*1000;
  date+=(N[3]-48)*100;
  date+=(N[5]-48)*10;
  date+=(N[6]-48)*1;
  if (date>=201905){
	  cout<<"TBD"<<endl;
  }else{
    cout<<"Heisei"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
void sort(int *x, int left, int right){
  int pivot,left_hold,right_hold;
  left_hold = left;
  right_hold = right;
  pivot = x[left];
  while(left < right){
    while((x[right]>=pivot)&&(left<right))
      right--;
    if(left!=right){
      x[left] = x[right];
      left++;
    }
    while((x[left]<=pivot)&&(left<right))
      left++;
    if(left!=right){
      x[right]=x[left];
      right--;
    }
  }
  x[left] = pivot;
  pivot = left;
  left = left_hold;
  right = right_hold;
  if(left<pivot)
    sort(x,left,pivot-1);
  if(right>pivot)
    sort(x,pivot+1,right);
}

main(){
  int A,B,K,i,C,D;
  scanf("%d%d%d",&A,&B,&K);
  for(i=0; i<K; i++){
    if(i%2==0){
      if(A%2!=0)
        A--;
      B += A/2;
      A /= 2;
    }else{
      if(B%2!=0)
        B--;
      A += B/2;
      B /= 2;
    }
  }
  printf("%d %d\n",A,B);
}

Measured memory_bytes: 128
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        c: i32,
        b: [i32; m],
    };

    let mut count = 0;
    for _ in 0..n {
        input! {
            a: [i32; m],
        };

        let a: Vec<i32> = a;

        let mut sum: i32 = 0;
        for (ai, bi) in a.iter().zip(b.iter()) {
            sum += ai * bi;
        }
        sum += c;

        if sum > 0 {
            count += 1;
        }
    }

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


Measured memory_bytes: 2152
import java.util.*;

class Main {
    int N, P, Q;
    boolean P_OK = false, Q_OK = false;
    int P_Num = 0, Q_Num = 0;

    public Main(){
        Scanner SC = new Scanner(System.in);

        N = SC.nextInt();

        P = Q = 0;
        for(int i=0;i<N;i++){
            P *= 10;
            P += SC.nextInt();
        }
        for(int i=0;i<N;i++){
            Q *= 10;
            Q += SC.nextInt();
        }

        permutation();

        System.out.println(Math.abs(Q_Num-P_Num));
    }

    void permutation(){
        int seed[] = new int[N];
        boolean[] used = new boolean[N];

        for(int i=0;i<N;i++) seed[i] = i+1;

        buildPerm(seed, 0, used, 0);
    }

    void buildPerm(int[] seed, int perm, boolean[] used, int index){
        if(P_OK && Q_OK) return;

        if(index == N){
            if(!P_OK){
                if(P > perm)
                    P_Num++;
                else
                    P_OK = true;
            }
            if(!Q_OK){
                if(Q > perm)
                    Q_Num++;
                else
                    Q_OK = true;
            }
            return;
        }

        perm *= 10;
        for(int i=0;i<N;i++){
            if(used[i]) continue;
            used[i] = true;
            buildPerm(seed, perm + seed[i], used, index+1);
            used[i] = false;
        }
    }

    public static void main(String[] args){
        Main m = new Main();
    }
}


Measured memory_bytes: 23380
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n,i,sum;
        String str;
        while(true) {
        	sum=0;
        	str=scan.next();
        	n=str.length();
        	for(i=0;i<n;i++) {
        		sum+=Character.getNumericValue(str.charAt(i));
        	}
        	if(sum==0) {
        		break;
        	}
        	else {
        		System.out.println(sum);
        	}
        }
    }
}


Measured memory_bytes: 26400
#include<iostream>
#include<cstdio>
#include<climits>
using namespace std;

#define N 130
int n;

int g[N][N];

int weight[N];
bool us[N];

//prim
void prim(){

  int v;
 
  weight[0]=0;
  
  while(true){
    v=-1;
   
    for(int i=0;i<n;i++){
      if(us[i]!=true && (v==-1 ||weight[i]<weight[v]))v=i;
    }

    if(v==-1)break;
    us[v]=true;
 

    for(int i=0;i<n;i++){
      if(weight[i]>(g[v][i]+weight[v])){

        weight[i]=(g[v][i]+weight[v]);
        //      cout <<"fsafa"<<endl;
      }
    }
  }
 
}


int main(){

  int u,k1,c,v;

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      g[i][j]=9953535;
    }
  }

  //load n
  cin >>n;

  //load data
  for(int i=0;i<n;i++){
    weight[i]=INT_MAX;
    us[i]=false;
    scanf("%d %d",&u,&k1);
    for(int j=0;j<k1;j++){
      scanf("%d %d",&v,&c);
      g[u][v]=c;
      //    cout <<g[i][j]<<" ";
    }
    //    cout <<endl;
  }




  //print
  prim();

  for(int i=0;i<n;i++){
    cout <<i<<" "<<weight[i]<<endl;
  }
  return 0;

}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define pb push_back
#define all(c) c.begin(), c.end()

const int MAX_N=5000;

// win[i]にjが含まれるならiはjに勝った
// win[i]にjが含まれるならiはjに負けた
vector<int> win[MAX_N+1];
vector<int> lose[MAX_N+1];

vector<int> ord;
int used[MAX_N+1]={0};

// vがordに追加される時点で，
// vから到達可能な全ての頂点，すなわち，vより順位が低いチームは，必ずordに追加されている
void tsort(int v){
    used[v]=true;
    for(int i=0; i<win[v].size(); i++){
        if(!used[win[v][i]]) tsort(win[v][i]);
    }
    ord.pb(v);
}

int main(){
    int n,m;cin>>n>>m;
    while(m--){
        //頂点w(winner), l(loser)を入力
        int w,l;cin>>w>>l;
        // win[w]にlを含める
        // lose[l]にwを含める
        win[w].pb(l);
        lose[l].pb(w);
    }
    // この時点では誰が1位か分からないので，
    // 誰かに勝っていれば，自分を1位としてトポロジカルソートを行う
    for(int i=1; i<=n; i++)
        if(!lose[i].size()) tsort(i);

    // "他のソート結果が存在する"フラグ
    bool exi=0;
    for(int i=1; i<n; i++){
        // "i位のチームにi+1位のチームが勝った"という情報が与えられているか？
        bool ok=find(all(win[ord[i]]), ord[i-1])==win[ord[i]].end();
        exi|=ok;
    }
    // 順位を出力
    for(int i=0; i<ord.size(); i++){
        cout<<ord[n-i-1]<<endl;
    }
    // 存在するかどうかを出力
    cout<<exi<<endl;
}

Measured memory_bytes: 2952
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

void solve(){
    int n;
    cin >> n;

    ll ans = 0;
    for(int i = 1; i <= n; ++i){
        ans += (n-1)/i;
    }

    cout << ans << "\n";
}

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

Measured memory_bytes: 3648
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{s:chars};
    let mut v = vec![];
    let u = vec!['K','I','H','B','R'];

    for i in 1..s.len() {
        if s[i] == 'I' && s[i-1] != 'K' {
            println!("NO");
            return ();
        }
        if s[i] == 'H' && s[i-1] != 'I' {
            println!("NO");
            return ();
        }
        if s[i] == 'A' && s[i-1] == 'A' {
            println!("NO");
            return ();
        }
    }

    for i in 0..s.len() {
        if s[i] != 'A' {
            v.push(s[i]);
        }
    }

    //debug!(v);
    //debug!(u);

    if v.len() != u.len() {
        println!("NO");
        return ();
    }

    for i in 0..v.len() {
        if v[i] != u[i] {
            println!("NO");
            return ();
        }
    }

    println!("YES");

}

Measured memory_bytes: 4352
#include <iostream>
using namespace std;
long n, s=1, M=1e9+7, a[1001];
int main() {
    int i,j,k;
	cin>>n;
	for(i=2;i<=n;i++){
	    k=i;
	    for(j=2;k>1;){
	        if(k%j==0) a[j]++,k/=j;
	        else j++;
	    }
	}
	for(auto x:a)s = s*(x+1)%M;
	cout<<s;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    rep(i, 0, m){
        cin >> a[i];
        sum += a[i];
    }
    if(n < sum){
        cout << -1 << endl;
    }
    else{
        cout << n - sum << endl;
    }
    return 0;
}


Measured memory_bytes: 7216
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s[i])
	}

	var m int
	fmt.Scan(&m)
	t := make([]string, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&t[i])
	}

	u := make(map[string]int, n+m)
	for _, v := range s {
		u[v]++
	}
	for _, v := range t {
		u[v]--
	}

	max := 0
	for _, v := range u {
		if max < v {
			max = v
		}
	}

	fmt.Println(max)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define INF (1e17)
#define N 305
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P2;

ll n, A[N][N], ans[N][N];
priority_queue<P2,vector<P2>,greater<P2> > q;

int main(){

  cin>>n;

  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++){
      
      cin>>A[i][j];
      
      if(i>j&&A[i][j]) q.push(P2(A[i][j],P(i,j)));
      
    }
  
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++){
      
      ans[i][j]=INF;

      if(i==j) ans[i][j]=0;
      
    }
  
  
  ll anscost=0;

  while(!q.empty()){

    P2 t=q.top(); q.pop();

    ll cost=t.first;

    int a=t.second.first, b=t.second.second;
    
    if(ans[a][b]<cost){
      
      anscost=-1;

      break;
      
    }

    if(ans[a][b]==cost) continue;

    ans[a][b]=ans[b][a]=cost;

    anscost+=cost;
    
    for(int i=0;i<n;i++){

      for(int j=0;j<n;j++){

	ll ncost=min(ans[i][a]+cost+ans[b][j],ans[i][b]+cost+ans[a][j]);
	
	ans[i][j]=ans[j][i]=min(ans[i][j],ncost);
	
      }
	
    }
    
  }

  
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++) 
      if(A[i][j]!=ans[i][j]) anscost=-1;
  
  cout<<anscost<<endl;
  
  return 0;
}


Measured memory_bytes: 2296
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <iomanip>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[4] = {-1, 0, 1, 0};
ll dy[4] = {0, 1, 0, -1};

int main(void){
    ll n;
    cin >> n;
    ll p[n];
    for(ll i = 0; i < n; i++)
        cin >> p[i];
    ll ans = 0;
    for(ll i = 1; i < n-1; i++){
        ll MAX = p[i-1];
        ll MIN = p[i-1];
        MAX = max(MAX, p[i]); MAX = max(MAX, p[i+1]);
        MIN = min(MIN, p[i]); MIN = min(MIN, p[i+1]);
        if(MAX != p[i] && MIN != p[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
    v=list(input().split())
    for j in range(len(v)):
        v[j]=int(v[j])
    x=2
    for k in range(v[1]):
        a[i][v[x+k]-1]=1
for i in range(n):
    for j in range(n):
        if j!=n-1:
            print(a[i][j],end=" ")
        else:
            print(a[i][j])



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

int main() {
    int N,A,B;

    cin>>B>>A;

    double aaa=0;
    double bbb=0;

    while(0.08*aaa<B){
        aaa++;
    }

    while(0.08*bbb<B+1){
        bbb++;
    }
    
    if(aaa<=10*A&&bbb-1>=10*A){
        cout<< 10*A <<endl;
    }else if(10*A<=aaa&&aaa<=10*A+9){
        cout << aaa << endl;
    }else{
        cout << -1 << endl;
    }

}

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

typedef long long int ll;

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

    ll in = stoi(n);
    ll t = 0;
    for(ll i = 0;i < n.size();i++){
        t += n[i] - '0';
    }

    if(in % t == 0){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	//int ans=0;
	cin >>n;
	string x;
	cin>>x;
	int pop=0;
	VV mod(n+1,V(3,0LL));
	VP ans(n+1,mp(0LL,0LL));
	//ll sum=0LL;
	V init(3);
	rep(i,n){
		if(x[i]=='1'){
			pop++;
		}
	}
//	clog<<"pop "<<pop<<endl;
	for(int i=0;i<=2;i++){
	
		if(i==1){
			continue;
		}
		if(i==0 and pop==1){continue;}
		for(int s=n-1;s>=0;s--){
			if(s==n-1){
				mod[s][i]=1LL%(pop+i-1);
			}else{
				mod[s][i] =mod[s+1][i]*2LL;
				mod[s][i] %=  (pop + i - 1);
			}
		
		}
	}
//	clog<<"init"<<endl;
	for(int i=0;i<n;i++){
		if (x[i] == '1') // >------------
		{
			init[0] += mod[i][0];//少ない方 1
			if(pop!=1){
			init[0] %= (pop - 1);
			}
			init[2] += mod[i][2];//多い方0
			init[2] %= (pop + 1);
		}
		else
		{
			//init[2] += mod[2][i];
			//init[2] %= (pop + 1);
		}
	}
//	clog<<"init0: "<<init[0]<<"   init 1 "<<init[2]<<endl;
	for (int i = 0; i < n; i++)
	{
		if (x[i] == '0')
		{
			ans[i].F=init[2]+mod[i][2];
			ans[i].F%=(pop+1);
			ans[i].S=1LL;
		}
		else
		{
			if(pop==1){
				ans[i].F=0LL;
				ans[i].S=0LL;
			}else{
				ans[i].F=init[0]-mod[i][0]+pop-1;
				ans[i].F%=(pop-1);
				ans[i].S=1LL;
			}
		}
	}
	for(int i=0;i<n;i++){
		while(ans[i].F!=0){
			ans[i].S++;
			ans[i].F = ans[i].F % __builtin_popcount(ans[i].F);
		}
	}
	rep(i,n){
		cout<<ans[i].S<<endl;
	}
}
/*
fin: s= 2^n-1
2^n mod pop
*/


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> C(N);
  vector<int> S(N);
  vector<int> F(N);

  for(int i=1; i<=N-1; i++) {
    cin >> C.at(i) >> S.at(i) >> F.at(i);
  }

  vector<int> time(N+1, 0);
  time[N] = 0;
  for(int i=1; i<=N-1; i++) {
    for(int j=i; j<=N-1; j++) {
      if(time[i] < S[j]) {
        time[i] = S[j];
      } else if(time[i]%F[j] != 0) {
        time[i] += (F[j] - time[i]%F[j]);
      }
      time[i] += C[j];
    }
    cout << time[i] << endl;
  }
  cout << time[N] << endl;

  return 0;
}

Measured memory_bytes: 256
S = input()
N = len(S)

ans = "Yes"
ind1 = int((N-1)/2)
ind2 = int((N+3)/2)
for i in range(N):
    if S[i] != S[N-i-1] or S[0] != S[ind1-1] or S[ind2-1] != S[N-1]:
        ans = "No"

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
 #include<iostream>
using namespace std;
const int mod=1e9+7;
const int MAX=200005;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin>>n;
	map<string,int>s;
	int maxn=0;
	for(int i=0;i<n;i++)
	{
		string ss;
		cin>>ss;
			s[ss]++;
			maxn=max(maxn,s[ss]); 
	}
	map<string,int>::iterator it = s.begin();
	while(it != s.end())
	{
		if(it->second==maxn)
		cout<<it->first<<'\n';
		it++;
	}
	

}


Measured memory_bytes: 23936
n = int(input())
nums = list(map(int, input().split()))
count = 0


while True:
    flag = 0

    for j in range(n - 1):
        if (nums[j + 1] < nums[j]):
            temp = nums[j]
            nums[j] = nums[j + 1]
            nums[j + 1] = temp
            count += 1
            flag = 1

    if flag != 1:
        break

print(' '.join([str(i) for i in nums]))
print(count)



Measured memory_bytes: 5608