akhauriyash/Code-Regression huggingface dataset:
// In the name of GOD
 
#include <bits/stdc++.h>
#define ll long long
#define pp pair <int, int>
using namespace std;
const ll N = 1e18, MOD =  998244353;

void solve() {
  int n;
  cin >> n;
  ll ans = 1;
  vector <ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  ll temp = 0;
  sort(a.begin(), a.end());
  for (ll x : a) {
    ans *= x;
    if (ans > N || temp > ans) {
      cout << -1;
      return;
    }
    temp = ans;
  }
  cout << ans;
}

int main()  {
  ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    }
}                                  

Measured memory_bytes: 3992
while True:
    try:
        cards = list(map(int, input().split(',')))
    except:
        break
    cards.sort()
    if cards.count(cards[2]) == 4:
        print('four card')
    elif cards.count(cards[2]) == 3:
        if cards[0] == cards[1] and cards[3] == cards[4]:
            print('full house')
        else:
            print('three card')
    elif (cards[1] < cards[2] < cards[3] < cards[4]) and cards[4] - cards[1] == 3\
        and (cards[0] == cards[4] - 4 or cards[0] == cards[4] - 12):
            print('straight')
    elif (cards[0] == cards[1] and (cards[2] == cards[3] or cards[3] == cards[4]))\
        or (cards[1] == cards[2] and cards[3] == cards[4]):
        print('two pair')
    elif max(cards.count(cards[i]) for i in range(5)) == 2:
        print('one pair')
    else:
        print('null')

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

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

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

    string S; cin >> S;

    if(S == "ABC") cout << "ARC" << endl;
    else if(S == "ARC") cout << "ABC" << endl;

    return 0;

}

Measured memory_bytes: 3612
#include <stdio.h>

int min(int a,int b){
    if(a>b) return b;
    else return a;
}

int abs(int num){
    if(num<0) num=-num;
    return num;
}

int main(void){
    int n,h[101000];
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&h[i]);
    int cost[101000];
    cost[0]=0;
    for(int i=1;i<n;i++){
        if(i==1) cost[i]=abs(h[i]-h[0]);
        else{
            cost[i]=min(cost[i-2]+abs(h[i]-h[i-2]),cost[i-1]+abs(h[i]-h[i-1]));
        }
    }
    printf("%d",cost[n-1]);
    return 0;
}

Measured memory_bytes: 896
def main():
    n, m, k = [int(i) for i in input().split()]
    a = [int(i) for i in input().split()]
    b = [int(i) for i in input().split()]

    cum = 0
    a_cnt = 0
    b_cnt = 0
    for i, j in enumerate(a):
        if cum + j > k:
            break
        cum += j
        a_cnt += 1
    
    for i, j in enumerate(b):
        if cum + j > k:
            break
        cum += j
        b_cnt += 1

    cnt = a_cnt + b_cnt
    max_cnt = cnt

    for i in range(a_cnt-1, -1, -1):
        cum -= a[i]
        cnt -= 1
        for i in range(b_cnt, len(b)):
            if cum + b[i] > k:
                break
            cum += b[i]
            b_cnt += 1
            cnt += 1
            max_cnt = max(cnt, max_cnt)
    print(max_cnt)   

if __name__ == '__main__':
    main()



Measured memory_bytes: 111872
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) ll aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) string aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007
int ans=0;
int F[100][100];
int N;
int A[100];

void route(int start){

		fyg(N+1,1){
			if(A[y]==0&&F[start][y]==1){
				F[start][y]=0;
				F[y][start]=0;
				A[y]=1;
				route(y);
				F[start][y]=1;
				F[y][start]=1;
			}
		}
		
}

int main() {
	
	int M;
	cin>>N>>M;
	pairs(P)
	fx(M){
		pairsp(P)
          F[aa][bb]=1;
      F[bb][aa]=1;
	}
	
	fx(M){
		int i=P.at(x).first;
		int j=P.at(x).second;
		F[i][j]=0;
		F[j][i]=0;
		A[1]=1;
		route(1);
		F[i][j]=1;
		F[j][i]=1;
      int sum=0;
      fy(N){
        if(A[y+1]==1){
          sum++;
        A[y+1]=0;
        }
      }
      if(sum!=N){
        ans++;
      }
	}
	ce(ans)

}

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

int main() {
	// your code goes here
	int a, b;
	cin >> a >> b;
	//for(int i = 0; i <= 3; i++){
		if((a * b) % 2 == 1){
			cout << "Yes" << endl;
			return 0;
		}
	//}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
use std::cmp::min;

// frog-1.rs --- Frog 1
// author: Seong Yong-ju <sei40kr@gmail.com>

// tanakah's input macro
// cf https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: usize,
        hs: [i32; n],
    };

    let mut dp = vec![std::i32::MAX; n];
    dp[0] = 0;

    for i in 0..n - 2 {
        dp[i + 1] = min(dp[i] + (hs[i] - hs[i + 1]).abs(), dp[i + 1]);
        dp[i + 2] = min(dp[i] + (hs[i] - hs[i + 2]).abs(), dp[i + 2]);
    }
    dp[n - 1] = min(dp[n - 2] + (hs[n - 2] - hs[n - 1]).abs(), dp[n - 1]);

    let ans = dp[n - 1];
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

int main() {
    std::ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    if (n % 2 == 0) {
        int s1 = 0;
        int s2 = 0;
        for (int i = 0; i < n; i++) {
            if (i % 2 == 0) {
                s1 += a[i];
            } else {
                s2 += a[i];
            }
        }
        cout << std::max(s1, s2) << " " << std::min(s1, s2) << "\n";
        return 0;
    }

    int l = 0;
    int r = 1000000000;
    while (r > l + 1) {
        int m = (l + r) / 2;
        int bp = 0;
        int s = 0;
        bool ok = false;
        for (int i = 0; i < n; i++) {
            if (i % 2 == 0) {
                s += a[i];
                if (s - bp >= m) {
                    if (i == n - 1) {
                        ok = true;
                    } else {
                        if (s - a[i + 1] < bp) {
                            bp = s - a[i + 1];
                        }
                    }
                }
            } else {
                s -= a[i];
            }
        }
        if (ok) {
            l = m;
        } else {
            r = m;
        }
    }

    int s = l;
    int s2 = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 1) s += a[i];
        s2 += a[i];
    }
    cout << s << " " << s2 - s << "\n";

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    int a; cin >>a;
    string s; cin >>s;

    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    } 
    
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    n=int(input())
    l=[[] for _ in range(n+1)]
    for _ in range(n-1):
        u,v,w=map(int,input().split())
        u-=1
        v-=1
        l[u].append([v,w])
        l[v].append([u,w])
    ans=[-1]*n
    chk=[(0,0,-1)]
    while chk:
        v,d,p=chk.pop()
        if d%2==0:
            ans[v]=0
        else:
            ans[v]=1
        for u,w in l[v]:
            if u==p:
                continue
            chk.append((u,d+w,v))
    [print(i) for i in ans]

if __name__ == '__main__':
    main()

Measured memory_bytes: 45904
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second
using ll = long long;
using P = pair<ll ,ll>;
using Tu = tuple<ll, ll, ll>;
const ll INFLL = 1LL<<61LL;
const ll INF = 1LL<<61LL;
const ll MOD = 1e9+7;



using ld = long double;

template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; assert(scanf("%lld", &x) == 1); return x;}
ld fin(){double x; assert(scanf("%lf", &x) == 1); return x;}
char yuyushiki[1000010]; string stin(){assert(scanf("%s", yuyushiki) == 1); return yuyushiki;}

int main(){
  ll N, M;
  cin >> N >> M;
  vector<Tu> es(M);
  for(int i=0;i<M;i++){
    ll a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    es[i] = Tu(b, a, -c);
  }
  vector<ll> dist(N, INF);
  dist[N - 1] = 0;
  ll cnt = 0;
  bool inf = false;
  while(cnt <= N * 2 + 10){
    cnt++;
    bool updated = false;
    for(auto &&e : es){
      ll f, t, c;
      tie(f, t, c) = e;
      if(dist[t] > dist[f] + c){
	updated = true;
	dist[t] = dist[f] + c;
	if(t == 0 && cnt > N)
	  inf = true;
      }
    }
    /*for(int i=0;i<N;i++)
      cout << i << " " << dist[i] << endl;
      cout << endl;*/
    if(!updated)
      break;
  }
  if(inf){
    cout << "inf" << endl;
  }else
    cout << -dist[0] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;


bool compare_by_b(pair<int, pair<string, int>> a, pair<int, pair<string, int>> b) {
  if(a.second.first != b.second.first){
      return a.second.first < b.second.first;
  }else{
      return a.second.second < b.second.second;
      // cerr << "Some error" << endl;
      // return 1;
  }
}

int main() {
  int N;
  cin >> N;
  vector<pair<int, pair<string, int>>> restaurant(N);
  rep(i,N) {
    restaurant[i].first = i+1;
    cin >> restaurant[i].second.first >> restaurant[i].second.second;
    restaurant[i].second.second *= -1;
  }
  sort(restaurant.begin(), restaurant.end(), compare_by_b);
  rep(i,N) {
    // cout << restaurant[i].second.first << " " << restaurant[i].second.second << endl;
    cout << restaurant[i].first << endl;
  }
  return 0;
}

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

LL solve(LL a,LL b) {
    if(a<b) swap(a,b);
    if(a%b==0) return 2*(a/b)*b-b;
    return 2*(a/b)*b+solve(b,a%b);
}

int main() {
    LL n,x;
    read(n);read(x);
    printf("%lld\n",n+solve(n-x,x));
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define N 100

int main(){
  int n;
  int A[N];
  int i;

  scanf("%d", &n);

  for(i=0; i<n; i++) {
    scanf("%d" , &A[i]);
  }
  for(i=n-1; i>=0; i--){
    if (i!=0) {
      printf("%d ", A[i]);
    } else {
      printf("%d\n", A[i]);
    }
    
  }
  return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<sstream>
#include<cmath>
#include<iomanip>  


using namespace std;




int main(){

    int n, k;
    cin >> n >> k;

    double ans = 0.0;


    for(int i = 1; i <= n; i++){
          double tmp = 1.0;
          for(int j = i; j < k; j*=2){
               tmp *= 0.5;
           }
          
          ans += tmp;
      }
    

    cout << setprecision(20) << ans/n << endl; 
 
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int N, K;
  cin >> N >> K;
  double ans = 0;
  for (int i = 1; i <= N; ++i) {
    int t = i;
    int re_ans = 1;
    while (t <= K-1) {
      t *= 2;
      re_ans *= 2;
    }
    ans += 1.0/(re_ans*N);
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 3244
l, r = gets.split.map(&:to_i)  # スペースで区切られた複数の整数

if r - l >= 2019
  puts(0)
else
  ans = 2019
  for i in l..r do
	  for j in i+1..r do
        k = (i * j) % 2019
        # puts(i, j, k)
		if k < ans
          ans = k
        end
      end
  end
  puts(ans)
end


Measured memory_bytes: 1788
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main(){
    int x[100]={};
    int top=0;
    char s[100];
    while(scanf("%s",s)!=EOF){
        if ( s[0] == '+' ){
            x[top-2]=x[top-2]+x[top-1];
            top--;
        } else if ( s[0] == '-' ){
            x[top-2]=x[top-2]-x[top-1];
            top--;
        } else if ( s[0] == '*' ){
            x[top-2]=x[top-2]*x[top-1];
            top--;
        } else {
        x[top] = atoi(s);
        top++;
        }
    }
    cout<<x[0]<<endl;
}



Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 1000005

//Suffix_Array
//O(|T|log|S|) S??????????????????T????????????????????????????´¢
#define rank A
int n,Len;
int rank[MAX_N+1];
int tmp[MAX_N+1];

//(rank[i],rank[i+k])??¨(rank[j],rank[j+k])?????????
bool compare_sa(int i,int j){
  if(rank[i]!=rank[j])return rank[i]<rank[j];
  int ri=i+Len<=n?rank[i+Len]:-1;
  int rj=j+Len<=n?rank[j+Len]:-1;
  return ri<rj;
}

//?????????S?????\?°??????????????§????
void construct_sa(string S,int *sa){
  n=S.length();
  //?????????????????????????????????????????????????????????
  for(int i=0;i<=n;i++){
    sa[i]=i;
    rank[i]=i<n?S[i]:-1;
  }
  //k????????????????????????????????????????????¨???????????????2k????????§?????????
  for(Len=1;Len<=n;Len*=2){
    sort(sa,sa+n+1,compare_sa);
    //?????£??????tmp????¬?????????????????¨?????????????rank?????£??\
    tmp[sa[0]]=0;
    for(int i=1;i<=n;i++)
      tmp[sa[i]]=tmp[sa[i-1]]+(compare_sa(sa[i-1],sa[i])?1:0);
    for(int i=0;i<=n;i++)rank[i]=tmp[i];
  }
}

//S??????????????????T????????????????????????????´¢??????
bool contain(string S,int *sa,string T){
  int left=0,right=S.length();
  while(right-left>1){
    int mid=(left+right)/2;
    if(S.compare(sa[mid],T.length(),T)<0)left=mid;
    else right=mid;
  }
  return S.compare(sa[right],T.length(),T)==0;
}

string t,p;
int q,sa[MAX_N];
int main(){
  cin>>t;
  construct_sa(t,sa);
  cin>>q;
  while(q--){
    cin>>p;
    if(contain(t,sa,p))printf("1\n");
    else printf("0\n");
  }
  return 0;
}

Measured memory_bytes: 16504
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(void){
  int n;
  cin >> n;
  if(n <= 999){
    cout << "ABC" << endl;
  } else {
    cout << "ABD" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
/*
                                                                                                                                               
8b        d8                           888888888888                                             88b           d88                  ad88888ba   
 Y8,    ,8P                                 88                                        ,d        888b         d888                 d8"     "8b  
  Y8,  ,8P                                  88                                        88        88`8b       d8'88                 ""      a8P  
   "8aa8"  ,adPPYba,   88       88          88  8b,dPPYba,  88       88  ,adPPYba,  MM88MMM     88 `8b     d8' 88   ,adPPYba,          ,a8P"   
    `88'  a8"     "8a  88       88          88  88P'   "Y8  88       88  I8[    ""    88        88  `8b   d8'  88  a8P_____88         d8"      
     88   8b       d8  88       88          88  88          88       88   `"Y8ba,     88        88   `8b d8'   88  8PP"""""""         ""       
     88   "8a,   ,a8"  "8a,   ,a88          88  88          "8a,   ,a88  aa    ]8I    88,       88    `888'    88  "8b,   ,aa         aa       
     88    `"YbbdP"'    `"YbbdP'Y8          88  88           `"YbbdP'Y8  `"YbbdP"'    "Y888     88     `8'     88   `"Ybbd8"'         88       
                                                                                                                                               
*/
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1e9 + 7;
int n, adj[25][25];
int dp[22][(1 << 22)];

int solve(int id, int bitmask) {
	if (bitmask == (1 << n) - 1) return 1;
	if (dp[id][bitmask] != -1) return dp[id][bitmask];

	int res = 0;
	for (int i = 0; i < n; i++) {
		if (adj[id][i] && !(bitmask & (1 << i))) res += solve(id + 1, bitmask | (1 << i));
		if (res > MOD) res -= MOD;
	}

	return dp[id][bitmask] = res;
}

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

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

	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> adj[i][j];
		}
	}

	memset(dp, -1, sizeof(dp));
	cout << solve(0, 0) << '\n';

	return 0;
} 

Measured memory_bytes: 360832
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 六 11/ 4 23:07:32 2017
 * Ended  Time*  : 六 11/ 4 23:39:35 2017
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

inline void OPEN(string s){
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

const int MaxN = 1e5;
int a[MaxN + 5], b[MaxN + 5], c[MaxN + 5];
int n;

int main()
{
	while(~scanf("%d", &n)){
		for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
		for(int i = 1; i <= n; i++) scanf("%d", &b[i]);
		for(int i = 1; i <= n; i++) scanf("%d", &c[i]);
		sort(a + 1, a + 1 + n);
		sort(b + 1, b + 1 + n);
		sort(c + 1, c + 1 + n);
		LL ans = 0;
		int pa = 0, pc = 0;
		a[n+1] = 1<<30, c[n+1] = 1<<30;
		for(int i = 1; i <= n; i++){
			while(a[pa+1] < b[i] && pa <= n) pa++;
			while(c[pc+1] <= b[i] && pc <= n) pc++;
			//printf("%d %d\n", pa, pc);
			ans += 1LL * pa * (n - pc);
		}
		printf("%lld\n", ans);
	}
    return 0;
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
char _;
int sieve[(int)1e6 + 5];

int32_t main(){
	int N, cnt = 0; cin >> N;
	vector<int> arr(N + 1); sort(arr.begin(), arr.end());
	for(int i = 0; i < N; i++){
		cin >> arr[i];
		if(sieve[arr[i]] < 2){
			for(int j = arr[i]; j <= (int)1e6; j += arr[i]){
				sieve[j]++;
			}
		}
	}
	for(int i = 0; i < N; i++){
		if(sieve[arr[i]] >= 2)continue;
		cnt++;
	}
	cout << cnt << '\n';
	return 0;
}

Measured memory_bytes: 12688
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#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 INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	string s;
	int k;
	cin >> s >> k;

	vector<string> subStrList;
	REP(i, s.size()) {
		REP(j, 5) {
			subStrList.emplace_back(s.substr(i, j + 1));
		}
	}
	sort(subStrList.begin(), subStrList.end());
	subStrList.erase(unique(subStrList.begin(), subStrList.end()), subStrList.end());
	cout << subStrList[k - 1] << endl;
	return 0;
}

Measured memory_bytes: 1660
#include <stdio.h>
#include <stdlib.h>

/* ソート関数 */
int int_sort( const void * a , const void * b ) {
  /* 引数はvoid*型と規定されているのでint型にcastする */
  if( *( int * )a < *( int * )b ) {
    return 1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return -1;
}



int main(void){
    int N,H;
    scanf("%d %d",&N,&H);
    int a[N],b[N];
    int maxa=0;
    for(int i=0;i<N;i++){
        scanf("%d %d",&a[i],&b[i]);
        if(maxa<a[i])maxa=a[i];
    }
      qsort(( void * )b , N , sizeof( b[0] ), int_sort );
    int ans=0;
    for(int i=0;i<N;i++){
        if(maxa>b[i])break;
        H-=b[i];
        ans++;
        if(H<=0){
            printf("%d",ans);
            return 0;
        }
    }
    ans+=(H+maxa-1)/maxa;
    printf("%d",ans);
    return 0;
}


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

#define lli long long int
#define mod 1000000007

int main()
{
	lli n,k,res=1;
	cin>>n>>k;
	vector<lli> v(n);
	for(lli i=0;i<n;i++)
	cin>>v[i];
	sort(v.begin(),v.end(),greater<lli>());
	if(k==n||(v[0]<0&&k%2==1))
	{
		for(lli i=0;i<k;i++)
		res=(res*(v[i]+mod)%mod+mod)%mod;
	}
	else
	{
		lli lo=0,hi=n-1,cnt=0;
		if(k%2)
		{
			res=(res*v[lo])%mod;
			cnt++;
			lo++;
		}
		while(cnt<k)
		{
			//if(k-cnt>=2)
			//{
				if(v[lo]*v[lo+1]>=v[hi]*v[hi-1])
				res=(res*(v[lo]%mod*v[lo+1]%mod)%mod)%mod,lo=lo+2;
				else
				res=(res*((v[hi]+mod)%mod*(v[hi-1]+mod)%mod)%mod)%mod,hi=hi-2;
				cnt=cnt+2;
			//}
			/*else
			{
				if(res*v[lo]>=res*v[hi])
				res=(res*v[lo]+mod)%mod,lo++,cnt++;
				else
				res=(res*v[hi]+mod)%mod,hi--,cnt++;
			}*/
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 4808
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll A[600][600];
ll B[600][600];
int main()
{
    ll n;
    cin>>n;
    ll r;
    r=n%10;
    if(r==2||r==4||r==5||r==7||r==9)
     cout<<"hon"<<endl;
        else if(r==0||r==1||r==6||r==8)
             cout<<"pon"<<endl;
        else if(r==3)
    {
        cout<<"bon"<<endl;
    }
    return 0;
}


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

using namespace std;
 
int main(){
  	int n;
    int RCount = 0;
  	cin >> n;
  
    string str;
  
    cin >> str;
    
    for (int i=0; i<str.length(); i++) {
        if (str[i] == 'R') {
            RCount++;
        }
    }
    
    if (RCount > str.length()/2){
        cout << "Yes";
    } else {
        cout << "No";
    }
        
  
	return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
int k,l;
struct key{
	int c,q;
}a[1005];
int f[1005][8500];
inline int _min(int w,int s) {
	if(w>=s) return s;
	else return w;
}
int main() {
	cin>>n>>m;
	for(int i=1;i<=m;i++) {
		scanf("%d%d",&a[i].c,&k);
		for(int j=1;j<=k;j++) {
			scanf("%d",&l);
			a[i].q+=1<<l;
		}
	}
	//for(int i=1;i<=m;i++) cout<<i<<" "<<a[i].c<<" "<<a[i].q<<endl;
	f[0][0]=1;
	for(int i=1;i<=m;i++) 
		for(int j=0;j<=(1<<(n+1));j++) 
			if(f[i-1][j]) {
				if(f[i][j]) f[i][j]=_min(f[i-1][j],f[i][j]);
				else f[i][j]=f[i-1][j];
				if(f[i][j|a[i].q]) f[i][j|a[i].q]=_min(f[i][j|a[i].q],f[i-1][j]+a[i].c);
				else f[i][j|a[i].q]=f[i-1][j]+a[i].c;
			}
	/*
	for(int i=1;i<=m;i++) {
		for(int j=1;j<=8;j++) cout<<f[i][j]<<" ";
		cout<<endl;
	}
	*/
	cout<<f[m][(1<<(n+1))-2]-1;
	return 0;
}

Measured memory_bytes: 32640
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {

	char n[5];
	scanf("%s", n);

	if (n[0] == n[2]) {
		printf("Yes");
	}
	else {
		printf("No");
	}
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)          \
  sort(x.begin(), x.end()); \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << "(" << #x << ", " << #y << ") = " \
                          << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

// ----------------------------------------------

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

  string s;
  cin >> s;

  ll n = s.size();

  vector<ll> a(n + 1);

  rep(i, n) {
    if (s[i] == '<') {
      a[i + 1] = max(a[i] + 1, a[i + 1]);
    }
  }

  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '>') {
      a[i] = max(a[i], a[i + 1] + 1);
    }
  }
  ll ans = 0;
  rep(i, n + 1) {
    ans += a[i];
  }

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

Measured memory_bytes: 4764
#include <iostream>

using namespace std;

int main(){
    int x,y;

    while (true) {
        cin >> x >> y;
        if(x == 0 && y == 0){
            break;
        }
        for(int i = 0;i < x;i++){
            for(int j = 0;j < y;j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    string t, b;
    cin >> t >> b;

    int n = t.size(), m = b.size();

    lint dp[1001][1001] = {0LL};
    dp[0][0] = 1;

    rep(i, n){
        rep(j, m + 1){
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= MOD;
            if(j < m && t[i] == b[j]){
                dp[i + 1][j + 1] += dp[i][j];
                dp[i + 1][j + 1] %= MOD;
            }
        }
    }

    cout << dp[n][m] << endl;

    return 0;
}


Measured memory_bytes: 11044
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class C
{
	public static void Main()
	{
		int H = GetInt();
		int W = GetInt();
		int[] num = new int[26];
		for(int i = 0; i < H; i++)
		{
			string a = GetString();
			for(int j = 0; j < W; j++)
				num[(int)(a[j] - 'a')]++;
		}

		int g1 = ((H % 2 == 1) && (W % 2 == 1)) ? 1 : 0;
		int g2 = ((H % 2 == 1) ? W / 2 : 0) + ((W % 2 == 1) ? H / 2 : 0);
		int g4 = (H * W - g1 - 2 * g2) / 4;

		if(g1 == 1)
		{
			int c = Array.FindIndex(num, x => x % 2 == 1);
			if(c != -1)
				num[c]--;
		}

		while(g2 > 0)
		{
			int c = Array.FindIndex(num, x => x % 4 == 2);
			if(c == -1)
			{
				g4 += g2 / 2;
				break;
			}
			else
			{
				num[c] -= 2;
				g2--;
			}
		}

		while(g4 > 0)
		{
			int c = Array.FindIndex(num, x => x > 0);
			if(c == -1)
			{
				break;
			}
			else
			{
				num[c] -= 4;
				g4--;
			}
		}

		Console.WriteLine(num.Any(x => x > 0) ? "No" : "Yes");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;

void cinv(vector<ll> &V){
	ll t;
	cin >> t;
	V.push_back(t);
}

int main()
{
	ll A,B,X;
	cin >> A >> B >> X;
	if(A>X){
		cout << "NO" << endl;
	}
	else if(A+B>=X){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}

}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N, W;
	cin >> N >> W;
	vector<int>w(N), v(N);
	rep(i, N)cin >> w[i] >> v[i];
	vector<vector<int>>dp(N + 1, vector<int>(1e5 + 1, INF));
	dp[0][0] = 0;
	rep(i, N)rep(j, 1e5 + 1) {
		if (j - v[i] >= 0)dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
		else dp[i + 1][j] = dp[i][j];
	}
	int ans = -INF;
	rep(i, 1e5 + 1)if (dp[N][i] <= W)ans = max(ans, i);
	cout << ans << endl;
}

Measured memory_bytes: 80256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
#include <map>
using namespace std;

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

	for (int i = 0; i < S.length(); i++)
	{
		S[i] = 'x';
	}
	cout << S << endl;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
total = 0
for v in C.values():
    total += v*(v-1)//2

for a in A:
    x = C[a]*(C[a]-1)//2
    ans = total - x
    ans += (C[a]-1)*(C[a]-2)//2
    print(ans)

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

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

    int n;cin>>n;
    unsigned long long sum=0;
    for(int i=1;i<=n;i++){
        if(i%3==0 || i%10==0 || i%10==5) continue;
        sum+=i;
    }
    cout<<sum;

    return 0;
}


Measured memory_bytes: 3652
import bisect

N,M,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

DP_1 = [0]
DP_2 = [0]
Max = 0

Sum = 0
for i in range(len(A)):
    Sum += A[i]
    if Sum <= K:
        DP_1.append(Sum)
    else:
        break

Sum = 0
for i in range(len(B)):
    Sum += B[i]
    if Sum <= K:
        DP_2.append(Sum)
    else:
        break

for i in range(len(DP_1)):

    j = bisect.bisect_left(DP_2,K-DP_1[i]+1) - 1

    a = i + j

    Max = max(Max,a)
    #print(Max,i,j,DP_1[i],DP_2[j])

#print(DP_1,DP_2)
print(Max)

Measured memory_bytes: 132952
#include"bits/stdc++.h"
#define REP(i,n)  for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n) for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n) for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)for(ll i=(n);i>0;--i)
#define ALL(obj)  (obj).begin(),(obj).end()
using namespace std;
using ll=long long;
using ull=unsigned long long;
template<typename T>using pqg=priority_queue<T,vector<T>,greater<T>>;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline vector<vector<T>>vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    cout<<(in()>=3200?in<string>():"red")<<endl;
}

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

int main(){
	char X,Y;
	cin>>X>>Y;
	if(X=='A'){
		if(Y=='A'){
			cout<<"="<<endl;
		}else{
			cout<<"<"<<endl;
		}
	}
	if(X=='B'){
		if(Y=='A'){
			cout<<">"<<endl;
		}
		else if(Y=='B'){
			cout<<"="<<endl;
		}else{
			cout<<"<"<<endl;
		}
	}
	if(X=='C'){
		if(Y=='A'||Y=='B'){
			cout<<">"<<endl;
		}
		else if(Y=='C'){
			cout<<"="<<endl;
		}else{
			cout<<"<"<<endl;
		}
	}
	if(X=='D'){
		if(Y=='A'||Y=='B'||Y=='C'){
			cout<<">"<<endl;
		}
		else if(Y=='D'){
			cout<<"="<<endl;
		}else{
			cout<<"<"<<endl;
		}
	}
	if(X=='E'){
		if(Y=='A'||Y=='B'||Y=='C'||Y=='D'){
			cout<<">"<<endl;
		}
		else if(Y=='E'){
			cout<<"="<<endl;
		}else{
			cout<<"<"<<endl;
		}
	}
	if(X=='F'){
		if(Y=='A'||Y=='B'||Y=='C'||Y=='D'||Y=='E'){
			cout<<">"<<endl;
		}
		else if(Y=='F'){
			cout<<"="<<endl;
		}
	}

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,d1,d2;
    bool f[100];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>d1>>d2;
        f[i]=d1==d2;
    }
    for(int i=0;i+2<n;i++)
        if(f[i]&&f[i+1]&&f[i+2]){
            cout<<"Yes"<<endl;
            return 0;
        }
    cout<<"No"<<endl;
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int main() {
    int A, B, K; cin >> A >> B >> K;
    for (int i = A; i <= B; i++) {
        if (i < A + K || i > B - K) cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define uint unsigned int
void DEBUG() {
    cout << "]\n";
}
template<typename H, typename...T> void DEBUG(H h, T... t) {
    cout << h;
    if(sizeof...(t))
        cout << ", ";
    DEBUG(t...);
}
#define debug(...) cout << "[LINE: " << __LINE__ << "] -> [" << #__VA_ARGS__ << " = ", DEBUG(__VA_ARGS__)

ll n, m;

void solve() {
    cin >> n >> m;
    ll ans=0;
    for(ll i=0; i<n; ++i) {
        ll a, b;
        cin >> a >> b;
        ll t=a*a+b*b;
        ld tmp=sqrt(t);
        if(t>=0&&tmp<=m) {
            ans++;
        }
    }
    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    solve();
    return 0;
}

Measured memory_bytes: 3672
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		double Eps = 1e-9;
		
		double[] v = new double[9];
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				v[i * 3 + j] = C[i][j];
			}
		}
		double[][] ar = new double[9][];
		for(int i=0;i<9;i++) ar[i] = new double[6];
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				ar[i * 3 + j][i] = 1;
				ar[i * 3 + j][3 + j] = 1;
			}
		}
		
		var ge = LinearAlg.GaussElimination(ar, v);
		bool chk = true;
		for(int i=0;i<ge.Length;i++){
			bool zeroCoef = true;
			for(int j=0;j<ge[i].Length - 1;j++) if(Math.Abs(ge[i][j]) > Eps) zeroCoef = false;
			if(zeroCoef && Math.Abs(ge[i][ge[i].Length - 1]) > Eps) chk = false;
		}
		Console.WriteLine(chk ? "Yes" : "No");
		
		
	}
	
	
	
	int[][] C;
	public Sol(){
		C = new int[3][];
		for(int i=0;i<3;i++) C[i] = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


class LinearAlg{
	const double Eps = 1e-9;
	
	public static double[][] GaussElimination(double[][] ar,double[] v){
		//  solving  Ax = V in double
		int N = ar.Length;
		int M = ar[0].Length;
		int N0 = Math.Min(N,M);
		
		double[][] L=new double[N][];
		//  returns GaussEliminationMatrix;
		for(int i=0;i<N;i++){
			L[i] = new double[M+1];
			for(int j=0;j<M;j++) L[i][j] = ar[i][j];
			L[i][M] = v[i];
		}
		
		for(int i=0;i<N0;i++){
			int pibot = i;
			double buf = Math.Abs(L[i][i]);
			for(int j=i+1;j<N;j++){
				if(Math.Abs(L[j][i]) > buf + Eps){
					pibot = j;
					buf = Math.Abs(L[j][i]);
				}
			}
			
			if(L[pibot][i] < Eps) continue;
			swap(ref L[i], ref L[pibot]);

			double d = L[i][i];
			for(int j=0;j<=M;j++) L[i][j] /= d;
			
			for(int j=i+1;j<N;j++){
				d = L[j][i];
				for(int k=0;k<=M;k++){
					L[j][k] -= L[i][k] * d;
				}
			}

		}
		
		for(int i=N0-1;i>=0;i--){
			for(int j=i-1;j>=0;j--){
				double d = L[j][i];
				for(int k=0;k<=M;k++){
					L[j][k] -= L[i][k] * d;
				}
			}
		}

		return L;
		
	}
	
	static void swap(ref double[] A,ref double[] B){
		double[] C;
		C=A;A=B;B=C;
	}
}

Measured memory_bytes: 11348
//#define NDEBUG
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
/*
二重連鎖木によるpairing heapの実装例
*/
template<class T,bool P=false>
class pairing_heap {
	static constexpr uint64 ALLOCSIZE = (uint64)1 << 10;
	struct node_t {
		T data;
		node_t *left, *right;
	};
	node_t *root;
	static node_t *pool;
	static node_t *merge(node_t *x, node_t *y) {
		if (P ^ (x->data < y->data)) std::swap(x, y);
		x->right = y->left;
		y->left = x;
		return y;
	}

public:
	pairing_heap() :root(nullptr) {}
	T pop() {
		assert(root);
		node_t *n = nullptr, *x = root->left, *y;
		root->left = pool;
		pool = root;
		while (x) {
			y = x;
			if (x->right) {
				x = x->right->right;
				y = merge(y, y->right);
			}
			else {
				x = nullptr;
			}
			y->right = n;
			n = y;
		}
		if (!n) { root = nullptr;return pool->data; }
		root = n;
		n = n->right;
		while (n) {
			x = n;
			n = n->right;
			root = merge(root, x);
		}
		return pool->data;
	}
	void push(const T &data) {
		if (!pool) {
			pool = (node_t *)malloc(ALLOCSIZE * sizeof(node_t));
			uint32 i = ALLOCSIZE;
			pool[i - 1].left = nullptr;
			while (--i) {
				pool[i - 1].left = pool + i;
			}
		}
		node_t *top = pool;
		pool = pool->left;
		top->data = data;
		top->left = nullptr;
		root = root ? merge(root, top) : top;
	}
	pairing_heap &operator+=(pairing_heap &other) {
		root = merge(root, other.root);
		other.root = nullptr;
		return *this;
	}
};
template<class T,bool P>
typename pairing_heap<T,P>::node_t *pairing_heap<T,P>::pool = nullptr;

template<typename T>
void uscan(T &d) {
	d = 0;int c = 0;
	while (c < '0' || '9' < c) c = fgetc(stdin);
	while ('0' <= c&&c <= '9') {
		d = (d << 3) + (d << 1) + c - '0';c = fgetc(stdin);
	}
}
void sscan(std::string &s) {
	s = std::string();
	int c = 0;
	while (c < 'a' || 'z' < c) c = fgetc(stdin);
	while ('a' <= c&&c <= 'z') {
		s.push_back(c);
		c = fgetc(stdin);
	}
}

int main(void) {
	std::string s;
	uint32 k;
	pairing_heap<uint32, true> Q;
	sscan(s);
	while (s[2] != 'd') {
		if (s[0] == 'e') {
			printf("%u\n", Q.pop());
		}
		else {
			uscan(k);
			Q.push(k);
		}
		sscan(s);
	}
	return 0;
}


Measured memory_bytes: 26244
#include <bits/stdc++.h>
 
#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    vector<int> h(n);
    rep(i, 0, n){
        cin >> h[i];
        if(h[i] >= k) cnt++;
    }
    cout << cnt << endl;
    
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, h, m; cin >> a >> b >> h >> m;
  ld angle = abs(30*h-5.5*m);
  angle = min(angle, 360-angle);
  ld theta = angle * M_PI / 180;
  ld ans = sqrt(a*a+b*b-2*a*b*cos(theta));
  cout << fixed << setprecision(10) << ans << "\n";
  return 0;
}


Measured memory_bytes: 4128
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(c >= a) {
			System.out.println(c <= b ? "Yes" :"No");
		} else {
			System.out.println("No");
		}
	}
}

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

int main()
{
  int N,map[100][100];
  long long ans=0;

  cin>>N;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++)cin>>map[i][j];
  }
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++)ans+=min(map[i][j],map[j][i]);
  }
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 1196
#include "bits/stdc++.h"
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long int
#define tc int t; cin>>t; while(t--)
#define fora(i,n) for(int i=0;i<n;i++)
#define forb(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007

template<class T> T power(T N,T P){ return (P==0)?  1: N*power(N,P-1);}

int32_t main()
{
    fastio

    
    int n,k;
    cin>>n>>k;
    int arr[n];
    fora(i,n) cin>>arr[i];
    sort(arr,arr+n);
    int sum=0;
    fora(i,k) sum+=arr[i];
    cout<<sum;

    return 0;


}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod=1e9+7;

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

	vector<int> a(n+1,0);

	for(int i=2;i<=n;i++){
		int x=i;
		for(int j=2;x>1;j++){
			while(x%j==0){
					a[j]++;
					x/=j;
			}
		}
	}
	int ans=1;
	for(auto&& w:a)if(w>0)ans=(ans*(w+1))%mod;
	cout<<ans<<endl;
		
}

Measured memory_bytes: 256