akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	int C[200001];
	int flag[200001]={};
	int nowbegin[200001]={};
	ll toori[200001];
	ll MOD=1e+9+7;
	scan(N);
	rep(i,N){
		scan(C[i]);
		C[i]--;
		if(i>0&&C[i]==C[i-1]){
			N--;
			i--;
		}
	}
	vpint kukan;
	//rep(i,N) printf("%d ",C[i]);
	//kaigyo;
	rep(i,N){
		if(flag[C[i]]==0){
			nowbegin[C[i]]=i;
			flag[C[i]]=1;
		}
		else{
			kukan.push_back(mp(nowbegin[C[i]],i));
			nowbegin[C[i]]=i;
		}
	}
	int saizu=kukan.size();
	if(saizu==0){
		prin(1);
		return 0;
	}
	sort(kukan.begin(),kukan.end());
	/*rep(i,saizu){
		printf("%d %d\n",kukan[i].first+1,kukan[i].second+1);
	}*/
	toori[saizu]=1;
	for(int i=saizu-1;i>=0;i--){
		int owari=kukan[i].second;
		int nextpos=lower_bound(kukan.begin(),kukan.end(),mp(owari,-1))-kukan.begin();
		toori[i]=toori[i+1]+toori[nextpos];
		toori[i]%=MOD;
	}
	/*rep(i,saizu){
		printf("i:%d ans:%lld\n",i,toori[i]);
	}*/
	prin(toori[0]);
	return 0;
}


Measured memory_bytes: 6260
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, m, X, Y;
		n = sc.nextInt();
		m = sc.nextInt();
		X = sc.nextInt();
		Y = sc.nextInt();
		int x[] = new int[110], y[] = new int[110];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
		}
		for (int i = 0; i < m; i++) {
			y[i] = sc.nextInt();
		}

		boolean ok = false;
		for (int z = X + 1; z <= Y; z++) {
			boolean dame = false;
			for (int i = 0; i < n; i++) {
				if (x[i] >= z) {
					dame = true;
				}
			}
			for (int i = 0; i < m; i++) {
				if (y[i] < z) {
					dame = true;
				}
			}
			if (!dame) {
				ok = true;
				break;
			}
		}

		if (ok) {
			System.out.println("No War");
		} else {
			System.out.println("War");
		}

		sc.close();
	}
}

Measured memory_bytes: 21712
/* Filename: ABC045C.java
 * Author: Mushiyo
 */

import java.util.Scanner;

public class Main{

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

		while (input.hasNext()) {
			String S = input.next();
			
			System.out.println(sum(S, 0, 0, 1));
		}
	}
	
	private static long sum(String S, long currentSum, int prevPlus, int pos){
		if(pos == S.length()){
			return currentSum + Long.parseLong(S.substring(prevPlus, pos));
		}
		
		return sum(S, currentSum + Long.parseLong(S.substring(prevPlus, pos)), pos, pos + 1)
				+ sum(S, currentSum, prevPlus, pos + 1);
	}
}


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vi a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  set<int> s;
  for (int i = 0; i < n; i++) {
    if (s.find(a[i]) == s.end()) {
      s.insert(a[i]);
    } else {
      s.erase(a[i]);
    }
  }
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 5376
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        // write your code
        System.out.println(k==1 ?  0 : (n - k));
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


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

using namespace std;
using ll = long long;
using ld = long double;
constexpr ll mod = 1e9 + 7;
const ld eps = 1e-9, pi = acos(-1.0);

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n), f(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> f[i];
  }
  sort(a.rbegin(), a.rend());
  sort(f.begin(), f.end());
  //printv(a);printv(f);
  ll lb = 1e18, ub = -1;
  while (lb - ub > 1) {
    ll mid = (lb + ub) / 2;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
      sum += max(0LL, - mid / f[i] + a[i]);
    }
    // cerr << lb << " " << ub << " " << sum << endl;
    if (sum <= k)
      lb = mid;
    else
      ub = mid;
  }
  cout << lb << endl;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int L, R, d;
  cin >> L >> R >> d;
  int ans = 0;
  for (int i = L; i <= R; i++)
  {
    if (i % d == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    int price=N*100/108;

    if(price*108/100==N && N*100%108==0) cout << price << endl;
    else if((price+1)*108/100==N && N*100%108!=0) cout << price+1 << endl;
    else cout << ":(" << endl;
}

Measured memory_bytes: 3596
#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;

    int a = count(s.cbegin(), s.cend(), '0');
    int b = count(s.cbegin(), s.cend(), '1');

    cout << 2*min(a,b) << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

#include <complex>
#define CURR(P, i) (P[i])
#define NEXT(P, i) (P[(i + 1) % P.size()])

typedef complex<double> Point;
typedef vector<Point> Polygon;
struct Line : public vector<Point> {
  Line() {;}
  Line(Point a, Point b) { push_back(a); push_back(b); }
};
struct Circle {
  Point p;
  double r;
  Circle() {;}
  Circle(Point p, double r) : p(p), r(r) {;}
};

namespace std{
  bool operator < (const Point& a, const Point& b){
    return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
  }
}

inline double cross(const Point& a, const Point& b){
  return imag(conj(a) * b);
}

inline double dot(const Point& a, const Point& b){
  return real(conj(a) * b);
}

int ccw(Point a, Point b, Point c){
  b -= a; c -= a;
  double len = abs(b) * abs(c);
  if(cross(b, c) > +EPS * len) return +1; // counter-clockwise
  if(cross(b, c) < -EPS * len) return -1; // clockwise
  if(dot(b, c) < 0) return +2; // c--a--b
  if(norm(b) < norm(c)) return -2; // a--b--c
  return 0; // a--c--b 
}

double polygonArea(const Polygon& P) {
  double A = 0;
  for (int i = 0; i < P.size(); ++i) 
    A += cross(CURR(P, i), NEXT(P, i));
  return abs(A) / 2.0;
}


int main(){
  int n;
  int cnt = 1;
  while(cin>>n && n){
    printf("%d ", cnt++);
    Polygon p(n);
    REP(i, n){
      int x, y; cin>>x>>y;
      p[i] = Point(x, y);
    }
    printf("%.1f\n", polygonArea(p));
  }
  return 0;
}

Measured memory_bytes: 1228
//////////////////////////
/*      _        ____   */
/*  U  /"\  u U /"___|  */
/*   \/ _ \/  \| | u    */
/*   / ___ \   | |/__   */
/*  /_/   \_\   \____|  */
/*   \\    >>  _// \\   */
/*  (__)  (__)(__)(__)  */
/*  Compro by NULL_CT©  */
//////////////////////////
/*STL Libs*/
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

/*Boost*/
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#define int long long // Black Magic
#define REP(I, LIM) for (int I = 0; I < LIM; I++)
#define ALL(LIST) (LIST.begin()), (LIST.end())

using namespace std;
using bint = boost::multiprecision::cpp_int;

constexpr int MOD = 10000007;

vector<int> divisor(int n) {
  vector<int> head, tail;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      head.push_back(i);
      if (i * i != n)
        tail.push_back(n / i);
    }
  }
  head.insert(head.end(), tail.rbegin(), tail.rend());
  return (head);
}

template<typename T> T input(void){
  T data;
  cin>>data;
  return data;
}

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

void execute() {
  int n=input<int>();
  cout<<(ceil(n/2.0))/n<<endl;
}

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

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  // cout<<fixed<<setprecision(20);

  execute();

  return (0);
}


Measured memory_bytes: 3296
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	c := getString()

	ans := "consonant"

	switch c[0] {
	case 'a':
		ans = "vowel"
	case 'i':
		ans = "vowel"
	case 'u':
		ans = "vowel"
	case 'e':
		ans = "vowel"
	case 'o':
		ans = "vowel"
	}
	out(ans)
}


Measured memory_bytes: 640
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	static final int INF = (int)1e9 + 7;
	int N,Ma,Mb;
	int[] A,B,C;

	public void solve() {
		N = nextInt();
		Ma = nextInt();
		Mb = nextInt();

		A = new int[N];
		B = new int[N];
		C = new int[N];

		for(int i = 0;i < N;i++){
			A[i] = nextInt();
			B[i] = nextInt();
			C[i] = nextInt();
		}

		int[][][] dp = new int[N+1][1010][1010];
		for(int i = 0;i < N + 1;i++){
			for(int j = 0;j < 1010;j++){
				for(int k = 0;k < 1010;k++){
					dp[i][j][k] = INF;
				}
			}
		}

		dp[0][0][0] = 0;
		for(int i = 0;i < N;i++){
			for(int j = 0;j < 1010 - A[i];j++){
				for(int k = 0;k < 1010 - B[i];k++){
					int a = j + A[i];
					int b = k + B[i];
					dp[i+1][j][k] = Math.min(dp[i+1][j][k], dp[i][j][k]);
					dp[i+1][a][b] = Math.min(dp[i+1][a][b],dp[i][j][k]+C[i]);
				}
			}
		}

		int ans = INF;
		int max = Math.max(Ma,Mb);

		for(int i = 1;i * max < 1010;i++){
			ans = Math.min(ans,dp[N][i*Ma][i*Mb]);
		}
		if(ans == INF){
			out.println(-1);
		}else{
			out.println(ans);
		}
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

class MainClass
{
    public static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());

        var input = Console.ReadLine().Split(' ');

        var nums = input.Select(x => int.Parse(x)).ToArray();

        List<Student> students = new List<Student>();

        for (int i = 0; i < N; i++)
        {
            var student = new Student() { id = i + 1, Num = nums.ElementAt(i) };
            students.Add(student);
        }

        var newStudents = students.OrderBy(x => x.Num).Select(x => x.id).ToArray();

        Console.WriteLine(string.Join(" ", newStudents));
    }

    public struct Student
    {
        public int id;
        public int Num;
    }
}




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

#define debug(x) cout << #x << " = " << x << endl

const int INF = 1<<29;
typedef long long ll;
typedef pair<int,int> P;


int main(){
   string a,b;
   cin >> a >> b;
   string ans = "";
   for(int i=0; i<min(a.size(),b.size()); i++){
	  ans += a[i];
	  ans += b[i];
   }

   if(a.size() > b.size()) ans += a[a.size()-1];
   else if(a.size() < b.size()) ans += b[b.size()-1];
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	LL X;
	cin>>X;
	LL Y=100;
	LL year=0;
	while (true){
		Y+=Y*0.01;
		year++;
		if (Y>=X){
			cout<<year<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3164
import sys

S = list(input())

for i in range(len(S)):
    if (i+1) % 2 == 1:
        if S[i] == 'L':
            print('No')
            sys.exit()
    else:
        if S[i] == 'R':
            print('No')
            sys.exit()

print('Yes')

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

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

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;

    print(n - k + 1);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pi pair<int,int>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/
string check[]={"AA","AB","AX","AY","BA","BB","BX","BY","XA","XB","XX","XY","YA","YB","YX","YY"};
int dp[1001];

signed main(){
  int n;
  cin>>n;
  bool ok=false;
  if(n%10==7) ok=true;
  n/=10;
  if(n%10==7) ok=true;
  n/=10;  
  if(n%10==7) ok=true;
  n/=10;  
  if(ok) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3632
while True:
    data = input().split()
    n,a,b,c,x = int(data[0]),int(data[1]),int(data[2]),int(data[3]),int(data[4])
    if n == 0 and a == 0 and b == 0 and c == 0 and x == 0: break
    yList = input().split()
    frames = []
    bRand = x
    for i in range(0,10001):
        frames.append(bRand)
        bRand = (a * bRand + b)%c
    yCount = 0
    frameCount = -1
    for i,rand in enumerate(frames):
        if int(yList[yCount]) == rand:
            yCount += 1
            if yCount == len(yList):
                frameCount = i
                break
    print(frameCount)


Measured memory_bytes: 6200
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}


int main() {
    int h,w,k;
    cin >> h >> w >> k;
    vector<vector<char>>field(h,vector<char>(w));
    vector<vector<char>>init_field(h,vector<char>(w));
    vector<vector<char>>tmp_field(h,vector<char>(w));
    rep(i,h) rep(j,w){
        cin >> field[i][j];
        init_field[i][j] = field[i][j];
    }
    int ans = 0;
    int kazu= 0;
    for(int bit = 0;bit< (1<<h);bit++) {
        
        for(int i = 0;i<h;i++) {
            if(bit & 1<<i) {
                rep(j,w) field[i][j] = '.';
            }
        }
        rep(i,h) rep(j,w) tmp_field[i][j] = field[i][j];//行の状態を保存
        for(int bit2 = 0;bit2< (1<<w);bit2++) { // 列について全探索
            int cnt = 0;
            for(int i = 0;i<w;i++) {
                if(bit2 & 1<<i) {
                    rep(j,h) {
                        field[j][i] = '.';
                    }
                }
            }
            rep(i,h) rep(j,w) if(field[i][j] == '#') cnt++;
            if(cnt==k) ans++; //条件を満たせばインクリメント
            rep(i,h)rep(j,w) field[i][j] = tmp_field[i][j]; //列の状態を戻す
            // kazu++;
        }
        rep(i,h) rep(j,w) field[i][j] = init_field[i][j]; //一つの行の通りを全て調べたら初期化
        
    }
    cout << ans << endl;
    // cout << kazu << endl;
}
    




Measured memory_bytes: 3628
#include <iomanip>
#include <iostream>
using namespace std;
int main(void) {
  for(; true;) {
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        if((i + j) % 2 == 0)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    if(h == 0 && w == 0)
      break;
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3100
my ($n, $k) = split(/\s+/, <STDIN>);
my ($s) = split(/\s+/, <STDIN>);

my (@zero, @one) = ();
push @zero, 0 for (1..$k);
push @one,  0 for (0..$k);
my $len = 0;
my $max = 0;

my $last = -1;
my $cont = 0;
for my $i (split(//, $s)) {
    #print "i=$i, ";
    if ($i == $last) {
	$cont++;
    } else {
	if ($last == 1) {
	    my $j = shift @one;
	    push @one, $cont;
	    $len += $cont - $j;
	    $max = $len if $max < $len;
	} elsif ($last == 0) {
	    my $j = shift @zero;
	    push @zero, $cont;
	    $len += $cont - $j;
	}
	$last = $i;
	$cont = 1;
    }
    #print "max=$max, one=",join(" ", @one), ", zero=", join(" ", @zero), "\n";
}
if ($last == 1) {
    my $j = shift @one;
    push @one, $cont;
    $len += $cont - $j;
    $max = $len if $max < $len;
} elsif ($last == 0) {
    my $j = shift @zero;
    push @zero, $cont;
    $len += $cont - $j - shift @one;
    $max = $len if $max < $len;
}

print "$max\n";


Measured memory_bytes: 18048
#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}
////////////////////////////////////////////////////////////
int keta(int n){
  int c=0;
  while(n>0){
    n/=10;
    c++;
  }
  return c;
}
signed main() {
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n){
    int t;
    cin>>t;
    a[t]++;
  }
  bool b=true;
  if(n%2==1){
    rep(i,n){
      if(i==0){if(a[i]!=1)b=false;}
      else if(i%2==0){
        if(a[i]!=2)b=false;
      }
    }
  }
  else{
    rep(i,n){
      if(i%2==1){
        if(a[i]!=2)b=false;
      }
    }
  }
  if(b) cout<<modpow(2,n/2)<<endl;
  else cout<<0<<endl;

}


Measured memory_bytes: 3912
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i,s=1;
	cin>>n;
	string S;
	cin>>S;
	for(i=0;i<n-1;i++){
		if(S[i]!=S[i+1])s++;
	}
	cout<<s;
	return 0;
}

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e6+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int a,b,c,k;
        cin>>a>>b>>c>>k;
        int need = 0;
        while(b<=a)b*=2LL,need++;
        while(c<=b)c*=2LL,need++;
        cout<<((need<=k)?"Yes":"No")<<endl;
    }
    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> preference(M);
  for (int i=0; i<N; ++i) {
    int K=0;
    cin >> K;
    for (int j=0; j<K; ++j) {
      int var=0;
      cin >> var;
      ++preference[var-1];
    }
  }
  
  int ans=0;
  for (int i=0; i<M; ++i) {
    if (preference[i] == N) {
      ++ans;
    } 
  }
  
  cout << ans << endl;
  return 0;
}









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

int i, sumrika, sumsha, t, u, cnt=0;
int rika[5], sha[3];
int main(){
	int minrika=110, minsha=110;
	for(i=1; i<=4; i++){
	  cin>>rika[i]; sumrika+=rika[i];
	  if(rika[i]<minrika) {minrika=rika[i];}
	}
	for(i=1; i<=2; i++){
		cin>>sha[i]; sumsha+=sha[i];
		if(sha[i]<minsha) {minsha=sha[i];}
	}
	int disp = (sumrika-minrika)+(sumsha-minsha);
	cout << disp << endl;
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back 8 7
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define E endl
#define M 1000000007
#define fast ios:: sync_with_stdio(false),cin.tie(0);

int main()
{
   ll n,k;
   cin>>n>>k;
   ll ans=0;
   ll a[n+1];
   for(ll i=0;i<n;i++)
   cin>>a[i];
   for(ll i=0;i<n;i++)
   {
   	 if(a[i]>=k)
   	 ans++;
   }
   cout<<ans;
}

Measured memory_bytes: 1024
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 12/08/2017 13:09:21
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define POB pop_back
#define dist(a, b) sqrt(a*a + b*b)
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vipi;
bool compare(pi p1, pi p2){
	 if(1) return true;
	 return false;
}

int main(){
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	int a, b, c, d;
	cin>>a>>b>>c>>d;
	int r = min(b, d) - max(a, c);
	if(r < 0) cout<<0<<endl;
	else cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <cctype>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    ll a,b; cin >>a>>b;

    ll k = abs(b - a)/2 + min(a, b);

    if (abs(b-a)%2 == 0) {
        cout << k << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    } 

    return 0;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int a = A % 2;
    int b = B % 2;
    int c = C % 2;
    int ans = 0;

    if (a == b && b != c) {
        A++;
        B++;
        ans++;
    }
    else if (a != b && b == c) {
        B++;
        C++;
        ans++;
    }
    else if (a == c && b != c) {
        A++;
        C++;
        ans++;
    }

    if (A > B) {
        int tmp = B;
        B = A;
        A = tmp;
    }
    if (B > C) {
        int tmp = C;
        C = B;
        B = tmp;
    }
    if (A > B) {
        int tmp = A;
        A = B;
        B = tmp;
    }

    cout  << ans + (C - B) / 2 + (C - A) / 2 << endl;

    return 0;
}

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

using namespace std;

int N, F;
map<pair<string, string>, int> TotalProductInfos;
map<pair<string, string>, int>::iterator curPos;
set<string> Info;

void updateTotal() {
	pair<string, string> curPair;
	set<string>::iterator it,itNext;
	
	for (it = Info.begin(); it != Info.end(); ++it) {
		itNext = ++it;
		--it;
		while (itNext != Info.end()) {
			curPair = make_pair(*it, *itNext);
			curPos = TotalProductInfos.find(curPair);
			if (curPos == TotalProductInfos.end()) {
				TotalProductInfos[curPair] = 1;
			}
			else {
				++curPos->second;
			}
			++itNext;
		}
	}

	
}

void solve() {
	int sum;

	sum = 0;
	for (curPos = TotalProductInfos.begin(); curPos != TotalProductInfos.end(); ++curPos) {
		//cout << (curPos->first).first << ":" << (curPos->first).second << "=" << curPos->second << endl;
		if (curPos->second >= F) {
			++sum;
		}
	}

	cout << sum << endl;
	for (curPos = TotalProductInfos.begin(); curPos != TotalProductInfos.end(); ++curPos) {
		if (curPos->second < F) {
			continue;
		}
		cout << (curPos->first).first << " " << (curPos->first).second << endl;
	}
}

int main() {
	int m;
	string item;
	
	TotalProductInfos.clear();
	cin >> N >> F;
	for (int i = 0; i < N; ++i) {
		cin >> m;
		for (int i = 0; i < m; ++i) {
			cin >> item;
			Info.insert(item);
		}
		updateTotal();
		Info.clear();
	}
	solve();
	
	return 0;
}


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

string S;
int l, L, ans = 0;

int main() {
  cin >> S;
  L = S.size();
  l = floor(L / 2);
  rep(i, l) if (S.at(i) != S.at(L - i - 1)) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;

struct Land{
	short treasure;
	short bridge;
} island[25];

class mycmp{
public:

	bool operator()(struct Land L1,struct Land L2){
		return L1.bridge < L2.bridge;
	}
};

int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;

		for(int i=0;i<n;i++){
			int w,bridge;
			scanf("%d %d",&w,&bridge);
			island[i].bridge = bridge;
			island[i].treasure = w;
		}

		sort(island,island+n,mycmp());

		int sum=0;
		bool isok = true;
		for(int i=0;i<n;i++){
			sum += island[i].treasure;
			if(sum > island[i].bridge) isok = false;
		}

		printf("%s\n",isok ? "Yes" : "No");
	}
}

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

vector<int> to[200005];

int main()
{
    int n, m;
    cin >> n >> m;
    rep(i, 0, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i, 0, n){
        int ans = 0;
        for(int u : to[i]) ans++;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 8272
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

ll poww(ll a, ll b, ll mod) {
    ll ans = 1;
    while (b > 0) {
        if (b & 1) ans = (ans * a) % mod;
        b >>= 1;
        a = (a * a) % mod;
    }
    return ans;
}

const int maxN = 250011;

const ll mod = 1000000007;
const ll base = 500167;
const ll inv_base = poww(base, mod - 2, mod);

const ll mod2 = 1000000009;
const ll base2 = 503803; 
const ll inv_base2 = poww(base2, mod2 - 2, mod2);

struct hash_key {
    ll v1, v2;

    hash_key() {v1 = v2 = 0;}
    hash_key(ll _v1, ll _v2) {v1 = _v1; v2 = _v2;}

    bool operator<(const hash_key &who) const {
        return mp(v1, v2) < mp(who.v1, who.v2);
    }
    
    bool operator==(const hash_key &who) const {
        return mp(v1, v2) == mp(who.v1, who.v2);
    }

    void operator*=(const hash_key who) {
        v1 = (v1 * who.v1) % mod;
        v2 = (v2 * who.v2) % mod2;
    }

    void operator+=(ll v) {
        v1 = (v1 + mod + v) % mod;
        v2 = (v2 + mod2 + v) % mod2;
    }

    void operator+=(hash_key who) {
        v1 = (v1 + who.v1) % mod;
        v2 = (v2 + who.v2) % mod2;
    }

    hash_key get_inv()const {
        return {poww(v1, mod - 2, mod), poww(v2, mod2 - 2, mod2)};
    }
};

struct smart_map {
    map<hash_key, ll> M;
    hash_key bonus;

    smart_map() {
        M.clear();
        bonus = {1, 1};
    }

    void operator*=(hash_key who) {
        bonus *= who;
    }

    void add(hash_key x) {
        x *= bonus.get_inv();
        M[x]++;
    }

    ll query(hash_key x) {
        x *= bonus.get_inv();
        return M[x];
    }
};

ll n, i;
char s[maxN];
smart_map data;
ll ans;

hash_key act, full;
const hash_key to_left = {base, base2};
const hash_key to_right = {inv_base, inv_base2};

int main()
{
   // freopen("test.in","r",stdin);

    scanf("%d\n%s", &n, s + 1);

    data.add(hash_key(0, 0));
    act = {0, 0};

    for (i = n; i >= 1; i--) {
        if (s[i] == '+') act += 1;    
        if (s[i] == '-') act += -1;
        if (s[i] == '<') act *= to_left;
        if (s[i] == '>') act *= to_right;
    }

    full = act;
    act = {0, 0};

    for (i = n; i >= 1; i--) {
        if (s[i] == '+') act += 1;    
        if (s[i] == '-') act += -1;
        if (s[i] == '<') act *= to_left, data *= to_left;
        if (s[i] == '>') act *= to_right, data *= to_right;
    
        hash_key src = act;
        src += hash_key(mod - full.v1, mod2 - full.v2);
        ans += data.query(src);

        data.add(act);
    }

    printf("%lld", ans);

    return 0;
}


Measured memory_bytes: 31744
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll qmax(ll a, ll b){
	return (a > b) ? a : b;
}

int n;
int h[200200];
ll b[200200];
ll dp[200200];
ll bit[200200];
void update(int now, ll val){
	while(now <= n){
		bit[now] = qmax(bit[now], val);
		now += (now & (-now));
	}
}
ll query(int now){
	ll ans = 0;
	while(now > 0){
		ans = qmax(ans, bit[now]);
		now -= (now & (-now));
	}
	return ans;
}

int main(){
	scanf("%d", &n);
	rep(i, n) scanf("%d", &h[i]);
	rep(i, n) scanf("%lld", &b[i]);
	memset(dp, 0xc0, sizeof(dp));
	memset(bit, 0xc0, sizeof(bit));
	dp[0] = 0; 
	update(1, 0);
	ll ans = 0;
	rep(i, n){
		dp[h[i]] = query(h[i]) + b[i];
		update(h[i] + 1, dp[h[i]]);
		ans = qmax(ans, dp[h[i]]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5760
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
    static ArrayList<Integer>[] vertice;
    static int ans = 0;
    static int total = 0;
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Long n = in.nextLong();
        Long m = in.nextLong();
        Long need = n*2;
        if (need<=m){
            m-=need;
            Long left = (long)(m/4);
            System.out.println(left+n);
        }
        else {
            System.out.println((long)(m/2));
        }
    }
}


Measured memory_bytes: 21844
k = int(input())

if k < 10:
    print(k)
    exit(0)

digits = [{k: 1 for k in range(10)}]
count = 9
digits[0]["lc"] = 9
while count < k:
    dg = {}
    dg[0] = digits[-1][0] + digits[-1][1]
    for i in range(1, 9):
        dg[i] = digits[-1][i - 1] + digits[-1][i] + digits[-1][i + 1]
    dg[9] = digits[-1][8] + digits[-1][9]
    dg["lc"] = digits[-1]["lc"] + sum(dg[i] for i in range(1, 10))
    count = dg["lc"]
    digits.append(dg)

def count_lun(base, index, last_digit=None):
    if index < 0:
        return ""
    if last_digit is None:
        rng = range(1, 10)
    elif last_digit == 0:
        rng = range(2)
    elif last_digit == 9:
        rng = range(8, 10)
    else:
        rng = range(last_digit - 1, last_digit + 2)
    for i in rng:
        base += digits[index][i]
        if base >= k:
            return str(i) + count_lun(base - digits[index][i], index - 1, i)

res = count_lun(digits[-2]["lc"], len(digits) - 1)
print(res)


Measured memory_bytes: 38448
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        string s = Console.ReadLine();
        char last = s[0];
        var count = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (last != s[i]) count++;
            last = s[i];
        }
        Console.WriteLine(count);
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
#define inf 2147483647
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(int i=a;i<b;i++)
#define  rr read()
#define ll long long
#define pn putchar('\n')
#define ps putchar(' ')
#define repb(i,a,b) for(int i=a;i<=b;i++)
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
const int N=1e5+5;
const long double EPS = 0.0000000001;
const long double PI=acos(-1);
long double f(long double a,long double b,long double ta)
{   
     if(ta>PI/2.0-EPS)return 0.0;
	 if(b<=a*tan(ta))
	 {
	 	 return b * b / tan(ta) * a / 2.0;
	 }
	 else
	 return a*a*b-a*a/2.0*a*tan(ta);
}

int main()
{
 long double a,b,x;
 long double l=0.0,r=PI/2;
 scanf("%Lf %Lf %Lf",&a,&b,&x);
// printf("%Lf %Lf %Lf",a,b,x);
long double ans=0;
for(int i=1;i<=N;i++)
{    
     ans=(l+r)/2.0;
	 if(f(a,b,ans)>x)
	 l=ans;
	 else
	 r=ans;
}
printf("%.10Lf",ans/PI*180.0);
}





Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int d, s;

int main(){
	while (cin >> d){
		s = 0;
		for (int i = d; i <= 600; i += d){
			s += d * (i - d)*(i - d);
		}
		cout << s << endl;
	}


	return 0;
}


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

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define si(x) int((x).size())
#define mp make_pair
#define a first
#define b second

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using ll=long long;
using uint=unsigned int;
using pi=pair<int,int>;
using vi=vc<int>;

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}

int main(){
	//freopen("matrix.in","r",stdin);
	//freopen("matrix.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n,m;cin>>n>>m;
	vvc<int> gout(n);
	vvc<int> gin(n);
	rep(i,m){
		int a,b;cin>>a>>b;a--,b--;
		gout[a].pb(b);
		gin[b].pb(a);
	}

	ll ans=m;
	vi tp(n,-1);
	rep(i,n)if(tp[i]==-1&&!gin[i].empty()&&!gout[i].empty()){
		vi idx;
		function<void(int,int)>dfs=[&](int v,int c)->void{
			if(tp[v]!=-1)return;
			tp[v]=c;
			idx.pb(v);
			for(int to:gout[v])
				dfs(to,(c+1)%3);
			for(int to:gin[v])
				dfs(to,(c+2)%3);
		};
		dfs(i,0);

		int cnt[3]={};
		int ne=0;
		bool isok=true;
		for(int v:idx){
			cnt[tp[v]]++;
			for(int u:gout[v]){
				ne++;
				isok&=((tp[v]+1)%3==tp[u]);
			}
		}

		if(isok){
			rep(c,3)ans+=ll(cnt[c])*(cnt[(c+1)%3]);
		}else{
			int tot=cnt[0]+cnt[1]+cnt[2];
			ans+=ll(tot)*tot;
		}
		ans-=ne;
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 19964
from collections import defaultdict
N, M = [int(a) for a in input().split(" ")]
KAs = [[int(a) for a in input().split(" ")] for i in range(N)]
dic = defaultdict(lambda: 0)
for kas in KAs:
    for a in kas[1:]:
        dic[a] += 1
ans = 0
for cnt in dic.values():
    if cnt==N:
        ans+=1
print(ans)

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

int II[1000] , PP[1000] , QQ[1000] , RR[1000];
int main(){
	int n;
	while(cin >> n && n){
		int x = 0;
		for(int i = 0 ; i < n ; i++){
			cin >> II[i] >> PP[i] >> QQ[i] >> RR[i];
		}
		int P,Q,R,C,k=0;
		cin >> P >> Q >> R >> C;
		for(int i = 0 ; i < n ; i++){
			if(PP[i] <= P && QQ[i] <= Q && RR[i] <= R && PP[i] * 4 + RR[i] * 4 + QQ[i] * 9 <= C){
				cout << II[i] << endl;
				k++;
			}
		}
		if(!k) cout << "NA" << endl;
	}
}

Measured memory_bytes: 880
#include<stdio.h>
signed main(){
    int n,k,p[99999],i,j,l,m,o=0;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
    }
    for(i=0;i<n;i++){
        l=i;
        for(j=i+1;j<n;j++){
            if(p[j]<p[l]){
                l=j;
            }
        }
        if(l!=i) {
            m=p[i];
            p[i]=p[l];
            p[l]=m;
        }
    }
    for(i=0;i<k;i++){
        o +=p[i];
    }
    printf("%d\n",o);
    return(0);
}


Measured memory_bytes: 1716
x,n = map(int, input().split())
seq = [int(x) for x in input().split()]

def solve(x, n, seq):
    if n == 0:
        print(x)
        return

    lower = x - 1
    higher = x + 1

    seq_set = set()

    for i in range(n):
        current = seq[i]
        seq_set.add(current)
    
    
    while lower in seq_set and lower > 0:
        lower -= 1
    
    while higher in seq_set and higher <= 100:
        higher += 1
    
    lower_diff = abs(lower - x)
    higher_diff = abs(higher - x)

    if lower_diff and higher_diff > 1 and x not in seq_set:
        print(x)
    elif lower_diff <= higher_diff:
        print(lower)
    elif higher not in seq_set:
        print(higher)
    else:
        print(x)
    

solve(x,n,seq)
    



Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    cout << u << endl;
    return u;
}

ll paty_counter(ll level, ll x){
    ll size = pow(2, level+2) - 3;
    ll pmi = pow(2, level) - 1;
    if(x == 0){
        return 0;
    }else if(level == 0){    
        return 1;
    }else{
        if(x <= (size - 1)/2){
            return paty_counter(level-1, x-1);
        }else{
            return pmi + 1 + paty_counter(level-1, x - pow(2, level+1) + 3 - 2);
        }
    }

}
 
int main() {
    ll n,x,t;
    cin >> n >> x >> t;
    if(n % x == 0){
        cout << n * t /x << endl;
    } else {
        cout << (n / x + 1) * t << endl;
    }

}



Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define endl        "\n"
#define si(a)       scanf("%d",&a)
#define si2(a,b)    scanf("%d%d",&a,&b)
#define sl(a)       scanf("%lld",&a)
#define sl2(a,b)    scanf("%lld%lld",&a,&b)
#define pb          push_back
#define mk          make_pair
#define loop(n)     for(int i=0; i<n; i++)
#define FOR(a,b)    for(int i=a; i<=b; i++)
#define sz          size()
#define ff          first
#define ss          second
#define mem(a,val)  memset(a, val, sizeof(a))
#define md          1000000007
#define pi          acos(-1.0)

ll a[200010], n,k;
bool solve(ll x)
{
    int cnt=0;
    for(int i=0; i<n; i++)
    {
        cnt+=(a[i]-1)/x;
    }
    return (cnt<=k);
}
int main()
{
    ll hi=0;
    sl2(n,k);
    ll ans=0;
    for(int i=0; i<n; i++)
    {
        sl(a[i]);
        hi=max(hi, a[i]);
    }
    if(k==0)
    {
        cout<<hi;
        return 0;
    }
    ll lo=1, mid;
    while(lo<=hi)
    {
        mid=(lo+hi)/2;
        if(solve(mid))
        {
            hi=mid-1;
            ans=mid;
        }
        else
         lo=mid+1;
    }
    cout<<ans;
}


Measured memory_bytes: 5204
#include <algorithm>
#include <cstdio>
const int MAXN = 55;
int P[MAXN];
int N;

bool solve() {
  int cnt = 0;
  for (int i = 1; i <= N; ++i) {
    if (P[i] != i) {
      ++cnt;
    }
  }
  return !cnt || (cnt == 2);
}

int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &P[i]);
  }
  puts(solve() ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  int N; cin>>N;
  vector<string> S(3);
  rep(i,0,3) cin>>S[i];
  int ans=0;
  rep(i,0,N){
    set<char> T;
    rep(j,0,3)
      T.insert(S[j][i]);
    ans+=T.size()-1;
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
N,*S=*$<;N=N.to_i;D=proc{|i|d,p,q,r=-1,0,1<<i;while 0<q;d,p,q,r=d+1,p|q,0,p&q^q;s=r;while(t=s&-s)>0;q|=S[N-t.bit_length].to_i 2;s^=t;end;x if 0<q&r;end;d};p *((0...N).map(&D).max rescue-1)

Measured memory_bytes: 2300
#include<iostream>
#include<string>
std::string s,ans;
int main() {
	std::cin >> s;
	for (int bit = 0; bit < (1 << ((int)s.size() - 1)); bit++) {
		long long sum = s[0] - '0';
		ans.clear();
		for (int i = 0; i < (int)s.size() - 1; i++) {
			if (bit & (1 << i)) {
				sum += s[i + 1] - '0';
				ans += "+";
			}
			else {
				sum -= s[i + 1] - '0';
				ans += "-";
			}
		}
		if (sum == 7) {
			std::cout << s[0] << ans[0] << s[1] << ans[1] << s[2] << ans[2] << s[3] << "=7" << std::endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, dis, t;
int a[1000010];
int f[1000010][40];

int read()
{
	int x = 0,f = 1;
	char ch= getchar();
	while(ch<'0' || ch>'9')
	{
		if(ch == '-')
			f=-1;
		ch = getchar();
	} 
	while(ch>='0' && ch<='9')
	{
		x = (x<<1) + (x<<3) + ch-'0';
		ch = getchar();
	}
	return x*f;
}

void chu()
{
	for(int i = 1;i <= n;i++)
	{
		int id = upper_bound(a + 1,a + 1 + n, a[i] + dis) - a - 1; 
		//返回第一个比a[i] + l小值 
		if(a[i] + dis > a[n])		
			f[i][0] = n;
		else
			f[i][0] = id;
	} 
	for(int i = 1;i <= 32;i++)
	{
		for(int j = 1;j <= n;j++)
			f[j][i] = f[f[j][i - 1]][i - 1]; 
		// 他走2的i次方天等于他从j走i - 1天，再从该处走i - 1天 
	}
}

int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n = read();
	for(int i = 1;i <= n;i++)
		a[i] = read();
	dis = read(), t = read();
	chu();
	for(int i = 1;i <= t;i++)
	{
		int l = read(), r = read();
		if(l > r)
			swap(l, r);
		int ans = 0;
		for(int j = 30;j >= 0;j --)   //倍增 
		{
			if(f[l][j] < r)
			{
				ans += (1 << j);
				l = f[l][j];
			}
		}
		printf("%d\n", ans + 1);
	}
	return 0;
} 

Measured memory_bytes: 19200