akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
constexpr int MOD = 1e9 + 9;

ll h, w, n;
int cs = 1;

template <typename T>
using matrix = std::vector<std::vector<T>>;

template <typename T>
matrix<T> modmul(const matrix<T> &l, const matrix<T> &r, const long long mod)
{
    matrix<T> ret(l.size(), std::vector<T>(r[0].size()));
    for (int i = 0; i < (int)l.size(); i++)
    {
        for (int k = 0; k < (int)r.size(); k++)
        {
            for (int j = 0; j < (int)r[0].size(); j++)
            {
                ret[i][j] += l[i][k] * r[k][j] % MOD;
                ret[i][j] %= MOD;
            }
        }
    }
    return ret;
}

template <typename T>
std::vector<T> modmul(const matrix<T> &a, const std::vector<T> &x, const long long mod)
{
    const int n = a.size();
    const int m = x.size();
    std::vector<T> ret(n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            ret[i] += a[i][j] * x[j] % MOD;
            ret[i] %= MOD;
        }
    }
    return ret;
}

template <typename T>
matrix<T> eye(const int n)
{
    matrix<T> ret(n, std::vector<T>(n));
    for (int i = 0; i < n; i++)
        ret[i][i] = 1;
    return ret;
}

template <typename T>
matrix<T> modpow(matrix<T> x, long long n, const long long mod)
{
    auto ret = eye<T>(x.size());
    while (n)
    {
        if (n & 1)
            ret = modmul(ret, x, mod);
        x = modmul(x, x, mod);
        n /= 2;
    }
    return ret;
}

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

    while (cin >> w >> h >> n, h || w || n)
    {
        cout << "Case " << cs << ": ";
        cs++;
        bool f = false;
        set<ll> st = {h};
        map<ll, vector<ll>> mp;
        for (int i = 0; i < n; i++)
        {
            ll x, y;
            cin >> y >> x;
            if (x == 1)
                continue;
            st.insert(x);
            y--;
            mp[x].push_back(y);
            if (x == h && y == w)
            {
                f = true;
            }
        }
        if (f)
        {
            cout << 0 << endl;
            continue;
        }
        vector<vector<ll>> id(w, vector<ll>(w, 0));
        for (int i = 0; i < w; i++)
        {
            id[i][i] = 1;
            if (i)
                id[i][i - 1] = 1;
            if (i + 1 < w)
                id[i][i + 1] = 1;
        }
        vector<ll> x(w, 0);
        x[0] = 1;
        ll pre = 1;
        for (auto v : st)
        {
            x = modmul(modpow(id, v - pre, MOD), x, MOD);
            for (auto y : mp[v])
                x[y] = 0;
            pre = v;
        }
        cout << x[w - 1] << endl;
    }
}



Measured memory_bytes: 3200
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
using namespace std;
#define vel vector<long long>
#define vvel vector<vel>
#define int long long
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 1000003;
vel kai(1000007, 1);
vel ink(1000007, 1);
template<typename T>
V<T> uni(V<T> &list) {
	if (list.size() == 0) { return list; }
	sort(list.begin(), list.end());
	V<T> ql(1, list[0]);
	rep(i, list.size() - 1) {
		if (list[i] != list[i + 1]) { ql.push_back(list[i + 1]); }
	}
	return ql;
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; ans %= p; }
	return ans;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, 1000006) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, 1000007) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p;
	return ans;
}
signed main() {
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	string s; cin >> s;
	a--; b--; c--; d--;
	bool fl = true;
	for (int i = b + 1; i < d - 1; i++) {
		if (s[i] == '#' and s[i + 1] == '#') { fl = false; }
	}
	for (int i = a + 1; i < c - 1; i++) {
		if (s[i] == '#' and s[i + 1] == '#') { fl = false; }
	}
	if (c > d) {
		bool fl1 = false;
		for (int i = b; i <= d; i++) {
			if (s[i-1]=='.' and s[i] == '.' and s[i + 1] == '.') { fl1 = true; }
		}
		fl &= fl1;
	}
	if (fl) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct UF {
  vector<Pi> data;
  UF(int n):data(n, Pi(-1, 0)){}
  Pi find(int x) {
    if(data[x].first < 0) return Pi(x, 0);
    Pi p = find(data[x].first);
    data[x].first = p.first;
    data[x].second += p.second;
    return data[x];
  }
  bool same(int a, int b) {
    return find(a).first == find(b).first;
  }
  void unite(int a, int b, int w) {
    int x = find(a).first, y = find(b).first;
    if(x == y) return;
    if(data[x].first > data[y].first) swap(x, y), swap(a, b), w = -w;
    w += data[a].second-data[b].second;
    data[x].first += data[y].first;
    data[y].first = x;
    data[y].second += w;
  }
};

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m;
  cin >> n >> m;
  vint x(n, -1);
  UF uf(n);
  bool flag = true;
  rep(i, m) {
    int l, r, d;
    cin >> l >> r >> d;
    --l, --r;
    if(uf.same(l, r)) {
      Pi p = uf.find(l), q = uf.find(r);
      if(q.second-p.second != d) flag = false;
    } else {
      uf.unite(l, r, d);
    }
  }
  cout << (flag ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
 
    using namespace std;
 
    typedef long long ll;
    typedef long double ld;
 
    typedef pair<int, int> pi;
    typedef pair<ll,ll> pl;

    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<pi> vpi;
    typedef vector<pl> vpl;
    typedef vector<vi> vvi;

 
    #define FOR(i, a, b) for (int i=a; i<(b); i++)
    
    #define sz(x) (int)(x).size()
    #define mp make_pair
    #define pb push_back
    #define f first
    #define s second
    #define lb lower_bound
    #define ub upper_bound
    #define all(x) x.begin(), x.end()
 
    template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
    template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
    
    #define trav(container, it) for(typeof(container.begin()) it=container.begin(); it!=container.end(); it++)
 
    const int MOD = 1000000007;
    const char nl = '\n';
 
    int main() 
    {
        ios_base::sync_with_stdio(0); cin.tie(0);
        string s,t;cin>>s>>t;
        int count=0;
        FOR(i,0,sz(s))
        {
          if(s[i]!=t[i]) count++;
        }
        cout<<count;
    }


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

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;
 
public:
  u64 a;
 
  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int 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 Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,f[ohara],fr[ohara];
ld doua;
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;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    using mint=modint<MOD>;

    cin>>n>>m>>k;

    vector<mint> fa(ohara);
    fa[0]=1;
    rrep(i,1,ohara){
    fa[i]=fa[i-1]*i;
    }
    const auto comb = [&fa](int n,int r) {
        return fa[n]/fa[r]/fa[n-r];
    };

    mint ans1=0;
    rrep(sa,1,m){
        mint cost;
        cost=(m-sa)*n*n;
        ans1+=mint(sa)*cost.value()*comb(n*m-2,k-2);
    }

    mint ans2=0;
    rrep(sa,1,n){
        mint cost;
        cost=(n-sa)*m*m;
        ans2+=mint(sa)*cost.value()*comb(n*m-2,k-2);
    }

    mint ans;
    ans=ans1.value()+ans2.value();
    Cout(ans.value());
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define INF 100000000
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)


int main(){
    string s;
    cin >> s;
    int l=s.length(), cnt=0;
    rep(i, l / 2){
        if(s[i] != s[l - i - 1]) cnt += 1;
    }
    cout << cnt << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  set<int>S;
  for(int i=0;i<N;i++){
  int x;
    cin>>x;
    S.insert(x);
  
  }if(S.size()==N)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
    
  
  return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 
 
   
int main(){
  int n,m;
  cin >> n >>m;
  VI p(m);
  vector<string> s(m);
  rep(i,m)cin >> p.at(i) >> s.at(i);
  map<int ,int> cnt;
  int wrg=0;
  set<int> crt;
  for(int i=1;i<=n;i++){
    cnt[i]=0;
  }
  rep(i,m){
    if(s.at(i)=="AC" && !crt.count(p.at(i))){
      crt.insert(p.at(i));
      wrg+=cnt.at(p.at(i));
    }
    else if(s.at(i)=="WA" && !crt.count(p.at(i))){
    cnt.at(p.at(i))++; 
    }
  }
  int ac=crt.size();
  cout << ac << " " << wrg << endl;
} 
    

Measured memory_bytes: 16176
//list index out of rangeエラー表示用
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep1(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)



int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  rep1(i, n){
    cin >> l[i];
  }
  int ans = 0;
  rep2(i, 0, n-2){
    rep2(j, i+1, n-1){
      rep2(k, j+1, n){
        int a = l[i];
        int b = l[j];
        int c = l[k];
        if(a != b && b != c && c != a && a+b > c && b+c > a && c+a > b){
          ans += 1;
          
        }
       
      }
    }
  }
  cout << ans;

}

Measured memory_bytes: 3568
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static int N;
	static int M;
	static int[][] path;
	static boolean[] visited;
	static int count;
	static int ans;
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		M=sc.nextInt();
		path=new int[N+1][N+1];
		visited=new boolean[N+1];
		Arrays.fill(visited,false);
		for(int i=0;i<M;i++){
			int a=sc.nextInt();
			int b=sc.nextInt();
			path[a][b]=1;
			path[b][a]=1;
		}
		dfs(1);
		System.out.println(ans);
	}
	public static void dfs(int s){
		visited[s]=true;
		count++;
		for(int i=1;i<N+1;i++){
			if(path[s][i]==1 && !visited[i]){
				dfs(i);
			}
		}
		if(count==N)ans++;
		visited[s]=false;
		count--;
	}

}


Measured memory_bytes: 23124
function Main(input) {
	var data = input.split(" ")
	var r1 = parseFloat(data[0])
	var r2 = parseFloat(data[1])
	var r3 = 1 / (1 / r1 + 1 / r2)
	console.log(r3)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
int main(){
  ll n, x;cin>>n>>x;
  ll pre_a;
  ll ans=0;
  for(int i=0;i<n;i++){
    ll a;cin>>a;
    if(i!=0){
      if(pre_a+a>x){
        ans+=a+pre_a-x;
        pre_a=x-pre_a;
      }else{
        pre_a=a;
      }
    }else{
      if(a>x){
        ans+=a-x;
        pre_a=x;
      }else{
      	pre_a=a;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==1)a=14;
		if(b==1)b=14;
		System.out.println(a==b?"Draw":(a>b)?"Alice":"Bob");
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}


Measured memory_bytes: 22868
NandK = input()
NandK = NandK.split(' ')
N = int(NandK[0])
K = int(NandK[1])
ans = []
while (N / K) >= K:
    ans.append(N % K)
    N = int(N / K)
if len(ans) != 0:
    print(len(ans) + 2)
else:
    print(len(ans) + 1)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <tuple>
#include <iomanip>


using namespace std;

typedef long long ll;

const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

int gcd(int a, int b){
	if (b == 0)return a;
	return gcd(b, a % b);
}


int main(void){
	ll people;
	cin >> people;

	vector<ll> v(5);

	for (int i = 0; i < 5; i++){
		cin >> v[i];
	}

	ll smallest = INF;

	for (int i = 0; i < 5; i++){
		smallest = min(smallest, v[i]);
	}

	long double tmp = (long double)people / (long double)smallest;

	ll ans = ceil(tmp) + 4;

	cout << ans << endl;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

vector <vector<ll>> ds = {{1, 0}, {0, 1}};

int main(void){
    ll h; cin >> h;
    ll w; cin >> w;
    vector <string> map;
    REP(_, h){
        string s; cin >> s;
        map.push_back(s);
    }
    vector <vector <ll>> dp(h, vector<ll>(w, 1e9));
    ll cnt = 0;
    queue <vector<ll>> q;
    q.push({0, 0, // h, w
            map[0][0] == '#', //斑点回数
            map[0][0] == '.'  //0なら白
    });

    while(!q.empty()){
        vector <ll> node = q.front();
        q.pop();
        ll r = node[0]; ll c = node[1]; ll dis = node[2]; ll is_white = node[3];
        for(auto d: ds){
            ll nextr = r + d[0];
            ll nextc = c + d[1];
            if ((nextr>h-1) or (nextr < 0)){
                continue;
            }
            if ((nextc>w-1) or (nextc < 0)){
                continue;
            }
            ll next_is_white = map[nextr][nextc] == '.';
            ll nextdis = dis + (is_white ^ next_is_white);
            if (nextdis < dp[nextr][nextc]){
                dp[nextr][nextc] = nextdis;
                q.push({nextr, nextc, nextdis, next_is_white});
            }
        }
    }
    cout << (dp[h-1][w-1]+1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	int p,j;
	int i;
	int pm,jm;
	int sm;
	pm=2000;
	jm=2000;
	for(i=0;i<3;i++){
		scanf("%d",&p);
			if(pm>p){
				pm=p;
			}
	}
	for(i=0;i<2;i++){
		scanf("%d",&j);
			if(jm>j){
				jm=j;
			}
	}
	sm=pm+jm-50;
	printf("%d\n",sm);
	return 0;
}

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;

    vector<ll> a(N);
    rep(i, N)
    {
        cin >> a[i];
    }

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

    ll ans = 1;

    rep(i, N)
    {
        if(log10(ans)+log10(a[i])>18)
        {
            cout << -1 << endl;
            return 0;
        }
        else
        {
            ans*=a[i];
        }

            if(ans>1000000000000000000)
    {
        cout << -1 << endl;
        return 0;
    }
        
    }
        
    if(ans>1000000000000000000)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3996
n = int(input())

A = list(map(int, input().split()))

q = int(input())


for _ in range(q):
    
    b, e, t = map(int, input().split())

    for k in range(e - b):

        A[b + k], A[t + k] = A[t + k], A[b + k]


# OUTPUT
print(*A)



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

signed main()
{
   int N,D; cin>>N>>D;
   vector<int> t(N),F(N);
   REP(i,N){
      cin>>t[i]>>F[i];
      F[i]--;
   }
   if(F[0]>t[0]){
      cout<<-1<<endl;
      return 0;
   }

   int num=1;
   int sum=0;
   for(int i=1;i<N;i++){
      if(F[i-1]+F[i]<=t[i]-t[i-1]){
         sum+=num*F[i-1];
         num=1;
      }
      else{
         if(num<D and abs(F[i]-F[i-1])<=t[i]-t[i-1]){
            sum+=(t[i]-t[i-1])*num;
            num++;
         }
         else{
            cout<<-1<<endl;
            return 0;
         }
      }
   }
   sum+=F[N-1]*num;
   cout<<sum<<endl;
}




Measured memory_bytes: 4424
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#define INF (INT_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int x, y, z;
  cin >> x >> y >> z;

  int ans = (x - z) / (y + z);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
#define PB push_back
#define loop(i,x,y) for(int i=x;i<y;i++)
#define rloop(i,x,y) for(int i=x;i>y;i--)
#define NL cout<<"\n"
#define ans(x) cout<<x<<"\n"
#define out(x) cout<<x<<" "
#define F first
#define S second
#define ansf(x,y) cout<<fixed<<setprecision(y)<<x<<endl;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
void solve()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c>=22) ans("bust");
  else ans("win");
}
signed main()
{
  // FAST;
  int T=1;
  // cin>>T;
  while(T--) solve();
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int N,D,X,ans=0;

int main(){
    cin>>N>>D>>X;
    int A[N];
    rep(i,N){
        cin>>A[i];
        ans+=D/A[i];
        if(D%A[i]>=1)ans++;
    }
    out(ans+X);

}


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
typedef long long LL;

int main() {
  int v[5];
  for (int i = 0; i < 5; ++i) std::cin >> v[i];

  int min_mod = v[0] % 10;
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    sum += v[i];
    int mod = v[i] % 10;
    if (mod != 0) {
      sum += 10 - mod;
      min_mod = std::min(min_mod, mod);
    }
  }

  if (min_mod != 0) {
    sum -= 10 - min_mod;
  }

  std::cout << sum << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main() {
    string s;
    cin >> s;
    
    string ans = "";
    rep(i, s.size()) {
        if (s[i] == '0') ans.push_back('0');
        if (s[i] == '1') ans.push_back('1');
        if (s[i] == 'B') {
            string t;
            rep(j, ans.size() - 1) t.push_back(ans[j]);
            ans = t;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
using namespace std;
#define INF 1000000005
int main()
{
int h, w;
std::cin >> h >> w;
std::vector<std::vector<int>> coin;
std::vector<std::vector<int>> check;
int odd = 0;

for(int i = 0; i < h; i++){
    std::vector<int> tempv;
    std::vector<int> tempc;
    for(int j = 0; j < w; j++){
        int temp;
        std::cin >> temp;
        if(temp % 2 == 1){
            odd++;
        } 
        tempv.push_back(temp);
        tempc.push_back(0);
    }
    coin.push_back(tempv);
    check.push_back(tempc);
}
int sum = 0;
std::vector<std::vector<int>> output;
int flag = 0;
for(int i = 0; i < h; i++){
    if(i != h - 1){
    for(int j = 0; j < w; j++){
        if(coin[i][j] % 2 == 1){
            coin[i + 1][j]++;
            coin[i][j]--; 
            sum++;
            std::vector<int> outv{i + 1,j + 1,i + 2,j + 1};
            output.push_back(outv);
        }
    }
    }else {
       for(int j = 0; j < w - 1; j++){
        if(coin[i][j] % 2 == 1){
            coin[i][j + 1]++;
            coin[i][j]--; 
            sum++;
            std::vector<int> outv{i + 1,j + 1,i + 1,j + 2};
            output.push_back(outv);
        }
    } 
    }
}

std::cout << sum << std::endl;
for(int i = 0; i < output.size(); i++){
    std::cout << output[i][0] << " " << output[i][1] << " " << output[i][2] << " " << output[i][3] << std::endl; 
}

return 0;
}

Measured memory_bytes: 11056
N = int(input())
childs = [[] for _ in range(N)]
parent = [-1 for _ in range(N)]
isleaf = [True for _ in range(N)]
for _ in range(N):
    i, k, *c = map(int, input().split())
    childs[i].extend(c)
    if k != 0:
        isleaf[i] = False
    for child in c:
        parent[child] = i

depth = [0 for _ in range(N)]


def dfs(cur):
    for child in childs[cur]:
        depth[child] = depth[cur] + 1
        dfs(child)


root = 0
while root < N:
    if parent[root] == -1:
        break
    else:
        root += 1
dfs(root)

for i in range(N):
    print('node {}: parent = {}, depth = {}, {}, {}'.format(
        i, parent[i], depth[i],
        'root' if i == root else 'leaf' if isleaf[i] else 'internal node',
        childs[i]))



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

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();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

int main(void){
    int N; cin >> N;
    VI p(N); REP(i,N) cin >> p[i];
    int ans = 0;
    REP(i,N-1){
        if(p[i] == i+1){
            swap(p[i],p[i+1]);
            i++;
            ans++;
        }
    }
    if(p[N-1] == N) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<stdio.h>
#include<string.h>

using namespace std;

char s[222];

int main(){
  cin >> s;
  int n = strlen(s);
  for(int i = n - 2; i >= 0; i -= 2){
    if(strncmp(s, s + i / 2, i / 2) == 0){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		int Q = sc.nextInt();

		boolean b = true; // 今、Sが元の順のときtrue

		StringBuffer head = new StringBuffer();
		StringBuffer tail = new StringBuffer();

		for (int i = 0; i < Q; i++) {
			int T = sc.nextInt();

			if (T == 1) {
				b = !b;

			} else {
				int F = sc.nextInt();
				String c = sc.next();
				if (F == 1) {
					if (b) {
						head.append(c);
					} else {
						tail.append(c);
					}
				} else {
					if (b) {
						tail.append(c);
					} else {
						head.append(c);
					}
				}
			}
		}

		sc.close();
		head.reverse().append(S).append(tail).toString();

		if (b) {
			out.println(head.toString());
		} else {
			out.println(head.reverse().toString());
		}

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 118008
#include <iostream>
#include <stdio.h>

using namespace std;

int main(void){
  int N = 0;
  while(1){
    N++;
    int n;
    cin >> n;
    if(n == 0){return 0;}

    double x[n + 1];
    double y[n + 1];

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

    double S = 0;

    for(int i = 0 ; i < n ; i++){
      S -= (x[i] * y[i + 1] - x[i + 1] * y[i]) / 2.0;
    }

    printf("%d %.1lf\n", N, S);
  }
}

Measured memory_bytes: 3076
#include <stdio.h>
#include <string.h>

int main(void)
{

	long a, b;
	char mark[10];

	scanf("%ld %ld", &a, &b);

	if (a < b) {
		strcpy(mark, "a < b");
	}
	else if (a > b) {
		strcpy(mark, "a > b");
	}
	else {
		strcpy(mark, "a == b");
	}

	printf("%s\n", mark);

	return 0;
}

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

using namespace std;

int main() {
    int n, q, a, b, p, x;

    cin >> n >> q;

    vector<vector<int>> node(n + 1, vector<int>(0, 0));

    for (int i = 0; i < n - 1; i++) {
        cin >> a >> b;
        node[a].push_back(b);
        node[b].push_back(a);
    }

    vector<long> count(n + 1, 0);

    for (int i = 0; i < q; i++) {
        cin >> p >> x;
        count[p] += x;
    }

    map<int, long> target;
    map<int, long> tmp_target;
    tmp_target[1] = 0;
    long result[n + 1] = {};
    vector<bool> checked(n + 1, false);

    while (tmp_target.size() > 0) {
        target = tmp_target;
        tmp_target = {};

        for (auto kv : target) {
            result[kv.first] = count[kv.first] + kv.second;
            checked[kv.first] = true;
            for (int j = 0; j < node[kv.first].size(); j++) {
                if (! checked[node[kv.first][j]]) {
                    tmp_target[node[kv.first][j]] = result[kv.first];
                }
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        cout << result[i] << " ";
    }
}

Measured memory_bytes: 42100
#include <iostream>
#include<utility>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cfloat>
#include<functional>
#include<string>
#include<numeric>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<cctype>
#include<iterator>
#include <stdio.h>
#include <string.h>
#include <sstream>
// #include <bits/stdc++.h>
//#include<conio.h>
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define MEGA_MIND ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define M_PI 3.14159265358979323846
#define mod 1000000007
#define endl "\n"
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;


const ll N = 5e5 + 5, inf = 2e10;

ll weight[102], value[102],mx=0;
vector<vector<ll>>dp(102, vector<ll>(N,inf));
int main()
{
	MEGA_MIND
		int n, w;
	cin >> n >> w;
	for (int i = 1; i <= n; i++)
		cin >> weight[i] >> value[i],mx+= value[i];

	for (int i = 0; i <= n; i++)
	{
		dp[i][0] = 0;
	}
	for (int item = 1; item <= n; item++)
	{
		for (int rem = 1; rem <= mx; rem++)
		{
			ll op1 = dp[item - 1][rem];
			ll op2 = inf;
			if (value[item] <= rem)
			{
				op2 = dp[item - 1][rem - value[item]] + weight[item];
			}
			dp[item][rem] = min(op1, op2);
		}
	}

	ll res = 0;
	for (int i = 1; i <= mx; i++)
	{
		if (dp[n][i]<=w)
		{
			res = i;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 402816
#include <stdio.h>


int main (void){
 
 int n, i , x , min = 999999999, max = -999999999; 
 long total = 0;
 scanf("%d", &n);
 
 for(i = 0; i < n; i++){
    
    scanf("%d", &x);
    if(x < min){ min = x; }
    if(x > max){ max = x; }
    
    total += x;
 }

 printf("%d %d %ld\n", min , max , total);

 return 0;

}

Measured memory_bytes: 600
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
    for(int i = 1; i < 10; i ++){
      for(int j = 1; j < 10; j++){
        //printf("%dx%d=%d\n",i,j,i*j);
        cout << i << "x" <<  j << "=" << i*j << endl;
      }
    }
  return 0;
}


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

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC093_B();
        }

        static void ABC093_B()
        {
            var ABK = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            var A = ABK[0];
            var B = ABK[1];
            var K = ABK[2];

            if (B - A+1 >= 2 * K)
            {
                for (var i = 0; i < K; i++)
                    Console.WriteLine(A + i);

                for (var i = K-1; i >= 0; i--)
                    Console.WriteLine(B - i);
            }
            else
            {
                for (var i = A; i <= B; i++)
                    Console.WriteLine(i);
            }
        }
    }
}

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

int main() {
	int N;
	static int A[200000];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	bool check = true;
	int count = -1;
	for (int i = 0; i < N; i++) {
		if (count + 1 < A[i]) check = false;
		if (A[i] == 0) count = 0;
		else count = min(count + 1, A[i]);
	}
	if (!check) cout << -1;
	else {
		long long ans = 0, now = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] == now + 1) ans++, now++;
			else ans += A[i], now = A[i];
		}
		cout << ans;
	}
}

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

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

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	int N; cin >> N;
	V<ll> A(N),B(N);
	V<P<ll,int>> C(N);
	REP(i,N) cin >> A[i] >> B[i];
	REP(i,N) C[i] = {A[i]+B[i],i};
	sort(ALL(C),greater<P<ll,int>>());
	ll t=0,a = 0;
	REP(i,N){
		if(i%2==0){
			t += A[C[i].second];
		}
		else{
			a += B[C[i].second];
		}
	}
	cout << t - a << endl;
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int inf=1e9+7;
const ll longinf=1LL<<60;
const ll mod=1e9+7;

vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    rep(i,n){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
    k%=mod-1;
    if(k<0)k+=mod-1;
    ll ret=1;
    while(k){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return ret;
}

int main(){
    int N;
    cin >> N;
    vector<ll> A(N+1);
    vector<ll> X(N);
    rep(i,N){
        cin >> A[i];
    }
    ll sum = accumulate(A.begin(), A.end(), 0LL);
    A[N] = A[0];
    ll sumDam  = 0;
    for(int i=1;i<N-1;i+=2){
        sumDam+=2*A[i];
    }
    X[0] = sum - sumDam;
    REP(i,1,N){
        X[i] = 2* A[i-1] - X[i-1];
    }
    rep(i,N){
        cout<<X[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 2944
# -*- coding: utf-8 -*-

W, a, b = map(int, input().split())

if a < b:
    if b - (a + W) > 0:
        print(b - (a + W))
    else:
        print(0)

elif a > b:
    if a - (b + W) > 0:
        print(a - (b + W))
    else:
        print(0)

elif a == b:
    print(0)

Measured memory_bytes: 3060
#include <cstdio>

const int MOD=1000000007;

int sr;
int sum(int a, int b){
	sr=a+b;
	if(sr>=MOD)	sr-=MOD;
	return sr;
}

int mul(int a, int b){
	return (int)((1LL*a*b)%(long long)(MOD));
}

int N, M;

int Tr1_[3][3]={{2, 1, 1}, {2, 1, 2}, {1, 0, 1}};
int Tr2_[3][3]={{1, 1, 1}, {0, 1, 2}, {0, 0, 1}};

struct Mat{
	int x[3][3];
} Zero, One, Tr1, Tr2, Ans;

Mat operator * (const Mat &A, const Mat &B){
	Mat ret=Zero;
	for(int i=0;i<3;++i)
		for(int j=0;j<3;++j)
			for(int k=0;k<3;++k)
				ret.x[i][k]=sum(ret.x[i][k], mul(A.x[i][j], B.x[j][k]));
	return ret;
}

Mat operator ^ (const Mat &A, int k){
	Mat ret=One, t=A;
	while(k){
		if(k&1)	ret=ret*t;
		t=t*t;
		k>>=1;
	}
	return ret;
}

int main(){
	
	for(int i=0;i<3;++i){
		One.x[i][i]=1;
		for(int j=0;j<3;++j){
			Tr1.x[i][j]=Tr1_[i][j];
			Tr2.x[i][j]=Tr2_[i][j];
		}
	}
	
	scanf("%d%d", &N, &M);
	Ans=One;
	int p=0;
	for(int i=1, a;i<=M;++i){
		scanf("%d", &a);
		Ans=Ans*(Tr1^(a-p-1));
		Ans=Ans*Tr2;
		p=a;
	}
	Ans=Ans*(Tr1^(N-p));
	printf("%d\n", Ans.x[0][2]);
	
	return 0;
}

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

int main() {
    int n, m;
    while (cin >> n >> m, n) {
        vector<int> cnt(11);
        while (n--) {
            int d, p; cin >> d >> p; cnt[p] += d;
        }
        for (int p = 10; p >= 0; p--) {
            int sub = min(m, cnt[p]);
            m -= sub, cnt[p] -= sub;
        }
        int ans = 0;
        for (int p = 0; p < 11; p++) ans += p * cnt[p];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 2960
n,m = map(int,input().split())
cnt = 0
a = list(map(int,input().split()))
num = sum(a) / (4*m)
for i in range(n):
    if a[i] < num:
        pass
    else:
        cnt += 1
if cnt >= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <math.h>
#define REP0(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REP1(i,n) for((i)=1;(i)<=(int)(n);(i)++)
#define ll long long
using namespace std;

ll i,j,k;
const ll MOD = 1000000000 + 7;

int main(){
    string s,t;
    ll ans=0;
    cin>>s>>t;
    REP0(i,s.size()){
        if(s[i]!=t[i]){
            ans++;
        }
    }


    cout<<ans<<'\n';
    
    
    return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF INT_MAX
#define MOD 100000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int A,B;
  cin>>A>>B;
  int ans=0;
  if(A>=13)ans=B;
  else if(A>=6)ans=B/2;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
     int a[3];
     int i;
     for(i=0;i<=2;i++)
      {
      	scanf("%d",&a[i]);
      }
      int b=0,c=0;
      for(i=0;i<=2;i++)
       {
       	 if(a[i]==5)
       	 b+=1;
       	 else if(a[i]==7)
       	 c+=1;
       }
      if(c=1&&b==2)
       printf("YES\n");
      else printf("NO\n");
      return 0;
}

Measured memory_bytes: 256
//OM
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <sstream>
#include <algorithm>
using  namespace  std;

#define  x first
#define  y second
#define  pb push_back
#define  mp make_pair
#define  PI (acos(-1.0))
#define  mem(a,b) memset(a,b,sizeof(a))
#define  Sort(x) sort(x.begin(),x.end())
#define  FOR(i, b, e) for(int i = b; i <= (int)(e); i++)
#define  FORR(i, b, e) for(int i = b; i >=(int)(e); i--)
#define  FORI(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define  pr(x) cout<<x<<"\n"
#define  prs(x) cout<<x<<" "
#define  pr2(x,y) cout<<x<<" "<<y<<"\n"
#define  pr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define  ppr(a) cout<<a.x<<" "<<a.y<<"\n"

typedef  long long ll;
typedef  pair <int, int> pii;
typedef  pair <double , double> pdd;
typedef  vector <int> vi;
typedef  vector <pii> vpii;

//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};
//int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction

#define  EPS 1e-9
#define  MAX 100007

vector<int>edge[2005];
int color[2005],v,k,cnt=0;
void DFS_visit(int u,int level=0)
{
    color[u]=1;
    if(level>k/2)cnt++;
    for(int i=0;i<edge[u].size();++i)
    {
        v=edge[u][i];
        if(color[v]==0)
        {
            DFS_visit(v,level+1);
        }
    }
}
int main()
{
    int T,n;
    int nodes,edges,source,n1,n2;
    scanf("%d%d",&n,&k);
    edges=n-1;
    vpii ed;
    for(int i=0;i<edges;++i)
    {
        scanf("%d%d",&n1,&n2);
        ed.pb(mp(n1,n2));
        edge[n1].push_back(n2);
        edge[n2].push_back(n1);
    }
    if(k%2==0)
    {
        int mn=n+1;
        FOR(i,1,n)
        {
            mem(color,0);
            cnt=0;
            DFS_visit(i);
            mn=min(mn,cnt);

        }
        printf("%d",mn);
    }
    else
    {
        int mn=n+1;
        FOR(i,0,(int)ed.size()-1)
        {
            mem(color,0);
            cnt=0;
            color[ed[i].y]=1;
            DFS_visit(ed[i].x);
            color[ed[i].y]=0;
            color[ed[i].x]=1;
            DFS_visit(ed[i].y);
            mn=min(mn,cnt);
        }
        printf("%d",mn);
    }
    return 0;
}



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

using namespace std;

typedef long long ll;

int main() {
    int N; cin>>N;
    vector<int> dn;
    for (int i=0;i<N;i++){
        int d; cin>>d;
        dn.push_back(d);
    }
    sort(dn.begin(), dn.end());

    cout << dn[N/2]-dn[N/2-1] << endl;

    return 0;
}

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

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

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define nl cout<<'\n'
#define pb push_back
#define all(s) s.begin(),s.end()
#define bs binary_search

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

const int Mod=1e9+7;
#define sum(a,b) (((a)%Mod)+((b)%Mod))%Mod
#define sub(a,b) (((a)%Mod)-((b)%Mod))%Mod
#define mul(a,b) (((a)%Mod)*((b)%Mod))%Mod
#define digit(x) floor((log10(x))+1)


#define count1(x) __builtin_popcount(x)

#define dbg(x) cout << #x <<":"<<x<<endl;

bool isPowerOfTwo (int x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
} 

ll pow(ll x, ll y, ll mod)
{
	int ans=1;
	while(y)
	{
		if(y&1)
			ans=(ans*x)%mod;
		y/=2;
		x=(x*x)%mod;
	}
	return ans;
}

int main()
{
	fast;
	ull n,i,sum;
	cin >> n;
	sum=0;
	for(i=1;i<=n;i++)
	{
		if(i%3==0 || i%5==0)
			continue;
		else
			sum+=i;
	}
	cout << sum << endl;
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <functional>
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	ll ans = 0;
	vector<ll>a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (i && a[i] < a[i - 1])
		{
			ans += a[i - 1] - a[i];
			a[i] = a[i - 1];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4764
// I'm a f*cking looser
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
#define fasino ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

// int rec_knapsack(vector<pair<int,int>> we, int weight, int n){
//     if(n==0 || weight==0) return 0;
//     if(we[n-1].first<=weight)
//         return max(we[n-1].second+rec_knapsack(we,weight-we[n-1].first,n-1),rec_knapsack(we,weight,n-1));
//     return rec_knapsack(we,weight,n-1);
// }

int dp[101][100001];
int we[101],val[101];

int memo_knapsack(int weight,int n){
    if(n < 0 || weight <=0) return 0;
    int& st = dp[n][weight];
    if(st!=-1) return st;
    st = numeric_limits<int>::min();
    if(we[n-1]<=weight)
        st=max(val[n-1]+memo_knapsack(weight-we[n-1],n-1),st);
    st = max(st,memo_knapsack(weight,n-1));
    return st;
} 

signed main()
{
    fasino
    int n,w;
    cin >> n >> w;
    for(int i=0;i<n;i++) cin>>we[i]>>val[i];
    // int profit = rec_knapsack(we,w,n);
    memset(dp,-1,sizeof dp);
    int prof = memo_knapsack(w,n);
    cout<<prof<<'\n';
    return 0;
}

Measured memory_bytes: 79232
c = [[int(i) for i in input().split()] for j in range(3)]
f1 = c[1][0]-c[0][0]+c[0][1]==c[1][1]
f2 = c[2][0]-c[0][0]+c[0][1]==c[2][1]
f3 = c[1][0]-c[0][0]+c[0][2]==c[1][2]
f4 = c[2][0]-c[0][0]+c[0][2]==c[2][2]
if all([f1,f2,f3,f4]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl '\n'
int M = 1e9 + 7;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, x;
  cin >> n >> m >> x;
  vector<vector<int>> v;
  for (int i = 0; i < n; ++i)
  {
    vector<int> temp;
    for (int j = 0; j < m + 1; ++j)
    {
      int x;
      cin >> x;
      temp.push_back(x);
    }
    v.push_back(temp);
  }
  queue<pair<int, vector<int>>> q;
  for (int i = 0; i < n; ++i)
  {
    q.push({i, v[i]});
  }
  int mini = 1e18;
  while (!q.empty())
  {
    auto it = q.front();
    q.pop();
    int check = it.first;
    vector<int> p = it.second;
    int cnt = 0;
    for (int i = 1; i < m + 1; ++i)
    {
      if (p[i] >= x)
        cnt++;
    }
    if (cnt == m)
    {
      mini = min(mini, p[0]);
      continue;
    }
    if (check == n - 1)
    {
      continue;
    }
    for (int i = check + 1; i < n; ++i)
    {
      vector<int> c = p;
      for (int j = 0; j < m + 1; ++j)
      {
        c[j] += v[i][j];
      }
      q.push({i, c});
    }
  }
  if (mini == 1e18)
    cout << "-1";
  else
    cout << mini;

}

Measured memory_bytes: 3796
from collections import defaultdict
from itertools import combinations

N = int(input())
S = [input()[0] for _ in range(N)]
dic_S = defaultdict(int)
for s in S:
  if s in "MARCH":
    dic_S[s] += 1

ans = 0
for a, b, c in combinations(dic_S.values(), 3):
  ans += a*b*c
  
print(ans)  
  


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

using namespace std;

typedef long long ll;

ll MOD = 1e9 + 7;

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

	ll N;
	cin >> N;

	string S;
	cin >> S;

	vector<int> T(2 * N);
	for(int i = 0; i < 2 * N; i++){
		T[i] = (S[i] == 'B' ? 1 : 0);
		if(i % 2 == 0) T[i] = 1 - T[i];
	}

	ll cnt = 0LL;
	rep(i, 2 * N) cnt += T[i];
	if(cnt != N){
		cout << 0 << endl;
		return 0;
	}

	ll ans = 1LL;
	ll t = 0LL;
	rep(i, 2 * N){
		if(T[i] == 0){
			t++;
		}else{
			ans *= t;
			ans %= MOD;
			t--;
		}
	}

	for(ll i = 1LL; i <= N; i++){
		ans *= i;
		ans %= MOD;
	}

	cout << ans << endl;

}


Measured memory_bytes: 1428