akhauriyash/Code-Regression huggingface dataset:
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	map<string, int> smap;
	cin >> N;
	string S;
	rep(i, 0, N)
	{
		cin >> S;
		smap[S]++;
	}

	cout << "AC x " << smap["AC"] << endl;
	cout << "WA x " << smap["WA"] << endl;
	cout << "TLE x " << smap["TLE"] << endl;
	cout << "RE x " << smap["RE"] << endl;

	return 0;
}

Measured memory_bytes: 3660
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    static void solve() {
        int a = nextInt();
        int b = nextInt();

        int ans = (a + b + 1) / 2;
        out.println(ans);
    }

    static PrintWriter out;
    static Scanner sc;

    static int[][] newIntArray(int h, int w, int value) {
        int[][] ret = new int[h][w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                ret[i][j] = value;
            }
        }
        return ret;
    }

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

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

    static String nextString() {
        return sc.next();
    }

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static char[][] nextCharArray(int h, int w) {
        char[][] c = new char[h][w];
        for (int i = 0; i < h; i++) {
            String str = nextString();
            for (int j = 0; j < w; j++) {
                c[i][j] = str.charAt(j);
            }
        }
        return c;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // return n^k mod m
    static long powMod(long n, long k, long m) {
        if (k == 0) {
            return 1;
        } else if (k % 2 == 1) {
            return powMod(n, k - 1, m) * n % m;
        } else {
            long tmp = powMod(n, k / 2, m);
            return tmp * tmp % m;
        }
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

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

        solve();

        out.flush();
        sc.close();
    }

}


Measured memory_bytes: 23764
#include <cstdio>

int main()
{
  long long n, a;
  scanf("%lld%lld", &n, &a);
  long long ans = a / 2;
  for (long long i = 1; i < n; ++i)
  {
    long long b = a;
    scanf("%lld", &a);
    if (b & 1 && a > 0)
    {
      ans++;
      a--;
    }
    ans += a / 2;
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

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

      int width = sc.nextInt();
      int height = sc.nextInt();

      int x = sc.nextInt();
      int y = sc.nextInt();
      int r = sc.nextInt();

      int maxWidth = x + r;
      int maxHeight = y + r;

      boolean isWidth = maxWidth > 0 ? true : false;
      boolean isHeight = maxHeight > 0 ? true : false;

      if (!isHeight || !isWidth) {
        System.out.println("No");
        System.exit(0);
      }

      if(width >= maxWidth && height >= maxHeight) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }

      sc.close();
  }
}


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

template< typename T >
struct Dinic
{
  struct edge
  {
    int to;
    T cap;
    int rev;
  };

  const T INF;
  vector< vector< edge > > graph;
  vector< T > min_cost;
  vector< int > iter;

  Dinic(int n) : INF(numeric_limits< T >::max())
  {
    graph.resize(n);
  }

  void add_edge(int from, int to, T cap)
  {
    graph[from].push_back((edge) {to, cap, (int) graph[to].size()});
    graph[to].push_back((edge) {from, 0, (int) graph[from].size() - 1});
  }

  bool bfs(int s, int t)
  {
    min_cost.assign(graph.size(), -1);
    queue< int > que;
    min_cost[s] = 0;
    que.push(s);
    while(!que.empty()) {
      int p = que.front();
      que.pop();
      for(auto &e : graph[p]) {
        if(e.cap > 0 && min_cost[e.to] == -1) {
          min_cost[e.to] = min_cost[p] + 1;
          que.push(e.to);
        }
      }
    }
    return (min_cost[t] != -1);
  }

  T dfs(int idx, const int t, T flow)
  {
    if(idx == t) return (flow);
    for(int &i = iter[idx]; i < graph[idx].size(); i++) {
      edge &e = graph[idx][i];
      if(e.cap > 0 && min_cost[idx] < min_cost[e.to]) {
        T d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return (d);
        }
      }
    }
    return (0);
  }

  T max_flow(int s, int t)
  {
    T flow = 0;
    while(bfs(s, t)) {
      iter.assign(graph.size(), 0);
      T f = 0;
      while((f = dfs(s, t, INF)) > 0) {
        flow += f;
      }
    }
    return (flow);
  }
};

int main()
{
    int N; cin >> N;
    vector<int> A(N); for (auto &a : A) cin >> a;
    int S = N, T = N+1;
    Dinic<Int> dinic(N+2);
    Int sum = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] < 0) {
            dinic.add_edge(S, i, -A[i]);
        } else {
            dinic.add_edge(i, T, A[i]);
            sum += A[i];
        }
    }
    const Int INF = 1e12;
    for (int i = 0; i < N; i++) {
        int n = i + 1;
        for (int m = n + n; m <= N; m += n) {
            dinic.add_edge(n-1, m-1, INF);
        }
    }
    cout << sum - dinic.max_flow(S, T) << '\n';
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

constexpr ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    friend ostream &operator<<(ostream& os,const mint& a){
        return os << a.x;
    }

    friend istream &operator>>(istream& is,mint& a){
        ll t;
        is >> t;
        a = mint(t);
        return (is);
    }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,A,B;
    cin >> N >> A >> B;
    mint two = 2;
    mint ans = two.pow(N)-1;

    auto calc = [&](int X){
        mint val = 1;
        for(int i=1;i<=X;i++){
            val *= (N-i+1);
            val /= i;
        }
        return val;
    };
    cout << ans-calc(A)-calc(B) << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
 
int main()
{
    while(true){
        int n;
        cin >> n;
 
        if(n==0)
            break;
 
        int S[100];
 
        int sum = 0;
 
        for(int i=0; i<n; i++){
            cin >> S[i];
            sum += S[i];
        }
 
        sort(S, S+n);
 
        cout << (sum-S[0]-S[n-1])/(n-2) << endl;
    }
 
    return 0;
}

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<(x)<<endl
#define fi first
#define se second

#define INF 2147483600

int main(){
  int n,k;
  cin>>n>>k;
  int res=k;

  rep(i,n-1) res *= k-1;
  cout<<res<<endl;

  return 0;
}


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

string S;

int main() {
    cin >> S;
    int ans;
    if (S == "SUN") ans = 7;
    else if (S == "MON") ans = 6;
    else if (S == "TUE") ans = 5;
    else if (S == "WED") ans = 4;
    else if (S == "THU") ans = 3;
    else if (S == "FRI") ans = 2;
    else if (S == "SAT") ans = 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Maxn 20
int a[Maxn + 5][Maxn + 5],b[Maxn + 5];
int N,M,C,s,ans;
int main(){
	cin >> N >> M >> C;
	for(int i = 1;i <= M;i++)
		cin >> b[i];
	for(int i = 1;i <= N;i++)
		for(int j = 1;j <= M;j++)
			cin >> a[i][j];
	for(int i = 1;i <= N;i++){
		s = 0;
		for(int j = 1;j <= M;j++)
			s += a[i][j] * b[j];
		if (s + C > 0) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/**************************************
 * Au: Hany01
 * Date: Aug 25th, 2018
 * Email: hany01@foxmail.com
**************************************/
 
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define File(a) freopen(a".in", "r", stdin), freopen(a".out", "w", stdout)
#define rep(i, j) for (register int i = 0, i##_end_ = j; i < i##_end_; ++ i)
#define For(i, j ,k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define SZ(a) ((int)(a.size()))
#define ALL(a) a.begin(), a.end()
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define x first
#define y second
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define y1 wozenmezhemecaia 
#ifdef hany01
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif
 
template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
 
inline int read() {
    register char c_; register int _, __;
    for (_ = 0, __ = 1, c_ = getchar(); !isdigit(c_); c_ = getchar()) if (c_ == '-')  __ = -1;
    for ( ; isdigit(c_); c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}
 
const int maxn = 1e5 + 5;
 
int n, a[maxn], ls[maxn], tot, l, r, mid, b[maxn];
 
struct Ftree {
    int c[maxn << 1];
#define lb(x) ((x) & -(x))
    inline void update(int x){
        x += 1e5 + 1;
        for ( ; x <= (2e5 + 2); x += lb(x)) ++ c[x];
    }
    inline int query(int x){
        int Ans = 0;
        x += 1e5 + 1;
        for ( ; x; x -= lb(x)) Ans += c[x];
        return Ans;
    }
}FT;
 
inline LL calc(int x) {
    LL Ans = 0;
    For(i, 1, n) b[i] = a[i] <= x ? 1 : -1;
    Set(FT.c, 0);
    FT.update(0);
    For(i, 1, n) Ans += FT.query((b[i] += b[i - 1]) - 1), FT.update(b[i]);
    return Ans;
}
 
int main()
{
#ifdef hany01
    File("a");
#endif
 
    n = read();
    For(i, 1, n) a[i] = ls[i] = read();
    sort(ls + 1, ls + 1 + n), tot = unique(ls + 1, ls + 1 + n) - ls - 1;
 
    l = 1, r = tot;
    while (l < r) if (calc(ls[mid = ((l + r) >> 1)]) >= (LL)n * (n + 1) / 4 + 1) r = mid; else l = mid + 1;
    printf("%d\n", ls[l]);
 
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <queue>
#include <string>
#include <algorithm>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n + 1; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define repr1(i, n) for (int i = n; i > 0; i--)
#define FOR(i, j, n) for (int i = j; i < n; i++)

typedef long long ll;
const ll MOD = 1000000007; // 10^9+7
const ll INF = 100000000;

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

    vector<ll> a(n+1,0);
    vector<ll> b(n+1,0);

    rep(i,n){
        cin >> a[i];
        a[i] %= MOD;
    }
    repr(i,n) b[i] = (a[i] + b[i+1]) % MOD;
    //rep(i,n) cout << b[i] << endl;

    ll ans=0;

    rep(i,n-1){
        ans = ( ans + ( a[i] * b[i+1] )%MOD) % MOD;
        //cout << ans << endl;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s, ans="";
    cin >> s;
    int start, end;
    for (int i = 0; i < s.length(); i++)
        if (s[i] == 'A') {
            start = i;
            break;
        }
    
    for (int i = s.length()-1; i >= 0;i--)
        if (s[i] == 'Z') {
            end = i;
            break;
        }
    
    for (int i = start; i <= end; i++)
        ans += s[i];
    cout << ans.length();
    
    
    return 0;
}


Measured memory_bytes: 776
#include <stdio.h>
int main(void){
    int inf1,inf2,math1,math2,sci1,sci2,eng1,eng2,sum1,sum2;
    scanf("%d %d %d %d",&inf1,&math1,&sci1,&eng1);
    scanf("%d %d %d %d",&inf2,&math2,&sci2,&eng2);
    
    sum1=inf1+math1+sci1+eng1;
    sum2=inf2+math2+sci2+eng2;
    
    if(sum1>=sum2){
        printf("%d\n",sum1);
    }
    
    else{
        printf("%d\n",sum2);
    }
}



Measured memory_bytes: 2088
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n%2==0) {
            System.out.println(n); 
            return;
        }else {
            System.out.println(n*2);
        }
    }    
}


Measured memory_bytes: 22740
import sys
from collections import deque
from copy import deepcopy
sys.setrecursionlimit(10**7)
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


class Dinic:
    def __init__(self, N):
        self.N = N
        self.G = [[] for _ in range(N)]

    def add_edge(self, fr, to, cap):
        forward = [to, cap, None]
        forward[2] = backward = [fr, 0, forward]
        self.G[fr].append(forward)
        self.G[to].append(backward)

    def add_multi_edge(self, v1, v2, cap1, cap2):
        edge1 = [v2, cap1, None]
        edge1[2] = edge2 = [v1, cap2, edge1]
        self.G[v1].append(edge1)
        self.G[v2].append(edge2)

    def bfs(self, s, t):
        self.level = level = [None]*self.N
        deq = deque([s])
        level[s] = 0
        G = self.G
        while deq:
            v = deq.popleft()
            lv = level[v] + 1
            for w, cap, _ in G[v]:
                if cap and level[w] is None:
                    level[w] = lv
                    deq.append(w)
        return level[t] is not None

    def dfs(self, v, t, f):
        if v == t:
            return f
        level = self.level
        for e in self.it[v]:
            w, cap, rev = e
            if cap and level[v] < level[w]:
                d = self.dfs(w, t, min(f, cap))
                if d:
                    e[1] -= d
                    rev[1] += d
                    return d
        return 0

    def flow(self, s, t):
        flow = 0
        INF = 10**9 + 7
        G = self.G
        while self.bfs(s, t):
            *self.it, = map(iter, self.G)
            f = INF
            while f:
                f = self.dfs(s, t, INF)
                flow += f
        return flow


N,M = MI()
S = [LS2() for _ in range(N)]

D = Dinic(N*M+2)
s,t = N*M,N*M+1
for i in range(N):
    for j in range(M):
        if (i+j) % 2 == 0:
            D.add_edge(s,M*i+j,1)
        else:
            D.add_edge(M*i+j,t,1)

for i in range(N-1):
    for j in range(M):
        if S[i][j] == S[i+1][j] == '.':
            a,b = M*i+j,M*(i+1)+j
            if (i+j) % 2 == 1:
                a,b = b,a
            D.add_edge(a,b,1)

for i in range(N):
    for j in range(M-1):
        if S[i][j] == S[i][j+1] == '.':
            a,b = M*i+j,M*i+(j+1)
            if (i+j) % 2 == 1:
                a,b = b,a
            D.add_edge(a,b,1)

print(D.flow(s,t))

ANS = deepcopy(S)
for a in range(N*M):
    for b,cap,_ in D.G[a]:
        if b == s or b == t:
            continue
        ai,aj = divmod(a,M)
        bi,bj = divmod(b,M)
        if (ai+aj) % 2 == 0 and cap == 0:
            if ai+1 == bi:
                ANS[ai][aj] = 'v'
                ANS[bi][bj] = '^'
            elif ai == bi+1:
                ANS[ai][aj] = '^'
                ANS[bi][bj] = 'v'
            elif aj+1 == bj:
                ANS[ai][aj] = '>'
                ANS[bi][bj] = '<'
            elif aj == bj+1:
                ANS[ai][aj] = '<'
                ANS[bi][bj] = '>'

for i in range(N):
    print(''.join(ANS[i]))


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;

int main() {
  ll k;
  cin >> k;
  vector<ll> t;
  FOR(i, 1, k + 1) FOR(j, 1, k + 1) { t.push_back(__gcd(i, j)); }

  ll ans = 0;
  for (auto x : t) {
    FOR(i, 1, k + 1) { ans += __gcd(x, ll(i)); }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int N,M;
  cin>>N>>M;
  map<int,int> m;
  int64_t Z=0,A=0;
  m[0]=1;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    A=(A+a)%M;
    m[A]++;
    Z+=m[A];
  }
  Z-=N;
  cout<<Z<<endl;
}



Measured memory_bytes: 6372
/**
 * @Author: harshkhajuria
 * @Date:   09-May-2020 05:39:30 pm
 * @Email:  khajuriaharsh729@gmail.com
 * @Filename: B - Trick or Treat.cpp
 * @Last modified by:   harshkhajuria
 * @Last modified time: 09-May-2020 05:52:40 pm
 */

#include <bits/stdc++.h>
#define ll long long
#define mp(a, b) make_pair(a, b)
#define newline cout << endl;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(),v.end()
using namespace std;

template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p)
{
		out << '(' << p.ff << ", " << p.ss << ')';
		return out;
}

template <typename T> ostream& operator<<(ostream& out, vector<T> const& v)
{
		int l = v.size();
		for (int i = 0; i < l - 1; i++)
				out << v[i] << ' ';
		if (l > 0)
				out << v[l - 1];
		return out;
}

template <typename T> void trace(const char* name, T&& arg1) {
		cout << name << " : " << arg1 << endl;
}

template <typename T, typename ... Args> void trace(const char* names, T&& arg1, Args&&... args)
{
		const char* comma = strchr(names + 1, ',');
		cout.write(names, comma - names) << " : " << arg1 << " | ";
		trace(comma + 1, args ...);
}

/*Input*/
ll n,k;
const ll sizeconst = 1e4 + 10;
vector<ll> v(sizeconst);
/*Input*/

int main()
{
		//ios::sync_with_stdio(false);
		//cin.tie(0);
		//cout.tie(0);
		clock_t tStart = clock();
		int test;
		test = 1;
		// cin >> test;
		while (test--) {
				cin >> n >> k;
				for(int i=0; i<sizeconst; i++) {
						v[i] = 0;
				}
				for(int i=0; i<k; i++) {
						ll x;
						cin >> x;
						for(int j=0; j<x; j++) {
								ll temp2;
								cin >> temp2;
								v[--temp2]++;
						}
				}
				ll ans = 0;
				for(int i=0; i<n; i++) {
						if(v[i] == 0) ans++;
				}
				cout << ans << endl;
		}
#ifdef LOCAL_DEFINE
		printf("Time taken: %.2fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC);
#endif
		return 0;
}


Measured memory_bytes: 3648
n, k = map(int, input().split())
ans = []
c = (n - 1) * (n - 2) // 2 - k
if c < 0:
    print(-1)
    exit(0)
for i in range(1, n):
    ans.append((0, i))
cnt = 0
flg = 0
for i in range(1, n):
    if flg:
        break
    for j in range(i + 1, n):
        if cnt >= c:
            flg = 1
            break
        ans.append((i, j))
        cnt += 1
print(len(ans))
for a, b in ans:
    print(a + 1, b + 1)

Measured memory_bytes: 43376
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	string s, t;
	cin >> s >> t;
	int s_len = s.size(), t_len = t.size();
	sort(s.begin(),s.end());DescSort(t);
	if (s<t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int n, d;
	cin >> n >> d;
	int x[20][20];
	int i, j;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < d; j++)
		{
			cin >> x[i][j];
		}
	}
	int cnt=0;
	int k,l;
	int sum;
	for (i = 0; i < n - 1; i++)
	{
		for (l = i + 1; l < n; l++)
		{
			sum = 0;
			for (j = 0; j < d; j++)
			{
				sum += (abs(x[i][j] - x[l][j])) * (abs(x[i][j] - x[l][j]));

				//cout <<"i="<<i<<" "<<"j="<<j<<" "<< x[i][j] <<" "<< x[l][j] <<" "<< sum << endl;
			}
			//cout << sum << endl;
			for (k = 1; k <= 1000; k++)
			{
				if (sum == k * k)
					cnt++;
			}
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
#define sf(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d%d",&a,&b)
#define pf printf
#define PI 3.1416
int main( )
{
	int k,x;
	sf2(k,x);
	if(k*500>=x)pf("Yes\n");
	else pf("No\n");
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << 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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin>>n;
  ll u=1,nota=1,notaorb=1;
  rep(i,n){
    u*=10;
    u%=MOD;
    nota*=9;
    nota%=MOD;
    notaorb*=8;
    notaorb%=MOD;
  }
  ll aorb=u-notaorb;
  ll a=u-nota;
  ll c=aorb-a;
  ll aandb=aorb-2*c;
  aandb=u-2*nota+notaorb;
  aandb%=MOD;
  aandb=(aandb+MOD)%MOD;
  print(aandb);
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

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

using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int> >;
using vii = vector<pair<int, int> >;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

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

int main() {
	int n, m; cin >> n >> m;
	vi a(m), b(m);

	map<int, bool> check;

	rep(i, m)
	{
		cin >> a[i] >> b[i];
		if (a[i] == 1) check[b[i]] = true;
	}

	rep(i, m) {
		if (b[i] == n && check[a[i]] == true) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl;


}

Measured memory_bytes: 11136
#include <iostream>
#include <string>

int main(){
    int isOk = true;

    std::string S;
    std::string T;

    std::cin >> S;
    std::cin >> T;

    if((S.size() < 1) || (S.size() > 10)){
        isOk = false;
    }

    std::string tmp = T.substr(0, S.size());
//    std::cout << tmp << "/" << S << std::endl;
    if(tmp != S){
        isOk = false;
    }

    if(T.size() != S.size() + 1){
        isOk = false;
    }

    if(isOk == true){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }

    return 0;
}

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

using namespace std;

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

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

string str;	
bool lose(int a,int b,int c){
	return str[a]=='x'&&str[b]=='x'&&str[c]=='x';
}
bool win(int a,int b,int c){
	return str[a]=='o'&&str[b]=='o'&&str[c]=='o';
}

int main() {
	while(cin>>str){
		if(win(0,1,2)||win(3,4,5)||win(6,7,8)||win(0,3,6)||win(1,4,7)||win(2,5,8)||win(0,4,8)||win(2,4,6)){
			puts("o");
		}else if(lose(0,1,2)||lose(3,4,5)||lose(6,7,8)||lose(0,3,6)||lose(1,4,7)||lose(2,5,8)||lose(0,4,8)||lose(2,4,6)){
			puts("x");
		}else puts("d");
		
	}
	return 0;
}

Measured memory_bytes: 0
import math

N = int(input())
if N <= 9:
    ans = 1
else:
    ans = 11
for n in range(1, int(math.sqrt(N))+1):
    if N % n == 0:
        # print(n)
        f = max(len(str(n)), len(str(int(N/n))))
        if f < ans:
            # print("f: %d"%f)
            ans = f
print(ans)

Measured memory_bytes: 3060
import itertools

times = [int(input()) for _ in range(5)]

p = itertools.permutations([0, 1, 2, 3, 4])

min_time = 10e9
for orders in p:
    current_time = 0
    for idx, order in enumerate(orders):
        t = times[order]
        current_time += t
        if idx < 4 and current_time % 10 != 0:
            current_time += 10 - current_time % 10

    min_time = min(min_time, current_time)

print(min_time)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>
typedef long long ll;
using namespace std;

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

    int flag;
    for (int i = int(s.length()) - 2; i > 0; i--) {
        flag = 1;
        if (i % 2 == 0)
            continue;
        int front  = i / 2;
        int end = i;
        while (front >= 0) {
            if (s[front] != s[end]) {
                flag = 0;
                break;
            }
            front--;
            end--;
        }
        if (flag == 0)
            continue;
        cout << i + 1 << endl;
        break;
    }
    
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=1e6+9;
const int mod=1e9+7;

ll fact[N],inv[N];

ll add(ll a,ll b){ 
    return ((a%mod)+(b%mod))%mod;
}

ll mul(ll a,ll b){ 
    return ((a%mod)*(b%mod))%mod;
}

ll sub(ll a,ll b){ 
    return ((a%mod)-(b%mod)+mod)%mod;
} 

ll fp(ll b,ll p){ 
	if(p==0) return 1;
	if(p&1) return (b*fp(b,p-1))%mod;
	return fp((b*b)%mod,p/2);
}

ll nCk(ll n,ll k){ 
   return ((fact[n]*inv[k])%mod*inv[n-k])%mod;  
} 


ll nPk(ll n,ll k){ 
   return mul(fact[n],inv[n-k]);  
}


void pre(){
   fact[0]=1;
   inv[0]=fp(fact[0],mod-2);
   for(int i=1;i<=N-1;i++){ 
       fact[i]=fact[i-1]*i%mod;
       inv[i]=fp(fact[i],mod-2); 
   }
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    pre();
    ll n;
    cin>>n;
    ll ans=fp(10,n);
    ll c=mul((ll)2,fp(9,n));
    ans=sub(ans,c);
    ans=add(ans,fp(8,n));
    cout<<ans<<'\n';
}

Measured memory_bytes: 19248
#include <iostream>


using namespace std;

int main()
{
   int i, h, m, s;
   cin >> i;
   h = i / 3600;
   m = (i- h*3600) / 60;
   s = i - h*3600 - m * 60;
   cout << h <<":" << m <<":" << s << endl; 

   return 0;
}


Measured memory_bytes: 3136
JUDGE_LIST=[[80, "A"],
            [65, "B"],
            [50, "C"],
            [30, "D"]]

while True:
    try:
        score=[int(x) for x in raw_input().split(" ")]
    except EOFError:
        break
    
    if score[0]==-1 and score[1]==-1 and score[2]==-1:
        break
    
    if score[0]==-1 or score[1]==-1:
        print "F"
        continue

    for judge in JUDGE_LIST:
        if judge[0] <= score[0] + score[1]:
            if "D" == judge[1] and score[2] >= 50:
                print "C"
                break
            else:
                print judge[1]
                break
    else:
        print "F"

Measured memory_bytes: 4236
//
//  main.c
//  aoj_04
//
//  Created by k16031kk on 2018/05/17.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int S;
    int h=0;
    int m=0;
    int s=0;
    scanf("%d",&S);//秒を入力
    h=S/3600;
    S%=3600;
    m=S/60;
    S%=60;
    s=S;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef long double ld;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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 dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  int N;  cin>>N;
  vector<ll> D(N),T;
  rep(i,0,N) cin>>D[i];
  int M;  cin>>M;
  T.resize(M);
  rep(i,0,M) cin>>T[i];
  map<ll,ll> ma;
  rep(i,0,N) ma[D[i]]++;
  rep(i,0,M){
    if(ma[T[i]]>0){
      ma[T[i]]--;
    }else{
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 15872
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();
   
    public void Solve() {
        var r = sc.nextInt();
        var D = sc.nextInt();
        var x = sc.nextInt();

        for (int i = 1; i <= 10; i++) {
            x = (r * x) - D;
            WriteLine(x);
        }
    }
}


class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int A,B;
    cin >> A >> B;
    int i=1;
    int cnt = 0;
    while(i<B){
        i=i+A-1;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
//https://codeforces.com/contest/1295/problem/A
//BROWNIE TK

#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()

#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en

#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second

#define pll pair<lli, lli>
#define pii pair<int, int>
#define pil pair<int, lli>

#define forz(i, n) for (int i = 0; i < n; i++)
#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)

#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

#define lb lower_bound
#define ub upper_bound
#define er equal_range

#define findnot find_first_not_of

#define maxe *max_element
#define mine *min_element

#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetlli tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements sbtriectly lesser than k
//2. find_by_order(k) : k-th element in the set
#define ofk order_of_key
#define fbo find_by_order
using namespace std;

/*STD funcions*/
lli power(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli modi(lli a, lli m) { return power(a, m - 2, m); }
/*CODE BEGINS*/

int main()
{
    kira;
    string s,t,u;
    int a,b;
    map<string,int>m;
    cin>>s>>t;
    cin>>a>>b;
    m[s]=a;
    m[t]=b;
    cin>>u;
    m[u]--;
    p2(m[s],m[t]);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,t,x,y,r,gcd;
    while(~scanf("%d%d",&a,&b))
    {
        x=a;
        y=b;
        if(x>y)
        {
            t=x;x=y;y=t;
        }
        r=y%x;
        while(r)
        {
           y=x;
           x=r;
           r=y%x;
        }
        //gcd=a*b/x;
        printf("%d\n",x);
    }
    return 0;
}



Measured memory_bytes: 2080
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use proconio::input;
use proconio::marker::Usize1;
use std::collections::*;
use std::cmp::*;
use std::f64::consts::*;

const MOD: u64 = 1000000007;
const INF: i64 = std::i64::MAX / 4;

fn main() {
    input! {
        N: usize,
        A: [i64; N],
    }

    let mut AI: Vec<(i64, i64)> = A.iter().enumerate().map(|(i, &a)| (a, i as i64)).collect();
    AI.sort();
    AI.reverse();

    let mut dp = vec![vec![-INF; N + 1]; N + 1];
    dp[0][0] = 0;

    for (i, &(a, j)) in AI.iter().enumerate() {
        for l in 0..i+1 {
            let r = i - l;
            dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + (a * ((l as i64) - j as i64).abs()));
            dp[l][r + 1] = max(dp[l][r + 1], dp[l][r] + (a * (((N as i64) - 1 - (r as i64)) - j as i64).abs()));
        }
    }

    println!("{}", dp.iter().map(|d| d.iter().max().unwrap()).max().unwrap());
}


Measured memory_bytes: 33412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 2;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, twosum[1000008];
string s;
bool use[3];

ll combo(ll n, ll k){
	return (twosum[n]-twosum[k]-twosum[n-k]) == 0;
}

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	twosum[0] = 0;
	rep(i, 1, 1e6){
		twosum[i] = twosum[i-1];
		ll tmp = i;
		while(tmp%2 == 0){
			twosum[i]++;
			tmp /= 2;
		}
	}
	
	cin >> n >> s;
	zep(i, 0, n){s[i]--;}
	//print(s)
	bool two = true;
	zep(i, 0, n){if(s[i] == '1'){two = false;}}
	if(two){zep(i, 0, n){if(s[i] == '2'){s[i] = '1';}}}
	
	ll ans = 0;
	zep(i, 0, n){
		if(s[i] == '1'){
			ans ^= combo(n-1, i);
		}
	}
	
	if(two){ans *= 2;}
	print(ans)
	return 0;
}

Measured memory_bytes: 9756
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

constexpr ll V = 1000000;

ll mod_pow (ll x, ll y) {
    ll ret = 1;
    while (y) {
        if (y&1) ret = ret * x % MOD;
        x = x * x % MOD;
        y /= 2;
    }
    return ret;
}

ll N;
ll A[200000];
ll C[V+1];
ll w[V+1];

void init() {
    for (ll i = 1; i <= V; i++) {
        w[i] = (mod_pow(i,MOD-2) + w[i] + MOD) % MOD;
        for (ll j = i*2; j <= V; j += i) {
            w[j] = (w[j] - w[i] + MOD) % MOD;
        }
    }
}

int main() {
    init();
    cin >> N;
    rep(i,N) cin >> A[i];
    rep(i,N) C[A[i]]++;
    ll ans = 0;
    for (ll i = 1; i <= V; i++) {
        ll add = 0;
        ll sum1 = 0, sum2 = 0;
        for (ll j = i; j <= V; j += i) {
            sum1 = (sum1 + C[j]*j) % MOD;
            sum2 = (sum2 + C[j]*j*j) % MOD;
        }
        add = (sum1*sum1-sum2+MOD)%MOD;
        add = add * mod_pow(2, MOD-2) % MOD;

        ans = (ans + add*w[i]) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 17408
//
//AtCoder Beginner Contest 164
//C - gacha
//

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define reAll(x) (x).rbegin(),(x).rend()

using ll = long long;

const double PI = 3.14159265358979323846;
const int MOD = 1000000007;

int main()
{
    int n;

    cin >> n;

    vector<string> s(n);

    int ans = 0;

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

    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());

    cout << s.size() << endl;
    
    return 0;
}


Measured memory_bytes: 9548
#include <stdio.h>
#define MAX 1000000


int parent(int i)
{
  return i/2;
}
int left(int i)
{
  return 2*i;
}
int right(int i)
{
  return  2*i+1;
}

int main()
{
  int i;
  int A[MAX+1];
  int n;

  scanf("%d",&n);
  for( i = 1 ; i <= n ; i++ ){
    scanf("%d",&A[i]);
  }
  for( i = 1 ; i <= n ; i++ ){
    printf("node %d: key = %d, ",i,A[i]);
    if( parent(i) >= 1 ) printf("parent key = %d, ",A[parent(i)]);
    if( left(i) <= n )   printf("left key = %d, ",A[left(i)]);
    if( right(i) <= n )  printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  for( i= 1; i< n; i++);
  
  return 0;
    
}



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

inline int readint(){
	int x; scanf("%d",&x); return x;
}

bool vis[105];

int main(){
	int n = readint(), k = readint();
	for(int d; k; --k){
		d = readint();
		while(d --)
			vis[readint()] = 1;
	}
	int ans = 0;
	for(int i=1; i<=n; ++i)
		if(not vis[i])
			++ ans;
	printf("%d\n",ans);
	return 0;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define mp make_pair


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


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

  ll a, b, n; cin >> a >> b >> n;
  ll x = min(b-1, n);

  cout << floor(a * x / b) - a * floor(x / b) << endl;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

ll a[4];

int main() {
//	file_put();
	
	rep(i,0,3) scanf("%lld",&a[i]);
	sort(a,a+3);
	rep(i,0,3) if (a[i]&1^1) return 0*printf("0\n");
	printf("%lld\n",a[0]*a[1]); 
	
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int i = 0; i<n; i++) {
		int a, f;
		cin >> a;
		f = a*a;
		char b[100][100], c[100][100];
		for (int j = 0; j < a; j++) {
			for (int z = 0; z < a; z++) {
				b[j][z] = ' ';
				c[j][z] = ' ';
			}
		}
		int h = (a - 1), w = 0, h2 = -1, w2 = 0;
		b[h][w] = '#';
		c[h][w + 1] = '#';
		c[h][w] = '#';
		f -= 2;
		int k = 0;
		while (f >= 0) {
			if (h + h2 >= a || h + h2 < 0 || w + w2 >= a || w + w2 < 0 || c[h + h2][w+w2] == '#' ) {
				if (h2 == -1) {
					h2 = 0;
					w2 = 1;
				}
				else if (h2 == 1) {
					h2 = 0;
					w2 = -1;
				}
				else if (w2 == -1) {
					w2 = 0;
					h2 = -1;
				}
				else if (w2 == 1) {
					w2 = 0;
					h2 = 1;
				}
			}
			h += h2;
			w += w2;
			if (c[h][w] != '#')
				f--;
			b[h][w] = '#';
			c[h][w] = '#';
			if (h2 == -1) {
				if (c[h][w + 1] != '#')
					f--;
				c[h][w + 1] = '#';
			}
			else if (h2 == 1) {
				if (c[h][w - 1] != '#')
					f--;
				c[h][w - 1] = '#';
			}
			else if (w2 == -1) {
				if (c[h - 1][w] != '#')
					f--;
				c[h - 1][w] = '#';
			}
			else if (w2 == 1) {
				if (c[h + 1][w] != '#')
					f--;
				c[h + 1][w] = '#';
			}
			if (f == 0) {
				k++;
				if (k ==2) {
					f--;
				}
			}
			if (a % 2 == 1 && f == 0)
				break;
		}
		for (int i = 0; i<a; i++) {
			for (int j = 0; j<a; j++) {
				cout << b[i][j];
			}
			cout << endl;
		}
		if (i < n - 1)
			cout << endl;
	}
}

Measured memory_bytes: 3036