akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const int maxm = maxn*10;
const int inf = 0x3f3f3f3f;
typedef long long ll;

int n,a[1<<18],b[1<<18],ans,cnt;
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    for(int i = 0;i<(1<<n);++i) cin>>a[i];
    for(int i = 0;i<n;i++) 
        for(int j = 0;j<(1<<n);j++)
            if((j>>i)&1){
                if(a[j] > a[j^(1<<i)]) b[j] = max(b[j],a[j^(1<<i)]);
                else {
                    b[j] = max(a[j],b[j^(1<<i)]);
                    a[j] = a[j^(1<<i)];
                }
            }
    int ans = 0;
    for(int i = 1;i<(1<<n);i++) {
        ans = max(ans,a[i] + b[i]);
        printf("%d\n",ans);
    }
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int a = 1; a * a <= n; a++) {
		for (int b = a; b <= n; b++) {
			int c = n - a * b;
			if (c > 0) {
				if (a == b)
					ans++;
				else
					ans += 2;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	read(k);
    string s;
    cin >> s;
    
    if (sz(s) <= k) cout << s;
    else
    {
        FOR (i, 0, k - 1) cout << s[i];
        cout << "...";
    }
    
    
}



















Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        class modMCalc
        {
            private const int M = 998244353;       // 素数(int範囲)

            // 乗算結果 % Mを求める
            static public int Mul(int a, int b)
            {
                return (int)(Math.BigMul(a, b) % M);
            }

            // 冪乗(mod M)
            static public int Pow(int a, int m)
            {
                if (0 == m)
                {
                    return 1;
                }
                if (1 == m)
                {
                    return a;
                }

                int result = 1;
                int param = a;
                for (; m > 0; m >>= 1)
                {
                    if ((m & 0x01) == 1)
                    {
                        result = Mul(result, param);
                    }

                    param = Mul(param, param);
                }

                return result;
            }

            // 除算(mod M)
            static public int Div(int a, int b)
            {
                return Mul(a, Pow(b, M - 2));
            }
        }

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');

            int[] v = new int[N];

            if(int.Parse(s[0]) != 0) {
                Console.WriteLine("0");
                return;
            }

            int maxInd = 0;
            for (int i = 0; i < N; i++)
            {
                int ind = int.Parse(s[i]);
                v[ind]++;

                maxInd = Math.Max(maxInd, ind);
            }

            if(v[0] != 1)
            {
                Console.WriteLine("0");
                return;
            }

            int ans = 1;
            for (int i = 0; i < maxInd; i++)
            {
                int m = modMCalc.Pow(v[i], v[i + 1]);
                ans = modMCalc.Mul(ans, m);
            }

            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 18144
let () =
	let n = Scanf.scanf "%d\n" (fun x -> x) in
    let lst = Array.to_list (Array.init n (fun _ -> Scanf.scanf "%d " (fun x -> x))) in
    Printf.printf 
    	(if (List.for_all (fun x -> (x mod 2 = 1) || ((x mod 2 = 0) && (x mod 3 = 0 || x mod 5 = 0))) lst) 
         then "APPROVED" else "DENIED")

Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n,segtree[2][816225][2];
bool delayed[2][816225];

void eval(int k, int i, int l, int r){
	if(delayed[k][i]){
		segtree[k][i][0] = segtree[k][i][1];
		if(r-l>1){
			segtree[k][i*2+1][1] = segtree[k][i][1];
			segtree[k][i*2+2][1] = segtree[k][i][1];
			delayed[k][i*2+1] = true;
			delayed[k][i*2+2] = true;
		}
		delayed[k][i] = false;
	}
}

int query(int k, int a, int b, int i=0, int l=0, int r=n){
	eval(k,i,l,r);
	if(r<=a || b<=l){
		return INF;
	}else if(a<=l && r<=b){
		return segtree[k][i][0];
	}else{
		return std::min(query(k,a,b,i*2+1,l,(l+r)/2),query(k,a,b,i*2+2,(l+r)/2,r));
	}
}

void update(int k, int a, int b, int v, int i=0, int l=0, int r=n){
	eval(k,i,l,r);
	// printf("%d %d %d %d %d %d %d\n",k,a,b,v,i,l,r);
	if(r<=a || b<=l){
		return;
	}else if(a<=l && r<=b){
		delayed[k][i] = true;
		segtree[k][i][1] = v;
		eval(k,i,l,r);
	}else{
		update(k,a,b,v,i*2+1,l,(l+r)/2);
		update(k,a,b,v,i*2+2,(l+r)/2,r);
		segtree[k][i][0] = std::min(segtree[k][i*2+1][0],segtree[k][i*2+2][0]);
	}
}

int main(void){
	int q,i,x,y,m[2];
	ll ans;
	std::cin >> n >> q;
	ans = (n-2); ans *= (n-2);
	update(0,1,n-1,n-2);
	update(1,1,n-1,n-2);
	m[0] = n-1; m[1] = n-1;
	for(i=0; i<q; ++i){
		std::cin >> x >> y;
		--x; --y;
		ans -= query(x,y,y+1);
		if(y<m[x]){
			m[x] = y;
			update(1-x,1,m[1-x],m[x]-1);
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 12856
#include<stdio.h>
int main()
{
    int a,b,c,d;
    char a1,a2,a3;
    while(scanf("%1d%1d%1d%1d",&a,&b,&c,&d)!=EOF)
    {
       if(a+b+c+d==7) printf("%d+%d+%d+%d=7\n",a,b,c,d);
       else if(a+b+c-d==7) printf("%d+%d+%d-%d=7\n",a,b,c,d);
       else if(a+b-c+d==7) printf("%d+%d-%d+%d=7\n",a,b,c,d);
       else if(a+b-c-d==7) printf("%d+%d-%d-%d=7\n",a,b,c,d);
       else if(a-b+c+d==7) printf("%d-%d+%d+%d=7\n",a,b,c,d);
       else if(a-b+c-d==7) printf("%d-%d+%d-%d=7\n",a,b,c,d);
       else if(a-b-c+d==7) printf("%d-%d-%d+%d=7\n",a,b,c,d);
       else if(a-b-c-d==7) printf("%d-%d-%d-%d=7\n",a,b,c,d);
    }
    return 0;


}


Measured memory_bytes: 128
n = int(input())
p = list(map(int,input().split()))
ans = 0
i = 0

p.append(0)

while i <= n-1:
	if p[i] == i+1 and p[i+1] == i+2:
		i += 2
		ans += 1
	elif p[i] == i+1 and p[i+1] != i+2:
		i += 1
		ans += 1
	else:
		i += 1

print(ans)

Measured memory_bytes: 20568
using System;
using System.Linq;

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(long.Parse).ToArray();
    var a = arr[0];
    var b = arr[1];
    var c = arr[2];
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
      Console.WriteLine(0);
    } else {
      Console.WriteLine(Math.Min(a * b, Math.Min(a * c, b * c)));
    }
  }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


void solve(LL N, vector<LL> a){
	LL sum = 0;
	REP(i, N) {
		sum += a[i] - 1;
	}
	cout << sum << endl;
}


int main(){	
	LL N;
	scanf("%lld",&N);
	vector<LL> a(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, a);
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
using namespace std;
int main()
{
	int A, B, C, K, X,Y;
	cin >> A >> B >> C >> K;
	X = pow(2, K);
	Y = max(max(A, B), C);
	cout << A+B+C+ Y*(X-1);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 2e5+100;
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll x,te;
    cin>>x;
    te=100;
    int cnt=0;
    while(te<x){
    	te+=te/100;
    	cnt++;
	}
	cout<<cnt;
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define LL long long
#define uLL unsigned long long
#define db double

using namespace std;
const int N=300+10;
int rd()
{
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*w;
}
int n,k,mod,f[N][N],g[N][N],c[N][N];
void ad(int &x,int y){x+=y,x-=x>=mod?mod:0;}

int main()
{
	n=rd(),k=rd(),mod=rd();
	for(int i=0;i<=n+1;++i)
	{
		c[i][0]=1;
		for(int j=1;j<=i;++j) c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	}
	for(int j=0;j<=k;++j) f[1][j]=g[1][j]=1;
	for(int j=k;~j;--j) ad(g[1][j],g[1][j+1]);
	for(int i=2;i<=n+1;++i)
	{
		for(int j=0;j<=k;++j)
			for(int l=1;l<i;++l)
				ad(f[i][j],1ll*f[l][j]*g[i-l][j+1]%mod*c[i-2][l-1]%mod);
		for(int j=k;~j;--j) g[i][j]=f[i][j],ad(g[i][j],g[i][j+1]);
	}
	printf("%d\n",f[n+1][0]);
    return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

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

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

int main(){
    int H, N; cin >> H >> N;
    vi A(N);
    for(auto &x : A) cin >> x;
    ll sum=0;
    for(int i=0; i<N; i++){
        sum+=A[i];
    }
    cout << (H <= sum ? "Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 3684
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		
		if(A==5&&B==5) {
			if(C==7) {
				System.out.print("YES");
			}
		}
		else if(B==5&&C==5) {
			if(A==7) {
				System.out.print("YES");
			}
		}
		else if(C==5&&A==5) {
			if(B==7) {
				System.out.print("YES");
			}
		}
		else {
			System.out.print("NO");
		}
		
		sc.close();
	}
}


Measured memory_bytes: 22100
#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);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
    string s;
    cin>>s;
    string a,b,c;
    
    cout<<s.substr(0,5)<<" "<<s.substr(6,7)<<" "<<s.substr(14,5)<<endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>

#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to, weight;

	bool operator < (const Edge& obj) const {
		return weight < obj.weight;
	}
};

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //ｘの入ってる集合と yの入ってる集合を併合
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //xとyが同じ集合に入っているかどうかを判定
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int main()
{
	int n;
	cin >> n;
	vector<pii> h(n);
	int bef = -1;
	REP(i, n) {
		int a;
		scanf("%d", &a);
		if (bef < a) {
			h[i] = { 1, a };
		}
		else {
			h[i] = { 0, a };
		}
		bef = a;
	}
	vector<int> s(n);
	REP(i, n) {
		scanf("%d", &s[i]);
	}
	bef = -1;
	bool ok = true;
	for(int i = n-1; 0 <= i; i--) {
		if (bef < s[i]) {
			if (h[i].first == 1 && s[i] != h[i].second) ok = false;
			if (h[i].first == 0 && s[i] > h[i].second) ok = false;
			h[i] = { 1, s[i] };
		}
		else {
			if (h[i].first == 1 && s[i] < h[i].second) ok = false;
			h[i] = { max(h[i].first,0), min(h[i].second, s[i]) };
		}
		bef = s[i];
	}

	if (ok == false) cout << 0 << endl;
	else {
		ll ans = 1;
		REP(i, n) {
			if(h[i].first == 0)
				(ans *= h[i].second)%=MODU;
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
const int mod = 1000000007;
//const int mod = 998244353;
 

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);
 
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}
vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}

// M * (M-1)^(N-1-K) * N-1 C K
int main(int argc, const char * argv[]) {
    string S; cin >> S;
    
    for(ll i=0;i<S.size();i++){
        S.replace(i,1,"x");
    }
    cout << S << endl;
    return 0;
}



Measured memory_bytes: 3328
N,C,K=gets.chomp.split(" ").map{|n| n.to_i}
T=Array.new(N)
0.upto(N-1){|d|
	T[d],_=gets.chomp.split(' ').map{|n| n.to_i}
}
T = T.sort

c = 0
tbase = 0
is_started = false
buses = 0
for i in 0..(N-1)
	if(!is_started)
		is_started = true
		tbase = T[i]
		c += 1
		buses += 1
	else
		if(tbase+K < T[i])
			buses += 1
			is_started = true
			c = 1
			tbase = T[i]
		else
			c += 1
		end
	end
	if(c == C)
		is_started = false
		c = 0
		tbase = nil
	end
end
puts buses


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	std::cin >> t;
	if(t==1)
	    std::cout << 0 << std::endl;
	else
	    std::cout << 1 << std::endl;
	return 0;
}

Measured memory_bytes: 3684
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<int,int>p[1000];
int main(){
	int a;scanf("%d",&a);
	int sz=0;
	for(int i=0;i<a;i++){
		int s,t;scanf("%d%d",&s,&t);p[sz++]=make_pair(s,t);
	}
	int b;scanf("%d",&b);
	for(int i=0;i<b;i++){
		int s,t;scanf("%d%d",&s,&t);p[sz++]=make_pair(s,t);
	}
	std::sort(p,p+sz);
	for(int i=0;i<sz;i++){
		if(i&&p[i].first==p[i-1].first&&p[i].second==p[i-1].second)continue;
		if(i)printf(" ");
		printf("%d:%02d",p[i].first,p[i].second);
	}printf("\n");
}

Measured memory_bytes: 1052
#include<stdio.h>
#define false 0
#define true 1
int A[20],n,q,m[200];
int solve(int i ,int m){
  int res;
  if(m == 0) return true;
  else if(i >= n) return false;
  res = solve (i + 1, m) || solve(i + 1,m - A[i]);
    return res;
}


int main(){
  int i;
  scanf("%d",&n);
  for(i = 0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i = 0;i<q;i++){
    scanf("%d",&m[i]);
  }
  for(i=0;i<q;i++){
    if(solve(0,m[i]) == true){
      printf("yes\n");
    }else printf("no\n");

  }
  return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;

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

const int N = 222;
string s[N];
bool vis[N][N]={};

bool IN(int y, int x){
    return 0<=y && y<N && 0<=x && x<N;
}

//  0, 1,  2,  3, 4,  5,  6, 7,  8,  9, +, -, *
// 12, 5, 11, 11, 9, 11, 12, 7, 13, 12, 5, 3, 1
char GET(int y, int x, int c){
    if(c == 1) return '*';
    if(c == 3) return '-';
    if(c == 5){
        if(s[y+1][x] == 'X') return '1';
        return '+';
    }
    if(c == 7) return '7';
    if(c == 9) return '4';
    if(c == 11){
        // 2,3,5
        if(s[y+3][x+2] != 'X') return '2';
        if(s[y+1][x] != 'X') return '3';
        return '5';
    }
    if(c == 12){
        // 0,6,9
        if(s[y+2][x+1] != 'X') return '0';
        if(s[y+1][x+2] != 'X') return '6';
        return '9';
    }
    return '8';
}

int main(){
    rep(i,N) s[i] = string(N,'.');

    int n;
    cin >>n;
    rep(i,n){
        int x1,y1,x2,y2;
        cin >>x1 >>y1 >>x2 >>y2;
        if(x1==x2) for(int y=min(y1,y2); y<=max(y1,y2); ++y) s[y][x1]='X';
        else for(int x=min(x1,x2); x<=max(x1,x2); ++x) s[y1][x]='X';
    }

    string a = "";
    rep(x,N){
        rep(y,N)if(s[y][x]=='X' && !vis[y][x]){
            queue<pi> que;

            vis[y][x] = true;
            que.push({y,x});
            int ct = 1;

            while(!que.empty()){
                pi c = que.front();
                que.pop();
                rep(i,4){
                    int ny = c.fi+dy[i], nx = c.se+dx[i];
                    if(IN(ny,nx) && s[ny][nx]=='X' && !vis[ny][nx]){
                        vis[ny][nx] = true;
                        que.push({ny,nx});
                        ++ct;
                    }
                }
            }

            a += GET(y,x,ct);
        }
    }

    int A = a.size();
    ll ans = 0;

    int i = 0;
    int m = 1;
    ll t = 1;
    while(i<A){
        if(isdigit(a[i])){
            ll v = 0;
            while(i<A && isdigit(a[i])){
                v = 10*v + (a[i]-'0');
                ++i;
            }
            t *= v;
        }
        else{
            if(a[i] == '+'){
                ans += m*t;
                m = 1;
                t = 1;
            }
            else if(a[i] == '-'){
                ans += m*t;
                m = -1;
                t = 1;
            }
            ++i;
        }
    }
    ans += m*t;

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3268
import math
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,h,m=INTM()
    mrad=360*m/60
    hrad=360*h/12+30*m/60
    mhdif =abs(mrad-hrad)
    
    if mhdif==180:
        ans=a+b
    elif mhdif==0 or mhdif==360:
        ans=abs(a-b)
    elif mhdif>180:
        mhdif=360-mhdif
    
    if 0<mhdif<180:
        ans=(a**2+b**2-2*a*b*math.cos(math.radians(mhdif)))**0.5
    
    print(ans)
    
if __name__ == '__main__':
    do()

Measured memory_bytes: 9612
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i, v := range a {
		fmt.Scan(&v)
		a[i] = v
	}
	check := make([]bool, n)
	for i, v := range a {
		if v%2 == 0 && (v%3 == 0 || v%5 == 0) || v%2 != 0 {
			check[i] = true
		}
	}
	result := "APPROVED"
	for _, v := range check {
		if v == false {
			result = "DENIED"
			break
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
int main(void){
    int n;
    ll m=0,t;
    vector<ll> v;
    cin>>n;
    for(int i=1;m<10000000;i++){
        m+=i;
        v.push_back(m);
    }
    for(int i=0;i<v.size();i++){
        if(n<=v[i]){
            m=i+1;
            t=v[i]-n;
            break;
        }
    }
    for(int i=1;i<=m;i++){
        if(i!=t)cout<<i<<endl;
    }
}


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

#define mk(a,b) make_pair(a,b)
#define fi first
#define se second

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

int H,W,N;
int Y[100010],X[100010];
ll A[100010];
ll INF = 1000000000000000000;
vector<pll> V[100010], G[100010];
ll D[100010], dif[100010];
vector<int> vis;
ll MIN;

bool flag = false;

void DFS(int v, ll d)
{
    if(D[v] != INF)
    {
        if(D[v] != d)flag = true;
        return;
    }
    D[v] = d;
    if(MIN > d)MIN = d;
    vis.push_back(v);

    for(int i = 0; i < G[v].size(); i++)
    {
        pll e = G[v][i];
        DFS(e.fi, d + e.se);
    }
}

int main()
{
    cin >> H >> W >> N;
    for(int i = 0; i < N; i++)cin >> Y[i] >> X[i] >> A[i];

    for(int i = 0; i < 100010; i++)D[i] = INF;

    for(int i = 0; i < N; i++)V[Y[i]].push_back(mk(X[i], A[i]));
    for(int i = 0; i < 100010; i++)sort(V[i].begin(), V[i].end());

    for(int i = 0; i < 100010; i++)
    {
        for(int j = 0; j + 1 < V[i].size(); j++)
        {
            pll a = V[i][j];
            pll b = V[i][j + 1];
            G[a.fi].push_back(mk(b.fi, b.se - a.se));
            G[b.fi].push_back(mk(a.fi, a.se - b.se));
        }
    }

    for(int i = 0; i < 100010; i++)
    {
        if(D[i] == INF)
        {
            vis.clear();
            MIN = INF;
            DFS(i, 0);
            if(flag)
            {
                cout << "No" << endl;
                return 0;
            }

            for(int j = 0; j < vis.size(); j++)
            {
                int now = vis[j];
                dif[now] = MIN - D[now];
            }
        }
    }

    for(int i = 0; i < N; i++)
    {
        int x = X[i];
        if(dif[x] + A[i] < 0)
        {
            cout << "No" << endl;
            return 0;
        }
    }

    for(int i = 0; i < 100010; i++)
    {
        V[i].clear();
        G[i].clear();
    }
    for(int i = 0; i < 100010; i++)D[i] = INF;

    for(int i = 0; i < N; i++)V[X[i]].push_back(mk(Y[i], A[i]));
    for(int i = 0; i < 100010; i++)sort(V[i].begin(), V[i].end());
    for(int i = 0; i < 100010; i++)
    {
        for(int j = 0; j + 1 < V[i].size(); j++)
        {
            pll a = V[i][j], b = V[i][j + 1];
            G[a.fi].push_back(mk(b.fi, b.se - a.se));
            G[b.fi].push_back(mk(a.fi, a.se - b.se));
        }
    }

    for(int i = 0; i < 100010; i++)
    {
        if(D[i] == INF)
        {
            vis.clear();
            MIN = INF;
            DFS(i, 0);
            if(flag)
            {
                cout << "No" << endl;
                return 0;
            }

            for(int j = 0; j < vis.size(); j++)
            {
                int now = vis[j];
                dif[now] = MIN - D[now];
            }
        }
    }

    for(int i = 0; i < N; i++)
    {
        int y = Y[i];
        if(dif[y] + A[i] < 0)
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        double v[] = new double[N];
        for(int i = 0; i < N; i++) {
            v[i] = (double)scan.nextInt();
        }
        Arrays.sort(v);

        for(int i = 0; i < N-1; i++) {
            v[i+1] = (v[i+1] + v[i]) / 2.0;
        }

        os.println(v[N-1]);
    }
}

Measured memory_bytes: 22736
#include<bits/stdc++.h>
#define INT long long
using namespace std;

INT arr[200005],countArray[200005];

int main()
{
    INT i,j,a,b,c,n,m;
    while(scanf("%lld",&n)==1)
    {
        memset(countArray, 0, sizeof(countArray));
        for(i=0;i<n;i++)
        {
            scanf("%lld",&arr[i]);
            countArray[arr[i]]++;
        }
        a=0;
        for(i=1;i<=n;i++)
        {
            m = countArray[i];
            a += (m*(m-1))/2;
        }
        for(i=0;i<n;i++)
        {
            m = countArray[arr[i]];
            c = a;
            c -= (m*(m-1))/2;
            if(m<=1)
                c += 0;
            else
                c += (((m-1)*(m-2))/2);
            printf("%lld\n",c);
        }
    }
    return 0;
}


Measured memory_bytes: 5760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.AbstractMap.SimpleEntry;

class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] a = sc.nextIntArray(N);
        int[] b = a.clone();
        // for (int i = 0; i < N; i++) {
        // b[i] = a[i] - X;
        // }
        // System.out.println(Arrays.toString(b));

        long ans = 0;
        if (b[0] > X) {
            ans += b[0] - X;
            b[0] = X;
        }
        for (int i = 1; i < N; i++) {
            int check = b[i - 1] + b[i];
            if (check > X) {
                b[i] -= check - X;
                ans += check - X;
            }
        }
        System.err.println(Arrays.toString(b));
        System.out.println(ans);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 42492
import java.util.Scanner;
import java.math.BigDecimal;

class Main{
  public static double[][] solEq(double[][] a){
    int n = a.length, m = a[0].length;
    for (int ipv = 0; ipv < n; ipv++) {
      double max = 0.0;
      int row = 0;
      for(int i = ipv; i < n; i++) {
        if(Math.abs(a[i][ipv]) > max) {
          max = a[i][ipv];
          row = i;
        }
      }
      if(max == 0.0) {
        break;
      }
      if(ipv != row) {
        for(int j = 0; j < m; j++) {
          double temp = a[ipv][j];
          a[ipv][j] = a[row][j];
          a[row][j] = temp;
        }
      }
      
      double inv_pv = 1.0/a[ipv][ipv];
      for (int j = 0; j < m; j++) {
        a[ipv][j] *= inv_pv;
      }
      
      for (int i = 0; i < n; i++) {
        if (i != ipv) {
          double temp = a[i][ipv];
          for (int j = 0; j < m; j++) {
            a[i][j] -= temp*a[ipv][j];
          }
        }
      }
    }
    return a;
  }


  public static double[] per_bisec(double A[], double B[]){
    double[] vecAB = {B[0]-A[0], B[1]-A[1]};
    double[] M = {(B[0]+A[0])*0.5, (B[1]+A[1])*0.5};
    double[] equ = {vecAB[0], vecAB[1], vecAB[0]*M[0]+vecAB[1]*M[1]};
    return equ;
  }
  public static double roundOff(double x, int n){
      BigDecimal bdx = new BigDecimal(x);
      bdx = bdx.setScale(n, BigDecimal.ROUND_HALF_UP);
      x = bdx.doubleValue();
      return x;
      }

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++) {
      double [][] point = new double[3][2];
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 2; k++) {
          point[j][k] = sc.nextDouble();
        }
      }
      double[][] mat = {per_bisec(point[0],point[1]),per_bisec(point[0],point[2])};
      mat = solEq(mat);
      double x = mat[0][2];
      double y = mat[1][2];
      double r = Math.sqrt(Math.pow((mat[0][2]-point[0][0]),2)+Math.pow((mat[1][2]-point[0][1]),2));
      x = roundOff(x,3);
      y = roundOff(y,3);
      r = roundOff(r,3);
      System.out.printf("%.3f %.3f %.3f%n", x, y, r);
    }
  }
}

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

int H,W;
int t[1000][1000];
int total=0;

int main(){
  cin>>W>>H;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>t[i][j];
      total+=t[i][j];
    }
  }

  for(int i=0;i<H;i++){
    int sum=0;
    for(int j=0;j<W;j++){
      sum+=t[i][j];
    }
    if( abs(sum - (W-sum) ) > 1 ){
      cout<<"no"<<endl;
      return 0;
    }
  }
  
  for(int j=0;j<W;j++){  
    int sum=0;
    for(int i=0;i<H;i++){
      sum+=t[i][j];
    }
    if( abs(sum - (H-sum) ) > 1 ){
      cout<<"no"<<endl;
      return 0;
    }
  }
  
  for(int i=0;i+1<H;i++){
    for(int j=0;j+1<W;j++){
      int f=t[i][j]+t[i+1][j]+t[i][j+1]+t[i+1][j+1];
      if(f%2==1){
        cout<<"no"<<endl;
        return 0;
      }
    }
  }

  if( abs( total - (H*W-total) ) > 1) {
    cout<<"no"<<endl;
    return 0;
  }
  
  cout<<"yes"<<endl;
  return 0;
}



Measured memory_bytes: 7004
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
    static int[][] e = new int[1 + 1000*(1000 - 1)/2][2];
    static int[] calculated = new int[1 + 1000*(1000 - 1)/2];
    static int[] visited = new int[1 + 1000*(1000 - 1)/2];
    static int[] depth = new int[1 + 1000*(1000 - 1)/2];
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 入力
		int n = sc.nextInt();
		int[][] v = new int[n][n];
		int id = 0;
		int currentId = 0;
		int prevId = 0;

        for(int k = 0; k < n; k++){
            for(int l = 0; l < n - 1; l++){
                int i = k;
                int j = sc.nextInt() - 1;
                int m = 0;
                if(i > j){
                    int tmp = j;
                    j = i;
                    i = tmp;
                    m = 1;
                }
                if(v[i][j] == 0){
                    id++;
                    v[i][j] = id;
                    //System.out.println((i+1) + "vs" + (j+1) + ":" + id);
                }
                currentId = v[i][j];
                if(prevId == 0){
                    prevId = v[i][j];
                }else{
                    e[currentId][m] = prevId;
                    prevId = currentId;
                    //System.out.println("e[" + currentId + "][" + m + "] = " + e[currentId][m]);
                }
            }
            prevId = 0;
            currentId = 0;
        }
        
		// 計算
		/*
		System.out.println(id);
		for(int i = 1; i <= id; i++){
		    if(e[id][0] == 0 && e[id][1] == 0){
	            System.out.println(i + ":");
		    }else{
    		    System.out.println(i + ":" + e[id][0] + " " + e[id][1]);	        
		    }
		}
		*/
		int result = 0;
		for(int i = 1; i <= id; i++){
		    int res = dfs(i);
		    if(res == -1){
		        result = -1;
		        break;
		    }
		    result = max(result, res);
		}

		// 出力
		System.out.println(result);
	}
	
	static int dfs(int id){
	    if(visited[id] == 1){
    	    if(calculated[id] == 1) return depth[id];
    	    return -1;
	    }
	    visited[id] = 1;
	    depth[id] = 1;
	    if(e[id][0] == 0 && e[id][1] == 0){
    	    calculated[id] = 1;
	        return depth[id];
	    }
	    for(int i = 0; i < e[0].length; i++){
	        if(e[id][i] == 0) continue;
	        int res = dfs(e[id][i]);
	        if(res == -1) return -1;
	        depth[id] = max(depth[id], res + 1);
	    }
	    calculated[id] = 1;
	    return depth[id];
	}
	
}


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

using namespace std;

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

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

	int dp[n];
	dp[0]=0;
	dp[1]=abs(arr[0]-arr[1]);

	for(int i=2;i<n;i++)
	{
		dp[i]=min(abs(arr[i-1]-arr[i])+dp[i-1],abs(arr[i-2]-arr[i])+dp[i-2]);
	}

	cout<<dp[n-1];

	return 0;
}

Measured memory_bytes: 4316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

void print_ans(vector<ll>& a) {
  ll n = SZ(a);
  REP(i, n) { cout << a[i] << " \n"[i == n - 1]; }
}

int main() {
  ll n, k, s;
  cin >> n >> k >> s;
  ll m = 1e9;
  vector<ll> ans;
  REP(i, k) { ans.push_back(s); }
  ll t = s == m ? 1 : s + 1;
  REP(i, n - k) { ans.push_back(t); }
  print_ans(ans);
}

Measured memory_bytes: 2164
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size,-1) { }

    int root(int x){
        if (data[x] < 0) return x;
        else return data[x] = root(data[x]);
    }

    int size(int x){
        return -data[root(x)];
    }

    bool isConnect(int x,int y){
        return root(x) == root(y);
    }

    bool connect(int x , int y){
        x = root(x);
	    y = root(y);
	
        if(x==y) return false;
        
        if(data[x] > data[y]){
            x ^= y;
            y ^= x;
            x ^= y;
        }
        
        data[x] = data[x] + data[y]; // membersize++
        data[y] = x;
        return true;
    }
};

int main(){
	vector<PII> edge;
	int N,M; SCD2(N,M);
	REP(i,M){
		int a,b; SCD2(a,b);
		a--; b--;
		edge.PB(MP(a,b));
	}
	
	int ans = 0;
	REP(e,M){
		bool con = true;
		UnionFind U(N);
		REP(k,M){
			if (k == e) continue;
			int a,b;

			a = edge[k].fst;
			b = edge[k].snd;
			U.connect(a,b);
		}
		
		REP(v,N){
			if (!U.isConnect(0,v)) con = false;
		}

		if (con) ans++;
		
	}

	PRINTD(M-ans);
}

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

#define  prec(n)        fixed<<setprecision(n)
#define  optimize       ios::sync_with_stdio(0); cin.tie(0);
#define  PI             acos(-1.0)
#define  RESET(a, b)    memset(a, b, sizeof(a))
#define  pb             push_back
#define  pii            pair<int,int>
#define  pll            pair<ll,ll>
#define  vv             vector<int>
#define  ff             first
#define  ss             second
#define  sz(v)          v.size()
#define  all(v)         v.begin(),v.end()

int const MOD=(int) 1e9+7;
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }
inline ll mod(ll a, ll m){ if(a<0) return m-(abs(a)%m); else if(a<m) return a; else return (a%m); }
const int N = 200007;
const int MAX=1000005;
int fact[20001];
int main()
{
    optimize
    ll s,n,ans=0;
    cin>>s;
    if(s<3){
        cout<<0<<endl;
        return 0;
    }
    n=s;
    int x=0;
    while(n-3>=3){
        n-=3;
        x++;
    }
    fact[0]=1;
    for(int i=1;i<=2000;i++) fact[i]=modMul(fact[i-1],i);
    for(int i=1;i<=x+1;i++){
        ll N=s-i*3;
        ll tmp=modDiv(fact[i+N-1],modMul(fact[N],fact[i-1]));
        ans=modAdd(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
int dp[100003]={},vis[100003]={},ans=0;
vector<int> adj[100003];
int dfs(int curr)
{
  if(vis[curr]==1) { return dp[curr]; }
  else
    {
      // cout<<curr<<"\n";
      vis[curr]=1;
    // }
      for(int child:adj[curr])
      {
        dp[curr]=max(dp[curr],1+dfs(child));
      }
      ans=max(ans,dp[curr]);
      // cout<<"curr="<<curr<<"dp="<<dp[curr]<<"\n";
      return dp[curr];
     }
}
// int32_t main()
int main()
{  ios_base::sync_with_stdio(false); cin.tie(NULL);
   int i,n,m,x,y;cin>>n>>m;
   for(i=0;i<m;i++)
  {
    cin>>x>>y;
    adj[x].push_back(y);
  }
  for(i=1;i<=n;i++)
  {if(vis[i]!=1) dfs(i);}
  cout<<ans;
}


Measured memory_bytes: 7936
from bisect import bisect_left

n = int(input())
dp = [int(1e9) + 1] * n
eol = 0

for _ in range(n):
    a = int(input())
    if dp[eol] < a:
        eol += 1
        dp[eol] = a
    else:
        dp[bisect_left(dp, a, hi=eol)] = a

print(eol + 1)

Measured memory_bytes: 11400
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int n,m;
int k[11];
int s[11][11];
int p[11];

int main(){
  cin >> n >> m;
  rep(i,0,m){
    cin >> k[i];
    rep(j,0,k[i]){
      cin >> s[i][j];
      s[i][j]--;
    }
  }

  rep(i,0,m) cin >> p[i];
  int c=0;

  for(int S=0;S<1<<n;S++){
    bool t  = true;
    rep(i,0,m){
      int q=0;
      rep(j,0,k[i]) if(S>>s[i][j] & 1) q++;
      t &= (q%2 == p[i]);
    }
    if(t) c++;
  }
  cout << c << endl;

  return 0;
}


Measured memory_bytes: 256
fn main() {
    let v: Vec<i32> = read_vec();
    println!("{}", if (v[0] * v[1]) % 2 == 0 { "No" } else { "Yes" });
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long double a;
    cin >> a;
    a /= 3;
    cout << fixed << setprecision(6)<< a*a*a << endl;
}


Measured memory_bytes: 256
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-O2")
#define int long long

using namespace std;

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

const int N = 52;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

int n, a[N], b[N], dp[N][N];
ll ans;
bool mark[N];

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	//return cout << -1, 0;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	for (int i = 0; i < N; i++)for( int j = 0; j < N; j++) dp[i][j] = INF; 
	dp[0][0] = 0;
	for (int i = 1; i < N; i++){
		dp[i][i] = 0;
		 for (int j = 0; j < i; j++){
		 	for (int k = 1; k <= i; k++){
			 	if (dp[i % k][j] != INF){
					dp[i][j] = k;
					break; 
				}
			}
		 }
	}
	for (int i = 1; i <= n; i++) if (dp[a[i]][b[i]] == INF) return cout << -1, 0;
	int mx = 0;
	for (int i = 1; i <= n; i++) mx = max(mx, dp[a[i]][b[i]]);
	while (mx != 0){
		mark[mx] = 1;
		ans += (1ll << mx);
		for (int i = 0; i < N; i++)for( int j = 0; j < N; j++) dp[i][j] = INF; 	
		dp[0][0] = 0;
		for (int i = 1; i < N; i++){
			dp[i][i] = 0;
			for (int j = 0; j < i; j++){
				for (int k = 1; k <= i; k++){
					if (mark[k]){
						if (dp[i % k][j] != INF)dp[i][j] = min(dp[i][j], dp[i % k][j]);
					}else{
						if (dp[i % k][j] != INF) dp[i][j] = min(dp[i][j], k);
					}
				}
			}
		}
		mx = 0;
		for (int i = 1; i <= n; i++) mx = max(mx, dp[a[i]][b[i]]);
	}
	cout << ans;







	return 0;
}

/*
3
19 10 14
0 3 4
*/



Measured memory_bytes: 256
def main():
    import sys
    #input = sys.stdin.readline
    mod = 10**9+7
    L = input()[::-1]
    K = len(L)
    S = 1
    
    for i in range(K):
        if L[i] == "1":
            S = (2*S + pow(3,i,mod))%mod
    
    print(S)
    
main()

Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define n_max 100

int main(){
    int n;
    cin >>n;
    int A[n_max+5];
    int sum=0;
    REP(i,n){
        scanf("%d",&A[i]);
        sum+=A[i];
    }
    float ave;
    ave=float(sum) / n;
    int id=0;
    float tmp=1000000;
    REP(i,n){
        if(abs(float(A[i]) - ave) <tmp){
            tmp = abs(float(A[i]) - ave);
            id=i;
        }
    }
    cout << id << endl;
}

Measured memory_bytes: 256