akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define pii pair<int,int>
using namespace std;
signed main(){
    fast;
    int n;
    cin>>n;
    int ans = 0;
    for(int i = 1;i<=n;i++){
        if(i%3 == 0 || i %5 == 0)
            continue;
        ans+=i;
    }
    cout<<ans;
}

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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N-1);
    for(int i=0; i<N; i++) {
        cin >> A[i];
    }
    for(int i=0; i<N; i++) {
        cin >> B[i];
    }
    for(int i=0; i<N-1; i++) {
        cin >> C[i];
    }
    int satisfy = B[A[0]-1];
    for(int i=1; i<N; i++) {
        satisfy += B[A[i]-1];
        if(A[i] - A[i-1] == 1) {
            satisfy += C[A[i]-2];
        }
    }
    cout << satisfy << endl;
    return 0;
}

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

#define INF 10000000
#define N 21
#define error(s) do{fprintf(stderr , s); exit(-1);}while(0)

int M[N][N];
void floyd(int n);

int main(){
	int i,j,n,m,a,b,c,d,x1,x2,y1,y2;
	scanf("%d",&n);
	scanf("%d",&m);
	for(i = 1 ; i <= n ; i++){
		for(j = 1 ; j <= n ; j++){
			M[i][j] = INF;
		}
	}
	for(i = 1 ; i <= m ; i++){
		scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		M[a][b] = c;
		M[b][a] = d;
	}
	scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
	floyd(n);
	y1 = y1 - y2 - M[x1][x2] - M[x2][x1];
	printf("%d\n",y1);
	return 0;
}

void floyd(int n){
	int i , j , k ;
	for(k = 1 ; k <= n ; k++){
		for(i = 1 ; i <= n ; i++){
			for(j = 1 ; j <= n ; j++){
				if(M[i][k] + M[k][j] < M[i][j]){
					M[i][j] = M[i][k] + M[k][j];
				}
			}
		}
	}
}

Measured memory_bytes: 600
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    int n, r;
    cin >> n >> r;

    if(n >= 10){
        cout << r << endl;
    } else {
        cout << r + (100 * (10 - n)) << endl;
    }
}

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

using namespace std;

int main(){
    int n;
    int m;
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    int count = 0;
    for(int i = 0; i < n; i++){
        if(a[i] * 4 * m >= sum){
            count++;
        }
    }
    if(count >= m){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

int main() {
  int n,ans=0;
  cin >> n;
  for(int i=1; i<=n; i++) {
    if(i%2 != 0) {
      int count=0;
      for(int j=1; j<=i; j++) {
        if(i%j == 0) count++;
      }
      if(count == 8) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<int,bool> BW;
int W,H;
string c[52];
bool f[52][52];

BW Solve(int h,int w){
    f[h][w]=true;
    queue<P> q;
    q.push(P(h,w));
    bool Bflag=false;
    bool Wflag=false;
    int ans=0;
    while(!q.empty()){
        P now=q.front();q.pop();
        ans++;
        int dh[4]={0,1,-1,0};
        int dw[4]={1,0,0,-1};
        for(int i=0;i<4;i++){
            int ch=now.first +dh[i];
            int cw=now.second+dw[i];
            if(0<=ch && ch<H && 0<=cw && cw<W && f[ch][cw]==false){
                
                if(c[ch][cw]=='B'){
                    Bflag=true;
                }else if(c[ch][cw]=='W'){
                    Wflag=true;
                }else{
                    q.push(P(ch,cw));
                    f[ch][cw]=true;
                }
            }
        }
    }
    if(Bflag && Wflag){
        return BW(0,false);
    }else if(Bflag){
        return BW(ans,false);
    }
    else if(Wflag){
        return BW(ans,true);
    }else{
        return BW(0,false);
    }
}

int main(){
    while(cin>>W>>H,W!=0){
        for(int i=0;i<H;i++){
            cin>>c[i];
            for(int j=0;j<W;j++){
                f[i][j]=false;
            }
        }
        int Bans=0;
        int Wans=0;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(!f[i][j] && c[i][j]=='.'){
                    BW result=Solve(i,j);
                    if(result.second==false){
                        Bans+=result.first;
                    }else{
                        Wans+=result.first;
                    }
                    /*for(int k=0;k<H;k++){
                        for(int l=0;l<W;l++){
                            cout<<f[k][l];
                        }cout<<endl;
                    }
                    /*cout<<"===================="<<endl;
                    cout<<Bans<<" " <<Wans<<endl;
                    cout<<"===================="<<endl;*/
                    
                }
            }
        }
        cout<<Bans<<" "<<Wans<<endl;
    }
    return 0;
}


Measured memory_bytes: 2992
# require 'pry'

S = gets.chomp.to_s.split('')
N = S.size

@elements = []
@pass = false

S.each_with_index do |s, i|

  if i == (N - 3) && s.size == 2
    if S[i+1] == S[i+2] # 最後の二つが同じとき
      if s == (S[i+1] + S[i+2])
        @elements << s + S[i+1]
        @elements << S[i+2]
      else
        @elements << s
        @elements << S[i+1] + S[i+2]
      end
    else
      @elements << s
      @elements << S[i+1]
      @elements << S[i+2]
    end
    break # おわり
  end

  
  # binding.pry
  

  if @pass
    break if i == (N - 1)
    S[i+1] = s + S[i+1]
    @pass = false
    next
  else
    @elements << s
  end

  if s == S[i+1]
    @pass = true
    next
  end if i != (N-1)

end

# print @elements

print @elements.count


Measured memory_bytes: 17172
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e5 + 7;

#include <math.h>
#define PI 3.14159265358979323846264338327950L


int main() {
    string s;
    cin >> s;
    if (s == "ABC") cout << "ARC";
    else cout << "ABC";
    return 0;
}

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

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

	const int n = 26;
	vector<int> num(n, 0);
	for (int i = 0; i < s.size(); i++) num[(int)(s.at(i) - 'a')] = 1;

	int cnt = 0;
	for (int i = 0; i < n; i++) cnt += num[i];
	
	string ans = "no";

	if (cnt == s.size()) ans = "yes";
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
#include <string>

using bint = boost::multiprecision::cpp_int;

bint gcdf(bint a, bint b)
{
    if (a < b) {
        std::swap(a, b);
    }
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}


int main()
{
    bint N, M;
    std::string S;
    std::string T;
    std::cin >> N >> M >> S >> T;
    bint gcd = gcdf(N, M);
    bint lcm = N * M / gcd;
    bint tmp = gcdf(lcm / N, lcm / M);
    bint tmpl = lcm / N * lcm / M / tmp;
    // std::cerr << lcm << std::endl;
    bool ok = true;
    for (bint i = 0; i < lcm; i += tmpl) {
        if (i % (lcm / N) == 0 and i % (lcm / M) == 0) {
            // std::cerr << i << std::endl;
            if (S.at(static_cast<int>(i / (lcm / N))) != T.at(static_cast<int>(i / (lcm / M)))) {
                ok = false;
            }
        }
    }
    if (ok) {
        std::cout << lcm << std::endl;
    } else {
        std::cout << -1 << std::endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    double a, b, n;
    int f ;
    cin >> a >> b >> n;

    if (n < b)
    {
        f = floor(a * n/ b);
    }
    else
    {
        f = floor(a * (b-1.0) / b);
    }

    cout << f << endl;
    return 0;
}

Measured memory_bytes: 3832
import javax.swing.*;
import java.util.*;

public class Main {


      public static void main(String[] args) {

            Scanner sc = new Scanner(System.in);
            int k = sc.nextInt() - 1;
            String ans = "ACL";
            for (int i = 0;i<k;i++){
                  ans += "ACL";
            }
            System.out.println(ans);
      }


}


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

signed main()
{
    int n,k,a,b,c{};
    cin>>n>>k;
    vector<pair<int,int>> v(n);
    rep(i,n){
        cin>>a>>b;
        v.emplace_back(a,b);
    }
    sort(begin(v),end(v));
    for(auto&& e : v){
        if(k<=(c+=e.second)){ cout<<e.first<<endl;break; }
    }
}

Measured memory_bytes: 4992
import sys
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template

# PyPyだと再帰が遅いので注意
# BEGIN CUT HERE
sys.setrecursionlimit(100000)
class UnionFind():
    '''UnionFind木'''
    def __init__(self,n):
        self.data = [-1] * n
    
    def unite(self, x, y):
        '''x と y を結合'''
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.data[x] < self.data[y]:
            x, y = y, x  # swap
        self.data[x] += self.data[y]
        self.data[y] = x
    
    def find(self, x):
        '''ノード x の親を返す'''
        if self.data[x] < 0:
            return x
        self.data[x] = self.find(self.data[x])
        return self.data[x]

    def same(self, x, y):
        '''x と y が同じグループに属するか判定'''
        return self.find(x) == self.find(y)
    
    def size(self, x):
        '''x を含むグループのノード数を返す'''
        return self.data[self.find(x)]
        
# END CUT HERE

def ABC120_D():
    n, m = mi()
    a = [0] * m
    b = [0] * m
    for i in range(m):
        a[i], b[i] = mi()
        
    uf = UnionFind(n)
    ans = [0] * (m + 1)
    ans[m] = n * (n - 1) // 2

    for i in range(m - 1, -1, -1):
        a[i] -= 1
        b[i] -= 1
        ans[i] = ans[i + 1]
        if uf.same(a[i], b[i]):
            continue
        
        x = uf.size(a[i])
        y = uf.size(b[i])
        ans[i] -= x * y
        
        uf.unite(a[i],b[i])
    
    for i in range(1, m + 1):
        print(ans[i])

# verified on 2019/06/23
# Python3:616ms https://atcoder.jp/contests/abc120/submissions/6094323


if __name__ == '__main__':
    ABC120_D()


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) cout << c << '\n';
  if (b == c) cout << a << '\n';
  if (c == a) cout << b << '\n';
}


Measured memory_bytes: 3592
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "y", long, "cost");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto s = sread();
    bool t;
    foreach (e; s)
        t |= e == '7';
    if (t)
        writeln("Yes");
    else
        writeln("No");
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

int main()
{
  string a;
  cin >> a;
  
  int b = 0;
  
  for (int i = 0; i < a.length(); i++)
  {
    if (a[i] == '1') b += 1;
  }
  cout << b << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N 36

typedef struct{
    char c;
    int value;
}sort;


int main()
{
  int i,j,n,flag=0,minj;
  sort C1[N],C2[N],a;
  char emp;
    
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
      scanf("%c%d%c",&C1[i].c, &C1[i].value,&emp);
      C2[i]=C1[i];
}
    
    
//bubble sort
    for(i=0;i<n;i++){
        for(j=n-1;j>i;j--){
             if(C1[j].value < C1[j-1].value){
               a=C1[j];
             C1[j] = C1[j-1];
            C1[j-1] =a;
             
            }
        }
    }
// bubble fin

    
//selection sort
    for(i=0;i<n;i++){
        minj=i;
        for(j=i;j<n;j++){
            if(C2[j].value <C2[minj].value ) minj=j;
        }
        if(minj != j){
                a=C2[i];
                C2[i]=C2[minj];
                C2[minj]=a;
        }
        }
  // selection fin
    
    
    for(j=0;j<n-1;j++){
        printf("%c%d ",C1[j].c,C1[j].value);
    }
    printf("%c%d\n",C1[n-1].c,C1[n-1].value);
    printf("Stable\n");
    
for(j=0;j<n-1;j++){
    printf("%c%d ",C2[j].c,C2[j].value );
    if(C1[j].c!=C2[j].c) flag=1;
}
printf("%c%d\n",C2[n-1].c,C2[n-1].value);
  if(C1[n-1].c!=C2[n-1].c) flag=1;
    
    if(flag==1) printf("Not stable\n");
    else printf("Stable\n");
 
    return 0;
    
}


Measured memory_bytes: 2144
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int n,i;
  const int mod=1e9+7;
  ll dp[100005][13]={};
  string s;
  
  cin >> s;
  n=s.size();
  
  dp[0][0]=1;
  int j,k;
  for (i=0;i<n;i++){
    if (s[i]=='?'){
      for (j=0;j<13;j++) for (k=0;k<10;k++){
        dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+dp[i][j])%mod;
      }
    }else{
      k=s[i]-'0';
      for (j=0;j<13;j++){
        dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+dp[i][j])%mod;
      }
    }
  }
  
  cout << dp[n][5] << endl;
  
  return 0;
}

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

typedef long long ll;

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

    int n, k, d;
    cin >> n >> k;
    int ans = n;
    int a[n] = {};
    while(k--) {
        cin >> d;
        while(d--) {
            int t;
            cin >> t;
            if(a[t-1] == 0) {
                --ans;
                a[t-1] = 1;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}



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

int main(){
    int n; cin >> n;
    vector<pair<string, pair<int,int> > > sp(n+1);
    string s;
    int p;

    for(int i=1; i<=n; i++){
        cin >> s >> p;
        sp[i].first = s;
        sp[i].second.first = -p;
        sp[i].second.second = i;
    }

    sort(sp.begin(), sp.end());

    for(int i=1; i<=n; i++){
        cout << sp[i].second.second << endl;
    }

    return 0;
}

Measured memory_bytes: 3544
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let mut l: Vec<i64> = (0..n).map(|_| read()).collect();

    l.sort();

    let mut count = 0;

    for i in 0..n {
        for j in 0..i {
            count += l[i + 1..].lower_bound(&(l[i] + l[j]));
        }
    }

    println!("{}", count);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

// like c++ std::lower_bound and std::upper_bound
trait BinarySearch<T: Ord> {
    fn lower_bound(&self, x: &T) -> usize;
    fn upper_bound(&self, x: &T) -> usize;
}

impl<T: Ord> BinarySearch<T> for [T] {
    fn lower_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();
        while low != high {
            let mid = low + (high - low) / 2;
            match self[mid].cmp(x) {
                std::cmp::Ordering::Less => low = mid + 1,
                _ => high = mid,
            }
        }
        low
    }

    fn upper_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();
        while low != high {
            let mid = low + (high - low) / 2;
            match self[mid].cmp(x) {
                std::cmp::Ordering::Greater => high = mid,
                _ => low = mid + 1,
            }
        }
        high
    }
}


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

template<typename T> class Edge{
    public:
        int to;
        T cost;

        Edge(){}
        Edge(int t, T c){
            this->to = t;
            this->cost = c;
        }
        bool operator<(Edge e){return this->cost < e.cost;}
        bool operator>(Edge e){return this->cost > e.cost;}
};

template<typename T> class Graph_list{
    public:
        vector<vector<Edge<T>>> list;

        Graph_list(int n);
        void add(int f, int t, T c);
        void add(int f, int t);
        int size();
        vector<Edge<T>> operator[](int i){
            return list[i];
        }
};

template<typename T> Graph_list<T>::Graph_list(int n){
    list = vector<vector<Edge<T>>>(n + 1, vector<Edge<T>>());
}

template<typename T> void Graph_list<T>::add(int f, int t, T c){
    list[f].push_back(Edge<T>(t, c));
}
template<typename T> void Graph_list<T>::add(int f, int t){
    list[f].push_back(Edge<T>(t, 1));
}
template<typename T> int Graph_list<T>::size(){
    return (int)list.size();
}

template<typename T>
vector<T> bfs_graph(Graph_list<T>& g, int s){
    const auto INF = numeric_limits<T>::max();
    vector<T> dist(g.size(), INF);

    queue<T> que;
    que.push(s);
    dist[s] = 0;
    while(que.size()){
        int p = que.front(); que.pop();
        for (auto e : g[p]){
            if (dist[e.to] == INF){
                dist[e.to] = dist[p] + e.cost;
                que.push(e.to);
            }
        }
    }
    return dist;
}


int main(){
    int n;
    cin >> n;
    Graph_list<int> g(n);
    REP(i,0,n - 1){
        int a, b;
        cin >> a >> b;
        g.add(a, b);
        g.add(b, a);
    }

    vector<int> dist_1 = bfs_graph(g, 1);
    vector<int> dist_n = bfs_graph(g, n);

    int cnt_1 = 0, cnt_n = 0;
    REP(i,1,n + 1){
        if (dist_1[i] <= dist_n[i]) cnt_1++;
        else cnt_n++;
    }

    cout << (cnt_1 > cnt_n?"Fennec":"Snuke") << endl;
    
    return 0;
}

Measured memory_bytes: 7040
n=int(input())
l=list(map(int,input().split()))
s=0
p=0
h_need=l[0]
for i in range(n):
    if h_need>l[i]:
        p=h_need-l[i]
        s+=p
    else:
        h_need=l[i]
print(s)

Measured memory_bytes: 32276
c[5004],d[5004],m,t,u,a,i,f="%d\n";main(x){for(scanf("%d%*d",&a);i<a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<a;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, k, q;
    std::cin >> n >> k >> q;
    std::vector<int> b(n);
    for (int i = 0; i < q; i++) {
        int a;
        std::cin >> a;
        b[a - 1]++;
    }

    for (auto e : b) {
        std::cout << (e > q - k ? "Yes" : "No") << std::endl;
    }

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <deque>
#include <climits>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<long long int>
#define vc vector<char>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(i = (a); i < (n); i++)
#define fi(i,a,n) for(i = (a); i <= (n); i++)
#define F first
#define S second

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

    ll n,m;
    cin>>n>>m;

    ll total = 0;


    vector<vector<ll>> arr(m);

    for(ll i=0;i<m;i++){
        ll x;
        cin>>x;
        for(ll j=0;j<x;j++){
            ll y;
            cin>>y;
            arr[i].push_back(y);
        }
    }

    vector<ll> p(m);

    for(ll i=0;i<m;i++){
        cin>>p[i];
    }

    for(ll i=0;i<pow(2,n);i++){
        vi v;
        ll t = n;
        ll z = i;
        while(t--){
            v.pb(z%2);
            z /= 2;
        }

        reverse(v.begin(),v.end());
//        for(ll j=0;j<v.size();j++){
//            cout<<v[j];
//        }
//        cout<<endl;
//

            ll count = 0;
         for(ll j=0;j<m;j++){
             ll c=0;

             for(ll k=0;k<arr[j].size();k++){
                 if(v[arr[j][k]-1]==1){
                     c++;
                 }
             }

             if(c%2 == p[j]){
                 count++;
             }

         }

         if(count == m){
             total++;
         }

    }

    cout<<total<<endl;

}

Measured memory_bytes: 512
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)




int main(){ FastIO;

int i,j,n;cin>>n;
int a[n];
for(i=0;i<n;i++) cin>>a[i];
int c=0;
for(i=0;i<n;i++)
{
	while(a[i]%2==0)
	{
		c++;
		a[i]=a[i]/2;
	}
}
cout<<c;

return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define int long long
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >  
#define N 200001
#define mod 1000000007
#define ll long long


int32_t main()
{
    IOS;

    int n,k;
    cin>>n>>k;
    vi a(n);
    for(int i = 0;i < n;i++)
        cin>>a[i];
    int dp[2][k+1];
    for(int i = 0; i<= k;i++)
    {
        dp[0][i] = 0;
        dp[1][i] = 1;
    }
    for(int i = 0;i < n;i++)
    {
        int cur = i&1;
        int prev = !cur;
        dp[cur][0] = 1;
        for(int j = 1;j <= k;j++)
        {
            
            if(j-a[i]<=0)
                dp[cur][j] = (dp[prev][j] );
            else
                dp[cur][j] = (dp[prev][j] -dp[prev][j-a[i]-1] +  mod)%mod;
            if(i == n-1  and j==k)
                cout<<dp[cur][k];
            if(j>0)
                dp[cur][j] = (dp[cur][j-1] + dp[cur][j])%mod;
            //trace4(i,cur,j,dp[cur][j]);
        }
        
    }
    if(k == 0)
        cout<<1;
    

    return 0;
}

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

using namespace std;
#define int            long long
#define f(i,n)        for(int i=0;i<(n);++i)
#define fa(i,a,n)     for(int i=a;i<=(n);++i)
#define fd(i,a,n)     for(int i=a;i>=(n);--i)
#define tc 			  int t;cin>>t;f(testcase,t)
#define pii             pair<int,int>
void c_p_c() {

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

}

int32_t main() {

	c_p_c();
	int a,b;
	cin>>a>>b;
	cout<<a*b;

	return 0;
}


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

#define pb push_back
#define fi first
#define se second
#define eb emplace_back

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
const int N = 1000007, M = 1e9 + 7,  inf = 0x3f3f3f3f;

ll gcd(ll a, ll b) {
	return b == 0? a : gcd(b, a%b);
}

ll pot[N];

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

	pot[0] = 1;
	for(int i = 1; i < N; i++) {
		pot[i] = pot[i-1] * 2ll % M;
	}
	int n; cin >> n;

	map<pair<ll, ll>, int> cnt;

	int uno, dos, ambos;
	uno = 0, dos = 0, ambos = 0;
	for(int i = 0; i < n; i++) {
		ll a, b; cin >> a >> b;

		if(!a or !b) {
			if(a == 0 and b == 0) ambos++;
			else if(a == 0) uno++;
			else dos++;
			continue;	
		}
		
		int nega = 0;
		if(a < 0) {
			nega ^= 1;
			a = -a;
		}

		if(b < 0) {
			nega ^= 1;
			b = -b;
		}


		ll g = gcd(a, b);
		a /= g;
		b /= g;

		if(nega) a = -a;
		cnt[{a, b}]++;
	}

	ll ans = 1;
	for(auto aux : cnt) {
		ll a, b;
		tie(a, b) = aux.first;

		if(a < 0 and cnt.count({b, -a})) continue;

		if(cnt.count({-b, a})) {
			ans = ans * ( (pot[aux.se] + pot[cnt[{-b, a}]] - 1 ) % M ) % M;
		} else {
			ans = ans * pot[aux.second] % M;
		}
	}

	ans = ans * ( (pot[uno] + pot[dos] - 1) % M) % M;


	cout << (ans + ambos - 1 + M)%M << '\n';
}

Measured memory_bytes: 23920
//https://blog.csdn.net/hesorchen
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define endl "\n"
#define lowbit(a) (a & (-a))
#define INF 0x3f3f3f3f
#define MAX 1010
#define mod 1000000007
#define PI 3.1415926
#define test_ printf("*************\n")

char p[8000000];
int main()
{
    fill(p, p + 401000, '*');
    int pos1 = 250000;
    int pos2;
    cin >> p + pos1;
    for (int i = 400005; i >= 250000; i--)
        if (p[i] != '*')
        {
            pos2 = i;
            break;
        }
    int t;
    cin >> t;
    int ff = 0;
    int a;
    int b;
    char x;
    pos1--;
    pos2;
    while (t--)
    {
        scanf("%d", &a);
        if (a == 1)
            ff++;
        else
        {
            scanf("%d", &b);
            getchar();
            scanf("%c", &x);
            if ((ff & 1 && b == 1) || (!(ff & 1) && b == 2))
                p[pos2++] = x;
            else
                p[pos1--] = x;
            // cout << "**** " << x << endl;
        }
    }
    if (ff & 1)
    {
        for (int i = pos2 - 1; i > pos1; i--)
            printf("%c", p[i]);
        cout << endl;
    }
    else
    {
        for (int i = pos1 + 1; i < pos2; i++)
            printf("%c", p[i]);
        cout << endl;
    }
    // cout << pos1 << ' ' << pos2 << endl;

    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N;
  cin >> N;
  char S;
  string kind = "Three";
  rep(i, N){
    cin >> S;
    if(S == 'Y') kind = "Four";
  }

  cout << kind << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define all(a) (a).begin(),(a).end()
#define X first
#define Y second
using namespace std;
const int mod=1e9+7;
void solve()
{
    int n,k; cin>>n>>k;
    int a[n],b[k+1]; b[0]=1;
    for(int i=0;i<n;i++)cin>>a[i];
    int dp[k+1];
    memset(dp,0,sizeof(dp));
    dp[0]=1;
    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=k;j++)b[j]=(dp[j]+b[j-1])%mod;
        for(int j=1;j<=k;j++)
        {
            if(j-a[i]-1<0)dp[j]=b[j];
            else dp[j]=(b[j]-b[j-a[i]-1]+mod)%mod;
        }
    }
    cout<<dp[k];
    return;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; t=1;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 4376
#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;

int main(){
	int a, b; cin >> a >> b;
	std::string s; cin >> s;
	
	for(int i = 0; i < s.size(); i++){
		if(i == a and s[i] != '-'){
			cout << "No" << endl;
			return 0;
		}
		if(i == a) continue;
		
		if('0' <= s[i] and s[i] <= '9') continue;
		cout << "No" << endl;
		return 0;
	}
	
	cout << "Yes" << endl;
	return 0;
}


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

int main()
{
  while(1){
    int n;
    cin >> n;
    if(n == 0) break;
    string w[n];
    bool k[500] = {};
    k[0] = true;
    string s = "";
    int m[n+1];
    m[0] = 0;
    for(int i = 0; i < n; i++){
      cin >> w[i];
      s += w[i];
      k[s.size()] = true;
      m[i+1] = s.size();
    }
    for(int i = 0; i < n; i++){
      if(s.size()-m[i]+1 < 31) continue;
      if(k[m[i]] && k[m[i]+5] && k[m[i]+12] && k[m[i]+17] && k[m[i]+24] && k[m[i]+31]){
        cout << i+1 << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 1216
s=input()

l=[1]

for i in range(2018):
    l.append(0)

ss=0
for i in range(len(s)):#ss=s[len(s)-i-1::]
    ss=(int(s[len(s)-i-1])*pow(10,i,2019)+ss)%2019
    l[ss]+=1
n=0
for i in range(2019):
    n+=l[i]*(l[i]-1)//2

print(int(n))


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

int main(void){
	int H,W,N,a,b;
	int dx[9]={-1,-1,-1,0,0,0,1,1,1},dy[9]={-1,0,1,-1,0,1,-1,0,1};
	cin>>H>>W>>N;
	ll cnt[10]={(ll)(H-2)*(W-2)};
	map<pi,int> mp;
	rep(i,N){
		cin>>a>>b;
		rep(j,9){
			if(a+dx[j]<=1 || a+dx[j]>=H || b+dy[j]<=1 || b+dy[j]>=W)continue;
			cnt[mp[pi (a+dx[j],b+dy[j])]++]--;
			cnt[mp[pi (a+dx[j],b+dy[j])]]++;
		}
	}
	rep(k,10)cout<<cnt[k]<<endl;

	return 0;
}


Measured memory_bytes: 56448
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<stack<int>> s(n);

	for (int i = 0; i < m; i++)
	{
		int q, t;
		cin >> q >> t;

		int x;
		switch (q)
		{
			case 0:
				cin >> x;
				s[t].push(x);
				break;

			case 1:
				if (!s[t].empty())
				{
					println(s[t].top());
				}
				break;

			case 2:
				if (!s[t].empty())
				{
					s[t].pop();
				}
				break;
		}
	}
}



Measured memory_bytes: 4276
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>

using namespace std;


int main() {

    char S;
    cin >> S;
    char ans;
    if (S == 'a') ans = 'b';
    if (S == 'b') ans = 'c';
    if (S == 'c') ans = 'd';
    if (S == 'd') ans = 'e';
    if (S == 'e') ans = 'f';
    if (S == 'f') ans = 'g';
    if (S == 'g') ans = 'h';
    if (S == 'h') ans = 'i';
    if (S == 'i') ans = 'j';
    if (S == 'j') ans = 'k';
    if (S == 'k') ans = 'l';
    if (S == 'l') ans = 'm';
    if (S == 'm') ans = 'n';
    if (S == 'n') ans = 'o';
    if (S == 'o') ans = 'p';
    if (S == 'p') ans = 'q';
    if (S == 'q') ans = 'r';
    if (S == 'r') ans = 's';
    if (S == 's') ans = 't';
    if (S == 't') ans = 'u';
    if (S == 'u') ans = 'v';
    if (S == 'v') ans = 'w';
    if (S == 'w') ans = 'x';
    if (S == 'x') ans = 'y';
    if (S == 'y') ans = 'z';
    if (S == 'z') ans = 'a';

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#define LL long long
using namespace std;

string s;
LL k,num=0,ans=0,last=0;
LL vis=0,viss=0,check=0;

int main(){
	cin>>s>>k;
	if(s.length()==1){
		cout<<k/2<<endl;
		return 0;
	}	
	for(int i=0;i<s.length();i++){
		if(s[i]==s[0]) vis++;
		else break;
	}
	if(vis==s.length()){
		cout<<(k*s.length())/2;
		return 0;
	}
	for(int i=s.length()-1;i>=0;i--){
		if(s[i]==s[s.length()-1]) viss++;
		else break;
	}
	for(int i=0;i<s.length()-1;i++){
		if(s[i]==s[i+1])s[i+1]='-',num++;
	}
	if(s[0]==s[s.length()-1]){
		last=1;
		if((vis+viss)%2==1) check=1;
	}
	if(check){
		cout<<num*k<<endl;
		return 0;
	}
	else ans=(num*k+last*(k-1));
	cout<<ans<<endl;
}


Measured memory_bytes: 256
S = input()
K = int(input())

ans = set()
for i in range(len(S)):
  for j in range(1, 6): #　制約が最大K=5の為
    s = S[i:i+j]
    ans.add(s)
    
ans = sorted(ans)    
print(ans[K-1])
    

Measured memory_bytes: 4556
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, i, j, k, ct, d, s;
	cin >> n >> d;
	vector<vector<int>> a(n, vector<int>(d));
	for (i = 0; i < n; i++) {
		for (j = 0; j < d; j++) cin >> a[i][j];
	}

	ct = 0;
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			s = 0;
			for (k = 0; k < d; k++) s += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
			long double sq = sqrt(s * 1.0);
			if (abs(sq - floor(sq + 0.000001)) < 0.000001) ct++;
		}
	}

	cout << ct << "\n";

	return 0;
}


Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True


ans=0

n,k=LI()
b=[]

for i in range(1,int(n**0.5)+1):
    b+=[n//i]
    b+=[n//(n//i)]

b=sorted(set(b))
d=[i-j for i,j in zip(b,[0]+b)]
k+=1

m=len(b)
dp=[[0]*(m) for j in range(1+k)]
dp[0][0]=1

for i in range(k):
    sdp=[0]
    #show('dp',dp[i])
    for j in range(m):
        sdp.append((sdp[-1]+dp[i][j]*d[j])%mo)
    sdp=sdp[::-1]
    #show('sdp',sdp)
    for j in range(m):
        dp[i+1][j]=sdp[j]

print(sdp[0])


Measured memory_bytes: 121836
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+23;
const double eps = 1e-11;
const double pi = acos(-1.0);
struct Point
{
    double x,y;
    Point(double x=0,double y=0) : x(x),y(y) {}
    bool operator < (const Point p)
    {
        return x<p.x||(x==p.x&&y<p.y);
    }
};
typedef Point Vector;
Point p[maxn];

Point operator - (Point A,Point B) {return Point(A.x-B.x,A.y-B.y);}
Point operator / (Point A,double t) {return Point(A.x/t,A.y/t);}
Point operator + (Point A,Point B) {return Point(A.x+B.x,A.y+B.y); }
Point operator * (Point A,double t) {return Point(A.x*t,A.y*t);}
double cross(Point A,Point B)
{
    return A.x*B.y-A.y*B.x;
}
double dot(Vector a,Vector b)
{
    return a.x*b.x+a.y*b.y;
}
double length(Vector t)
{
    return sqrt(dot(t,t));
}
struct Circle
{
    Point p;double r;
    Circle(Point p=Point(0,0),double r=0):p(p),r(r) {}
};

bool IN(Point p,Circle c)
{
    return length(p-c.p)<c.r+eps;
}

double angle(Vector A,Vector B)
{
    return acos(dot(A,B)/length(A)/length(B));
}
Vector rotate(Vector a,double rad) {return Vector(a.x*cos(rad)-a.y*sin(rad),a.x*sin(rad)+a.y*cos(rad)); }
Point GetLineIntersection(Point P,Vector V,Point Q,Vector W) {Vector u=P-Q;double t=cross(W,u)/cross(V,W);return P+V*t; }
Circle oc(Point A,Point B,Point C)
{
    Point p1=(A+B)/2,p2=(B+C)/2;
    Vector v1=rotate(B-A,pi/2),v2=rotate(C-B,pi/2);
    Point d=GetLineIntersection(p1,v1,p2,v2);
    return Circle(d,length(d-A));
}


int n;
int main()
{
    cin >> n ;
    for(int i=0;i<n;i++) cin >> p[i].x >> p[i].y;
    if(n>=1000) random_shuffle(p,p+n);
    Circle C=Circle(Point(0,0),0);
    for(int i=0;i<n;i++){
        if(!IN(p[i],C)){
            C=Circle(p[i],0.0);
            for(int j=0;j<i;j++){
                if(!IN(p[j],C)) {
                    C=Circle(Point(p[i]/2+p[j]/2),length(p[i]-p[j])/2);
                    for(int k=0;k<j;k++){
                        if(!IN(p[k],C)){
                            C=oc(p[i],p[j],p[k]);
                        }
                    }
                }
            }
        }
    }
    printf("%.10f",C.r);
}


Measured memory_bytes: 2048
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INF = 1e6+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

int main(){
	int a,v,b,w,t;
	cin >> a >> v >> b >> w >> t;
	if(v<=w){
		cout << "NO" << endl;
		return 0;
	}
	if(v*t>=abs(a-b)+w*t){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3632
n=gets.to_i
zoroes = n.times.map do
  arr = gets.chomp.split(' ').map(&:to_i)
  arr[0] == arr[1]
end
res = (0..n-3).any? do |i|
  zoroes[i] && zoroes[i+1] && zoroes[i+2]
end
puts res ? 'Yes' : 'No'

Measured memory_bytes: 14368
n=int(input())
#a,b,c=map(int,input().split())

if 599>=n>=400:
  print(8)
elif 799>=n>=600:
  print(7)
elif 999>=n>=800:
  print(6)
elif 1199>=n>=1000:
  print(5)
elif 1399>=n>=1200:
  print(4)
elif 1599>=n>=1400:
  print(3)
elif 1799>=n>=1600:
  print(2)
elif 1999>=n>=1800:
  print(1)



Measured memory_bytes: 9172
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	int ans = 0;
	int first = 1;

	while (first < b) {
		first--;
		first += a;
		ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int N, K;
	cin >> N >> K;
	int A[200000];
	rep(i, N) cin >> A[i];

	int L = 0, R = 1000000000;
	while (L + 1 < R) {
		int H = (L + R) / 2;
		ll k = 0;
		rep(i, N) {
			k += (A[i] - 1) / H;
		}
		if (k <= K) R = H;
		else L = H;
	}

	co(R);


	Would you please return 0;
}

Measured memory_bytes: 4328
#include <iostream>
#include <math.h>

int main(){
	using namespace std;
	int a;
	double r = 0.0;
	cin >> a;

	if (a % 2 == 0) {
		r = 0.5;
	}
	else {
		r = (1-floor(a / 2)/a);
	}

	cout << r << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i=0;i<N;i++) {
			A[i]=sc.nextInt();
		}
		Arrays.sort(A);


		int[] gc = new int[N-1];
		gc[0]=gcd(A[0],A[1]);
		for (int i=0;i<N-2;i++) {
			gc[i+1]= gcd(gc[i],A[i+2]);
		}
		System.out.println(gc[N-2]);
	}

	static int gcd(int a,int b) {
	int temp;
	while((temp = a%b)!=0) {
		a = b;
		b = temp;
	}
	return b;
	}
}

Measured memory_bytes: 50512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 998244353;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//Range Minimum Query
struct SegmentTree{
    int n;
    vector<ll> nodes;
    
    SegmentTree(vector<ll> v) {
        int sz=v.size();
        n=1;
        while(n<sz) {
            n*=2;
        }
        nodes.resize(2*n-1,LINF);
        for(int i=0;i<sz;i++) {
            nodes[i+n-1]=v[i];
        }
        for(int i=n-2;i>=0;i--) {
            nodes[i]=min(nodes[2*i+1],nodes[2*i+2]);
        }
    }
    
    void update(int x,ll val) {
        x=n+x-1;
        nodes[x]=val;
        while(x>0) {
            x=(x-1)/2;
            nodes[x]=min(nodes[2*x+1],nodes[2*x+2]);
        }
    }
    
    ll getmin(int a,int b,int k=0,int l=0,int r=-1) {
        if(r<0) r=n;
        
        if(r<=a || b<=l) return LINF;
        if(a<=l && r<=b) return nodes[k];
        
        ll vl=getmin(a,b,2*k+1,l,(l+r)/2);
        ll vr=getmin(a,b,2*k+2,(l+r)/2,r);
        
        return min(vl,vr);
    }
    
    ll at(int x) {
        return nodes[n+x-1];
    }
};

int main() {
    int n,m;
    cin>>n>>m;
    vector<pair<pair<int,int>,ll>> vec(m);
    rep(i,m) {
        int l,r;
        ll c;
        cin>>l>>r>>c;
        l--;r--;
        vec[i]={{r,l},c};
    }
    sort(all(vec));
    
    vector<ll> v(n,LINF);
    SegmentTree segt(v);
    segt.update(0,0);
    rep(i,m) {
        int l=vec[i].first.second;
        int r=vec[i].first.first;
        ll c=vec[i].second;
        segt.update(r,min(segt.at(r),segt.getmin(l,r+1)+c));
    }
    cout<<(segt.at(n-1)==LINF ? -1 : segt.at(n-1))<<endl;
}



Measured memory_bytes: 5376
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in(),M=in();
	auto A=vecin(M);
	auto S=accumulate(ALL(A),0LL);
	
	if(S>N) out(-1);
	else out(N-S);

	return 0;
}


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

int64_t gcd(int64_t a, int64_t b){
    return b==0 ? a : gcd(b, a%b);
}

int64_t A, B, C, D;

int64_t calc(int64_t X){
    int64_t lcm = C*D / gcd(C, D);
    return X - X/C - X/D + X/lcm;
}

int main(){
    cin >> A >> B >> C >> D;
    int64_t ans = calc(B) - calc(A-1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256