akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

//MOD,および逆元テーブルの作成
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();
    long long N,K;
    cin>>N>>K;
    vector<long long> A;
    long long a;
    for(int i=0;i<N;++i){
      cin>>a;
      A.push_back(a);
    }
    std::sort(A.begin(),A.end());
    // 計算例
    long long ans=0;
    long long tmp;
    for(long long i=1;i<N+1;++i){
      if(N-i>=K-1){
        //Aiが一番小さくなるような組み合わせの数
        tmp=COM(N-i,K-1);
        ans-=(tmp*A[i-1]);
        ans%=MOD;
      }
      if(i-1>=K-1){
        //Aiが一番大きくなるような組み合わせの数
        tmp=COM(i-1,K-1);
        ans+=(tmp*A[i-1]);
        ans%=MOD;
      }
    
    }
    ans%=MOD;
    if(ans<0){
      ans+=MOD;
    }
    cout<<ans<<"\n";
    return 0;
}

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

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

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int main(){
    int a,b;
    cin>>a>>b;
    cout << (a<=5 ? 0 : (a<=12 ? b/2 : b)) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
    static Scanner scan = new Scanner(System.in);
     
    public static void main(String[] args){
        int a,b,c;
        int tmp;
         
        a = scan.nextInt();
         b = scan.nextInt();
        c = scan.nextInt();
//      a = Integer.parseInt(args[0]);
//      b = Integer.parseInt(args[1]);
//      c = Integer.parseInt(args[2]);
 
         
         
        if(a > b){
 
            tmp = a;
            a = b;
            b = tmp;
        }if (a > c){
            tmp = a;
            a = c;
            c = tmp;
        }
        if(b > c){
            tmp = b;
            b = c;
            c = tmp;
        }
        System.out.println(a+" "+b+" "+c);
     
    }
 
}



Measured memory_bytes: 26016
#include<bits/stdc++.h>
using namespace std;
int dist[1010][1010],H,W;
queue<int> q;
const int dx[]={0,0,1,-1},dy[]={-1,1,0,0};
int getfront()
{
	int res=q.front();
	q.pop();
	return res;
}
int main()
{
	cin>>H>>W;
	for(int i=0;i<H;i++)
	{
		string s;
		cin>>s;
		for(int j=0;j<W;j++)
			if(s[j]=='#')
			{
				dist[i][j]=1;
				q.push(i);
				q.push(j);
			}
	}
	while(!q.empty())
	{
		int x=getfront(),y=getfront();
		for(int i=0;i<4;i++)
		{
			int tox=x+dx[i],toy=y+dy[i];
			if(tox<0||tox>=H||toy<0||toy>=W||dist[tox][toy])
				continue;
			dist[tox][toy]=dist[x][y]+1;
			q.push(tox);
			q.push(toy);
		}
	}
	int B=-1;
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			B=max(B,dist[i][j]);
	cout<<B-1<<endl;
	return 0;
}

Measured memory_bytes: 12432
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N = sc.nextInt();
	static int H = sc.nextInt();
	static int W = sc.nextInt();
	static int[] a = new int[N];
	static int[] b = new int[N];
	public static void main(String[] args) {
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		int ans = 0;
		for (int i = 0; i < N; i++) {
			if (a[i] >= H && b[i] >=W) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 25776
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
//#define ordered_set         tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
/*

    order_of_key (k) : Number of items strictly smaller than k .
    find_by_order(k) : K-th element in a set (counting from zero).

*/
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 3e18;

/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
signed main()
{
    FastIO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        int x;
        cin>>x;
        int ans =0;
        int i=1;
        while(1)
        {
            int val = 360*i;
            if(val%x==0)
            {
                cout<<val/x<<"\n";
                break;
            }
            i++;
        }
        
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||

|| A year from now you may wish you had started today ||
*/



Measured memory_bytes: 3636
#include<stdio.h>
int main(void)
{
	int a,b,i,s,ss;
	scanf("%d",&b);
	while(b!=0){
	ss=0;
	for(i=0;i<9;i++){
		scanf("%d",&a);
		ss+=a;
	}
	s=b-ss;
	printf("%d\n",s);
	scanf("%d",&b);
	}
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 
typedef long long ll;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define DBGV(v,n) forn(i,n) cout << v[i] << " "; cout << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl

double solve(vector <double> v, int n)
{
	vector < vector <double> > dp(n+5,vector<double>(n+5,0));
	dp[0][0]=1-v[0]; dp[0][1]=v[0];
	forr(i,1,n)
	{
		forn(j,i+2)
		{
			//DBG(i); DBG(j);
			if(j==0)
			{
				dp[i][j]=dp[i-1][j]*(1-v[i]); 
				//DBG(dp[i][j]);
				continue;
			}
			dp[i][j]=dp[i-1][j-1]*v[i]+dp[i-1][j]*(1-v[i]);
			//DBG(dp[i][j]);
		}
	}
	double ans = 0;
	forr(i,(n+1)/2,n+1)
	{
		ans+=dp[n-1][i];
	}
	return ans;
} 
 
int main()
{ 
	FIN;
	
	#ifdef input
		freopen("test3.txt", "r", stdin);
	#endif
	
	int n;
	cin >> n;
	vector <double> v(n);
	forn(i,n) cin >> v[i];
	cout << fixed << setprecision(12) << solve(v,n) << endl;
	return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void SMTB2019A()
{
	int m1, m2, d1, d2;
	cin >> m1 >> d1;
	cin >> m2 >> d2;
	if (d2 == 1)
	{
		cout << "1" << endl;
	}
	else
	{
		cout << "0" << endl;
	}
}

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

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const int inf = 1 << 30;

int main(void){
	int n,k;
	cin >> n >> k;
	vector<int> h(n);
	rep(i,n) cin >> h[i];

	vector<int> dp(n, inf);
	dp[0] = 0;
	rep(i,n)rep(j,1,k+1){
		if(i + j < n){
			chmin(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
		}
	}
	cout << dp[n-1] << endl;

	return 0;
}

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

int solve_any(int w, vector<int> a){
    vector<int> dp(w+1, 0);
    dp[0] = 1;
    for(int i=0; i<w; i++){
        for(int e: a){
            if(i+e > w) continue;
            dp[i+e] += dp[i];
        }
    }
    return dp[w];
}
int solve_alter(int w, vector<vector<int>> a){
    vector<vector<int>> dp(2, vector<int>(w+1,0));
    for(int d=0; d<2; d++){
        for(int e: a[d]){
            if(e > w) continue;
            dp[d][e] = 1;
        }
    }
    for(int i=0; i<w; i++){
        for(int d=0; d<2; d++){
            for(int e: a[d]){
                if(i+e > w) continue;
                dp[d][i+e] += dp[1-d][i];
            }
        }
    }
    return dp[0][w] + dp[1][w];
}

int main(){
    while(1){
        int h,w;
        cin >> h >> w;
        if(h == 0) break;

        if(h > w) swap(h, w);
        if(h == 1){
            cout << 1 - w%2 << endl;
        }else if(h == 2){
            vector<int> a(w);
            for(int i=0; i<w; i++) a[i]=i+1;
            cout << solve_alter(w, {a, {2}}) << endl;
        }else if(h%2 == 0){
            cout << solve_alter(w, {{1}, {h-2, h}}) << endl;
        }else{
            cout << 2*solve_any(w, {h-1, h+1}) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3012
//Name: Programming Contest Challenge Book
//Level: 3
//Category: 数学,Math,考察
//Note:

/**
 * 棒を長さの降順でソートしてから考える。
 * 以下、三角形の辺に関して長い方からp,q,rと呼ぶことにする。
 *
 * 三角形を1つ作るとき、棒iを辺pとして採用すると、三角不等式のうちp+q>rとp+r>qが満たされることは自明である。
 * q+r>pであるためにはbとcを可能な限り大きく取ればよいから、結局棒i+1とi+2を加えて三角形を構成できなければ、棒iを辺pとした三角形は構成できないことがわかる。
 *
 * この考察から、連続する3辺で三角形が作れるかを考えながら貪欲に構成していくという方法が思いつくが、これでは3 3 2 2 1 1のような列のときにうまくいかない。
 * すなわち、a_{i+3}≧a_{i+4}+a_{i+5}であるが、2つの三角形に割り当てる順番をうまく入れ替えてやるとちょうど割り当てられる場合である。
 * このような場合は、棒iから連続する6つの棒だけを使って2つの三角形を構成しないと意味がないため、全探索すればよい
 * （周長を最大化する制約から、この6つよりも短い棒を使っている場合、iを超えない範囲で長い棒に入れ替えることは安全であり、かつ得をする）。
 *
 * オーダーは O(N log N)。
 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;

bool solve() {
    int N;
    if(!(cin >> N)) return false;

    vector<long long> as(N);
    for(int i = 0; i < N; ++i) {
        cin >> as[i];
    }
    sort(begin(as), end(as), greater<long long>());

    typedef vector<int> Choice;
    vector<pair<Choice,Choice>> choose_3;
    for(int pat = 0; pat < (1<<6); ++pat) {
        if(__builtin_popcount(pat) != 3) continue;
        Choice c1, c2;
        for(int i = 0; i < 6; ++i) {
            if(pat & (1<<i)) c1.push_back(i);
            else c2.push_back(i);
        }
        choose_3.emplace_back(c1, c2);
    }

    long long ans = 0;
    int composed = 0;
    for(int i = 0; i <= N-3; ++i) {
        // Check if all 6 sticks can be used
        if(composed == 0 && i <= N-6) {
            for(auto pat : choose_3) {
                const auto &c1 = pat.first;
                const auto &c2 = pat.second;
                if(as[i+c1[0]] < as[i+c1[1]]+as[i+c1[2]] && as[i+c2[0]] < as[i+c2[1]]+as[i+c2[2]]) {
                    ans = accumulate(begin(as)+i, begin(as)+i+6, 0LL);
                    composed = 2;
                    goto end;
                }
            }
        }
        // Check if 3 sticks can be used
        if(as[i] < as[i+1] + as[i+2]) {
            ans += as[i]+as[i+1]+as[i+2];
            if(++composed == 2) break;
            i += 2;
        }
    }
end:
    if(composed != 2) ans = 0;
    cout << ans << endl;
    return true;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 1788
program test 
implicit none
integer::n,k,d,i,j,ans
integer,allocatable::a(:),e(:)
read*,n,k
allocate(a(n))
allocate(e(n))
a=0
ans=0
do i=1,k
	e=0
	read*,d
   	read(5,*)(e(j),j=1,d)
    do j=1,d
        a(e(j))=a(e(j))+1
    end do
end do
do i=1,n
	if(a(i)==0)then
    	ans=ans+1
    else 
    	ans=ans
 	end if
end do
print*,ans
end program test

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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




LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)x += mod1;
    return x;
}

const LL mod=1e9+7;
LL bigmod(LL p, LL q) {
  LL res = 1ll;
  while(q) {
    if(q & 1ll) {
      res = (res * p) % mod;
    }
    q >>= 1;
    p = (p * p) % mod;
  }
  return res;
}
LL mod_inverse(LL x) {
  return bigmod(x, mod - 2);
}
LL a[100002],fact[100002];

void find_fact()
{
    LL i;
    fact[0]=1LL;
    for(i=1LL;i<=100000;i++)fact[i]=(fact[i-1]*i)%mod;
}

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    find_fact();
    LL i,k,n,ans=0LL;
    cin >> n >> k;
    for(i=1;i<=n;i++)cin >> a[i];
    sort(a+1,a+n+1,greater<LL>());
    for(i=1;i<=n;i++)
    {
        if(i <= n - k + 1) {
          LL p = mod_inverse(fact[n - i - (k - 1)]);
          LL q = mod_inverse(fact[k - 1]);
          LL down = (p * q) % mod;
          down = (a[i] * down) % mod;
          ans = (ans + down * fact[n - i]) % mod;
          if(ans < 0) ans += mod;
        }
        if(i >= k) {
          LL p = mod_inverse(fact[i - 1 - (k - 1)]);
          LL q = mod_inverse(fact[k - 1]);
          LL down = (p * q) % mod;
          down = (a[i] * down) % mod;
          ans = (ans - down * fact[i - 1]) % mod;
          if(ans < 0) ans += mod;
        }
    }
    if(ans < 0) ans += mod;
    cout << ans;
    return 0;
}

Measured memory_bytes: 1792
def lower(n, hli):

    hli.reverse()
    ans = 0
    count = 0

    for i in range(n-1):
        if hli[i] <= hli[i+1]:
            count += 1
            ans = max(ans, count)
        else:
            ans = max(ans, count)
            count = 0

    return ans

def main():
    n = int(input())
    hli = list(map(int, input().split()))
    print(lower(n, hli))

if __name__ == '__main__':
    main()

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n,h,w,cnt=0; cin>>n>>h>>w;
    rep(i,n){
        ll a,b; cin>>a>>b;
        if(a>=h && b>=w) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3516
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL
struct PrettyOS {
    ostream& os;
    bool first;
    template <class T> auto operator<<(T&& x) {
        if (!first) os << ", ";
        first = false;
        os << x;
        return *this;
    }
};
template <class... T> void dbg0(T&&... t) {
    (PrettyOS{cerr, true} << ... << t);
}
#define dbg(...)                                            \
    do {                                                    \
        cerr << __LINE__ << " : " << #__VA_ARGS__ << " = "; \
        dbg0(__VA_ARGS__);                                  \
        cerr << endl;                                       \
    } while (false);
#else
#define dbg(...)
#endif

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

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

struct UnionFind {
    V<int> p, r;
    int gn;
    UnionFind(int n = 0) : p(n, -1), r(n, 1), gn(n) {}
    void merge(int a, int b) {
        int x = group(a), y = group(b);
        if (x == y) return;  // same
        gn--;
        if (r[x] < r[y]) {
            p[x] = y;
        } else {
            p[y] = x;
            if (r[x] == r[y]) r[x]++;
        }
    }
    int group(int a) {
        if (p[a] == -1) return a;
        return p[a] = group(p[a]);
    }
    bool same(int a, int b) { return group(a) == group(b); }
};

void ok() {
    cout << "Yes" << endl;
    exit(0);
}

void kmzk() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    using P = pair<int, int>;
    V<P> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i].first;
        b[i].second = i;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    for (int i = 0; i < n; i++) {
        if (a[i].first > b[i].first) kmzk();
    }

    for (int i = 0; i < n - 1; i++) {
        if (a[i + 1].first <= b[i].first) ok();
    }
    auto uf = UnionFind(n);
    for (int i = 0; i < n; i++) {
        uf.merge(a[i].second, b[i].second);
    }
    if (uf.gn != 1) ok();
    kmzk();
    return 0;
}


Measured memory_bytes: 2560
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	if a >= b {
		if a >= c {
			fmt.Println(b + c)
		} else {
			fmt.Println(a + b)
		}
	} else {
		if b >= c {
			fmt.Println(a + c)
		} else {
			fmt.Println(a + b)
		}
	}
}


Measured memory_bytes: 512
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

using ll = long long int;
using namespace std;

int init_BIT(std::vector<long long int> &BIT, int N_MAX);
int add_num(std::vector<long long int> &BIT, long long int N_MAX, long long int index, long long int d);
long long int cumulative_sum(std::vector<long long int> &BIT, long long int r);


int main(){

  // read problem
  ll N, tmp;
  cin >> N;
  vector<ll> P(N), P_inv(N);
  
  for(ll i = 0; i < N; i++){
    cin >> tmp;
    P[i] = tmp-1;
    P_inv[tmp-1] = i;
  }

  // prepare BIT  
  long long int N_MAX = 1<<18; 
  std::vector<long long int> BIT(N_MAX);
  
  // solve problem
  ll L1, L2, R1, R2, l, r, mid, sumtmp;
  ll ans = 0;

  for(ll i = N-1; i >= 0; i--){
    //cerr << "i = " << i << endl;

    // update count
    add_num(BIT, N_MAX, P_inv[i], 1);
    sumtmp = cumulative_sum(BIT, P_inv[i]);

    // determine L2
    if(sumtmp == 1){
      L2 = -1;
    }
    else{
      r = P_inv[i]-1;
      l = -1;
      while(r-l > 1){
        mid = (r+l)/2;
        if(cumulative_sum(BIT, mid) == sumtmp-1){
          r = mid;
        }
        else{
          l = mid;
        }
      }
      L2 = r;
    }

    // determine L1
    if(sumtmp <= 2){
      L1 = -1;
    }
    else{
      r = L2-1;
      l = -1;
      while(r-l > 1){
        mid = (r+l)/2;
        if(cumulative_sum(BIT, mid) == sumtmp-2){
          r = mid;
        }
        else{
          l = mid;
        }
      }
      L1 = r;
    }

    // determine R1
    if(N-i - sumtmp == 0){
      R1 = N;
    }
    else{
      r = N-1;
      l = P_inv[i];
      while(r-l > 1){
        mid = (r+l)/2;
        if(cumulative_sum(BIT, mid) == sumtmp){
          l = mid;
        }
        else{
          r = mid;
        }
      }
      R1 = r;
    }
    // determine R2
    if(N-i - sumtmp <= 1){
      R2 = N;
    }
    else{
      r = N-1;
      l = R1;
      while(r-l > 1){
        mid = (r+l)/2;
        if(cumulative_sum(BIT, mid) == sumtmp+1){
          l = mid;
        }
        else{
          r = mid;
        }
      }
      R2 = r;
    }

    //cerr << L1 << " " << L2 << " " << R1 << " " << R2 << " " << endl;
    // update answer
    ans += (i+1)*((P_inv[i]-L2) * (R2-R1) + (L2-L1)*(R1-P_inv[i]));
    //cerr << ans << endl;
  }

  cerr << "Answer: " << endl;
  cout << ans << endl;

  return 0;
}


int add_num(std::vector<long long int> &BIT, long long int N_MAX, long long int index, long long int d){
  index ++;
  while(index < N_MAX){
    BIT[index-1] += d;
    index += (index & -index);
  }
  
  return 0;
}

long long int cumulative_sum(std::vector<long long int> &BIT, long long int r){
  // sum of no elements
  if(r == -1){
    return 0;
  }
  
  r++;
  long long int sum = 0;
  while(r > 0){
    sum += BIT[r-1];
    r -= (r & -r);
  }
  
  return sum;
}



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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define inf 100000000000010
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool isprime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

struct CustomCompare
{
    bool operator()(const int& lhs, const int& rhs)
    {
        return lhs < rhs;
    }
};

bool comp(pair<ll, ll>a,pair<ll,ll>b)
{
    return a.fi>=b.fi;
}

ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}

ll addmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
/*
const int mxn = 5*(1e6) +10;
vi spf(mxn);
void sieve()
{
    for(ll i =0;i<mxn;i++)spf[i]  = i;
    for(ll i=2;i<mxn;i+=2)spf[i] = 2;
    for(ll i = 3;i*i<mxn;i++)
    {
        if(spf[i]==i)
        {
            for(ll j = i*i;j<mxn;j+=i)
            {
                if(spf[j]==j)spf[j] = i;
            }
        }
    }
}
*/




int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll n,x,t; cin>>n>>x>>t;
ll res = 0 , ans = 0;
while(res<n)
{
    ans+=t;
    res+=x;
}
cout<<ans<<endl;
return 0;

}
/*
1
4
1 2
2 3
3 4
2
2 2
*/


Measured memory_bytes: 3636
N = int(input()) #1行目のNを取得する
num_list = [input() for i in range(N)] #複数行の数値の入力を取得

num_list.sort(reverse = True)
result = 0

for i in range(N):
    if i == 0:
        result += 1
    else:
        if num_list[i] != num_list[i-1]:
            result += 1

print(result)


Measured memory_bytes: 2940
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    };
    println!("{}", s.chars().filter(|&c| c == '1').count());
}


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

int main() {
  int n; cin >> n;
  vector<int>A(n);
  rep(i,n) cin >> A[i];
  sort(A.begin(),A.end());
  rep(i,n-1){
    if(A[i]==A[i+1]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  double a,b,c,d,e,f;
  /*double t[2];
  bool dp[5][3500];*/
  cin >>a>>b>>c>>d>>e>>f;
  ll k=f/(100*a);
  double ans=-1,h=100;
  ll sa=0,wa=100*a;
  for(ll i=0;i<=k;i++){
    ll l=(f-i*100*a)/b;
   for(ll j=0;j<=l;j++){
     if(i==j&&i==0) continue;
     double w=100*i*a+100*j*b;
     double s=f-w,q=(w/100)*e;
     if(s<q) q=s;
     ll p=q/c;
     for(ll k=0;k<=p;k++){
       ll u=(q-k*c)/d;
       for(ll e=0;e<=u;e++){
         double ss=k*c+e*d;
         double no=(h*ss)/(w+ss);
         if(no>ans){
           ans=no;
           sa=ss;
           wa=w;
         }
       }
     }
   }
  }
  cout <<sa+wa<<" "<<sa<<endl;
}


Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

int n, a, b;

bool read() {
  if (scanf("%d%d%d", &n, &a, &b) < 3) {
    return false;
  }
  return true;
}

int delBit(int x, int bit) {
  return (x & ((1 << bit) - 1)) + ((x >> (bit + 1)) << bit);
}

int addBit(int x, int bit, int val) {
  return (x & ((1 << bit) - 1)) + (val << bit) + ((x >> bit) << (bit + 1));
}

vector<int> rec1(int n, int a) {
  if (n == 1) {
    return {a, a ^ 1};
  }
  int bit = 0;
  vector<int> l = rec1(n - 1, delBit(a, bit));
  for (int i = 0; i < sz(l); i++) {
    l[i] = addBit(l[i], bit, ((a >> bit) & 1));
  }
  int c = l.back();
  c ^= (1 << bit);
  vector<int> r = rec1(n - 1, delBit(c, bit));
  for (int i = 0; i < sz(r); i++) {
    r[i] = addBit(r[i], bit, ((c >> bit) & 1));
  }
  vector<int> res = l;
  for (int i = 0; i < sz(r); i++) {
    res.push_back(r[i]);
  }
  return res;
}

vector<int> rec(int n, int a, int b) {
  if (n == 1) {
    return {a, b};
  }
  int bit = 0;
  while ((a & (1 << bit)) == (b & (1 << bit))) {
    bit++;
  }
  vector<int> l = rec1(n - 1, delBit(a, bit));
  for (int i = 0; i < sz(l); i++) {
    l[i] = addBit(l[i], bit, ((a >> bit) & 1));
  }
  int c = l.back();
  c ^= (1 << bit);
  vector<int> r = rec(n - 1, delBit(c, bit), delBit(b, bit));
  for (int i = 0; i < sz(r); i++) {
    r[i] = addBit(r[i], bit, ((b >> bit) & 1));
  }
  vector<int> res = l;
  for (int i = 0; i < sz(r); i++) {
    res.push_back(r[i]);
  }
  return res;
}

void solve() {
  if (!(__builtin_popcount(a ^ b) & 1)) {
    printf("NO\n");
    return;
  }
  vector<int> ans = rec(n, a, b);
  printf("YES\n");
  for (int i = 0; i < sz(ans); i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 1632
import sys
input = sys.stdin.readline
H, W = map(int,input().split())
S = [ str(input()) for i in range(H) ]
sumlist = []
for i in range(H):
    tmp = 0
    for j in range(W):
        if S[i][j] == '#':
            for k in range(tmp):
                sumlist.append(tmp)
            sumlist.append(0)
            tmp = 0
            continue
        else:
            tmp += 1
    for k in range(tmp):
        sumlist.append(tmp)
sumlist2 = []
for i in range(W):
    tmp = 0
    for j in range(H):
        if S[j][i] == '#':
            for k in range(tmp):
                sumlist2.append(tmp)
            sumlist2.append(0)
            tmp = 0
            continue
        else:
            tmp += 1
    for k in range(tmp):
        sumlist2.append(tmp)
res = [sumlist[i]+sumlist2[(i%W)*H+(i//W)] for i in range(H*W)]
print(max(res)-1)


Measured memory_bytes: 281160
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        int [] freq = new int[26];
        for (int i = 0; i < word.length(); i++) {
            freq[word.charAt(i) -'a']++;
        }

        for (int i = 0; i < 26; i++) {
            if ((freq[i] & 1) != 0){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 21076
K, A, B = map(int, input().split())
if A>=B-1:
    res = 1 + K
elif K <= A:
    res = 1 + K
else:
    res = 1
    en = 0
    K -= (A+1)
    res = B# もとでから増やしてA好感してB好感した
    res += K//2 * (B-A) + K%2
print(res)

Measured memory_bytes: 3060
#include<iostream>
#include<set>
using namespace std;
int n,m;
int startPoint[28];
int endPoints[28];
int result=0;

/**判断是否所有点都遍历过,passPoint表示已经遍历过的点*/
bool allPassed(set<int> passPoint){
	for(int i =1;i<=n;i++){
		//从1到n，只要有一个在passPoint 里面不存在，说明没有都遍历过 
		if(passPoint.count(i)==0){
			return 0;
		}
	}
	return 1;
}

void printSet(set<int> s){
	set<int>::iterator iter = s.begin();
	while (iter!=s.end()){
		cout<<*iter<<"\t";
		iter++;
	}
	cout<<endl;
}
/**
往前走一步，current表示当前节点
passPoint 表示已经遍历过的点
passEdge 表示已经遍历过的边 
*/
void goOneStep(int current,set<int> passPoint,set<int>  passEdge){
	/**每走一步，需要判断当前这个点有哪些下一步可以走
		但是已经遍历过的点不能再走了
		已经用过的边，不能再走了
		往前走一步，把走过的点和边记录下来
		如果判断所有的点走过，那么就可以返回，并且结果+1
		如果没有边可以走，那么也返回，但是结果不+1 
	*/
	if(allPassed(passPoint)) {
		result ++;
		//cout << "success!\n";
		return ;
	}
	
	for(int i=0;i<m;i++){
		int next;
		if(passEdge.count(i)>0){
			//走过的边不能再走了 
			continue;
		}
		//如果开始节点和当前节点一致，那么下一步就是结束节点
		//如果结束节点和当前节点一致，那么下一步就是开始节点
		//如果都不一致，就和不在候选之列 
		if(startPoint[i]==current ){
			next=endPoints[i];
		}else if(endPoints[i] == current){
			next = startPoint[i];
		}else{
			continue;
		}
		if(passPoint.count(next)>0){
			//走过的点不能走 
			continue;
		}
		set<int> thisPassPoint =  passPoint;
		thisPassPoint.insert(next);
		set<int> thisPassEdge = passEdge;
		thisPassEdge.insert(i);
		//cout<<"from:"<<current<<"to"<<next<<endl;
		/**
		cout<<"passPoint:";
		printSet(thisPassPoint);
		cout<<"passEdge:";
		printSet(thisPassEdge);
		*/
		goOneStep(next,thisPassPoint,thisPassEdge);
	}
	
}



int main(){
	set<int> passPoint,passEdge;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin >> startPoint[i] >> endPoints[i];
	}
	passPoint.insert(1);
	goOneStep(1,passPoint,passEdge);
	cout<<result;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int main(void){
    char s[200001];
    cin>>s;
    int l=strlen(s);
    int a,t;
    for(a=0;s[a]!='A';a++);
    for(t=l-1;s[t]!='Z';t--);
    cout<<t-a+1<<endl;
}


Measured memory_bytes: 384
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]

ans = 'Yes'
t_cur, x_cur, y_cur = 0, 0, 0
for t, x, y in txy:
    d = abs(x-x_cur) + abs(y-y_cur)
    if t-t_cur >= d and ((t-t_cur)-d)%2 == 0:
        t_cur = t
        x_cur = x
        y_cur = y
    else:
        ans = 'No'
        break
    
print(ans)


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

int main()
{
    int n,i;
        scanf("%d",&n);
    char str1[n+1],str2[n+1];
    scanf("%s",str1);
    scanf("%s",str2);
    for(i=0;i<n;i++)
    {
        printf("%c%c",str1[i],str2[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=123456;
int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif*/
    int n;
    while(sf("%d",&n)==1)
    {
        int t[n+5];
        int tot=0;
        for(int i=1;i<=n;i++)sf("%d",&t[i]),tot+=t[i];

        int m;
        sf("%d",&m);
        for(int i=1;i<=m;i++)
        {
            int p,x;
            sf("%d %d",&p,&x);
            int cur=tot-t[p];
            cur+=x;
            pf("%d\n",cur);
        }
    }
    return 0;
}
 









 




























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

int main() {
	int a,b,c,d;
	int ab,cd;
	cin >> a >> b >> c >> d;
	ab=a*b;
	cd=c*d;
	if(ab>=cd){
		cout << ab;
    }
    else{
    	cout << cd;
    }
	return 0;
}

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

using ll = long long;
using namespace std;



int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    string prev="";
    string st="";
    int ans=0;
    for(int i=0; i<s.size(); ++i)
    {
        st=st +s[i];
        if (st!=prev)
        {
            ans++;
            prev=st;
            st="";
        }
    }
    cout << ans;
    return 0;
}



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

using namespace std;

int main()
{
	// 入力
	string S, T;
	cin >> S >> T;
	
	int n = S.size();

	bool bAnswer = true;
	vector<int> vecA(26, -1);
	vector<int> vecB(26, -1);

	for (int i = 0; i < n; i++)
	{
		int si = S[i] - 'a';
		int ti = T[i] - 'a';

		if (vecA[si] != -1 || vecB[ti] != -1)
		{
			if (vecA[si] != ti || vecB[ti] != si)
			{
				bAnswer = false;
				break;
			}
		}

		// 文字の値を交換する
		vecA[si] = ti;
		vecB[ti] = si;
	}

	// 出力
	if (bAnswer)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

#define MAX_N 100000
int n, m;
struct edge {
    int to, cost;
    edge(int to) : to(to) {}
};
vector<edge> G[MAX_N + 1];
int prv[MAX_N + 1];
bool seen[MAX_N + 1];

void bfs(int s) {
    queue<int> qu;
    qu.push(s);
    seen[s] = true;
    prv[s] = -1;
    while (!qu.empty()) {
        int u = qu.front();
        qu.pop();
        for (auto e : G[u]) {
            if (!seen[e.to]) {
                seen[e.to] = true;
                prv[e.to] = u;
                qu.push(e.to);
            }
        }
    }
}

int main() {
    cin >> n >> m;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(edge(b));
        G[b].push_back(edge(a));
    }
    bfs(1);
    cout << "Yes" << endl;
    repc2(i, 2, n) { cout << prv[i] << endl; }
    return 0;
}

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

using namespace std;

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

  if (a <= b) {
    for (int i = 0; i < b; i++){
      cout << a;
    }
    cout << endl;
  } else {
    for (int i = 0; i < a; i++) {
      cout << b;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
N=int(input())
cnt=0
list1=[]
for i in range(N):
  a=input().split()
  if a[0]==a[1]:
    list1.append(i)
moji=''.join(map(str, list1))
for j in range(N):
  a=str(j)+str(j+1)+str(j+2)
  if a in moji:
    cnt=1
    break
print("Yes"*cnt+"No"*(1-cnt))

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

inline int rd() {
  int x = 0;
  char c = getchar();
  while(!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
  return x;
}

ll tot, cnt[N];

inline void init() {
  int n = 1000000;
  for (int i = 1; i <= n; ++i) cnt[i] = 1;
  for (int i = 2; i <= n; ++i)
    for (int j = i; j <= n; j += i) ++cnt[j];
  for (int i = 2; i <= n; ++i) cnt[i] += cnt[i - 1];
}

int main() {
  init();
  printf("%lld\n", cnt[rd() - 1]);
  return 0;
}


Measured memory_bytes: 11556
#include<bits/stdc++.h>
using namespace std;
int a[50]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
    int k;
    cin>>k;
    cout<<a[k]<<endl;
    return 0;
}

Measured memory_bytes: 256
var
s:string;
i,l:longint;
k:int64;
f:boolean;
begin
readln(s);
read(k);
l:=length(s);
f:=true;
if k<=l then
begin
for i:=1 to k do
if s[i]<>'1' then f:=false;
if f then
begin
writeln(1);
halt;
end;
end;
for i:=1 to l do
if s[i]<>'1' then
begin
writeln(s[i]);
halt;
end;
writeln(1);
end.

Measured memory_bytes: 128
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define PER(i,a,b) for(int i=(a);i>=(b);i--)
#define RVC(i,S) for(int i=0;i<(S).size();i++)
#define RAL(i,u) for(int i=fr[u];i!=-1;i=e[i].next)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
     
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
/*============ Header Template ============*/

const int maxn=(int)(1e5)+5;
int a[maxn];

int main() {
    int n,x;
    LL res=0;
    read(n);read(x);
    REP(i,1,n) {
        read(a[i]);int tmp=0;
        if(a[i]+a[i-1]>x) tmp=a[i]+a[i-1]-x;
        res+=tmp;a[i]-=tmp;
    }
    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 640
s = input()
tmps = s
flag = 1
while len(tmps)>1:
    if tmps[0:2] == 'hi':
        tmps = tmps[2:]
    else:
        flag = 0
        tmps = tmps[2:]
if len(tmps)==1 or flag==0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 38256
import sys

def make_prime(n):
    ret=[2]
    for i in range(3,n,2):
        for j in range(3,int(i**0.5)+1):
            if i%j==0:
                break
        else:
            ret.append(i)
    return ret

q_max = 10 ** 5 + 1
primes = make_prime(q_max)
#print(primes)
c = [0 for i in range(q_max)]
csum = [0 for i in range(q_max)]
for p in primes:
    if (p+1)//2 in primes:
        c[p] = 1

for i in range(1,q_max):
    csum[i] = csum[i-1] + c[i]

ans=[]
Q = int(input())
for i in range(Q):
    l,r = map(int,sys.stdin.readline().rstrip().split())
    ans.append(csum[r]-csum[l-1])
for a in ans:
    print(a)


Measured memory_bytes: 54576
import math
a,b,x=map(int,input().split())
if x>=(a**2*b)/2:
  print(math.degrees(math.acos(a/((2*(a**2*b-x)/a**2)**2+a**2)**0.5)))
else:
  print(math.degrees(math.acos((2*x/a/b)/(((2*x/a/b)**2+b**2)**0.5))))


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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<double> point;
#define F first
#define S second

struct circle { point p; double r; };

const double eps = 1e-9;

// fix comparations on doubles with this two functions
int sign(double x) { return x < -eps ? -1 : x > eps; }

// circle-circle intersection
vector<point> intersect(circle C, circle D)
{
	double d = abs(C.p - D.p);
	if (sign(d - C.r - D.r) > 0) return {};      // too far
	if (sign(d - abs(C.r - D.r)) < 0) return {}; // too close
	double a = (C.r*C.r - D.r*D.r + d*d) / (2*d);
	double h = sqrt(C.r*C.r - a*a);
	point v = (D.p - C.p) / d;
	if (sign(h) == 0) return {C.p + v*a};         // touch
	return {C.p + v*a + point(0,1)*v*h,           // intersect
			C.p + v*a - point(0,1)*v*h};
}

int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, k;
	cin >> n >> k;
	vector<pair<point, double>> a(n);
	for (auto &i : a)
	{
		int x, y, c;
		cin >> x >> y >> c;
		i.F = { x, y };
		i.S = c;
	}

	auto f = [&](double x)
	{
		vector<point> v;
		vector<circle> c;
		for (auto i : a)
		{
			v.push_back(i.F);
			c.push_back({ i.F, x / i.S });
		}
		for (int i = 0; i < n; ++i)
			for (int j = i+1; j < n; ++j)
				for (auto z : intersect(c[i], c[j]))
					v.push_back(z);
		for (auto p : v)
		{
			int cnt = 0;
			for (auto i : c)
				cnt += abs(p - i.p) <= i.r + eps;
			if (cnt >= k)
				return true;
		}
		return false;
	};

	double l = 0, r = 1e6;
	for (int it = 200; it--; )
	{
		double md = (l + r) / 2.0;
		if (f(md))
			r = md;
		else
			l = md;
	}
	cout << setprecision(20) << fixed << l << '\n';

	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
        sc.close();
    }
}

Measured memory_bytes: 39072
#include <stdio.h>
#include <limits.h>
int main(){
	int n,m,s,i,j;
	scanf("%d%d",&n,&m);
	int e[m+1][3],dist[m+1],update=1,k,d[200][200];
	//printf("xxx");
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(i==j)d[i][j]=0;
			else d[i][j]=INT_MAX;
		}
	}
	for(i=0;i<m;i++){
		for(j=0;j<3;j++){
			scanf("%d",&e[i][j]);
		}
		d[e[i][0]][e[i][1]]=e[i][2];
	}
	for(i=0;i<n;i++){
		dist[i]=INT_MAX;
	}
	dist[s]=0;
	for(i=0;i<n-1;i++){
		update=0;
		for(j=0;j<m;j++){
			if(dist[e[j][0]]!=INT_MAX&&dist[e[j][1]]>dist[e[j][0]]+e[j][2]){
				dist[e[j][1]]=dist[e[j][0]]+e[j][2];
				update=1;
			}
		}
		if(update==0)break;
	}
	for(j=0;j<m;j++){
		if(dist[e[j][0]]!=INT_MAX&&dist[e[j][1]]>dist[e[j][0]]+e[j][2]){
			printf("NEGATIVE CYCLE\n");
			return 0;
		}
	}
	for(k=0;k<n;k++){
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				if((d[i][k]!=INT_MAX&&d[k][j]!=INT_MAX)&&d[i][j]>d[i][k]+d[k][j]){
					d[i][j]=d[i][k]+d[k][j];
				}
			}
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(j>0)printf(" ");
			if(d[i][j]==INT_MAX){
				printf("INF");
			}
			else{
				printf("%d",d[i][j]);
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1236
t = input()
c1, c2 = 0, 0
for i, s in enumerate(t):
  if i % 2 == 0:
    if s == '0':
      c1 += 1
    else:
      c2 += 1
  else:
    if s == '1':
      c1 += 1
    else:
      c2 += 1
print(min(c1, c2))

Measured memory_bytes: 3188