akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

long long pow_mod(long long n, long long p, long long m)
{
    if (p == 0) {
        return 1;
    }

    if (p % 2 == 0) {
        long long t = pow_mod(n, p / 2, m);
        return t * t % m;
    }
    return n * pow_mod(n, p - 1, m) % mod;
}

long long nCr_mod(long long n, long long r)
{
    long long x = 1;
    for (long long i = n - r + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }

    long long a = 1;
    for (long long i = 1; i <= r; i++) {
        a *= i;
        a %= mod;
    }

    long long y = pow_mod(a, mod - 2, mod) % mod;

    return x * y % mod;
}

bool is_prime(long long n)
{
    if (n == 1) {
        return false;
    }

    for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }

    return true;
}

int main()
{
    long long n;
    std::cin >> n;

    std::vector<std::pair<std::string, long long>> pairs(n);

    long long sum = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> pairs[i].first >> pairs[i].second;
        sum += pairs[i].second;
    }

    std::string s;
    std::cin >> s;

    for (int i = 0; i < n; i++) {
        sum -= pairs[i].second;
        if (s == pairs[i].first) {
            break;
        }
    }

    std::cout << sum << std::endl;
}


Measured memory_bytes: 256
#include<stdio.h>
main(){
  int x,y,z,i,j,k;
  while(1){
    scanf("%d %d",&x,&y);
    if(x == 0 && y == 0)break;
    if(x > y){
      printf("%d %d\n",y,x);
    }
    else{
      printf("%d %d\n",x,y);
    }
  }
  return 0;
}

Measured memory_bytes: 600
#75b
h,w=map(int,input().split())
s=[list('.'*(w+2))]
s.extend([list('.'+input()+'.') for i in range(h)])
s.append(list('.'*(w+2)))


for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j]=='.':
            cnt=0
            cnt += s[i-1][j-1:j+2].count('#')
            cnt += s[i][j-1:j+2].count('#')
            cnt += s[i+1][j-1:j+2].count('#')
            s[i][j] = str(cnt)

for i in s[1:-1]:
    print(''.join(i[1:-1]))

Measured memory_bytes: 3188
// /*
// power code taken from geeks for geeks
// */
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
double modd(double a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;
 
    ll P = power(k, p/2LL);
    P = (P * P) % MODD;
 
    if (p % 2 == 1)
        P = (P * k) % MODD;
 
    return P;
}



struct p_str {
    ll a, b;
};


void solve() {
    ld d, t, s;
    cin >> d >> t >> s;

    ld t2 = d / s * 1.0 ;

    // cout << t2 << endl;

    if(t2 <= t) {
        cout << "Yes\n";
        
    }
    else {
        cout << "No\n";
    }
}


int main(){


  


    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    



    ll t=1;


    // cin>>t;
    


    while(t--){

        solve();
    }
    return 0;
}

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

int main(){
    string s,t;
    cin >> s >> t;
    if(t.substr(0,s.size())==s){
        if(t.size()==s.size()+1){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3620
//Strange Bank

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n;cin>>n;
    vector<int>a;
    a.pb(1);
    int t=6;
    a.pb(t);
    rep(i,0,5){
        t*=6;
        a.pb(t);
    }
    t=9;
    a.pb(t);
    rep(i,0,4){
        t*=9;
        a.pb(t);
    }
    sort(range(a),greater<int>());
    vector<int>m(n+1,inf);
    m[0]=0;
    rep(i,1,n+1){
        for(auto j:a){
            if(i-j<0)continue;
            m[i]=min(m[i],m[i-j]+1);
        }
    }
    cout<<m[n]<<nnn;
    return 0;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b,c; cin >> a >> b >> c;
    int m = max(a,max(b,c));
    int x = m+1;
    if((3*m-(a+b+c))%2 == 0) x = m;
    OUT((3*x-(a+b+c)) /2);

    return 0;
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	p := Permutation{}
	p.init(n)

	pp := make([]Point, n)
	for i := 0; i < n; i++ {
		pp[i].x = getNextFloat64(scanner)
		pp[i].y = getNextFloat64(scanner)
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			p.xy[i][j] = math.Sqrt(math.Pow(pp[i].x-pp[j].x, 2) + math.Pow(pp[i].y-pp[j].y, 2))
		}
	}

	p.calc(n)

	fmt.Fprintln(writer, p.ans/float64(p.fac))

	writer.Flush()
}

type Point struct {
	x, y float64
}
type Permutation struct {
	a   []int
	xy  [][]float64
	ans float64
	fac int
}

func (p *Permutation) init(n int) {
	p.a = make([]int, n)
	p.xy = make([][]float64, n)
	p.fac = 1
	for i := 0; i < n; i++ {
		p.a[i] = i
		p.xy[i] = make([]float64, n)
		p.fac *= i + 1
	}
}
func (p *Permutation) calc(n int) {
	if n == 1 {
		for i := 1; i < len(p.a); i++ {
			p.ans += p.xy[p.a[i]][p.a[i-1]]
		}
		return
	}

	for i := 0; i < n; i++ {
		p.calc(n - 1)
		if n%2 == 0 {
			p.a[i], p.a[n-1] = p.a[n-1], p.a[i]
			continue
		}
		p.a[0], p.a[n-1] = p.a[n-1], p.a[0]
	}
}


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


int* mallocint(int si)
{
    return (int*) malloc(si * sizeof(int));
}

int* inputint(int n)
{
    int *ans = mallocint(n);
    for( int i = 0; i < n; i++ ) cin >> ans[i];
    return ans;
}

int main()
{
    int n;
    cin >> n;
    int *a = inputint(n);
    int ans = 0;
    for( int i = 1; i <= n; i++ )
    {
        if( i % 2 == 1 && a[i - 1] % 2 == 1 ) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 3620
import java.text.ParseException;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws ParseException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		double sum = 0;

		for(int i = 0; i < n ; i++) {
			double x = sc.nextDouble();
			String u = sc.next();

			if(u.equals("BTC")) {
				x *= 380000;
			}

			sum += x;

		}

		System.out.println(sum);

		sc.close();
	}

}


Measured memory_bytes: 24148
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;

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

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    Sushi[] sushis = new Sushi[N];
    for (int i = 0; i < N; i++) sushis[i] = new Sushi(scanner.nextInt(), scanner.nextInt());

    Arrays.sort(sushis);
    reverse(sushis);

    HashSet<Integer> tset = new HashSet<>();
    boolean[] first = new boolean[N];
    for (int i = 0; i < N; i++) {
      if (!tset.contains(sushis[i].t)) {
        first[i] = true;
        tset.add(sushis[i].t);
      }
    }

    long sum = 0;
    long tt = 0;
    Stack<Sushi> stack = new Stack<>();
    for (int i = 0; i < K; i++) {
      sum += sushis[i].d;
      if (first[i]) {
        sum += tt * 2 + 1;
        tt++;
      } else {
        stack.push(sushis[i]);
      }
    }
    long max = sum;
    for (int i = K; i < N && !stack.isEmpty(); i++) {
      if (first[i]) {
        sum += sushis[i].d - stack.pop().d + tt * 2 + 1;
        max = Math.max(max, sum);
        tt++;
      }
    }
    System.out.println(max);
  }

  private static class Sushi implements Comparable<Sushi> {
    public final int t;
    public final int d;

    private Sushi(int t, int d) {
      this.t = t;
      this.d = d;
    }

    @Override public int compareTo(Sushi sushi) {
      return this.d - sushi.d;
    }
  }

  private static void reverse(Sushi[] list) {
    int i = 0;
    int j = list.length - 1;
    while (i < j) {
      Sushi tmp = list[i];
      list[i] = list[j];
      list[j] = tmp;
      i++;
      j--;
    }
  }
}


Measured memory_bytes: 95572
(
  (stdin.ReadLine() |> int),
  (stdin.ReadLine() |> fun x -> x.Split(' ') |> Array.map int |> Array.sort),
  (stdin.ReadLine() |> fun x -> x.Split(' ') |> Array.map int |> Array.sort),
  (stdin.ReadLine() |> fun x -> x.Split(' ') |> Array.map int |> Array.sort)
)
|> fun (n, arrA, arrB, arrC) ->
  (
    fun (arr: int array) ->
      (
        (arr |> Array.length |> double, 2.) |> System.Math.Log |> ceil |> int,
        arr |> Array.max
      )
      |> fun (limI, maxV) ->
        fun v ->
          if v >= maxV
          then n
          else (
            [1..limI]
            |> List.fold (
              fun (li, ri) _ ->
                if li = ri then (li, ri) else (
                  li + (ri - li) / 2
                  |> fun mi ->
                    match compare v arr.[mi] with
                    | -1 -> (li, mi)
                    | _ -> (mi + 1, ri)
                )
            ) (0, arr.Length - 1)
            |> fun (_, i) -> i
          )
  )
  |> fun search ->
    (
      arrB
      |> Array.map (search arrC >> (-) n >> int64)
      |> Array.rev
      |> Array.scan (+) 0L
      |> Array.rev
    )
    |> fun arrBSize ->
      arrA
      |> Array.sumBy (search arrB >> (fun i -> arrBSize.[i]))
|> printfn "%d"


Measured memory_bytes: 57236
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int h,w,k;
    cin >> h >> w >> k;
    int fib[10];
    fib[0] = fib[1] = 1;
    rep(i,8){
        fib[i+2] = fib[i+1] + fib[i];
    }
    long long dp[h+10][w+2];
    dp[0][1] = 1;
    rep(i,w-1){
        dp[0][i+2] = 0;
    }
    rep(i,h+2){
        rep(j,w+1){
            dp[i+1][j+1] = 0;
        }
    }
    if(w==1){
        cout << 1 << endl;
    }
    else{
        rep(i,h){
            for(int j = 1;j<=w;j++){
                if(j == 1){
                    dp[i+1][2] += dp[i][1]*fib[w-2];
                    dp[i+1][2]%=MOD;
                }
                else if(j == w){
                    dp[i+1][w-1] += dp[i][w]*fib[w-2];
                    dp[i+1][w-1]%=MOD;
                }
                else{
                    dp[i+1][j-1] += dp[i][j]*fib[j-2]*fib[w-j];
                    dp[i+1][j+1] += dp[i][j]*fib[j-1]*fib[w-j-1];
                    dp[i+1][j-1]%=MOD;
                    dp[i+1][j+1]%=MOD;
                }
                dp[i+1][j] += dp[i][j]*fib[j-1]*fib[w-j];
                dp[i+1][j]%=MOD;
            }
        }
        cout << dp[h][k] << endl;   
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    private static final int N = 1000000;
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int [] prime = new int [N];
		for(int i=2;i*i<N;i++){
			if(prime[i]==1)
				continue;
			for(int j=i*2;j<N;j=j+i){
				prime[j]=1;
			}
		}
		for(int i=2;i<N;i++){
			prime[i]=prime[i-1]+(prime[i]==0?1:0);
		}
		  while ( sc.hasNextInt ( ) )
		    {
		      int n;
		      
		      n = sc.nextInt ( );
		      System.out.println ( prime[ n ] );
		    }
	return;	    
	}

}

Measured memory_bytes: 25292
#include<stdio.h>
int main() {
  int n;
  scanf("%d",&n);
  switch (n%10) {
    case 0:
      printf("pon");
      break;
    case 1:
      printf("pon");
      break;
    case 2:
      printf("hon");
      break;
    case 3:
      printf("bon");
      break;
    case 4:
      printf("hon");
      break;
    case 5:
      printf("hon");
      break;
    case 6:
      printf("pon");
      break;
    case 7:
      printf("hon");
      break;
    case 8:
      printf("pon");
      break;
    case 9:
      printf("hon");
      break;
  }
  return 0;
}

Measured memory_bytes: 1732
N, A, B= map(int, input().split())
result = []
for i in range(1, N + 1):
    tmp = i
    digits_sum = 0
    while tmp > 0:
        digits_sum += tmp % 10
        tmp //= 10
    if A <= digits_sum <= B:
        result.append(i)
print(sum(result))

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

int main(){
    int N;
    
    cin >> N;
    
    int 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{
        cout << "bon" << endl;
    }
    
    
}

Measured memory_bytes: 3600
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++ i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; -- i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++ i)
#define ri rd<int>
typedef double db;
const db pi = acos(-1.);
const int maxN = 2e5 + 7;
const int INF = 1e9 + 7;
using namespace std;

template<class T> inline T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - 48; return f ? x : -x;
}

int n, m, rev;
struct pt {
	int x, y;
	inline void input() {x = ri(), y = ri();}
	inline bool operator < (const pt &v) const {return x < v.x;}
}L, R, a[maxN];
int f[maxN];

int main() {

	L.input(), R.input();
	if (L.x > R.x) swap(L, R);
	if (L.y > R.y) L.y = -L.y, R.y = -R.y, rev = 1;

	m = ri();
	rep (i, 1, m) {
		pt p; p.input();
		if (rev) p.y = -p.y;
		if (L.x <= p.x && p.x <= R.x && L.y <= p.y && p.y <= R.y) a[++n] = p;
	}
	sort(a+1, a+n+1);

	f[0] = -INF; int mx = 0, ss = 0;
	rep (i, 1, n) {
		int p = upper_bound(f, f+mx+1, a[i].y) - f;
		f[p] = a[i].y;
		mx = max(p, mx);
	}
	if (mx == min(R.y - L.y, R.x - L.x) + 1) mx--, ss = 1;
	printf("%.15lf\n", (R.y - L.y + R.x - L.x) * 100.0 - mx  * (20 - 5 * pi) + ss * (10 * pi - 20));

	return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
    public static void main(String args[] ) throws Exception {
    	new Main().exec(args);
    }

    public Main() {
    }

    public void exec(String args[]) throws Exception {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int x = sc.nextInt();
    	int[] a = new int[N];
    	int[] b = new int[N-1];
    	long ans=0;
    	for(int i=0; i<N; i++) {
    		a[i] = sc.nextInt();
    		if(i>=1){
    			b[i-1]=a[i]+a[i-1];
    		}
    	}

    	if(N==2){
    		System.out.println( (b[0]-x<0) ? 0 : b[0]-x );
    	}else{
			int overbi=0;
    		for(int i=0; i<N-2; i++){
    			overbi=b[i]-x;
	   			if(overbi>0){
					ans += overbi;
					b[i+1] -= ((a[i+1]<overbi)?a[i+1]:overbi);
	    		}
    		}
    		if(b[N-2]>x){
    			ans += (b[N-2]-x);
    		}
    		System.out.println(ans);
    	}
    }
}

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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

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



int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


    int n;
    cin >> n;
    vi v(n);
    vi mn(n);
    for(int &x : v)cin >> x;
    mn[n-1] = v[n-1];
    bool flag = true;
    rloop(i,n-2){
        if(v[i] - mn[i + 1] > 1){
            flag = false;
        }else if(v[i] - mn[i+1] == 1){
            v[i]--;
        }

        mn[i] = min(v[i] , mn[i+1]);
    }

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

    return 0;
}


Measured memory_bytes: 1024
from collections import defaultdict
from heapq import heappop, heappush

N = int(input())


class Graph(object):
    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    def __init__(self, graph, start):
        g = graph.graph

        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0
        self.prev = defaultdict(lambda: None)

        Q = []
        heappush(Q, (self.dist[start], start))

        while Q:
            dist_u, u = heappop(Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(Q, (alt, v))

    def shortest_distance(self, goal):
        return self.dist[goal]

    def shortest_path(self, goal):
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]

g = Graph()
for _ in range(N - 1):
    a, b = map(int, input().split())
    g.add_edge(a - 1, b - 1)
    g.add_edge(b - 1, a - 1)

d1 = Dijkstra(g, 0)
d2 = Dijkstra(g, N - 1)
c1, c2 = 0, 0
for i in range(N):
    if d1.shortest_distance(i) <= d2.shortest_distance(i):
        c1 += 1
    else:
        c2 += 1

if c1 > c2:
    print('Fennec')
else:
    print('Snuke')


Measured memory_bytes: 77692
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int N;
    static int M;
    static void INPUT()
    {
        N = NextInt();
        M = NextInt();

    }
    static void OUT()
    {
        var ans = combination(N,2) + combination(M, 2);
        Console.WriteLine(ans);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
    /// <summary>
    /// 階乗
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
    public static long Factorial(int n)
    {
        var num = 1;
        for (var i = 2; i <= n; i++)
            num *= i;
        return num;
    }

    /// <summary>
    /// 階乗
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
    public static long permutation(int a, int b)
    {
        var num = 1;
        for (var i = 0; i < b; i++)
            num *= (a - i);
        return num;
    }

    /// <summary>
    /// 組み合わせ
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
    public static long combination(int a, int b)
    {
        return permutation(a, b) / Factorial(b);
    }
}




Measured memory_bytes: 11220
#include<stdio.h>

int main(void){
  int A[100],n,i,j,temp,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
	temp=A[j];
	A[j]=A[j-1];
	A[j-1]=temp;
	count++;
      }
    }
  }
  for(i=0;i<n-1;i++){
      printf("%d ",A[i]);
  }
  printf("%d",A[n-1]);
  printf("\n");
  printf("%d\n",count);
}



Measured memory_bytes: 2144
program main;
var ac, wa, tle, re, i, n : integer;
    s : string;
 
begin
  readln(n);
  ac := 0; wa := 0; tle := 0; re := 0;
  for i := 1 to n do begin
    readln(s);
    if s = 'AC' then inc(ac)
    else if s = 'WA' then inc(wa)
    else if s = 'TLE' then inc(tle)
    else if s = 'RE' then inc(re);
  end;
  writeln('AC x ', ac);
  writeln('WA x ', wa);
  writeln('TLE x ', tle);
  writeln('RE x ', re);
end.

Measured memory_bytes: 1356
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int input(int x[]);
int output(int x[]);

int main(void)
{
	int x[10000] = { 0 };

	input(x);
	output(x);

	return 0;
}
int input(int x[])
{
	for (int loop = 0;loop<10000;loop++)
	{
		scanf("%d", &x[loop]);

		if (0 == x[loop])
			break;
	}
	return 0;
}
int output(int x[])
{
	for (int loop = 0; loop<10000; loop++)
	{
		if (0 == x[loop])
			break;
		printf("Case %d: %d\n", loop + 1, x[loop]);
	}
	return 0;
}


Measured memory_bytes: 2040
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &in, vector<T> &vec) {
    for (auto &e : vec) in >> e;
    return in;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    i64 H, W;
    read(H, W);
    char mat[55][55] {};
    rep(i, H) {
        read(mat[i]);
    }

    bool f[55][55] {};

    rep(i, H) {
        rep(j, W) {
            if (mat[i][j] == '#') {
                if (mat[i][j+1] == '#') {
                    f[i][j] = f[i][j+1] = '.';
                }
                if (mat[i+1][j] == '#') {
                    f[i][j] = f[i+1][j] = '.';
                }
            }
        }
    }
    rep(i, H) rep(j, W) {
        if (mat[i][j] == '#' && !f[i][j]) {
            print("No");
            return 0;
        }
    }
    print("Yes");

    return 0;
}


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

#define int long long
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define reps(i, n) for (int (i) = 1; (i) <= (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL << (n))
typedef vector<int> vint;
typedef pair<int, int> pint;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct SetUp {
    SetUp() {
        cout << fixed << setprecision(20);
        cerr << fixed << setprecision(20);
    };
} setUp;

int L, R;
signed main() {
    cin >> L >> R;
    if (R - L >= 2018) {
        cout << 0 << endl;
        return 0;
    }
    int ans = LLONG_MAX;
    for (int i = L; i <= R; i++) {
        for (int j = i + 1; j <= R; j++) {
            chmin(ans, i * j % 2019);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
INF = float("inf")
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
A = nl()

res = INF
for t in range(-100, 101):
    cost = 0
    for i in range(N):
        cost += (A[i] - t) * (A[i] - t)
    if cost < res:
        res = cost

print(res)


Measured memory_bytes: 38896
#include <iostream>

using namespace std;

static const int NIL = -1;
struct node {
  int p;
  int r;
  int l;
};

node tree[9999];


int depth(int u){
  int d = 0;
  while(tree[u].p != NIL){
    u = tree[u].p;
    d++;
  }
return d;
}

int printh(int u){
  int h1 ,h2;
  h1 = h2 = 0;
  if(tree[u].l != NIL) h1 = printh(tree[u].l) + 1;
  if(tree[u].r != NIL) h2 = printh(tree[u].r) + 1;
  return max(h1 , h2);
}


int printsib(int u){
  int c;
  if(tree[u].p != NIL) c = tree[u].p;
  else return NIL;
  if(tree[c].r != u && tree[c].r != NIL) return tree[c].r;
  else if(tree[c].l != u && tree[c].l != NIL) return tree[c].l;
  else return NIL;
}

int printdeg(int u){
  if(tree[u].r != NIL && tree[u].l != NIL) return 2;
  else if((tree[u].r != NIL && tree[u].l == NIL) || (tree[u].r == NIL && tree[u].l != NIL)) return 1;
  else return 0;
}

void preorder(int u){
if(u == NIL) return;

cout << ' ' << u;
preorder(tree[u].l);
preorder(tree[u].r);
}

void inorder(int u){
  if(u ==NIL) return;
  if(tree[u].l != NIL) inorder(tree[u].l);
  cout << ' ' << u;
  if(tree[u].r != NIL) inorder(tree[u].r);
}

void postorder(int u){
  if(tree[u].l != NIL) postorder(tree[u].l);
  if(tree[u].r != NIL) postorder(tree[u].r);
  cout << ' ' << u ;
}
void print(int u){

cout << "Preorder" << endl;
preorder(u);
cout << endl;

cout << "Inorder" << endl;
inorder(u);
cout << endl;

cout << "Postorder" << endl;
postorder(u);
cout << endl;
}

int main(){

  int n,u,c1,c2;
  cin >> n;
  for(int i = 0;i < n;i++) tree[i].p = tree[i].r = tree[i].l = -1;
  for(int i = 0;i < n;i++){
    cin >> u ;
    cin >> tree[u].l >> tree[u].r;
    c1 = tree[u].l;
    c2 = tree[u].r;
    if( c1 != NIL ) tree[c1].p = u;
    if( c2 != NIL ) tree[c2].p = u;
  }
  int root;
  for(int i = 0;i < n;i++) if(tree[i].p == NIL) root = i;
 print(root);

}

Measured memory_bytes: 3092
using System;

public class Program
{
    static string s;

    static string output;

    static string[] tap = { "LUD", "RUD" };

    public static void Main(string[] args)
    {
        Input();
        Proc();
        Output();
    }

    static void Input()
    {
        string[] input = null;

        // スペース区切りの整数の入力
        input = Console.ReadLine().Split(' ');
        s = input[0];
    }

    static void Proc()
    {
        output = "Yes";

        for (long idx = 0; idx < s.Length; idx++)
        {
            string currentInput = s.Substring((int)idx, 1);
            string currentTap = tap[(idx + 1) % 2];

            if (currentTap.Contains(currentInput) == false)
            {
                output = "No";
                return;
            }
        }
    }

    static void Output()
    {
        //出力
        Console.WriteLine(output);
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

int main() {
    int N; cin >> N;
    set<int> D;
    rep(i,N) {
        int x; cin >> x;
        D.insert(x);
    }
    cout << D.size() << '\n';
    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#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 forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=100005;
int id[maxn],n,a[maxn],b[maxn],c[maxn],d[maxn],fa[maxn],finish;
pin Queue[maxn];
typedef set<int>::iterator It;
set<int> e[maxn];
set<pin> F;
inline void calc(int x,int y){
	Queue[++finish]=mk(x,y);
}
inline int find(int n){
	int step=n,x;
	while(fa[step]!=step)step=fa[step];
	while(n!=step)x=fa[n],fa[n]=step,n=x;return n;
}
int main(){
    read(n);
    rep(i,1,n)fa[i]=i;
    rep(i,1,n-1)read(a[i]),read(b[i]);
    rep(i,1,n-1)read(c[i]),read(d[i]);
    rep(i,1,n-1)e[c[i]].insert(d[i]),e[d[i]].insert(c[i]);
    rep(i,1,n-1){
    	if(e[a[i]].count(b[i])){
    		calc(a[i],b[i]);
    		e[a[i]].erase(b[i]);
    		e[b[i]].erase(a[i]);
    	}
    	else{
    		e[a[i]].insert(b[i]);
    		e[b[i]].insert(a[i]);
    	}
    }
    rep(i,1,n-1){
    	//cerr<<i<<endl;
    	if(finish<i){
    		puts("NO");
    		return 0;
    	}
    	int x=Queue[i].w1,y=Queue[i].w2;
    	x=find(x);y=find(y);
    	// if(e[x].count(y)==1){
    		// fprintf(stderr,"%d %d\n",x,y);
    		// cerr<<i<<endl;
    		// assert(0);
    	// }
    	if(e[x].size()<e[y].size())swap(x,y);
    	fa[y]=x;
    	for(It it=e[y].begin();it!=e[y].end();it++){
    		//assert(*it>=1&&*it<=n);
    		// assert(*it!=y);
    //		fprintf(stderr, "%d\n",*it );
    		if(e[x].count(*it)){
    			e[*it].erase(x);
    			e[*it].erase(y);
    			e[x].erase(*it);
    			calc(x,*it);
    		}else{
    			e[x].insert(*it);
    			e[*it].erase(y);
    			e[*it].insert(x);
    		}
    	}
    	e[y].clear();
    }
    puts("YES");
    return 0;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int a, b, c;

int main() {
	cin >> a >> b >> c;
	
	bool flag = false;
	if(a + b == c) { flag = true; }
	if(b + c == a) { flag = true; }
	if(c + a == b) { flag = true; }
	
	cout << (flag ? "Yes" : "No") << endl;
	
	return 0;
}


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

int main() {
    int h, w; cin >> h >> w;
    vector<string> c(h);
    rep(i, h)
        cin >> c.at(i);

    rep(i, h) {
        rep(j, 2)
            cout << c.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Numerics;

public class Program
{
    public static void Main(string[] args)
    {
        //string[] line = Console.ReadLine().Split(' ');
        //Divisor(2141231);

        int n = int.Parse(Console.ReadLine());

        e = new int[n + 1];

        for (int i = 2; i <= n; i++)
        {
            int cur = i;
            for (int j = 2; j <= i; j++)
            {
                while(cur % j == 0)
                {
                    e[j]++;
                    cur = cur / j;
                }
            }
        }

        int r = num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) / 2;
        Console.WriteLine(r);
        Console.ReadLine();
    }

    static int[] e;
    public static int num(int m)
    {
        return e.Where(i => i >= m - 1).Count();
    }
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int selectionsort(vi &a, int n) {
    int cnt = 0;
    rep(i, n) {
        int minj = i;
        for (int j = i; j < n; ++j) {
            if (a[j] < a[minj]) minj = j;
        }
        if (minj != i) {
            cnt++;
            swap(a[i], a[minj]);
        }
    }
    return cnt;
}

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

    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    int ans = selectionsort(a, n);
    rep(i, n) cout << a[i] << (i == n-1 ? '\n' : ' ');
    cout << ans << endl;
}



Measured memory_bytes: 3136
function Main(input){
    input = input.split("\n");
  var n = Math.pow(3,input[0]);
  var sum = 1;
  var arr = input[1].split(" ").map(Number);
  arr.forEach(function(val){if(val%2==0)sum *= 2});
  console.log(n-sum);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
#!/usr/bin/python
# coding: UTF-8

n,m = map(int,input().split())

s = []
for i in range(m):
    s += [tuple(map(int,input().split())),]

p = list(map(int,input().split()))

ret = 0
all = [(str(bin(i)))[2:].zfill(n) for i in range(2 ** n)]
all = [[int(i) for i in case] for case in all]
for case in all:
    flag = 0
    for num,i in enumerate(s):
        if flag == 1:
            continue

        sw = [0 for z in range(n)]
        for k in i[1:]:
            sw[k-1] = 1

        if (sum(i*j for i,j in zip(sw,case)) % 2) != p[num]:
            flag = 1
           
    if flag == 0:
        ret += 1

print(ret)

Measured memory_bytes: 3316
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,k;
    cin>>n>>k;
    vi a(n+1);
REP(i,1,n)cin>>a[i];
rep(i,n)a[i+1]+=a[i];
vi b;
rep(i,n)REP(j,i+1,n)b.emplace_back(a[j]-a[i]);
int ans=0;
rev(i,42){
int c=0;
int t=ans|(1ll<<i);
for(x:b)c+=(t&x)==t;
if(c>=k)ans|=(1ll<<i);
}
cout<<ans<<endl;
}


Measured memory_bytes: 6512
#include <iostream>

using namespace std;

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

	for (int a = 0; a <= 9 ; a++) {
		for (int b = 0; b <= 9 ; b++) {
			if (a * b == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}

	}
	cout << "No" << endl;


}

Measured memory_bytes: 256
import sys
from collections import Counter

H, W = map(int, sys.stdin.readline().split())

string = ""
for _ in range(H):
    string += sys.stdin.readline().strip()

counter = Counter(string)
e_one = 0
e_two = 0
e_four = 0
for key, count in counter.items():
    tmp = count // 4
    e_four += tmp
    count -= 4 * tmp
    tmp = count // 2
    e_two += tmp
    count -= 2 * tmp
    e_one += count

one = 0
two = 0
four = 0
if H % 2 == 0 and W % 2 == 0:
    four = H * W // 4
# 奇数の場合、中心の文字は1つしかなくても回文になる
elif H % 2 == 1 and W % 2 == 1:
    one = 1
    two = H // 2 + W // 2
    four = (H * W - (one + two * 2)) // 4
else:
    # 縦を奇数とする
    if W % 2 == 1:
        H, W = W, H

    two = W // 2
    four = (H * W - two * 2) // 4
# four = (H//2) * (W//2)
# two = (H%2) * (W//2) + (H//2) * (W%2)
# one = (H%2) * (W%2)

# print("exists", e_four, e_two, e_one)
# print("needs", four, two, one)

if four > e_four:
    print("No")
else:
    e_four -= four
    e_two += e_four * 2
    if two > e_two:
        print("No")
    else:
        e_two -= two
        e_one += e_two * 2
        if e_one == one:
            print("Yes")
        else:
            print("No")

Measured memory_bytes: 9428
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

i64 N;
vector<int> V;
vector<int> W;
i64 Q;

int main() {
  cin >> N;
  V.resize(N + 1);
  W.resize(N + 1);
  rep(i,0,N) {
    cin >> V[i + 1] >> W[i + 1];
  }
  i64 L = 1e5 + 1;
  vector<vector<int>> dp((1 << 9) + 1, vector<int>(L, 0));
  for(int i = 1; i < dp.size() && i <= N; i++) {
    vector<int>& next = dp[i];
    next = dp[i >> 1];
    rep(k,W[i],L) {
      next[k] = std::max(next[k], dp[i >> 1][k - W[i]] + V[i]);
      next[k] = std::max(next[k], next[k - 1]);
    }
  }
  
  cin >> Q;
  rep(i,0,Q) {
    i64 v, L;
    cin >> v >> L;
    vector<int> vs;
    while(v >= dp.size()) {
      vs.push_back(v);
      v >>= 1;
    }
    int ans = dp[v][L];
    for(int s = 0;s < (1 << vs.size()); s++) {
      int val = 0;
      int wei = 0;
      rep(j,0,vs.size()) {
        if(s & (1 << j)) {
          val += V[vs[j]];
          wei += W[vs[j]];
        }
      }
      if(L - wei >= 0) {
        ans = std::max(ans, val + dp[v][L - wei]);
      }
    }
    cout << ans << "\n";
  }
}



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

int main()
{
    int N, K;
    cin >> N >> K;

    vector<long long> H(N);
    for (long long &h : H)
    {
        cin >> h;
    }
    sort(H.rbegin(), H.rend());

    long long ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (i < K)
        {
        }
        else
        {
            ans += H[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
function main(input) {
  var rows = input.split('\n');
  var sideCount = ~~rows[0];
  var sides = rows[1].trim().split(" ").map(Number);
  var maxLength = Math.max(...sides);
  var othersLengthSum = sides.reduce((prev, cur) => prev + cur, 0);
  if ( 2 * maxLength < othersLengthSum ) {
  	console.log('Yes')
  }else {
  	console.log('No')
  }
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include <stdio.h>

int main(int argc, char const *argv[]) {

    int a,b;
    char op;

    while(1){
        scanf("%d %c %d",&a,&op,&b);

        if(op == '+'){
            printf("%d\n",a + b);
        }else if(op == '-'){
            printf("%d\n",a - b);
        }else if(op == '/'){
            printf("%d\n",a / b);
        }else if(op == '*'){
            printf("%d\n",a * b );
        }else if(op == '?'){
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 2036
n, a, b = list(map(int, input().split()))
s = input()

cnt = 0
oversea = 0

for each in s:
    if each == 'a' and cnt < a + b:
        print('Yes')
        cnt += 1
        continue
    if each == 'b' and cnt < a + b and oversea < b:
        print('Yes')
        cnt += 1
        oversea += 1
        continue
    else:
        print('No')

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

using namespace std;

int main() {
	cin.sync_with_stdio(false);

	int H, W;
	cin >> H >> W;
	vector<string>C(H);
	for (int i = 0;i < H;i++) {
		cin >> C[i];
	}
	for (int i = 0;i < H;i++) {
		cout << C[i] << endl << C[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256