akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(void)
{
	int H,W,i,j;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0){
			break;
		}
		for(i=1;i<=H;i++){
			for(j=1;j<=W;j++){
				if(i%2==1 && j%2==0 || i%2==0 && j%2==1){
					printf(".");
				}else{
					printf("#");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

int gcd(int x, int y)
{
    if (x < y) {
        swap(x, y);
    }
    while (y > 0) {
        int tmp = x % y;
        x = y;
        y = tmp;
    }
    return x;
}

int main()
{
    int x, y;
    cin >> x >> y;

    cout << gcd(x, y) << endl;

    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vlll = vector<vll>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
//AtCoder以外ではコメントアウトを忘れずに！
//#include <atcoder/all>
//using namespace atcoder;
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, LIS, digitDP, treeDP, Rerooting//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA, FordFulkerson//
ll i, j, k, l; ll N, M, K, H, W, X, Y, Z, R, Q, T;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vl flag, D; vll path; vs S;
int main() {
	ll A, B, C, D;
	cin >> A >> B >> C >> D;
	ans = A * C;
	chmax(ans, A * D);
	chmax(ans, B * C);
	chmax(ans, B * D);
	co(ans);
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int f[100][10];
int p[100][11];

int main()
{
    int n;
    cin >> n;

    rep(i, n) rep(j, 10) cin >> f[i][j];
    rep(i, n) rep(j, 11) cin >> p[i][j];

    int ans = -1e9;

    for (int bit = 1; bit < (1 << 10); bit++)
    {
        int t[10] = {};
        for (int i = 0; i < 10; i++)
        {
            if (bit & (1 << i))
                t[i] = 1;
        }

        int sum = 0;
        rep(i, n)
        {
            int cnt = 0;
            rep(j, 10)
            {
                if (f[i][j] == 1 && t[j] == 1)
                    cnt++;
            }
            sum += p[i][cnt];
        }
        ans = max(ans, sum);
    }
    OP(ans);

    return 0;
}

/*int p[100][11];

int bitcount(int x)
{
    x = (x & 0x55555555) + (x >> 1 & 0x55555555);
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = (x & 0x0F0F0F0F) + (x >> 4 & 0x0F0F0F0F);
    x = (x & 0x00FF00FF) + (x >> 8 & 0x00FF00FF);
    x = (x & 0x0000FFFF) + (x >> 16 & 0x0000FFFF);

    return x;
}

int main()
{
    int n;
    cin >> n;

    int shop[100];

    rep(i, n)
    {
        bitset<10> a;
        rep(j, 10)
        {
            int d;
            cin >> d;
            a[j] = d;
        }
        stringstream ss;
        ss << a;
        string s = ss.str();
        shop[i] = stoi(s, 0, 2);
    }
    rep(i, n) rep(j, 11) cin >> p[i][j];

    int ans = -10e8;

    for (int i = 1; i <= 1023; i++)
    {
        int sum = 0;
        rep(j, n)
        {
            int cnt = bitcount(shop[j] & i);
            sum += p[j][cnt];
        }
        ans = max(ans, sum);
    }

    OP(ans);

    return 0;
}
*/

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

ans = 'APPROVED'
for a in A:
    if not a % 2:
        if (not a % 3) or (not a % 5):
            pass
        else:
            ans = 'DENIED'

print(ans)


Measured memory_bytes: 3064
strS = input()
strT = input()

strS = list(strS)
strT = list(strT)

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1

print(len(strT)-maxRange)


Measured memory_bytes: 9124
# https://github.com/cheran-senthil/PyRival/blob/master/pyrival/data_structures/SegmentTree.py
class SegmentTree:
    def __init__(self, data, default=0, func=max):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size : _size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        """func of data[start, stop)"""
        start += self._size
        stop += self._size

        res_left = res_right = self._default
        while start < stop:
            if start & 1:
                res_left = self._func(res_left, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res_right = self._func(self.data[stop], res_right)
            start >>= 1
            stop >>= 1

        return self._func(res_left, res_right)

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)


from collections import defaultdict


N, K, C = [int(x) for x in input().split()]
S = input()

# dp[i] stores max number of days worked including day i
dp = SegmentTree([0] * N, 0, max)
for i, x in enumerate(S):
    if x == "o":
        dp[i] = max(1, 1 + dp.query(0, max(0, i - C)))


if any(dp[i] > K for i in range(N)):
    # If it's possible to work more than K days, can always skip any day and still work K
    # No output
    print()
    exit()


#print([dp[i] for i in range(N)])


# Clear out day values that can't reach K
inf = float('inf')
dp2 = SegmentTree([0] * N, inf, min)
for i in range(N - 1, -1, -1):
    days = dp[i]
    if days < K and dp2.query(min(N, i + C + 1), N) != days + 1:
        dp2[i] = inf
    else:
        dp2[i] = days


# Any day values that appear only once is critical
groups = defaultdict(list)
for i in range(N):
    days = dp2[i]
    if days != 0:
        groups[days].append(i)

#print([dp2[i] for i in range(N)])
#print(groups)

mustWork = set()
for k, v in groups.items():
    if len(v) == 1:
        mustWork.update(v)

for i in range(N):
    if i in mustWork:
        print(i + 1)


Measured memory_bytes: 145940
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;



int main()
{
	int N;
	string s;
	cin >> N;
	cin >> s;

	vector <int> e(N+1);
	vector <int> w(N+1);

	for (int i = 0; i < N; ++i)
	{
		if (s[i] == 'W')
		{
			w[i + 1] = w[i] + 1;
			e[i + 1] = e[i];
		}
		else
		{
			e[i + 1] = e[i] + 1;
			w[i + 1] = w[i];
		}
	}

	int ans = BIG;

	for (int i = 0; i < N; ++i)
	{
		int sumw = w[i] - w[0];
		int sume = e[N] - e[i + 1];

		int tmp = sumw + sume;




		amin(ans, tmp);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3076
N = int(input())
A = list(map(int, input().split()))

A_list = [i for i in A if i % 2 == 0]


for i in A_list:
    if i % 3 == 0 or i % 5 == 0:
        pass

    else:
        print("DENIED")
        exit()

print("APPROVED")

Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
using namespace std;
int n,s,a[20],b;
main()
{
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b,s+=max(a[i]-b,0);
  cout<<s<<endl;
}

Measured memory_bytes: 256
/*
░░░░░░░░░░░░░░░░▄▄█▀▀██▄▄░░░░░░░
░░░░░░░░░░░░░▄█▀▀░░░░░░░▀█░░░░░░
░░░░░░░░░░░▄▀░░░░░░░░░░░░░█░░░░░
░░░░░░░░░▄█░░░░░░░░░░░░░░░█░░░░░
░░░░░░░██▀░░░░░░░▄▄▄░░▄░█▄█▄░░░░
░░░░░▄▀░░░░░░░░░░████░█▄██░▀▄░░░
░░░░█▀░░░░░░░░▄▄██▀░░█████░██░░░
░░░█▀░░░░░░░░░▀█░▀█▀█▀▀▄██▄█▀░░░
░░░██░░░░░░░░░░█░░█░█░░▀▀▄█▀░░░░
░░░░█░░░░░█░░░▀█░░░░▄░░░░░▄█░░░░
░░░░▀█░░░░███▄░█░░░░░░▄▄▄▄█▀█▄░░
░░░░░▀██░░█▄▀▀██░░░░░░░░▄▄█░░▀▄░
░░░░░░▀▀█▄░▀▄▄░▄░░░░░░░███▀░░▄██
░░░░░░░░░▀▀▀███▀█▄░░░░░█▀░▀░░░▀█
░░░░░░░░░░░░▄▀░░░▀█▄░░░░░▄▄░░▄█▀
░░░▄▄▄▀▀▀▀▀█▀░░░░░█▄▀▄▄▄▄▄▄█▀▀░░
░▄█░░░▄██▀░░░░░░░░░█▄░░░░░░░░░░░
█▀▀░▄█░░░░░░░░░░░░░░▀▀█▄░░░░░░░░
█░░░█░░░░░░░░░░░░░░░░░░█▄░░░░░░░*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define mp make_pair
const ll mod = 1000000007;
const ll nmax=2525*1001;
#define int ll
int n;
multiset<long double> s;
long double x;
     
int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
	cin>>n;
	for(int i=1; i<=n; i++){
		cin>>x;
		s.insert(x);
	}
	while(s.size()>1){
		long double xd1=*s.begin();
		s.erase(s.begin());
		long double xd2=*s.begin();
		s.erase(s.begin());
		s.insert((xd1+xd2)/2);
	}
	cout<<fixed<<setprecision(10)<<*s.begin();
}

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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define int long long

using namespace std;

const int N = 30005;

int n, u[N], sum = 0, m;

vector <int> ans;

main()
{
    cin >> n;
    m = n;
    if (n == 3)
    {
        puts("2 5 63");
        return 0;
    }
    ans.push_back(2);
    sum = 2;
    u[2] = 1;
    n--;
    for (int i = 30000; ; i -= 2)
    {
        if (n == 2)
        {
            sum -= ans.back();
            i = ans.back();
            u[i] = 0;
            ans.pop_back();
            while (u[i] || (sum + i) % 30 != 0)
                i -= 2;

            sum += i;
            u[i] = 1;
            ans.push_back(i);
            break;
        }
        sum += i;
        ans.pb(i);
        u[i] = 1;
        n--;

        if (i < 100 && n % 10 == 0)
        {
            sum -= ans.back();
            i = ans.back();
            u[i] = 0;
            ans.pop_back();
            while (u[i] || (sum + i) % 30 != 0)
                i -= 2;
            sum += i;
            u[i] = 1;
            ans.push_back(i);
            break;
        }
    }
    /***/
    sum = 0;
    for (int i = 30000; ; i -= 3)
    {
        if (u[i] || i % 2 == 0) continue;

        if (n == 0)
        {
            sum -= ans.back();
            i = ans.back();
            u[i] = 0;
            ans.pop_back();
            while (u[i] || (sum + i) % 30 != 0)
                i -= 3;

            sum += i;
            u[i] = 1;
            ans.push_back(i);
            break;
        }
        sum += i;
        ans.pb(i);
        u[i] = 1;
        n--;

        if (i < 500 && n % 6 == 0)
        {
            sum -= ans.back();
            i = ans.back();
            u[i] = 0;
            ans.pop_back();
            while (u[i] || (sum + i) % 30 != 0)
                i -= 3;

            sum += i;
            u[i] = 1;
            ans.push_back(i);
            break;
        }
    }
    /***/
    sum = 0;
    for (int i = 30000; ; i -= 5)
    {
        if (u[i]) continue;

        if (n == 0)
        {
            sum -= ans.back();
            i = ans.back();
            u[i] = 0;
            ans.pop_back();
            while (u[i] || (sum + i) % 30 != 0)
                i -= 5;

            sum += i;
            u[i] = 1;
            ans.push_back(i);
            break;
        }
        sum += i;
        ans.pb(i);
        u[i] = 1;
        n--;
    }
    int gcd = 0;
    sum = 0;
    assert(ans.size() == m);

    for (auto to : ans) sum += to, gcd = __gcd(to, gcd);

    assert( gcd == 1 );
    for (auto to : ans)
    {
        assert( __gcd( to, sum - to ) != 1 );
    }

    for (auto to : ans)
        cout << to << " ";
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main(void){
    string s;
    cin>>s;
    int n= s.size();
    vector <vector<int>> dp(100010 ,vector <int>(2 ));
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        if(s[i]=='0'){
            //dp[i+1][0] += dp[i][0];
            //dp[i+1][1] += dp[i][1]*3;
            dp[i+1][0] = dp[i][0];
        dp[i+1][1] = dp[i][1];
            (dp[i+1][1] += dp[i][1]*2 % mod) %= mod;
        }
        if(s[i]=='1'){
            /*dp[i+1][0] += dp[i][0]*2;
            dp[i+1][1] += dp[i][0];
            dp[i+1][1] += dp[i][1]*3;*/
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % mod;
            (dp[i+1][0] += dp[i][0]*2 % mod) %= mod;
        (dp[i+1][1] += dp[i][1]*2 % mod) %= mod;
        }
        dp[i+1][0] %= 1000000007;
        dp[i+1][1] %= 1000000007;
    }
    cout<<(dp[n][0]+dp[n][1])%1000000007<<endl;
}


Measured memory_bytes: 5760
# -*- coding: utf-8 -*-
#import sys

N = int(input().strip())
S_list = [input().strip() for _ in range(N)]
#-----

class Combination():
    def __init__(self):
        self._selected=[]
        self._all_pattern=[]
        
    def getPattern(self, arr :list, r :int) -> list:
        self._make(arr,r)
        return self._all_pattern
        
    def _make(self, arr :list, r :int):
        if r == 0:
            self._all_pattern.append(self._selected[:])
            return 
        
        for i in range(len(arr)):
            self._selected.append( arr[i] )
            r -= 1
            
            next_arr = arr[(i+1):]
            
            ans = self._make(next_arr,r)
            if ans == None:
                del self._selected[-1]
                r += 1
#-----

cnt_word = { w:0 for w in "MARCH"}

for words in S_list:
    key = words[0]
    if key in cnt_word:
        cnt_word[ words[0] ] += 1

comb = Combination()
pattern = comb.getPattern( list("MARCH"),3)

sum=0
for p1,p2,p3 in pattern:
    sum += cnt_word[p1] * cnt_word[p2] * cnt_word[p3]

print(sum)


Measured memory_bytes: 9776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}





int main(){
  ll K;
  cin >> K;
  vector<ll> ans,x;
  FOR(i,1,10)x.push_back(i);
  FOR(i,1,10)ans.push_back(i);
  FOR(i,0,1000){
    vector<ll> tmp;
    for(auto a:x){
      ll n = a%10;
      if(n-1>=0){
        tmp.push_back(a*10+n-1);
        ans.push_back(a*10+n-1);
      }
      if(n+1<10){
        tmp.push_back(a*10+n+1);
        ans.push_back(a*10+n+1);
      }
      tmp.push_back(a*10+n);
      ans.push_back(a*10+n);
    }
    x = tmp;
    if(x.size()>K)break;
  }
  SORT(ans);
  cout << ans[K-1] << endl;
}




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

#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define endl "\n"

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

int main()
{
    IOS
    ll t,n,i,k,a,b,c;
    string s;
    cin>>a>>b>>c;
    cin>>k;

    for(i = 0; i < k; i++)
    {
         if(a<b)
         {
              c*=2;
         }
         else
          b*=2;
    }

    if(a<b && b < c)
     cout<<"Yes\n";
    else
     cout<<"No\n";




    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
    int N, A, B;
    string S;
    cin >> N >> A >> B >> S;

    int cnt = 0, bcnt = 0;
    rep(i, S.size()) {
        if (S[i] == 'a') {
            if (cnt < A + B) {
                cout << "Yes";
                cnt++;
            } else
                cout << "No";
        } else if (S[i] == 'b') {
            if (cnt < A + B && bcnt < B) {
                cout << "Yes";
                cnt++, bcnt++;
            } else
                cout << "No";
        } else
            cout << "No";
        cout << "\n";
    }

    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
	int n, y;
	cin >> n >> y;
	
    for (int a = 0; a <= n; a++) {
        for (int b = 0; b <= n - a; b++) {
            int c = n - (a + b);
            
            if(10000*a + 5000*b + 1000*c == y) {
                printf("%d %d %d\n", a, b, c);
                return 0;
            }
            
        }
    }
    
    printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 256
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = [0]*(n+1)
    b = list(map(int, input().split()))
    for i in range(n):
        if a[i]-ans[i] >= b[i]:
            ans[i] += b[i]
        else:
            k = ans[i]
            ans[i] += a[i]-k
            rest = b[i] - a[i] + k
            ans[i+1] += min(rest,a[i+1])
    print(sum(ans))

if __name__=="__main__":
    main()


Measured memory_bytes: 96444
/*
ID: jerrywcy
TASK: AtCoder Beginner Contest 107 Problem C
LINK: https://abc107.contest.atcoder.jp/tasks/abc107_c
LANG: C++
*/
#include <bits/stdc++.h>

using namespace std;

int n,k;
long long x[100010];
long long ans=1000000000;

int main() {
	int n,k;
	cin>>n>>k;
	int i;
	for (i=1;i<=n;i++)cin>>x[i];
	
	for (i=1;i<=n-k+1;i++) {
		long long d=x[i]-x[i+k-1];
		ans=min(ans,(long long)(min(fabs(x[i]),fabs(x[i+k-1]))+fabs(d)));
	}
 
 	cout<<ans<<endl;
 
	return 0;
}

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

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

const int INF = 1000000007;

int main(){
	int n,m; cin>>n>>m;
	int a[210000]={0}, b[210000]={0};
	int arr[210000]={0};
	bool possible = false;
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i];
		if(a[i]==1){
			arr[b[i]-1] = 1;
		}
	}

	for(int i=0;i<m;i++){
		if(b[i]==n && arr[a[i]-1]==1) possible = true;
	}

	if(possible) cout<< "POSSIBLE" <<endl;
	else cout<< "IMPOSSIBLE" <<endl;

	return 0;
}

Measured memory_bytes: 2688
#include<stdio.h>
int fib[45];
 
int fibonacci(int n){
  int f;  
  if(fib[n] != NULL) return fib[n];
  f = fibonacci(n-1)+fibonacci(n-2);
  fib[n] = f;
  return f;
}
 
int main(){
  int n;
  fib[0] = 1;
  fib[1] = 1;
  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <limits>

using namespace std;

struct Item {
    int weight, value;
};

int main() {
    ios::sync_with_stdio(false);

    int N, W; cin >> N >> W;

    vector<Item> items(N);
    int total_value = 0;
    for (int i = 0; i < N; ++i) {
        cin >> items[i].weight >> items[i].value;
        total_value += items[i].value;
    }

    vector<int64_t> best(total_value + 1, numeric_limits<int64_t>::max() / 2);
    best[0] = 0;

    for (int i = 0; i < N; ++i) {
        for (int j = total_value - items[i].value; j >= 0; --j)
            best[j + items[i].value] = min(best[j + items[i].value], best[j] + items[i].weight);
    }

    int answer = 0;
    for (int i = total_value; i >= 0; --i)
        if (best[i] <= W) {
            answer = i;
            break;
        }

    cout << answer << "\n";
}


Measured memory_bytes: 1024
def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    # 「次のマス以上」が今何回続いているか
    cnt=0
    # 「次のマス以上」が最高で何回続いたか
    cntmax=0
    for i in range(n-1):
        if l[i]>=l[i+1]:
            # 「次のマス以上」だったらcntを増やして、次より大きいが何回続いているかを記録
            cnt+=1
            if i==n-2:
                cntmax=max(cnt,cntmax)
        else:
            # 次のマス未満だったら、それまでのcntとcntmaxを比べてカウント最高値を記録する
            # cntを０にして振り出しに戻す
            cntmax=max(cnt,cntmax)
            cnt=0
    print(cntmax)
resolve()

Measured memory_bytes: 14252
/*
	Author: Dinesh Verra
	College: ABV-IIITM
	Date: 20/06/2020
*/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision; 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define cu continue
#define br break
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define F first
#define S second
#define vll vector <ll>
#define vpll vector <pll>
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define all(v) v.begin(),v.end()
#define nl cout<<'\n'

template <typename A1>
void prn(A1&& arg)
{
	cout<<arg<<'\n';
}
template <typename A1, typename... A>
void prn(A1&& arg, A&&... args)
{
	cout<<arg<<' ';
	prn(args...);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n;
	cin>>n;
	string s="";
	while(n>0)
	{
		n--;
		s+=(char)('a'+(n%26));
		n/=26;
	}
	reverse(all(s));
	cout<<s<<'\n';
}



Measured memory_bytes: 3652
#include<cstdio>


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		int ans=0;

		for(int i=1;i<=n;i+=2)
		{
			int c=0;
			for(int j=1;j<=i;j++)
			{
				if(i%j==0) c++;
			}
			if(c==8)
			{
				ans++;
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
  int N;
  int ans;
  cin >> N;
  ans=(N+1)*(N/2);
  if(N%2==1){
    ans+=N/2+1;
  }
  if(N==1){
    ans=1;
  }
  cout << ans;
  return 0;
}
    

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

#define rep(i,s,t) for(int i = s; i <= t; ++ i)
#define reep(i,s,t) for(int i = s; i >= t; -- i)
const int MaxN = 100050;
const int Mod = 1e9+7;
const int inf = 1<<30;

int N, T[MaxN], A[MaxN];
int w1[MaxN], w2[MaxN];
int r1[MaxN], r2[MaxN];
int x[MaxN], y[MaxN];
long long ans = 1;

int main()
{
	scanf("%d",&N);
	rep(i,1,N) scanf("%d",&T[i]);
	rep(i,1,N) scanf("%d",&A[i]);
	w2[1] = w1[1] = T[1]; r1[N] = r2[N] = A[N];
	rep(i,2,N) 
		if(T[i] != T[i-1]) w1[i] = w2[i] = T[i];
		else w1[i] = 1, w2[i] = T[i];
	reep(i,N-1,1)
		if(A[i] != A[i+1]) r1[i] = r2[i] = A[i];
		else r1[i] = 1, r2[i] = A[i];
	rep(i,1,N) x[i] = max(w1[i], r1[i]), y[i] = min(w2[i], r2[i]);
	rep(i,1,N) 
		if(x[i] > y[i]) {puts("0"); return 0;}
		else ans = (ans * (long long)(y[i]-x[i]+1)) % Mod;
	cout << ans;
}

Measured memory_bytes: 3328
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B = map(int, readline().split())
    print((A+B+1)//2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9088
mod = 1000000007
H, W, A, B = map(int, input().split())
import sys
sys.setrecursionlimit(10000)
factorial = [1]
for n in range(1, H+W):
    factorial.append(factorial[n-1]*n % mod)

def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return (power(x, y//2)**2) % mod
    else:
        return (power(x, y//2)**2 * x) % mod
inverseFactorial = [0 for i in range(H+W)]
inverseFactorial[H+W-1] = power(factorial[H+W-1], mod-2)
for n in range(H+W-2, -1, -1):
    inverseFactorial[n] = (inverseFactorial[n+1] * (n+1) )% mod

def combi(n, m):
    return (factorial[n] * inverseFactorial[m] * inverseFactorial[n-m] )% mod
 
sum = 0
for i in range(B+1, W+1):
    sum = (sum + combi(H-A-1+i-1, i-1) * combi(A-1+W-i, W-i)) % mod
print(sum)

Measured memory_bytes: 63856
#include <iostream>

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

int main() {
    int n;
    cin >> n;

    int x[n];
    rep(i,n) {
        cin >> x[i];
    }

    int mini;
    for (int i = 1; i <= 100; i++) {
        int tmp = 0;
        rep(j, n) {
            tmp += (x[j] - i) * (x[j] - i);
        }
        if (tmp < mini || i == 1) {
            mini = tmp;
        }
    }

    cout << mini << endl;
    return 0;
}


Measured memory_bytes: 256
import math
a,b,h,m=map(int,input().split())
#coss=math.cos(math.radians(30))
#c=a**2+b**2-2*b*a*coss

t=h*30+0.5*m
s=m*6

coss=math.cos(math.radians(t-s))
c=a**2+b**2-2*b*a*coss
print(c**0.5)



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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, 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 GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

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

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int r; cin >> r; cout << r * r << endl;
} 

Measured memory_bytes: 256
def main():
    N = int(input())
    x_y_h = [tuple(map(int, input().split())) for _ in range(N)]

    cx, cy, H = solve(x_y_h)
    print(cx, cy, H)


def height(cx, cy, x_y_h):
    for x, y, h in x_y_h:
        if h <= 0:
            continue
        return h + abs(x - cx) + abs(y - cy)
    return 0


def valid(cx, cy, H, x_y_h):
    for x, y, h in x_y_h:
        if h != max(H - abs(x - cx) - abs(y - cy), 0):
            return False
    return True


def solve(x_y_h):
    for cx in range(101):
        for cy in range(101):
            try_H = height(cx, cy, x_y_h)
            if valid(cx, cy, try_H, x_y_h):
                return cx, cy, try_H
    return 0, 0, 0


main()


Measured memory_bytes: 3064
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))
#define PB push_back
#define MP make_pair

using namespace std;

const double eps = 1e-8;

typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;

int main() {
    int n = 0;
    vector<int> nums{}, sorted_nums{};
    cin >> n;
    for (int i = 0, t = 0; i < n; ++i) {
        cin >> t;
        nums.push_back(t);
    }
    sorted_nums = nums;
    sort(sorted_nums.begin(), sorted_nums.end());
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (sorted_nums[i] != nums[i]) ++cnt;
    }
    string ans = cnt <= 2 ? "YES" : "NO";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && B == C) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	string c;
	cin>>c;
	ll cr=0,cw=0;
	for(ll i=0;i<n;i++){
		if(c[i]=='R') cr++;
		else cw++;
	}
	ll ans=0;
	for(ll i=0;i<cr;i++){
		if(c[i]!='R') ans++;
	}
	ans = min(ans , min(cw,cr));
	cout<<ans;
	
	
	
	return 0;
}

Measured memory_bytes: 3772
#include <iostream>
using namespace std;
int main(void){
   int a,b,c;
   cin>>a>>b>>c;
   if(a==b&&b==c){
       cout<<1<<endl;
   }
   else if(a!=b&&a!=c&&b!=c){
       cout<<3<<endl;
   }
   else{
       cout<<2<<endl;
   }
    
}


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

//template
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define repr(i,n) for(ll i=n;i>0;i--)
#define all(v) v.begin(),v.end()
#define in cin>>
#define out cout<<
#define en <<endl
const ll INF = 10000000000000;

int main()
{
	ll a, b, c;
	in a >> b >> c;
	if (a < b && b < c)
	{
		out "Yes" en;
	}
	else
		out "No" en;
}



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

int main() {
	int H;
	cin >> H ;
	int i=1;
	for (;;i++) {
		if ((i *(i + 1) / 2) >= H && (i*(i - 1) / 2) <= H)
			break;
	}
	printf("%d\n", i);
	
	return 0;
}



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

long long N, K, Q;
long long A[100005];

int main(){
	cin >> N >> K >> Q;
	for(long long i = 0; i < N; i++){
		A[i] = K - Q;
	}

	for(long long i = 0; i < Q; i++){
		long long tmp;
		cin >> tmp;tmp--;
		A[tmp]++;
	}

	for(long long i = 0; i < N; i++){
		if(A[i] <= 0){
			cout << "No" << endl;
		} else {
			cout << "Yes" << endl;
		}
	}
}

Measured memory_bytes: 1408
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      h: usize,
      w: usize,
      mut a: usize,
      mut b: usize,
    }

    if (w+1)/2 <= a {
        return puts!("{}\n", "No");
    }

    if (h+1)/2 <= b {
        return puts!("{}\n", "No");
    }
    let mut ans = vec![vec![0; w]; h];

    let mut v = 0;

    for i in 0..h {
        if i >= b {
            v = 1;
        }
        for j in 0..w {
            if j < a {
                ans[i][j] = v;
            } else {
                ans[i][j] = 1 - v;
            }
        }
    }

    for i in 0..h {
        for j in 0..w {
            puts!("{}", ans[i][j]);
        }
        puts!("\n");
    }
}


Measured memory_bytes: 9340
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

ss = list(input()[:-1])

ss.sort()

aaa = s(ss)

ima = set()

for i in aaa:
    ima.add(i[0])

data = "qwertyuiopasdfghjklzxcvbnm"

se = set()
for i in data:
    se.add(i)
ans = se - ima

ans = sorted(list(ans))

if len(ans) == 0:
    print("None")
else:
    print(ans[0])

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

const int MAX_N = int(2e5) + 10;

int n, a, b, c, d;
char s[MAX_N];

int main() {
	scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
	scanf("%s", s + 1);
	if (c < d) {
		for (int i = a; i < d; ++i) {
			if (s[i] == '#' && s[i + 1] == '#') {
				puts("No");
				return 0;
			}
		}
		puts("Yes");
		return 0;
	} else {
		for (int i = a; i < c; ++i) {
			if (s[i] == '#' && s[i + 1] == '#') {
				puts("No");
				return 0;
			}
		}
		for (int i = b; i <= d; ++i) {
			if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
				puts("Yes");
				return 0;
			}
		}
		puts("No");
	}
}

Measured memory_bytes: 3944
n,k = map(int,input().split())
a=[]
for i in range(k):
    d = int(input())
    a.append(list(map(int,input().split())))

ans = [i for i in range(1,n+1)]
for i in a:
    for j in i:
        if j in ans:
            ans.remove(j)

print(len(ans))

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

// https://atcoder.jp/contests/abc125/tasks/abc125_d
namespace DFlippingSigns
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力の取得
            var n = int.Parse(Console.ReadLine());
            var inputNums = Console.ReadLine().Split().Select(long.Parse).ToArray();
            
            // 任意回の操作を行えば、負の数が偶数個ならば全て正の数に奇数個ならば1つ以外正の数にできる
            // ただし、1つでも0が含まれれば、全ての数字を正の数にすることができる
            var negativeCount = inputNums.Count(num => num < 0);
            var absNums = inputNums.Select(Math.Abs).ToArray();
            var minAbsNum = absNums.Min();

            var sum = absNums.Sum();
            if (negativeCount % 2 != 0 && minAbsNum != 0)
            {
                sum -= minAbsNum * 2;
            }

            // 解答の出力
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 31196
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

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

int main() {

  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];

  sort(a, a+n);

  for(int i=0; i<n-1; ++i) {
    if(a[i]==a[i+1]) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 1024
{
  const run = (input: string) => {
    const list = input.trim().split("\n").map(v => parseInt(v))
    let index = 1
    const used = {}
    while (true) {
      index = list[index]
      if (index === 2) {
        return Object.keys(used).length + 1
      }

      if (used[index] === 1) {
        return -1;
      }
      used[index] = 1
    }
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)
#define fi first
#define se second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> H(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &H[i]);
  }

  sort(all(H));
  K = max(0LL, N - K);
  ll total = accumulate(begin(H), begin(H) + K, 0LL);
  put(total);

  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

template <class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


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

int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q; cin >> n >> q;
	set<pair<int, int>> se[2];
	se[0].insert({n, n});
	se[1].insert({n, n});
	while (q--) {
		int ty, i; cin >> ty >> i;
		ty--;
		auto it = se[ty].lower_bound({i, -1});
		int k = (*it).second;
		se[ty ^ 1].insert({(k - 1), i});
	}
	long long ans = 1LL * (n - 2) * (n - 2);
	for (int i = 0; i < 2; i++) {
		for (auto x: se[i]) {
			if (x.second != n) ans -= x.first - 1;
		}
	}	
	cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 12944
using System;

namespace ITP1_5_B
{
    class Program
    {
        static void Main()
        {
            while (true)
            {
                string[] x = Console.ReadLine().Split(' ');
                int h = int.Parse(x[0]);
                int w = int.Parse(x[1]);
                
                if (h == 0 && w == 0) break;
                
                for (int i = 0; i < w; i ++)
                {
                    Console.Write("#");
                }
                Console.WriteLine();
                
                for (int j = 0; j < h - 2; j ++)
                {
                    Console.Write("#");
                    for (int k = 0; k < w - 2; k ++)
                    {
                        Console.Write(".");
                    }
                    Console.WriteLine("#");
                }
                
                for (int l = 0; l < w-1; l ++)
                {
                    Console.Write("#");
                }
                Console.WriteLine("#");
                Console.WriteLine();
            }
        }
    }
}


Measured memory_bytes: 15908
#include <stdio.h>
#include <stdlib.h>

#define MAX 8

int max[MAX]={
	0,
	0,
	10,
	100,
	1000,
	10000,
	100000,
	1000000,
};

int main(){
	int a,b,c;
	int i;
	
	while(scanf("%d%d",&a,&b)==2){
		c=a+b;
		for(i=MAX-1;i>=0;i--){
			if(c>=max[i]){
				break;
			}
		}
		putchar('0'+i);
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 2016