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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    string ans = "No";    
    if(a == b){
	if(b != c) ans = "Yes";
    }
    else{
        if(b == c) ans = "Yes";
	    else if(a == c) ans = "Yes";
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>

using namespace std;

typedef complex<double> Point;

struct Segment{
  Point p1, p2;
};

typedef Segment Line;

const double EPS = 1e-10;

bool equals(double a, double b){
  return abs(a-b) < EPS;
}

double dot(Point a, Point b){
  return a.real()*b.real() + a.imag()*b.imag();
}

double cross(Point a, Point b){
  return a.real()*b.imag() - a.imag()*b.real();
}

int ccw(Point p0, Point p1, Point p2){
  Point a = p1 - p0;
  Point b = p2 - p0;
  if(cross(a, b) > EPS) return 1;
  if(cross(a, b) < -EPS) return -1;
  if(dot(a, b) < -EPS) return 2;
  if(norm(a) < norm(b)) return -2;
  return 0;
}

bool isIntersect(Point p1, Point p2, Point p3, Point p4){
  return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 &&
	  ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

bool isIntersect(Segment s1, Segment s2){
  return isIntersect(s1.p1, s1.p2, s2.p1, s2.p2);
}

Point getCrossPoint(Segment s1, Segment s2){
  Point base = s2.p2 - s2.p1;
  double d1 = abs(cross(base, s1.p1 - s2.p1));
  double d2 = abs(cross(base, s1.p2 - s2.p1));
  double t = d1 / (d1 + d2);
  return s1.p1 + (s1.p2 - s1.p1) * t;
}

main(){
  double a, b, c, d;
  while(cin >> a >> b >> c >> d && (a || b || c || d)){
    Segment s1, s2, s3;
    s1.p1.real() = a;
    s1.p1.imag() = b;
    s1.p2.real() = c;
    s1.p2.imag() = d;
    cin >> a >> b >> c >> d;
    s2.p1.real() = a;
    s2.p1.imag() = b;
    s2.p2.real() = c;
    s2.p2.imag() = d;
    cin >> a >> b >> c >> d;
    s3.p1.real() = a;
    s3.p1.imag() = b;
    s3.p2.real() = c;
    s3.p2.imag() = d;
    if(!isIntersect(s1, s2) || !isIntersect(s2, s3) || !isIntersect(s3, s1)){
      cout << "kyo" << endl;
    }else{
      Point a, b, c;
      a = getCrossPoint(s1, s2);
      b = getCrossPoint(s2, s3);
      c = getCrossPoint(s3, s1);
      b.real() -= a.real();
      b.imag() -= a.imag();
      c.real() -= a.real();
      c.imag() -= a.imag();
      double s = abs(b.real()*c.imag() - b.imag()*c.real()) / 2.0;
      if(s > 1900000.0 - EPS) cout << "dai-kichi" << endl;
      else if(s > 1000000.0 - EPS) cout << "chu-kichi" << endl;
      else if(s > 100000.0 - EPS) cout << "kichi" << endl;
      else if(s > 0 + EPS) cout << "syo-kichi" << endl;
      else cout << "kyo" << endl;
    }
  }
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int a,b;cin>>a>>b;
    cout<<(a+b+1)/2<<endl;
    return 0;
}


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

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

#define fr first
#define sc second

int main(){
	static int n,k;
	static int x[100010];
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%d",&x[i]);
	}
	
	int ret=1000000000;
	for(int i=0;i<n-k+1;i++){
		int l=min(0,x[i]);
		int r=max(0,x[i+k-1]);
		ret=min(ret,r-l+min(-l,r));
	}
	cout<<ret<<endl;
}



Measured memory_bytes: 640
#include<stdio.h>
 int main(){
 	int a,b,c,k,h;
 	scanf("%d %d %d",&a,&b,&c);
 	for(k=a;k<=b;k++){
 		if(c%a ==0){
 			h++;
 		}
 		a++;
 	}
 	printf("%d\n",h);
 }

Measured memory_bytes: 1820
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String s = saori.nextHayami();
		s = s.replaceAll("2017", "2018");
		System.out.println(s);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21204
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long lint;

int main()
{
	int n;
	static int a[100000];
	static int s[200000], t[200000], next[2][200000];
	static pair<int, int> p[400000];
	static vector<int> bucket[300000];
	
	lint sum = 0;
	
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++){
		scanf("%d", a + i);
		sum += a[i];
	}
	
	lint left = 0, right = sum / 3;
	
	while (left != right){
		lint mid = (left + right + 1) >> 1;
		lint sum2 = 0;
		int head = 0, tail = 0;
		bool ng = false;
		
		for (; head < n; head++){
			while (sum2 < mid){
				sum2 += a[tail++];
				if (tail >= n) tail -= n;
			}
			int i = head;
			s[i] = head, t[i] = tail;
			if (s[i] == t[i]) ng = true;
			if (t[i] < s[i]) t[i] += n;
			s[n + i] = s[i] + n, t[n + i] = t[i] + n;
			sum2 -= a[head];
		}
		if (ng){
			right = mid - 1;
			continue;
		}
		for (int i = 0; i < n * 3; i++) bucket[i].clear();
		
		for (int i = 0; i < n * 2; i++){
			bucket[t[i]].push_back(i);
			bucket[s[i]].push_back(n * 2 + i);
		}
		int ctr = 0;
		for (int i = 0; i < n * 3; i++){
			for (int j = 0; j < bucket[i].size(); j++){
				p[ctr++] = make_pair(i, bucket[i][j]);
			}
		}
		
		int last = -1;
		for (int i = n * 4 - 1; i >= 0; i--){
			int id = p[i].second;
			if (id < n * 2) next[0][id] = last;
			else {
				id -= n * 2;
				if (last < 0 || t[last] > t[id]) last = id;
			}
		}
		
		for (int k = 0; k + 1 < 2; k++){
			for (int i = 0; i < n * 2; i++){
				if (next[k][i] < 0) next[k + 1][i] = -1;
				else next[k + 1][i] = next[k][next[k][i]];
			}
		}
		
		int res = 0;
		for (int i = 0; i < n; i++){
			int tmp = 0, j = i;
			for (int k = 1; k >= 0; k--){
				int j2 = next[k][j];
				if (j2 >= 0 && t[j2] <= s[i] + n){
					j = j2;
					tmp |= 1 << k;
				}
			}
			if (res >= 3) break;
			res = max(res, tmp + 1);
		}
		if (res >= 3) left = mid;
		else right = mid - 1;
	}
	
	printf("%lld\n", left);
	
	return (0);
}

Measured memory_bytes: 23244
#include <iostream>

using namespace std;
int Memo[32];

void Calc()
{
	for(int i = 1; i < 15; ++i)
	{
		Memo[2 * i + 1] = Memo[2 * i - 1] * 3 + 2;
		Memo[2 * i + 2] = Memo[2 * i] * 3 + 2;
	}
}

void solve()
{
	Memo[1] = 1;
	Memo[2] = 2;
	Calc();
	int n;
	while(cin >> n)
	{
		cout << Memo[n] << endl;
	}
}

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

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
const int  N = 2e5 + 314;
void foo(){
    int n, k;
    cin>>n>>k;
    vi v(n);
    for(int i = 0; i < n; i++)cin>>v[i];
    sort(all(v));
    ll sum=0;
    for(int i = 0; i < n-k; i++)sum+=v[i];
    cout<<sum;
}
int main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)foo();
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include <string>
#include <math.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
  int n,m,k; cin >>n>>m>>k;
  if(k%n==0||k%m==0){
    cout << "Yes" << endl;
    return 0;
  }
  for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
      if(i*j+(n-i)*(m-j)==k){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main{
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();
		String[]S = s.split(""); 
		int count = 0;
		
		for(int i = 0; i < S.length; i++) {
			if(S[i].equals("1")) {
				count++;
			}
		}
		System.out.println(count);
	}
}

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

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

using namespace std;
using lint=long long;

const lint MOD=1e9+7;

int main(){
	lint fact[100001];
	fact[0]=1;
	rep(i,1e5) fact[i+1]=fact[i]*(i+1)%MOD;

	int n,m; cin>>n>>m;

	if(abs(n-m)>=2){
		cout<<0<<endl;
	}
	else if(n==m){
		cout<<fact[n]*fact[m]*2%MOD<<endl;
	}
	else{
		cout<<fact[n]*fact[m]%MOD<<endl;
	}

	return 0;
}


Measured memory_bytes: 1024
n = int(input())
max_num = n
cnt_max = 0
for i in range(n,0,-1):
  cnt = 0
  t = i
  while t > 0:
    if t % 2 == 0:
      t = t//2
      cnt += 1
    else:
      break
  if cnt > cnt_max:
    cnt_max = cnt
    max_num = i
print(max_num)

Measured memory_bytes: 3060
import sys

N, M = map(int, raw_input().split())
# print N, M                                                                                                                                                                                                                                  

ans = 1
if abs (N - M) > 1:
    ans = 0
elif N != M:
    for i in reversed(range(1, N+1)):
        ans *= i
        ans %= 1e9 + 7
    for i in reversed(range(1, M+1)):
        ans *= i
        ans %= 1e9 + 7
elif N == M:
    for i in reversed(range(1, N+1)):
        ans *= i
        ans %= 1e9 + 7
    for i in reversed(range(1, M+1)):
        ans *= i
        ans %= 1e9 + 7
    ans *= 2
    ans %= 1e9 + 7

print int(ans)


Measured memory_bytes: 5764
let () =
    let split s =
        let rec loop i cur flag acc =
            if i = String.length s then ( if flag then cur :: acc else acc) else (
                match flag, s.[i] with
                | true,  ' ' -> loop (i + 1) "" false (cur :: acc)
                | false, ' ' -> loop (i + 1) "" false acc
                | true,  v   -> loop (i + 1) (Printf.sprintf "%s%c" cur v) true acc
                | false, v   -> loop (i + 1) (Printf.sprintf "%s%c" cur v) true acc
            )
        in
        List.map int_of_string (List.rev (loop 0 "" false []))
    in
    let main () =
        let n = int_of_string (read_line ()) in
        let h = split (read_line ()) in
        let rec loop prev = function
            | [] -> "Yes"
            | hd :: tl -> if hd > prev + 1 then "No" else
                          if hd = prev + 1 then loop (hd - 1) tl else
                              loop hd tl
        in
        match List.rev h with
        | hd :: tl -> print_endline (loop hd tl)
        | [] -> failwith "??"

    in
    main ()

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> c(h);
  for (int i = 0; i < h; i++)
    cin >> c[i];

  for (int i = 0; i < h; i++) {
    cout << c[i] << endl;
    cout << c[i] << endl;
  }
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  string s; std::cin >> s;
  int len = s.size(), l, r;
  rep(i, len) if (s[i] == 'A') {
    l = i;
    break;
  }
  drep(i, len) if (s[i] == 'Z') {
    r = i;
    break;
  }
  std::cout << r-l+1 << "\n";
}


Measured memory_bytes: 720
N = int(input())
B = list(map(lambda x: int(x)-1, input().split()))

ans = []
for i in range(N):
    erase = -1
    for c in reversed(range(len(B))):
        if B[c] == c:
            erase = c
            break
    
    if erase == -1:
        print(-1)
        exit()
    else:
        ans.append(erase)
        B.pop(erase)

for _ in ans[::-1]:
    print(_+1)

Measured memory_bytes: 9172
#include <stdio.h>

int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    if(a>b) {
        printf("a > b\n");
    }else if(a<b) {
        printf("a < b\n");
    }else if(a==b) {
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 580
# -*- coding: utf-8 -*-
import sys
S = input()
S_list = list(S)
tmp = S_list.copy()
N = len(S)
if N % 2 == 0:
  print("No")
  sys.exit()
else: #奇数個
  S_list.reverse()
  if S_list == tmp:
    tmp_2 = int((len(tmp)-1) / 2)
    tmp_2_list = tmp[:tmp_2]
    t2=tmp_2_list.copy()
    
    tmp_3 = int((len(tmp)+3) / 2)
    tmp_3_list = tmp[tmp_3-1:]
    t3 = tmp_3_list.copy()
    
    tmp_2_list.reverse()
    tmp_3_list.reverse()
    if tmp_2_list == t2 and tmp_3_list == t3:
      print("Yes")
      sys.exit()
    else:
      print("No")
      sys.exit()
  else:
    print("No")
    sys.exit()

Measured memory_bytes: 3064
/**
 *    author:  morato
 *    created: 29.08.2020 18:14:06
**/
#include <bits/stdc++.h>

using namespace std;

#define y1 asjdlfasdjfl

struct Info {
  int strikes, dir, tam;
  int x, y;
  Info(int a, int b, int c, int d, int e): strikes(a), dir(b), tam(c), x(d), y(e) {}
  bool operator>(const Info& other) const {
    if (strikes == other.strikes) {
      return tam > other.tam;
    }
    return strikes > other.strikes;
  }
};

int vx[] = {0, 0, -1, 1};
int vy[] = {1, -1, 0, 0};
int H, W, K;

bool valid(int x, int y) {
  return (x > 0 && x <= H && y > 0 && y <= W);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> H >> W >> K;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  vector<vector<int>> grid(H + 1, vector<int>(W + 1, 1));
  vector<vector<vector<int>>> vis(H + 1, vector<vector<int>>(W + 1, vector<int>(4, 0)));
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      char ch;
      cin >> ch;
      if (ch == '@') {
        grid[i][j] = 0;
      }
    }
  }
  priority_queue<Info, vector<Info>, greater<Info>> pq;
  pq.push(Info(0, -1, 0, x1, y1));
  while (!pq.empty()) {
    Info lugar = pq.top();
    pq.pop();
    
    if(lugar.dir != -1 && vis[lugar.x][lugar.y][lugar.dir]) {
      continue;
    }
    if (lugar.dir == -1) {
      for (int k = 0; k < 4; k++) {
        vis[lugar.x][lugar.y][k] = 1;
      }
    } else {
      vis[lugar.x][lugar.y][lugar.dir] = 1;
    }
    if (lugar.x == x2 && lugar.y == y2) {
      cout << lugar.strikes << '\n';
      return 0;
    }
    for (int i = 0; i < 4; i++) {
      int nx = lugar.x + vx[i];
      int ny = lugar.y + vy[i];
      if (valid(nx, ny) && grid[nx][ny] && !vis[nx][ny][i]) {
        int new_strikes = 0;
        int new_tam = 0;
        if (i == lugar.dir) {
          if (lugar.tam == K) {
            new_strikes = lugar.strikes + 1;
            new_tam = 1; 
          } else {
            new_strikes = lugar.strikes;
            new_tam = lugar.tam + 1;
          }
        } else {
          new_strikes = lugar.strikes + 1;
          new_tam = 1;
        }
        pq.push(Info(new_strikes, i, new_tam, nx, ny));
      }
    }
  }
  cout << -1 << '\n';
  return 0;
}


Measured memory_bytes: 175136
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
//const llint mod=1000000007;
const llint inf=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int dp[1000]={};
vector<tuple<char,int,int,int>>syu;
void put(char c,int i,int j,int k){
	syu.pub(mt(c,i,j,k));
	/*if(c=='+'){dp[k]=dp[i]+dp[j];}
	else if(dp[i]<dp[j]){dp[k]=1;}
	else{dp[k]=0;}*/
}
int main(void){
	//cin>>dp[0]>>dp[1];
	put('<',3,0,6);
	put('+',6,7,7);
	put('<',3,1,6);
	put('+',6,7,7);
	put('<',3,7,4);//[4]=1
	put('+',4,4,5);//[5]=2
	int K=30;
	int h,i,j,k;
	put('+',3,4,100);
	for(i=0;i<K-1;i++){put('+',100+i,100+i,100+i+1);}
	
	put('+',3,3,6);//[6]=0
	put('+',0,4,0);//[0]++
	for(i=K-1;i>=0;i--){
		put('+',6,100+i,7);
		put('<',7,0,8);
		put('<',7,0,200+i);
		for(j=0;j<i;j++){put('+',8,8,8);}
		put('+',6,8,6);
	}
	
	put('+',3,3,6);//[6]=0
	put('+',1,4,1);//[0]++
	for(i=K-1;i>=0;i--){
		put('+',6,100+i,7);
		put('<',7,1,8);
		put('<',7,1,300+i);
		for(j=0;j<i;j++){put('+',8,8,8);}
		put('+',6,8,6);
	}
	
	for(i=0;i<K;i++){
		for(j=0;j<K;j++){
			put('+',200+i,300+j,6);
			put('<',4,6,7);
			put('+',7,400+i+j,400+i+j);
		}
	}
	for(i=K+K;i>0;i--){
		put('+',400+i,400+i,400+i);
		put('+',400+i,400+i-1,400+i-1);
	}
	
	put('+',3,400,2);
	
	//cerr<<dp[2]<<endl;
	
	cout<<syu.size()<<endl;
	for(auto it:syu){
		cout<<get<0>(it)<<" "<<get<1>(it)<<" "<<get<2>(it)<<" "<<get<3>(it)<<endl;
	}
	return 0;
}


Measured memory_bytes: 3276
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

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

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

int n;
string s;

int ans[256];
int cnt[256];

int main(){

  REP( i , 256 ){
    ans[i] = INF;
  }
  
  n = in();
  REP( i , n ){
    s = stin();
    REP( j , 256 ){
      cnt[j] = 0;
    }
    YYS( w , s ){
      cnt[w]++;
    }
    REP( j , 256 ){
      chmin( ans[j] , cnt[j] );
    }
  }

  REP( i , 256 ){
    REP( j , ans[i] ){
      printf( "%c" , (char)i );
    }
  }
  printf( "\n" );
  
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<iostream>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}
//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin>>n;
    vector<ll> a(12),dp(1000000,mod);
    rep(i,6) {
        a[i]=modpow(6,i+1,mod);
        a[i+6]=modpow(9,i,mod);
    }
    sort(ALL(a));
    dp[0]=0;
    for(ll i=0;i<n;i++) {
        rep(j,12){
            dp[i+a[j]]=min(dp[i]+1,dp[i+a[j]]);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 8192
//AtCoder ABC070 C - Multiple Clocks
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int64_t calc_gcd(int64_t a,int64_t b){
    if (a<b){
        swap(a,b);
    }
	int64_t r = a % b;
	while(r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
    return b;
}
ll lcm(ll num1,ll num2){
	//return num1 / calc_gcd(num1,num2) * num2;
    return num1 / __gcd(num1,num2) * num2; //gcc拡張
}

void PrimeFactorization(ll n, unordered_map<ll,ll>& x){
    ll num=n;
	//for(int i = 2; i <= n; i++) {
	for(ll i = 2; i <= num; i++) {
		while(num % i == 0) { //素数で割り切れなくなるまで割っていく
			x[i]++; //割った個数を配列に足す
			num /= i;
		}
	}
}

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N;
    cin>>N;
    vector<ll> tn(N,0);
    for(auto&& t:tn){
        cin>>t;
    }
    ll ans=1;
    for(const auto& t:tn){
         ans=lcm(t,ans);
    }
    cout<<ans<<endl;
#if 0
    unordered_map<ll,ll> ans;
    for(const auto& t:tn){
		unordered_map<ll, ll> tmp;
		PrimeFactorization(t,tmp);
        for(const auto& t:tmp){
            ans[t.first] = max(ans[t.first], t.second);
        }
    }
    ll val=1;
    for(const auto& a:ans){
        val*=pow(a.first,a.second);
    }
    cout<<val<<endl;
#endif
    return 0;
}

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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int H, A;
    cin >> H >> A;
    if (H <= A) {
        print(1);
    }
    else if (H % A == 0) {
        print(H / A);
    } else {
        print(H/A + 1);
    }
}

signed main() {
    solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define N 1000005
#define BB(V) V[V.size()-2]
#define ex(V) return printf(V),0
using namespace std;
int mp[105][105];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<50;i++)for(int j=0;j<100;j++)mp[i][j]=1;
	int r=0,t=0;
	for(int i=1;i<a;i++){
		mp[r][t+r%2]=0;
		t+=2;
		if(t==100){
			t=0;
			r+=2;
		}
	}
	r=99,t=0;
	for(int i=1;i<b;i++){
		mp[r][t+r%2]=1;
		t+=2;
		if(t==100){
			t=0;
			r-=2;
		}
	}
	printf("100 100\n");
	for(int i=0;i<100;i++){
		for(int j=0;j<100;j++)printf("%c",mp[i][j]?'#':'.');
		puts("");
	}
}

Measured memory_bytes: 256
#include <iostream>
static bool is_prime(long n) {
    static long p[10000] = { 2l };
    static int ip = 1;
    for (int i = 0; i < ip; ++i) {
        if (n == p[i]) {
            return true;
        }
    }
    if (n % 2l == 0l) {
        return false;
    }
    for (long i = 3l; i * i <= n; i += 2l) {
        if (n % i == 0l) {
            return false;
        }
    }
    p[ip++] = n;
    return true;
}
int main() {
    int n, c = 0;
    long m;
    std::cin >> n; // skip
    while (std::cin >> m) {
        if (is_prime(m)) {
            ++c;
        }
    }
    std::cout << c << std::endl;
}



Measured memory_bytes: 3152
#pragma GCC optimize("O2")
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x;
  cin>>x;
  if(x>=400 && x<=599)
  {
    cout<<8;
  }
  else if(x>=600 && x<=799)
  {
    cout<<7;
  }
  else if(x>=800 && x<=999)
  {
    cout<<6;
  }
  else if(x>=1000 && x<=1199)
  {
    cout<<5;
  }
  else if(x>=1200 && x<=1399)
  {
    cout<<4;
  }
  else if(x>=1400 && x<=1599)
  {
    cout<<3;
  }
  else if(x>=1600 && x<=1799)
  {
    cout<<2;
  }
  else if(x>=1800 && x<=1999)
  {
    cout<<1;
  }
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include <unordered_map>  
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;
 
 
int main() {
	int n;
	unsigned long long int y;
	cin >> n >> y;
	vector<int> sen, gosen, ichi;
	for (int i = 0; i < n; ++i) {
		gosen.push_back(1);
	}
	unsigned long long int sum = sen.size() * 1000 + gosen.size() * 5000 + ichi.size() * 10000;
	while (sum != y) {
		if (sum > y) {
			if (gosen.size() == 0) {
				cout << "-1 -1 -1" << endl;
				return 0;
			}
			gosen.erase(gosen.begin());
			sen.push_back(1);
		}
		else {
			if (gosen.size() == 0) {
				cout << "-1 -1 -1" << endl;
				return 0;
			}
			gosen.erase(gosen.begin());
			ichi.push_back(1);
		}
		sum = sen.size() * 1000 + gosen.size() * 5000 + ichi.size() * 10000;
	}
	cout << ichi.size() << " " << gosen.size() << " " << sen.size() << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sum(b) - sum(a)
if c < 0:
  print("No")
  exit(0)
x = a + []
#print(c)
for i in range(N):
  if x[i] < b[i]:
    c += -(b[i] - x[i]) // 2
    x[i] = b[i]

if c < 0:
  print("No")
else: print("Yes")

Measured memory_bytes: 40176
#include <bits/stdc++.h>
#define test cout << "test ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
void yn(bool b){ cout << (b ? "Yes" : "No") << endl; }
void YN(bool b){ cout << (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(a>b){a=b; return true;} return false; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  int cnt = 0;
  for(int i=0; i<n; i++){
	cin >> a[i];
	if(a[i]&1 && (i+1)&1) cnt++;
  }

  cout << cnt << endl;
}

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 3632
from operator import itemgetter

N,W = map(int, input().split())
List = [[int(l) for l in input().split()] for _ in range(N)]

num = [0]*4
w0 = List[0][0]
for i in range(N):
    num[List[i][0]-w0] += 1
    
List.sort(reverse=True, key=itemgetter(1))
L = []
for i in range(N):
    if List[i][0] == w0:
        L.append(List[i])
for i in range(N):
    if List[i][0] == w0+1:
        L.append(List[i])
for i in range(N):
    if List[i][0] == w0+2:
        L.append(List[i])
for i in range(N):
    if List[i][0] == w0+3:
        L.append(List[i])
        
prev = w0
for i in range(1, N):
    if L[i][0] == prev:
        L[i][1] += L[i-1][1]
    else:
        prev += 1
        
ans = 0
for i in range(-1, num[0]):
    wi = (i+1)*w0
    ci = 0
    if i >= 0:
        if wi > W:
            break
        ci += L[i][1]
    for j in range(-1, num[1]):
        wj = (j+1)*(w0+1)
        cj = 0
        if j >= 0:
            if wi+wj > W:
                break
            cj += L[j+num[0]][1]
        for k in range(-1, num[2]):
            wk = (k+1)*(w0+2)
            ck = 0
            if k >= 0:
                if wi+wj+wk > W:
                    break
                ck += L[k+num[0]+num[1]][1]
            for l in range(-1, num[3]):
                wl = (l+1)*(w0+3)
                cl = 0
                if l >= 0:
                    if wi+wj+wk+wl > W:
                        break
                    cl += L[l+num[0]+num[1]+num[2]][1]
                ans = max(ans, ci+cj+ck+cl)
            
print(ans)

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k;
	int x,y,cnt;
	
	while(1) {
		cin>>x>>y;
		if(x==0&&y==0) break;
		if(y>x) swap(x,y);
		cnt=0;
		while(y!=0) {
			cnt++;
			x=x%y;
			swap(x,y);
		}
		cout<<x<<" "<<cnt<<endl;
	}
}

Measured memory_bytes: 3076
N, K, Q = map(int, input().split())
A = Q - K 
N_dict = {}
for i in range(1,N+1):
    N_dict[i] = 0

for i in range(Q):
    N_dict[int(input())] +=1

for i in range(1,N+1):
    if  N_dict[i] > A:
        print('Yes')
        continue
    print('No')

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

int main() {
    ll n,k; cin >> n >> k;
    vector<pair<ll,ll>> a(n);
    for(int i = 0; i < n; i++) {
    int x,y; cin >> x >> y;
        pair<ll,ll> p(x,y);
        a.at(i)=p; 
    }
    sort(a.begin(),a.end());

    for(ll i = 0; i < n; i++) {
        k -= a[i].second;
        if(k<=0){
            cout << a[i].first << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4824
#include<iostream>
#include<queue>
#include<deque>
#include<vector>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>
#include<unordered_set>
//~ #include<unordered_map>
#include<stack>
 
#define pi 3.141592653
#define in freopen("entrada","r",stdin);
#define out freopen("myfile.txt","w",stdout);
#define ii pair<int,int> 
#define fast_io cin.tie(0), cin.sync_with_stdio(false);
#define inf 0x3f3f3f3f
#define sup_inf 1e18
#define f first
#define s second
#define eps 1e-9

#define nl ( no << 1)
#define nr ( no << 1)|1
#define mid l+(( r-l)>>1)
 
using namespace std;
typedef long long ll;	
typedef long double ld;
typedef unsigned long long ull;
typedef  pair< long long , pair< int,int> > iii;

const int maxn = 2e5 + 100; 
const int MAX = 1010;
const int mod = 1e9 + 7;
const int MAXLV = 16;
 

using namespace std;



int n ,a[maxn];

int main () { 
  //~ in
  
  cin >> n;
  
  for(int i = 0 ;i < n;i++) { 
    cin >> a[i];
  }
  
  
  ll ans =0;
  for(int i = 1; i< n;i++) { 
    if ( a[i] < a[i-1] ){
      int dif = a[i-1] - a[i];
      a[i]+=dif;
      ans += dif;
    }
  }
  cout<< ans << '\n';
  
  return 0;
}



Measured memory_bytes: 3936
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	string s, t;
	cin >> s >> t;
	if(s == t.substr(0, t.size() - 1)) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

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

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////
int main() {
	ll N;
	cin >> N;
	vll a(N + 1), b(N + 1);
	repn(i, N) cin >> a[i];
	repn(i, N) cin >> b[i];

	vector<pair<ll, ll>> p(2*N + 1);
	repn(i, N) {
		p[2 * i - 1] = { a[i],0 };
		p[2 * i] = { b[i],1 };
	}

	sort(++p.begin(), p.end());

	ll acnt = 0;
	ll bcnt = 0;
	mint ans = 1;

	repn(i, 2 * N) {
		if (p[i].second == 1) {
			if (acnt < bcnt) { ans *= bcnt - acnt; }
			acnt++;
		}
		else {
			if (bcnt < acnt) { ans *= acnt - bcnt; }
			bcnt++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 7956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
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 long long INF = 1LL << 60;

int main()
{
    string a, b; cin >> a >> b;
    int c = stoi(a + b);
    bool f = false;
    int i = 1;
    while (i <= c / i)
    {
        if (i * i == c)
            f = true;
        i++;
    }
    cout << (f ? "Yes" : "No") << endl;
}

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

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

    int n, m;
    cin >> n >> m;

    int A[11][11] = {};
    vector<int> K(m);
    for(int i = 0; i < m; i++){
        cin >> K[i];
        for(int j = 0; j < K[i]; j++){
            cin >> A[i][j];
            A[i][j]--;
        }
    }

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

    int ans = 0;
    for(int i = 0; i < (1 << n); i++){
        set<int> st;
        for(int j = 0; j < n; j++){
            if((i >> j) & 1){
                st.insert(j);
            }
        }

        bool f = true;
        for(int j = 0; j < m; j++){
            int cnt = 0;
            for(int k = 0; k < K[j]; k++){
                if(st.count(A[j][k])){
                    cnt++;
                }
            }
            if(cnt % 2 == P[j]);
            else{
                f = false;
                break;
            }
        }
        if(f) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

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

  int maxL = 1;
  int minR = n;

  for (int i = 0; i < m; ++i) {
    int L, R;
    std::cin >> L >> R;
    if (L > maxL) maxL = L;
    if (R < minR) minR = R;
  }

  auto count = minR - maxL + 1;
  if (count < 0) count = 0;
  std::cout << count << std::endl;
}


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

int main() {
    string S;
    cin >> S;
    int N = S.length();

    ll ans = 0;
    // (1 << 3) = 8 (1000) (1 << 2) = 4 (100)
    for (int i = 0; i < (1 << (N - 1)); i++) {
        ll sum = 0;
        ll a = S[0] - '0';
        for (int j = 0; j < N - 1; j++) {
            if (i & (1 << j)) {
                sum += a;
                a = 0;
            }
            a = a * 10 + S[j + 1] - '0';
        }
        sum += a;
        ans += sum;
    }

    print(ans);

    return 0;
}

Measured memory_bytes: 256
main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R))for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}

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

int main(){
  long long n,a,b;
  cin >> n >> a >> b;
  if(a>b){
    cout << 0 << endl;
  }else if(a==b){
    cout << 1 << endl;
  }else{
    if(n==1){
      cout << 0 << endl;
    }else{
      long long ans=1;
      ans=max(1ll,(b-a)*(n-2)+1);
      cout << ans << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>
#include <math.h>

int main(void) {
	int a, b;
	scanf("%d", &a);
	scanf("%d", &b);
	int area = a * b;
	int circumference = (a * 2) + (b * 2);
	printf("%d %d\n", area, circumference);
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll d;cin>>d;
    vector<ll>c(26);
    rep(i,26)cin>>c[i];
    vector<vector<ll> >s(d,vector<ll>(26));
    rep(i,d){
        rep(j,26)cin>>s[i][j];
    }
    vector<ll>last(26);
    vector<ll>v(d);
    ll ans=0;
    rep(i,d){
        ll ma=-inf*inf;
        ll idx=0;
        rep(t,26){
            ll cn=0;
            cn+=s[i][t];
            cn+=6*(d-last[t]+1);
            if(cn>ma){
                ma=cn;
                idx=t;
            }
        }
        last[idx]=i+1;
        v[i]=idx+1;
    }
    rep(i,d){
        cout<<v[i]<<endl;
    }
}

Measured memory_bytes: 3696
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	@SuppressWarnings("unchecked")
	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int k = scanner.nextInt();
		List<Pair>[] list = new List[n];
		for (int i = 0; i < n; i++)
			list[i] = new ArrayList<Pair>();
		while (m-- > 0) {
			int a = scanner.nextInt() - 1;
			int b = scanner.nextInt() - 1;
			int l = scanner.nextInt();
			list[a].add(new Pair(b, l));
			list[b].add(new Pair(a, l));
		}
		int[] dp = new int[n];
		Arrays.fill(dp, 1 << 25);
		PriorityQueue<Pair> pq = new PriorityQueue<Main.Pair>();
		for (int i = 0; i < k; i++) {
			int s = scanner.nextInt() - 1;
			dp[s] = 0;
			pq.offer(new Pair(0, s));
		}
		while (!pq.isEmpty()) {
			Pair pair = pq.poll();
			int f = pair.f;
			int s = pair.s;
			if (dp[s] < f)
				continue;
			for (Pair p : list[s]) {
				if (dp[p.f] <= f + p.s)
					continue;
				dp[p.f] = f + p.s;
				pq.offer(new Pair(f + p.s, p.f));
			}
		}
		int ans = 0;
		boolean[] b = new boolean[n];
		for (int i = 0; i < n; i++) {
			b[i] = true;
			for (Pair p : list[i]) {
				if (b[p.f])
					continue;
				int a = Math.max(dp[i], dp[p.f])
						+ (p.s - Math.abs(dp[i] - dp[p.f]) + 1) / 2;
				ans = Math.max(ans, a);
			}
		}
		System.out.println(ans);
	}

	class Pair implements Comparable<Pair> {
		int f, s;

		public Pair(int f, int s) {
			super();
			this.f = f;
			this.s = s;
		}

		@Override
		public String toString() {
			return "Pair [f=" + f + ", s=" + s + "]";
		}

		@Override
		public int compareTo(Pair o) {
			return f - o.f;
		}

	}
}

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

namespace ABC112C_cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var sds = new List<SurveyDetail>();

            for(var i = 0; i < n; i++)
            {
                var xyh = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                sds.Add(new SurveyDetail(xyh[0], xyh[1], xyh[2]));
            }
            var sr = new SurveyResult(n, sds);
            var result = sr.Center();
            Console.WriteLine("{0} {1} {2}", result.X, result.Y, result.H);
        }
    }
    public class SurveyResult
    {
        private int _n;
        private List<SurveyDetail> _sds;


        public SurveyResult(int n, List<SurveyDetail> sds)
        {
            _n = n;
            _sds = sds;
        }

        public SurveyDetail Center()
        {
            var sample = _sds.Where(tmp => tmp.H > 0).First();
            for(int Cx = 0; Cx <= 100; Cx++)
            {
                for (int Cy = 0; Cy <= 100; Cy++)
                {
                    int h = sample.H + Math.Abs(Cx - sample.X) + Math.Abs(Cy - sample.Y);
                    if (_sds.All(tmp => Math.Max(0, h - Math.Abs(tmp.X - Cx) - Math.Abs(tmp.Y - Cy)) == tmp.H))
                        return new SurveyDetail(Cx, Cy, h);
                }
            }
            return new SurveyDetail(0, 0, 0);
        }
    }

    public class SurveyDetail
    {
        private readonly int _x;
        private readonly int _y;
        private readonly int _h;

        public int X => _x;
        public int Y => _y;
        public int H => _h;

        public SurveyDetail(int x, int y, int h)
        {
            this._x = x;
            this._y = y;
            this._h = h;
        }

    }
}


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

int main(){
  int n,m,c;
  cin>>n>>m>>c;
  vector<int> b(m);
  int a;
  int sum=c;
  int count=0;
  for(int i=0;i<m;i++) cin>>b[i];
  for(int i=0;i<n;i++){
    sum=c;
    for(int j=0;j<m;j++){
      cin>>a;
      sum+=a*b[j];
    }
    if(sum>0) count++;
  }
  cout<<count<<endl;
}


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


int main(){
  int n,k;
  cin >>n>>k;
  int a[n];
  for(int i=0;i<n;i++){
    cin >>a[i];
  }
  int ans;
  ans=((n-1)+(k-2))/(k-1);
  cout <<ans<<endl;
  return 0;
}

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

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i+1;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main() {
    int N,K;
    cin >> N >> K;
    vector<double> e(N);
    for(int i=0;i<N;i++){
        double p;
        cin >> p;
        e[i] = (p + 1 )/2;
    }
    double max = 0;
    double temp = 0;
    for(int i=0;i<K;i++){
        temp+=e[i];
    }
    max = temp;
    for(int i=0;i<N-K;i++){
        temp = temp - e[i] + e[i+K];
        if(temp>max){
            max = temp;
        }

    }
    cout << fixed << setprecision(6) << max << endl;
}


Measured memory_bytes: 1792