akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;

const long long TIME_LIMIT=10000;

ll scorecalc(vector<vector<ll>> a, vector<ll> los, ll d, vector<ll> an)
{
    ll ans = 0;
    
    vector<ll> last(los.size(), 0);
    for (int i = 0; i < an.size(); i++)
    {
        ll loss = 0;
        for (int j = 0; j < 26; j++)
        {
            if (j == an[i] - 1)
                continue;

            loss += los[j] * (d - last[j]);
        }
        ans += a[i][an[i] - 1] - loss;
        last[an[i] - 1] = i + 1;
    }

    return ans;
}

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

    ll d;
    cin >> d;
    vector<ll> c(26);
    rep(i, 26)
    {
        cin >> c[i];
    }
    vector<vector<ll>> s(d, vector<ll>(26));
    rep(i, d)
    {
        rep(j, 26)
            cin >> s[i][j];
    }

    vector<ll> ans(d);

    vector<ll> last(26, 0);

    for (ll i = 0; i < d; i++)
    {
        ll lost = 0;
        for (int j = 0;j < 26; j++)
        {
            lost += c[j] * (i + 1 - last[j]);
        }
        ll man = s[i][0]-lost+c[0]*(i+1-last[0]);
        ll manu = 1;
        for (int j = 0; j < 26; j++)
        {
            if (man <= s[i][j]-lost+c[j]*(i+1-last[j]))
            {
                man = s[i][j] - lost + c[j] * (i + 1 - last[j]);
                manu = j + 1LL;
                last[j] = i + 1;
            }
        }
        ans[i] = manu;
    }
    ll score = scorecalc(s, c, d, ans);
    ll times = 0;
    while (times < 10000)
    {
        vector<ll> tmpD(1000);
        rep(j, 1000)
        {
            tmpD[j] = (ll)rand() % d;
        }
        vector<ll> tmpN(1000);
        rep(j, 1000)
        {
            tmpN[j] = ans[tmpD[j]];
            ans[tmpD[j]] = (ll)rand() % 26 + 1;
        }

        if (score >= scorecalc(s, c, d, ans))
            rep(j, 1000)
            ans[tmpD[j]] = tmpN[j];
        else
            score = scorecalc(s, c, d, ans);

        times++;
    }

    rep(i, d)
    {
        cout << ans[i] << endl;
    }

	return 0;

}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline int read() {
    int x = 0, fh = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')
            fh = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = (x << 1) + (x << 3) + c - '0';
        c = getchar();
    }
    return x * fh;
}
int n, k, i, a[11];
bool check(int x) {
	int i;
	while (x) {
		for (i = 1; i <= k; i++) if (x % 10 == a[i]) return 0;
		x /= 10;
	}
	return 1;
}
int main() {
	n = read(); k = read();
	for (i = 1; i <= k; i++) a[i] = read();
	for (i = n; ; i++) if (check(i)) { cout << i << '\n'; break; }
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
#define rSORT(a, i) sort(all(a),(i))

using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;
constexpr int MAX = 2000200;
constexpr double EPS = 1E-11;

using namespace std;

int main() {
	int a, b; cin >> a >> b;

	if (a >= 10 || b >= 10) {
		cout << "-1" << endl;
	}
	else {
		cout << a * b << endl;
	}
}




Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    unsigned long long a;cin>>a;
    string bs;cin>>bs;
    cout<<a*stoll(string{bs[0],bs[2],bs[3]})/100<<endl;
}


Measured memory_bytes: 3596
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
else:
    count = 1
    flag = True
    for i in range(N):
        count = count * A[i]
        if count > 10 ** 18:
            print(-1)
            flag = False
            break
    if flag:
        print(count)

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

#define ld long double
#define ll long long int
#define ull unsigned long long int

using namespace std;

int main() {

    int X;
    cin >> X;
    int max;

    // X以下のべき乗数を求める -> X以下の最大のべき乗数を求める
    for (int b = 1; b <= 32; ++b) {
        for (int p = 2; p <= 10; ++p) {
            int pow = std::pow(b, p);
            if (pow > X) { break; }
            if (max < pow && pow <= X) {
                max = pow;
            }
        }
    }
    cout << max << endl;

}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	int a[10];
	for (int i = 0; i < 10; i++){
		scanf("%d", &a[i]);
	}
	sort(a, a + 10);
	printf("%d\n", a[9]);
	printf("%d\n", a[8]);
	printf("%d\n", a[7]);
	return 0;
}

Measured memory_bytes: 1044
n = int(input())
mod = 10**9 + 7
# memo[len][c1][c2][c3]
dp = [[[[0, 0, 0, 0] for k in range(4)] for j in range(4)] for i in range(n+1)]

# ACGT => 0123とする。
# 長さ0の文字数は1である。
# 0,1,2に関する制約しかないので文字列sは333sと考えても良い。
dp[0][3][3][3] = 1

for len in range(n):
    for c1 in range(4):
        for c2 in range(4):
            for c3 in range(4):
                if dp[len][c1][c2][c3] == 0:
                    continue
                for add in range(4):
                    if c1 == 1 and c2 == 0 and add == 2:
                        continue
                    elif c1 == 0 and c2 == 1 and add == 2:
                        continue
                    elif c1 == 2 and c2 == 0 and add == 1:
                        continue
                    elif c1 == 1 and c3 == 0 and add == 2:
                        continue
                    elif c2 == 1 and c3 == 0 and add == 2:
                        continue
                    dp[len+1][add][c1][c2] += dp[len][c1][c2][c3]
                    dp[len+1][add][c1][c2] %= mod
    ans = 0
    for c1 in range(4):
        for c2 in range(4):
            for c3 in range(4):
                ans += dp[n][c1][c2][c3]
                ans %= mod

print(ans)


Measured memory_bytes: 3312
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h> /*限界*/

#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)

//abc 160 B

int main(void)
{
  long long N;
  long long happy = 0;
  scanf("%lld", &N);
  if (N >= 500) {
    happy += (N/500)*1000;
    N %= 500;
  }
  if (N>= 5) {
    happy += (N/5)*5;
  }
  printf("%lld\n", happy);
  return 0;
}


Measured memory_bytes: 128
from collections import Counter

if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split()))
    c = Counter(l)
    size = len(c.most_common())
    if size > 3:
        print("No")
        exit()
    if size == 1:
        a, b = c.most_common()[0]
        if a == 0 and b == n:
            print("Yes")
        else:
            print("No")
        exit()
    if size == 2:
        a1, b1 = c.most_common()[0]
        a2, b2 = c.most_common()[1]
        if b1 == 2 * n / 3 and a2 == 0 and b2 == n / 3:
            print("Yes")
        else:
            print("No")
        exit()
    a1, b1 = c.most_common()[0]
    a2, b2 = c.most_common()[1]
    a3, b3 = c.most_common()[2]
    if a1 ^ a2 ^ a3 == 0 and b1 == n / 3 and b2 == n / 3 and b3 == n / 3:
        print("Yes")
    else:
        print("No")
    exit()


Measured memory_bytes: 15512
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  multiset<int> l;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    auto it = l.lower_bound(x);
    if (it == l.begin())
      l.insert(x);
    else {
      it--;
      l.erase(it);
      l.insert(x);
    }
  }
  cout << l.size() << endl;
}

Measured memory_bytes: 4992
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N, K;
  int counter[SIZE] = {};

  cin >> N >> K;

  for (int i = 0; i < K; i++) {
    int d, x;
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> x;
      counter[x - 1]++;
    }
  }

  int ans = 0;

  for (int i = 0; i < N; i++) {
    ans += counter[i] == 0;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4376
#pragma comment(linker, "/stack:200000000")
 #pragma GCC optimize("Ofast")
 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif
    

// -------------------------------------Code starts here--------------------------------------------------------------------- 

    int m1,d1,m2,d2;
    cin>>m1>>d1>>m2>>d2;
    if(m2-1==m1 && d2==1)
        cout<<1;
    else
    {
        cout<<0;
    }
    

// -------------------------------------Code ends here------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
     clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

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

result = ""

while(n != 0):
  if (n % 26 == 0):
    result = "z" + result
    n = n // 26 - 1
  else:
    result = chr(ord("a") + (n % 26) - 1) + result
    n //= 26

print(result)

Measured memory_bytes: 9168
n = gets.to_i
n.times do |n|
  x1, y1, x2, y2, x3, y3, x4, y4 = gets.split.map(&:to_f)
 
  a = (x2-x1)*(y4-y3)
  b = (x4-x3)*(y2-y1)
 
  puts (a-b).abs < 1e-10 ? "YES" : "NO"
end

Measured memory_bytes: 8568
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC optimization ("unroll-loops, no-stack-protector")
#pragma GCC target ("avx")
#pragma GCC target ("avx2")
#pragma GCC target ("fma")
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
int main(){
	ll n, m; cin >> n >> m;
	vpll sgm; sgm.resize(m);
	for (ll i = 0; i < m; i++) cin >> sgm[i].fi >> sgm[i].se;
	sort(sgm.begin(), sgm.end());
	ll nd = -1, ans = 0;
	for (ll i = 0; i < sgm.size(); i++){
		if (nd <= sgm[i].fi){
			nd = sgm[i].se; ans++;
		}
		else nd = min(sgm[i].se, nd);
	}
	cout << ans << endl;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
signed main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	f(i,a){
		f(j,b){
			if((i<a-d&&j<b-c)||(i>=a-d&&j>=b-c))cout<<0;
			else cout<<1;
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 1280
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI 3.14159265358979323846264338327950L

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

bool isPalindrome(string s){
    REP(i, s.length() / 2){
        if(s[i] != s[(s.length() - 1) - i]){
            return false;
        }
    }
    return true;
}

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

 ll N, M, K, Q, i, j, k, l, tmp, ans;

int main(){


    scanf("%lld", &N);
    if (N % 1000 == 0){
        printf("0\n");
        return 0;
    }
    ans = 1000 - N % 1000;

    printf("%lld\n", ans);

     return 0;
}

Measured memory_bytes: 3836
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
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; }
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,int> LP;

struct Edge {
  int to, a, b;
  Edge(int to, int a, int b):to(to),a(a),b(b) {}
};

const int MAX_C = 2505;

vector<Edge> to[55];
vector<P> change(55);

int main(){
  int n,m,s;
  cin >> n >> m >> s;
  rep(i,m){
    int u,v,a,b;
    cin >> u >> v >> a >> b;
    u--,v--;
    to[u].emplace_back(v,a,b);
    to[v].emplace_back(u,a,b);
  }
  rep(i,n){
    int c,d;
    cin >> c >> d;
    change[i]=pair(c,d);
  }
  auto toID = [&](int v,int c){
    return v*MAX_C+c;
  };
  priority_queue<LP,vector<LP>,greater<LP>> pq;
  vector<ll> dist(MAX_C*n,LINF);
  auto push = [&](int v,int c,ll x){
    if(c<0)return;
    int id = toID(v,c);
    if(dist[id]<=x)return;
    dist[id]=x;
    pq.emplace(x,id);
  };
  chmin(s,MAX_C-1);
  push(0,s,0);
  while(!pq.empty()){
    ll d = pq.top().first;
    int id = pq.top().second;
    pq.pop();
    if(dist[id]!=d)continue;
    int v = id/MAX_C;
    int c = id%MAX_C;
    for(auto e:to[v]){
      push(e.to,c-e.a,d+e.b);
    }
    push(v,min(c+change[v].first,MAX_C-1),d+change[v].second);
  }
  for(int i=1;i<n;i++){
    ll ans = LINF;
    rep(j,MAX_C)chmin(ans,dist[toID(i,j)]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 5792
#include <iostream>
#include <string.h>

using namespace std;

#define NO_EDGE 0x80808080
#define INIT_MAX -90000000000000000
#define NOT_VISITED -1e13

int edges[1001][1001];

long saved_sc[1001];

int trace[1001];

int N=0,M=0;

int cycleDetect(int vertex, int steps, int point){
  int cycle_start=-1;
  for(int j=0;j<steps;j++){
    if(trace[j]==point){
      cycle_start=j;
      break;
    }
  }
  if(cycle_start==-1)
    return 1;
  //calculate the cycle weight
  long weights=0;
  for(int i=cycle_start;i<=steps-1;i++){
    weights += edges[trace[i+1]][trace[i]];
  }
  weights += edges[trace[cycle_start]][vertex];

  if(weights>0)
    return -1;
  else
    return 0;
}

long higestScore(int vertex, int steps, int cycle){
  trace[steps]=vertex;
  long max=INIT_MAX;
  for(int i=1;i<=N;i++){
    if(edges[i][vertex]!=NO_EDGE){
      int cyc=cycleDetect(vertex,steps,i);
      //positive cycle
      if(cyc==-1){
	cycle=1;
	if(i==1)
	  return NO_EDGE;
	else{
	  //find cylcle start position
	  int j=0;
	  for(j=0;j<steps;j++){
	    if(trace[j]==i)
	      break;
	  }
	  //cut the cycle
	  edges[trace[j+1]][i]=NO_EDGE;
	  long tmp = higestScore(i,steps+1,1);
	  if(tmp==INIT_MAX)
	    continue;
	  else
	    return NO_EDGE;
	}
      }
      else if(cyc==0){ //negative cycle
	edges[i][vertex]=NO_EDGE;
	continue;
      }
      
      long len=0;
      if(saved_sc[i]!=NOT_VISITED){
	if(saved_sc[i]==INIT_MAX)//can not reach vertex 1
	  continue;
	else
	  len=saved_sc[i]+edges[i][vertex];
      }
      else{
	long res=higestScore(i,steps+1,cycle);
	if(res==NO_EDGE)
	  return NO_EDGE; //path from 1 to N exist positive cycle
	saved_sc[i]=res;
	if(res==INIT_MAX)//can not reach vertex 1
	  continue;
	len=res+edges[i][vertex];
      }
      if(len>max)
	max=len;
    }
  }
  if(max==INIT_MAX && vertex==1){//no edges connect
    if(cycle)
      return NO_EDGE;
    else
      return 0;
  }
  return max;
}

int main(){
  memset(edges,0x80,sizeof(edges));
  memset(trace,0,sizeof(trace));
  cin>>N>>M;
  for(int i=1;i<=N;i++)
    saved_sc[i]=NOT_VISITED;
    
  for(int i=0;i<M;i++){
    int start,end,weight;
    cin>>start>>end>>weight;
    edges[start][end]=weight;
  }
  
  long res = higestScore(N,0,0);
  if(res==NO_EDGE)
    cout<<"inf"<<endl;
  else
    cout<<res<<endl;
  return 0;
}

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

int main()
{
int a,b,c,d,e,f;
int kt,cnt1,cnt2,cnt3,cnt4;
  cnt1 = cnt2 = cnt3 = cnt4 = 0;
cin >> a >> b >> c >> d >> e >> f;
int arr[] = {a,b,c,d,e,f};

for(int i = 0; i < 6; i++){
kt = arr[i]; 
switch(kt){
case 1:
++cnt1;
break;
case 2:
++cnt2;
break;
case 3:
++cnt3;
break;
case 4:
++cnt4;
break;
}
}
if((cnt1 == 2 && cnt2 == 2) || (cnt1 == 2 && cnt3 == 2) || (cnt1 == 2 && cnt4 == 2) ||
   (cnt2 == 2 && cnt3 == 2) || (cnt2 == 2 && cnt4 == 2) || (cnt3 == 2 && cnt4 == 2))
{cout << "YES";}

else
cout << "NO";

  return 0;
}

Measured memory_bytes: 256
import java.util.*; 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        Queue<String> qProcess = new LinkedList<String>();
        Queue<Integer> qTime = new LinkedList<Integer>();        
        int totalTime = 0;
        for (int i = 0; i < n; i++) {
            qProcess.add(sc.next());
            qTime.add(sc.nextInt());
        }         
        while (qProcess.size()>0) {
            if (qTime.peek() - q > 0) {
                qProcess.add(qProcess.poll());
                qTime.add(qTime.poll()-q);
                totalTime = totalTime + q;
            } else {
                totalTime = totalTime + qTime.poll();
                System.out.println(qProcess.poll() + ' ' + totalTime);
            }
        }
    }
}


Measured memory_bytes: 73536
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>

int main() {
	std::cin.tie(nullptr); std::cin.sync_with_stdio(false);
	int n, m; std::cin >> n >> m;
	std::cout << n * (n - 1) / 2 + m * (m - 1) / 2 << std::endl;
}

Measured memory_bytes: 888
import sys
input = sys.stdin.readline

def unite(node_a, node_b):
    root_a = node_a.root()
    root_b = node_b.root()
    if root_a == root_b:
        return False
    if root_b.depth > root_a.depth:
        root_a, root_b = root_b, root_a
    root_b.is_root = False
    root_b.parent = root_a
    root_a.depth = max(root_a.depth, root_b.depth+1)
    return True

class Node:
    def __init__(self, id):
        self.id = id
        self.is_root = True
        self.parent = None
        self.depth = 1
    
    def root(self):
        if self.is_root:
            return self
        elif self.parent.is_root:
            return self.parent
        else:
            self.parent = self.parent.root()
            return self.parent

def main():
    N, K, L = map(int, input().split())
    
    trains = [Node(i) for i in range(N)]
    streets = [Node(i) for i in range(N)]

    for i in range(K):
        p, q = map(int, input().split())
        p -= 1; q -= 1
        unite(trains[p], trains[q])
    for i in range(L):
        r, s = map(int, input().split())
        r -= 1; s -= 1
        unite(streets[r], streets[s])
    dic = {}
    roots = []
    for i in range(N):
        tmp = (trains[i].root().id, streets[i].root().id)
        roots.append(tmp)
        if tmp in dic:
            dic[tmp] += 1
        else:
            dic[tmp] = 1
    
    for i in range(N-1):
        print(dic[roots[i]], end=" ")
    print(dic[roots[N-1]])

if __name__ == "__main__":
    main()

Measured memory_bytes: 150048
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<ll> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	vi sc(1 << n), dp(1 << n, -(ll)1e18);
	vector<vi> a(n, vi(n));
	rep(i, n) rep(j, n) cin >> a[i][j];
	
	dp[0] = 0;
	
	rep(i, 1 << n) rep(j, n) if(i >> j & 1) rep(k, j) if(i >> k & 1) sc[i] += a[j][k];
	rep(i, 1 << n) for(int j = i; j; j = j - 1 & i) dp[i] = max(dp[i], dp[i ^ j] + sc[j]);
	cout << dp[(1 << n) - 1] << endl;
	
	return 0;
}

Measured memory_bytes: 1280
from collections import Counter

N = int(input())
S = []
for _ in range(N):
    S.append(input())

c = Counter(S).most_common()
num = c[0][1]
v_l = []
for v ,s in c:
    if s == num:
        v_l.append(v)

print(*sorted(v_l))

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    lint n, k;
    cin >> n >> k;

    vector< LLP > v;
    rep(i, n){
        lint a, b;
        cin >> a >> b;
        v.emplace_back(a, b);
    }
    SORT(v);
    lint cnt = 0, ans = 0;
    rep(i, n){
        cnt += v[i].second;
        if(cnt >= k){
            ans = v[i].first;
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)((n)-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n; cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));

    map<int,vi> mp;
    rep(i,n) mp[a[i]].push_back(i);
    vi used(n,0);
    int ans = 0;
    rrep(i,n){
        if(used[i]) continue;
        int lsb = __builtin_ffsll(a[i]) - 1;
        int msb = (31 - __builtin_clz(a[i]));
        int x = 1 << lsb;
        REP(j,lsb,msb){
            if((a[i]&(1<<j)) == 0) x |= 1<<j;
        }
        if(mp.count(x)){
            if(mp[x].size() == 0) continue;
            if(mp[x].back() == i){
                mp[x].pop_back();
                if(mp[x].size() == 0) continue;
            }
            int idx = mp[x].back();
            used[idx] = 1;
            mp[x].pop_back();
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 26756
#include<stdio.h>
int main(void){
  int r;
  int g;
  int b;
  1<=r,g,b;
  r,g,b<=9;
  scanf("%d",&r);
  scanf("%d",&g);
  scanf("%d",&b);
  if((r*100+g*10+b)%4==0){
    printf("YES");
  }else{
    printf("NO");
  }
}
  

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int i;
    int a[3];
    for (i=0;i<3;i++)
        cin>>a[i];
    sort(a,a+3,greater<int>());
    cout<<a[0]*10+a[1]+a[2]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
using namespace std;

int main()
{
    fastIO;
    ll n, a, b;string ans = "No";cin>>n;
    Fo(a,1,10) {
        if((n%a==0) and (n/a<10) and (n/a>0))ans="Yes";
    }
    cout<<ans;
}   

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
from operator import itemgetter
def main():
    n,m=map(int,input().split())
    A=[int(_) for _ in input().split()]
    A.sort()
    D=[[int(_) for _ in input().split()] for i in range(m)]
    D.sort(key=itemgetter(1),reverse=True)
    len_D=len(D)
    index_d=0
    for i in range(n):
        if D[index_d][0]==0:
            index_d+=1
            if index_d==len_D:
                break
        if A[i]>=D[index_d][1]:
            break
        A[i]=D[index_d][1]
        D[index_d][0]-=1
    print(sum(A))

if __name__=='__main__':
    main()

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

int N;
vector<long long> a;

void solve() {
    map<long long, long long> ma;
    for(int i = 0; i < N; ++i)
        ma[a[i]]++;
    long long res = 0;
    for(auto it : ma)
        res += it.second * (it.second - 1) / 2;
    for(int i = 0; i < N; ++i) {
        long long val = ma[a[i]];
        long long before = val * (val - 1) / 2;
        long long after = (val - 1) * (val - 2) / 2;
        cout << res + after - before << endl;
    }
}

int main() {
    cin >> N;
    a.resize(N);
    for(int i = 0; i < N; ++i)
        cin >> a[i];
    solve();
}

Measured memory_bytes: 12768
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007

int main(){
    int n;
    cin>>n;
    vector<double> x(n);
    vector<string> y(n);
    rep(i,n){
        cin>>x[i]>>y[i];
    }
    double sum=0;
    rep(i,n){
        if(y[i]=="JPY"){
            sum += x[i];
        }
        else{
            sum += x[i]*380000;
        }
    }
    cout<<sum<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main()
{
    ll a, b, x;
    cin >> a >> b >> x;
    cout << b / x - a / x + (a % x == 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define ALLG(v) v.begin(), v.end() ,greater<int>()
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll GCD(ll x, ll y) { return y ? GCD(y, x % y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }
ll GetDigit(ll num) {
	ll digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}

using namespace std;
int main() {

	int n, k;

	cin >> n >> k;

	set<int> st;

	for (int i = 0; i < k; i++)
	{
		int d;
		cin >> d;
		for (int j = 0; j < d; j++)
		{
			int temp;
			cin >> temp;
			st.insert(temp);
		}
	}

	cout << n - st.size() << endl;




}

Measured memory_bytes: 3600
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n,k = nm()
l = nl()
f = list(filter(lambda x:x>0, l))
g = list(filter(lambda x:x<0, l))
f.sort(); g.sort(reverse=True)
pl = len(f); mi = len(g)
ze = n - pl - mi
tomi = pl*mi
if tomi >= k:
    def jud(z):
        ret = 0
        i = mi
        for x in f:
            while i and x*g[i-1] <= z: i -= 1
            ret += mi - i
        return ret
    ok,ng = 0,max(f)*min(g)-1
    while ok - ng > 1:
        mid = (ok+ng)//2
        if jud(mid) < k:
            ng = mid
        else:
            ok = mid
    print(ok)
    exit(0)

tomi += ze*(n-ze) + (ze-1)*ze//2
if tomi >= k:
    print(0); exit(0)

else:
    k -= tomi
    def jud2(z):
        ret = 0
        i = pl
        for e,x in enumerate(f):
            while i and f[i-1]*x > z: i -= 1
            ret += i - (e<=i-1)
        i = mi
        for e,x in enumerate(g):
            while i and g[i-1]*x > z: i -= 1
            ret += i - (e<=i-1)
        return ret//2
    ok,ng = 0,max(max(f+[0])**2, min(g+[0])**2)
    while ng - ok > 1:
        mid = (ok+ng)//2
        if jud2(mid) < k:
            ok = mid
        else:
            ng = mid
    print(ng)


Measured memory_bytes: 92056
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    int len = s.size();
    bool ok = true;
    rep(i,len){
        int temp = i+1;
        if(temp%2){
            if(s[i] == 'L')ok = false;
        }
        else{
            if(s[i] == 'R')ok = false;
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

int	F(int P, vector<vector<int>> &A) {
	int l=0; 
	int r=A.size()-1;
	while(r-l>1) {
		int m=(l+r)/2;
		if (A.at(m).at(0)>P)
			r=m;
		else
			l=m;
	}
	return r;
}

int	main() {
	int N;
	cin >>N;
	vector<int> A(N, 0);
	for (int i=0; i<N; i++)
		cin >>A.at(i);
	int S=1;
	int AA=A.at(0);
	for (int i=1; i<N; i++)
		if (AA>A.at(i)) {
			AA=A.at(i);
			S++;
		}
	cout <<S <<endl;
	return 0;
}



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

string s;

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

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
using namespace std;

#define PI 3.14159265358979323846264338327950L

string res;

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

    string T;
    cin >> T;
    res = T;
    for (int i = 0; i < T.length(); i++)
    {
        if(T[i]=='?'){
            res[i] = 'D';
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
  int a,b,c,x,temp,ans=0;scanf("%d%d%d%d",&a,&b,&c,&x);
  rep(i,a+1)rep(j,b+1){
    temp=x-i*500-j*100;
    if(temp>=0&&temp/50<=c){
      ans++;
    }
  }printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
using namespace std;

const int N = 2e3 + 9;
vector<int> adj[N];
int vis[N], par[N];
vector<int> path;
int cur = 1e9;

void getPath(int node) {
	vector<int> v;
	while(node != -1) {
		v.push_back(node);
		node = par[node];
	}
	if((int)v.size() < cur)
		path = v, cur = path.size();
}

void bfs(int node) {
	memset(vis, 0, sizeof vis);
	vis[node] = 1;
	par[node] = -1;
	queue<int> q;
	q.push(node);
	while(!q.empty()) {
		int tp = q.front();
		q.pop();
		for(auto it: adj[tp]) {
			if(!vis[it]) {
				vis[it] = 1;
				par[it] = tp;
				q.push(it);
			} else if(it == node) {
				getPath(tp);
			}
		}
	}
}

int main() {
	fastIO;
#ifdef LOCAL
	freopen("input.in", "rt", stdin);
#endif
	int n, m, u, v;
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> u >> v;
		adj[u].push_back(v);
	}
	for (int i = 1; i <= n; ++i)
		bfs(i);
	if(path.empty()) {
		cout << -1;
		return 0;
	}
	vector<int> in(n + 1, 0), out(n + 1, 0);
	set<int> st = set<int>(path.begin(), path.end());
	for(auto it: path) {
		for(auto child: adj[it]) {
			if(st.find(child) != st.end()) {
				++in[child];
				++out[it];
			}
		}
	}
	for (int i = 1; i <= n; ++i) {
		if(in[i] > 1 || out[i] > 1) {
			cout << -1;
			return 0;
		}
	}
	cout << path.size() << '\n';
	for(auto it: path) cout << it << '\n';
	return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/21  Problem: ABC 063 D / Link: http://abc063.contest.atcoder.jp/tasks/abc063_d  ----- */


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

	LL N, A, B; cin >> N >> A >> B;
	vector<LL> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	auto f = [&A,&B,&N](LL x, VL a) {
		FOR(i, 0, N) {
			a[i] -= x * B;
		}
		LL needx = 0;
		FOR(i, 0, N) {
			if (a[i] > 0)needx += (a[i] - 1 + (A - B)) / (A - B);
		}

		return needx <= x;
	};
	LL L = 0, R = 1e9;
	while (R - L > 1) {
		LL mid = (L + R) / 2;
		if (f(mid,a)) {
			R = mid;
		}
		else {
			L = mid;
		}
	}
	LL ans = R;
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define FOR(i,n) for(int i = 0;i<n ;i++)
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>
#define mii map<int,int>
#define uii unordered_map<int,int>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pb push_back
#define MOD 1e9+7
#define INF 0x3f3f3f3f
#define print(x) cout<<x<<"\n";

//#include<boost/multiprecision/cpp_int.hpp>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//(Uncomment when needed and be sure it not give TLE bcoz it requires time)
//#pragma GCC optimize "trapv"//to check integer overflow and gives RE.
//typedef tree<pair<int,int>,null_type, 
//less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)\
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("O3")
//uncoment for large int requirement
//using boost::multiprecision::cpp_int;
//using namespace _gnu_pbds;

using namespace std;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
//use it with unordered_map<T,T,custom_hash> safe_map

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

int main()
{fast_io

int t;
//cin>>t;
t = 1;
while(t--)
{
   ll k;
   cin>>k;
   ll val = 7%k;
   for(int i = 1 ;i<1e7 ;i++){
      if(val==0)
       {cout<<i<<endl;
       return 0;
           
       }
       val = (val*10+7)%k;
   }
   cout<<-1<<endl;
}
}


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

int a, b, c, d;
bool ans = true;

int main() {
	cin >> a >> b >> c >> d;
	if (abs(c - a) <= d) {
		cout << "Yes" << endl;
	}
	else if (abs(b - a) <= d  && abs(c - b) <= d) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 200005
#define MOD 1000000007
#define INF 10000000

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define piii pair<pii, ll>
#define ft first
#define sd second

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}


void solve(){

    ll a[3];
    cin >> a[0] >> a[1] >> a[2];
    swap(a[0], a[1]);
    swap(a[0], a[2]);

    cout << a[0] <<  " " << a[1] << " " << a[2] ;

}

int main()
{
    //fast();
    solve();
}



Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	vector<pair<ld, ld>> a;
	cin >> n;
	a.resize(n);
	for(auto &i : a) cin >> i.first >> i.second;
	sort(all(a));
	ld ans = 0;
	ll x = 0;
	do {
		for(int i = 1; i < n; i++)
			ans += sqrt((a[i].first-a[i-1].first)*(a[i].first-a[i-1].first) + (a[i].second-a[i-1].second)*(a[i].second-a[i-1].second));
		x++;
	} while(next_permutation(all(a)));
	cout << fixed << setprecision(15) << (ans/x);
}


Measured memory_bytes: 256