akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
// 型シノニム
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
// 定数
constexpr ll INF   = 1e16;
constexpr ll INM   = 114514;
constexpr ll MOD   = 1e9 + 7;
constexpr ld EPS   = 1e-12;
constexpr ll dx[4] = {1, 0, -1, 0};
constexpr ll dy[4] = {0, 1, 0, -1};
// 便利関数
void IOS() { ios::sync_with_stdio(false), cin.tie(0); }
template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll mod) {
	if (a > 0) return a % mod;
	if (a % mod == 0) return 0;
	ll x = -a / mod + 1;
	a += x * mod;
	return a % mod;
}
ll powm(ll a, ll b, ll m) {
	if (b == 0) {
		return 1;
	} else if (b % 2 == 0) {
		ll d = powm(a, b / 2, m);
		return (d * d) % m;
	} else {
		return (powm(a, b - 1, m) * a) % m;
	}
}
// 本体

int main() {
	IOS();
	ll n, m;
	cin >> n >> m;
	ll dif = (n - 1) / 2;
	ll lb = 1, ub = dif + 1;
	ll cnt = 0;
	while (lb < ub && cnt < m) {
		cout << lb << " " << ub << endl;
		lb++;
		ub--;
		cnt++;
	}
	lb = dif + 2;
	ub = 2 * dif + 1;
	while (lb < ub && cnt < m) {
		cout << lb << " " << ub << endl;
		lb++;
		ub--;
		cnt++;
	}
}

Measured memory_bytes: 3612
x, y = map(int, input().split())

if x >= 0:
    if y >= x:
        print(y - x)
    elif y > 0:
        print(1 + x - y + 1)
    elif abs(y) < x:
        print(1 + x + y)
    else:
        print(1 + abs(x + y))
else:
    if y >= abs(x):
        print(1 + y + x)
    elif y > 0:
        print(abs(x + y) + 1)

    elif abs(y) <= abs(x):
        print(abs(y - x))
    else:
        print(1 + abs(y - x) + 1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define DEBUG(x) cout << #x << " = " << x << endl
#define pb push_back
using namespace std;
typedef long long ll;


const int MAXN = 500005;
int d[MAXN][27];
int b[MAXN][30];

int main()
{
    //freopen("input.txt", "r", stdin);
    string s;
    cin >> s;
    int sz = s.size();

    for (int i = 0; i < 27; i++) d[sz][i] = sz+1;
    for (int i = 0; i < 27; i++) d[sz+1][i] = sz+1;
    for (int l = sz-1; l >= 0; l--)
    {
        int c = s[l]-'a';
        d[l][c] = l+1;
        for (int i = c+1; i < 27; i++)
        {
            d[l][i] = d[ d[l][i-1] ][ i-1 ];
        }

        for (int i = 0; i < c; i++)
        {
            d[l][i] = d[ d[l][26] ][i];
        }
    }

    for (int i = 0; i <= sz+1; i++)
    {
        b[i][0] = d[i][26];
    }

    for (int i = 1; i < 20; i++)
    {
        for (int j = 0; j <= sz+1; j++)
        {
            b[j][i] = b[ b[j][i-1] ][i-1];
        }
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        int l, r;
        cin >> l >> r;
        l--;
        int k = 19;
        while(1)
        {
            while(k >= 0 && b[l][k] > r) k--;
            if (k < 0)
            {
                cout << "No" << endl; break;
            }
            if (b[l][k] == r)
            {
                cout << "Yes" << endl; break;
            }
            l = b[l][k];
        }
    }

    return 0;
}




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

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

int main(int argc, char **argv)
{
	ll a, b, c; cin >> a >> b >> c;
	ll g = gcd(a, b);
	if (c % g == 0)
		std::cout << "YES"<< std::endl;
	else
		std::cout << "NO" << std::endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A=sc.nextInt();
		int B =sc.nextInt();
		if((1<=A&&A<=9)&&(1<=B&&B<=9)) {
		System.out.print(A*B);
		}else {
			System.out.print("-1");
		}
		sc.close();
	}

}

Measured memory_bytes: 22740
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	int n;
  	cin >> n;
  	vi p(n);
  	rep(i,n) cin >> p[i];
  	int cnt = 0;
  	rep3(i,1,n-2){
    	if((p[i-1]-p[i])*(p[i]-p[i+1]) > 0) cnt++;
    }
  	cout << cnt << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 10000000
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < k; i++)
typedef long long ll;
typedef unsigned long long ull;

int B[128][3];
int n;

struct data{
	int nowh;
	int nowb;
	int cost;
};

int bfs(){
	bool V[128][3];
	queue<data> Q;
	rep(i,n)rep(j,2)V[i][j] = false;
	int sl = 0,sr = 0;
	if(B[sl][0] == 1){
		while(B[sl+1][0] == 1 && sl+1 < n){
			sl++;
		}
	}
	if(B[sr][1] == 1){
		while(B[sr+1][1] == 1 && sr+1 < n){
			sr++;
		}
	}
	V[sl][0] = true;
	V[sr][1] = true;
	data start = {sl,0,0};
	Q.push(start);
	data Start = {sr,1,0};
	Q.push(Start);
	data x;
	while(!Q.empty()){
		x = Q.front();
		Q.pop();
		if(x.nowh == n-1) return x.cost;
		rep(i,3){
			int p = x.nowh + i;
			int b = (x.nowb + 1) % 2;
			if(p >= n)continue;
			if(B[p][b] == 2)while(B[p][b] == 2)p--;
			if(B[p][b] == 1)while(p+1 < n && B[p+1][b] == 1)p++;
			if(V[p][b])continue;
			V[p][b] = true;
			data next = {p ,b , x.cost+1};
			Q.push(next);
		}
	}
	return INF;
}

int main(){
	while(scanf("%d",&n),n){
		memset(B,0,sizeof(B));
		rep(i,n)scanf("%d",&B[i][0]);
		rep(i,n)scanf("%d",&B[i][1]);
		int ans = bfs();
		(ans == INF) ? puts("NA") : printf("%d\n",ans); 
	}
	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b;
    cin>>n>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%n==0)
        {
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;



    return 0;
}


Measured memory_bytes: 3592
S=input()

from itertools import groupby, accumulate

_l = [len(list(g)) for k,g in groupby(S)]
_l_cs = [0] + list(accumulate(_l))
_l_cs_r = list(accumulate(_l[::-1]))[::-1] + [0]

answer = len(S)
for i, r in zip(_l_cs, _l_cs_r):
  answer = min(answer, max(i,r))

print(answer)

Measured memory_bytes: 7856
package main

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

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

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

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

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			x /= i
		}
	}
	if x != 1 {
		result[x]++
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m, k := readInt(), readInt(), readInt()

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()
	}

	t := 0
	b := make([]int, m)
	for i := 0; i < m; i++ {
		b[i] = readInt()
		t += b[i]
	}

	j := m
	ans := 0
	for i := 0; i < n+1; i++ {
		for j > 0 && t > k {
			j--
			t -= b[j]
		}
		if t > k {
			break
		}

		ans = max(ans, i+j)
		if i == n {
			break
		}
		t += a[i]
	}
	fmt.Println(ans)
}


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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

int binom_max = 5e5+1;
vector<int> fact(binom_max), inv_fact(binom_max), inv(binom_max);

void modbinom_init() {
    fact[0] = fact[1] = 1;
    inv_fact[0] = inv_fact[1] = 1;
    inv[1] = 1;
    for(int i=2; i<binom_max; i++){
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        inv_fact[i] = inv_fact[i-1] * inv[i] % MOD;
    }
}
int comb(int n, int k){
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return fact[n] * (inv_fact[k] * inv_fact[n-k] % MOD) % MOD;
}

int perm(int n, int k){
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return (fact[n] * inv_fact[n-k]) % MOD;
}

int n, m;

int f(int i){
    int ret = mod(comb(n,i) * perm(m,i));
    ret = mod(ret * perm(m-i,n-i));
    ret = mod(ret * perm(m-i,n-i));
    if(i % 2 == 1) ret = mod(-ret);
    return ret;
}

signed main(){
    modbinom_init();
    
    cin >> n >> m;
    
    int ans = 0;
    reps(i,0,n){
        ans = mod(ans + f(i));
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 14980
#include <iostream>

int	main(int	argc,
		 char*	argv[])
{
  int	s	= 0;
  
  std::cin >> s;

  std::cout << s / (60 * 60) << ':' << (s % (60 * 60)) / 60 << ':' << s % 60 << std::endl;
}



Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


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


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

signed main() {
    int n;
    while (cin >> n) {
        vector<int> a(n);
        rep(i, n) cin >> a[i];
        sort(a.begin(), a.end());
        int x = a.back();
        cout << x << ' ';
        a.pop_back();

        rep(i, a.size()) a[i] *= 2;
        int best = a[0];
        rep(i, a.size()) {
            if (abs(x - best) > abs(x - a[i])) {
                best = a[i];
            }
        }
        best /= 2;
        cout << best << endl;
    }
}


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

int main() {
  int n,k;
  cin >> n >> k;
  int count = 0;
  rep(i,n){
    int s;
    cin >> s;
    if(s>=k)count++;
  }
  
  cout << count << endl;
    
}

Measured memory_bytes: 256
/// You just can't beat the person who never gives up
/// ICPC next year


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
void offset(vector<int>&a,int x) {
    for(int i = 0; i < sz(a);i++) {
        a[i] = x;
    }
}
struct cmp {
    bool operator() (const pair<int,int>& lhs, const pair<int,int>& rhs) const {
        return lhs.ff * rhs.ss < lhs.ss * rhs.ff;
    }
//for map<pii,int>
};


// auto cmp = [](pair<int,int>a,pair<int,int>b) {if(a.first==b.first)return a.second>b.second;
//      else return a.first > b.first;
//  };
//  multiset<pair<int,int>,decltype(cmp)>fc(cmp);
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash> safe_map;
};

const int MAXN = 2e5+ 10;

#define int long long
bool cmps(pair<int,int>p1,pair<int,int>p2) {
    return p1.ss > p2.ss;
}
int32_t main() {
    fio
    int n,k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a,a+n);
    int sum = 0;
    for (int j = 0; j < n - k; ++j) {
        sum+=a[j];
    }
    cout << sum << endl;


    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;


}






Measured memory_bytes: 5400
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const  ll INF = 1e18;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    ll n,ans = 1,prev = 0;
    cin >> n;
    ll a[n];
    repi(i,n,0){
        cin >> a[i];
        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    repi(i,n,0){
        ans *= a[i];
        if(ans < prev || ans > INF){
            cout << -1 << endl;
            return 0;
        }
        prev = ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4372
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
  int n;
  int i,j,k;
  while(cin>>n,n){
    map<string,int> m;
    map<string,int> l;
    int t,g;
    map<string,bool> h;
    string date,time,io,name,ye;
    for(i=0;i<n;i++){
      cin >> date >> time >> io >> name;
      t=(time[0]-'0')*600+(time[1]-'0')*60+(time[3]-'0')*10+(time[4]-'0');
      if(io=="I"){
	h[name]=true;
	l[name]=t;
	if(name=="000"){
	  //cout << "I" << t << endl;
	  for(map<string,bool>::iterator itr=h.begin();itr!=h.end();++itr) {
	    if(itr->second){
	      //cout << "key = " << itr->first << endl;
	      l[itr->first]=t;
	    }
	  }
	}
      }else{
	h[name]=false;
	if(name=="000"){
	  //cout << "O" << t << endl;
	  for(map<string,bool>::iterator itr=h.begin();itr!=h.end();++itr) {
	    if(itr->second){
	      //cout << "key = " << itr->first << endl;
	      m[itr->first]+=t-l[itr->first];
	    }
	  }
	}else{
	  if(h["000"]) m[name]+=t-l[name];
	}
      }
    }
    int o=0;
    for(map<string,bool>::iterator itr=h.begin();itr!=h.end();++itr) {
      //cout << "key = " << itr->first <<"time=" << m[itr->first] << endl;
      o=max(o, m[itr->first]);
    }
    cout << o << endl;
  }
  return 0;
}

Measured memory_bytes: 1344
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100100;
const int MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

long long A,B;

bool ok(long long key,long long index){
    string S = to_string(index);
    long long nagasa = S.size();
    if(index*A+nagasa*B > key) return true;
    else if(index*A+nagasa*B <= key) return false;
}

long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    double N;cin >> N;
    double pi = 3.1415;
    cout << 2.00*N*pi << endl;
    // PLEASE GIVE ME THE "ACCEPTED" !
}

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

typedef pair<int, int> P;

int N;
vector<vector<int>> G;
vector<vector<int>> W;
vector<int> C;
vector<bool> visited;

void dfs(int u) {
    visited[u] = true;

    for (int i = 0; i < G[u].size(); i++) {
        int v = G[u][i];
        if (visited[v]) continue;
        C[v] = (C[u] + W[u][i]) % 2;
        dfs(v);
    }
}

int main() {
    cin >> N;
    G.resize(N);
    W.resize(N);
    C.resize(N);
    visited.resize(N, false);
    for (int i = 0; i < N - 1; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
        W[u].push_back(w);
        W[v].push_back(w);
    }

    dfs(0);

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

    return 0;
}

Measured memory_bytes: 13392
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)
#define pb push_back

const int H = 11;
const int W = 5;

int h;
int board[H][W];

bool input(){
	cin>>h;
	if(h==0)return false;
	
	rep(i,H)rep(j,W)board[i][j]=0;
	rep(i,h){
		rep(j,W)cin>>board[i][j];
	}
	
	return true;
}

int check[H][W];

void docheck(){
	rep(i,H)rep(j,W)check[i][j]=0;
	
	rep(i,h){
		rep(j,W-2){
			bool hit = true;
			rep(k,3){
				if(board[i][j+k] != board[i][j])hit=false;
			}
			if(hit){
				rep(k,3)check[i][j+k]=1;
			}
		}
	}
}

int del(){
	int ans= 0;
	rep(i,h){
		rep(j,W){
			if(check[i][j]==1){
				ans += board[i][j];
				board[i][j]=0;
			}
		}
	}
	return ans;
}

void tsume(){
	rep(i,h){
		reps(j,1,h){
			rep(k,W){
				if(board[j][k]==0){
					swap(board[j-1][k], board[j][k]);
				}
			}
		}
	}
}

void print(){
	rep(i,h){
		rep(j,W)printf("%d ",board[i][j]);puts("");
	}
}

void solve(){
	int ans = 0;
	while(1){
		
		docheck();
		
		int val = del();
		ans += val;
		if(val==0)break;
		
		tsume();
		
		//print();puts("");
	}
	cout<<ans<<endl;
}

int main(){
	while(input())solve();
}

Measured memory_bytes: 1160
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

vector<int> list;
vector<int> kisu;

int dp1[1001000];
int dp2[1001000];

int main() {
	int i;
	for(i=1;;i++){
		int yon=i*(i+1)*(i+2)/6;
		if(yon>1000000)break;
		list.push_back(yon);
		if(yon%2==1)kisu.push_back(yon);
	}
	for(i=0;i<1001000;i++){
		dp1[i]=dp2[i]=i;
	}
	for(i=0;i<1001000;i++){
		int j;
		for(j=0;j<list.size();j++){
			if(i-list[j]<0)break;
			chmin(dp1[i],dp1[i-list[j]]+1);
		}
		for(j=0;j<kisu.size();j++){
			if(i-kisu[j]<0)break;
			chmin(dp2[i],dp2[i-kisu[j]]+1);
		}
	}
	int n;
	while(n=in()){
		cout<<dp1[n]<<" "<<dp2[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 8616
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
#print(N,M,X,Y,x,y)
x.append(X)
y.append(Y)
if((max(x)+1)>min(y) or (X+1)>Y):
  print('War')
else:
  print('No War')



Measured memory_bytes: 2940
N = 60
MOD = 10**9 + 7
n = int(input())
c0 = [0 for _ in range(N)]
c1 = [0 for _ in range(N)]

a = list(map(int,input().split()))
for i in range(n):
    for j in range(N):
        if a[i] & (1 << j) == 0:
            c0[j] += 1
        else:
            c1[j] += 1

ans = 0
for i in range(n-1):
    for j in range(N):
        if a[i] & (1 << j) == 0:
            c0[j] -=1
        else:
            c1[j] -=1
    for j in range(N):
        if a[i] & (1 << j) == 0:
            ans += (1<<j) * c1[j]
        else:
            ans += (1<<j) * c0[j]

print(ans % MOD)

Measured memory_bytes: 123228
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef unsigned long long ul;
const int mn = 1 << 18;
int nn; ll dat[2 * mn - 1],lazy[2 * mn - 1];
void init(int n) {
	nn = 1;
	while (nn < n)nn *= 2;
}
//遅延
void eval(int k, int l, int r) {
	dat[k] += lazy[k];
	if (r - l > 1) {
		lazy[2 * k + 1] += lazy[k];
		lazy[2 * k + 2] += lazy[k];
	}
	lazy[k] = 0;
}
//範囲加算
void update(ll x, int a, int b, int k, int l, int r) {
	eval(k, l, r);
	if (r <= a || b <= l)return;
	if (a <= l && r <= b) {
		lazy[k] += x;
		eval(k, l, r);
	}
	else {
		update(x, a, b, k * 2 + 1, l, (l + r) / 2);
		update(x, a, b, k * 2 + 2, (l + r) / 2, r);
		dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
	}
}
ll query(int a, int b, int k, int l, int r) {
	eval(k, l, r);
	if (r <= a || b <= l)return -INF;
	if (a <= l && r <= b)return dat[k];
	else {
		ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return max(vl, vr);
	}
}
vector<LP> v[1 << 18];
int n, m;
ll dp[1 << 18];
int main() {
	cin >> n >> m; init(n+2);
	rep(i, m) {
		int l, r; ll a; cin >> l >> r >> a;
		v[l].push_back({ l,a });
		v[r + 1].push_back({ l,-a });
	}
	ll ans = 0;
	rep1(i, n + 1) {
		rep(j, v[i].size()) {
			int id = v[i][j].first;
			update(v[i][j].second, 0, id, 0, 0, nn);
		}
		dp[i] = query(0, i, 0, 0, nn);
		ans = max(ans, dp[i]);
		update(dp[i], i, i + 1, 0, 0, nn);
	}
	cout << ans << endl;
	//stop
	return 0;
}

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


#include <bits/stdc++.h>

using namespace std;

class CGuessTheNumber {
public:
  void solve(std::istream &cin, std::ostream &cout) {
    int n, m;
    cin >> n >> m;
    vector<pair<int, char>> v(m);
    for (int i = 0; i < m; ++i) {
      int s;
      char c;
      cin >> s;
      cin >> c;
      v[i] = make_pair(s, c);
    }
    int ans = -1;
    for (int j = 0; j < 1000; ++j) {
      bool flag = true;
      string tmp = to_string(j);
      if (tmp.size() != n)continue;
      for (const auto &p : v) {
        if (tmp[p.first - 1] != p.second) {
          flag = false;
        }
      }
      if (flag) {
        ans = j;
        break;
      }
    }
    cout << ans << endl;
  }
};


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


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

int main()
{
    int K, N; cin >> K >> N;
    vector<int> a(N); rep(i, N) cin >> a[i];
    
    sort(a.begin(), a.end());
    int d = 0;
    rep(i, N-1) {
        d = max(d, a[i+1] - a[i]);
    }
    d = max(d, a[0] + K - a[N-1]);
    cout << (K - d) << endl;
    return 0;
}


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

using namespace std;

int main(){
	string s;
	cin>>s;
	map<char, int>mp;
	map<char, int>::iterator it;
	for(auto i : s) ++mp[i];
	if(mp.size() <= 2){
		it = mp.begin();
		for(it = mp.begin();it != mp.end(); ++it){
			if(it->second != 3 && it->second != 4 && it->second != 1){
				cout<<"No";
				return 0;
			}
			else if(it->second == 4){
				cout<<"Yes";
				return 0;
			}
			else if(it->second == 1){
		        if(it->first != s[0] && it->first != s[3]){
		        	cout<<"No";
		        	return 0;
		        }
		        else{
		        	cout<<"Yes";
		        	return 0;
		        }
			}
		}
	}

else cout<<"No";
return 0;
}

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int ab, bc, ca;
map<int, int> an;

int main() {
    cin >> ab >> bc >> ca;
    cout << ab * bc / 2 << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  int out = N;
  if(N%2) out--;
  vector<P> ans;
  for(int i=1; i<=N; i++){
    for(int j=i+1; j<=N; j++){
      if(j == out) continue;
      ans.emplace_back(i,j);
    }
    out--;
  }
  cout << ans.size() << endl;
  for(int i=0; i<ans.size(); i++){
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}

Measured memory_bytes: 384
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll H1,M1,H2,M2,K;
	while(cin>>H1>>M1>>H2>>M2>>K) {
		ll a = H1*60+M1;
		ll b = H2*60+M2;
		ll ans=max(0LL, b-a-K);
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3196
#ifdef __GNUC__
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#endif

#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>

#include <string>
#include <cstring>
#include <vector>
#include <valarray>
//#include <array>//x C++ (G++ 4.6.4)

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <cassert>//assert();
#include <fstream>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)

/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#define PII pair<int,int>
/////////
using namespace::std;

// 最大公約数
template<class T>
inline T gcd(T a, T b){return b == 0 ? a : gcd(b, a % b);}
// 最小公倍数
template<class T>
inline T lcm(T a, T b){return a * b / gcd(a, b);}
////////////////////////////////

inline void solve(){
	int A,B;
	cin >> A >> B;
	A = (A+11)%13;
	B = (B+11)%13;
	if( A>B ){
		cout << "Alice" << endl;
	}else if(A<B){
		cout << "Bob" << endl;
	}else{
		cout << "Draw" << endl;
	}
}

signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	//std::cout << std::fixed;//小数を10進数表示
	//cout << setprecision(16);//小数をいっぱい表示する。16?

	solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {

	string s;
	cin>>s;
	if(s=="A"){
		cout<<"T"<<endl;
	}else if(s=="T"){
		cout<<"A"<<endl;
	}else if(s=="C"){
		cout<<"G"<<endl;
	}else if(s=="G"){
		cout<<"C"<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <numeric>

int main() {
	int N=0;
	
	std::cin >>N;

	int total_candy=0;

	for(int i = 0; i <N+1 ; i++) {
	
	total_candy=i+total_candy;

	}
	std::cout << total_candy << std::endl;

	return 0;
}

Measured memory_bytes: 3156
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int min = Integer.MAX_VALUE;
		int ans = Integer.MIN_VALUE;
		for(int i = 0;i < N;i++) {
			int a = scn.nextInt();
			ans = Math.max(ans, a - min);
			min = Math.min(min, a);
		}
		System.out.println(ans);
	}

}



Measured memory_bytes: 98776
n = int(input())
controller = [int(input()) for _ in range(n)]
seq = []
button = controller[0]
seq.append(1)

for i in range(n):
    if button == 2:
        print(len(seq))
        exit(0)
    button = controller[button - 1]
    seq.append(button)

print(-1)


Measured memory_bytes: 7840
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<Integer,List<Integer>> t = new HashMap<>();
        Map<Integer,List<Integer>> f = new HashMap<>();
        for(int i = 0;i < n;i++){
            int a = sc.nextInt();
            List<Integer> tt = new ArrayList<>();
            List<Integer> tf = new ArrayList<>();
            for(int j = 0;j < a;j++){
                int x = sc.nextInt();
                int y = sc.nextInt();
                if(y == 1){
                    tt.add(x - 1);
                }else{
                    tf.add(x - 1);
                }
            }
            t.put(i,tt);
            f.put(i,tf);
        }
        int result = 0;
        for(int i = 0;i < (1 << n);i++){
            boolean[] trust = new boolean[n];
            int ti = 0;
            for(int j = 0;j < n;j++){
                if((1 & i >> j) == 1){
                    trust[j] = true;
                    ti++;
                }else{
                    trust[j] = false;
                }
            }
            boolean flag = true;
            NEXT:
            for(int j = 0;j < n;j++){
                boolean trustable = trust[j];
                if(!trustable){
                    continue;
                }
                for(int tp : t.get(j)){
                    if(!trust[tp]){
                        flag = false;
                        break NEXT;
                    }
                }
                for(int fp : f.get(j)){
                    if(trust[fp]){
                        flag = false;
                        break NEXT;
                    }
                }
            }
            if(flag){
                if(result < ti){
                    result = ti;
                }
            }
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 38160
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q) ]
B = [K-Q]*N
for i in range(Q):
    B[A[i]-1] += 1
for i in range(N):
    if B[i] > 0:
        print("Yes")
    else:
        print("No")









Measured memory_bytes: 10472
import java.util.Scanner;
class Main 
{
  public static void main(String[] args) 
  {
    Scanner input=new Scanner(System.in);
    int a=input.nextInt();
    int b=input.nextInt();
    if(a>=1 && a<=100 && b>=1 && b<=100)
    {
      String temp=""+a+""+b;
      int c=Integer.parseInt(temp);
      Double d=Math.sqrt(c);
      int e = d.intValue();
      if(d==e)
      {
        System.out.println("Yes");
      }else
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 20948
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    ll x,y,z,k,A[1000],B[1000],C[1000],D[3000000],E[3000000];
    cin>>x>>y>>z>>k;
    rep(i,x) cin>>A[i];
    rep(i,y) cin>>B[i];
    rep(i,z) cin>>C[i];
    if(x*y<=3000){
        int d=0;
        rep(i,x)rep(j,y)rep(k,z) D[d]=A[i]+B[j]+C[k],d++;
        sort(D,D+d,greater<ll>());
        rep(i,k) cout<<D[i]<<endl;
    }
    else{
        int d=0,e=0;
        rep(i,x)rep(j,y) D[d]=A[i]+B[j],d++;
        sort(D,D+d,greater<ll>());
        rep(i,3000)rep(j,z) E[e]=D[i]+C[j],e++;
        sort(E,E+e,greater<ll>());
        rep(i,k) cout<<E[i]<<endl;
    }
}

Measured memory_bytes: 34944
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AizuRangeSumQuery solver = new AizuRangeSumQuery();
        solver.solve(1, in, out);
        out.close();
    }

    static class AizuRangeSumQuery {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int q = in.nextInt();

            int[] a = new int[n];
            int[] b = new int[4 * n];

            build(0, 0, n - 1, a, b);

            while (q-- != 0) {
                int o = in.nextInt();
                int l = in.nextInt() - 1;
                int r = in.nextInt() - 1;

                if (o == 0) {
                    update(0, 0, n - 1, l, r + 1, a, b);
                } else {
                    out.printf("%d\n", query(0, 0, n - 1, l, r, b));
                }
            }
        }

        private void build(int n, int s, int e, int[] a, int[] b) {
            if (s == e) {
                b[n] = a[s];
            } else {
                int m = (s + e) / 2;
                build(2 * n + 1, s, m, a, b);
                build(2 * n + 2, m + 1, e, a, b);

                b[n] = b[2 * n + 1] + b[2 * n + 2];
            }
        }

        private void update(int n, int s, int e, int idx, int val, int[] a, int[] b) {
            if (s == e) {
                a[idx] += val;
                b[n] += val;
            } else {
                int m = (s + e) / 2;
                if (s <= idx && idx <= m) {
                    update(2 * n + 1, s, m, idx, val, a, b);
                } else {
                    update(2 * n + 2, m + 1, e, idx, val, a, b);
                }

                b[n] = b[2 * n + 1] + b[2 * n + 2];
            }
        }

        private long query(int n, int s, int e, int l, int r, int[] b) {
            if (r < s || e < l) {
                return 0;
            } else if (l <= s && e <= r) {
                return b[n];
            } else {
                int m = (s + e) / 2;
                long s1 = query(2 * n + 1, s, m, l, r, b);
                long s2 = query(2 * n + 2, m + 1, e, l, r, b);

                return s1 + s2;
            }
        }

    }
}




Measured memory_bytes: 141056
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

const int mn = 5;
int ans[499][499];

int dx[2] = { 1,-1 };
int dy[2] = { -1,1 };
void solve() {
	int k; cin >> k;
	if (k <= 500) {
		cout << k << endl;
		rep(i, k) {
			rep(j, k) {
				if (j > 0)cout << " ";
				cout << i + 1;
			}
			cout << endl;
		}
		return;
	}
	int n = (k+3) / 4; n *= 2;
	cout << n << endl;
	rep1(i, n) {
		rep1(j, n) {
			if (j > 1)cout << " ";
			int u = (i + j) % n; if (u == 0)u = n;
			if (i % 2 == 0) {
				u += n;
				if (u > k)u -= n;
			}
			cout << u;
		}
		cout << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(9);
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 1152
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author ilyakor
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.nextInt();
      int m = in.nextInt();
      int a = in.nextInt();
      int b = in.nextInt();
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          int x = (j < a ? 0 : 1);
          if (i < b) {
            x = 1 - x;
          }
          out.print(x);
        }
        out.printLine();
      }
    }

  }

  static class OutputWriter {

    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
      for (int i = 0; i < objects.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(objects[i]);
      }
    }

    public void printLine(Object... objects) {
      print(objects);
      writer.println();
    }

    public void close() {
      writer.close();
    }

  }

  static class InputReader {

    private InputStream stream;
    private byte[] buffer = new byte[10000];
    private int cur;
    private int count;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public static boolean isSpace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int read() {
      if (count == -1) {
        throw new InputMismatchException();
      }
      try {
        if (cur >= count) {
          cur = 0;
          count = stream.read(buffer);
          if (count <= 0) {
            return -1;
          }
        }
      } catch (IOException e) {
        throw new InputMismatchException();
      }
      return buffer[cur++];
    }

    public int readSkipSpace() {
      int c;
      do {
        c = read();
      } while (isSpace(c));
      return c;
    }

    public int nextInt() {
      int sgn = 1;
      int c = readSkipSpace();
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res = res * 10 + c - '0';
        c = read();
      } while (!isSpace(c));
      res *= sgn;
      return res;
    }

  }
}



Measured memory_bytes: 41924