akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<utility>
#include<sstream>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 1005;
int a[1005][1005];
int x[20], y[20];
int ans, w, h, n;
bool leap[1005][1005];
int dir[4][2] = { 1, 0, -1, 0, 0, 1, 0, -1 };
struct Node
{
	int x, y, t;
	Node(int x, int y, int t) :x(x), y(y), t(t){}
};
int work(int xx, int yy, int pos)
{
	memset(leap, false, sizeof(leap));
	leap[xx][yy] = 1;
	queue<Node>p;
	p.push(Node(xx, yy, 0));
	while (p.size())
	{
		Node temp = p.front();
		p.pop();
		for (int i = 0; i < 4; i++)
		{
			int tempx = temp.x + dir[i][0];
			int tempy = temp.y + dir[i][1];
			if (tempx >= 1 && tempx <= h&&tempy >= 1 && tempy <= w)
			{
				if (a[tempx][tempy] == 1)continue;
				if (leap[tempx][tempy] == 1)continue;
				if (tempx == x[pos + 1] && tempy == y[pos + 1])
				{
					return temp.t + 1;
				}
				leap[tempx][tempy] = 1;
				p.push(Node(tempx, tempy, temp.t + 1));
			}
		}
	}

}
int main()
{
#ifdef LOCAL
	freopen("C:\\Users\\ΡΡ\\Desktop\\in.txt", "r", stdin);
	//freopen("C:\\Users\\ΡΡ\\Desktop\\out.txt","w",stdout);
#endif // LOCAL
	while (scanf("%d%d%d", &h, &w, &n) != EOF)
	{
		char s[1005];
		for (int i = 1; i <= h; i++)
		{
			scanf("%s", s);
			for (int j = 1; j <= w; j++)
			{
				if (s[j - 1] == '.')
					a[i][j] = 0;
				else if (s[j - 1] == 'X')
					a[i][j] = 1;
				else if (s[j - 1] == 'S')
				{
					x[0] = i; y[0] = j;
					a[i][j] = 0;
				}
				else
				{
					a[i][j] = 0;
					int id = s[j - 1] - '0';
					x[id] = i; y[id] = j;
				}
			}
		}
		ans = 0;
		for (int i = 0; i < n; i++)
		{
			ans = ans + work(x[i], y[i], i);
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 6132
import bisect

n, m, k = map(int, input().split())
INF = 10**18
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cum_a = [0] * (n+1)
cum_b = [0] * (m+1)
for i in range(n):
    cum_a[i+1] = cum_a[i] + A[i]
for i in range(m):
    cum_b[i+1] = cum_b[i] + B[i]
INF = 10**18
ans = -INF
for i in range(n+1):
    mod = k - cum_a[i]
    b = bisect.bisect(cum_b, mod)
    if b == 0:
        ans = max(ans, i)
        break
    ans = max(ans, b+i)
print(ans-1)


Measured memory_bytes: 47364
n=int(input())
h=list(map(int,input().split()))
ans=0

for i in range(max(h)):
  if h[0]>0:
    flag=1
    ans+=1
  else:
    flag=-1
  h[0]-=1
  for j in range(1,n):
    if h[j]>0:
      if flag==-1:
        ans+=1
        flag=1
    else:
      flag=-1
    h[j]-=1
print(ans)
       

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int N;
    cin >> N;
    int res = 0;
    rep(i, 1, N+1) {
        if (i % 2 == 0) continue;
        int ndiv = 0;
        rep(j, 1, i+1) {
            if (i % j == 0) ndiv++;
        }
        if (ndiv == 8) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int k = in.nextInt();
        int s = in.nextInt();

        int c = 0;
        for (int i = 0; i <= k; i++) {
            for (int j = 0; j <= k; j++) {
                if (s >= i + j && s - (i + j) <= k) {
                    c++;
                }
            }
        }

        out.println(c);
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

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

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

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

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

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

void swap()
{
  int a, b, c, temp;
  temp = 0;

  cin >> a >> b >> c;

  temp = b;
  b = a;
  a = temp;

  temp = c;
  c = a;
  a = temp;

  cout << a << " " << b  << " " << c << endl;
}

int main()
{
   swap();
}


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

int n;
int a[112];

int main(){
    ios_base::sync_with_stdio(0);
    //freopen("input.txt","r",stdin);

    cin>>n;
    bool ok=true;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2==0&&!(a[i]%3==0)&&!(a[i]%5==0))ok=false;
    }
    cout<<(ok?"APPROVED":"DENIED");
}


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

int main(){
	vector<string> s(3);
  	for(auto&& u:s)cin>>u;
    vector<int> t(3,0);
  //	rep(i,3)t[i]=s[i].size();
  
  int x=0;
  while(t[x]<s[x].size()){
  t[x]++;
  x=s[x][t[x]-1]-'a';  
  }
  cout<<"ABC"[x]<<endl;
  
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline

d = []
ABC = []

sys.setrecursionlimit(10 ** 8)


def solve(i, dis):
    global d
    global ABC
    d[i] = dis

    for n, c in ABC[i]:
        if d[n] == -1:
            solve(n, dis + c)


def main():
    N = int(input())
    global ABC
    ABC = [[] for _ in range(N + 1)]
    global d
    d = [-1] * (N + 2)
    for _ in range(N - 1):
        a, b, c = [int(x) for x in input().split()]
        ABC[a - 1].append([b - 1, c])
        ABC[b - 1].append([a - 1, c])

    Q, K = [int(x) for x in input().split()]

    solve(K - 1, 0)

    for _ in range(Q):
        x, y = [int(x) for x in input().split()]
        print(d[x - 1] + d[y - 1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 138032
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

// Bの先頭がX, 末尾がYであるものの個数
lint memo[300][300];

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

    for(lint i=1; i<=n; i++) {
        string si = to_string(i);
        if(si[0] == '0' || si.back() == '0')  continue;
        memo[si[0]][si.back()]++;
    }

    lint ans = 0;
    for(lint i=1; i<=n; i++) {
        string si = to_string(i);
        if(si[0] == '0' || si.back() == '0')  continue;
        ans += memo[si.back()][si[0]];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from itertools import permutations
 
def warshall_floyd(conn):
    n = len(conn)
    dp = [[v for v in A] for A in conn]
    for k in range(n):
        for i in range(n):
            for j in range(n):
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
    return dp
 
 
def solve(N: int, M: int, R: int, r: "List[int]", A: "List[int]", B: "List[int]", C: "List[int]"):
    conn = [[float('inf') for _ in range(N)] for _ in range(N)]
    for i in range(N):
        conn[i][i] = 0
    for j in range(M):
        a = A[j] - 1
        b = B[j] - 1
        conn[a][b] = min(conn[a][b], C[j])
        conn[b][a] = min(conn[b][a], C[j])
    dp = warshall_floyd(conn)
    #print(dp)
    ret = float('inf')
    perms = list(permutations(list(range(R))))
    for order in perms:
        tmp = 0
        for i in range(R - 1):
            s = r[order[i]] - 1
            t = r[order[i + 1]] - 1
            #print(r[s], r[t], dp[s][t])
            tmp += dp[s][t]
        ret = min(ret, tmp)
    print(ret)
    return
 
 
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    r = [ int(next(tokens)) for _ in range(R) ]  # type: "List[int]"
    A = [int()] * (M)  # type: "List[int]" 
    B = [int()] * (M)  # type: "List[int]" 
    C = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
        C[i] = int(next(tokens))
    solve(N, M, R, r, A, B, C)
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 63708
def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()

Measured memory_bytes: 21788
s = input()
t = input()
minr = len(t)
s_t_d = len(s) - len(t)
for i in range(s_t_d + 1):
    cnt = 0
    for ss, ts in zip(s[i:i + len(t)], t):
        if ss != ts:
            cnt += 1
    minr = min(minr, cnt)
print(minr)



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

#define int long long int
#define MOD 1000000007
#define N 100001
#define pii pair<int,int>
#define MAX 1000000000000000000
#define _mp make_pair
#define pb push_back
#define _sort(v) sort(v.begin(),v.end())
#define _rsort(v) sort(v.rbegin(),v.rend())
using namespace std;

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

int32_t main(){

int x,y,f=0;
cin>>x>>y;
int a,b;
a=y-2*x;
if(a<0||a%2==1)
f=1;
b=4*x-y;
if(b<0||b%2==1)
f=1;

if(!f)
cout<<"Yes";
else cout<<"No";

    
    // end_timer = std::chrono::high_resolution_clock::now();
    // ll elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(end_timer - start_timer).count();

return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}

int main() {

    int k, a, b;
    cin >> k >> a >> b;

    bool ok = false;
    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            ok = true;
            break;
        }
    }

    if (ok) Cout("OK");
    else Cout("NG");

    return 0;
}

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

#define reint register int
#define coint const int

using namespace std;

typedef long long ll;

coint SIZE = 1100;

int n, k;
int divi[SIZE], cnt[SIZE], dcnt;
ll li[SIZE], sub[SIZE], scnt;
ll dis[SIZE];

inline int isOk(coint sub) {
    ll sum = 0;
    for (reint j = 1; j <= n; ++j)
        dis[j] = sub - li[j] % sub, sum += li[j] % sub;
    sort(dis + 1, dis + n + 1);
    const ll xcnt = sum / sub;
    const ll stp = accumulate(dis + 1, dis + xcnt + 1, 0ll);
    return stp <= k;
}

int main(void) {
    scanf("%d%d", &n, &k);
    for (reint i = 1; i <= n; ++i) scanf("%lld", &li[i]);

    const ll sum = accumulate(li + 1, li + n + 1, 0ll);
    ll ans = 0;
    for (reint i = 1; (ll)i * i <= sum; ++i) {
        if (sum % i) continue;
        if (isOk(i)) ans = max(ans, (ll)i);
        if (isOk(sum / i)) ans = max(ans, sum / i);
    }

    printf("%lld\n", ans);

    return 0;
}



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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D)
    cout << "Left" << endl;
  else if (A + B == C + D)
    cout << "Balanced" << endl;
  else
    cout << "Right" << endl;
    
}

Measured memory_bytes: 256
direct = ((0, -1), (0, 1), (-1, 0), (1, 0))

def comb(target_color, mp, pos):
  next_pos = pos[:]
  end = len(next_pos)
  ind = 0
  while ind < end:
    x, y = next_pos[ind]
    for dx, dy in direct:
      nx, ny = x + dx, y + dy
      if mp[ny][nx] == target_color and (nx, ny) not in next_pos:
        next_pos.append((nx, ny))
        end += 1
    ind += 1
  return next_pos

def search(rest, now_color, goal_color, pos, mp):
  if rest == 1:
    if now_color != goal_color:
      next_pos = comb(goal_color, mp, pos)
      return len(next_pos)
    return 0

  ret = 0
  for next_color in range(1, 7):
    if next_color != now_color:
      next_pos = comb(next_color, mp, pos)
      ret = max(ret, search(rest - 1, next_color, goal_color, next_pos, mp))
  return ret

def main():
  while True:
    h, w, c = map(int, input().split())
    if h == 0:
      break
    mp = [[-1] + list(map(int, input().split())) + [-1] for _ in range(h)]
    mp.insert(0, [-1] * (w + 2))
    mp.append([-1] * (w + 2))
    init_pos = [(1, 1)]
    init_color = mp[1][1]
    init_pos = comb(init_color, mp, init_pos)
    print(search(5, init_color, c, init_pos, mp))
main()


Measured memory_bytes: 5624
#include<iostream>
#include<vector>
#include<string.h>
using namespace std;

int main()
{
	int n;
	while(cin>>n && n!=0){
		bool can[50][31];
		memset(can,false,sizeof(can));
		for(int i=0;i<n;i++){
			int t;cin>>t;
			for(int j=0;j<t;j++){
				int k; cin>>k;can[i][k]=true;
			}
		}

		bool have[50][50];
		memset(have,false,sizeof(have));
		for(int i=0;i<n;i++)
			have[i][i]=true;

		bool print=false;
		for(int day=1;day<=30;day++){

			


			vector<int> meet;
			for(int k=0;k<n;k++)
				if(can[k][day]) meet.push_back(k);

			vector<int> share;
			for(int m=0;m<meet.size();m++){
				for(int k=0;k<n;k++){
					if(have[meet[m]][k]) share.push_back(k);
				}
			}

			for(int m=0;m<meet.size();m++){
				for(int s=0;s<share.size();s++){
					have[meet[m]][share[s]]=true;
				}
			}




			for(int i=0;i<n;i++){
				bool ok=true;
				for(int k=0;k<n;k++){
					if(!have[i][k]){ok=false;break;}
				}
				if(ok){cout<<day<<endl; print=true; break;}
			}
			if(print) break;
		}
		if(!print) cout<<-1<<endl;
	}
	return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

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

// E

ll bf(ll N, ll X, ll M) {
  vector<ll> A;
  A.pb(X);
  rep(i,N-1) {
    ll v = A.back();
    A.pb(((v%M)*(v%M))%M);
  }
  ll sum = 0;
  rep(i,(int)A.size()) {
    sum += A[i];
    cout << A[i] << endl;
  }
  cout << "%%" << endl;
  return sum;
}




void solve() {

}

const bool debug = 0;

int main() {
  ll N,X,M;
  cin >> N >> X >> M;

  vector<ll> vec;
  map<int,int> used;
  ll cur = X;
  vec.pb(cur);
  used[cur] = 0;

  int sp = -1;
  while(1) {
    ll nex = ( cur * cur ) % M;
    if( used.count(nex) ) {
      sp = used[nex];
      break;
    }
    used[nex] = (ll)vec.size();
    vec.pb(nex);
    cur = nex;
  }
  if( debug ) {
    cout << "* sp = " << sp << " (" << vec[sp] << ")" << endl;
    rep(i,(int)vec.size()) {
      cout << "  vec[" << i << "] = " << vec[i] << endl;
    }
  }

  if( N <= (int)vec.size() ) {
    ll ans = 0;
    rep(i,N) {
      ans += vec[i];
    }
    cout << ans << endl;
    if( debug ) {
      cout << "Answer: " << bf(N,X,M)  << endl;
    }
    return 0;
  }

  ll ans = 0;
  rep(i,sp) {
    ans += vec[i];
  }

  if( debug ) {
    cout << " default = " << ans << endl;
  }
  
  ll sum = 0;
  REP(i,sp,(int)vec.size()) sum += vec[i];

  if( debug ) {
    cout << "  sum = " << sum << endl;
  }

  ll rem = N - ( sp );
  if( debug ) {
    cout << "  rem = " << rem << endl;
  }
  ll loop_len = (ll)vec.size() - sp;
  ll cnt = rem / loop_len;
  ans += ( cnt * sum );

  rem = rem - cnt * loop_len;
  rep(i,rem) {
    ans += vec[sp+i];
  }

  if( debug ) cout << "? ";
  cout << ans << endl;
  if( debug ) {
    cout << "Answer: " << bf(N,X,M)  << endl;
  }


  
  
  return 0;
}


Measured memory_bytes: 5996
#include <iostream>

using namespace std;

int main() {
	int X, Y;
	cin >> X >> Y;
	bool ok = false;
	for (int cranes = 0; cranes <= X; cranes++) {
		int turtles = X - cranes;
		if (cranes * 2 + turtles * 4 == Y) ok = true;
	}
	
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=110;
char s[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=='-'?o=-o:0,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int n,k,ans=0,res=0;
    scanf("%s%d",s,&k),n=strlen(s);
    for(int i=n;i<n+n;i++) s[i]=s[i-n];
    for(int i=1;i<n;i++)
	if(s[i]==s[i-1]) ++ans,s[i]='*';
    if(k==1) return cout<<ans,0;
    for(int i=n;i<n+n;i++)
	if(s[i]==s[i-1]) s[i]='*',++res;
    if(s[n+n-1]=='*') cout<<(k+1)/2LL*ans+k/2LL*res;
    else cout<<ans+(k-1LL)*res;
    return 0;
}

Measured memory_bytes: 256
h,w,a,b = map(int,input().split())
ans = [["0"]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if (w-a<=j and h-b>i) or (w-a>j and h-b<=i):
            ans[i][j] = "1"
for i in range(h):
    print("".join(ans[i]))

Measured memory_bytes: 16672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  ll N;
  cin >> N;
  
  for (int i = 1; i < 10; i++) {
    ll Ntmp = N;
    if (N % i == 0 && N / i < 10) {
      cout << "Yes" << endl;
      return 0;
    }
  }
    
  cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<stack>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	if(n%2==0)
		printf("%d\n",n*n/4);
	else{
		int a = (n+1)/2;
		int b = n/2;  
		printf("%d\n",a*b);
		}
	return 0;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:1024000000,1024000000")
/* vim: set fdm=marker */
//{{{
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int iinf = 0x7fffffff;
const ll linf = ~(1LL<<63);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;
template<typename T>
inline T gcd(T a, T b) {
	if(a < 0) return gcd(-a, b);
	if(b < 0) return gcd( a,-b);
	if(a < b) return gcd(b, a);
	if(b == 0) return a;
	return gcd(b, a%b);
}

ll qpow(ll a, ll n, ll mod) {
	a %= mod;
	ll ans = 1LL;
	while(n) {
		if(n & 1) ans = (ans*a % mod);
		a = (a*a % mod);
		n >>= 1;
	}
	return ans;
}

inline ll rev(ll a, ll p) {
	return qpow(a, p - 2, p);
}

#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define rep(x, st, en) for(int x = st; x < en; x++)
#define rer(x, st, en) for(int x = st; x >= en; x--)
#define pb push_back
#define mp make_pair
#define dbgm(msg, var) cerr<<#msg<<" "<<#var<<" = "<<var<<endl; 
#define dbg(var) cerr<<#var<<" = "<<var<<endl;
#define X first
#define Y second
// build prefix sum
template<typename T>
inline void BPS(T* DST, T* SRC, int N, int s = 0) {
	DST[s] = SRC[s];
	rep(i, 1, N) DST[s + i] = DST[s + i - 1] + SRC[s + i];
}
inline int in() { int x; cin>>x; return x; }
#ifdef ALNDBG
namespace alndbg {
	clock_t s, e;
}
#endif

inline void tic() {
#ifdef ALNDBG
	alndbg::s = clock();
#endif
}

inline void toc() {
#ifdef ALNDBG
	alndbg::e = clock();
	cerr<<1000.0 * (alndbg::e - alndbg::s) / CLOCKS_PER_SEC<<" ms"<<endl;
#endif
}

//}}}

// -------------------- Spliters ------------------------
const int maxn = 10010;

ll sum(ll n) {
	return (1LL + n) * n / 2LL;
}

int main() {
	ios::sync_with_stdio(0);
	int N;
	cin>>N;
	while(N > 0) {
		ll l = 1, r = 10000000;
		ll last_ans = 0;
		while(l <= r) {
			ll mid = (l + r) / 2;
			ll s = sum(mid); 

			if(s <= N) {
				l = mid + 1;
				last_ans = max(last_ans, mid);
			} else {
				r = mid - 1;
			}
		}
		if(sum(last_ans) == N) {
			rep(i, 1, last_ans + 1) {
				cout<<i<<endl;
			}
			break;
		} else {
			if(last_ans <= N) {
				N -= last_ans + 1;
				cout<<last_ans + 1<<endl;
			} else {
				N -= last_ans;
				cout<<last_ans<<endl;
			}
		}
	}
	return 0;
}
// --USE C++11
// *-USE O2


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int a,b;
    cin >> a >> b;
    int t = 0;
    if (a != b) {
        int s = max(a,b);
        t = s + (s-1);
    } else {
        int s = a;
        t = 2*a;
    }
    cout << t << "\n";
}


Measured memory_bytes: 256
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int ans=0;
int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='+')ans+=1;
        if(s[i]=='-')ans-=1;
    }
    cout<<ans;
system("pause");
return 0;
}

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

using namespace std;

int a[200100];

int main()
{
    int n,k;  cin >> n >> k;
    for(int i=0;i<n;i++)  cin >> a[i];
    sort(a , a + n);
    long long Ans = 0;
    for(int i = n - 1;i>=0;i--){
        if(k){
            k--;
        }
        else  Ans+=a[i];
    }
    cout << Ans;
    return 0;
}


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

int main(){
    int H,W;
    cin >> H >> W;
    while (H!=0 && W!=0){
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cout << "#";
            }
          	cout << endl;
            
        
    }
    cout << endl;
    cin >> H >> W;
}
  
}


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

using namespace std;

int main()
{
    int n,m;
    int max = 0;
    vector<int> count(100);
    vector<string> s(100),t(100);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s.at(i);
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>t.at(i);
    }
    for(int i=0;i<n;i++)
    {
        count.at(i) = 0;
        for(int j=0;j<n;j++)
        {
            if(s.at(i) == s.at(j))
            {
                count.at(i)++;
            }
        }
        for(int j=0;j<m;j++)
        {
            if(s.at(i) == t.at(j))
            {
                count.at(i)--;
            }
        }
        if(count.at(i) > max)
        {
            max = count.at(i);
        }
    }
    cout<<max<<endl;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <string>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
char s[200005];
int main()
{
    int n,w;
    cin >> n >> s;
    int ans = 0, sum = 0;
     for(int i = 0; i < n; i++)
     {
         if(s[i] == 'R')
         sum++;
     }
    for(int i = 0; i < sum; i++)
    {
        if(s[i] == 'R')
        ans++;
    }
    cout << sum-ans << endl;

}

Measured memory_bytes: 3812
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

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

   int ans = 999999999;
   int calcres = 0;
   rep(i,s.size()-2){
      int num = (s[i] - '0') * 100 + (s[i+1] - '0') * 10 + (s[i+2] - '0');
      ans = min(ans ,abs(num-753));
      tmp = "";
   }
   cout << ans << endl;




   return 0;
}

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

using namespace std;

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

static const double EPS = 1e-8;

short dp[4001][4001];

int main(){
	string str1;
	while(cin>> str1){
		memset(dp,0,sizeof(dp));

		string str2;
		cin >> str2;

		short res = 0;
		for(int i=0;i<str1.size();i++){
			for(int j=0;j<str2.size();j++){
				if(str1[i] == str2[j]){
					dp[i+1][j+1] = dp[i][j]+1;
					res = max(res,dp[i+1][j+1]);
				}
				else{
					dp[i+1][j+1] = 0;
				}
			}
		}

		printf("%d\n",res);
	}
}

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    int n, ans = 0, cnt = 0;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
        if (a[i - 1] == a[i]) {
            cnt++;
            if (i == n - 1) {
                ans += cnt / 2;
            }
        } else {
            ans += cnt / 2;
            cnt = 1;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
#!/usr/bin/env python3
MOD = 10**9 + 7
n = int(input())
s = input()
d = 0
ans = 1
for i in range(2 * n):
    if (s[i] == 'B') ^ (d % 2 != 0):
        d += 1
    else:
        ans *= d
        ans %= MOD
        d -= 1
if d != 0:
    print(0)
    exit()
for i in range(1, n + 1):
    ans *= i
    ans %= MOD
print(ans)


Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int a[12][12];
int main(){
  int n,m,x;
  cin>>n>>m>>x;
  vector<int>c(n);
  rep(i,n){
    cin>>c[i];
    rep(j,m)cin>>a[i][j];
  }
  int ans=INT_MAX;
  rep(s,1<<n){
    vector<int>d(m,0);
    int sum=0;
    rep(i,n){
      if(s>>i&1){
        sum+=c[i];
        rep(j,m)d[j]+=a[i][j];
      }
      bool flag=true;
      for (int j = 0; j < (int)(m); j++){
        if(d[j]<x){
          flag=false;
          break;
        }
      }
      if(flag==true)ans=min(ans,sum);
    }
  }
  if(ans==INT_MAX){
    cout<<-1<<endl;
  }else{
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)


void solve(long long L){
    double x = static_cast<double>(L) / 3.0;
    printf("%.10f\n", x * x * x);
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long L;
    scanf("%lld",&L);
    solve(L);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

char map[6][6] = {};
int main()
{
    int H, W, K;
    std::cin >> H >> W >> K;
    int n_black = 0;
    for (int j = 0; j < H; j++)
    {
        for (int i = 0; i < W; i++)
        {
            std::cin >> map[j][i];
            if (map[j][i] == '#')
                n_black++;
        }
    }
    int count = 0;
    // 2^H * 2^W <= 2^6 * 2^6 = 2^12 = 4096
    for (int row = 0; row < (1 << H); row++)
    {
        for (int column = 0; column < (1 << W); column++)
        {
            int n = 0; // 残る黒石の数
            for (int i = 0; i < H; i++)
            {
                if (row & (1 << i))
                    continue;
                for (int j = 0; j < W; j++)
                {
                    if (column & (1 << j))
                        continue;
                    if (map[i][j] == '#')
                        n++;
                }
            }
            if (n == K)
                count++;
        }
    }
    std::cout << count << std::endl;
}

Measured memory_bytes: 3552
n = int(input())
h = list(map(int, input().split()))
dp = [float('INF') for _ in range(n)]
for i in range(n):
    if 0 == i:
        dp[i] = 0
    elif 1 == i:
        dp[i] = abs(h[i-1] - h[i])
    else:
        dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]),
                    dp[i-2] + abs(h[i-2] - h[i]))
print(dp[-1])


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

int main() {
    ll n, k;
    cin >> n >> k;
    vl a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    sort(all(a), greater<ll>());
    rep(i, n) {
        if (i < k) continue;
        ans += a[i];
    }
    out(ans);
    return 0;
}


Measured memory_bytes: 1792
import collections,sys
def s():
 d=collections.deque()
 input()
 for e in sys.stdin:
  if'i'==e[0]:d.appendleft(e.split()[1])
  else:
   if' '==e[6]:
    m=e.split()[1]
    if m in d:d.remove(m)
   elif len(e)%2:d.pop()
   else:d.popleft()
 print(*d)
if'__main__'==__name__:s()


Measured memory_bytes: 69740
#include <bits/stdc++.h>
#define FOR(i,a,b) for(long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(long i=0;i<(n);i++)
#define RREP(i,n) for(long i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    vector<long> two;
    vector<long> three;
    vector<long> five;
    vector<long> num;
    two.PB(1);
    three.PB(1);
    five.PB(1);
    for(long i=1;two.back()<1e6;i++){
	two.PB(two.back() * 2);
    }
    for(long i=1;three.back()<1e6;i++){
	three.PB(three.back() * 3);
    }
    for(long i=1;five.back()<1e6;i++){
	five.PB(five.back() * 5);
    }
    for(long i=0;i<two.size();i++){
	for(long j=0;j<three.size();j++){
	    for(long k=0;k<five.size();k++){
		if(two[i] * three[j] * five[k] <= 1e7)
		    num.PB(two[i] * three[j] * five[k]);
	    }
	}
    }
    sort(ALL(num));
    while(true){
	long n,m;
	cin >> m;
	if(m == 0) break;
	cin >> n;
	long ans  = upper_bound(ALL(num),n) -  lower_bound(ALL(num),m);
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1236
#include<iostream>
using namespace std;
int m(int a,int b)
{
  if(a<b) return b;
  else return a;
}
int main()
{
  int n;
  cin>>n;
  int a,b,count=0;
  cin>>a;
  int ma=0;
  for(int i=0;i<n-1;i++)
  {
   cin>>b;
    if(a>=b) {
	count+=1;
//cout<<"keerthi"<<count<<endl;	
}
    else 
    {
    	ma=m(ma,count);
	count=0;
    }
    a=b;
  }
  ma=m(ma,count);
  cout<<ma;
}

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

int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    int n,r=0,ans=0,i;
    cin >> n;
    char arr[n];
    for (i = 0; i < n; i++)
    {
        cin >> arr[i];
        if (arr[i] == 'R')
            r++;
    }
    for(i=0;i<r;i++)
    {
        if(arr[i]=='W')
            ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3764
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[][] rumors = new int[n][n];     //言った人、言った先
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                rumors[i][j]=-1;
            }
        }
        
        int testimony_n =0, person = 0;
        for(int i = 0;i < n;i++){
            testimony_n = Integer.parseInt(sc.next());
            for(int j = 0;j < testimony_n;j++){
                person = Integer.parseInt(sc.next());
                person--;
                rumors[i][person] = Integer.parseInt(sc.next());
            }
        }
        
        boolean[] honesty = new boolean[n];
        boolean contradiction = false;
        int count = 0,max=0;
        
        for(int bit=0;bit < (1<<n);bit++){
            contradiction = false;
            for(int i=0;i < n;i++){
                honesty[i] = (bit&(1<<i))>0;
            }
            for(int i=0;i < n;i++){
                if(honesty[i]){
                    for(int j=0;j<n;j++){
                        if((rumors[i][j] == 0)&&(honesty[j])) contradiction=true;
                        if((rumors[i][j] == 1)&&(!honesty[j])) contradiction=true;
                    }
                }
            }
            if(!contradiction){
                count=0;
                for(int i=0;i < n;i++){
                    if(honesty[i]) count++;
                }
                max = count>max ? count : max;
            }
        }
        
        System.out.println(max);
    }
}

Measured memory_bytes: 23104
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int d,t,s;
  float sum = 0.0;
  cin>>d>>t>>s;
  sum =  d / float(s);
  if(sum <= t)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
   
 return 0; 
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    int N;
    cin >> N;
    vector<ll> A(N);
    ll tot = 0;
    REP(i,N){
        cin >> A[i];
        tot += A[i];
    }
    ll total = tot;
    ll first = 0,next = 0;
    REP(i,N){
        if(tot >= 0){
            first = tot;
        }else{
            next = tot;
            break;
        }
        tot -= 2*A[i];
    }
    if(next == 0)next = total;
    cout <<min(abs(next),abs(first))<< "\n";
}

Measured memory_bytes: 1792
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        
        int tate = Integer.parseInt(input[0]);
        int yoko = Integer.parseInt(input[1]);
        if(tate < 1 || yoko < 1 || tate > 100 || yoko > 100){
            System.out.println("Error");
        }
        
        int men = 0;
        int nag = 0;
        
        men = tate * yoko;
        nag = (tate + yoko) * 2;
        
        System.out.println(men + " " + nag);
    }

}

Measured memory_bytes: 24132
count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())

for cnt in range(n):
    b, f, r, v = [int(x) for x in input().split()]
    count[b-1][f-1][r-1] += v

for i, b in enumerate(count):
    for f in b:
        for r in f:
            print(" {0}".format(r), end = "")
        print()
    if i < 3: print("####################")


Measured memory_bytes: 5620
var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var data = input.split( '\n' );
  var n = parseInt( data[0] );
  var nums =  data[1].split( ' ' ).map( Number );
  
  var output = [];
  var i,j;
  output.push( nums.join( ' ' ) );
  for( i=1; i<nums.length; i++ ) {
    var key = nums[i];
    j = i - 1;
    while( 0<= j && key < nums[j] ) {
      nums[j+1] = nums[j];
      j--;
    }
    nums[j+1] = key;
    output.push( nums.join( ' ' ) );
  }
  console.log( output.join( '\n' ) );
});

Measured memory_bytes: 16752
import fractions
import functools


n = int(input())
a = [int(i) for i in input().split()]
ans = 0

# a_0 ~ a_i の 最大公約数
l_gcd = [0]
l_append = l_gcd.append
# a_i ~ a_n-1 の最大公約数
r_gcd = []
r_append = r_gcd.append

for i, a_i in enumerate(a):
    if i == 0:
        l_append(a_i)
    else:
        l_append(fractions.gcd(a_i, l_gcd[i]))

for i, a_i in enumerate(reversed(a)):
    if i == 0:
        r_append(a_i)
    else:
        r_append(fractions.gcd(a_i, r_gcd[i-1]))
r_gcd.reverse()
r_append(0)

m = []
m_append = m.append
for i in range(n):
    m_append(fractions.gcd(l_gcd[i], r_gcd[i+1]))
ans = max(m)
print(ans)


Measured memory_bytes: 94312
#include <bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define MOD 1000000007
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
using namespace std;

int main() {
  ll n, m;
  cin >> n >> m;

  if (n % m == 0)
    cout << -1 << endl;
  else {
    cout << n << endl;
  }
}


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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()



int main() {
    int N;
    cin >> N;
    vi d(N);
    REP(i,N)cin >> d[i];

    sort(d.begin(),d.end()); //照準

    if(N&1){
        cout << 0 << endl;
        return 0;
    }else{
        cout << d[N/2]-d[N/2-1] << endl;
        return 0;
    }

    return 0;


}



Measured memory_bytes: 640
#![allow(unused)]

//
// Based on EbTech's Scanner https://stackoverflow.com/q/56449027
//
struct Scanner<'a, R: std::io::BufRead> {
    reader: R,
    buf: String,
    iter: std::str::SplitWhitespace<'a>,
}

impl<'a, R: std::io::BufRead> Scanner<'a, R> {
    fn new(reader: R) -> Self {
        Self { reader, buf: String::new(), iter: "".split_whitespace() }
    }

    fn get_str(&mut self) -> &str {
        if let Some(t) = self.iter.next() {
            return t;
        }
        self.buf.clear();
        self.reader.read_line(&mut self.buf).expect("I/O error");
        self.iter = unsafe { std::mem::transmute(self.buf.split_whitespace()) };
        self.get_str()
    }

    fn get<T: std::str::FromStr>(&mut self) -> T {
        self.get_str().parse().ok().expect("Parse error")
    }
}

fn main() {
    let stdin = std::io::stdin();
    solve(Scanner::new(stdin.lock()));
}

fn go(i: usize, x: i64, books: &Vec<(i64, Vec<i64>)>, done: &mut Vec<i64>, cost: i64) -> Option<i64> {
    if i == books.len() {
        if done.iter().all(|&k| k >= x) {
            return Some(cost);
        } else {
            return None;
        }
    }

    let taken = go(i + 1, x, books, done, cost);
    for j in 0..(done.len()) {
        done[j] += books[i].1[j];
    }
    let nottaken = go(i + 1, x, books, done, cost + books[i].0);
    for j in 0..(done.len()) {
        done[j] -= books[i].1[j];
    }
    match (taken, nottaken) {
        (Some(a), Some(b)) => Some(std::cmp::min(a, b)),
        (Some(a), None) => Some(a),
        (None, Some(b)) => Some(b),
        (None, None) => None,
    }
}

fn solve<R: std::io::BufRead>(mut sc: Scanner<R>) {
    let n: usize = sc.get();
    let m: usize = sc.get();
    let x: i64 = sc.get();
    let books: Vec<(i64, Vec<i64>)> = (0..n)
        .map(|_| (sc.get(), (0..m).map(|_| sc.get()).collect()))
        .collect();
    
    let mut done = vec![0; m];
    println!("{}", go(0, x, &books, &mut done, 0).unwrap_or(-1));
}


Measured memory_bytes: 2164
#include <cstdio>
#include <iostream>
#include <sstream>

#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

//////////////////////////////////////////////////

i64 ts[100005];
const i64 mod = 1000000007LL;


int main() {
  ts[0] = 1;
  for(int i=0;i<100003;i++){
    ts[i+1] = ts[i] * 3 % mod; 
  }
  string s;
  cin >> s;
    i64 ret1 = 0, ret2 = 1;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '1') {
        ret1 += ret2 * ts[s.length() - i - 1] % mod;
        ret1 %= mod;
        ret2 *= 2;
        ret2 %= mod;
      }
    }
    cerr << ret1 << " " << ret2 << endl;
    cout << (ret1 + ret2) % mod << endl;
  return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define maxN 100005
#define rep(i,n) for(int i=0;i<n;i++)
#define refv(i,l,r) for(int i=l;i<r;i++)
#define rerv(i,l,r) for(int i=r;i>=r;i--)
#define pi pair<ll,ll>
#define pii pair<ll,pair<ll,ll> > 
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define printvector(v) for(int i= 0;i<v.size();i++) {cout<<v[i]<<" ";} cout<<endl;
#define printset(s) for(auto it = s.begin();it!=S.end();it++){cout<<*it<<" ";} cout<<endl;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); 
using namespace std;

void subsetsUtil(vector<int>& A, vector<vector<int> >& res, 
                 vector<int>& subset, int index) 
{ 
    res.push_back(subset); 
    for (int i = index; i < A.size(); i++) { 
  
        // include the A[i] in subset. 
        subset.push_back(A[i]); 
  
        // move onto the next element. 
        subsetsUtil(A, res, subset, i + 1); 
  
        // exclude the A[i] from subset and triggers 
        // backtracking. 
        subset.pop_back(); 
    } 
  
    return; 
} 
  
// below function returns the subsets of vector A. 
vector<vector<int> > subsets(vector<int>& A) 
{ 
    vector<int> subset; 
    vector<vector<int> > res; 
  
    // keeps track of current element in vector A; 
    int index = 0; 
    subsetsUtil(A, res, subset, index); 
  
    return res; 
} 
  

int32_t main()
{
	int n,m;
    cin>>n>>m;
    vector<int> v[m];
    vector<int > sub;
    rep(i,n)
    {
        sub.pb(i+1);
    }
     vector<vector<int> > res =subsets(sub);
    rep(i,m)
    {
        int x;
        cin>>x;
        rep(j,x)
        {
            int xx;
            cin>>xx;
            v[i].pb(xx);
        }
    }
    int p[m];
    rep(i,m)
    {
        cin>>p[i];
    }
    int result=0;

    rep(i,res.size())
    {
        int ans=0;
        rep(j,m)
        {
            int count=0;
            rep(l,v[j].size())
            {
                for(int z=0;z<res[i].size();z++)
                {
                    if(v[j][l]==res[i][z])
                    {
                        count++;
                        break;
                    }
                }
            }
            if(count%2==p[j])
            {
                ans++;
            }
        }
        if(ans==m)
        {
            result++;
        }
    }
    cout<<result<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll now = 1;
ll n;
int main() {
	cin >> n;
	REP(i, n) {
		ll a;
		cin >> a;
		if (now == a)now++;
	}
	if (now == 1)cout << -1 << endl;
	else cout << n - now + 1 << endl;
}



Measured memory_bytes: 256