akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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 (a > b) { a = b; return 1; } return 0; }

const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 998244353;

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


bool solve(ll a, ll b, ll c, ll d) {
	if (b > a || b > d)return false;
	if (b <= c)return true;
	ll g = gcd(b, d);

	ll e = (b - a % g + g - 1) / g * g;

	e += a % g;
	e -= g;
	if (e > c)return false;
	return true;

}


int main() {

	int t;
	cin >> t;
	REP(qi,t) {
		ll a, b, c, d;
		cin >> a >> b >> c >> d;
		cerr << "========";
		if (solve(a, b, c, d))cout << "Yes" << endl;
		else cout << "No" << endl;


	}


}

Measured memory_bytes: 256
#include <stdio.h>

bool ans=false;
int dn[4]={5,7,5,6};
char s[100001],d[4][10]={"dream","dreamer","erase","eraser"};

void h(int x);

int main(void){
  scanf("%s",s);
  h(0);
  printf("%s\n",(ans)? "YES":"NO");
  return 0;
}

void h(int x){
  int i,j;
  if (ans) return;
  if (!s[x]){
    ans=true;
    return;
  }
  for (i=0;i<4;i++){
    for (j=0;j<dn[i];j++){
      if (s[x+j]!=d[i][j]) break;
    }
    if (j==dn[i]) h(x+j);
  }
  return;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
char a,b,c,d;
cin>>a>>b>>c>>d;
if(a==b&&b==c&&c==d){
    cout<<"Yes";
}
else if(a!=b&&b==c&&c==d){
    cout<<"Yes";
}
else if (a==b&&b==c&&c!=d){
    cout<<"Yes";
}
else cout <<"No";
return 0;
}


Measured memory_bytes: 256
hist = {}
max = ""

while line = gets do
  words = line.chomp.split(" ")
  words.each do |w|
    if hist.include? w
      hist[w] += 1
    else
      hist[w] = 1
    end

    max = w if max.length < w.length
  end
end
hist = hist.sort{|(k1 ,v1), (k2, v2)| v2 <=> v1}
puts "#{hist.to_a[0][0]} #{max}"

Measured memory_bytes: 8560
#include<iostream>
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
using namespace std;
int main()
{
    fastio;
    long long n,a,b,i;
    cin>>n>>a>>b;
    if(a>b)
    {
        cout<<0;
    }
    else if(n==1 && a!=b)
    {
        cout<<0;
    }
    else
    {
        n--;
        cout<<(a+(n*b))-(b+(n*a))+1;
    }
    return 0;
}

Measured memory_bytes: 3532
/**
 * File    : B.cpp
 * Author  : Kazune Takahashi
 * Created : 11/11/2018, 12:25:14 PM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int ans = 0;
  for (auto i = 0; i <= A; i++)
  {
    for (auto j = 0; j <= B; j++)
    {
      int R = X - 500 * i - 100 * j;
      if (R >= 0 && R % 50 == 0 && R / 50 <= C)
      {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100010
#define NIL -1

typedef struct{int parent, left, right; }Node;

Node T[MAX];
int depth[MAX];

void Print(int x){
	int i,c;
	printf("node %d: parent = %d, depth = %d, ",x,T[x].parent,depth[x]);
	if(T[x].parent == NIL)printf("root, ");
	else if(T[x].left == NIL)printf("leaf, ");
	else printf("internal node, ");

	printf("[");
	for(i=0,c=T[x].left;	c!=NIL;		i++,c=T[c].right){
		if(i)printf(", ");
		printf("%d",c);
	}
	printf("]\n");
}

void getDepth(int x, int d){
	depth[x]=d;
	if(T[x].right != NIL)getDepth(T[x].right, d);
	if(T[x].left != NIL)getDepth(T[x].left, d+1);
}

int main(){
	int i,j,n,id,k,c,l,r;	scanf("%d",&n);
	for(i=0;i<n;i++)T[i].parent=T[i].left=T[i].right=NIL;

	for(i=0;i<n;i++){
		scanf("%d%d",&id,&k);
		for(j=0;j<k;j++){
			scanf("%d",&c);
			if(j==0)T[id].left=c;
			else T[l].right=c;
			l=c;

			T[c].parent = id;
		}
	}

	for(i=0;i<n;i++){
		if(T[i].parent == NIL){
			getDepth(i,0);
			break;
		}
	}

	for(i=0;i<n;i++)Print(i);


	return 0;
}



Measured memory_bytes: 6416
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<utility>
using namespace std;struct road{int a,b,l;road(int a_,int b_,int l_):a(a_),b(b_),l(l_){}};typedef pair<int,int> pii;int main(){int n,m,k,a,b,l,s;vector<road>rd;vector<pii>town[3001];int len[3001];priority_queue<pii,vector<pii>,greater<pii> >qu;for(cin>>n>>m>>k;m--;rd.push_back(road(a,b,l))){cin>>a>>b>>l;town[a].push_back(make_pair(b,l));town[b].push_back(make_pair(a,l));}for(;k--;qu.push(make_pair(0,s)))cin>>s;for(fill(len,len+n+1,-1);!qu.empty();){pii pi=qu.top();qu.pop();if(len[pi.second]==-1){len[pi.second]=pi.first;for(vector<pii>::iterator it=town[pi.second].begin();it!=town[pi.second].end();++it)qu.push(make_pair(pi.first+it->second,it->first));}}s=0;for(vector<road>::iterator it=rd.begin();it!=rd.end();++it){s=max(max(s,len[a]),max(len[b],(len[it->b]+it->l-len[it->a]+1)/2+len[it->a]));}cout<<s<<endl;}

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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MAX_V 100000

#define MOD 1000000007L
#define INF 100000000000

signed main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(a * b, c*  d) << endl;

}


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

using namespace std;

struct Node {
    int x, y;
    Node() {}
    Node(int _x, int _y) : x(_x), y(_y) {}
};

void solve() {
    int n, k;
    cin >> n >> k;
    vector<Node> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].x >> a[i].y;
        a[i].x = k - a[i].x;
    }
    sort(a.begin(), a.end(), [&](auto& u, auto& v){
        return u.x > v.x;
    });
    int res = 0;
    int j = 0;
    priority_queue<int> pq;
    for (int i = k-1; i >= 0; i--) {
        while (j < n && a[j].x >= i) {
            pq.push(a[j++].y);
        }
        if (!pq.empty()) {
            res += pq.top();
            pq.pop();
        }
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 1660
#ABC058C
N=int(input())
d={}
for n in range(N):
	S=input()
	for a in [chr(ord('a') + i) for i in range(26)]:
		d[a]=min(d.get(a,100),S.count(a))
for a in [chr(ord('a') + i) for i in range(26)]:
	print(a*d[a],end='')
print()

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(){
  int S[100000],T[100000],n,q,key,low=0,upper=0,mid,flag;
  int i=0,cnt = 0;

  
  cin >>n;
  for(int i=0; i< n; i++){
    cin >>S[i];
  }
  cin >>q;
  for(int i=0; i< q; i++){
    cin >>T[i];
  }




  for( i=0;i<q;i++){
      ///------------------------------
    key = T[i];
    low = 0;
    upper=0;
    mid = 0;
    upper=n;//n-1
    
    mid=(low+upper)/2;
  while(low<upper){
    //mid=(low+upper)/2;

    if(S[mid]==key){

      flag=1;
      cnt++;
      break;
    }
    
    if(S[mid]<key){
      low=mid+1;
    }
    else {
      upper=mid;//mid-1
    }
    mid=(low+upper)/2;//

  }
    if(flag!=1){
      //no 
    }

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



  
  
  }

  cout << cnt<<endl;
  
  return 0;
}



Measured memory_bytes: 3608
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = Long.parseLong(sc.next());
		long B = Long.parseLong(sc.next());
		long ans;
		if(A==0){
			ans = func(B);
		}else{
			ans = func(A-1)^func(B);
		}
		System.out.println(ans);
		sc.close();
	}
	public static long func(long n){
		if(n%4 == 0)return n;
		if(n%4 == 1)return n^(n-1);
		if(n%4 == 2)return n^1;
		if(n%4 == 3)return n^(n-1)^1;
		System.out.println("NG");
		return 0;
	}

}


Measured memory_bytes: 24916
#include<stdio.h>
#include<string.h>

char s[100],p[100];
char S[200];

main(){

scanf("%s",s);
scanf("%s",p);

strcpy(S,s);
strcat(S,s);

if(strstr(S,p)!=NULL){
    printf("Yes\n");
    }
     
    else{
    printf("No\n");
    }
return 0;
}

Measured memory_bytes: 540
using System;
using System.Collections.Generic;
using System.Linq;

namespace kakomon
{
    class Program
    {
        static void Main(string[] args)
        {
            agc015_a();
        }

        static void agc015_a()
        {
            // A - A+...+B Problem
            long[] input = Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
            long n = input[0];
            long a = input[1];
            long b = input[2];
            long ans;
            // 成り立たない
            if (a > b) ans = 0;
            // 成り立たない
            else if (n == 1 && a != b) ans = 0;
            // ぜんぶ同じ
            else if (n == 1 && a == b) ans = 1;
            // 一般
            else ans = (b - a) * (n - 2) + 1;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
#include <stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
  int p,l,r;
};
struct Node T[MAX];
int n;

void preParse(int u)
{
  if(u==NIL)return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u)
{
  if(u==NIL)
  {
    return;
  }
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u)
{
  if(u==NIL)
  {
    return;
  }
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main()
{
  int i,v,l,r,root;

  scanf("%d", &n);
  for(i=0;i<n;i++)
  {
    T[i].p=NIL;
  }
  for(i=0;i<n;i++)
  {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=NIL)
    {
      T[l].p=v;
    }
    if(r!=NIL)
    {
      T[r].p=v;
    }
  }
  for(i=0;i<n;i++)
  {
    if(T[i].p == NIL)
    {
      root = i;
    }
  }
  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}



Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
#define fi first
#define se second 
#define pb push_back
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,d,a;
	cin>>n>>d>>a; 
	vector<pair<ll,ll> >v;
	for(int i=0;i<n;i++){
		ll x,h;
		cin>>x>>h;
		v.pb({x,(h+a-1)/a});
	}
	sort(v.begin(),v.end());
	queue<pair<ll,ll> > q;
	ll ans = 0;
	ll cur = 0;
	for(int i=0;i<n;i++){
		while(!q.empty()){
			if(q.front().fi>v[i].fi)break;
			cur-=q.front().se;
			q.pop();
		}
		
		ll trt = max(0ll,v[i].se-cur);
		cur+=trt;
		if(trt)q.push({v[i].fi+d+d+1,trt});
		ans += trt;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

using point = complex<double>;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    point p1(x1, y1);
    point p2(x2, y2);
    point p3 = p2 + (p2 - p1) * polar<double>(1.0, acos(0.0));
    point p4 = p3 + (p3 - p2) * polar<double>(1.0, acos(0.0));
    int x3 = round(p3.real());
    int y3 = round(p3.imag());
    int x4 = round(p4.real());
    int y4 = round(p4.imag());
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}


Measured memory_bytes: 512
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <bitset>
#include <array>
#include <set>
#include <string>

#include <iterator>
#include <algorithm>
#include <numeric>

#include <ios>
#include <sstream>
#include <iostream>
#include <fstream>


#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define range(i,m,n) for(int i=m, i<n;i++)
#define each(i,n) for(auto i:n)
#define all(i) i.begin(),i.end()

#define makevv(i,j,k,l,m) vector<vector<i>> j(k,vector<i>(l,m))

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


template <typename T>
std::string printItr(T b, T e, std::string delim=" ")
{
    std::stringstream ss;
    std::ostream_iterator<decltype(*b)> out_it(ss, delim.c_str());
    std::copy(b,e - 1, out_it);
    ss<<*(e-1);
    return ss.str();
}
using namespace std;

int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b){
        cout<<c;
    }else if(a==c){
        cout<<b;
    }else cout<<a;

}

Measured memory_bytes: 764
#include <stdio.h>
#define H 3
#define W 10

void ARR(int n[H][W]){
    for(int i = 0 ; i < H ; i++){
        for(int j = 0 ; j < W ; j++){
            printf(" %d" , n[i][j]);
        }
        printf("\n");
    }
}

int main(void){
    int arr_1[H][W] = {0} ;
    int arr_2[H][W] = {0} ;
    int arr_3[H][W] = {0} ;
    int arr_4[H][W] = {0} ;
    int i , j ;
    int n , b , f , r , v ;
    
    scanf("%d" , &n);
    
    for(i = 1 ; i <= n ; i++){
        scanf("%d %d %d %d" , &b , &f , &r , &v);
        if(b == 1){
            arr_1[f - 1][r - 1] += v;
        }
        else if(b == 2){
            arr_2[f - 1][r - 1] += v;
        }
        else if(b == 3){
            arr_3[f - 1][r - 1] += v;
        }
        else if(b == 4){
            arr_4[f - 1][r - 1] += v;
        }
    }
    
    ARR(arr_1);
    
    for(i = 1 ; i <=20 ; i++){
        printf("#");
    }
    printf("\n");
    
    ARR(arr_2);
    
    for(i = 1 ; i <= 20 ; i++){
        printf("#");
    }
    printf("\n");
    
    ARR(arr_3);
    
    for(i = 1 ; i <= 20 ; i++){
        printf("#");
    }
    printf("\n");
    
    ARR(arr_4);
    
    return 0;
}


Measured memory_bytes: 2144
#include<stdio.h>

int main(){
    
    int cnt,a,b[1000];
    
    scanf("%d",&a);
    for(cnt=0;cnt<a;cnt++){
        scanf("%d",&b[cnt]);
    }
    
    for(cnt=0;cnt<a;cnt++){
        if(a-1!=cnt){
        printf("%d ",b[a-cnt-1]);
        }else{
            printf("%d",b[a-cnt-1]);
        }
    }
    printf("\n");
    return 0;
    
}


Measured memory_bytes: 2044
import java.awt.Point;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Main {	
	Scanner in = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		//		//		while(in.hasNext())
		new AOJ0076();	
	}


	class AOJ0076{
		public AOJ0076() {

			while(true){
				int n = in.nextInt();
				if(n==-1)break;
				Walker w = new Walker();
				for(int i=0;i<n-1;i++)w.doIt();
				System.out.printf("%.2f\n%.2f\n",w.x,w.y);
			}
		}

		class Walker{
			double x,y;
			double angle;
			public Walker() {
				x=1.0;
				y=0.0;
			}

			void doIt(){
				double l1 = Math.sqrt(x*x+y*y);//ベクトルの長さ
				double sx = -y/l1; //法線ベクトルx/長さ
				double sy = x/l1;  //法線ベクトルy/長さ
				x+=sx;y+=sy;
			}
		}
	}

}

Measured memory_bytes: 17208
#include <stdio.h>
int main(void)
{
  int n,x,y,h,w,i,size,sum;
  while(scanf("%d",&n),n){
    sum=0;
    for(i=0;i<n;i++){
      scanf("%d %d %d %d",&x,&y,&h,&w);
      size=x+y+h;
      if(size<=60&&w<=2)sum+=600;
      else if(size<=80&&w<=5)sum+=800;
      else if(size<=100&&w<=10)sum+=1000;
      else if(size<=120&&w<=15)sum+=1200;
      else if(size<=140&&w<=20)sum+=1400;
      else if(size<=160&&w<=25)sum+=1600;
    }
    printf("%d\n",sum);
  }
  return 0;
}
    

Measured memory_bytes: 600
n,p = map(int,input().split())
ans = 1
if n == 1:
    print(p)
else:
    cnt = 0
    while p % 2 == 0:
        p //= 2
        cnt += 1
    ans *= 2**(cnt//n)
    #print(2,cnt,p)
    for i in range(3,int(p**(1/n))+2,2):
        cnt = 0
        while p % i == 0:
            p //= i
            cnt += 1
        #print(i,cnt,p)
        ans *= i**(cnt//n)
        if p == 1:
            break
    print(ans)                

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
  int A,B;
  cin>>A>>B;
  
  int sum=0;
  for(int i=A;i<=B;i++){
    string N=std::to_string(i);
    if(N.at(0)==N.at(4)&&N.at(1)==N.at(3)) sum+=1;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ld long double
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
// const ll INF = 1LL << 30;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////

int main() {
    string s, t; cin >> s >> t;
    ll ans = 0;
    rep(i, 0, sz(s)){
        if(s[i] != t[i]) ans ++;
    }
    co(ans);

    return 0;
}



Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
int main(){int A,B,C; cin>>A>>B>>C;for(int i=0;i<=A;i++)for(int j=0;j<=B;j++)if(i*(B-j)+j*(A-i)==C){cout<<"Yes"<<endl; return 0;}cout<<"No"<<endl;}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    ll r;

    cin >> r;

    cout << (r*r) << endl;





    return 0;
}



Measured memory_bytes: 256
n = int(input())
a =  list(map(int, input().split()))
b =  list(map(int, input().split()))
cnt = 0
for i in range(n):
    if a[i] <= b[i]:
        cnt+= a[i]
        b[i] -= a[i]
        if a[i+1] <= b[i]:
            cnt += a[i+1]
            a[i+1] = 0
        else:
            cnt += b[i]
            a[i+1] -= b[i]
    else:
        cnt += b[i]

print(cnt)

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

int main() {
 long long int n,k,i,ans=1;
  cin>>n>>k;
  for(i=0;i<n;i++){
    if(i==0)
      ans=ans*k;
    else ans=ans*(k-1);
  }
  cout<<ans;
}

Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)
s = 1
e = n

m.times do
  l, r = gets.chomp.split.map(&:to_i)
  if l <= s && s <= r
    e = [e, r].min
  elsif l <= e && e <= r
    s = [s, l].max
  elsif s <= l && r <= e
    s = l
    e = r
  else
    e = s - 1
  end
end

puts e - s + 1

Measured memory_bytes: 1916
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	try {
    		final int A = sc.nextInt();
    		final int B = sc.nextInt();
    		final int C = sc.nextInt();

    		if (A == B) {
    			if (A == C) {
    				System.out.println("No");
    			} else {
    				System.out.println("Yes");
    			}
    		} else if (A == C || B == C) {
				System.out.println("Yes");
    		} else {
				System.out.println("No");
    		}

    	} finally {
    		sc.close();
    	}
    }
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define ll long long
#define MOD 998244353
#define REP(i,b,e) for(int (i)=b;(i)<e;(i)++)
const ll INF= 1LL << 60;

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


//入力
ll N;
string S;
vector<ll> A;
int main(){
  cin >> N;
  cin >> S;

  vector<ll> w;
  vector<ll> b;
  bool flag=false;//白はじまり
  w.push_back(0);
  int i=0;
  for(int j=0;j<N;j++){
    if(flag){
      if(S[j]=='.'){
        flag=false;
        w.push_back(1);
        i++;
      }else{
        b[i]++;
      }
    }else{
      if(S[j]=='#'){
        flag=true;
        b.push_back(1);
      }else{
        w[i]++;
      }
    }
  }
  if(!flag) b.push_back(0);
  
  vector<ll> sum_w(w.size()+1,0);
  vector<ll> sum_b(b.size()+1,0);
  for(int j=1;j<=i+1;j++){
    sum_w[j]=sum_w[j-1]+w[j-1];
    sum_b[j]=sum_b[j-1]+b[j-1];
  }
  
  ll ans=N;
  chmin(ans,sum_b[i]-sum_b[0]);
  chmin(ans,sum_w[i+1]-sum_w[1]);
  for(int j=1;j<i;j++){
    chmin(ans,sum_w[i+1]-sum_w[j]+sum_b[j-1]-sum_b[0]);
    //cout<<sum_w[i+1]-sum_w[j]<<endl;
    //cout<<sum_b[j-1]-sum_b[0]<<endl;
    
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3824
from sys import stdin

a, b, c = [int(x) for x in stdin.readline().strip().split()]
guki = [a%2, b%2, c%2]
cnt = 0
if guki[0]==guki[1]==guki[2]:
  # 全部同じ
  pass
else:
  cnt += 1
  # 揃える
  if guki[0] == guki[1]:
    # cだけ違う
    a += 1
    b += 1
  elif guki[0] == guki[2]:
    # bだけ違う
    a += 1
    c += 1
  else:
    # aだけ違う
    b += 1
    c += 1
    
cnt += (max([a,b,c]) - a) / 2
cnt += (max([a,b,c]) - b) / 2
cnt += (max([a,b,c]) - c) / 2

print(int(cnt))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

int saiki(int y,int x,int dir,vector<vector<char> > &field,vector<vector<vector<int> > > &table,int count){
    if(table[y][x][dir] != -1) return count+table[y][x][dir];
    if(field[y][x] == '0') return count;
    int m;
    switch(dir){
    case 0:
        m= saiki(y+1,x,dir,field,table,count+1);
        break;
    case 1:
        m= saiki(y+1,x+1,dir,field,table,count+1);
        break;
    case 2:
        m= saiki(y,x+1,dir,field,table,count+1);
        break;
    case 3:
        m= saiki(y-1,x+1,dir,field,table,count+1);
        break;
    case 4:
        m= saiki(y-1,x,dir,field,table,count+1);
        break;
    case 5:
        m= saiki(y-1,x-1,dir,field,table,count+1);
        break;
    case 6:
        m= saiki(y,x-1,dir,field,table,count+1);
        break;
    case 7:
        m= saiki(y+1,x-1,dir,field,table,count+1);
        break;
    }
    table[y][x][dir] = m;
    return m;
}

int solve(vector<vector<char> > field){
    int n = field.size();
    //[y][x][dir]
    vector<vector<vector<int> > > v(n,vector<vector<int> >(n,vector<int>(8,-1)));

    for(int i=0;i<n;i++){
        for(int j=0;j<8;j++){
            v[i][0][j] = 0;
            v[i][n-1][j] = 0;
            v[0][i][j] = 0;
            v[n-1][i][j] = 0;
        }
    }
    int ret = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<8;k++){
                ret = max(saiki(i,j,k,field,v,0),ret);
            }
        }
    }
    return ret;
}

int main(){
    int n;
    while(cin >> n && n!= 0){
        vector<vector<char> > v(n+2,vector<char>(n+2,'0'));
        for(int i=1;i<n+1;i++){
            for(int j=1;j<n+1;j++){
                char c;
                cin >> c;
                if(c=='1')v[i][j] = '1';
            }
        }
        cout << solve(v) << endl;
    }
    return 0;
}

Measured memory_bytes: 4432
# -*- coding:utf-8 -*-
if __name__ == "__main__":
    directFlag = False
    indirectFlag = False
    a, b, c, d= map(int, input().split())
    if abs(a-c) <= d:
        directFlag = True
    else:
        pass
    if abs(a-b) <= d and abs(b-c) <= d:
        indirectFlag = True
    else:
        pass
    if directFlag or indirectFlag:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
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...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const ll INF = 1e18;
// const int MOD = 1e9 + 7;

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

    ll ans = INF;
    for (ll i = 1; i < sqrt(N) + 1; i++) {
        if (N % i == 0) {
            chmin(ans, (i - 1) + (N / i - 1));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

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

    int K=N,sum=0;
    while(K>0){
        sum+=K%10;
        K/=10;
    }
    
    if(N%sum==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

string s[200005];

map<string,ll> m;

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
rep(i,0,n-1)cin>>s[i],sort(all(s[i]));

rep(i,0,n-1)m[s[i]]++;
ll ans=0;
tr(m,it)
{
	ll x=it->ss;
	ans+=(x*(x-1))/2;
}
ol(ans);


return 0;
}



Measured memory_bytes: 17408
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>
#include <iomanip>
#include <sstream>
#include <unordered_map>

using namespace std;
typedef long long ll;


ll ans, mx, mn, flag, sum, cnt;

double d;
int main(){
	ll n;
	cin>>n;
	for(ll i=0; i<n; i++){
		double a;
		cin>>a;
		d+=1.0/a;
	}
	cout<<1.0/d;
			
}


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

int ans[100010],n,rr,ll,cr,cl;
string s;

int main(){
    cin>>s;
    n=s.size();
    for(int i=0;i<n;i++){
        if(s[i]=='R'){
            rr=i;
            cr=0;
        }
        else{
            cr++;
            if(cr%2==0)ans[rr]++;
            else ans[rr+1]++;
        }
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='L'){
            ll=i;
            cl=0;
        }
        else{
            cl++;
            if(cl%2==0)ans[ll]++;
            else ans[ll-1]++;
        }
    }
    cout<<ans[0];
    for(int i=1;i<n;i++)cout<<' '<<ans[i];
    cout<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define nl "\n"
#define pb push_back
#define sp " "
typedef long long ll;
#define len(x) x.length()
#define vsort(x) sort(x.begin(), x.end();
using namespace std;
int main(){
 
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    #ifndef ONLINE_JUDGE
   // freopen("bruh.txt","r",stdin);
    #endif
     int n;
     cin >>n;
     while(n>0){
        if(n%10==7){
            cout<<"Yes"<<nl;
            return 0;
        }
        n/=10;
     }
     cout<<"No"<<nl;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < n; i++)
#define REP(n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using INT64 = long long;
using UINT64 = unsigned long long;
#define MOD 1000000007

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

    int l = s.size();

    INT64 dp1 = 0;
    INT64 dp2 = 0;

    REP(l){
        if (i == 0) {
            dp1 = 1;
            dp2 = 2;
        } else {
            if (s[i] == '1') {
                dp1 = (dp1 * 3 + dp2) % MOD;
                dp2 = dp2 * 2 % MOD;
            } else {
                dp1 = (dp1 * 3) % MOD;
            }
        }
    }

    cout << (dp1 + dp2) % MOD << endl;


    return 0;
}


Measured memory_bytes: 512
n = int(input())
AB = []
for _ in range(n):
    a, b = map(int, input().split())
    AB.append((a,b))

CD = []
for _ in range(n):
    c, d = map(int, input().split())
    CD.append((c,d))

CD = sorted(CD, key=lambda x:x[1])
count = 0

for cd in CD:
    c = cd[0]
    d = cd[1]
    max_a = -1
    max_b = -1
    for ab in AB:
        a = ab[0]
        b = ab[1]
        if b < d and a < c:
            if max_a < a:
                max_a = a
                max_b = b
    if max_a == -1:
        pass
    else:
        AB.remove((max_a, max_b))
        count += 1

print(count)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>

using namespace std;


int main()
{
	int N;
	vector<int> list;

	cin >> N;	

	int n;
	for (int ni = 0; ni < N; ni++){
		cin >> n;
		list.push_back(n);
	}

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

	int ans = 0;
	int half = N /2;
	if (list[half -1] == list[half]){
		ans = 0;
	}else{
		ans = list[half] - list[half - 1]; 
	}


	printf("%d",ans);


	return 0;
}



Measured memory_bytes: 892
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		int N = s.length();
		int K = sc.nextInt();
		int count = 0;
		int x = 0;
		if( N>=5 ){
			count = 5*N-10;
			x = 5;
		}else{
			count = N*(N+1)/2;
			x = N;
		}
		String[] sub = new String[count];
		s = s + "A";
		int a = 0;
		for( int i=x; i>0; i-- ){        
			for( int j=0; j<=N-i; j++ ){
				sub[a] = s.substring(j,j+i);
				a++;              
			}
		}     
		Arrays.sort(sub);
		int b = 0;  
		if( N>1 ){	//
		for( int i=0; i<a-1; i++ ){  
			if( !(sub[i].equals(sub[i+1])) ){
				b++;
			}      
			if( b==K ){
				System.out.println(sub[i]);             
				break;
			}
		}  
		}  		// 
		if( N>1 && b<K ){
			System.out.println(sub[a-1]);          
        }          
		if( N==1 ){
			System.out.println(sub[0]);
		} 
	}
}


Measured memory_bytes: 26004
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

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

    private static void solve(Scanner in) {
        int N = in.nextInt(), M = in.nextInt();
        int[] l = new int[N + 1], r = new int[N + 1];
        for (int i = 1; i < N + 1; i++) {
            l[i] = in.nextInt();// 1 <= l <= r <= M
            r[i] = in.nextInt();
        }

        @SuppressWarnings("unchecked")
        List<Integer>[] nByLen = new List[M + 1];
        for (int n = 1; n < N + 1; n++) {
            int len = r[n] - l[n] + 1;
            if (nByLen[len] == null) {
                nByLen[len] = new ArrayList<>();
            }
            nByLen[len].add(n);
        }

        int accum = N;

        Fenwick F = new Fenwick(M);
        for (int d = 1; d < M + 1; d++) {
            int sum = accum;
            for (int e = d; e < M + 1; e += d) {
                sum += F.accum(e);
            }
            System.out.println(sum);
            if (nByLen[d] != null) {
                accum -= nByLen[d].size();
                for (int i : nByLen[d]) {
                    F.add(l[i], 1);
                    F.add(r[i] + 1, -1);
                }
            }
        }
    }
}

class Fenwick {
    private final int[] fenwick;

    public Fenwick(int n) {
        fenwick = new int[n + 1];
    }

    public int accum(int i) {
        int sum = 0;
        for (; i > 0; i -= i & -i) {
            sum += fenwick[i];
        }
        return sum;
    }

    public int sum(int begin, int end) {
        return accum(end) - accum(begin - 1);
    }

    public void add(int i, int a) {
        for (; i < fenwick.length; i += i & -i) {
            fenwick[i] += a;
        }
    }

    @Override
    public String toString() {
        int N = fenwick.length;
        long[] raw = new long[N];
        long[] acc = new long[N];
        for (int i = 1; i < N; i++) {
            acc[i] = accum(i);
            raw[i] = acc[i] - acc[i - 1];
        }
        StringBuilder s = new StringBuilder();
        s.append("Fenwick [\n");
        s.append(" fenwick=" + Arrays.toString(fenwick) + "\n");
        s.append(" accum  =" + Arrays.toString(acc) + "\n");
        s.append(" raw    =" + Arrays.toString(raw) + "\n]");
        return s.toString();
    }
}

Measured memory_bytes: 143676
#include<bits/stdc++.h>
using namespace std;
char s[3][10]={"Sunny","Cloudy","Rainy"},s1[10];
int main(){
	scanf("%s",s1);int x;
	for(int i=0;i<3;i++)if(s1[0]==s[i][0])x=i;
	printf("%s",s[(x+1)%3]);
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int n;
  cin>>n;
  int a[n];
  rep(i,0,n) cin>>a[i];
  sort(a,a+n);
  ll s=0;
  rep(i,0,n-1){
    s+=a[i];
  }
  if(s>a[n-1]){
    cout<<"Yes\n";
  }
  else cout<<"No\n";
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3580
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int>P;
#define Z(a,b)v.push_back(make_pair(a,b))
struct C{bool operator()(P a,P b){return a.first*a.second<b.first*b.second;}};
int main(){
	int n,w,d,p,s;
	for(;scanf("%d%d%d",&n,&w,&d),w;puts("")){
		vector<P>v;
		for(Z(w,d);n--;){
			scanf("%d%d",&p,&s);p--;s%=v[p].first+v[p].second;
			int x=v[p].first,y=v[p].second,S=0,_x=0,_y=0,x1,x2,y1,y2;
			for(;s--;)if(S==0){_x++;if(_x==x)S=1;}else _y++;
			if(S==0)x1=_x,x2=x-_x,y1=y2=y;
			else x1=x2=x,y1=_y,y2=y-_y;
			v.erase(v.begin()+p);
			if(x1*y1>x2*y2)Z(x2,y2),Z(x1,y1);
			else Z(x1,y1),Z(x2,y2);
		}
		for(sort(v.begin(),v.end(),C());v.size();){
			printf("%d",v[0].first*v[0].second);v.erase(v.begin());if(v.size())printf(" ");
		}
	}
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
int main() 
{
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(a*b > c*d)
  {
    printf("%d",a*b);
  }
  else
  {
    printf("%d",c*d);
  }
	return 0;
}

Measured memory_bytes: 128
n, m = map(int, input().split())
s = []
for i in range(m):
    si = list(map(int, input().split()))
    s.append(si)
p = list(map(int, input().split()))

ans = 0
for i in range(2 ** n):
    x = format(i, '0' + str(n) +'b')
    for j in range(m):
        q = 0
        for idx in s[j][1:]:
            if x[idx - 1] == '1':
                q += 1
        if q % 2 != p[j]:
            ans -= 1
            break
    ans += 1
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
main(){
int i,j,k,l,n,m;
while(cin>>n){
int x[n-1];
for(i=0;i<n-1;i++)cin>>x[i];
j=x[0];
for(i=0;i<n-2;i++){
 if(x[i]<x[i+1]) j+=x[i];
 else j+=x[i+1];
}
j+=x[n-2];
if(n==2)j=x[0]*2;
cout<<j<<endl;
} return 0;
}


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

namespace ARC102C
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            long[] ints = ConsoleInput.LongArray();
            long N = ints[0];
            long K = ints[1];

            long zero = N / K;
            long half = 0;
            if (K % 2 == 0)
            {
                half = (N + K / 2) / K;
            }

            long ans = zero * zero * zero + half * half * half;
            Console.WriteLine(ans);
        }
    }
    
    internal static class ConsoleInput
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

Measured memory_bytes: 13396
N=int(input())
A=list(map(int,input().split()))
S=sum(A)
ans=0
for i in A:
    S-=i
    ans+=i*S
print(ans%(10**9+7))

    

                
            





    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














Measured memory_bytes: 31592
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R

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

	cin >> N >> K;
	vector<int>v(N);
	vector<int>box;
	while (K) {
		box.push_back(K);
		K >>= 1;
	}
	box.push_back(0);
	M = box.size();
	vector<vector<int>>l(M, vector<int>(N));
	vector<vector<int>>r(M, vector<int>(N));
	for (auto &i : v)cin >> i;
	for (int i = 0; i < M; i++) {
		int nx = 0;
		for (int j = 1; j < N; j++) {
			if (v[j] - v[j - 1] > box[i]) {
				for (int k = nx; k < j; k++) {
					r[i][k] = j - 1;
				}
				nx = j;
			}
		}
		for (int j = nx; j < N; j++)r[i][j] = N - 1;
		nx = N - 1;
		for (int j = N - 1; j >= 0; j--) {
			if (v[j + 1] - v[j] > box[i]) {
				for (int k = nx; k > j; k--) {
					l[i][k] = j + 1;
				}
				nx = j;
			}
		}
		for (int j = nx; j >= 0; j--)l[i][j] = 0;
	}
	vector<int>ldp(1 << M, MOD);
	vector<int>rdp(1 << M, -MOD);
	ldp[0] = N;
	rdp[0] = -1;
	for (int i = 0; i < 1 << M; i++) {
		for (int j = 0; j < M; j++) {
			if ((i >> j) & 1)continue;
			if (rdp[i] == N - 1) {
				rdp[i + (1 << j)] = N - 1;
				continue;
			}
			rdp[i + (1 << j)] = max(rdp[i + (1 << j)], r[j][rdp[i] + 1]);
		}
		for (int j = 0; j < M; j++) {
			if ((i >> j) & 1)continue;
			if (ldp[i] == 0) {
				ldp[i + (1 << j)] = 0;
				continue;
			}
			ldp[i + (1 << j)] = min(ldp[i + (1 << j)], l[j][ldp[i] - 1]);
		}
	}
	for (int i = 0; i < 1 << M; i++) {
	//	cout << i << " " << rdp[i] << " " << ldp[i] << endl;
	}
	vector<int>ans(N);
	for (int i = 0; i < N; i++) {
		int bag = r[0][i];
		int ch = 0;
	//	cout << i << " " << bag << endl;
		for (int j = 0; j < (1 << M) - 1; j+=2) {
		//	cout << j << " " << rdp[j] << " " << ldp[j] << endl;
			if (rdp[j] >= i - 1 && ldp[(1 << M) - 2 - j] <= bag + 1) {
				ch = 1;
			}
		}
		for (int j = i; j <= bag; j++)ans[j] = ch;
		i = r[0][i];
	}
	for (auto i : ans) {
		if (i)cout << "Possible\n";
		else cout << "Impossible\n";
	}
	return 0;
}

Measured memory_bytes: 37872
class in{struct It{int it;const bool rev;explicit constexpr It(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(It& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const It i,n;public:explicit constexpr in(int n):i(0),n(n<0?0:n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const It& begin(){return i;}const It& end(){return n;}};

#include <bits/stdc++.h>
using namespace std;

/* requirement
   Val : Val(), copy / move constructor
   Upd, Map : Val operator() (Val, Val)
*/
template<class Val, class Upd, class Map>
struct SegTreeLazy {
    int n;
    vector<Val> data, lazy;
    vector<bool> isLazy;
    Upd upd;
    Map mp;
    const Val Lim; // identity mapping
    explicit SegTreeLazy(int n_, const Val& lim = Val())
        : upd(Upd()), mp(Map()), Lim(lim) { init(n_);}
    void init(int n_) { // 0 init
        for(n = 1; n < n_; n <<= 1);
        data.assign(2 * n - 1, Lim);
        lazy.assign(2 * n - 1, Val());
        isLazy.assign(2 * n - 1, false);
    }
    // lazy propagation
    inline void setLazy(int cn, int mul, Val x) {
        isLazy[cn] = true;
        lazy[cn] = upd(lazy[cn], x);
        data[cn] = upd(data[cn], x * mul);
    }
    inline void push(int cn, int cl, int cr) {
        if(isLazy[cn] == false) return;
        int mid = (cl + cr) / 2;
        setLazy(cn * 2 + 1, mid - cl, lazy[cn]);
        setLazy(cn * 2 + 2, cr - mid, lazy[cn]);
        lazy[cn] = Val();
        isLazy[cn] = false;
    }
    // operation : upd [ql, qr) by x
    // current node : cn [cl, cr)
    void updrange(int ql, int qr, const Val& x) {
        updrange(ql, qr, x, 0, 0, n);
        return;
    }
    void updrange(int ql, int qr, const Val& x, int cn, int cl, int cr) {
        if(qr <= cl || cr <= ql) return;
        if(ql <= cl && cr <= qr) {
            setLazy(cn, cr - cl, x);
            return;
        }
        push(cn, cl, cr);
        updrange(ql, qr, x, cn * 2 + 1, cl, (cl + cr) / 2);
        updrange(ql, qr, x, cn * 2 + 2, (cl + cr) / 2, cr);
        data[cn] = mp(data[cn * 2 + 1], data[cn * 2 + 2]);
    }
    Val query(int ql, int qr) {
        return query(ql, qr, 0, 0, n);
    }
    Val query(int ql, int qr, int cn, int cl, int cr) {
        if(qr <= cl || cr <= ql) return Lim;
        if(ql <= cl && cr <= qr) return data[cn];
        push(cn, cl, cr);
        Val a = query(ql, qr, cn * 2 + 1, cl, (cl + cr) / 2);
        Val b = query(ql, qr, cn * 2 + 2, (cl + cr) / 2, cr);
        return mp(a, b);
    }
};

template<class T> // requirement : operator +
struct adder {
    T operator ()(const T& a, const T& b) { return a + b;}
};

using i64 = long long;
using SegTree = SegTreeLazy<i64, adder<i64>, adder<i64>>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    SegTree seg(n);
    for(int _ : in(q)) {
        int p, u, v;
        cin >> p >> u >> v;
        --u;
        if(p) {
            cout << seg.query(u, v) << '\n';
        }
        else {
            i64 x;
            cin >> x;
            seg.updrange(u, v, x);
        }
    }
    return 0;
}

Measured memory_bytes: 7212