akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,sz1,sz2,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX; string str,ttr,ntr;
        long long x=0,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct,tct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr,mp1,mp2;

        scanf("%lld %lld %lld",&a,&b,&n);
        fr=min(b-1,n);
        sc=a*fr;  p=sc/b;  printf("%lld\n",p);







    return 0;
}





Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define X first
#define Y second
#define pb push_back
#define Scan(a) scanf("%I64d", &a);
#define CLR(a) memset(a,0,sizeof(a))
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORE(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)

using namespace std;

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

int main()
{
    ios::sync_with_stdio(0);
    //freopen("inp.txt", "r", stdin);
    string s;
    cin >> s;
    int n = s.length();
    if (s[0] == s[n-1] && n % 2 == 0) cout << "First";
    else if (s[0] == s[n-1] && n % 2) cout << "Second";
    else if (s[0] != s[n-1] && n % 2 == 0) cout << "Second";
    else cout << "First";
    return 0;
}


Measured memory_bytes: 512
NM = raw_input().split()
cPairs = int(NM[1]) / 2
SCCby1S2C = min([int(NM[0]),cPairs])
NM[0] = int(NM[0]) - SCCby1S2C
cPairs = cPairs - SCCby1S2C
SCCby4C = cPairs / 2
print SCCby1S2C + SCCby4C

Measured memory_bytes: 2568
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<pi,null_type,less<pi>,rb_tree_tag,tree_order_statistics_node_update> indexed_set_pair;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

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

const int N = (int)3e5+5;
const int M = (int)1e3+5;
const int Q = 102;
const int logN = 19;

const double pie = acos(-1);

void solve() {
  int x;
  cin >> x;
  cout << 1-x;
}

int main() {
    //freopen("./sort/b2.in","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        //cout<<"\n";
    }
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long int
#define ld long double
#define el '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < int(n); i++)
#define pll pair<ll, ll>
#define mll map<ll,ll>
#define vli vector<pair<ll,int>>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

vector<ll> parent, rak;

void make_set(int f){
    fo(i,f+1)parent.pb(i);
    rak.assign(f+1,1);
}

ll find_set(ll v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

ll union_sets(ll a, ll b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rak[a] < rak[b])
            swap(a, b);
        parent[b] = a;
        rak[a]+=rak[b];
        return (rak[a]-rak[b])*(rak[b]);
    }
    return 0;
}

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}
ll extend_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1,y1;
    ll ans =extend_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-(a/b)*y1;

    return ans;
}
ll inverse(ll a,ll m){
    ll x,y;
    extend_gcd(m,a,x,y);
    y%=m;
    y+=m;
    y%=m;
    return y;
}

/*const int N = 1000001;
int lp[N+1];
vector<int> pr;
void s(){
for (int i=2; i<=N; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
            lp[i * pr[j]] = pr[j];
    }
}*/


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s;
//vvl v;
//vl vis,d;

int main() {
    IOS;
    ld f;
    cin>>f>>x>>y;
    cout<<f*x/2;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, k;
int a[200000];
signed main() {
	cin >> n >> k;
	int res = Inf, r = -1;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i > 0 && a[i] >= 0 && a[i - 1] < 0) r = i;
	}
	for (int i = k - 1; i < n; i++) {
		if (a[i] >= 0 && a[i - k + 1] < 0) {
			res = min(res, min(abs(a[i] * 2) + abs(a[i - k + 1]), abs(a[i - k + 1] * 2) + abs(a[i])));
		}
		else if (a[i] < 0) {
			res = min(res, abs(a[i - k + 1]));
		}
		else res = min(res, abs(a[i]));
	}
	cout << res << endl;
}

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

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

void takahashi_win(){
    p_no();
    exit(0);
}

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

    // input
    ll H, W, N;
    cin >> H >> W >> N;

    ll Sr, Sc;
    cin >> Sr >> Sc;
    Sr--;
    Sc--;

    string s, t;
    cin >> s >> t;
    // pn(s);
    // pn(t);

    ll r;
    ll c;
    // 上に落とせるか
    r = Sr;
    c = Sc;
    FOR(i, 0, N){
        if(s[i]=='U') r--;
        if(r<0) takahashi_win();
        
        if(t[i]=='D') r++;
        if(r==H) r--;
    }

    // 下に落とせるか
    r = Sr;
    c = Sc;
    FOR(i, 0, N){
        if(s[i]=='D') r++;
        if(r>=H) takahashi_win();
        
        if(t[i]=='U') r--;
        if(r==-1) r++;
    }

    // 左
    r = Sr;
    c = Sc;
    FOR(i, 0, N){
        if(s[i]=='L') c--;
        if(c<0) takahashi_win();

        if(t[i]=='R') c++;
        if(c==W) c--;
    }

    // 右
    r = Sr;
    c = Sc;
    FOR(i, 0, N){
        if(s[i]=='R') c++;
        if(c>=W) takahashi_win();

        if(t[i]=='L') c--;
        if(c==-1) c++;
    }

    p_yes();

    return 0;
}

Measured memory_bytes: 920
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
#define INF 1 << 30

using namespace std;

int main(){
  int e;
  while(scanf("%d", &e) && e){
    int res = INF;
    for(int i = 0; i * i * i <= e; i++){
      int z = i;
      int y = sqrt(e-z*z*z);
      int x = e-(y*y+z*z*z);
      res = min(res, z + y + x);
    }

    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 1188
N = int(input())
B = [int(i) for i in input().split(' ')]
A = [0]*(N)
for i,a in enumerate(B):
    if i == 0: #index最初
        A[i] = a
        A[i+1] = a
    else:#二番目以降
        if B[i-1] < B[i]:
            A[i+1] = a
        else:
            A[i] = a
            A[i+1] = a

print(sum(A))

Measured memory_bytes: 61976
#include<bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int input() {
	int r;
	scanf("%lld", &r);
	return r;
}
int a[100][100];
int f(int i, int j) {
	if (a[i][j] == 0)return 0;
	int r = 0;
	a[i][j] = 0;
	r = max({ f(i - 1, j),f(i + 1, j),f(i, j - 1),f(i, j + 1) });
	a[i][j] = 1;
	return ++r;
}
bool solve() {
	int n = input(); if (n == 0)return 0;
	int m = input();
	for1(i, n)for1(j, m)a[i][j] = input();
	int ans = 0; for1(i, n)for1(j, m)ans = max(ans, f(i, j));
	cout << ans << endl;
	for1(i, n)for1(j, m)a[i][j] = 0; return 1;
}
signed main() {
	while (solve());
}


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

using namespace std;

using int64 = long long;

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

string Solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string s_reversed(s);
  reverse(s_reversed.begin(), s_reversed.end());

  string t = s + s_reversed;

  if (k == 1) {
    string ans = s;
    for (int i = 0; i < n; i++) {
      UpdateMin(ans, t.substr(i, n));
    }
    return ans;
  }

  char min_char = s[0];
  for (char c : s) {
    UpdateMin(min_char, c);
  }
  vector<int> counts(2 * n);
  if (t[0] == min_char) {
    counts[0] = 1;
  }
  for (int i = 1; i < 2 * n; i++) {
    if (t[i] == min_char) {
      counts[i] = counts[i - 1] + 1;
    } else {
      counts[i] = 0;
    }
  }
  int max_count = 0;
  for (int c : counts) {
    UpdateMax(max_count, c);
  }

  vector<string> seeds;
  for (int i = 0; i <= n; i++) {
    if (counts[i + n - 1] == max_count) {
      string seed = t.substr(i, n);
      reverse(seed.begin(), seed.end());
      seeds.push_back(seed);
    }
  }

  sort(seeds.begin(), seeds.end());
  string seed = seeds[0];

  int prefix_length = max_count;
  while (k > 1) {
    prefix_length *= 2;
    k--;
    if (prefix_length >= n) {
      break;
    }
  }

  if (prefix_length >= n) {
    return string(n, min_char);
  }

  int additional_length = prefix_length - max_count;
  // cerr << "additional_length: " << additional_length << endl;
  return string(additional_length, min_char)
      + seed.substr(0, n - additional_length);
}

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

  cout << Solve() << endl;
}

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


int main(){
    int A,B,C;cin>>A>>B>>C;
    if(A==7 && B==5 && C==5)cout<<"YES"<<endl;
    else if(A==5 && B==7 && C==5)cout<<"YES"<<endl;
    else if(A==5 && B==5 && C==7)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0; 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
bool find(string s,char c){
    for(char cc:s){
        if(c == cc)return 1;
    }
    return 0;
}
main(){
    string s1 = "qwertasdfgzxcvb";
    string S;
    cin >> S;
    while(S != "#"){
        int turn,cnt = 0;
        turn = find(s1, S[0]);
        rep(i,0,S.size()){
            if(turn != find(s1, S[i])){
                cnt++;
                turn = find(s1, S[i]);
            }
        }
        cout << cnt << endl;
        cin >> S;
    }
}


Measured memory_bytes: 3220
#include<stdio.h>

int main(void){

	int a,b,c;

	scanf("%d%d%d",&a,&b,&c);

	if(a!=b && b!=c && c!=a){
		printf("3");
	}

	
	else if(a==b && b==c && c==a){
		printf("1");
	}

	else{
		printf("2");
	}

	return 0;

}



Measured memory_bytes: 128
// Charan Sriramula

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;

const ll lg=22;
const ll N=1e6+5;
const ll INF=1e18+5;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;

#define is(n) scanf("%d",&n)
#define io(n) printf("%d\n",n)
#define ls(n) scanf("%lld",&n)
#define lo(n) printf("%lld\n",n)

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
template<typename T> T power(T x,T y){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%mod;y>>=1LL;x=(x*x)%mod;}return ans%mod;}

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll inv(ll a){ return power(a, mod - 2); }

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

int main()
{
  ll x,y,z;
  cin>>x>>y>>z;
  x+=y;
  x+=z;
  if(x>=22){cout<<"bust"<<endl;}
  else{cout<<"win"<<endl;}
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int H, W;
  std::cin >> H >> W;
  auto calc = [](int H, int W, int ah) {
    int bh = (H - ah) / 2, ch = H - ah - bh;
    int a = ah * W, b = bh * W, c = ch * W;
    int mi = a, ma = a;
    mi = min(mi, b);
    mi = min(mi, c);
    ma = max(ma, b);
    ma = max(ma, c);
    int ret = ma - mi;
    int bw = W / 2, cw = W - bw;
    b = (H - ah) * bw;
    c = (H - ah) * cw;
    mi = a, ma = a;
    mi = min(mi, b);
    mi = min(mi, c);
    ma = max(ma, b);
    ma = max(ma, c);
    ret = min(ret, ma - mi);
    return ret;
  };
  int ans = LONG_MAX;
  for (int i = 1; i < H; i++)
    chmin(ans, calc(H, W, i));
  for (int i = 1; i < W; i++)
    chmin(ans, calc(W, H, i));
  print(ans);
}

Measured memory_bytes: 256
a,b,m = map(int,input().split())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
yasuiyo = min(al) + min(bl)
ans = []
for i in range(m):
  x,y,c = map(int,input().split())
  ans.append(al[x-1] + bl[y-1] - c)

print(min(min(ans),yasuiyo))

Measured memory_bytes: 24796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define fi first
#define se second
ll a,b,c,d,n,m,p,q,x,y,k,h,w,sum,mi,ma,ans,l,r,res;
string s;
typedef vector<int> VI;
typedef vector<pair<int,int> > VP;

int main() {
    cin>>a>>b;
    p(a*b-a-b+1);
    return 0;
}


Measured memory_bytes: 256
import collections

N = int(input())
S = []

for i in range(N):
    S.append(input())

t = collections.Counter(S)


maxt = max(t.values())
maxvt = [key for key in t if t[key] == maxt]
maxvt.sort()

for i in range(len(maxvt)):
    print(maxvt[i])

Measured memory_bytes: 35572
import           Control.Exception (assert)
import           Control.Monad     (replicateM)
import           Data.List         (foldl')

import           Data.Vector       (Vector, (!))
import qualified Data.Vector       as V (fromList)

main :: IO ()
main = do
  [n, q] <- map read . words <$> getLine
  s <- getLine
  assert (length s == n) $ do
    spells <- replicateM q $ do
      [t, d] <- words <$> getLine
      pure $ toSpell t d
    print $ solve n s spells

data Spell = Spell Char Direction

data Direction = L | R

toSpell :: String -> String -> Spell
toSpell [c] "L" = Spell c L
toSpell [c] "R" = Spell c R
toSpell _   _   = error "irregular"

solve :: Int -> String -> [Spell] -> Int
solve n s spells =
  let
    l = bisect (\i -> destination' s spells i == LeftEdge) 0 n
    r = bisect (\i -> destination' s spells i /= RightEdge) 0 n
  in
    r - l

bisect :: (Int -> Bool) -> Int -> Int -> Int
bisect p lowerB upperB -- section: [lowerB, upperB)
  | upperB - lowerB == 1 = lowerB
  | p middle             = bisect p middle upperB
  | otherwise            = bisect p lowerB middle
  where
    middle = (lowerB + upperB) `div` 2

data WithEdge a = LeftEdge | Inner a | RightEdge
  deriving (Eq)

destination' :: String -> [Spell] -> Int -> WithEdge Char
destination' s spells startIndex = array ! foldl' update (startIndex + 1) spells
  where
    array = V.fromList $ [LeftEdge] ++ map Inner s ++ [RightEdge]

    update i (Spell c d) =
      case (array ! i == Inner c, d) of
        (False, _) -> i
        (True, L)  -> pred i
        (True, R)  -> succ i

destination :: String -> [Spell] -> Int -> WithEdge Char
destination s spells i = extract $ foldl' update zipper spells
  where
    zipper = nTimes (i + 1) right $ fromList $ [LeftEdge] ++ map Inner s ++ [RightEdge]

    update z (Spell c d) =
      case (extract z == Inner c, d) of
        (False, _) -> z
        (True, L)  -> left z
        (True, R)  -> right z

fromList :: [a] -> Zipper a
fromList []       = error "non empty"
fromList (x : xs) = Zipper [] x xs

nTimes :: Int -> (a -> a) -> a -> a
nTimes n f x = iterate f x !! n

data Zipper a = Zipper [a] a [a]

extract :: Zipper a -> a
extract (Zipper _ x _) = x

left :: Zipper a -> Zipper a
left z@(Zipper [] _ _)      = z
left (Zipper (l : ls) x rs) = Zipper ls l (x : rs)

right :: Zipper a -> Zipper a
right z@(Zipper _ _ [])      = z
right (Zipper ls x (r : rs)) = Zipper (x : ls) r rs


Measured memory_bytes: 76156
from collections import Counter

class union_find():
    def __init__(self,n):
        self.n=n
        ##親要素のノード番号を格納。par[x]==xのときそのノードは根
        ##親とはその上にノードなし！！　
        self.par=[-1 for i in range(n)]
        self.rank=[0]*(n)

    def find(self,x):
        if self.par[x]<0:
            return x
        else:
            self.par[x]=self.find(self.par[x])
            
            return self.par[x]

    def union(self,x,y):
        x=self.find(x)
        y=self.find(y)

        ##木の高さを比較し、低い方から高い方へ辺をはる
        if x==y:
          return

        if self.par[x]>self.par[y]:
          x,y=y,x
          
        self.par[x]+=self.par[y]
        self.par[y]=x

    def same(self,x,y):
        return self.find(x) == self.find(y)
    
    def size(self,x):
      return -self.par[self.find(x)]
      
    def members(self,x):
      root=self.find(x)
      return [i for i in range(self.n) if self.find(i)==root]
    
    def roots(self):
      return [i for i, x in enumerate(self.par) if x<0]
    
    def all_group_member(self):
      return {r:self.members(r) for r in self.roots()}
      
n,m=map(int,input().split())

ri=[]

for _ in range(m):
  a=list(map(int,input().split()))
  ri.append(a)
  
uf=union_find(n)
ans=[0]

for i in range(m):
  temp=ri[(m-1)-i]
  x,y=temp[0]-1,temp[1]-1
  ch=0
  if uf.par[x]==-1 and uf.par[y]==-1:
    ans1=1
  elif uf.par[x]==-1:
    ans1=uf.size(y)
  elif uf.par[y]==-1:
    ans1=uf.size(x)
  elif uf.same(x,y):
    ans1=0
  else:
    ans1=uf.size(x)*uf.size(y)
  uf.union(x,y)
  ans.append(ans[-1]+ans1)
  
ans_sa=0
for j in range(m):
  ans_sa+=ans[m-j]-ans[m-1-j]
  print(ans_sa)
  

  

Measured memory_bytes: 102188
let main = (input) => {
    let usrInput = input.split(/\n/)
    let time = 0
    if (usrInput[0] !== usrInput[1]) {
        for (let index = 0; index < usrInput[0].length; index++) {
            if (usrInput[0][index] != usrInput[1][index]) {
                time++
            }
        }
    }
    console.log(time)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 32644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//最大公約数
long long gcd(long long a, long long b) {
  if (a < b) std::swap(a, b);
  long long r = a % b;
  while (r) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main() {
  ll n, m;
  cin >> n >> m;
  vll a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    a[i] /= 2;
  }

  ll lcm = a[0];
  for (ll i = 1; i < n; i++) {
    ll x = a[i] / gcd(lcm, a[i]);
    lcm *= x;
  }
  for (ll i = 0; i < n; i++) {
    if (lcm / a[i] % 2 == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  ll ans = 0;
  if (lcm <= m) {
    ans++;
    m -= lcm;
    ans += m / (2 * lcm);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<double >    vecd;
typedef vector<vector<int> >  vec2int;
typedef vector<vector<double> >  vec2d;
typedef vector<ll >     vecll;
typedef vector<string > vecstr;
typedef vector<bool > vecbool;
typedef vector<vector< bool > > vec2bool;
typedef vector<bool > vecbool;
////////////////////////////////////////////////
int main()
{
  int    n;
  cin >> n;
  cout << (n + 1)/2<< endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
//↓区間和を求めるSegmentTree
struct SegmentTreeSum {
private:
    ll n;
    vector<ll> node;

public:
    // 元配列 v をセグメント木で表現する
    SegmentTreeSum(vector<ll> v) {
        // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく
        // セグメント木全体で必要なノード数は 2n-1 個である
        ll sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);

        // 最下段に値を入れたあとに、下の段から順番に値を入れる
        // 値を入れるには、自分の子の 2 値を参照すれば良い
        for(ll i=0; i<sz; i++) node[i+n-1] = v[i];
        for(ll i=n-2; i>=0; i--) node[i] = (node[2*i+1] + node[2*i+2]);
    }
	void update(ll x, ll val) {
		// 最下段のノードにアクセスする
		x += (n - 1);

		// 最下段のノードを更新したら、あとは親に上って更新していく
		node[x] = val;
		while(x > 0) {
			x = (x - 1) / 2;
			node[x] = (node[2*x+1] + node[2*x+2]);
		}
	}
	ll getsum(ll a, ll b, ll k=0, ll l=0, ll r=-1) {
		// 最初に呼び出されたときの対象区間は [0, n)
		if(r < 0) r = n;

		// 要求区間と対象区間が交わらない -> 適当に返す
		if(r <= a || b <= l) return 0;

		// 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う
		if(a <= l && r <= b) return node[k];

		// 要求区間が対象区間の一部を被覆 -> 子について探索を行う
		// 左側の子を vl ・ 右側の子を vr としている
		// 新しい対象区間は、現在の対象区間を半分に割ったもの
		ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
		ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
		return (vl + vr);
	}
};
//↑区間和を求めるSegmentTree
int main(){
	ll N;
	cin>>N;
	vector<tuple<ll,ll,ll>> A,B;
	ll maxi=0;
	for(int i=0;i<N;i++){
		ll a;
		cin>>a;
		A.eb(a,i,(a>maxi));
		maxi=max(maxi,a);
	}
	B=A;
	/*
	for(int i=0;i<N;i++){
		ll a,b,c;
		tie(a,b,c)=A[i];
		cout<<a<<" "<<b<<" "<<c<<endl;
	}
	*/
	sort(A.begin(),A.end());
	vll node;
	for(ll i=0;i<N;i++)
		node.pb(get<0>(A[i]));
	SegmentTreeSum S(node);
	ll ans[SIZE]={};
	ll wa[SIZE]={};
	//flagが立ってるやつの番号
	vint F;
	for(int i=0;i<N;i++)
		if(get<2>(A[i]))
			F.pb(i);
	ans[get<1>(A[F[0]])]=S.getsum(0,N);
	for(int i=0;i<F.size()-1;i++){
		ll a,b,c;
		tie(a,b,c)=A[F[i]];
		ans[get<1>(A[F[i+1]])]=S.getsum(F[i],N)-a*(N-F[i]);
	}
	/*
	for(int i=0;i<N;i++)
		if(!get<2>(B[i]))
			ans[i]=0;
	*/
	ll prev=0;
	for(int i=N-1;i>=0;i--){
		if(ans[i]!=0){
			ll temp=prev;
			prev=ans[i];
			ans[i]-=temp;
		}
	}
	for(ll i=0;i<N;i++)
		cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 10864
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
#define MOD 1000000007
#define FormulaToConvertMicrosecondsToSeconds(duration) duration / 1e+6
#define _CRT_SECURE_NO_DEPRECATE
#define ll                    long long
#define nl                    '\n'                             // NL - sign of new line

#define upperString(str)      transform(str.begin(), str.end(), str.begin(), ::toupper); // make entire string uppercase
#define lowerString(str)      transform(str.begin(), str.end(), str.begin(), ::tolower); // make entire string lowercase

#define ps(x,y)               fixed << setprecision(y) << x     // usage: t=1.1234; cout << ps(t,4); // it means it will print 4 decimal places.

#define eb                    emplace_back
#define sortv(v)              sort(v.begin(), v.end());
#define rsortv(v)             sort(v.rbegin(), v.rend());
#define rev(v)		          reverse(v.begin(), v.end())       // reverse the vector

#define si                    set<int>

#define mii			          std::map <int,int>
#define multimii		      std::multimap <int,int>
#define mss			          map <string, string>
#define w(t)                  unsigned t; cin >> t; while(t--)
mt19937                       rng(chrono::steady_clock::now().time_since_epoch().count());

void solve();
//==================================

bool isPrime(int num) {
	if (num == 1) return false;
	for (int i = 2; i <= sqrt(num); i++) {
		if (num % i == 0) return false;
	}
	return true;
}

ll binarySearch(int a[], int l, int r, int x)
{
	while (l <= r)
	{
		int mid_index = l + (r - l) / 2;

		if (a[mid_index] == x)
			return mid_index;
		else if ( x > a[mid_index])
		{
			l = mid_index + 1;
		}
		else if ( x < a[mid_index])
		{
			r = mid_index - 1;
		}
	}
	return -1;
}

ll fast_power(ll base, ll power) {
	ll result = 1;
	while (power > 0) {

		// if( power % 2 == 1)
		if (power & 1) { // Can also use (power & 1) to make code even faster
			result = (result * base) % MOD;
		}
		base = (base * base) % MOD;

		// power /= 2
		power >>= 1; // Can also use power >>= 1; to make code even faster
	}
	return result;
}

//==================================
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//--------------------------------
	auto t1 = std::chrono::high_resolution_clock::now();

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

	solve();
	//}



	auto t2 = std::chrono::high_resolution_clock::now();
	auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();

	cerr << "\n\nTime taken : " << FormulaToConvertMicrosecondsToSeconds(duration) << " secs" << nl;
	return 0;
}

void solve() //Task A. Double Cola!!! Two teams composing !
{

	unsigned ll n, s; cin >> n >> s;
	if (s >= n) {
		cout << 0; return;
	}
	else if (s == 0)
	{
		unsigned ll ans = 0;
		while (n--)
		{
			unsigned ll e; cin >> e;
			ans += e;
		}
		cout << ans;
	}
	else
	{
		vector<unsigned ll>v(n);
		unsigned ll ans = 0;
		for (ll i = 0; i < n; ++i)
		{
			cin >> v[i];
		}

		sortv(v);

		unsigned ll sum = 0;
		for (int i = 0; i < n - s; ++i)
		{
			sum += v[i];
		}
		cout << sum;
	}

} // !solve


/* TESTS:


*/

Measured memory_bytes: 4812
package main

import (
	"fmt"
)

func main() {
	var A, B int
	var S string
	fmt.Scan(&A, &B)
	fmt.Scan(&S)
	if S[A] != '-' {
		fmt.Println("No")
		return
	}
	s := []string{S[0:A], S[A+1:]}
	for _, v := range s[0] {
		if v < '0' || '9' < v {
			fmt.Println("No")
			return
		}
	}
	for _, v := range s[1] {
		if v < '0' || '9' < v {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


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

using namespace std;

int main(){
	int count=0;
	string W,word;
	cin >> W;
	int size=W.size();
	for(int i=0;i<size;i++){
		W[i]=toupper(W[i]);
	}
	while(1){
		cin >> word;
		if(word == "END_OF_TEXT") break;
		int size=word.size();
		for(int i=0;i<size;i++){
			word[i]=toupper(word[i]);
		}
		if(word == W) count++;
	}
	cout << count << endl;
	return 0;
}

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

int main() {
	int n,k;
	cin>>n>>k;
	long long x[n];
	for(int i =0;i<n;i++)
		cin>>x[i];
		
	long long ans = 10e16;	
	for(int l =0;l<n-k+1;l++)
	{
		int r = l+k-1;
		ans = min(ans,min(abs(x[l])+abs(x[l]-x[r]),abs(x[r])+abs(x[l]-x[r])));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
n=int(input())
arr=[int(i) for i in input().split()]
def sumXOR(arr, n):
    MOD=int((1e+9)+7)
    sum = 0
    for i in range(0, 62): 
        zc = 0
        oc = 0
        idsum = 0
        for j in range(0, n): 
            if (arr[j] % 2 == 0): 
                zc = zc + 1
            else: 
                oc = oc + 1
            arr[j] = arr[j]//2
        idsum = oc * zc * (1 << i) 
        sum = (sum + idsum)%MOD
    return sum

ans = sumXOR(arr, n); 
print (ans)

Measured memory_bytes: 125624
N, S = map(int, input().split())
A = [int(i) for i in input().split()]

mod = 998244353

dp = [0] * (S + 1)
dp[0] = 1
for a in A :
  for i in range(S, -1, -1) :
    if i >= a :
      dp[i] = dp[i] * 2 + dp[i - a]
    else :
      dp[i] = dp[i] * 2
    dp[i] %= mod
print(dp[-1])

Measured memory_bytes: 68452
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, i, j, k, x, c1, c2, c;
	cin >> n >> m >> x;
	c1 = 0; c2 = 0;
	for (i = 0; i < m; i++) {
		cin >> c;
		if (c < x) c1++;
		if (c > x) c2++;
	}
	cout << min(c1, c2) << "\n";

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        var N = long.Parse(Console.ReadLine());
        var a = 1L;
        var b = 1L;
        for(var i = 0;i < N;i++){
            var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            if(s[0] < a || s[1] < b){
                var c = Math.Max(a / s[0] + (a % s[0] == 0 ? 0 : 1),b / s[1] + (b % s[1] == 0 ? 0 : 1));
                a = s[0] * c;
                b = s[1] * c;
            }else{
                a = s[0];
                b = s[1];
            }
        }
        
        Console.WriteLine(a + b);
        
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#define f first
#define s second
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define rn return
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;



int main(){
    ll N,M; cin >> N >> M;
    vector<P> keys;
    rep(i,M) {
        int a,b; cin >> a >> b;
        int k = 0;
        rep(j,b) {
            int c; cin >> c; c--;
            k |= (1<<c);
        }
        keys.emplace_back(P(k,a));
    }
    int INF = 1e9;
    vector<int> dp(1<<N,INF);
    dp[0] = 0;
    rep(i,M){
        rep(j,1<<N){
            dp[j|keys[i].f] = min(dp[j|keys[i].f],dp[j]+keys[i].s);
        }
    }
    if (dp[(1<<N)-1] == INF) dp[(1<<N)-1] = -1;
    cout << dp[(1<<N)-1] << endl;
    rn 0;
}

Measured memory_bytes: 256
/*
 * SortingThreeNumbers.cpp
 *
 *  Created on: 2014/07/21
 *      Author: WanWan1985
 */
#include <iostream>
using namespace std;

int main(void) {

	int a, b, c = 0;
	cin >> a >> b >> c;
	int iArray[] = {a, b, c};

	for (int i = 0; i < 2; i++) {
		for (int j = i + 1; j < 3; j++) {
			if (iArray[i] > iArray[j]) {
				int itmp = iArray[i];
				iArray[i] = iArray[j];
				iArray[j] = itmp;
			}
		}
	}

	cout << iArray[0] << " " << iArray[1] << " " << iArray[2] << endl;
	return 0;
}

Measured memory_bytes: 1164
import sys
input = sys.stdin.buffer.readline
import numpy as np

def main():
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    f = list(map(int,input().split()))
    a.sort()
    f.sort(reverse=True)

    if sum(a) <= K:
        print(0)
    else:
        a = np.array(a)
        f = np.array(f)
        left,right = 0,max(a)*max(f)
        while right-left > 1:
            mid = (left+right)//2
            pra = a-mid//f
            pra[pra<0] = 0
            if np.sum(pra) > K:
                left = mid
            else:
                right = mid
        print(right)

if __name__ == "__main__":
    main()


Measured memory_bytes: 38924
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;

int main()
{
    int N, M;

    vector<int> room;
    vector<vector<int>> path(100001);
    queue<int> list;

    room.reserve(100001);

    cin >> N >> M;

    vector<int> mark(N + 1, 0);

    for (int i = 0; i < M; i++)
    {
        int tmpa, tmpb;
        cin >> tmpa >> tmpb;
        path[tmpa].push_back(tmpb);
        path[tmpb].push_back(tmpa);
    }

    list.push(1);
    while (!list.empty())
    {
        int tmp = list.front();
        list.pop();
        for (int x : path[tmp])
        {
            if (mark[x] == 0)
            {
                list.push(x);
                mark[x] = tmp;
            }
        }
    }

    for (int i = 1; i <= N; i++)
    {
        if (mark[i] == 0)
        {
            cout << "No";
            return 0;
        }
    }

    cout << "Yes" << endl;
    for (int i = 2; i <= N; i++)
        cout << mark[i] << endl;

    return 0;
}


Measured memory_bytes: 10204
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect
import statistics
mod = 10**9+7

def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f

def bit(S, j):
    # Sの右からj bit目(0-indexed)
    return (S>>j)&1

N = int(input())
a = [[] for i in range(N)]
for i in range(N):
    a[i] = list(map(int, input().split()))

dp = [0 for i in range(1<<N)]
dp[0] = 1

for S in range(1,1<<N):
    i = popcount(S)
    for j in range(N):
        if bit(S,j) == 1 and a[i-1][j] == 1:
            dp[S] = (dp[S] + dp[S^(1<<j)]) % mod

print(dp[(1<<N)-1] % mod)

Measured memory_bytes: 214684
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<stack>
#include<set>
#include<sstream>
#include<fstream>
using namespace std;

const double pi=4*atan(1.0);

constexpr long long mod=static_cast<long long>(1e9+7);

using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;

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

	double x = (sqrt(8.*(double)(N)+1) - 1.) / 2.;
	int L = ceil(x);
	for(int i = L; i > 0; --i){
		if(N - i >= 0){
			cout << i << "\n";
			N -= i;
		}
	}

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;
    int even_ans = 1, odd_ans = 1;
    
    for(int i=1; i<S.size(); i+=2){
        if(S[i] == 'R'){
            even_ans = 0;
        }
    }

    for(int i=0; i<S.size(); i+=2){
        if(S[i] == 'L'){
            odd_ans = 0;
        }
    }

    if(even_ans == 1 and odd_ans == 1){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

    return 0;
}

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

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int n, h, k;
int dp[100001];
vi heights;

int calc(int i){
	if(dp[i]!=-1) return dp[i];
	if(i==n-1) return 0;
	int ans=1e9;
	rep(j, 1, min(n-1-i, k)){
		ans=min(ans, calc(i+j)+abs(heights[i]-heights[i+j]));
	}
	return dp[i]=ans;
}

int main(){
  // freopen("input.txt", "r", stdin); 
  // freopen("output.txt", "w", stdout);
  cin.sync_with_stdio(0); cin.tie();
  cin.exceptions(cin.failbit);

  cin >> n >> k;
  rep(i, 1, n){
  	cin >> h;
  	heights.pb(h);
  }
  rep(i, 0, n) dp[i]=-1;
  cout << calc(0);
}

Measured memory_bytes: 11984
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <vector>
#include <bitset>
#include <stack>
#include <iomanip>
#include <set>
#include <queue>
#include <map>


typedef long long ll;
typedef unsigned long long ull;
#define mk make_pair
#define mkt make_tuple
#define fi first
#define se second


using namespace std;
int const N = 200005;
ll const MOD = 1e9 + 7;
pair<ll, ll> a[N];

int main()
{
	ll n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].se >> a[i].fi;
	}
	sort(a, a + n);
	bool isValid = true; ll time = 0;
	for (int i = 0; i < n; i++) {
		time += a[i].second;
		if (time > a[i].first)
			isValid = false;
	}

	if (!isValid) cout << "No";
	else cout << "Yes";
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#include<algorithm>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;
int main()
{
    fast_io
    ll t,i,j,n,a,b,x,ans=0;
    cin>>a>>b>>x;
    ans=(b/x)-(a/x);
    if(a%x==0) ans++;
    cout<<ans<<endl;

    return 0;
}





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

using namespace std;

int main() {
    int N;
    int A[200];
    int num_count = INT_MAX;

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

    for (int i = 0; i < N; i++) {
        int count = 0;
        while (1) {
            if (A[i] % 2 != 0) {
                break;
            }
            A[i] /= 2;
            count++;
        }
        num_count = min(num_count, count);
    }
    cout << num_count << endl;

    return 0;
}



Measured memory_bytes: 256
# ARC059C - いっしょ / Be Together (ABC043C)
n = int(input())
lst = list(map(int, input().rstrip().split()))
ans = float("inf")
MIN, MAX = min(lst), max(lst)

if MIN == MAX:
    print(0)
else:
    for i in range(MIN, MAX + 1):
        cnt = 0
        for j in lst:
            cnt += (i - j) ** 2
        ans = min(ans, cnt)
    print(ans)

Measured memory_bytes: 3060
///In the name of Almighty Allah(swt).

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int n,i,a=0,w=0,t=0,r=0;
    cin>>n;
    string s[n];
    for(i=0; i<n; i++)
    {
        cin>>s[i];
    }
    for(i=0; i<n; i++)
    {
        if(s[i] == "AC")
            a++;
        else if(s[i] == "TLE")
            t++;
        else if(s[i] == "WA")
            w++;
        else if(s[i] == "RE")
            r++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<w<<endl;
    cout<<"TLE x "<<t<<endl;
    cout<<"RE x "<<r<<endl;



    return 0;
}


Measured memory_bytes: 6728
#include <string>
#include <iostream>
using namespace std;
int a,b;
string u;
string s,t;
int main(){
	cin>>s>>t>>a>>b>>u;
	if (u==s){
		--a;
	}
	else{
		--b;
	}
	cout<<a<<' '<<b;
	return 0;
}


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

using namespace std;

string expr(const string& S, long long i) {
    string e;
    for (int j = 0; j < S.size() - 1; ++j) {
        e += S[j];
        if ((i >> j) & 1) {
            e += "+";
        }
    }
    e += S[S.size() - 1];
    return e;
}

long long eval(const string& expr) {
    long long r = 0;
    string buf;
    for (int i = 0; i < expr.size(); ++i) {
        if (expr[i] == '+') {
            r += stol(buf);
            buf.clear();
        }
        buf += expr[i];
    }
    r += stol(buf);
    return r;
}

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

    long long ans = 0;
    for (int i = 0; i < (1 << (S.size() - 1)); ++i) {
        ans += eval(expr(S, i));
    }
    cout << ans << endl;
}


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

int main () {
    unsigned int N, D, X;
    cin >> N >> D >> X;

    unsigned int A[N];
    unsigned int prepared_chocolates = 0;
    for (unsigned int i = 0; i < N; ++i) {
        cin >> A[i];
        unsigned int ate_chocolates_i = ((D - 1) / A[i]) + 1;
        prepared_chocolates += ate_chocolates_i;
    }
    prepared_chocolates += X;

    cout << prepared_chocolates;

    return 0;
}

Measured memory_bytes: 256
X = int(input())
def primeCheck(n):
    if n==2:
        return True
    for divisor in range(2, int(n**(0.5)+1)):
        if n % divisor == 0:
            return False
    return True
while(True):
    if primeCheck(X):
        print(X)
        break
    X += 1

Measured memory_bytes: 3060