akhauriyash/Code-Regression huggingface dataset:
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 998244353, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll f[ohara], fr[ohara];

ll mod_pow(ll xx, ll nn, ll mod) {
  ll ret = 1;
  while (nn > 0) {
    if (nn & 1) ret = ret * xx % mod;
    xx = xx * xx % mod;
    nn >>= 1;
  }
  return ret;
}

ll ncr(ll nn, ll r) {
  if (nn < r) return 0;
  return f[nn] * fr[r] % MOD * fr[nn - r] % MOD;
}

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

  cin >> n >> m >> k;
  f[0] = 1;
  rrep(i, 1, n + 3) { f[i] = f[i - 1] * i % MOD; }
  fr[n + 2] = mod_pow(f[n + 2], MOD - 2, MOD);
  rrrep(i, n + 1, 0) { fr[i] = fr[i + 1] * (i + 1) % MOD; }
  rrep(x, 0, k + 1) {
    ll kake = ncr(n - 1, n - x - 1);
    kake *= m;
    kake %= MOD;
    kake *= mod_pow(m - 1, n - x - 1, MOD);
    ans += kake;
    ans %= MOD;
    // debug(kake);
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 6748
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);
function main(){
  var n = next();
  var a = nexts(n);
  for(var i = 0; i < n; i++){
    if(a[i] % 2 === 0){
      if(a[i] % 3 !== 0 && a[i] % 5 !== 0)return "DENIED";
    }
  }
  return "APPROVED";
}

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

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    ll X;
    cin >> X;
    vector<ll> A(201, 1), B(401, 1);
    rep(i, 201){
        rep(j, 5) A.at(i)*=i;
    }
    rep(i, 401){
        rep(j, 5) B.at(i)*=(i-200);
    }
    rep(i, 201){
        rep(j, 401){
            if(A.at(i)-B.at(j) == X){
                cout << i << " " << j-200 << endl;
                return;
            }
        }
    }
}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 3644
#include<bits/stdc++.h>
 
#define hell                         1000000007
#define hell2                        998244353
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define all(v)                       v.begin(),v.end()
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(ll i=a;i<b;i++)
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'
 
const ll MAX=500005;
const ll SQN=330;
const ll LG=22;
const double PI=atan(1)*4;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    ll x;
    cin >> x;
    ll cur=100;
    ll ans=0;
    rep(i,1,MAX) {
    	cur=cur*(1.01);
    	if(cur>=x) {
    		ans=i;
    		break;
    	}
    }
    ret(ans);
}

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

public class Main {

	public static void main(String[] args) throws IOException {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

			String inputLine;
			while ((inputLine = br.readLine()) != null) {

				final String[] inputs = inputLine.split(" ");

				final Integer H = Integer.valueOf(inputs[0]);
				final Integer W = Integer.valueOf(inputs[1]);

				if (H.equals(0) && W.equals(0)) {
					break;
				}

				final String[] outputSet = {"#", "."};

				StringBuilder output = new StringBuilder();

				for(int h = 0; h < H; h++) {
					for(int w = 0; w < W; w++) {
						if(h % 2 == 0) {
							output.append(outputSet[w % 2]);
						} else {
							output.append(outputSet[(w + 1) % 2]);
						}
					}
					output.append("\n");
				}
				System.out.println(output);
			}
		}
	}
}


Measured memory_bytes: 25572
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

const int INF = 500000;

int n, m;
vector<int> G[200000];

int dijkstra() {
  vector<int> dp(200000, INF);
  vector<bool> done(200000, false);
  priority_queue<pair<int, int> > Q;
  Q.push({0, 0});
  dp[0] = 0;
  
  while (Q.size()) {
    auto p = Q.top(); Q.pop();
    int v = p.second;
    if (done[v]) continue;
    done[v] = true;
    for (auto u: G[v]) {
      if (dp[v] + 1 >= dp[u]) continue;
      dp[u] = dp[v] + 1;
      Q.push({dp[u] , u});
    }
  }
  
  return dp[n-1];
}

int main() {
  cin >> n >> m;
  loop(i,0,m) {
    int a, b;
    cin >> a >> b; a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  if (dijkstra() <= 2) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 16748
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll h,n;
    cin >> h >> n;
    vector<ll> a(n);
    vector<ll> b(n);

    rep(i,n) cin >> a[i] >> b[i];

    ll dp[10010];
    ll INF = 1e9;
    rep(i,10010){
        dp[i] = INF;
    }
    dp[0] = 0;



    for(int i=0; i<n; i++){
        for(int j=0; j<=h; j++){
            chmin(dp[min(j+a[i],h)], dp[j] + b[i]);
        }
    }
    dunk(dp[h]);
}

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

int main(void){
	int n,k;
	int min;
	int *h;

	cin>>n>>k;
	k--;
	h=new int[n];
	for(int i=0;i<n;i++)cin>>h[i];
	sort(h,h+n);
	min=h[k]-h[0];
	for(int i=1;i<n-k;i++){
		if(min>h[i+k]-h[i])min=h[i+k]-h[i];
	}
	cout<<min<<endl;
	
	return 0;
}


Measured memory_bytes: 640
fun main(args: Array<String>) {
        val input = read()
        println(coins(input))
    }

    fun read(): List<Int> {
        val readed = mutableListOf<Int>()
        readed.add(Integer.parseInt(readLine()))
        readed.add(Integer.parseInt(readLine()))
        readed.add(Integer.parseInt(readLine()))
        readed.add(Integer.parseInt(readLine()))
        return readed
    }

    fun coins(inputs: List<Int>): Int {
        val sums = mutableListOf<Int>()
        (0..inputs[0]).forEach { fiveHundred ->
            (0..inputs[1]).forEach { hundred ->
                (0..inputs[2]).forEach { fifty ->
                    sums.add(fiveHundred * 500 + hundred * 100 + fifty * 50)
                }
            }
        }
        return sums.count { it == inputs[3] }
    }

Measured memory_bytes: 39184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
void factorization(long long n,map<long long ,long long>& mp){
    for(long long i=2;i*i<=n;i++){
        while(n%i==0){
            mp[i]++;
            n /= i;
        }
     }
     if(!(n == 1)) mp[n]++;
}
int main(){
ll n;
cin >>n;
map<ll, ll> mp;
factorization(n, mp);
ll ans = n;
for(auto i:mp){
    ans = ans * (i.first - 1) / i.first;
}
cout << ans << endl;
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision;
// #define int cpp_int
using namespace std;

#define fastio 			ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int 			long long
#define ll 				long long
#define ld 				long double
#define vi 				vector<int>
#define pii 			pair<int,int>
#define vpii 			vector< pair<int,int> >
#define uset			unordered_set
#define umap 			unordered_map
#define maxpq 			priority_queue<int>
#define minpq			priority_queue<int,vi,greater<int>()>

#define all(v) 			v.begin(),v.end()
#define part(v,s,e)		v.begin()+s,v.begin()+e
#define rev(v)			reverse(v.begin(),v.end())
#define sz(x)			(int)x.size()
#define def(v)			memset(v,-1,sizeof(v));
#define def0(v)			memset(v,0,sizeof(v));
#define minv(a)			*min_element(all(a))
#define maxv(a)			*max_element(all(a))
#define sumv(a)			accumulate(all(a),0)

#define	lb				lower_bound
#define	ub				upper_bound
#define	desc			greater<int>()
#define	pb				emplace_back
#define	mp				make_pair
#define	F				first
#define	S				second

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a/(__gcd(a,b)))*b

#define setbits(x) 		__builtin_popcountll(x)
#define zerobits(x)		__builtin_ctzll(x)

#define ip(v)	 		for(auto& i:v)	cin>>i;
#define op(v) 			for(auto i:v)	cout<<i<<" ";cout<<endl;
#define deb(x) 			cout <<"Value of " #x << " : " << x << endl;


void solve()
{	

	int n;
	cin>>n;

	int a[n];
	ip(a);

	ld d=0;

	for(int i=0;i<n;i++)
	{
		d+=(1/(a[i]*1.0));
	}

	cout<<1/d<<endl;

}	

int32_t main()
{

	fastio
	cout<<setprecision(15)<<fixed;

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

	int t=1;
	// cin>>t;
	
	for(int i=1;i<=t;i++)
	{
		// cout<<"Case "<<i<<" : "<<endl;
		solve();
	}
	
	#ifndef ONLINE_JUDGE	
		cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	#endif

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int N, K;
  cin >> N;
  cin >> K;
  int x = 0;
  for (int i = 0; i < N; i++) {
    int h;
    cin >> h;
    if (h + 1 > K) {
      x++;
    }
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    double ans = (double) w * h / 2;
    int num = 0;
    if ((w % 2 == 0 && w/2 == x) && (h % 2 == 0 && h / 2 == y)){
        num = 1;
    }
    printf("%.9lf %d\n", ans, num);
    return 0;
}

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

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll maxn=2e5+1;
const ll INF=4e18;
void solve()
{
	ll N;
	cin>>N;
	string s,t,n;
	cin>>s>>t;
	for(ll i=0;i<N;i++)
	{
		n+=s[i];
		n+=t[i];
	}
	cout<<n<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1,p=0;
	//cin>>T;
	do
	{
		solve();
		p++;
	}while(p<T);
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
int main(){
    char s[16];
    scanf("%s",s);
    int lose=0;
    for(int i=0;s[i]!='\0';i++){
        if(s[i]=='x')lose++;
    }
    printf("%s\n",(lose<8)?"YES":"NO");
    return 0;
}

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

typedef struct BAITO_ {
	int A;
	int B;
} BAITO;

bool baitoSort(const BAITO &x, const BAITO &y) {
	if (x.B > y.B) return true;
	else if (x.B==y.B) return x.A > y.A;
	return false;
}

struct {
	bool work; // 働く日か否か
	int nextday; // 次の働く日の候補
} workday[100002]; // 期日よりx日前に働く


int main(void) {
	int N, M;
	cin >> N >> M;
	vector <BAITO> baito(N);
	for (int i = 0; i < N; i++) {
		cin >> baito[i].A >> baito[i].B;
	}

	sort(baito.begin(), baito.end(), baitoSort);

	for (int i = 0; i <= M; i++) {
		workday[i].work = false;
		workday[i].nextday = i;
	}
	for (int i = M+1; i < 100002; i++) {
		workday[i].work = true;
		workday[i].nextday = i;
	}

	unsigned long long reward = 0;
	for (unsigned int i = 0; i < baito.size(); i++) {
		int A = baito[i].A;
		int B = baito[i].B;

		for (int j = workday[A].nextday; j <= M; j++) {
			if (!workday[j].work) {
				workday[j].work = true;
				workday[A].nextday = j+1;
				reward += B;
				break;
			}
		}
	}
	cout << reward << endl;
	return 0;
}


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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

int main() {
    int H, A;
    cin >> H >> A;
    cout << ceil ((double)H / A) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxN = 110;
int num[maxN];
int main()
{
    int N;
    cin>>N;
    for(int i=1;i<=N;i++)cin>>num[i];
    int sum=0;
    for(int i=1;i<=N;i++)sum+=num[i];
    int p=round((double)sum/N);
    int ans=0;
    for(int i=1;i<=N;i++)ans+=(num[i]-p)*(num[i]-p);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

	class Program
	{
		static void Main(string[] args)
		{
			var N = int.Parse(Console.ReadLine());

			var aNum = N / 500;
			var nokori = N % 500;
			var bNum = nokori / 5;

			Console.WriteLine((aNum * 1000) + (bNum * 5));
		}

	}
}

Measured memory_bytes: 13140
#include <cstdio>

int main(){
    int i, n, k;
    scanf("%d %d",&n,&k);
    int w[n];
    int p = 0;
    int sum = 0;
    for(i=0;i<n;i++){
        scanf("%d",w+i);
        sum += w[i];
    }
    p = sum / k;
    if(sum%k)p++;
    int p_, k_;
    for(;;p++){
        p_ = 0;
        k_ = 0;
        for(i=0;i<n;i++){
            if(w[i]>p)break;
            else if(p_+w[i]<=p)p_+=w[i];
            else{
                p_ = w[i];
                k_++;
            }
            if(k_>=k)break;
        }
        if(i==n)break;
    }
    printf("%d\n",p);
    return 0;
}



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

int main() {
  int A, B, C, D, P, X, Y, Z;
  cin >> A >> B >> C >> D >> P;

	X = A*P;
	  if(P<=C){
	Y = B;
	}
	  else{
	Y = B + D*(P-C);
	}

	if(X>=Y){
	Z = Y;
	}

	else{
	Z = X;
	}

 cout << Z << endl;

return 0;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll N;
  scanf("%lld",&N);
  ll L;
  scanf("%lld",&L);
  vector<string> S(N);
  for(int i = 0 ; i < N ; i++){
    cin >> S[i];
  }
  sort(S.begin(),S.end());
  for (int i=0; i<N; i++) {
    cout<<S[i];
  }
  cout<<endl;;
}

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


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

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

    cin >> A >> B >> C;

    if ((A < C) && (C < B))
    {
        cout << "Yes" << endl;
    }
    else if ((B < C) && (C < A))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    bool flag = false;
    for(int i=n-2;i>=0;i--){
        if(a[i]<=a[i+1]){
            continue;
        }else{
            a[i]--;
            if(a[i]>a[i+1]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
    
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;

int n, m, R, r[10], a[20000], b[20000], c[20000];

ll d[201][201];

void warshall_floyd()
{
    for (int k = 1; k <= n; k++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

int main()
{

    cin >> n >> m >> R;

    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++)
        {
            d[i][j] = i == j ? 0 : 1e18;
        }

    vector<int> v;

    REP(i, R)
    {
        cin >> r[i];
        v.push_back(r[i]);
    }
    REP(i, m)
    {
        cin >> a[i] >> b[i] >> c[i];
        d[a[i]][b[i]] = c[i];
        d[b[i]][a[i]] = c[i];
    }

    warshall_floyd();

    ll res = 1e18;

    SORT(v);

    do
    {
        ll tmp = 0;
        for (int i = 0; i < v.size() - 1; i++)
            tmp += d[v[i]][v[i + 1]];

        res = min(res, tmp);

    } while (next_permutation(v.begin(), v.end()));

    cout << res << endl;

    return 0;
}

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

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	vector<vector<int>> e(n + 1);
	for (int i = 0; i < m; i++)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}

	vector<vector<int>> q(3);
	vector<bool> v(n + 1, false);
	q[0].push_back(1);
	v[1] = true;
	for (int i = 0; i < 2; i++)
		for (int j = 0; j < q[i].size(); j++)
			for (int k = 0; k < e[q[i][j]].size(); k++)
				if (!v[e[q[i][j]][k]])
				{
					v[e[q[i][j]][k]] = true;
					q[i + 1].push_back(e[q[i][j]][k]);
				}
	if (v[n])
		printf("POSSIBLE\n");
	else
		printf("IMPOSSIBLE\n");

	return 0;
}

Measured memory_bytes: 12784
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;

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

    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    map<ll, int> ma;
    ll minv = 1e9;
    rep(i, n){
        minv = min(minv, v[i]);
        ll diff = v[i] - minv;
        if(diff >= 0) ma[diff]++;
    }

    using P = pair<ll, ll>;
    vector<P> ans;
    for(auto p: ma) ans.push_back(p);
    sort(rall(ans));

    cout << ans[0].second << endl;
}

Measured memory_bytes: 9464
/*************************************************************************
    > File Name: A.cpp
    > Author: PumpkinYing
    > Created Time: 2018/11/12 14:52:35
 ************************************************************************/

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define prii pair<int,int>
#define prdd pair<double,double>
#define rep(i,l,r) for(int i = l;i < r;i++)
#define rep_(i,l,r) for(int i = l;i <= r;i++)
typedef long long ll;

const int maxn = 100010;
char s[maxn],t[maxn];

int main() {
	int n,m;
	scanf("%d%d",&m,&n);
	scanf("%s%s",s+1,t+1);
	ll x = __gcd(m,n);
	ll d1 = n/x;
	ll d2 = m/x;
	
	ll lcm = (ll)d1/__gcd(d1,d2)*d2;

	ll ok = 1;
	ll j = 1;
	for(int i = 1;i <= m;i += lcm/d1) {
		if(s[i] != t[j]) ok = 0;
		j += lcm/d2;
	}

	if(ok) printf("%lld\n",(ll)m/__gcd(m,n)*n);
	else printf("-1\n");
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>

#define MAX 100000

int main(void) {
	int n;
	int a[100001] = { 0 };
	int cnt[100001] = { 0 };
	int ans = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (a[i] > MAX) ans++;
		else cnt[a[i]]++;
	}

	for (int i = 1; i <= MAX; i++) {
		if (i < cnt[i])ans += cnt[i] - i;
		else if (i > cnt[i])ans += cnt[i];
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 896
(let* ((n (read))
       (lst (loop :repeat n :collect (read))))
  (if (position 0 lst :test #'=)
      (princ 0)
      (loop :for k :in lst
            :with ans := 1
            :do (setf ans (* ans k))
            :if (not (<= ans (expt 10 18)))
              :do (princ -1) :and :return -1
            :finally (princ ans))))

Measured memory_bytes: 78556
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,n) rep2(i,0,n-1)
int MOD=1000000000+7;
int INF=1e6;
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

string s;

main(){
    cin>>s;
    vector<string> v;
    int t=s.size();
    rep2(i,1,5){
        rep(j,t+1-i){
            v.push_back(s.substr(j,i));
        }
    }
    sort(v.begin(),v.end());
    int k;
    cin>>k;
    int pre=0;
    int count=1;
    
    int pos=1;
    while(count!=k){
        if(v[pre]!=v[pos]){
            count++;
            pre=pos;
            pos++;
            
        }else{
            pos++;
        }
    }
    cout<<v[pre];
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
//26

int dp[20000];
signed main(){
	fill(dp, dp+20000, 1);
	dp[0] = dp[1] = 0;
	repi(i,2,10002){
		if(dp[i] == 1)for(int j = 2;i*j <= 10001;j++){
			dp[i*j] = 0;
		}
	}
	
	while(1){
		int n;
		scanf("%lld", &n);
		if(n == 0)break;
		P p = P(3, 5);
		repi(i,5,n+1){
			if(dp[i] == 1 and dp[i-2] == 1)p = P(i-2, i);
		}
		printf("%lld %lld\n", p.fi, p.se);
	}
	//rep(i,15)printf("%lld %lld\n", i, dp[i]);
	return 0;
}






Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()

long long gcd(long long a,long long b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}
int main(void){
	int N;
	cin >> N;
	vector<long long> A(N);
	for(int i=0;i<N;i++)cin >> A[i];
	sort(ALL(A));
	long long ans = A[0];
	for(int i=1;i<N;i++){
		ans = gcd(ans,A[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
import sys

sys.stdin.readline()
lst = list(map(int, sys.stdin.readline().split()))
N = len(lst)

max_val, max_t = lst[0], 0
min_val, min_t = lst[0], 0

for t in range(1, len(lst)):
    if max_val < lst[t]:
        max_val = lst[t]
        max_t = t
    if min_val > lst[t]:
        min_val = lst[t]
        min_t = t

if max_val >= -min_val:
    print(2 * N - 2)
    for i in range(len(lst)):
        if i == max_t:
            continue
        print(max_t + 1, i + 1)
    for i in range(1, len(lst)):
        print(i, i + 1)
else:
    print(2 * N - 2)
    for i in range(len(lst)):
        if i == min_t:
            continue
        print(min_t + 1, i + 1)
    for i in range(len(lst), 1, -1):
        print(i, i - 1)


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

int N,K;
long long X[200010] = {0};
int main(){
	cin >> N >> K;
	int id = N+1;
	for(int i=1;i<=N;i++){
		cin >> X[i];
		if(X[i]>=0) id = min(id,i);
	}
	long long  ans = 1e18;
/*	for(int i=1;i<=N;i++){
		cout << X[i] << (i!=N? " ":"\n");
	}
*/	if(id+K-1<=N) ans = X[id+K-1];
	if(id-K>=1) ans = abs(X[id-K]);
	for(int i=0;i<K;i++){

		if(id+i<=N && id-(K-i)+1>=1){
			ans = min(ans,2*X[id+i]+abs(X[max(id-(K-i)+1,0)]));
			ans = min(ans,X[id+i]+2*abs(X[max(id-(K-i)+1,0)]));
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

int a, b;

int main(){

    cin >> a >> b;

    if((a*b)%2==0){
        cout << "Even";
        return 0;
    }

    cout << "Odd";

}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int i, j = 0, n;
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			int[] a = new int[n];
			int[] b = new int[n];
			for(i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			for(i = 0; i < n - 1; i++) {
				if(a[i] == a[i + 1]) {
					continue;
				}
				b[j] = a[i];
				j++;
			}
			b[j] = a[n - 1];
			for(i = 0; i < j; i++){
				System.out.print(b[i] + " ");
			}
			System.out.println(b[j]);
		}
	}
}



Measured memory_bytes: 73192
#include<stdio.h>
char line[100];
int X;
int N;
int m[10000];
int min;
int sum=0;
int number=0;
int main(){
fgets(line,sizeof(line),stdin);
sscanf(line,"%d %d",&N,&X);
for (int i=0;i<N;++i){
scanf("%d",&m[i]);
}
min=m[0];
for (int i=0;i<N;++i){
if (min > m[i]) min = m[i];
sum += m[i];
}
number = (X-sum)/min + N;
printf("%d\n",number);
return 0;
}

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

int main(void){
    int n, k;
    string s;
    cin >> n >> k >> s;
    vector<int> to1, to0;
    to1.push_back(0);
    if (s[0] == '0') to0.push_back(0);
    rep(i,n-1) {
        if (s[i]=='0' && s[i+1]=='1') to1.push_back(i+1);
        if (s[i]=='1' && s[i+1]=='0') to0.push_back(i+1);
    }
    if (s.back() == '0') to1.push_back(n);
    to0.push_back(n);

    int m = to1.size();
    if (m <= k) {
        cout << n << endl;
        return 0;
    }
    int mx = 0;
    rep(i,m-k){
        mx = max(mx, to0[i+k] - to1[i]);
    }
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 1020
from itertools import combinations

N = int(input())
L = list(map(int, input().split()))
if len(L) < 3:
    print(0)
    exit()
cnt = 0
for edges in combinations(L, 3):
    if len(set(edges)) == 3:
        edges = list(edges)
        edges.sort()
        a, b, c = edges
        if c < a + b:
            cnt += 1
print(cnt)


Measured memory_bytes: 68468
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
 
const double EPS = 1E-10;
typedef vector<double> vec;
typedef vector<vec> mat;
 
vec gauss_jordan(const mat& A, const vec& b) {
  int n = A.size();
  mat B(n, vec(n+1));
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      B[i][j] = A[i][j];
    }
  }
 
  for(int i=0; i<n; i++) B[i][n] = b[i];
   
  for(int i=0; i<n; i++) {
    int pivot = i;
    for(int j=i; j<n; j++) {
      if(fabs(B[j][i]) > fabs(B[pivot][i])) pivot = j;
    }
    swap(B[i], B[pivot]);
 
    if(fabs(B[i][i]) < EPS) return vec();
     
    for(int j=i+1; j<=n; j++) B[i][j] /= B[i][i];
    for(int j=0; j<n; j++) {
      if(i != j) {
    for(int k=i+1; k<=n; k++) B[j][k] -= B[j][i] * B[i][k];
      }
    }
  }
  vec x(n);
  for(int i=0; i<n; i++) x[i] = B[i][n];
  return x;
}
 
int main() {
  int n;
   
  double x[4], y[4];
   
  cin >> n;
  for(int i=0; i<n; i++) {
    mat A;
    vec a, b;
    for(int j=0; j<4; j++) {
      cin >> x[j] >> y[j];
    }
     
    a.push_back(y[1]-y[0]);
    a.push_back(x[0]-x[1]);
    A.push_back(a);
     
    b.push_back(( y[1]-y[0] ) * x[0] - ( x[1]-x[0] ) * y[0]);
     
    a.clear();
    a.push_back(y[3]-y[2]);
    a.push_back(x[2]-x[3]);
    A.push_back(a);
     
    b.push_back(( y[3]-y[2] ) * x[2] - ( x[3]-x[2] ) * y[2]);
     
     
    vec ans(2);
    ans = gauss_jordan(A, b);
     
    //if(fabs(ans[0]) < EPS) ans[0] = 0.0;
    //if(fabs(ans[1]) < EPS) ans[0] = 0.0;
    printf("%.10lf %.10lf\n", ans[0], ans[1]);
  }
   
  return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;
typedef long double ld;
#define pi 3.14159265358979

int  main()
{
	long n, m; cin >> n >> m;
	long sum = 0;
	if (n*2 <= m)
	{
		m -= (n * 2);
		sum += n;
		sum += m/4;
	}
	else
	{
		if(n >= (m / 2))
		{
			sum += (m/2);
		}
		else
		{
			sum += n;
			m -= (2*n);
			sum += m/4;
		}
	}
	cout << sum << endl;
	return 0;
}

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

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back


int a,d,n;
bool era[10000000]={false};


void makeERA(){
    for(int i=2;i<1000001;i++){
        if(era[i]!=true)continue;
        for(int j=2;;j++){
            if(i*j<=1000000)
                era[i*j]=false;
            else break;
        }
    }
    era[2]=true;
}



int main(){
    rep(i,10000000)era[i]=true;
    era[0]=false;era[1]=false;
    makeERA();
    
    while(cin>>a>>d>>n){
        if(a==0 && d==0 && n==0)break;
        

        int c=0;
        for(int i=0;;i++){
            if(era[a+i*d]){c++;}
            if(c==n){
                cout<<a+i*d<<endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 10924
A = input()
B = input()

if len(A) > len(B):
    print('GREATER')
elif len(A) == len(B):
    for n in range(len(A)):
        if int(A[n]) > int(B[n]):
            print('GREATER')
            break
        if int(A[n]) == int(B[n]):
            continue
        if int(A[n]) < int(B[n]):
            print('LESS')
            break
    else:
        print('EQUAL')
else:
    print('LESS')


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

int main() {
    ll A, B, N; cin >> A >> B >> N;

    ll x = min(N, B - 1);
    cout << (A * x) / B << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N, M;
    cin >> N >> M;
    vector<bool> ok(N + 1, true);
    REP(i, M) {
        int a;
        cin >> a;
        ok[a] = false;
    }
    vector<ll> dp(N + 1);
    dp[0] = 1;
    FOR(i, 1, N + 1) {
        if (!ok[i])
            continue;
        if (ok[i - 1]) {
            dp[i] += dp[i - 1];
            dp[i] %= MOD7;
        }
        if (0 <= i - 2 && ok[i - 2]) {
            dp[i] += dp[i - 2];
            dp[i] %= MOD7;
        }
    }
    print(dp[N]);

    return 0;
}

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



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

using namespace std;

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

  int cnt = 0, ret = 0;

  for(int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if(S == "A") ++cnt;
    else --cnt;
    ret = min(ret, cnt);
  }

  if(ret < 0 || cnt > 0) cout << "NO" << endl;
  else cout << "YES" << endl;

}

Measured memory_bytes: 3096
/**
	������������ Author : Avi J Patel ������������
	������������ University : DA-IICT ������������
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001

#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

/*bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} */
/*void calc()
{
	for(int i=0;i<2005;i++)
	{
		a[i][0]=1;
		a[i][i]=1;
		for(int j=1;j<i;j++)
		{
			a[i][j]=(a[i-1][j-1]+a[i-1][j])%MOD;	
		}
	}
}*/
int main()
{
	int a,b;
	cin>>a>>b;
	cout<<max(a+b,max(a-b,a*b));
	return 0;
}











Measured memory_bytes: 256
def main():
    t = list(input())
    lent = len(t)
    if t[-1] == '?':
        t[-1] = 'D'

    for i1 in range(lent - 2, 0, -1):
        if t[i1] == '?':
            if t[i1+1] == 'D':
                if t[i1-1] == 'P':
                    t[i1] = 'D'
                else:
                    t[i1] = 'P'
            else:
                t[i1] = 'D'
    if t[0] == '?':
        if t[1] == 'D':
            t[0] = 'P'
        else:
            t[0] = 'D'
    r = "".join(t)
    print(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10796
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    for(int n; 0!=(n=readln().chomp().to!int()); )
    {
        auto a=0,b=0;
        foreach(i;1..n+1)
        {
            auto t=i;
            while(t%2==0) t/=2,++a;
            while(t%5==0) t/=5,++b;
        }
        writeln(min(a,b));
    }
}

Measured memory_bytes: 1040
module Main where

import Data.Functor

main :: IO ()
main = do
  { [a,b] <- getInts
  ; let result = hikaku (a,b)
  ; putStrLn result
  }

hikaku :: (Int, Int) -> String
hikaku (x,y)
  | x < y  = "a < b"
  | x == y = "a == b"
  | x > y  = "a > b"

getInts :: IO [Int]
getInts = map read . words <$> getLine

Measured memory_bytes: 3600
import java.util.*;
public class Main{

	public static void main(String[]agrs){
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n == 0 && m == 0) break;
			double[][] list = new double[n][n];
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < n; j++) {
					list[i][j] = sc.nextDouble();
				}
			}
			
			double dp[][] = new double[m][n];
			Arrays.fill(dp[0], 1);
			for(int i = 1; i < m; i++) {
				for(int j = 0; j < n; j++) {
					for(int k = 0; k < n; k++) {
						dp[i][j] = Math.max(dp[i][j], dp[i-1][k] * list[k][j]);
					}
				}
			}
			double max = 0;
			for(int i = 0; i < n; i++) {
				max = Math.max(dp[m-1][i],max);
			}
			
			System.out.printf("%.2f\n",max);
		}
	}
}

Measured memory_bytes: 82512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A+B > C+D)
    cout << "Left";
  else if (A+B < C+D)
    cout << "Right";
  else
    cout << "Balanced";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
int main()
{
    int H,W,h,w;
    scanf("%d%d",&H,&W);
    scanf("%d%d",&h,&w);
    int ans=(H-h)*(W-w);
    printf("%d\n",ans);
}


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

typedef long long ll;

class UnionFind {
public:
	vector<int>Parent;

	UnionFind(int n) {
		Parent = vector<int>(n, -1);
	}

	int root(int a) {
		if (Parent[a] < 0)return a;
		return Parent[a] = root(Parent[a]);
	}

	int size(int a) {
		return -Parent[root(a)];
	}

	bool connect(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b) return false;

		if (size(a) < size(b))swap(a, b);

		Parent[a] += Parent[b];
		Parent[b] = a;

		return true;
	}
};

int main() {
	ll n, m; cin >> n >> m;
	vector<ll>a(m), b(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
	}

	vector<ll>ans(m);
	ans[m - 1] = n * (n - 1) / 2;

	UnionFind Uni(n);
	for (int i = m - 1; i >= 1; i--) {
		ans[i - 1] = ans[i];
		if (Uni.root(a[i]) != Uni.root(b[i])) {
			ans[i - 1] -= (ll)Uni.size(a[i]) * Uni.size(b[i]);
			Uni.connect(a[i], b[i]);
		}
	}

	for (int i = 0; i < m; i++) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 4096
#include <stdio.h>
#define INF 1000000000
 
int prim();
int i, j, n, w[100][100];
 
int main(){
  int a;
 
  scanf(" %d ", &n);
  for(i = 0 ; i < n ; i++){
    for(j = 0 ; j < n ; j++){
      scanf(" %d ", &w[i][j]);
    }
  }
  
  a = prim();
  printf("%d\n",a);
  return 0;
}
 
int prim(){
  int distanse = 0, i, u, v, MinCost, Colour[n], d[n], p[n];
  for( u = 0 ; u < n ; u++ ){
    d[u] = INF;
    p[u] = -1;
    Colour[u] = -1;
  }
 
  d[0]=0;
 
  while(1){
    MinCost = INF;
 
    for( i = 0 ; i < n ; i++){
      if(Colour[i] != 1 && d[i]<MinCost){
      MinCost = d[i];
      u = i;
      }
    }
 
    if(MinCost==INF)
       break;
 
    Colour[u] = 1;
 
    for( v = 0 ; v < n ; v++ ){
      if( Colour[v] != 1 && w[u][v] < d[v] && w[u][v] != -1){
      p[v] = u;
      d[v] = w[u][v];
      }
    }
  }
  
  for( i = 0 ; i < n ; i++ ){
    distanse =  distanse + w[i][p[i]];
  }
  return distanse;
}

Measured memory_bytes: 1876
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
using namespace std;
#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
//typedef vector<int> V;
//typedef vector<VV> VVV;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

struct edge { int to, cost,theef; };
typedef pair<int, int > P;
struct pp { int point, now, money;};

//V頂点数
int V;
vector<edge>G[100000];//max頂点数
int d[105][105];//n,予算

void dijktra(int s,int l) {
	queue<pp> que;
	for (int i = 0; i <V+3; i++) {
		fill(d[i], d[i] + l + 3, 100000000);
	}

	d[s][l] = 0;
	pp ppp = { 0, s, l };
	que.push(ppp);

	while (!que.empty()) {
		pp p = que.front(); que.pop();
		int v = p.now;
		if (d[v][p.money] < p.point)continue;
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to][p.money] > d[v][p.money] + e.theef) {
				d[e.to][p.money] = d[v][p.money] + e.theef;
				ppp = { d[e.to][p.money], e.to,p.money };
				que.push(ppp);
			}
			if ((p.money - e.cost) < 0)continue;
			if (d[e.to][p.money - e.cost] > d[v][p.money]) {
				d[e.to][p.money - e.cost] = d[v][p.money];
				ppp = { d[e.to][p.money - e.cost], e.to,p.money-e.cost };
				que.push(ppp);
			}
		}
	}
}


int main() {
	int n, m, l, a, b, d2, e;
	cin >> n >> m >> l;
	while (n != 0) {
		V = n;//頂点数
		for (int i = 0; i < m; i++) {
			cin >> a >> b >> d2 >> e;
			edge e1 = { b,d2 ,e };
			edge e2 = { a,d2,e };
			G[a].push_back(e1);//aからbへコストcの辺
			G[b].push_back(e2);
		}
		int min = 1000000;
		dijktra(1, l);//頂点aからの最短距離配列生成
		for (int i = 0; i <= l; i++) {
			if (min > d[V][i])min = d[V][i];
		}
		cout << min << endl;
		cin >> n >> m >> l;
		for (int i = 1; i <= V; i++) {
			G[i].clear();
		}
	}
}



Measured memory_bytes: 5640
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s=="SUN")cout << 7 << endl;
  else if(s=="MON")cout << 6 << endl;
  else if(s=="TUE")cout << 5 << endl;
  else if(s=="WED")cout << 4 << endl;
  else if(s=="THU")cout << 3 << endl;
  else if(s=="FRI")cout << 2 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()

using namespace std;

typedef vector<int> vi;
typedef long long  ll;

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

int main()
{
    int a , b;
    cin >> a >> b;
    string x;
    cin >> x;
    int cnt = 0;
    if((int)x.size() != a + b + 1){
        cout <<"No"<<endl;
        return 0;
    }
    for(int i=0;x[i];++i){
        if(isdigit(x[i]) && i != a){
            ++cnt;
        }
    }
    if(x[a] != '-' || cnt != a + b){
        cout<<"No"<<endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n ,a;
  cin >> n;
  vector<int> v(n);
  a = 0;
    
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }

  for (int i = 0; i < n; i++) {
  if (i % 2 == 0 && v.at(i) % 2 == 1) {
   a++;
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 3640
#include<set>  
#include<map> 
#include<stack>
#include<cmath>  
#include<cstdio>  
#include<queue>  
#include<vector>  
#include<climits>  
#include<cstring>  
#include<iostream>  
#include<algorithm>  
using namespace std;
#define eps 1
#define MAXN 1000
#define INF 0x3f3f3f3f  
int read(){  
    int f=1,x=0;  
    char c=getchar();  
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}  
    while('0'<=c&&c<='9') x=x*10+c-'0',c=getchar();  
    return f*x;  
}
int main()  
{
	int a=read(),b=read(),c=read();
	if(a+b>=c)printf("Yes\n");
	else printf("No\n");
    return 0;  
}


Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "limits.h"
#include "bitset"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
using namespace std;

string s;
int p;
bool flag1;
bool flag2;
bool flag3;


int main(){
	cin >> s;
	p = 0;
	flag1 = flag2 = flag3 = false;
	while (true) {
		if (p == s.size()) {
			cout << "YES" << endl;
			return 0;
		}
		if (p + 5 <= s.size()) {
			if (s[p] == 'd'&&s[p + 1] == 'r'&&s[p + 2] == 'e'&&s[p + 3] == 'a'&&s[p + 4] == 'm') {
				flag1 = true;
				flag2 = false;
				flag3 = true;
				p += 5;
			}
			else if (s[p] == 'e'&&s[p + 1] == 'r'&&s[p + 2] == 'a'&&s[p + 3] == 's'&&s[p + 4] == 'e') {
				flag1 = false;
				flag2 = true;
				flag3 = true;
				p += 5;
			}
		}
		if (p + 2 <= s.size()) {
			if (s[p] == 'e'&&s[p + 1] == 'r'&&flag1&&flag3==false) {
			flag1 = false;
			flag3 = true;
			p += 2;
			}
		}
		if(p+1<=s.size()){
			if (s[p] == 'r'&&flag2&&flag3 == false) {
				flag2 = false;
				flag3 = true;
				p++;
			}
		}
		if (flag3 == false) {
			cout << "NO" << endl;
			return 0;
		}
		flag3 = false;
	}
	return 0;
}

Measured memory_bytes: 512
#include<iostream>

using namespace std;

int main(){
	int n;
	cin >>n;
	if(n%4==0){
		cout<<"Yes\n";
		return 0;
	}
	while(n>0){
		n=n-7;
		if(n%4==0){
			break;
		}
	}
	if(n==0){
		cout<<"Yes\n";
	}else{
		while(n>0){
			n=n-4;
		}
		if(n==0){
			cout<<"Yes\n";
		}else{
			cout<<"No\n";
		}
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
using namespace std;
 
int main() {
  ll N, sum = 0;
  cin >> N;
  for(ll i = 1; i <= N; i++) {
    if((i % 3 == 0) || (i % 5 == 0));
    else sum += i;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3632
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    // 番号の取得
    String numStr = sc.next();

    if (numStr.contains("7")) {
	    System.out.println("Yes");
    } else {
	    System.out.println("No");
    }
  }
}

Measured memory_bytes: 35700
using System;

namespace program{

	class workspace{

		static void Main(){
			//int input = int.Parse(Console.ReadLine());
			string[] str = (Console.ReadLine().Split());
			int a = int.Parse(str[0]);
			int b = int.Parse(str[1]);
			int c = int.Parse(str[2]);

			for(int i = 0; i < b; i++){
				if(i*a % b == c){
					Console.Write("YES");
					Environment.Exit(0);
				}
			}
			Console.Write("NO");

		}

	}

}

Measured memory_bytes: 13140