akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define INF 1e15
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef long long ll;
typedef pair<int, int> P;
#define END system("PAUSE");return 0
int a, b, c;
signed main() {
	cin >> a >> b >> c;
	cout << min(c, a + b +1) + b << endl;
	END;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int a;cin >> a;
	cout << 3*a*a << endl;
	return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <cstdio>
#define zero 100000
#define ll long long
using namespace std;

ll n,c;

ll sol[200010];
ll idx[200010];

ll sums[200010];

ll cost[200010];
ll nutr[200010];

int main()
{
    int i,j;
    cin>>n>>c;

    for(i=1;i<=n;i++)
        cin>>cost[i]>>nutr[i];

    sums[zero+1]=nutr[1]-cost[1];

    for(i=2;i<=n;i++)
        sums[zero+i]=sums[zero+i-1]+nutr[i]-cost[i]+cost[i-1];

    sums[zero-1]=nutr[n]-c+cost[n];

    for(i=2;i<=n;i++)
        sums[zero-i]=sums[zero-i+1]+nutr[n-i+1]+cost[n-i+1]-cost[n-i+2];

    for(i=1;i<=n;i++)
    {
        if( sums[zero+i] > sol[zero+i-1] )
        {
            sol[zero+i]=sums[zero+i];
            idx[zero+i]=i;
        }
        else
        {
            sol[zero+i]=sol[zero+i-1];
            idx[zero+i]=idx[zero+i-1];
        }
    }

    for(i=1;i<=n;i++)
    {
        if( sums[zero-i]>sol[zero-i+1])
        {
            sol[zero-i]=sums[zero-i];
            idx[zero-i]=n-i+1;
        }
        else
        {
            sol[zero-i]=sol[zero-i+1];
            idx[zero-i]=idx[zero-i+1];
        }
    }

    long long rez=-2;

    for(i=0;i<=n;i++)
    {
        rez=max(rez,1LL*sol[zero+i]);
        rez=max(rez,1LL*sol[zero+i]+sol[zero+i-n]- cost[idx[zero+i]] );
    }

    for(i=0;i>=-n;i--)
    {
        rez=max(rez,1LL*sol[zero+i]);
        rez=max(rez,1LL*sol[zero+i]+sol[zero+i+n] - c + cost[ idx[zero+i]] );
    }

    cout<<rez<<'\n';

    return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
 int n;
 cin >> n;
 VI a(n);
 rep(i,n){
     cin >> a.at(i);
 }
 sort(a.begin(),a.end());
 int ans=a.at(n-1)-a.at(0);
 cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int N=0;
    int X=0;
    int L[101]={0};
    int D=0;
    int count=0;
    scanf("%d %d",&N,&X);
    for(int i=0;i<N;i++){
        scanf("%d",&L[i]);
    }
    for(int i=0;i<N;i++){
        D=D+L[i];
        if(D>X) break;
        count++;
    }
    printf("%d\n",count+1);
    return 0;
}

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

int sum(int a) {
    int Tong = 0;
    while (a>=1 && a <= 10) {
for (int i = 1; i <=3; ++i ) {
    Tong += pow(a,i);
    }
    cout << Tong;
    break;
}
return 0;}

int main() {
int a;
cin >> a;
sum(a);
return 0;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    vector<ll> a(N+1);
    for (ll i = 1; i < N+1; i++) {
        cin >> a[i];
    }

    vector<ll> ans(N+1, 0);
    for (ll i = N; i >= 1; i--) {
        ll tmp = 0;
        for (ll j = 2; j*i <= N; j++) {
            tmp += ans[j*i];
        }
        if (tmp%2 != a[i]) {
            ans[i] = 1;
        }
    }

    ll cnt = 0;
    rep (i, N+1) {
        if (ans[i]) {
            cnt++;
        }
    }

    cout << cnt << endl;
    rep (i, N+1) {
        if (ans[i]) {
            cout << i << " ";
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        if (s.equals("AAA")) System.out.println("No");
        else if (s.equals("BBB")) System.out.println("No");
        else System.out.println("Yes");
    }
}

Measured memory_bytes: 21844
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (inline split-ints-into-vector))
(defun split-ints-into-vector (string dest-vector &key (offset 0) (key #'identity))
  (declare (string string)
           (function key)
           ((array * (*)) dest-vector)
           ((integer 0 #.most-positive-fixnum) offset))
  (loop with position = 0
        for idx from offset below (length dest-vector)
        do (setf (values (aref dest-vector idx) position)
                 (parse-integer string :start position :junk-allowed t))
           (setf (aref dest-vector idx) (funcall key (aref dest-vector idx)))
        finally (return dest-vector)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (x (read))
         (as (make-array n :element-type 'uint32))
         (table (make-array (list n n) :element-type 'uint32)))
    (declare (uint15 n)
             (uint31 x))
    (split-ints-into-vector (read-line) as)
    (dotimes (i n)
      (let ((min #xffffffff))
        (dotimes (j n)
          (let ((a (aref as (mod (- i j) n))))
            (when (< a min)
              (setf min a))
            (setf (aref table i j) min)))))
    (println
     (loop for j below n
           minimize (+ (* j x)
                       (loop for i below n
                             sum (aref table i j)
                             of-type fixnum))
           of-type fixnum))))

#-swank(main)


Measured memory_bytes: 27112
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int chk[105], length, result;
char S[15];

int main()
{
    chk['A'] = 1;
    chk['C'] = 1;
    chk['G'] = 1;
    chk['T'] = 1;
    scanf("%s", S);
    length = strlen(S);
    for(int i = 0; i < length; i++)
    {
        int count = 0;
        for(int j = i; j < length; j++)
        {
            if(chk[S[j]] != 1)
            {
                break;
            }
            count++;
            result = max(result, count);
        }
    }
    printf("%d", result);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<lint> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define N 1000000
int euler_phi(int n){
    int res = n;
    for (int i = 2; i * i <= n;i++){
        if(n%i==0){
            res = res / i * (i - 1);
            while(n%i==0){
                n /= i;
            }
        }
    }
    if(n!=1){
        res = res / n * (n - 1);
    }
    return res;
}
int main()
{
    vi sum(N + 1);
    sum[1] = 2;
    repi(i, 1, N)
    {
        sum[i + 1] = sum[i] +euler_phi(i+1);
    }
    int t;
    cin >> t;
    rep(i, t)
    {
        int n;
        cin >> n;
        cout << sum[n] << endl;
    }
    return 0;
}


Measured memory_bytes: 10564
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = []

for _ in range(m):
    bc.append(list(map(int,input().split())))

bc.sort(key=lambda x:(x[1]),reverse=True)

for b,c in bc:
    a.extend([c]*b)
    if len(a) > n*2:
        break
a.sort(reverse=True)
print(sum(a[:n]))

Measured memory_bytes: 34896
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

char** table;

void func(int height){

	for(int i = 0; i < height; i++){
		for(int k = 0; k <= 1049; k++)table[i][k] = '#';
	}

	int most_right = 0;

	for(int i = 0; i < height; i++){
		scanf("%s",table[i]);

		for(int k = 0;table[i][k] != '\0';k++){
			if(table[i][k] == '.' && table[i][k+1] != '\0' && table[i][k+1] != '.'){
				table[i][k] = '+';
				most_right = max(most_right,k);
				for(int p = 0; p < k; p++)table[i][p] = ' ';
				break;
			}
		}
	}


	int top,bottom;

	for(int col = 0; col <= most_right; col++){
		top = 0;
		while(true){
			for(;top <= height-1 && table[top][col] != '+';top++);
			if(top == height)break;

			for(bottom = top+1;bottom <=height-1 && table[bottom][col] == ' ';bottom++);
			if(bottom == height)break;

			if(table[bottom][col] == '+'){
				for(int i = top+1; i <= bottom-1; i++)table[i][col] = '|';
			}
			top = bottom;
		}
	}

	for(int i = 0; i < height; i++)printf("%s\n",table[i]);
}

int main(){

	table = new char*[1000];
	for(int i = 0; i < 1000; i++){
		table[i] = new char[1051];
	}

	int height;
	while(true){
		scanf("%d",&height);
		if(height == 0)break;

		func(height);
	}
	return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
int main(void){
int N,M,i;
int A[100];

int sum=0;
scanf("%d %d",&N,&M);


int b=0;

for(i=0;i<=N-1;i++){
scanf("%d",&A[i]);
sum+=A[i];
}

for(i=0;i<=N-1;i++){
if(A[i]*4*M>=sum){
	b++;
}
}

if(b>=M)
	printf("Yes");
else
    printf("No");  

return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
struct St {
	int l, r, num;
};
int a[N], c[N], ans[N], flag[N];
St ask[N];
int n;

int lowbit(int x) {
	return x & (-x);
}

void add(int x, int k) {
	while (x <= n) {
		c[x] += k;
		x += lowbit(x);
	}
}

int getsum(int x) {
	int ret = 0;
	while (x) {
		ret += c[x];
		x -= lowbit(x);
	}
	return ret;
}

bool cmp(St x, St y) {
	return x.r < y.r;
}

int main()
{
	int m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &ask[i].l, &ask[i].r);
		ask[i].num = i;
	}
	sort(ask, ask + m, cmp);
	int pos = 1;
	for (int i = 0; i < m; i++) {
		for (int j = pos; j <= ask[i].r; j++) {
			if (flag[a[j]])
				add(flag[a[j]], -1);
			add(j, 1);
			flag[a[j]] = j;
		}
		pos = ask[i].r + 1;
		ans[ask[i].num] = getsum(ask[i].r) - getsum(ask[i].l - 1);
	}
	for (int i = 0; i < m; i++) {
		printf("%d\n", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 17456
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	int p = a * b;
	if(p % 2 == 0) printf("Even\n");
	else printf("Odd\n");
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio (false);
	cout << fixed;
	cout.precision(10);
	if(fopen("joke.in", "r")){
		freopen ("joke.in","r",stdin);
		freopen ("joke.out","w",stdout);
	}

	int n;
	cin >> n;
	vector<long double> p(n + 1);
	for(int i = 1; i <= n; ++i){
		cin >> p[i];
	}

	// dp[i][j] - i coins so far and j heads
	vector<vector<long double>> dp(n + 1, vector<long double>(n + 1, 0.0));
	dp[1][0] = 1.0 - p[1];
	dp[1][1] = p[1];

	for(int i = 2; i <= n; ++i){
		for(int j = 0; j <= i; ++j){
			dp[i][j] = dp[i - 1][j] * (1.0 - p[i]);
			if(j > 0)
				dp[i][j] += dp[i - 1][j - 1] * p[i];
			
		}
	}

	long double res = 0.0;
	for(int i = n; i > n / 2; --i){
		//cout << dp[n][i] << endl;
		res += dp[n][i];
	}
	cout << res;
    return 0;
}


Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
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; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y, z;
    cin >> x >> y >> z;
    int ans = (x - z) / (y + z);
    cout << ans << endl;
}

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

using namespace std;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1000000007;

using ll = long long;

ll mod(ll a, ll b){return (a%b+b)%b;}
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);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    int n = s.size();

    bool a = n%2==0;
    bool b = s[0]==s[n-1];
    if(a^b) ppp("Second");
    else ppp("First");

    return 0;
}


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

template<typename T>
void print(const vector<T> &x) {
	int n = x.size();
	rep(i,n) {
		cout << x[i];
		if (i!=n-1) cout<<" ";
		else cout << endl;
	}
}

template<typename T>
void print(const vector<vector<T>> &x) {
	int n = x.size();
	rep(i,n) {
		rep(j,x[i].size()) {
			cout << x[i][j] << " ";
		}
		cout << endl;
	}
}

template<typename T>
void print(const vector<T> &x, int n) {
	rep(i,n) {
		cout << x[i];
		if (i!=n-1) cout<<" ";
		else cout << endl;
	}
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
	rep(i,n) {
		rep(j,m) {
			cout << x[i][j] << " ";
		}
		cout << endl;
	}
}

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


int main(int argc, char const *argv[]) {
	ll n; cin>>n;
	vector<P> cand;
	for (ll i = 1; i*i <= n; ++i) {
		if (n%i == 0) cand.emplace_back(i,n/i);
	}

	ll ans = LINF;
	for (auto &&e: cand) {
		ll tmp = (e.first-1ll)+(e.second-1ll);
		chmin(ans,tmp);
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> v(N);
    for(int i=0;i<N;i++){
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    cout<<v[v.size()/2] - v[v.size()/2 - 1]<<endl;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
int N, M;
VEC<int> A;
VEC<int> dp;
const int inf = 1e6;
const VEC<int> num = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

int main() {
  cin >> N >> M;

  A = VEC<int>(M);
  REP(i, 0, M) cin >> A[i];
  dp = VEC<int>(N + 1, -inf);
  dp[0] = 0;
  REP(i, 0, N + 1) {
    REP(j, 0, M) {
      int rem = i - num[A[j]];
      if (rem >= 0) {
        dp[i] = max(dp[i], dp[rem] + 1);
      }
    }
  }
  DUMP(dp);
  int ansketa = dp[N];
  string ans = "";
  int match = N;
  sort(A.rbegin(), A.rend());
  REP(i, 0, ansketa) {
    REP(j, 0, M) {
      // if A[j] is available, remain will be
      int ketaRemain = ansketa - i - 1;
      int matchRemain = match - num[A[j]];
      if (matchRemain >=0 && ketaRemain == dp[matchRemain]) {
        ans += A[j] + '0';
        match = matchRemain;
        DUMP(ans, A[j], match);
        break;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main(void){
    int H, N;
    cin >> H >> N;
    vector<int> dp(H + 1, INF);
    dp[0] = 0; 
    for(int i = 0; i < N; i++){
        int A, B;
        cin >> A >> B;
        for(int j = 1; j <= H; j++){
            int nj = max(j - A, 0);
            dp[j] = min(dp[j], dp[nj] + B);
        }
    }
    cout << dp[H] << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        System.out.println(n-k+1);


        sc.close();
    }
}

class io {
    public static void br() {
        System.out.println("");
    }

    public static void yesno(boolean f) {
        System.out.println(f ? "yes" : "no");
    }

    public static void YesNo(boolean f) {
        System.out.println(f ? "Yes" : "No");
    }

    public static void YESNO(boolean f) {
        System.out.println(f ? "YES" : "NO");
    }

}

class Algo {
    public static int nibutan(int target, int[] ar) {
        // ar[i] >= target なる最小のiを探す
        int res;
        int high = ar.length;
        int low = 0;
        while (high > low) {
            res = (high + low) / 2;
            if (ar[res] < target) {
                // ↑↓ここを変える
                low = res + 1;
            } else {
                // ↓ここを変える
                high = res;
            }
        }
        return low;
    }

    public static boolean isOdd(int n) {
        return n % 2 == 1;
    }

    public static boolean isEven(int n) {
        return n % 2 == 0;
    }


}



Measured memory_bytes: 23636
let n, m, x = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let a_s = Array.init m @@ fun _ -> Scanf.scanf " %d" (+) 0
let c = Array.fold_left (fun c a -> if a < x then c + 1 else c) 0 a_s
let _ = Printf.printf "%d\n" @@ min c @@ m - c

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

using namespace std;

int main() {
  int64_t N;
  cin >> N;

  vector<int64_t> vec(N);
  vector<int64_t> count(N);

  


  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
    /*for(int i=0;i<N;i++){
    cout << vec.at(i) <<endl;
  }*/

  for(int i=0;i<N;i++){
    while(vec.at(i)%2==0){
      count.at(i)++;
      vec.at(i)/=2;
    }
  }

    sort(count.begin(), count.end());
  cout << count.at(0) << endl;
}



Measured memory_bytes: 256
package main

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

func main() {
	scanInit()

	s := nextStr()

	cnt := 0
	cntmax := 0
	for i := 0; i < len(s); i++ {
		if s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T' {
			cnt++
			cntmax = max(cntmax, cnt)
		} else {
			cnt = 0
		}
	}

	fmt.Println(cntmax)

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

// ---- readfunc
var sc = bufio.NewScanner(os.Stdin)

func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}



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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 2019;
const int maxn = 1e6 + 5;



string s;
int n;

ll pw10[maxn];
ll dp[maxn];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    pw10[0]=1;
    for (int i=1; i<maxn; i++) {
	pw10[i]=(pw10[i-1]*10)%mod;
    }
    cin>>s;
    n=s.length();
    ll ans = 0;
    dp[0]=1;
    


    ll cur=0;
    for (int i=n-1; i>=0; i--) {
	cur += pw10[n-i-1]*(s[i]-'0')%mod;
	cur %= mod;
	ans += dp[cur];
	dp[cur]++;
    }


    cout<<ans<<endl;
  

    return 0;
}


Measured memory_bytes: 11624
#!ruby -pl
def f a
!a[2]&&a[0]==a[1]||a.combination(3).any?{|p|b,c,d=p.sort
(b==c&&c==d||b+1==c&&c+1==d)&&(e=a.dup;p.map{|i|e.delete_at(e.index i)};f(e))}end
$_=(d=(1..9).find_all{|i|(l=$_.chars.map(&:to_i)<<i).count(i)<5&&f(l)}*" ")>""?d:0

Measured memory_bytes: 6108
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first

#if MYDEBUG
#define DBG(...) {string dst__=#__VA_ARGS__;dbgsplit(dst__);stringstream dss__; dss__<<dst__; debug(dss__,__VA_ARGS__);}
#else
#define DBG(...)
#endif
void debug(stringstream& ds){cerr<<endl;return;}
template<typename F, typename... R>void debug(stringstream& ds,const F& f, const R&... r){string n; ds>>n; cerr<< n <<'='<<f<<' '; debug(ds,r...);}
void dbgsplit(string &s){int l=s.length(),n=0;for(int i=0; i<l; ++i){if(s[i]=='(')++n;if(s[i]==')')--n;if(s[i]==','&&!n)s[i]=' ';}}
using LL = long long;
constexpr long long LINF=334ll<<53; constexpr int INF=15<<26; constexpr long long MOD=1E9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long x,ans;
    cin >> x;
    ans=(x/11)*2;

    if(0<x%11 && x%11<=6)ans++;
    if(6<x%11) ans=ans+2;
    cout << ans <<endl;


    return 0;
}



Measured memory_bytes: 256
N,W = map(int,input().split())
w = []
v = []
for _ in range(N):
    weight,value = map(int,input().split())
    w.append(weight)
    v.append(value)
    
dp = [[0] * (W+1) for _ in range(N+1)] #dp[i+1][w]品物i番目までw以下になるように選んだ時の価値の最大値

for i in range(N):
    for sum_w in range(W+1):
        if sum_w -w[i]>= 0:
            dp[i+1][sum_w] = max(dp[i+1][sum_w],dp[i][sum_w-w[i]] + v[i])
        dp[i+1][sum_w] = max(dp[i+1][sum_w],dp[i][sum_w])
print(dp[N][W])

Measured memory_bytes: 121068
def main():
    from collections import deque
    import sys
    input = sys.stdin.readline

    N, M = map(int, input().split())

    g = tuple(set() for _ in range(N))
    for _ in range(M):
        x, y, _ = (int(x) - 1 for x in input().split())
        g[x].add(y)
        g[y].add(x)

    ans = 0
    checked = [False] * N
    for s in range(N):
        if checked[s]: continue
        checked[s] = True
        ans += 1

        dq = deque([s])
        while dq:
            v = dq.popleft()
            for u in g[v]:
                if checked[u]: continue
                checked[u] = True
                dq.append(u)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 49028
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll dp[1007][1007];

int main(){
  ll H,W;
  string S[1007];
  cin >> H >> W;
  rep(i,H){
    cin >> S[i];
  }
  Rep(i,1,H+1){
    Rep(j,1,W+1){
      if(i==1&&j==1){
        dp[i][j]=1;
      }
      else{
        if(S[i-1][j-1]=='.'){
          dp[i][j]=dp[i-1][j]+dp[i][j-1];
          dp[i][j]%=MOD;
        }
      }
    }
  }
  cout << dp[H][W] << endl;
}

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

int main() {
  long long a,b;
  cin>>a>>b;
  long long man=10000;
  long long gosen=5000;
  long long sen=1000;
  for(long long i=0;i<b/man+1;i++){
    for(long long j=0;j<b/gosen+1;j++){
      long long k=(b-man*i-gosen*j)/sen;
      if(k<0)break;
      if(man*i+gosen*j+k*sen>b)break;
      if(i+j+k==a&&man*i+gosen*j+k*sen==b){
        cout<<i<<" "<<j<<" "<<k<<" "<<endl;
        return 0;
      }
    }
  }
  cout<<"-1 -1 -1"<<endl;
  return 0;
}
        


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long A = long.Parse(str[0]);
		double B = double.Parse(str[1]);
		long C = (long)(B * 100 + 0.0001);
		long ans = A * C / 100;
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 18004
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005
template<typename T>inline T read(){
	T x=0;int f=1;char ch=getchar();
	for(;ch>'9'||ch<'0';f=ch=='-'?-1:1,ch=getchar());
	for(;ch<='9'&&ch>='0';x=x*10+ch-48,ch=getchar());
	return x*f;
}
int n,ans;
int a[maxn],b[maxn],c[29][maxn],d[maxn];
int main(){
	n=read<int>();
	for(int i=1;i<=n;i++)a[i]=read<int>();
	for(int i=1;i<=n;i++)b[i]=read<int>();
	for(int k=0;k<28;k++)
		if(!k)for(int i=1;i<=n;i++)c[k][i]=b[i]&(1<<k);
		else for(int i=1;i<=n;i++)c[k][i]=c[k-1][i]^(b[i]&(1<<k));
	for(int k=0;k<28;k++)std::sort(c[k]+1,c[k]+n+1);
	for(int k=1;k<=28;k++)
		for(int i=1;i<=n;i++){
			d[i]^=a[i]&(1<<k-1);
			int l=std::lower_bound(c[k-1]+1,c[k-1]+n+1,(1<<k)-d[i])-c[k-1];
			ans^=((n-l+1)%2)<<k;
		}
	for(int k=0,w,x,y,z;k<=28;k++){
		w=x=y=z=0;
		for(int i=1;i<=n;i++)if(a[i]&(1<<k))x++;else w++;
		for(int i=1;i<=n;i++)if(b[i]&(1<<k))z++;else y++;
		ans^=((1ll*w*z%2+1ll*x*y%2)%2)<<k;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define ms memset
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define lower_bound lb
#define upper_bound ub

int main()
{
    int n, k; cin >> n >> k;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
    int l = 0; int r = k;
    while (r < n){
        if (arr[r] > arr[l]) cout << "Yes" << '\n';
        else cout << "No" << '\n';
        l++; r++;
    }
    return 0;
}

Measured memory_bytes: 4044
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans=b;
    ans+=min(a+b+1,c);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<vector>
using namespace std;
#define PI acos(-1)
int main(){
    double r;
    double cum;
    cin>>r;
    cum=2*PI*r;
    printf("%.20f",cum);
    
    
    
    
    
    
}

Measured memory_bytes: 3780
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Scanner;

public class Main {
  static InputReader in;
  static PrintWriter out;

 


  static class Solution {
    void solve() throws IOException {
      int[] cnt = new int[26];
      char[] alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
                          'v','w','x','y','z'};
      Scanner sc = new Scanner(System.in);
      while (sc.hasNext()) {
        String word = sc.next(); 
        for (int i = 0; i < word.length(); i++) {
          for (int j = 0; j < 26; j++) {            
            if(alphabet[j] == word.toLowerCase().charAt(i)) {
              cnt[j]++;
            }
          }
        }
        
      }
      for (int i = 0; i < 26; i++) {
        out.println(alphabet[i] + " : " + cnt[i]);
      }
//      End solve()
    }
//    End Solution
}


  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}


  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;

    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }

    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }

    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken());
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }

    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }

  }

}

Measured memory_bytes: 28900
#!/usr/bin/python3
# coding: utf_8

shflst = []

while True:
    s = input()
    if s == "-":
        break
    else :
        time_input = int(input())

        for i in range(time_input):
            sp = int(input())
            s1=""
            s2=""
            s=s[sp:]+s[:sp]
        shflst.append(s)

for s in shflst:
    print(s)




Measured memory_bytes: 5604
from collections import deque
n=int(input())
graph=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1;b-=1
    graph[a].append(b)
    graph[b].append(a)
even=[]
odd=[]
ansl=[0]*n
nums=set([i for i in range(1,n+1)])
dist=[-1]*n
dist[0]=0
even.append(0)
D=deque([0])
while D:
    v=D.popleft()
    for i in graph[v]:
        if dist[i]!=-1:continue
        dist[i]=dist[v]+1
        D.append(i)
        if dist[i]%2:odd.append(i)
        else:even.append(i)
El=len(even)
Ol=len(odd)
if El <= Ol:
    if El <= n//3:
        for i in range(El):
            ansl[even[i]]=(i+1)*3
            nums.remove((i+1)*3)
        for i in range(Ol):
            ansl[odd[i]]=nums.pop()
    else:
        cnt=0
        while 3*cnt+2<=n:
            ansl[even[cnt]]=3*cnt+2
            ansl[odd[cnt]]=3*cnt+1
            nums.remove(3*cnt+2)
            nums.remove(3*cnt+1)
            cnt+=1
        for i in range(cnt,El):
            ansl[even[i]]=nums.pop()
        for i in range(cnt,Ol):
            ansl[odd[i]]=nums.pop()

if Ol < El:
    if Ol <= n//3:
        for i in range(Ol):
            ansl[odd[i]]=(i+1)*3
            nums.remove((i+1)*3)
        for i in range(El):
            ansl[even[i]]=nums.pop()
    else:
        cnt=0
        while 3*cnt+2<=n:
            ansl[odd[cnt]]=3*cnt+2
            ansl[even[cnt]]=3*cnt+1
            nums.remove(3*cnt+2)
            nums.remove(3*cnt+1)
            cnt+=1
        for i in range(cnt,Ol):
            ansl[odd[i]]=nums.pop()
        for i in range(cnt,El):
            ansl[even[i]]=nums.pop()
print(*ansl)

Measured memory_bytes: 66468
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = list(map(int,sys.stdin.readline().split()))
# a = [sys.stdin.readline() for _ in range(n)]
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
import sys,bisect,math
sys.setrecursionlimit(15000)

A,B,N = map(int,sys.stdin.readline().split())

x = min(N,B-1)
m = math.floor(A*x/B)-A*math.floor(x/B)
print(m)

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

int main(void){
  ll k; cin >> k;
  ll L;
  if(k % 2 == 0 || k %5 == 0){
    cout << -1 << endl;
    return 0;
  }
  if(k % 7 == 0){
    L = 9*k/7;
  }
  else{
    L=9*k;
  }
  ll prc = 10;
  for(int i = 1; i <= L; i++){
    if(prc % L == 1){
      cout << i << endl;
      return 0;
    }
    prc = (prc%L)*10;
  }
  return 0;
}


Measured memory_bytes: 3636
N = int(input())
A = list(map(int, input().split()))
ans = 0
flag = False
while True:
    for i in range(N):
        if A[i] % 2 != 0:
            flag = True
            break
        A[i] = A[i] // 2
    else:
        ans += 1
        if 0 in A:
            break
    if flag:
        break
print(ans)


Measured memory_bytes: 3060
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 1e6+1 , limit = 9*1e18 , MOD=1e9+7;
string binary(int n){bitset<60>b(n) ;string p =b.to_string();return p;}
int decimal(string n) { int dec_value = 0;  int base = 1;  for (int i = n.size() - 1; i >= 0; i--) { if (n[i] == '1') 
dec_value += base; base = base * 2; } return dec_value; } 
bool isPrime(int n){if (n <= 1) return false; if (n <= 3) return true;if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; }
int pow (int x, int n,int mod) {if (n == 0) return 1; int res = pow (x, n / 2,mod);res = (res * res) % mod;if (n % 2) res = (res * x ) % mod;return res;}

#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n';

int32_t main(){
    int ans = -1;
    for(int i=1;i<=5;i++)
    {
        int x;cin>>x;
        if(x == 0)ans=i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
// Problem : A - Number of Multiples
// Contest : AtCoder - AIsing Programming Contest 2020
// URL : https://atcoder.jp/contests/aising2020/tasks/aising2020_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int l, r, d;
	int ams = 0;
	cin >> l >> r >> d;
	FOR(i, l, r) {
		if (i % d == 0) ams++;
	}
	cout << ams;
	return 0;
}
 


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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

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

template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<ll>;
V(size_t) -> V<ll>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

int main(){

    ll N;
    cin >> N;

    for(ll n=1;n<=3500;n++){
        for(ll w=1;w<=3500;w++){
            ll A = N * n * w;
            ll B = 4*n*w - N*w - N*n;
            if(B != 0 and A%B==0){
                ll h = A/B;
                if(h>=0){
                    cout << h spa n spa w << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i)
#define mod 1e9 + 7
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	　　　　　 　 _... ..._
	　　　　　 , ´⌒ ⌒ヽ
	　　　 　 ﾉｨ（ノﾉ）ﾉ）ﾉ）
	　　　 　 （（q|.ﾟ ヮﾟﾉ|ﾊ
	　　　　　　△ﾑ,8ﾑﾌつ
	　　　　　/(ﾝ_/＿ヽ＼
	　　　　 ～～i_ﾌ_ﾌ～´
	*/
	string a, b, c;
	cin >> a >> b >> c;
	if (a[a.size() - 1] == b[0] and b[b.size() - 1] == c[0]) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
	return 0;
}
 

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

using namespace std;

typedef vector<bool> vb;
typedef vector<int> vi;

int main()
{
	int n;
  	cin >> n;
    
    vi a(n);
    for (int &x : a) cin >> x;

    vi dp(n, 0);
    for (int i = 1; i < n; ++i)
    {
        dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
        if (i > 1)
            dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]));
    }

    cout << dp[n - 1];
}

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

int main(){
  int G[101][101];
  int n,u,i,j,k,v;
  
  scanf("%d",&n);
  for(i=1;i<=n;i++) for(j=1;j<=n;j++) G[i][j]=0;
  
  for(i=1;i<=n;i++){
    scanf("%d%d",&u,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      G[u][v]=1;
    }
  }
  
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      printf("%d",G[i][j]);
      if(j!=n) printf(" ");
    }
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2088
a, b, k = map(int, input().split())
#%%
a_s = set(list(range(a, min(b+1, a+k))))
b_s = set(list(range(max(a, b-k+1), b+1)))
s_uni = b_s | a_s
print(*sorted(s_uni), sep='\n')

Measured memory_bytes: 3060
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <stack>
#define ll long long
using namespace std;


const int maxm = 550 * 550;
const int maxn = 1100;
struct EE
{
    int to,ne;
}e[2 * maxm];
int head[maxn],L,matc[maxn],N;
bool use[maxn];
void adde(int u,int v)
{
    e[L].to = v;
    e[L].ne = head[u];
    head[u] = L++;
}
bool check(int u)
{
    if (use[u]) return false;
    use[u] = true;
    for (int i = head[u]; i != -1; i = e[i].ne) {
        int v = e[i].to;
        if (matc[v] == u) continue;
        if (!use[v]) {
            use[v] = true;
            if (matc[v] == -1 || check(matc[v])) {
                matc[v] = u;
                matc[u] = v;
                return true;
            }
        }
    }
    return false;
}
int match()
{
    int ret = 0;
    memset(matc,-1,sizeof(matc));
    for (int u = 0; u < N; u++) {
        if (matc[u] != -1) continue;
        memset(use,0,sizeof(use));
        if (check(u))
            ret++;
    }
    return ret;
}
int n,m;
int main()
{
    scanf("%d%d",&n,&m);
    L = 0;
    for (int i = 0; i < n + m; i++)
        head[i] = -1;
    N = n + m;
    for (int i = 0; i < n; i++) {
        int k,a;
        scanf("%d",&k);
        for (int j = 0; j < k; j++) {
            scanf("%d",&a);
            adde(i,n + a);
            adde(n + a, i);
        }
    }
    if (match() == m)
        printf("Bob\n");
    else
        printf("Alice\n");
}

Measured memory_bytes: 5276