akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
               
#define pb push_back
#define PII pair<int,int>
               
#define VS vector<string>
#define VI vector<int>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {
    int n = 0; 
    cin >> n;  
    if(n%10 == 9 || n/10 == 9) cout << "Yes" << endl;
    else cout << "No" << endl;
}  

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

using namespace std;

#define endl '\n'


typedef long long ll;
typedef complex<ll> point;

ll cross(point a, point b) { return imag(conj(a) * b); }

ll dot(point a, point b) { return real(conj(a) * b); }

ll area2(point a, point b, point c) { return cross(b - a, c - a); }

namespace std
{
	bool operator<(const point &a, const point &b)
	{
		return real(a) < real(b) || (real(a) == real(b) && imag(a) < imag(b));
	}
}

const ll oo = 0x3f3f3f3f3f3f3f3f;

struct hull : vector<point>
{
	void add_point(point p)
	{
		for (int s = size(); s > 1; --s)
			if (area2(at(s - 2), at(s - 1), p) < 0) break;
			else pop_back();
		push_back(p);
	}

	ll max_dot(point p)
	{
		int lo = 0, hi = (int) size() - 1, mid;

		while (lo < hi)
		{
			mid = (lo + hi) / 2;

			if (dot(at(mid), p) <= dot(at(mid + 1), p))
				lo = mid + 1;
			else hi = mid;
		}

		return dot(at(lo), p);
	}
};

ll sqr(ll x){
	return x * x;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	hull UH, LH;
	
	int n;
	cin >> n;
	ll c;
	cin >> c;
	
	vector<ll> dp(n + 1, oo), h(n + 1);
	
	for(int i = 1; i <= n; i++)
		cin >> h[i];
	
	dp[n] = 0;
	
	UH.add_point(point(dp[n] + sqr(h[n]), -2LL * h[n]));
	LH.add_point(point(-dp[n] - sqr(h[n]), 2LL * h[n]));
	
	for(int i = n - 1; i >= 1; i--){
		
		dp[i] = -UH.max_dot(point(-1LL, -h[i]));
		dp[i] = min(dp[i], -LH.max_dot(point(1LL, h[i])));
		dp[i] += sqr(h[i]) + c;
		
		
		UH.add_point(point(dp[i] + sqr(h[i]), -2LL * h[i]));
		LH.add_point(point(-dp[i] - sqr(h[i]), 2LL * h[i]));
	}
	
	cout << dp[1] << endl;

	return 0;
}

Measured memory_bytes: 13792
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main () {
    int n;
    scanf("%d", &n);
    
    int sum = 0;
    int i;
    for (i = 1; sum < n; i++) {
        sum += i;
    }
    printf("%d", i - 1);
}






Measured memory_bytes: 128
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int h1=0,h2=0,h3=0,h4=0,h5=0,h6=0;
		for(int i=0;i<n;i++){
			double h=sc.nextDouble();
			if(h<165.0)h1++;
			else if(165.0<=h&&h<170.0)h2++;
			else if(170.0<=h&&h<175.0)h3++;
			else if(175.0<=h&&h<180.0)h4++;
			else if(180.0<=h&&h<185.0)h5++;
			else h6++;
		}
		System.out.print("1:");
		for(int j=1;j<=h1;j++){
			System.out.print("*");
		}
		System.out.println();
		System.out.print("2:");
		for(int j=1;j<=h2;j++){
			System.out.print("*");
		}
		System.out.println();
		System.out.print("3:");
		for(int j=1;j<=h3;j++){
			System.out.print("*");
		}
		System.out.println();
		System.out.print("4:");
		for(int j=1;j<=h4;j++){
			System.out.print("*");
		}
		System.out.println();
		System.out.print("5:");
		for(int j=1;j<=h5;j++){
			System.out.print("*");
		}
		System.out.println();
		System.out.print("6:");
		for(int j=1;j<=h6;j++){
			System.out.print("*");
		}	
		System.out.println();
	}
}

Measured memory_bytes: 20248
#include<stdio.h>
int main(){
  int N,a,b,i;
  scanf("%ld",&N);
  for(i=1;i<=9;++i){
  a=N%i;
    if(a==0){
      b=N/i;
if(b<=9){
        printf("Yes\n");
        break;
      }
  }
  }
if(b>9){
printf("No\n");
}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  vector<int>DP(N);
  DP[0]=0;
  DP[1]=abs(A[1]-A[0]);
  for(int i=2;i<N;i++){
    DP[i]=min(DP[i-2]+abs(A[i]-A[i-2]),DP[i-1]+abs(A[i]-A[i-1]));
  }
  cout<<DP[N-1]<<endl;
}

Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int n;
    cin>>n;
    for(int i=1;i<=9;i++)
    {
        for(int j=1;j<=9;j++)
        {
            if(i*j==n)
            {
                cout<<"Yes"<<NL;
                return 0;
            }
        }
    }
    cout<<"No"<<NL;
    return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n,0);
    
    for (int i = 0; i < n-1; ++i) {
        int ai;
        cin >> ai;
        v[ai-1] += 1;
    }
    for (int i = 0; i < n-1; ++i) 
        cout << v[i] << endl;
    cout << 0 << endl;
    
    return 0;
}


Measured memory_bytes: 4024
S = input()
i = len(S) - 1
while i > 0:
    if S[i] == 'm':
        if i < 4 or S[i - 4:i + 1] != "dream":
            print("NO")
            exit(0)
        i -= 5

    elif S[i] == 'e':
        if i < 4 or S[i - 4:i + 1] != "erase":
            print("NO")
            exit(0)
        i -= 5

    else:
        if i >= 6 and S[i - 6:i + 1] == "dreamer":
            i -= 7
            continue
        elif i >= 5 and S[i - 5:i + 1] == "eraser":
            i -= 6
            continue
        print("NO")
        exit(0)

print("YES")

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

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if (A == B && A != C){
        cout << "Yes" << endl;
    }
    else if (B == C && A != B){
        cout << "Yes" << endl;
    }
    else if (C == A && A != B){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3644
use std::io::Read;
use std::io::*;
use std::str::FromStr;
     
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {   
    let mut s: String = read();
    let n: usize = s.trim().parse().unwrap();
    let mut cnt = vec![vec![0; 10]; 10];
    for i in 1..(n + 1) {
        let x = i % 10;
        let mut m = i;
        while m >= 10 {
            m = m / 10;
        }
        let y = m;
        cnt[y][x] += 1;
    }
    let mut ans = 0;
    for i in 0..10 {
        for j in 0..10 {
            ans += cnt[i][j] * cnt[j][i];
        }
    }
    println!("{}", ans);
}

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

int main(){
    int m,n;
    cin>>n>>m;
    vector<vector<pair<int,int>>> v(n);
    for(int i=0;i<m;i++){
        int p,y;
        cin>>p>>y;p--;y--;
        v[p].push_back(make_pair(y,i));
    }
    vector<pair<int,int>> ans(m);
    for(int i=0;i<n;i++){
        sort(v[i].begin(),v[i].end());
        for(int j=0;j<v[i].size();j++){
            ans[v[i][j].second]=make_pair(i+1,j+1);
        }
    }
    for(int i=0;i<m;i++){
      printf("%06d%06d\n",ans[i].first,ans[i].second);
    }
    return 0;
}


Measured memory_bytes: 7680
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		double a = in.nextDouble();
		double ans = 0;
		for (int i=0; i<10; i++) {
			ans += a;
			if (i%2 == 0) a *= 2;
			else a /= 3;
		}

		out.printf("%.8f\n",ans);
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(in.hasNext()) solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 28292
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int h,w;
vector<string> M;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> h >> w;
    for(int i=0;i<h;i++){
        string s; cin >> s;
        M.push_back(s);
    }
}

int solve(){

  
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(M[i][j]=='.') M[i][j]='0';
  
  int x,y;

  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(M[i][j]=='#'){
          DBG(make_pair(i,j))

        for(int k=0;k<=8;k++)
        {
          x=i+dx[k];
          y=j+dy[k];
          DBG(make_pair(x,y))
          if(0<=x&&x<h&&0<=y&&y<w)
          {
            if(M[x][y]=='#') continue;
            M[x][y]++;
            
          }
        }
      }

  for(int i=0;i<h;i++)
    cout << M[i] << endl;

  return 0;
}

int main()
{
    input();
    solve();
    return 0;
}


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

using namespace std;

int main() {
    int h, w, m;    cin >> h >> w >> m;
    vector<int> hc(h, 0), wc(w, 0);
    vector<vector<int> > p(m, vector<int>(2));
    for (int i = 0; i < m; i++) {
        cin >> p[i][0] >> p[i][1];
        p[i][0]--;  p[i][1]--;
        hc[p[i][0]]++;
        wc[p[i][1]]++;
    }

    int mh = 0, mw = 0;
    for (int i = 0; i < h; i++) 
        mh = max(mh, hc[i]);
    long long th = 0;
    for (int i = 0; i < h; i++) {
        if (mh == hc[i])
            th++;
    }
    for (int i = 0; i < w; i++)
        mw = max(mw, wc[i]);
    long long tw = 0, cnt = 0;
    for (int i = 0; i < w; i++) {
        if (mw == wc[i])
            tw++;
    }

    for (int i = 0; i < m; i++) {
        if (hc[p[i][0]] == mh && wc[p[i][1]] == mw)
            cnt++;
    }

    

    if (cnt >= th*tw)
        cout << mh + mw -1 << endl;
    else 
        cout << mh + mw << endl;
    return 0;
}

Measured memory_bytes: 21992
class Node(object):
    def __init__(self, num, prv = None, nxt = None):
        self.num = num
        self.prv = prv
        self.nxt = nxt
 
 
class DoublyLinkedList(object):
    def __init__(self):
        self.start = self.last = None
 
    def insert(self, num):
        new_elem = Node(num)
 
        if self.start is None:
            self.start = self.last = new_elem
        else:
            new_elem.nxt = self.start
            self.start.prv = new_elem
            self.start = new_elem
 
    def delete_num(self, target):
        it = self.start
        while it is not None:
            if it.num == target:
                if it.prv is None and it.nxt is None:
                    self.start = self.last = None
                else:
                    if it.prv is not None:
                        it.prv.nxt = it.nxt
                    else:
                        self.start = self.start.nxt
 
                    if it.nxt is not None:
                        it.nxt.prv = it.prv
                    else:
                        self.last = self.last.prv
                break
            it = it.nxt
 
    def delete_start(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.start.nxt.prv = None
            self.start = self.start.nxt
 
    def delete_last(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.last.prv.nxt = None
            self.last = self.last.prv
 
    def get_content(self):
        ret = []
        it = self.start
 
        while it is not None:
            ret.append(it.num)
            it = it.nxt
 
        return ' '.join(ret)
 
 
def _main():
    from sys import stdin
 
    n = int(input())
 
    lst = DoublyLinkedList()
     
    for _ in range(n):
        cmd = stdin.readline().strip().split()
        if cmd[0] == 'insert':
            lst.insert(cmd[1])
        elif cmd[0] == 'delete':
            lst.delete_num(cmd[1])
        elif cmd[0] == 'deleteFirst':
            lst.delete_start()
        elif cmd[0] == 'deleteLast':
            lst.delete_last()
 
    print(lst.get_content())
 
 
if __name__ == '__main__':
    _main()


Measured memory_bytes: 227600
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		long w =  Long.parseLong(W.split(" ")[0]);
		long h =  Long.parseLong(W.split(" ")[1]);
		long x =  Long.parseLong(W.split(" ")[2]);
		long y =  Long.parseLong(W.split(" ")[3]);

		double sq = w*h/2.0;
		System.out.print(sq+" ");

		if(w/2.0==x && h/2.0 == y){
			System.out.println("1");
		}else{
			System.out.println("0");
		}
	}
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define maxn 1006
#define ll long long
#define eps 1e-1
#define pi acos(-1.0)
using namespace std;

typedef pair<int, int> P;

int h, w;
char s[maxn][maxn];
bool used[maxn][maxn];
int dp[maxn][maxn];
int dx[4] = {0, -1, 1, 0};
int dy[4] = {-1, 0, 0, 1};

queue<P> q;

bool in(int x, int y)
{
    return (x >= 0 && x < h && y >= 0 && y < w) ? 1 : 0;
}

int main()
{
    cin >> h >> w;
    for (int i = 0; i < h; i++)
    {
        scanf("%s", s[i]);
        for (int j = 0; j < w; j++)
        {
            if (s[i][j] == '#')
            {
                q.push(P(i, j));
                used[i][j] = 1;
            }
        }
    }

    int ans = 0;

    while (!q.empty())
    {
        P p = q.front();
        q.pop();
        int x = p.first;
        int y = p.second;
        for (int i = 0; i < 4; i++)
        {
            int tx = x + dx[i];
            int ty = y + dy[i];
            if (!in(tx, ty) || used[tx][ty])
                continue;
            used[tx][ty] = 1;
            dp[tx][ty] = dp[x][y] + 1;
            ans = max(ans, dp[tx][ty]);
            q.push(P(tx, ty));
        }
    }
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 12304
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		sc.fill(a);

		int odd = 0; // 奇数
		int even = 0;
		int x4 = 0; // 4倍数
		for (int i = 0; i < N; i++) {
			if (a[i] % 4 == 0) {
				x4++;
			} else if (a[i] % 2 == 0) {
				even++;
			} else {
				odd++;
			}
		}
		debug(odd, even, x4);

		if (odd <= x4 + ((even > 0) ? 0 : 1)) {
			System.out.println("Yes");
			return;
		}

		System.out.println("No");
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;
		private StringBuilder buffer = new StringBuilder();

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			int read = skip();
			do {
				buffer.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			String text = buffer.toString();
			buffer.delete(0, buffer.length());

			return text;
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

Measured memory_bytes: 22100
from collections import defaultdict

# Combination
MOD = 10**17+3
MAX = 2*10**5
fac = [1,1] + [0]*MAX
finv = [1,1] + [0]*MAX
inv = [0,1] + [0]*MAX
for i in range(2,MAX+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def comb(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

N, A, B = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
arr = V[:A]
se = set()
mi = 10**18
dic2 = defaultdict(int)
tot = 0
for a in arr:
    tot += a
    dic2[a] += 1
    se.add(a)
    if a < mi:
        mi = a
dic = defaultdict(int)
for v in V:
    dic[v] += 1
if len(se) == 1:
    ans = 0
    for i in range(A, B+1):
        ans += comb(dic[mi], i)
else:
    ans = comb(dic[mi], dic2[mi])
print(tot/A)
print(ans)


Measured memory_bytes: 28700
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	string s;
	cin>>s;
	int len = s.size();
	int ans = 0;
	int maxx = 0;
	for(int i = 0; i < len; i++)
	{
		if(s[i]=='A'||s[i]=='G'||s[i]=='C'||s[i]=='T')
		{
			ans++;
			if(ans>maxx)
				maxx = ans; 
		}
		else
			ans = 0;
	}
	cout<<maxx<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;

    map<int,int> m;
    rep(i,N){
        int x;
        cin>>x;
        m[x]++;
    }
    string ans="YES";
    for(auto p:m){
        if(p.second>1) ans="NO";
    }
    cout << ans << endl;



}


Measured memory_bytes: 12800
//Author : Gaara

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

#define ll long long
#define pb push_back
#define endl "\n"
#define fo(i,n) for(ll i=0;i<n;i++)
#define ro(i,n) for(ll j=n-1;i>=0;i--)
#define vll vector<long long>
#define mod 1000000007

int main(){
    int t=1;
    //cin>>t;
    while(t--){
		string s,t;
		cin>>s>>t;
		int ls = s.length(), lt = t.length(), ans = INT_MAX;
		fo(i,ls-lt+1){
			int x=0;
			fo(j,lt){
			if(s[i+j]!=t[j]) x++;
			}
			ans=min(ans,x);
		}
		cout<<ans<<endl;
	}
    return 0;
}

Measured memory_bytes: 3576
#include <stdio.h>

int main(void){
  int k,x;
  
  scanf("%d %d",&k,&x);

  for(int i =-k+1;i<k;i++){
    if(x+i<1000000&&x+i>-1000000)printf("%d ",x+i);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
typedef int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e18;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define lb(x,a) lower_bound(all(x),a)
#define ub(x,a) upper_bound(all(x),a)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

struct UnionFind {
    vector<int> par,si; 

    UnionFind(int N) : par(N), si(N,1) { 
        rep(i,0,N) par[i] = i;
    }

    int root(int x) { 
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        x = root(x); 
        y = root(y); 
        if (x == y) return; 
        si[y]+=si[x];
        par[x] = y; 
    }

    bool same(int x, int y) { 
      return root(x)== root(y);
    }
    int size(int x){
       return si[root(x)];
    }

};


void solve(){
 ll n;
  cin >> n;
 vll id(n),y(n);
  rep(i,0,n){
   ll u,v;
    cin >> u >> v;
    --u;
    --v;
    id[u]=i;
    y[u]=v;
  }
  
  UnionFind u(n);
  set<P> s;
  repr(i,n,0){
   P p=P(y[i],id[i]);
    auto it=s.lower_bound(p);
   while(it!=s.end()){
    u.unite(it->se,id[i]);
    p=*it;
    it=s.erase(it); 
   }
    s.insert(p);
  }
  
 rep(i,0,n) cout << u.size(i) << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}


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

namespace ABC_Training
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split(' ');
            var a = int.Parse(ab[0]);
            var b = int.Parse(ab[1]);
            var result = a - b * 2;
            Console.WriteLine(result >= 0 ? result : 0);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>


using namespace std;
#define INF 1000000005
int main()
{
int n;
std::vector<int> a;
std::cin >> n;
std::vector<int> b(n,0);
std::vector<int> c(n,0);

for(int i = 0; i < n; i++){
    int temp;
    std::cin >> temp;
    a.push_back(temp);
}
for(int i = 0; i < n; i++){
    b[i] = a[i];
    c[i] = a[i];
}
long long int suma = 0;

for(int i = 0; i < n - 1; i++){
    if(a[i] % 2 == 1){
        if(a[i + 1] > 0){
            a[i]--;
            a[i + 1]--;
            suma++;
        }
    }
}

for(int i = 0; i < n; i++){
    if(a[i] >= 2){
        int temp = a[i] / 2;
        suma += temp;
    }
}

std::cout << suma << std::endl;
return 0;
}

Measured memory_bytes: 1660
#include<stdio.h>
long long a[100010];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%lld",&a[i]);
    int zero=0;
    for(int i=0; i<n; i++)
        if(a[i]==0)
            zero++;
    if(zero >0)
    {
        printf("0\n");
        return 0;
    }
    long long prod=1;
    for(int i=0; i<n; i++)
    {
        if(a[i]<=1000000000000000000/prod)
        {

            prod*=a[i];
        }
        else
        {
            printf("-1\n");
            return 0;
        }
    }
    printf("%lld\n",prod);
}


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

int main(){
	string s;
	cin>>s;
	vector<int>eng(26,0);
	bool ans=true;
	for(int i=0;i<s.size();i++){
		eng.at(s[i]-'a')++;
	}
	for(int i=0;i<26;i++){
		if(eng.at(i)%2!=0){
			ans=false;
		}
	}
	if(ans){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

ll dp[110][100010];

class DKnapsack1 {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, W;
	    in >> n >> W;
	    vector<ll> w(n), v(n);
	    for(int i=0; i<n; i++){
	        in >> w[i] >> v[i];
	    }

        Fill(dp, 0);
	    for(int i=0; i<n; i++){
	        for(int j=0; j<=W; j++){
	            if(j + w[i] <= W) chmax(dp[i+1][j + w[i]], dp[i][j] + v[i]);
	            chmax(dp[i+1][j], dp[i][j]);
	        }
	    }

	    ll res = 0;
	    for(int i=0; i<=W; i++){
	        chmax(res, dp[n][i]);
	    }

	    out << res << endl;
	}
};


int main() {
	DKnapsack1 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 86144
#include <iostream>
#include <cmath>
#include <string>
using namespace std;

int main(){
    int a;
    cin >> a;
    int b,c,d,e;
    b = a / 1.08;
    c = a / 1.08;
    c++;
    d = b*1.08;
    e = c*1.08;
    if(a == d)cout << b << endl;
    else if(e == a)cout << c << endl;
    else cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
data = input().split()

divisor0 = []
divisor1 = []
for i in range(int(data[0])):
    if int(data[0]) % (i+1) == 0:
        divisor0.append(i+1)

for i in range(int(data[1])):
    if int(data[1]) % (i+1) == 0:
        divisor1.append(i+1)


plus_array= divisor0 + divisor1
l_duplicate = [x for x in set(plus_array) if plus_array.count(x) > 1]

l_duplicate.sort(reverse=True)

print(l_duplicate[int(data[2])-1])


Measured memory_bytes: 3064
import scala.io.StdIn
/**
  * AOJ
  */

object Main {

  def main(args: Array[String]): Unit = {

    val dice = StdIn.readLine().split(" ").map(_.toInt)
    val commands = StdIn.readLine().toCharArray
    println(commands.foldLeft(dice){(x,y) => getNextStatus(y,x)}(0))
  }

  def getNextStatus(cmd:Char,dice:Array[Int]): Array[Int] = cmd
    match {
      case 'E' => Array(dice(3),dice(1),dice(0),dice(5),dice(4),dice(2))
      case 'N' => Array(dice(1),dice(5),dice(2),dice(3),dice(0),dice(4))
      case 'S' => Array(dice(4),dice(0),dice(2),dice(3),dice(5),dice(1))
      case 'W' => Array(dice(2),dice(1),dice(5),dice(0),dice(4),dice(3))
    }
}

Measured memory_bytes: 43892
#include<bits/stdc++.h>
using namespace std;
 
int main(){

    int a, b,c;
    cin >> a >> b >> c;
    
    if((a == b && b !=c) || (b == c && c != a) || (c == a && a != b))cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;

void main(){
	while(true){
		int n;
		readf("%d\n", &n);
		if(n == 0) break;
		int[999] itime;
		bool[999] islogin;
		itime[] = 0;
		islogin[] = false;
		int month=-1, date=-1;
		bool logined = false;
		int start;
		while(n--){
			int m, d, hour, minute, p;
			int time;
			char e;
			readf("%d/%d %d:%d %s %d\n", &m, &d, &hour, &minute, &e, &p);
			time = 60*hour+minute;
			if(d != date || m != month){
				if(logined){
					foreach(i, b; islogin)
						if(b) itime[i] += 24*60-start;
				}
				logined = false;
				date = d; month = m;
				islogin[] = false;
			}
			if(e == 'I'){
				if(p == 0){
					logined = true;
					start = time;
					foreach(i, b; islogin)
						if(b) itime[i] -= time-start;
				}else{
					islogin[p-1] = true;
					if(logined)	itime[p-1] -= time-start;
				}
			}else{
				if(p == 0){
					logined = false;
					foreach(i, b; islogin)
						if(b) itime[i] += time - start;
				}else{
					islogin[p-1] =  false;
					if(logined)	itime[p-1] += time-start;
				}
			}
		}
		int m = 0;
		foreach(i; itime) m = max(m, i);
		writeln(m);
	}
}

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

int main() {
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main()
{
  int N;
  int t[110000];
  int x[110000];
  int y[110000];
  t[0]=0;
  x[0]=0;
  y[0]=0;

  cin >> N;
  for (int i = 1; i < N+1; i++)
  {
    cin >> t[i] >> x[i] >> y[i];
  }

  bool flag=true;
  for (int i = 1; i < N+1; i++)
  {
    int dist=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
    int tdist = t[i] - t[i-1];
    if(tdist>=dist){
      if(tdist%2 == 0){
        if(dist%2 != 0){
          flag=false;
          break;
        }
      }else{
        if(dist%2 != 1){
          flag=false;
          break;
        }
      }
    }else{
      flag=false;
      break;
    }
    // cout << dist << endl;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl


signed main(void){
    int N;
    int A[214514];
    cin >> N;
    REP(i,N){
        cin >> A[i];
    }
    int now=0;
    bool one=false;
    REP(i,N){
        if(A[i]==now+1){
            now++;
        }
        if(A[i]==1){
            one=true;
        }
    }
    if(!one)GOODBYE;
    cout << N-now << endl;
    return 0;
}



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

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

typedef long long ll;

const int INF = 1e8;

int main() {
    int N; cin >> N;
    vector<int> a(N); rep(i, N) cin >> a[i];

    int ans = INF;
    int mina = *min_element(a.begin(), a.end());
    int maxa = *max_element(a.begin(), a.end());

    for(int i=mina; i<=maxa; i++){
        int res = 0;
        for(int j=0; j<N; j++) res += pow(a[j]-i, 2);
        ans = min(ans, res);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

map<ll, ll> mp;

int main(int argc, char const *argv[]) {
    ll n, t;
    cin >> n >> t;
    vector<ll> a(n);
    REP(i,n) cin >> a[i];
    ll m = a[0];
    ll diff = -LINF;
    for (int i = 1; i < n; ++i) {
        if (a[i] < m) m = a[i];
        else mp[a[i]-m]++;
    }
    cout << mp.rbegin()->second << endl;
    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
 
int main() {
  int A, B; cin >> A >> B;
  int maximum = A + B;
  maximum = (A-B) > maximum ? (A-B) : maximum;
  maximum = (A*B) > maximum ? (A*B) : maximum;
  cout << maximum << endl;
}

Measured memory_bytes: 256
#include <atcoder/lazysegtree>
#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;

struct S{
	mint value;
	int size;
};

S op(S x, S y) {
	return S{x.value + y.value, x.size + y.size};
}

S e() {
	return S{0, 1};
}

struct F{
	mint b;
	mint c;
};

S mapping(F f, S x) {
	return S{f.b * x.value + f.c * x.size, x.size};
}

F composition(F f2, F f1) {
	return F{f1.b * f2.b, f1.c * f2.b + f2.c};
}

F id() {
	return F{1, 0};
}

int main() {
	int n, q; cin >> n >> q;
	vector<S> a(n);
	for (int i = 0; i < n; ++i) {
		int x; cin >> x;
		a[i] = S{x, 1};
	}
	lazy_segtree<S, op, e, F, mapping, composition, id> st(a);
	for (int z = 0; z < q; ++z) {
		int k; cin >> k;
		if (k == 0) {
			int l, r, b, c; cin >> l >> r >> b >> c;
			st.apply(l, r, F{b, c});
		} else {
			int l, r; cin >> l >> r;
			cout << st.prod(l, r).value.val() << "\n";
		}
	} 
	return 0;
}

Measured memory_bytes: 19360
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll x, k;std::cin >> x >> k;
  multiset<vll> st;
  for(int i=0;i<k;i++){
    ll a;scanf("%lld", &a);
    st.insert(vll{a, -10000000000});
  }
  ll q;std::cin >> q;
  for(int i=0;i<q;i++){
    ll t, a;scanf("%lld %lld", &t, &a);
    st.insert(vll{t, a});
  }
  ll prev = 0;
  ll a = 0, b = x, c = 0, cnt = 0;

  for(auto v:st){
    ll sa = v[0] - prev;
    if(cnt%2){
      c += sa;
      if(b+c>x) b = x - c;
      if(a>b) a = b;
    }else{
      c -= sa;
      if(a+c<0) a = -c;
      if(a>b) b = a;
    }
    prev = v[0];
    if(v[1]==-10000000000) cnt++;
    else std::cout << max(a, min(b, v[1])) + c << '\n';
  }
  return 0;
}


Measured memory_bytes: 19968
x = int(input())

dp = [0 for _ in range(x + 1)] #0:"No", 1:"Yes"
dp[0] = 1
if x < 100:
    print(dp[x])
    exit()
for i in range(100, min(x+1,106)):
    dp[i] = 1
if x < 106:
    print(dp[x])
    exit()
for i in range(106, x + 1):
    if dp[i-100] == 1 or dp[i-101] == 1 or dp[i-102] == 1 or dp[i-103] == 1 or dp[i-104] == 1 or dp[i-105] == 1:
        dp[i] = 1
print(dp[x])


Measured memory_bytes: 3864
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        String[] lines = getStdin();
        int n = Integer.parseInt(lines[0]);
        String[] str = lines[1].split(" ");
        int[] a = new int[n];
            for (int i = 0; i < n; i++){
                a[i] = Integer.parseInt(str[i]);
            }
            
        Arrays.sort(a);
        //最小値はa[0] 最大値はa[n - 1]
        long sum = 0;
            for (int i = 0; i < a.length; i++){
                sum += a[i];
            }
        System.out.println(a[0] + " " + a[n - 1] + " " + sum);
   }
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
}


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

int main()
{
	int n, m;
	int a[1000], b[1000];

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

	int k = 0, max = 0;

	for (int i = 0; i < m; i++) {
		if (max < b[i]) {
			k = i;
			max = b[i];
		}
	}

	int cost = 0;
	for (int i = 0; i < m; i++) {
		if (i != k) {
			if (a[i] < n) {
				cost += n - a[i];
			}
		}
	}

	cout << cost << endl;

	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h> 
using namespace std; 
const int dx[]={1,0,-1,0,1,-1,-1,1}; 
const int dy[]={0,1,0,-1,1,1,-1,-1}; 
const int INF = 1e9; 
const long long LINF = 1e18; 
const double EPS = 1e-8; 
#define pb emplace_back 
#define mk make_pair 
#define fr first 
#define sc second 
#define ll long long 
#define reps(i,j,k) for(int i = (j); i < (k); ++i) 
#define rep(i,j) reps(i,0,j) 
#define all(a) (a).begin(),(a).end() 
#define MOD 1000000007 
typedef pair<int,int> Pii; 
typedef vector<int> vi; 
int main(){
    string str;
    cin >> str;
    int len = str.size();
    bool f = false;
    bool x = false;
    rep(i,len){
        if(!f && str[i] == 'C'){
            f = true;
        }
        else if(f && str[i] == 'F'){
            x = true;
        }
    }
    if(x)cout << "Yes" << endl;
    else cout <<"No" << endl;;


    return 0;
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int n, i, j;
	cin >> n;
	vi a(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll m = INF;
	for (i = -200; i <= 200; i++) {
		ll ans = 0;
		for (j = 0; j < n; j++) {
			ans += (a[j] - i)*(a[j] - i);
		}
		m = min(m, ans);
	}
	cout << m << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF (1<<28)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
/*
  int n;
  cin>>n;
  vector<pair<string,pair<int,int> >> l;
  lp(i,n){
    string s;
    int a;
    cin>>s>>a;
    l.push_back({s,{-1*a,i}});
  }
  sort(l.begin(),l.end());
  lp(i,l.size()){
    cout<<l[i].second.second+1<<endl;
  }


  return 0;
}
signed main(){
  int a,p;
  cin>>a>>p;
  p+=a*3;
  cout<<p/2<<endl;
  return 0;
}
*/
int a[11][11];
signed main(){
  int n,m;
  cin>>n>>m;
  int bit=0;
  lp(i,m){
    int k;
    cin>>k;
    lp(j,k){
      int x;
      cin>>x;
      a[i][x-1]=1;
    }
  }
  int p[10];
  lp(i,m) cin>>p[i];
  int ans=0;
  while(1){
    int stat=0;
    //cout<<bit<<endl;
    lp(z,m){
      int cnt=0;
      lp(i,n){
        if(bit&(1<<i)&&a[z][i]==1)cnt++;
      }
      if(cnt%2!=p[z])stat=1;
      //cout<<cnt<<endl;
    }
    //cout<<endl;
    if(stat==0) ans++;
    bit++;
    if(bit==pow(2,n))break;
  }
  cout<<ans<<endl;
  return 0;
}

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

#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    string S,T; cin >> S >> T;
    int ans = 0;
    for(int i = 0; i < S.size(); ++i) {
        ans += (S[i]!=T[i]);
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans=1;
  for (int i=1; i<N; i++) {
    if (S.at(i) != S.at(i-1)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#define MAX_N 200000
#define STRSIZE 10

struct sset{
  char str[STRSIZE+1];
  int cnt;
};

int partition(struct sset s[], int l, int r){
	int i, j;
	char pivot[STRSIZE+1];
	struct sset t;

	i = l-1;
	j = r;
	strcpy(pivot, s[(l+r)/2].str);
	t = s[r];
	s[r] = s[(l+r)/2];
	s[(l+r)/2] = t;


	for(;;){
		while(strcmp(s[++i].str, pivot) < 0){
			;
		}
		while(i < --j && strcmp(pivot, s[j].str) < 0){
			;
		}
		if(i >= j){
			break;
		}
		t = s[i];
		s[i] = s[j];
		s[j] = t;
	}
	t = s[i];
	s[i] = s[r];
	s[r] = t;

	return i;
}

void quick_sort(struct sset s[], int l, int r){
	int v;

	if(l >= r){
		return;
	}

	v = partition(s, l, r);
	quick_sort(s, l, v-1);
	quick_sort(s, v+1, r);
}

int main(){
	int n, i;
	struct sset s[MAX_N];
	struct sset *sp;
	int max = 0;

	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%s", s[i].str);
		s[i].cnt = 0;
	}

	quick_sort(s, 0, n-1);

	sp = s;
	for(i=1; i<n; i++){
		if(strcmp(sp->str, s[i].str) == 0){
			sp->cnt += 1;
			if(max < sp->cnt){
				max = sp->cnt;
			}
			continue;
		}else{
			sp = s+i;
		}
	}

	for(i=0; i<n; i++){
		if(max > s[i].cnt){
			continue;
		}
		printf("%s\n", s[i].str);
	}
	return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e9;

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

int main() {
  ll n, X;
  cin >> n >> X;
  vector<ll> x(n), d(n);
  rep(i, n) cin >> x[i];

  x.push_back(X);
  sort(x.begin(), x.end());
  rep(i, n) d[i] = x[i + 1] - x[i];

  ll g = d[0];
  for (int i = 1; i < n; ++i) g = gcd(g, d[i]);

  cout << g << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>
int main(){
  int a;
  scanf("%d",&a);
  char s[a+1];
  scanf("%s",s);
  int e[a+2],w[a+2];
  e[a+1]=0;w[0]=0;
  for(int i=1; i<=a+1; i++){
    w[i]=w[i-1];
    if(s[i-1]=='W'){w[i]++;}
  }
  for(int i=a; 1<=i; i--){
    e[i]=e[i+1];
    if(s[i-1]=='E'){e[i]++;}
  }
  e[0]=e[1];
  int b=w[0]+e[1];
  for(int i=1; i<=a; i++){
    if(b>w[i]+e[i+1]){
      b=w[i]+e[i+1];
    }
  }
  printf("%d",b);
  return 0;}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll k;
  cin >> k;
  vector<ll> vec(k,0);
  ll piv = 1;
  ll t = 0;
  while(1){
    t *= 10;
    t += 7;
    t %= k;
    if(t == 0){
      break;
    }else{
      if(vec[t] == 1){
        piv = -1;
        break;
      }else{
        vec[t] = 1;
      }
    }
    piv++;
  }
  cout << piv << endl;
}

Measured memory_bytes: 11168
object Main extends App {
  import io.StdIn._
  val numberOfLine = readLine().split(' ').map(_.toInt).head
  val lineLengths = readLine().split(' ').map(_.toInt)
  val longestLine = lineLengths.max
  if (longestLine < (lineLengths.sum - longestLine)) {
    println("Yes")
  } else {
    println("No")
  }
}

Measured memory_bytes: 54944