akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;

void solve()
{	
	double l; cin >> l;
	cout << pow(l/3,3) << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <stdlib.h>
using namespace std;

int N,M;
int a[55],b[55],Map[55][55];
int visit[55];

bool dfs(int l,int r,int num)
{
    int j ;
    if(l==r||Map[l][r]==1)
        return true;
    visit[num] = l;
    for(int i = 1;i<=M;i++){
        for(j=0;j<num;j++){
            if(visit[j]==i)
                break;
        }
        if(j<num&&visit[j]==i) continue;
        if(Map[l][i]!=1) continue;
        if(dfs(i,r,num+1))
            return true;
    }

    return false;
}

int main(){
    cin>>N>>M;
    for(int i = 1;i<=M;i++){
        cin>>a[i]>>b[i];
        Map[a[i]][b[i]] = Map[b[i]][a[i]] = 1;
    }

    int sum = 0;
    for(int i = 1;i<=M;i++){
        memset(visit,0,sizeof(visit));
        Map[a[i]][b[i]] = 0;
        if(!dfs(a[i],b[i],0))
            sum++;
        Map[a[i]][b[i]] = 1;
    }
    cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
/// 5:50 PM 12/05/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>

using namespace std;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define VARIABLE_ERROR(x) cout << #x << " = " << x << endl;
#define CONTAINER_ERROR(v) cout << "{";for (auto &x:v) { cout << x << ','; }cout << "}" << endl;
#define PI 3.14159265358979323846
#define M 1000000007
#define INF 1e15
typedef long long ll;
vector<vector<ll> > I;

vector<vector<ll> > multiply(vector<vector<ll> > &v1, vector<vector<ll> > &v2) {
    ll r1 = v1.size();
    ll c1 = v1[0].size();
    ll r2 = v2.size();
    ll c2 = v2[0].size();
    vector<vector<ll> > ans(r1, vector<ll>(c2, 0));
    for (ll i = 0; i < r1; i++) {
        for (ll j = 0; j < c2; j++) {
            for (ll k = 0; k < c1; k++) {
                ll temp = v1[i][k] * v2[k][j];
                temp = (temp % M);
                ans[i][j] = (ans[i][j] + temp) % M;
            }
        }
    }
    return ans;
}

vector<vector<ll> > matrixPower(vector<vector<ll>> &v, ll k) {
    if (k == 0) {
        return I;
    }
    if (k == 1) {
        return v;
    }
    ll mid = (k / 2);
    vector<vector<ll> > half = matrixPower(v, mid);
    half = multiply(half, half);
    if (k & 1) {
        half = multiply(half, v);
    }
    return half;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n, k;
    cin >> n >> k;
    vector<vector<ll> > v(n, vector<ll>(n));
    for (auto &x:v) {
        for (auto &y:x) {
            cin >> y;
        }
    }
    I = vector<vector<ll>>(n, vector<ll>(n, 0));
    for (ll i = 0; i < n; i++) {
        I[i][i] = 1;
    }
    vector<vector<ll> > multiple = matrixPower(v, k);
    ll ans = 0;
    for (ll i = 0; i < n; i++) {
        for (ll j = 0; j < n; j++) {
            ans = (ans + multiple[i][j]) % M;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x1 = sc.nextDouble();
		double y1 = sc.nextDouble();
		double x2 = sc.nextDouble();
		double y2 = sc.nextDouble();
		System.out.println(Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)));
	}
}



Measured memory_bytes: 27984
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb1=new StringBuilder();
		StringBuilder sb2=new StringBuilder();
		String b=" ";
        String[] rc=br.readLine().split(b);
        int r=Integer.parseInt(rc[0]);
        int c=Integer.parseInt(rc[1]);
        int[] ct=new int[c];
        int t=0,rt=0,v=0;
        String str=null;
        String[] row=null;
        for(int i=0;i<r;i++){
        	str=br.readLine();
        	row=str.split(b);
        	rt=0;
        	for(int j=0;j<c;j++){
        		v=Integer.parseInt(row[j]);
        		ct[j]+=v;
        		rt+=v;
        		if(i==r-1){
        			t+=ct[j];
        			sb2.append(ct[j]+b);
        		}
        	}
        	sb1.append(str+b+rt+"\n");
        }
        sb1.append(sb2).append(t);
        System.out.println(sb1);
	}
}

Measured memory_bytes: 27228
#include<iostream>
#include<vector>
#include<string>
#include<map>

using ll = long long;
ll n;
const ll MAX = 1000000;
std::vector<bool> table(MAX + 1, true);
std::vector<ll> fact;

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

void initTable(){
    table[0] = false;
    table[1] = false;
    for(ll i = 2; i*i <= MAX; i++){
        if(table[i]){
            fact.push_back(i);
            for(ll j = i*i; j <= MAX; j += i){
                table[j] = false;
            }
        }
    }
}

int main(){
    initTable();
    std::cin >> n;
    std::vector<ll> a(n);
    std::cin >> a[0];
    std::map<ll, ll> mp;
    ll g = a[0];
    ll maxCnt = 0, maxMap = 0;
    ll k = fact.size();
    std::vector<ll> cnt(k, 0);
    for(int j = 0; j < k; j++){
        if(a[0] % fact[j] == 0){
            a[0] /= fact[j];
            cnt[j]++;
            maxCnt = std::max(maxCnt, cnt[j]);
        }
    }
    if(table[a[0]]) mp[a[0]]++;

    for(int i = 1; i < n; i++){
        std::cin >> a[i];
        g = gcd(g, a[i]);
        for(int j = 0; j < k; j++){
            if(a[i] % fact[j] == 0){
                a[i] /= fact[j];
                cnt[j]++;
                maxCnt = std::max(maxCnt, cnt[j]);
            }
        }

        if(table[a[i]]){
            mp[a[i]]++;
            maxMap = std::max(maxMap, mp[a[i]]);
        }
    }

    maxCnt = std::max(maxMap, maxCnt);
    // std::cout << maxCnt << " " << g << std::endl;

    if(maxCnt >= 2 && g > 1){
        std::cout << "not coprime" << std::endl;
    }else if(maxCnt >= 2 && g == 1){
        std::cout << "setwise coprime" << std::endl;
    }else{
        std::cout << "pairwise coprime" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 15944
#include <iostream>
#include <string>
#include <algorithm>
#include<cstdio>
#include<map>
#include<cstring>
using namespace std;
typedef long long ll;
const int man=200005;
int n,m;
int a[man];

int main()
{
   //freopen("in.txt","r",stdin);
   cin>>n;
   int t=(n+110)/111;
   cout<<t*111<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long int
#define ld long double
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define pb push_back

using namespace std;
typedef pair<int, int> pii;

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

    int maxStreak = 0;
    int streak = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        if (a == b) streak++;
        else streak = 0;

        maxStreak = max(maxStreak, streak);
    }

    if (maxStreak >= 3) cout << "Yes";
    else cout << "No";

}


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


pair<long long,long long> bs(long long x,long long ar[],int r,int l){
  if(ar[l]<x)return make_pair(ar[l],10e+10);
  if(ar[r]>x)return make_pair(10e+10,ar[r]);
  while(l-r>1){
	if(ar[(l+r)/2]==x)l=r=(l+r)/2;
	else if(ar[(l+r)/2]<x)r=(l+r)/2;
	else l=(l+r)/2;
  }
  return make_pair(ar[r],ar[l]);
}

long long search_min(long long x,pair<long long,long long>p1,pair<long long,long long>p2){
  p1=make_pair(abs(x-p1.first),abs(x-p1.second));
  p2=make_pair(abs(x-p2.first),abs(x-p2.second));
  long long res=p1.first+p2.second+min(p1.first,p2.second);
  res=min(res,p2.first+p1.second+min(p2.first,p1.second));
  res=min(res,max(p1.first,p2.first));
  res=min(res,max(p1.second,p2.second));
  return res;
}
  
int main(){
  long long a[100010],b[100010];
  int na,nb,q;cin>>na>>nb>>q;
  for(int i=0;i<na;++i)cin>>a[i];
  for(int i=0;i<nb;++i)cin>>b[i];
  while(q--){
	long long x;cin>>x;
	pair<long long,long long>p1=bs(x,a,0,na-1),p2=bs(x,b,0,nb-1);
	cout<<search_min(x,p1,p2)<<endl;
  }
  return 0;
}


Measured memory_bytes: 2816
#include<stdio.h>

int main(void){
	int a;
	int b;
	int d,r;
	double f;
	scanf("%d %d",&a,&b);
	
	d = a / b;
	r = a % b;
	f = 1.0 * a / b;
	
	printf("%d %d %.8lf\n",d,r,f);

	return 0;
}


Measured memory_bytes: 2144
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <math.h>

int main(void) {
	using namespace std;
	double r;
	cin >> r;
	cout << fixed << setprecision(6)<< r * r * M_PI << ' ' << 2 * M_PI * r << endl;
	return 0;
}

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

#define pb     push_back
#define mp     make_pair
#define all(v) v.begin() , v.end()
#define allr(v) v.rbegin(), v.rend()
const ll INF =  0x3f3f3f3f;
const int MOD = 1e9+7;
const int MAX = 1e5+5;

int n;
string s1, s2;
int type;
ll ans;

int main(int argc, char const *argv[])
{
  ios_base::sync_with_stdio(false);
  
  // #ifndef ONLINE_JUDGE
  // freopen("in","r",stdin);
  // freopen("out","w",stdout);
  // #endif

  type = 0;
  ans = 1;
  cin >> n;
  cin >> s1 >> s2;

  for(int i = 0 ; i < n ; i++){
  	if(type == 0){
  		if(s1[i] == s2[i]){
  			ans = (ans * 3)%MOD;
  			type = 1;
  		}
  		else{
  			ans = ans * 6;
  			type = 2;
  			i++;
  		}
  	}
  	else if(type == 1){
  		if(s1[i] == s2[i]){
  			ans = (ans * 2)%MOD;
  			type = 1;
  		}
  		else{
  			ans = (ans * 2)%MOD;
  			type = 2;
  			i++;
  		}
  	}
  	else{
  		if(s1[i] == s2[i]){
  			type = 1;
  		}
  		else{
  			ans = (ans * 3)%MOD;
  			type = 2;
  			i++;
  		}
  	}
  }

  cout << ans;



  return 0;
}  

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int k,s,ans=0;
    cin>>k>>s;
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            if(s-i-j>=0&&s-i-j<=k)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define EPS 0.0000000001
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;

int N;
int F[100][14];
int P[100][15];

int main()
{
    scanf("%d", &N);
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 10; j++)
            scanf("%d", &F[i][j]);
    }
    for (int i = 0; i < N; i++)
        for (int j = 0; j < 11; j++)
            scanf("%d", &P[i][j]);
    int res = -(1 << 30);
    for (int b = 1; b < (1 << 10); b++)
    {
        int cc = 0;
        for (int i = 0; i < N; i++)
        {
            int c = 0;
            for (int j = 0; j < 10; j++)
                if ((b >> j & 1) && F[i][j])
                    c++;
            cc += P[i][c];
        }
        if (res < cc)
            res = cc;
    }
    cout << res;
}

Measured memory_bytes: 256
using System;

namespace Atcoder1
{
    public class Program
    {
        public static void Main(string[] args)
        {
            string[] nums = Console.ReadLine().Split(' ');
            decimal num1 = decimal.Parse(nums[0]);
            decimal num2 = decimal.Parse(nums[1]);

            decimal ans = num1 * num2;

            Console.WriteLine(Math.Floor(ans));
        }
    }
}

Measured memory_bytes: 27620
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
//int dx[]={+1,-1,+0,+0};///Four Directions
//int dy[]={+0,+0,+1,-1};///Four directions
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions

//int mark[10007];vi prime;void seive(){for(int i=2;i<10000;i++){if(mark[i]==0){prime.pb(i);for(int j=i+i;j<=10000;j+=i)mark[j]=1;}}}

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

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

   int n,m,x; cin>>n>>m>>x;


   vector<int>v[n+3];


   for(int i=0;i<n;i++) {
    int cc;
    cin>>cc;
    v[i].pb(cc);
    for(int j=0;j<m;j++){
        int c; cin>>c;
        v[i].pb(c);
    }
   }


    bool flag=false;
    int res=100000000;
    ll len=pow(2,n)-1;

    for (int mask = 0; mask <=len; mask++) {
        int coin = 0,xp=0;
        vector<int>tem(m,0);
        for (int j = 0; j < n; ++j) {
            if((1<<j)&mask){
                coin+=v[j][0];
                for(int I=1;I<=m;I++) {
                    tem[I-1]+=v[j][I];
                }
            }
        }
        int f=1;
        for(int I=0;I<m;I++) {
                    if(tem[I]<x) f=0;
                }

                if(f==1){
                    flag=true;
                    res=min(res,coin);
                }
    }



    if(!flag) cout<<-1<<endl;
    else cout<<res<<endl;
   End;
}


Measured memory_bytes: 4072
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    int l=0,r=1<<30;
    int n,m;
    cin>>n>>m;
    rep(i,0,m){
        int lv,rv;
        cin>>lv>>rv;
        chmax(l,lv);
        chmin(r,rv);
    }
    cout<<max(r-l+1,0)<<endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        int len = S.length();
        while (len > 0) {
            boolean found = false;
            for (String word : words) {
                if (len < word.length()) {
                    continue;
                }
                String w = S.substring(len - word.length(), len);
                if (w.equals(word)) {
                    len -= w.length();
                    found = true;
                }
            }
            if (!found) {
                break;
            }
        }

        if (len == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 28112
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

struct FastIO
{
  FastIO() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(0); 
  }
} fastio;

int zpowl(int v,int k) { int r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }

signed main() {
	int n;
	std::cin >> n;
	int m = zpowl(2,n);
	std::vector<int> s(m);
	rep(i,m) std::cin >> s[i];
	std::multiset<int,std::greater<int> > set;
	for(int i:s) set.emplace(i);
	std::vector<int> created;
	auto it = set.begin();
	created.emplace_back(*it);
	set.erase(it);
	rep(i,n) {
		rep(j,zpowl(2,i)) {
			auto it = set.upper_bound(created[j]);
			if(it==set.end()) {
				print("No");
				return 0;
			}
			created.emplace_back(*it);
			set.erase(it);
		}
	}
	print("Yes");

	return 0;
}


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

int main() {
    string n;
    cin >> n;
    vector<int> digits(n.size() + 1);
    rep(i, (int)n.size()) digits[i + 1] = n[i] - '0';
    reverse(digits.begin(), digits.end());
    digits[digits.size() - 1] = 0;
    int ans = 0;
    rep(i, (int)digits.size()) {
        if (digits[i] < 5 || (digits[i] == 5 && digits[i + 1] < 5))
            ans += digits[i];
        else {
            if (digits[i] < 10) ans += 10 - digits[i];
            digits[i + 1]++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 5252
n = int(input())
csf = [list(map(int, input().split())) for _ in range(n-1)]

for j in range(n-1):
    time = 0
    for i in range(j, n-1):
        c = csf[i][0]
        s = csf[i][1]
        f = csf[i][2]
        if time <= s:
            time = s+c
        else:
            if (time - s) % f == 0:
                time += c
            else:
                time += (f - (time - s)) % f + c
    print(time)
print(0)


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

int main() {
	char a, b;
	cin >> a >> b;
	if(a == 'H' && b == 'H' || a == 'D' && b == 'D') {
		cout << 'H' << endl;
	} else {
		cout << 'D' << endl;
	}
	return 0;
}

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

using namespace std;
#define int long long
#define maxn 666
vector<int> v[maxn];
int vis[maxn];
int match[maxn];
int e[maxn][maxn];
int n,m;
int dfs(int u){  //匈牙利算法模板
    for(int i=1;i<=n;i++){
        if(vis[i]==0&&e[u][i]==1){
            vis[i]=1;
            if(match[i]==0||dfs(match[i])){
                match[i]=u;
                return 1;
            }
        }
    }
    return 0;
}
void floyed(){
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				if(e[i][k]&&e[k][j])
					e[i][j]=1;
	return ;
}
signed main(){
	
	int a,b,c;cin>>a>>b>>c;cout<<c<<" "<<a<<" "<<b;
	return 0;
}

/*
3
1 3 4
6 7 9
1 1 2 3

*/

Measured memory_bytes: 256
#include<queue>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  vector<vector<int> > g(110);
  int INF=(1<<29);
  int x,n,i,j,v,k,u,ans[110];
  queue<int> q;
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      g[u].push_back(v);
    }
  }
  for(i=0;i<n;i++){
    ans[i]=INF;
  }
  q.push(0);
  ans[0]=0;
  while(!q.empty()){
    x=q.front();
    q.pop();
    for(i=0;i<g[x].size();i++){
      if(ans[g[x][i]]>ans[x]+1){
        ans[g[x][i]]=ans[x]+1;
        q.push(g[x][i]);
      }
    }
  }
  for(i=0;i<n;i++){
    if(ans[i]==INF){
      ans[i]=-1;
    }
  }
  for(i=0;i<n;i++){
    printf("%d %d\n",i+1,ans[i]);
  }
  return 0;
}


Measured memory_bytes: 3268
import sys
import itertools
N=int(sys.stdin.readline().strip())
L=map(int, sys.stdin.readline().split())
LL=list( itertools.combinations(L,3) )
ans=0
for a,b,c in LL:
    if a+b>c and b+c>a and c+a>b and a!=b and b!=c and c!=a:
        ans+=1
print ans


Measured memory_bytes: 89216
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007

int N, K;
int ans = 1e9;
vi S;

void dfs(int x) {
    if (x >= N) {
        ans = min(ans, x);
        return;
    }
    for (auto y : S) {
        if (x == 0 && y == 0) continue;
        dfs(10 * x + y);
    }

}

int main() {
    cin >> N >> K;
    set<int> D;
    rep(i, K) {
        int d; cin >> d;
        D.insert(d);
    }
    rep(i, 10) {
        if (!D.count(i)) S.pb(i);
    }

    dfs(0);

    cout << ans << endl;


}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	X := make([]int, M)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < M; i++ {
		X[i] = nextInt(sc)
	}
	if N >= M {
		fmt.Println(0)
		return
	}
	sort.Ints(X)
	D := make([]int, 0)
	for i := 1; i < M; i++ {
		D = append(D, X[i]-X[i-1])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(D)))
	// fmt.Println("X", X, "total length", X[len(X)-1]-X[0], "D", D)
	ans := X[len(X)-1] - X[0]
	for i := 0; i < N-1; i++ {
		ans -= D[i]
	}
	fmt.Println(ans)
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
using namespace std;

int main() {
    int A[3][3];
    rep(i, 3) rep(j, 3) cin >> A[i][j];

    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;
        rep(j, 3) rep(k, 3) {
            if (A[j][k] == b) {
                A[j][k] = 0;
            }
        }
    }

    bool ok = false;
    if (A[0][0] == 0 && A[0][1] == 0 && A[0][2] == 0) ok = true;
    if (A[1][0] == 0 && A[1][1] == 0 && A[1][2] == 0) ok = true;
    if (A[2][0] == 0 && A[2][1] == 0 && A[2][2] == 0) ok = true;
    if (A[0][0] == 0 && A[1][0] == 0 && A[2][0] == 0) ok = true;
    if (A[0][1] == 0 && A[1][1] == 0 && A[2][1] == 0) ok = true;
    if (A[0][2] == 0 && A[1][2] == 0 && A[2][2] == 0) ok = true;
    if (A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0) ok = true;
    if (A[0][2] == 0 && A[1][1] == 0 && A[2][0] == 0) ok = true;

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define per(i,a,b) for(int i=(b);i>=(a);i--)
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Forenska(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
using namespace std;
typedef long long LL;
typedef pair<int,int> Pair;
typedef vector<int> vec;
const long double PI=3.14159265358979323846264338327950288;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const int MAX_N=100005;
int N;
vec G[MAX_N];
int dist[MAX_N];
int main()
{
	memset(dist,-1,sizeof(dist));
	cin>>N;
	rep(i,0,N-1)
	{
		int a,b;
	//	cin>>a>>b;
		scanf("%d%d",&a,&b);
		G[a].pb(b);
		G[b].pb(a);
	}
	priority_queue <Pair,vector<Pair>,greater<Pair> > q;
	int K;
	cin>>K;
	rep(i,0,K)
	{
		int v,p;
	//	cin>>v>>p;
		scanf("%d%d",&v,&p);
		dist[v]=p;
		q.push(mp(p,v));
	}
	while(!q.empty())
	{
		Pair t=q.top();
		q.pop();
		rep(i,0,G[t.se].size())
		{
			int to=G[t.se][i];
			if(dist[to]==-1)
			{
				dist[to]=dist[t.se]+1;
				q.push(mp(t.fi+1,to));
			}
		}
	}
	For(i,1,N)
	{
		for(int v:G[i])
		{
			if(abs(dist[i]-dist[v])!=1)
			{
				puts("No");
				return 0;
			}
		}
	}
	puts("Yes");
	For(i,1,N)printf("%d\n",dist[i]);
	return 0;
}


Measured memory_bytes: 7924
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main(){
    int a, b;
    cin >> a;
    cin >>b;
    if(a+b==3) cout << 3 << endl;
    if(a+b==4) cout << 2 << endl;
    if(a+b==5) cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

class BinarySearchTree
{
public:
    BinarySearchTree()
    : root((Node*)nullptr)
    {}
    ~BinarySearchTree() {}

    struct Node
    {
        Node() {}
        Node(int u)
        : key(u), p((Node*)nullptr), l((Node*)nullptr), r((Node*)nullptr)
        {}
        Node(const Node& node)
        : key(node.key), p(node.p), l(node.l), r(node.r)
        {}
        ~Node() {} 
        int key;
        Node *p, *l, *r;
    };

    void insert(int u)
    {
        Node* y = nullptr;
        Node* x = root;
        Node* z = new Node(u);
        while (x != nullptr)
        {
            y = x;
            if (z->key < x->key)
            {
                x = x->l;
            }
            else
            {
                x = x->r;
            }
        }
        z->p = y;

        if (y == nullptr)
        {
            root = z;
        }
        else if (z->key < y->key)
        {
            y->l =z;
        }
        else
        {
            y->r = z;
        }
    }

    bool find(int key)
    {
        Node* x = root;
        while (x)
        {
            if (x->key == key)
            {
                return true;
            }
            else if (key < x->key)
            {
                x = x->l;
            }
            else
            {
                x = x->r;
            }
        }
        return false;
    }

    void preorder(Node* u)
    {
        Node* l = u->l;
        Node* r = u->r;
        cout << " " << u->key;
        if (l) preorder(l);
        if (r) preorder(r);
    }

    void inorder(Node* u)
    {
        Node* l = u->l;
        Node* r = u->r;
        if (l) inorder(l);
        cout << " " << u->key;
        if (r) inorder(r);
    }

    Node* root;
};

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

    int n;
    cin >> n;

    BinarySearchTree bst;
    char cmd[10];
    int u;
    rep (i, n)
    {
        cin >> cmd;
        // cout << i << ": cmd, u = " << cmd << ", " << u << "\n";
        if (cmd[0] == 'i')
        {
            cin >> u;
            bst.insert(u);
        }
        else if (cmd[0] == 'f')
        {
            cin >> u;
            if (bst.find(u)) cout << "yes\n";
            else cout << "no\n";
        }
        else if (cmd[0] == 'p')
        {
            bst.inorder(bst.root);
            cout << "\n";
            bst.preorder(bst.root);
            cout << "\n";
        }
    }

    return 0;
}



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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back


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

    vec D;
    ll k = 1;
    while(k * k < N) {
        if(N % k == 0) {
            D.pb(k);
            D.pb(N / k);
        }
        ++k;
    }
    if(N % k == 0) D.pb(k);
    ASC(D);

    ll sum = 0;
    FORR(d,D) {
        if(N / d <= d - 2) sum += d - 1;
    }
    PR(sum);


    return 0;
}

/*



*/

Measured memory_bytes: 3572
function Main(input) {
  input = input.trim().split("\n").map(function(x) { return x.split(" ")});
  var vec_x = input[0].map(e => parseInt(e, 10));
  var ans;
  for (var i = 0; i < 5; i++){
    if (vec_x[i] === 0) ans = i+1;
  }
  console.log(ans);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29588
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()

    return s[:3] + '8' + s[4:]

print(main())




Measured memory_bytes: 8132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    int A,B;cin>>A>>B;
    cout<<max({A+B,A-B,A*B})<<endl;
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define lli long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// int const mod = 7340033;
int const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}
 
int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 1e7+5;
int const inf = 2e9;


void solve(){
    int i,j,l;
    int n;
    cin>>n;
    int a[n];
    int mn = inf;
    int ans = 0;
    for(i=0;i<n;i++){
        int x;cin>>x;
        if(mn > x) ans++;
        mn = min(mn, x);
    }
    cout<<ans<<endl;
}   

int32_t main(){
    IOS;	
    int t;
    t = 1;
    // pre_compute();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

/*

*/

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 60005
#define M 200005
#define seed 23333

using namespace std;
int i,j,m,n,p,k,tot,T,ID[N],up[N],used[N],vis[N],a[N],Q[N],bl[N];
vector<int>v[N],nex[N];
map<int,int>mp;
void ins(int id,int pr)
{
		if (mp.find(pr)==mp.end()) mp[pr]=++tot;
		nex[mp[pr]].pb(id);
		nex[id].pb(mp[pr]);		
}
void bfs(int x)
{
		Q[Q[0]=1]=x;
		++T;
		up[x]=1;
		bl[x]=T;
		int i,l;
		for (l=1;l<=Q[0];++l)
		{
				int p=Q[l];
				for (i=0;i<(int)nex[p].size();++i)
				{
						int k=nex[p][i];
						if (up[k]||used[k]) continue;
						up[k]=1;
						bl[k]=T;
						Q[++Q[0]]=k;
				}
		}
}
int gcd(int x,int y)
{
		return !y?x:gcd(y,x%y);
}
void rebuild()
{
		int i;
		memset(up,0,sizeof(up)); T=0;
		for (i=1;i<=n;++i)	
			if (!used[i]&&!up[i]) bfs(i);
}
void renew_block()
{
		int i;
		for (i=1;i<=T;++i) ID[i]=0;
		for (i=1;i<=n;++i)
			if (!used[i]&&vis[i]&&(!ID[bl[i]]||a[ID[bl[i]]]>a[i])) ID[bl[i]]=i; 
}
int work()
{
	    int i;
		renew_block();
		int now=1;
		for (i=2;i<=T;++i)	if (a[ID[now]]<a[ID[i]]) now=i;
		used[ID[now]]=1;
		for (i=1;i<=n;++i) if (bl[i]==now) vis[i]=0;
		for (i=0;i<(int)v[ID[now]].size();++i)
			vis[v[ID[now]][i]]=1; 
		rebuild();
		return a[ID[now]];
}
int main()
{
	scanf("%d",&n); tot=n;
	for (i=1;i<=n;++i)
	{
			scanf("%d",&a[i]);
			for (j=2,k=a[i];j*j<=k;++j)
				if (k%j==0)
				{
						ins(i,j);
						while (k%j==0) k/=j;
				}
			if (k>1) ins(i,k);
	}
	for (i=1;i<=n;++i)
		for (j=1;j<=n;++j) if (gcd(a[i],a[j])!=1) v[i].pb(j);
	for (i=1;i<=n;++i) vis[i]=1;
	rebuild();
	for (i=1;i<=n;++i) printf("%d ",work()); 
}


Measured memory_bytes: 18944
#include<stdio.h>
#include<math.h>



int main(){

int n;
int count = 0;
scanf("%d",&n);

while(n!=0){
	int digit = n%10;
	if(digit==7){
		printf("Yes\n");
		count++;
		break;
	}
	n/=10;
}

if(count==0){
	printf("No\n");
}



return 0; 
} 

Measured memory_bytes: 1656
buf = input().split(" ")
H=int(buf[0])
N=int(buf[1])
 
A = list(map(int, input().split())) 
 
A=sorted(A, reverse=True)
 
for i in range(N):
  if H<=0:
    break
  H=H-A[i]
 
if H<=0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 13964
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;//政府の判定
  int c;//最少
  long int t;//和
  int n;
  int i;
  b=1;
  t=0;
  c=1000000000;
  cin >>n;
  for (i=0; i<n; i++){
    cin >>a;
    if(a<0){
      	b=(-1)*b;
    }
      
    if(a<0){
      a=a*(-1);
    }
    t=t+a;
    if(a<c){
      c=a;
    }
  
  }
  if(b<0){
    t=t-2*c;
  }
  cout<<t;
}

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

int main(){
    int N;
    cin >> N;
    int a[N];
    map<int,int> m;
    for(int i=0;i<N;i++){
        cin >> a[i];
        m[a[i]]++;
    }
    int ans=0;
    for(auto it=m.begin();it!=m.end();it++){
        if(it->first==it->second){
            continue;
        }
        if(it->first<it->second){
            ans+=it->second-it->first;
        }else{
            ans+=it->second;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

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

    for(int i=0;i<(S.length()-1);i++){
        if(S[i]==S[i+1]){

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

    cout<<"Good"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 200000 + 5;

int main() {
	int n,k;
	cin >> n >> k;
	int t = 0;
	while(n != 0){
		int f = n % k;
		t++;
		n /= k;
	}
	cout << t << endl;
	return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,s[200000],t[200000],f=-1,l=1e12+1,m,ok,an;
int main(void){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    for(int i=0;i<n;i++){
        cin>>t[i];
    }
    sort(s,s+n);
    sort(t,t+n);
    reverse(t,t+n);
    while(l-f>1){
        an=0;
        ok=0;
        m=(l+f)/2;
        for(int i=0;i<n;i++){
            an+=max(0LL,s[i]-(m/t[i]));
            if(an>k){
                f=m;
                ok=1;
                break;
            }
        }
        if(ok==0){
            l=m;
        }
    }
    cout<<l<<endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
#define f   first
#define s   second
#define pb          push_back
#define mod         1000000007
#define hell        998244353
#define inf         1000000000000000000LL
using namespace std;
ll n,k,m;
//ll dp[15][1005];
ll dp[105][100005];
void solve()
{   ll W;
    cin>>n>>W;
    vector<ll> w(n+1),v(n+1);
    for(int i=1;i<=n;i++) cin>>w[i]>>v[i];
    for(int i=0;i<100005;i++) dp[0][i]=inf;
    for(int i=0;i<=104;i++) dp[i][0]=0;
            //dp[0][0]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<100005;j++)
        {
            if(j>=v[i])
                dp[i][j]=min(dp[i-1][j],w[i]+dp[i-1][j-v[i]]);
            else dp[i][j]=dp[i-1][j];
        }
    }
    ll ans=0;
    for(int i=0;i<100005;i++) if(dp[n][i]<=W) ans=max(ans,(ll)i);
        cout<<ans;
}

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

}

Measured memory_bytes: 82176
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
using namespace std;
#define loop(i,a,b) for(int i = a; i < b; i++)
#define rep(i,a) loop(i,0,a)
#define shosu(x) fixed<<setprecision(x)
typedef long long ll;

int main()
{	
	int n;
	cin>>n;
	int t[100];
	ll sum=0;
	rep(i,n){ 
		cin>>t[i];
		sum+=t[i];
	}
	int m;
	cin>>m;
	int p[100];
	int x[100];
	rep(i,m)
			cin>>p[i]>>x[i];
 	rep(i,m)
	cout<<sum-t[p[i]-1]+x[i]<<endl;
			


	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int X;
    cin >> X;
    vector<ll> C = { 100, 101, 102, 103, 104, 105 };
    vector<vector<bool>> dp(C.size() + 1, vector<bool>(X + 1, false));
    dp[0][0] = true;
    rep(i, C.size()) {
        rep(j, X + 1) {
            //if (dp[i][j] == false) continue;
            if(j - C[i] >= 0)
                dp[i + 1][j] = dp[i + 1][j]  | dp[i][j] | dp[i + 1][j - C[i]];
            else {
                dp[i + 1][j] = dp[i + 1][j]  | dp[i][j];
            }
        }
    }
    if (dp[C.size()][X] == true) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 384
N,M = map(int,input().split())

if N == 1 and M == 1:
  ans = 1
elif N == 1 or M == 1:
  ans = N * M - 2
elif N == 2 or M == 2:
  ans = 0
else:
  ans = (N - 2) * (M - 2)
  
print(ans)

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

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

const int MAXN = 1e5;
int n, a[MAXN + 5];

int main() {
    read(n);
    for (int i = 1; i <= n; ++i) read(a[i]);
    sort(a + 1, a + n + 1, greater<int>());
    for (int i = 1; i <= n; ++i)
        if (i + 1 > a[i + 1]) {//找到以原点为左下角的最大正方形，其右上方顶点为 (i, i) 
            int j = 0;
            for (; a[j + i + 1] == i; ++j);
            if (((a[i] - i) & 1) || (j & 1)) puts("First");
            else puts("Second");
            break;
        }
    return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;

    int ans = 0;
    rep(i, 3) if (s[i] == t[i]) ans++;

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int Mo=1000000007;
int f[3010][3010][2];
inline void upd(int &x,int y) {x=(x+y)%Mo;}
int main() {
    int n,m,ans=0;
    cin>>n>>m;
    f[0][0][1]=1;
    for(int i=1;i<n;i++) f[0][i][0]=1;
    for(int i=0;i<m-1;i++)
	for(int j=0;j<n;j++)
	    for(int k=0;k<2;k++) {
		int v=f[i][j][k];
		if(v) {
		    if(j) upd(f[i+1][j-1][k|(j==1)],v);
		    if(j<n-1) upd(f[i+1][j+1][k],v);
		    upd(f[i+1][j][k],2*v%Mo);
		}
	    }
    for(int i=0;i<=n;i++) ans=(ans+f[m-1][i][1])%Mo;
    cout<<4LL*ans%Mo;
    return 0;
}

Measured memory_bytes: 70784
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


map<ll, vector<pair<ll, ll>>> G;
map<ll, ll> C;


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    for (ll i = 1; i <= N; ++i) {
        G[i];
        C[i] = -1;
    }
    rep (i, N - 1) {
        ll u, v, w;
        cin >> u >> v >> w;
        G[u].pb({v, w});
        G[v].pb({u, w});
    }
    set<ll> memo;
    queue<pair<ll, ll>> q;
    q.push({1, 0});
    for (ll i = 1; i <= N; ++i) {
        auto u = q.front();
        //cout << u.fst << ", " << u.snd << endl;
        q.pop();
        if (u.snd % 2 == 0) {
            C[u.fst] = 1;
        } else {
            C[u.fst] = 0;
        }
        memo.ist(u.fst);
        for (auto v : G[u.fst]) {
            if (memo.count(v.fst)) continue;
            q.push({v.fst, u.snd + v.snd});
        }
    }
    for (ll i = 1; i <= N; ++i) {
        cout << C[i] << endl;
    }
}


Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std;
int findGCD(int arr[], int n) 
{ 
    int result = arr[0]; 
    for (int i = 1; i < n; i++) 
    { 
        result = __gcd(arr[i], result); 
  
        if(result == 1) 
        { 
           return 1; 
        } 
    } 
    return result; 
} 
int main()
{
int n;
cin>>n;
int ans;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
ans=log2(findGCD(a,n));
cout<<ans;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    string s,t;
    cin >> s >> t;
    sort(all(s));
    sort(rall(t));
    if(s < t)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
// abc148_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif
    
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    
    string ans = "";
    REP(i, N){
        ans += S[i];
        ans += T[i];
    }
    print(ans);


    return 0;
}


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

int main() {
  int n,k,sum=0;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    if(x*2>k)
      sum+=(k-x)*2;
    else
      sum+=x*2;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256