akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 100000000000000000
#define MOD 1000000007LL
#define MAX_V 100005
#define MAX_E 100005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef priority_queue<P> PQ;

class Edge {
public:
    ll t, w;
    Edge (ll t, ll w): t(t), w(w) {}
};

ll N;
vector<Edge> G[MAX_V];
ll d[MAX_V], color[MAX_V];
ll dis_Fen[MAX_V], dis_Snu[MAX_V];

void dijkstra(ll s) {
    ll i, u;
    for(i=0; i<N; i++) {
        d[i]=INF;
        color[i]=WHITE;
    }
    priority_queue<P> PQ;
    PQ.push(P(0, s));
    d[s]=0;
    
    while(PQ.size()) {
        P f=PQ.top(); PQ.pop();
        u=f.second;
        
        color[u]=BLACK;
        if(d[u]<f.first*(-1)) continue;
        
        for(i=0; i<G[u].size(); i++) {
            Edge &e=G[u][i];
            if(color[e.t]!=BLACK && d[e.t]>d[u]+e.w) {
                d[e.t]=d[u]+e.w;
                PQ.push(P(-d[e.t], e.t));
            }
            
        }
        
    }
    
}


void add_edge(ll s, ll t, ll w) {
    G[s].push_back(Edge(t, w));
    G[t].push_back(Edge(s, w));
}

int main(void) {
    cin >> N;
    ll a, b;
    ll i;
    
    for(i=0; i<N-1; i++) {
        cin >> a >> b;
        a--; b--;
        add_edge(a, b, 1);
    }
    
    dijkstra(0);
    for(i=0; i<N; i++) {
        dis_Fen[i]=d[i];
    }
    
    dijkstra(N-1);
    for(i=0; i<N; i++) {
        dis_Snu[i]=d[i];
    }
    
    ll fe=0, sn=0;
    for(i=0; i<N; i++) {
        if(dis_Fen[i]<=dis_Snu[i])
            fe++;
        else
            sn++;
    }
    
    if(fe>sn) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
    
}

Measured memory_bytes: 10812
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
///////////////////////___combination___////////////////////
vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll 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;
}
vector<bool> sieve(int n){
  vector<bool> is_prime(n+1, true);
  is_prime[0] = is_prime[1] = false;
  repd(i, 2, n+1){
    if(is_prime[i]){
      for(int j = 2*i;j <= n;j += i)is_prime[j] = false;
    }
  }
  return is_prime;
}
///////////////////////////////////////////////////////////
int q, r[110000];P p[110000];
vector<bool> v;
signed main(){
  cin>>q;
  rep(i,q)cin>>p[i].first>>p[i].second;
  v = sieve(110000);
  repd(i,1,110000){
    if(i % 2 == 1 && v[i] && v[(i+1)/2]){
      r[i]++;
    }
  }
  repd(i,1,110000)r[i] += r[i-1];
  rep(i,q){
    cout << r[p[i].second] - r[p[i].first-1] << endl;
  }
}




Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    int w=0,p=0,g=0,y=0;
    cin>>x;
    char a;

for(int i=0;i<x;i++)
{
    cin>>a;
    if(a=='W') w=1;
    if(a=='G') g=1;
    if(a=='Y') y=1;
    if(a=='P') p=1;


}

int sum=w+g+y+p;

if(sum==3) cout<<"Three"<<endl;
else cout<<"Four"<<endl;


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;


const int mod = 1000000007;

/* Using gfg Code */

long long moduloMultiplication(long long a,
                               long long b,
                               long long mod)
{
	long long res = 0;
	a %= mod;

	while (b)
	{

		if (b & 1)
			res = (res + a) % mod;

		a = (2 * a) % mod;

		b >>= 1;
	}

	return res;
}



int32_t main()
{

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



	int T = 1;

	while (T--)
	{

		int n;

		cin >> n;

		int arr[n];


		for (int i = 0; i < n; ++i)
			cin >> arr[i];


		int prefix_sum = 0;

		for (int i = 0; i < n; ++i)
		{
			prefix_sum += arr[i];

			prefix_sum = prefix_sum % mod;
		}



		int ans = 0;



		for (int i = 0; i < n - 1; ++i)
		{

			prefix_sum -= arr[i];

			if (prefix_sum <= 0) prefix_sum += mod;

			ans += prefix_sum * arr[i];

			ans = ans % mod;


		}


		cout << ans << endl;



	}


	return 0;


}

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

template<typename D = long long, int useAssert = 1>
class BIT{
public:
  int n;
  vector<D> bit;
  BIT():n(-1){};
  BIT(int n_){
    n=1;
    while(n < n_+2) n *= 2;
    bit.resize(n+1, 0);
  }

  //[0, i]までの総和を得る
  D sum(int i){
    if(useAssert) assert( i >= 0 && i <= n );
    i++;
    D s=0;
    while(i>0){
      s = (s + bit[i]);
      i -= i & -i;
    }
    return s;
  }

  //i番目の要素にx加算(0 オリジン)
  void add(int i, D x){
    if(useAssert) assert( i >= 0 && i <= n );
    i+=2;

    while(i <= n){
      bit[i] = (bit[i] + x);
      i += i & -i;
    }
  }

  D sum(int l, int r){ //[l, r) 0オリジン
    if(useAssert){
      assert(l <= r);
      assert( 0 <= l && l <= n);
      assert( 0 <= r && r <= n);
    }
    return sum(r) - sum(l);
  }
};

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

  BIT<long long> bit(n);
  while(q--){
    int com, x, y;
    cin>>com >> x >> y;
    if(com == 0) bit.add(x-1 , y);
    if(com == 1) cout<<bit.sum(x-1,y)<<endl;
  }


}



Measured memory_bytes: 3828
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

const double PI=3.14159265358979323846;

int main() {
    double r;
    cin >> r ;
    
   cout << setprecision(10) << fixed << 2*r*PI << endl;
	return 0;
}



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

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

    if(a==1||b==1){
        if(a>b)
            cout << "Bob";
        else if(a<b)
            cout << "Alice";
        else
            cout << "Draw";
    }
    else
    {
        if(a>b)
            cout << "Alice";
        else if(a<b)
            cout << "Bob";
        else
            cout << "Draw";
        
    }
    
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 100000000000000009
#define MOD 1000000007
#define int long long
using P = pair<int,int>;
signed main(){
  int n;
  cin >> n;
  vint A(n);
  int MAX = 0;
  rep(i,n){
    cin >> A[i];
    MAX = max(MAX,A[i]); 
  }
  int num = -INF;
  int key = -1;
  rep(i,n){
    if(A[i] != MAX){
      if(A[i] < MAX/2){
        if(num < A[i]){
          num = max(num,A[i]);
          key = A[i];
        }
      }
      else{
        if(num < MAX - A[i]){
          num = max(num,MAX - A[i]);
          key = A[i];
        }
      }
    }
  }
  cout << MAX << " " << key << endl;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			int dataSet = scanner.nextInt();
			if (dataSet == 0) {
				break;
			}
			int[] scoreArray = new int[dataSet];
			for (int i = 0; i < dataSet; i++) {
				scoreArray[i] = scanner.nextInt();
			}
			Arrays.sort(scoreArray);
			int sum = 0;
			for (int i = 1; i < scoreArray.length - 1; i++) {
				sum += scoreArray[i];
			}
			System.out.println(sum / (dataSet - 2));
		}
	}
}

Measured memory_bytes: 20928
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define INF 1e8
typedef long long int ll;
const double PI = acos(-1);

using Graph = vector<vector<int>>;
int main() {
  string s;
  cin >> s;
  if (s[s.length() - 1] == 's')
    cout << s << "es" << endl;
  else
    cout << s << 's' << endl;
}


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

using namespace std;

#define sz(x) ((int) ((x).size()))
typedef long long ll;
typedef long double ld;

ll s;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> s;
  ll l = 0, h = 1000000000;
  while (l + 1 < h) {
    ll m = (l + h) / 2;
    if (m * m < s)
      l = m;
    else
      h = m;
  }
  s -= h * h;
  s = abs(s);
  cout << 0 << " " << 0 << " " << h << " " << 1 << " " << s << " " << h << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>

using namespace std;

int main()
{
  int A,B,Q;
  cin>>A>>B>>Q;
  vector <long long> s(A), t(B);
  for(int i=0;i<A;i++){
    cin>>s[i];
  }
  for(int i=0;i<B;i++){
    cin>>t[i];
  }
  for(int i=0;i<Q;i++){
    long long x,slow,shigh,tlow,thigh,ans=100000000000;
    cin>>x;
    decltype(s)::iterator its=lower_bound(s.begin(),s.end(),x);
    decltype(t)::iterator itt=lower_bound(t.begin(),t.end(),x);
    if (its==s.end()){
      shigh=100000000000;
    }else{
      shigh=*its;
    }
    if (itt==t.end()){
      thigh=100000000000;
    }else{
      thigh=*itt;
    }
    if (its==s.begin()){
      slow=-100000000000;
    }else{
      its--;
      slow=*its;
    }
    if (itt==t.begin()){
      tlow=-100000000000;
    }else{
      itt--;
      tlow=*itt;
    } 
    //low->low
    ans=min(ans,x-min(slow,tlow));
    //high->high
    ans=min(ans,max(shigh,thigh)-x);
    //slow->thigh
    ans=min(ans,thigh+x-2*slow);
    ans=min(ans,shigh+x-2*tlow);
    //shigh->thigh
    ans=min(ans,2*shigh-x-tlow);
    ans=min(ans,2*thigh-x-slow);
    cout<< ans <<endl;
  }
}


Measured memory_bytes: 2944
#include<iostream>

using namespace std;

int main(void){

    double w, h, x, y;
    double ans, ans1, ans2;

    cin >> w >> h >> x >> y;

    bool ismul = false;

    cout << w*h/2 << " " << (x+x==w && y+y==h) << endl;

    return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll x;
    cin>>x;
    ll year=0;
    ll now=100;
    while(now<x)
    {
        now+=(now/100);
        year++;
    }
    cout<<year<<'\n';
    return 0;
}    
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int t = (c+b-1)/b;
    int ao = (a+d-1)/d;
    if(t<=ao)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>


int main(){
  int hai[100][100];
  int n;
  int i,j,a,b,c;

  scanf("%d",&n);

  for(i = 0; i < 100; i++){
    for(j = 0; j< 100; j++){
      hai[i][j] = 0;
    }
  }

  for(i = 0; i < n; i++){
    scanf("%d%d",&a,&b);
    a--;
    for(j = 0; j < b; j++){
      scanf("%d",&c);
      c--;
      hai[a][c] = 1;
    }
  }

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      printf("%d%c",hai[i][j],(j < n - 1 ? ' ' : '\n'));
    }
  }
  return 0;
}



Measured memory_bytes: 2100
<?php

$roman = array(
    'I' => 1,
    'V' => 5,
    'X' => 10,
    'L' => 50,
    'C' => 100,
    'D' => 500,
    'M' => 1000
);

while (($line = trim(fgets(STDIN))) !== '') {
    $result = $roman[substr($line, -1)];
    $prev = $result;
    for ($i = strlen($line) - 2; $i >= 0; $i--) {
        $key = $line[$i];
        $n = $roman[$key];

        if ($n < $prev) {
            $result -= $n;
        } else {
            $result += $n;
        }

        $prev = $n;
    }

    echo $result, PHP_EOL;
}

Measured memory_bytes: 6592
#include<stdio.h>
long long q[100010];
int main()
{
    int n,x;
    scanf("%d%d",&n,&x);
    for(int i=0; i<n; i++)
    {
        scanf("%I64d",&q[i]);
    }
    long long sum=0;
    for(int i=0; i<n; i++)
    {
        if(q[i]>x)
        {
            sum+=q[i]-x;
            q[i]=x;
        }
        if(q[i]+q[i+1]>x)
        {
            sum+=q[i]+q[i+1]-x;
            q[i+1]-=q[i]+q[i+1]-x;

        }
    }
    printf("%lld\n",sum);
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll fact[2200003];
ll ifact[2200003];
ll Combination(ll a,ll b) {
  ll s = (fact[a] * ifact[b]) % Mod;
  return (s * ifact[a-b]) % Mod;
}

ll Calc(ll r,ll c) {
  ll res = Combination(c+r+2,r+1) - 1;
  res %= Mod;
  if (res < 0) res += Mod;
  return res;
}

int main() {
  fact[0] = 1;
  ifact[0] = 1;
  for (int i = 1; i < 2200003; i++) {
    fact[i] = fact[i-1] * i;
    fact[i] %= Mod;
    ifact[i] = modinv(fact[i],Mod);
  }
  ll r1,c1,r2,c2;
  cin >> r1 >> c1 >> r2 >> c2;
  ll ans = Calc(r2,c2) + Calc(r1-1,c1-1) - Calc(r2,c1-1) - Calc(r1-1,c2);
  ans %= Mod;
  if (ans < 0) ans += Mod;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 37992
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

struct UnionFind
{
    vector<int> par;
    vector<int> sizes;

    UnionFind(int n) : par(n), sizes(n, 1) {
        REP(i,n) par[i] = i;
    }

    int find(int x) {
        if (x == par[x]) return x;
        return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        return sizes[find(x)];
    }
};

int main(){
    int N,M;
    cin>>N>>M;
    UnionFind uf(N);
    REP(i,M){
        int A,B;
        cin>>A>>B;A--;B--;
        uf.unite(A,B);
    }
    int res=1;
    REP(i,N){
        if(uf.find(i)==i){
            res=max(uf.size(i),res);
        }   
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 4824
def main():
	n = int(input())
	a = list(map(int,input().split()))
	a.sort()
	ans = 0
	for i in range(len(a)-1):
		if a[i] == a[i+1]:
			ans = 1
	if ans == 1:
 		print("NO")
	else:
 		print("YES")
	
 
if __name__ == '__main__':
	main()

Measured memory_bytes: 86356
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mp make_pair
#define ins insert
#define sz(x) (int)x.size()
#define whoami(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); whi(_it, args); }

void whi(istream_iterator<string> it) { cerr<<"\n"; }

template<typename T, typename... Args>
void whi(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<" "<<a<<" "; whi(++it, args...); }

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;
const ll INF = 4e18;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  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);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max({a*c, b*d, a*d, b*c})<<"\n";
	return;
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#include <climits>
#include <cmath>

#define DEBUG if(false)

using namespace std;



int main(){

  long long A;
  string B;
  cin >> A >> B;
  // B : 1.23
  int BB = 0;
  BB = (B[0] - 48) * 100;
  BB += (B[2] - 48) * 10;
  BB += (B[3] - 48);

  //cout << BB << endl;
  cout << (A * (long long)BB) / 100 << endl;

  return 0;
}


Measured memory_bytes: 3628
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

void _yn(bool p) {
	p ? _y() : _n();
}

void _YN(bool p) {
	p ? _Y() : _N();
}


LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 



/*****************************************************************************/

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

	int q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	h = min(2 * q, h);
	s = min(2 * h, s);
	cout << min(n / 2 * d + n % 2 * s, n*s);
	return 0;
}

Measured memory_bytes: 764
import numpy as np
N,M,C =list(map(int, input().split()))
B = np.array(list(map(int, input().split())))
ans = 0
for i in range(N):
    A = np.array(list(map(int, input().split())))
    ans += int((np.dot(A,B) + C) > 0)
print(ans)

Measured memory_bytes: 21776
N, M = map(int, input().split())
Info = [list(map(int, input().split())) for i in range(M)]

Group = [[i] for i in range(N+1)]  # 同じ集合に属する人のリスト
Distance = [[i, 0] for i in range(N+1)]  # 人を渡すと[親番号，親からの距離]が返る

for info in Info:
    l, r, d = info
    lp, rp = Distance[l][0], Distance[r][0]
    lpd, rpd = Distance[l][1], Distance[r][1]

    if lp != rp:
        if len(Group[lp]) > len(Group[rp]):
            Group[lp] += Group[rp]
            for h in Group[rp]:
                Distance[h][0] = lp
                Distance[h][1] += d + lpd - rpd
        else:
            Group[rp] += Group[lp]
            for h in Group[lp]:
                Distance[h][0] = rp
                Distance[h][1] -= d + lpd - rpd
    else:
        if rpd - lpd != d:
            print("No")
            exit()

print("Yes")

Measured memory_bytes: 75264
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << "\n"
static const int INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[300][300];
char field[200][200];
int p,q,x;

int dfs(int a,int b,int l){
  // cout << a << " " << b << " " << l << endl;
  ll ans = 0;
  ll sum = 0;
  rep(i,0,l)sum += a / d[i];
  if(sum * q == p * a)ans++;
  else if(sum * q > p * a)return 0;
  if(l == n)return ans;
  lep(i,b,x){
    if(a * i > x)break;
    d[l] = i;
    ans += dfs(a*i,i,l+1);
  }
  return ans;
}

int main(){
  while(cin >> p >> q >> x >> n,(p + q + x + n)){
    print(dfs(1,1,0));
  }
  return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100005
#define INF 1000000005
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000005;
const int MOD = 1000000007;
int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int>c(n);
    vector<vector<int>>a(n,vector<int>(m));
    REP(i,n){
        cin>>c[i];
        REP(j,m){
            cin>>a[i][j];
        }
    }
    int ans=INF;
    for(int bit=0;bit<(1<<n);bit++){
        vector<int> S;
        REP(i,n){
            if(bit & (1<<i)){
                S.push_back(i);
            }
        }
        int sum=0;
        vector<int>ri(m);
        for(auto i:S){
            sum+=c[i];
            REP(j,m){
                ri[j]+=a[i][j];
            }
        }
        bool f=true;
        REP(i,m){
            if(ri[i]<x){
                f=false;
                break;
            }
        }
        if(f)ans=min(ans,sum);
    }
    if(ans==INF)ans=-1;
    OUT(ans);
    return 0;
}

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

int main(){
    int n;
    map<int , int> m;
    while(cin>>n){
        while(n--){
            int x;
            cin>>x;
            m[x]++;
        }

        int c=0;
        for(auto x: m){
            if(x.first >  x.second) {c+= x.second;}
            else if(x.first < x.second) {c+= x.second - x.first;}
        }
        cout<<c<<endl;
        m.clear();
    }
    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        boolean isDistinct = true;
        for(int i = 1; i < N; i++) {
            if(arr[i] == arr[i-1]) {
                isDistinct = false;
                break;
            }
        }
        if(isDistinct) System.out.println("YES");
        else System.out.println("NO");
    }
}


Measured memory_bytes: 60800
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

class MaxFlow{
public:
    struct edge{int to,rev;ll cap;};
    static const int MV=10000;
    vector<edge> E[MV];
    bool used[MV];
    void add_edge(int from, int to, ll cap, bool undir=false){
        E[from].push_back({to,(int)E[to].size(),cap});
        E[to].push_back({from,(int)E[from].size()-1,undir?cap:0});
    }
    ll dfs(int v, int t, ll f){
        if(v==t) return f;
        used[v]=true;
        for(auto& e:E[v]){
            if(!used[e.to]&&e.cap>0){
                ll d=dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    E[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }
    ll maxflow(int s, int t){
        ll flow=0;
        while(true){
            mem(used,false);
            ll f=dfs(s,t,numeric_limits<ll>::max());
            if(f==0) return flow;
            flow+=f;
        }
    }
};

MaxFlow mf;
int N;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    int s=0,t=N+1;
    ll total=0;
    rep1(i,N){
        int x; cin>>x;
        if(x>=0){
            total+=x;
            mf.add_edge(s,i,x);
            mf.add_edge(i,t,0);
        }else{
            mf.add_edge(s,i,0);
            mf.add_edge(i,t,-x);
        }
        for(int j=2*i;j<=N;j+=i){
            mf.add_edge(j,i,LLINF);
        }
    }
    
    total -= mf.maxflow(s,t);
    cout1(total);
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


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

  sort(waza.rbegin(), waza.rend());
  bool j = false;
  for(int i = 0; i < n; ++i) {
    h -= waza[i];
    if(h <= 0) {
      j = true;
      break;
    }
  }

  if(j) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

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

using namespace std;

string s;

int main() {
  #ifdef GG
    freopen("a.in", "r", stdin);
    freopen("a.out", "w", stdout);
  #endif
  ios_base::sync_with_stdio(0); cin.tie(NULL);
  cin >> s; int n = (int) s.size();
  for (int i = 0; i < n - 1; ++i) {
    if (s[i] == s[i + 1]) {
      cout << i + 1 << ' ' << i + 2;
      return 0;
    }
  }
  for (int i = 0; i < n - 2; ++i) {
    if (s[i] == s[i + 2]) {
      cout << i + 1 << ' ' << i + 3;
      return 0;
    }
  }
  cout << "-1 -1";
  return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <tr1/unordered_set>
using namespace std;

int n , v[20] , ans = 0;

tr1::unordered_set<int> memo[20];

int X[421] , Y[421] , top;
 
int main(){
	while(scanf("%d\n",&n)&& n){
		int dp2[21] = {0};
		for(int i = 0 ; i < n ; i++) scanf("%d",&v[i]) , memo[i].clear();
		sort(v,v+n,greater<int>());
		for(int i = n-1 ; i >= 0 ; i--) dp2[i] = dp2[i+1] + v[i];
		ans = 99999999;
		top = 0;
		X[top] = 0;
		Y[top] = 0;
		while(~top){
			int pos = X[top] , sum = Y[top]; top--;
			if(pos==n) ans = min(ans,sum);
			else{
				if( sum >= dp2[pos] && ans <= sum-dp2[pos] ) continue;
				X[++top] = pos+1;
				Y[top]   = sum+v[pos];
				X[++top] = pos+1;
				Y[top]   = abs(sum-v[pos]);
			}
		}
		printf("%d\n",ans);
	}
}

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

typedef long long ll;

int main(){
    int N,P; cin >> N >> P;
    string s; cin >> s;
    map<int,int> cnt;
    ll ans=0;
    if(10%P==0){
        for(int i=0;i<N;i++){
            int d=s[i]-'0';
            if(d%P==0){
                ans+=i+1;
            }
        }
    }else{
        reverse(s.begin(),s.end());
        int ten=1;
        vector<int> tmp(N+1);
        for(int i=0;i<N;i++){
            int d=(s[i]-'0')*ten%P;
            tmp[i+1]=(d+tmp[i])%P;
            tmp[i+1]%=P;
            ten*=10; ten%=P;
        }
        for(int i=0;i<N+1;i++){
            ans+=cnt[tmp[i]];
            cnt[tmp[i]]++;
        }
    }
    cout << ans << endl;
}

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

int main()
{
	int k,a,b;
	cin >> k >> a >> b;
	for (int i = a; i <= b; ++i)
	{
		if (i % k == 0)
		{
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
string LCS(string s,string t,ll n1,ll n2)
{
    ll dp[n1+1][n2+1];
    memset(dp,0,sizeof(dp));

    for(ll i=0;i<n1;i++)
    {
        for(ll j=0;j<n2;j++)
        {
            if(s[i]==t[j])
                dp[i+1][j+1]=dp[i][j]+1;
            else
                dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
        }
    }
    string x;
    for(ll i=n1-1,j=n2-1;i>=0,j>=0;)
    {
        if(s[i]==t[j])
            {x+=s[i];i--;j--;}
        else if(dp[i][j+1]>dp[i+1][j])
        {
            i--;
        }
        else //if(dp[i][j+1]<dp[i+1][j])
        {
            j--;
        }
    }
    reverse(x.begin(),x.end());
    return x;
}
int main()
{
    string s,t;cin>>s>>t;
    ll n1=s.length(),n2=t.length();
    cout<<LCS(s,t,n1,n2);
}


Measured memory_bytes: 70656
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;

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

long long int INF = 1e18;
long long int mod = 998244353;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
priority_queue <P,vector<P>,greater<P> > pqps2;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(15)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
    //abcのbed乗を計算する
    if(bed==0){return 1;}
    else{
        ll ced = rui(abc,bed/2);
        ced *= ced;
        ced %= mod;
        if(bed%2==1){ced*=abc; ced%=mod;}
        return ced;
    }
}
ll gcd(ll number1,ll number2){
	if(number1 > number2){
		swap(number1,number2);
	}
	if(number1 == 0 || number1 == number2){
		return number2;
	}else{
		return gcd(number2 % number1,number1);
	}
}

ll i,j,k,ii,jj,r,l;
ll n,m,num,ans;
ll a,b,c,d,e,g,h,w;
ll x[500005],y[500005],z[500005];
bool coin[700][700];
ll dp[400][400][700];
char s[5005];

ll bitsum(ll i){
	ll s = 0;
	while(i>0){
		//p("hoi");
		s += bit[i];
		i -= i & -i;
	}
	return s;
}
void bitadd(ll b,ll x){
	while(b <= n){
		//p("hoi");
		bit[b] += x;
		b += b & -b;
	}
}

int main(){
	
    cin>>s;
	if(strlen(s) == 2){
		p(s);
	}else{
		reverse(s,s+3);
		p(s);
	}
	//p(ans);
	

    return 0;
}

Measured memory_bytes: 23936
fun main(arg: Array<String>) {
    val N = nextInt()
    val A = listOfInt().sorted()
    for (n in 1 until N) {
        if (A[n - 1] == A[n]) {
            println("NO"); return
        }
    }
    println("YES")
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 79284
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
vector<int>a[1000001];
int n,m;
int p[1000001];
int vis[1000001];
int cnt;
void dfs(int node,int fa){
	vis[node]=1;
	int flag=0;
	for(auto u:a[node]){
		if(p[u]>=p[node]){
			flag=1;
		}
		//cout<<node<<" "<<u<<endl;
	}
	if(!flag) {
		//cout<<node<<endl;
		cnt++;
	}
	for(auto u:a[node]){
		if(u!=fa&&!vis[u]){
			dfs(u,node);
		}
	}
	
}
map<pair<int,int>,int>p1;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n>>m;
    rep(i,1,n+1) cin>>p[i];
    rep(i,1,m+1){
    	int x,y;
    	cin>>x>>y;
    		a[x].pb(y);
    		a[y].pb(x);
	}
	dfs(1,0);
	rep(i,1,n+1){
		if(!vis[i]){
			dfs(i,0);
		}
		
	}
	cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 31832
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")



/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  int H,N;cin>>H>>N;
  int sm = 0;
  for(int i = 0; N > i; i++){
    int t;cin>>t;sm+=t;
  }
  if(H > sm)cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

object Main {

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val v = Vector.fill(n)(sc.next())

    println("AC x " + v.count(_ == "AC"))
    println("WA x " + v.count(_ == "WA"))
    println("TLE x " + v.count(_ == "TLE"))
    println("RE x " + v.count(_ == "RE"))
  }
}


Measured memory_bytes: 63084
#include <bits/stdc++.h>
using namespace std;
#define print printf("==================\n")
#define ll long long
#define pi acos(-1.0)
#define eps 1e-16
#define max3(a,b,c) max(a,max(b,c))
const ll INF = 1 << 30;
typedef pair<double, double  > payar;
typedef struct
{
    ll  x, y;
} point;
priority_queue<payar, vector<payar>,  greater<payar> > pq; ///accending
vector< pair<double,payar  > > vpp;
vector < payar >  vp;

string X,Y;
int tab[3005][3005];
int lcs( int m, int n )
{

    int i, j;

    for (i=0; i<=m; i++)
    {
        for (j=0; j<=n; j++)
        {
            if (i == 0 || j == 0)
                tab[i][j] = 0;

            else if (X[i-1] == Y[j-1])
                tab[i][j] = tab[i-1][j-1] + 1;

            else
                tab[i][j] = max(tab[i-1][j], tab[i][j-1]);
        }
    }

    return tab[m][n];
}
void path(int x,int y)
{
    if(x==0 or y==0)
        return ;
    if(tab[x][y]!=tab[x-1][y] and tab[x][y]!=tab[x][y-1] )
    {
        path(x-1,y-1);
        cout<<Y[y-1];
    }
    else if (tab[x][y]==tab[x-1][y])
    {
        path(x-1,y);
    }
    else if (tab[x][y]==tab[x][y-1])
    {
        path(x,y-1);
    }

}
int main()
{


    cin>>X>>Y;
    //if(X.size()>Y.size())swap(X,Y);
    ll l = lcs(X.size(),Y.size());
//    for(int i = 0 ; i<=X.size() ; i++)
//    {
//        for(int j = 0 ; j<=Y.size() ; j++)
//        {
//            cout<<tab[i][j]<<" ";
//        }
//        cout<<endl;
//    }
   // cout<<endl;
    string sub="";

    path(X.size(),Y.size());
    return  0 ;
}


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

int main(){
  int n,k;
  cin >> n >> k;
  ll ans=k;
  rep(i,n-1) ans*=(k-1);
  cout << ans << endl;
}

Measured memory_bytes: 3464
#include <stdio.h>
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<complex>
#include<vector>
#include <climits>

using namespace std;
//--------------------------------------------------------------
int a,b,c; 

int main(void)
{
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);

    if(c<=a+b)
    {
        printf("%d",c+b);
    }
    else 
    {
        printf("%d",a+2*b+1);
    }


        return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
using ll = long long;

int main() {
	string s;
	cin >> s;
	int n = s.size() - 1;
	if (n % 2 == 1)n--;
	for (int i = n; i > 0;i-=2) {
		if (s.substr(0, i / 2) == s.substr(i / 2, i / 2)) {
			cout << i << endl;
			break;
		}
	}
}

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

int main() {
    int k, x;
    cin >> k >> x;
    vector<int> ans(1, x);
    for(int i = 1; i <= k-1; i++) {
        ans.push_back(x+i);
        ans.push_back(x-i);
    }
    sort(ans.begin(), ans.end());
    for(auto e : ans)  cout << e << " ";
    cout << endl;
}

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

int main(void) {
  int64_t N, A, B;
  cin >> N >> A >> B;
  vector<int64_t> X(N);
  rep(i, N) cin >> X[i];

  int64_t answer = 0;
  rep(i, N - 1) {
    int64_t diff = X[i + 1] - X[i];
    if (diff * A < B)
      answer += diff * A;
    else
      answer += B;
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int num,to[N],la[N],he[N],dp[N];
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch&15),ch=getchar();
	return x*f;
}
void addedge(int x,int y){to[++num]=y;la[num]=he[x];he[x]=num;}
int dfs(int u)
{
	if (dp[u]!=-1) return dp[u];
	int t=-1;
	for (register int i=he[u];i;i=la[i])
	{
		int v=to[i];
		t=max(t,dfs(v));
	}
	return dp[u]=t+1;
}
int main()
{
	int n=read(),m=read();
	for (register int i=1;i<=m;++i)
	{
		int x=read(),y=read();
		addedge(x,y);
	}
	memset(dp,-1,sizeof(dp));
	for (register int i=1;i<=n;++i) if (dp[i]==-1) dp[i]=dfs(i);
	int ans=0;for (register int i=1;i<=n;++i) ans=max(ans,dp[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3200
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
  int a,b;
  cin>>a>>b;
  cout<<max(a-b,0)<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_F&lang=jp
0-1 ???????????¶???????????? II
????????? vi ????????? wi ??§??????????????? N ??????????????¨???????????? W ??????????????¶?????????????????????????¬?????????¶?????????????????????????????????????????§???????????¶???????????\????????????

???????????????????????????????¨??????§???????????????????????????
???????????????????????????????????? W ????¶?????????????
?????????????¨?????????§???????±??????????????????????

??¶?´?
1 ??? N ??? 100
1 ??? vi ??? 100
1 ??? wi ??? 10,000,000
1 ??? W ??? 1,000,000,000
*/

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, W; cin >> N >> W;
	vector<ll> v(N), w(N);
	ll MAX_V = 100;
	for (int i = 0; i < N;i++) cin >> v[i] >> w[i];
	/* dp[i][j] := i???????????§????????????????????¨???,??????j??¨?????????????????????????°?????????? */
	vector<vector<ll>> dp(N + 1, vector<ll>(N * MAX_V + 1, INF));
	dp[0][0] = 0;
	for (int i = 0; i < N;i++) {
		for (int j = 0; j <= N*MAX_V;j++) {
			if (dp[i][j] == INF) continue;
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
			if (dp[i][j] + w[i] <= W) {
				dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
			}
		}
	}
	for (int j = N*MAX_V; j >= 0; j--) {
		if (dp[N][j] == INF)continue;
		cout << j << endl;
		break;
	}
	return 0;
}

Measured memory_bytes: 10812
#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    n = n % 10;
    
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9){
        printf("hon");
    }else if(n == 0 || n == 1 || n == 6 || n == 8){
        printf("pon");
    }else{
        printf("bon");
    }
        return 0;
}

Measured memory_bytes: 1704
#include<stdio.h>
#include<stdlib.h>
void bubblesort(int*,int);
int cnt=0;
int main(){
  int i,j;
  int *num;

  scanf("%d",&j);
  num=(int *)malloc(j * sizeof(int));
  for(i=0;i<j;i++)scanf("%d",&num[i]);
  bubblesort(num,j);
  printf("%d",num[0]);
  for(i=1;i<j;i++)printf(" %d",num[i]);
  printf("\n");
  printf("%d\n",cnt);
  return 0;
}
void bubblesort(int *num,int x){
  int flag=1,j,key;
  while(flag){
    flag=0;
    for(j=x-1;1<=j;j--){
      if(num[j]<num[j-1]){
        key=num[j-1];
        num[j-1]=num[j];
        num[j]=key;
        flag=1;
        cnt++;
      }
    }
  }
}



Measured memory_bytes: 2140