akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pi;
const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	double L;cin>>L;
	double x= (L/3);
	double ans = x*x*x;
	cout.precision(17);
	cout<<ans;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<numeric>
#include<vector>
#include<tuple>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
typedef long long ll;
const int MOD = 1e9 + 7;

char a[100][100];
int H, W;

int main(void)
{
	cin >> H >> W;
	FOR(i, 0, H) {
		FOR(k, 0, W) {
			cin >> a[i][k];
		}
	}
	FOR(i, 0, W + 2)cout << "#";
	cout << endl;
	FOR(i, 0, H) {
		cout << "#"; FOR(k, 0, W)cout << a[i][k]; cout << "#" << endl;
	}
	FOR(i, 0, W + 2)cout << "#";
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] line1 = line.split(" ");
        int a = Integer.parseInt(line1[0]);
        int b = Integer.parseInt(line1[1]);
        System.out.println((a * 3 + b) / 2);
    }
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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()
{
  int n, m; cin >> n >> m;
  vector<P> vec(m);
  rep(i, m) cin >> vec[i].first >> vec[i].second;
  auto comp = [&](P a, P b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
  };
  sort(ALL(vec), comp);

  int ans = 0, cur = -INF;
  rep(i, m) {
    if(vec[i].first < cur) continue;

    ++ans;
    cur = vec[i].second;
  }
  cout << ans << endl;
}

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

#include <iostream>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<string> strs = {"dream", "dreamer", "erase", "eraser"};
  for (auto& str : strs) {
    reverse(str.begin(), str.end());
  }
  reverse(s.begin(), s.end());

  bool result = true;
  while (s.size() != 0) {
    bool match = false;
    for (auto str : strs) {
      if (equal(str.begin(), str.end(), s.begin())) {
        match = true;
        s = s.substr(str.size());
        break;
      }
    }
    if (!match) {
      result = false;
      break;
    }
  }

  if (result) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#define maxn 1000000+10
using namespace std;
int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3)+(x<<1)+c-48;
		c=getchar();
	}
	return x*f;
}
int f[maxn];
int main(){
	int k,m,n;
	string s;
	n=read();m=read();
	cin>>s;
	for(register int i=0;i<n;i++){
		f[i+1]+=f[i];
		if(s[i]=='C' && s[i-1]=='A'){
			f[i+1]++;
		}	
	}
	for(register int i=1;i<=m;i++){
		int l,r;
		l=read();r=read();
		printf("%d\n",f[r]-f[l]);
	}
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main(){
  int N,i=0;

  cin >> N;

  string result = "";

  if(N==0){
    result =  "0";
  }

  while(N != 0){
    if(N%2!=0){
      result = "1" + result;
      if(i%2==0){
        N = (N-1)/2;
      }else{
        N = (N+1)/2 ;
      }
    }
    else{
      result = "0" + result;
      N /= 2;
    }
    i += 1;
  }

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
t=10**9+7
s=[1,0,0,0]
n=input()
for i in n:
    if i=="?":
        for j in range(3,0,-1):
            s[j]*=3
            s[j]+=s[j-1]
            s[j]%=t
        s[0]*=3
        s[0]%=t
    else:
        j="1ABC".index(i)
        s[j]+=s[j-1]
        s[j]%=t
print(s[3])

Measured memory_bytes: 3188
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

map< int64_t, int > kai;

void prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;

  for(auto p : ret) {
      if(kai[p.first] < p.second){
          kai[p.first] = p.second;
      }
      /*
      decltype(kai)::iterator it = kai.find(p.first);
      if (it != kai.end()) {
          if(it->second < p.second){
              kai.insert(MP(p.first,p.second));
          }
      }
      else{
          kai.insert(MP(p.first,p.second));
      }
      */
  }

  return ;
}

LL mypow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}
void Main()
{
    int n;cin>>n;
    VI a(n);
    REP(i, n) cin >> a[i];

    sort(ALL(a), greater<int>());


    FOR(i,0,n){
        prime_factor(a[i]);
    }

    LL koubai=1;
    for(auto p : kai) {
        koubai *= modpow(p.first,p.second);
        koubai %= MOD;
    }

    //dump(koubai)

    LL result = 0;
    REP(i,n){
        result += moddev(koubai ,a[i]);
        result %= MOD;
    }
    
    cout << result << endl;

	return;
}

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

Measured memory_bytes: 896
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int n,a[200000],i,b[200000];
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
		b[i]=a[i];
	}
	sort(b,b+n);
	for(i=0;i<n;i++){
		if(abs(a[i]-b[n/2])>=abs(a[i]-b[n/2-1]))cout<<b[n/2]<<endl;
		if(abs(a[i]-b[n/2])<abs(a[i]-b[n/2-1]))cout<<b[n/2-1]<<endl;
	}
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;

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

  int cnt0 = 0, cnt1 = 0;
  for (int i = 0; i < s.size(); ++i) {
    cnt0 += (s[i] - '0') != (i % 2);
    cnt1 += (s[i] - '0') == (i % 2);
  }

  cout << min(cnt0, cnt1) << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;

int main(int argc, char ** argv) {
	int N, a, b;
	scanf("%d%d%d", &N, &a, &b);
	printf("%d\n", min(N*a, b));	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a<=8&&b<=8){
      System.out.println("Yay!");
    }else{
      System.out.println(":(");
    }

 }
}

Measured memory_bytes: 21844
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# AISing Programming Contest 2019：C - Alternating Path
C = '#.'
CR = {'#':0, '.':1}

H, W = [int(i) for i in raw_input().strip().split(' ')]
S = []
for _ in range(H):
    # S.append(raw_input().strip())
    S.append([CR[c] for c in raw_input().strip()])


def find(h, w, sumi):
    while True:
        if sumi[h][w] == False:
            return (h, w)
        w += 1
        if w >= W:
            w = 0
            h += 1
            if h >= H:
                return None
    return None


'''
def chain((h, w), t, c, sumi):
    if 0 <= h < H and 0 <= w < W:
        pass
    else:
        return c
    if sumi[h][w]:
        return c
    if S[h][w] == t:
        sumi[h][w] = True
        c[t] += 1
        for ptr in [(-1, 0), (0, 1), (1, 0), (0, -1)]:
            c = chain((h+ptr[0], w+ptr[1]), 1-t, c, sumi)
        return c
    return c
'''


# dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
dd = [(0, 1), (1, 0), (0, -1), (-1, 0)]

def find_chain((hh, ww), t, sumi):
    # chain_sumi = [[False for _ in range(W)] for _ in range(H)]
    chain_sumi = set()
    h, w = hh, ww
    sumi[h][w] = True
    chain_sumi.add((h, w))
    c = [0, 0]
    c[t] = 1
    d = 0
    stack = []
    while True:
        while True:
            if d >= 4:
                break
            hd = h + dd[d][0]
            wd = w + dd[d][1]
            d += 1
            if 0 <= hd < H and 0 <= wd < W:
                if (hd, wd) not in chain_sumi:
                    td = S[hd][wd]
                    if td == t-((hh+ww+hd+wd)&1):
                        sumi[hd][wd] = True
                        chain_sumi.add((hd, wd))
                        c[td] += 1
                        stack.append([h, w, d])
                        h , w, d = hd, wd, 0
        if len(stack) == 0:
            break
        h, w, d = stack.pop()
    # print 'sumi :', sumi
    # print 'chain_sumi :', chain_sumi
    return c


def main():
    sumi = [[False for _ in range(W)] for _ in range(H)]
    h, w = 0, 0
    n = 0
    while True:
        # print 'sumi:', sumi
        result = find(h, w, sumi)
        if not result:
            break
        h, w = result[0], result[1]
        # print 'found:', h, w
        c = find_chain((h, w), S[h][w], sumi)
        # print c
        n += c[0] * c[1]
    print n


if __name__ == '__main__':
    main()


Measured memory_bytes: 41080
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveD();
	}

	private void solveD() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.nextLine();
		int x = sc.nextInt();
		int y = sc.nextInt();

		List<Integer> f_list = new ArrayList<>();
		{
			int f_count = 0;
			for (int i = 0; i < s.length(); i++) {
				char c = s.charAt(i);
				if (c == 'F') {
					f_count++;
				}
				if (c == 'T') {
					f_list.add(f_count);
					f_count = 0;
				}
			}
			f_list.add(f_count);
		}

		Set<Integer> x_set = new HashSet<>();
		Set<Integer> y_set = new HashSet<>();

		x_set.add(f_list.get(0));
		y_set.add(0);

		for (int index = 1; index < f_list.size(); index++) {
			Set<Integer> next_set = new HashSet<>();
			int f = f_list.get(index);
			if (index % 2 == 0) {
				for (int tmp_x : x_set) {
					next_set.add(tmp_x + f);
					next_set.add(tmp_x - f);
				}
				x_set = next_set;
			} else {
				for (int tmp_y : y_set) {
					next_set.add(tmp_y + f);
					next_set.add(tmp_y - f);
				}
				y_set = next_set;
			}
		}
		if (x_set.contains(x) && y_set.contains(y)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 134964
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H, N;
    cin >> H >> N;
    vector<ll> A(N);
    ll sum = 0;
    REP(i,N){
        cin >> A[i];
        sum += A[i];
    }
    if(H <= sum) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
 	int x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int x3,y3,x4,y4;
	x3 = x2 - (y2 - y1);
	y3 = y2 + (x2 - x1);
	x4 = x3 - (x2 - x1);
	y4 = y3 - (y2 - y1);
	
	cout << x3 << " " << y3 << " "<< x4 << " "<< y4 << " " << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const int MOD=1e9+7;

//const int MOD=998244353;
const double PI=3.14159265359;





int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n,k;
    cin>>n>>k;
    
    vector<long long> v(n);
    for(auto &i:v) cin>>i;
    
    long long ans=1e18;
    
    for(int i=0; i+k-1<n; i++){
        long long l=v[i], r=v[i+k-1];
        if(r<=0){
            ans=min(ans, -l);
        }
        else if(l>=0){
            ans=min(ans, r);
        }
        else{
            ans= min(ans,min(-2*l+r, 2*r-l));
        }
        
    }
    
    cout<<ans;
    
    
    return 0;
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;

int main(){
  int n;
  cin >> n;
  ll x[n], y[n];
  REP(i,n) cin >> x[i] >> y[i];
  map<p,ll> xy;
  REP(i,n) xy[p(x[i],y[i])]=i;
  map<p,ll> mp;
  for(int i = 0; i < n-1; i++){
    for(int j = i+1; j < n; j++){
      mp[p(x[i]-x[j],y[i]-y[j])]++;
      mp[p(x[j]-x[i],y[j]-y[i])]++;
    }
  }
  ll m = 0;
  for(auto itr=mp.begin(); itr!=mp.end(); ++itr){
    //cout << itr->first.first << itr->first.second << itr->second << endl;
    m = max(m,itr->second);
  }
  cout << n-m << endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static int A;
	public static int B;
	public static int C;

	public static void main(String[] args) {
		init();
		if ((A == B && B != C) || (B == C && C != A) || (C == A && A != B)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

	public static void init() {
		Scanner sc = new Scanner(System.in);
		try {
			A = sc.nextInt();
			B = sc.nextInt();
			C = sc.nextInt();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}


Measured memory_bytes: 23124
#include<stdio.h>

int main(void)
{
	int i,a,b;
	int n, m, k;
	char s[4], t[20];

	scanf("%d", &i);
	if (i >= 30) {
		printf("Yes");
		return 0;
	}


		printf("No");

	return 0;
}

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

int min_n(vector<int> vec) {
    int m = vec.at(0);
    for (int i = 1; i < vec.size(); i++) {
        if (m > vec.at(i)) {
            m = vec.at(i);
        }
    }
    return m;
}

int main() {
    int n, k; cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    int min_a = min_n(a);
    vector<bool> dp(k+1, false);
    for (int i = min_a; i <= k; i++) {
        for (int j = 0; j < n; j++) {
            int idx = i - a.at(j);
            if (idx >= 0 && !dp.at(idx)) {
                dp.at(i) = true;
            }
        }
    }
    if (dp.at(k)) {
        cout << "First" << endl;
    } else {
        cout << "Second" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int a, b; cin >> a >> b;
	if(a <= 0 && b >= 0){
		cout << "Zero" << endl;
		return 0;
	}
	if(a > 0 || (b - a) % 2){
		cout << "Positive" << endl;
		return 0;
	}
	cout << "Negative" << endl;
	
	return 0;
}

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 int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

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;
}
template<class T>
void DEBUG_DP(T* viewdp, int ilen, int jlen){
    REP(i,ilen){
        REP(j,jlen){
            if(viewdp[i][j] != -1)
                printf("[% 4d]", viewdp[i][j]);
            else
                printf("[    ]");
        }
        puts("");
    }
}
const int N=81;
const int C=6400;
const int K=C*2+1;
int h,w;
int a[N][N], b[N][N];
bitset<K> dp[N][N];
int ans = INT_MAX;

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

    REP(i,N){
        fill(a[i], a[i]+N, -1);
        fill(b[i], b[i]+N, -1);
    }

    cin>>h>>w;

    REP(i,h) REP(j,w) cin>>a[i][j];
    REP(i,h) REP(j,w) cin>>b[i][j];

    //int sx=0,sy=0, gx=w-1, gy=h-1;
    dp[0][0][abs(a[0][0]-b[0][0]) + 6400]=true;

    REP(i,h) REP(j,w){
        int ab =abs(a[i+1][j]-b[i+1][j]);

        dp[i+1][j] |= dp[i][j] << ab;
        dp[i+1][j] |= dp[i][j] >> ab;

        ab =abs(a[i][j+1]-b[i][j+1]);
        dp[i][j+1] |= dp[i][j] << ab;
        dp[i][j+1] |= dp[i][j] >> ab;
    }

    REP(i,K){
        if(dp[h-1][w-1][i]) chmin(ans, abs(6400-i));
    }

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

Measured memory_bytes: 10624
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

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

using namespace std;

int main(void)
{
	int t;
	cin >> t;
	while(t--){
		int n, k;
		int y_sum;
		int ans;
		cin >> n >> k;
		vector<int> x(n), y(n-1);
		//配列xに家の位置を入力
		rep(i, n){
			cin >> x[i];
		}
		//kがn以上なら確実に0
		if (k >= n){
			cout << 0 << endl;
			continue;
		}
		//区間距離の配列yを構成
		rep(i, n-1){
			y[i] = x[i+1]-x[i];
		}
		//区間距離を降順でソート
		sort(y.begin(), y.end(), [](int x, int y){return x > y;});

		y_sum = accumulate(y.begin(), y.begin()+k-1, 0);
		ans = (x[n-1]-x[0]) - y_sum;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3552
N, X, M = map(int, input().split())

d = {}
l = []
for i in range(N):
    if X in d:
        break
    d[X] = i
    l.append(X)
    X = X*X%M
else:
    print(sum(l))
    exit()

s = d[X]

q, r = divmod(N-s,i-s)
ans = sum(l[:s])+q*sum(l[s:i])+sum(l[s:s+r])
print(ans)

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

#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define MAX 1e9
#define MIN -1e9
#define mod 1000000007
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define mxn 300005
using namespace std;

int main()
{
	FLASH
	ll a,b,c;
	cin >> a >> b >> c;
	ll k;
	cin >> k;
	ll ans = 0;
	if(a >= b){
		ll  val = a - b;
		while(a >= b){
			b *= 2;
			ans++;
		} 
	}
	if(b >= c){
		while(b >= c){
			c *= 2;
			ans++;
		}
	}
	if(ans <= k){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 3584
# coding: utf-8
# Your code here!
N=int(input())

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
        
ANS=num2alpha(N)
print(ANS.lower())




Measured memory_bytes: 9164
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] aegs){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
        int a = 0;
        String t = "";
        while (true){
            try {
                t = br.readLine();
                if(t == null){
                    break;
                }
                a = Integer.parseInt(t);
            } catch (NumberFormatException e) {
                // TODO ????????????????????? catch ????????????
                e.printStackTrace();
            } catch (IOException e) {
                // TODO ????????????????????? catch ????????????
                e.printStackTrace();
            }
         
 
        int b = 0;
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                for(int k=0;k<10;k++){
                    for(int l=0;l<10;l++){
                        if((i+j+k+l) == a){
                            b++;
                             
                        }
                    }
                }
            }
         
        }
         
        System.out.println(b);
        }
         
    }
 
}

Measured memory_bytes: 24884
ans_list = []
while True:
    s = input()
    if s == ".":
        break
    q_list = ["" for i in range(len(s))]
    now = -1
    ans = "yes"
    for i in list(s):
        if i == "(" or i == "[":
            now += 1
            q_list[now] = i
        elif i == ")":
            if now == -1:
                ans = "no"
            elif q_list[now] == "(":
                now -= 1
            else:
                ans = "no"
        elif i == "]":
            if now == -1:
                ans = "no"
            elif q_list[now] == "[":
                now -= 1
            else:
                ans = "no"
        if ans == "no":
            break
    if now >= 0:
        ans = "no"
    ans_list.append(ans)

for i in ans_list:
    print(i)


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

// #define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int k, x;
  cin >> k >> x;

  for ( int i = max(-1000000, x-k+1); i <= min(1000000, x+k-1); i++ ) {
    cout << i << " ";
  }
  cout << endl;
  
  return 0;
}


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

int main(){
  int N, x;
  cin >> N;
  x = 1;
  for(int i = 0;i < N; i++){
    int K;
    cin >> K;
    if (x < K){
      x *= 2;
    }
    else{
      x += K;
    }
  }
  cout << x <<endl;
}

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

#define rep for(int i = 0;i<n;i++)
const int MOD = 1000000007;

int main(){
  string s;cin >> s;
  int i = 0; int ans = 0;bool frag = false;
  while(i < s.size()){
    if(i== s.size()-1){ ans++; break;}
    if(s.at(i+1)== s.at(i) and i<s.size()-1){
      if(frag == true){
              frag = false;
      }else{
              frag = true;
              i++;
      }
    }else{
            frag = false;
    }
    ans += 1; i++;
    //cout << ans <<" "<< i <<  endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        String[] lines = getStdin();
        String str = lines[0];
        String[] str1 = str.split(" ");
        long a = Long.parseLong(str1[0]);
        long b = Long.parseLong(str1[1]);
        long d;
        long r;
        double f;

        d = a / b;
        r = a % b;
        f = (double) a / (double) b;

        System.out.printf("%d %d %.9f", d, r, f);
    }

  
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
  
}


Measured memory_bytes: 26312
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int Max=1000007;

bool visit[Max];
int prime[Max];
int num=0;
void init_prim()
{
    memset(visit, true, sizeof(visit));
    for (int i = 2; i <Max; ++i)
    {
        if (visit[i] == true)
        {
            num++;
            prime[num] = i;
        }
        for (int j = 1; ((j <= num) && (i * prime[j] <= 1000000));  ++j)
        {
            visit[i * prime[j]] = false;
            if (i % prime[j] == 0) break;
        }
    }
}

int main()
{
    int n;
    init_prim();
    while(~scanf("%d",&n))
    {
        int l=lower_bound(prime,prime+num,n)-prime;
        if(prime[l]>n)
            l=l-1;
        printf("%d\n",l);
    }
    return 0;
}

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

int main() {
    
    int N;
    cin >> N;
    vector<int> parent(N);
    vector<vector<int>> child(N);
    parent[0] = -1;
    for (int i = 1; i < N; i++) {
        int p;
        cin >> p;
        p--;
        parent[i] = p;
        child[p].push_back(i);
    }
    vector<int> X(N);
    for (int i = 0; i < N; i++) cin >> X[i];
    int inf = 99999999;
    vector<int> dp(N, inf);
    for (int i = N-1; i >= 0; i--) {
        if (child[i].empty()) {
            dp[i] = 0;
            continue;
        }
        
        int sum = 0;
        int m = (int)child[i].size();
        vector<vector<bool>> small_dp(m + 1, vector<bool>(X[i]+1, false));
        small_dp[0][0] = true;
        for (int j = 0; j < m; j++) {
            int c = child[i][j];
            sum += X[c] + dp[c];
            for (int k = 0; k <= X[i]; k++) {
                if (small_dp[j][k]) {
                    if (k + dp[c] <= X[i]) small_dp[j+1][k + dp[c]] = true;
                    if (k + X[c] <= X[i]) small_dp[j+1][k + X[c]] = true;
                }
            }
        }
        
        for (int j = 0; j <= X[i]; j++) {
            if (small_dp[m][j]) {
                dp[i] = min(dp[i], sum - j);
                if (sum - j <= X[i]) {
                    dp[i] = min(dp[i], j);
                }
            }
        }
        if (dp[i] == inf) {
            cout << "IMPOSSIBLE" << endl;
            return 0;
        }
    }
    cout << "POSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};

int main(){
    int N; cin >> N;
    vector<pair<int,int> > b;
    vector<pair<int,int> > r;
    bool ur[100],ub[100];
    for(int i=0;i<N;i++){
        int c,d; cin >> c >> d;
        r.push_back(make_pair(c,d));
    }
    for(int i=0;i<N;i++){
        int c,d; cin >> c >> d;
        b.push_back(make_pair(c,d));
    }
    for(int i=0;i<100;i++){
        ur[i] = ub[i] = false;
    }
    sort(b.begin(),b.end());
    sort(r.begin(),r.end());
    int cnt=0;
    //赤のほうが必ず小さくなる
    //青を見ていってペアにできるyが最大のものをつなげる
    for(int i=0;i<N;i++){
        cerr << b[i].first << "," << b[i].second << endl;
        int ma=-1;
        int mai=0;
        for(int j=0;j<N;j++){ // 赤を探す
            if(ur[j]) continue;//すでに使われている
            if(b[i].first>r[j].first && b[i].second>r[j].second){
            cerr << "\t" << r[j].first << "," << r[j].second << endl;
                if(ma<r[j].second){
                    mai=j;
                    ma=r[j].second;
                }
            }
        }
        if(ma<0) continue;

        ur[mai]=true;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;

int main() {
	//freopen("/Users/liyingyan/Documents/ACM/in.txt", "r", stdin);
	//std::ios::sync_with_stdio(false);
	int n, d, x;
	int ans = 0;
	cin >> n >> d >> x;
	for(int i=0; i<n; i++) {
		int a;
		cin >> a;
		ans += (d-1)/a + 1;
	}
	ans += x;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//
// Created by ZEN on 2019/10/20.
//

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a, n, k, q;
    cin >> n >> k >> q;
    vector<int> points(n, k - q);
    vector<int> winner(q);
    for (int i = 0; i < q; ++i) {
        cin >> a;
        winner.at(i) = a;
    }
    for (int j = 0; j < q; ++j) {
        points.at(winner.at(j) - 1)++;
    }
    for (int l = 0; l < n; ++l) {
        if (points.at(l) > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 1408
"""#################################################################
【ABC118】
B_Foods_Loved_by_Everyone
#################################################################"""

#インポート
import sys

#入力用
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IS(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def SS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()

lst = []
cnt = 0
N, M = IS()
for i in range(N):
    lst += (LI()[1:])
for i in range(1, M+1):
    if lst.count(i) == N:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

int main(){
    int A,B,C; cin >> A >> B >> C;

    if(A%2 == B%2 && B%2 == C%2){
        int m = max(A, max(B,C));
        int ans = 0;
        ans += abs(A-m)/2;
        ans += abs(B-m)/2;
        ans += abs(C-m)/2;
        cout << ans << endl;
        return 0;
    }

    if(C < B) swap(B,C);
    if(C < A) swap(A,C);
    if(B < A) swap(A,B); // A <= B <= C
    int ans = 0;
    if(A%2 == B%2 && B%2 != C%2){
        A++; B++; ans++;
        ans += abs(C-A)/2;
        ans += abs(C-B)/2;
    }else if(B%2 == C%2 && C%2 != A%2){
        B++; C++; ans++;
        ans += abs(C-A)/2;
        ans += abs(C-B)/2;
    }else if(C%2 == A%2 && A%2 != B%2){
        A++; C++; ans++;
        ans += abs(C-A)/2;
        ans += abs(C-B)/2;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;

/**
 *
 * @author Node2
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String str = in.readLine();

        Deque<Integer> a = new ArrayDeque();
        for (int i = 0; i < str.length(); i++) {
            char buf = str.charAt(i);
            switch (buf) {
                case 'a':
                    a.addLast(0);
                    break;
                case 'b':
                    a.addLast(1);
                    break;
                case 'c':
                    a.add(2);
                    break;
            }
        }

        str = in.readLine();

        Deque<Integer> b = new ArrayDeque();
        for (int i = 0; i < str.length(); i++) {
            char buf = str.charAt(i);
            switch (buf) {
                case 'a':
                    b.addLast(0);
                    break;
                case 'b':
                    b.addLast(1);
                    break;
                case 'c':
                    b.add(2);
                    break;
            }
        }
        str = in.readLine();

        Deque<Integer> c = new ArrayDeque();
        for (int i = 0; i < str.length(); i++) {
            char buf = str.charAt(i);
            switch (buf) {
                case 'a':
                    c.addLast(0);
                    break;
                case 'b':
                    c.addLast(1);
                    break;
                case 'c':
                    c.add(2);
                    break;
            }
        }
        String anser;

        if (a.isEmpty()) {
            anser = "A";
        } else {
            int g = a.pop();
            while (true) {
                if (g == 0) {

                    if (a.isEmpty()) {
                        anser = "A";
                        break;
                    } else {
                        g = a.pop();
                    }
                }else if(g==1){
                    if (b.isEmpty()) {
                        anser = "B";
                        break;
                    } else {
                        g = b.pop();
                    }                    
                }else{
                    if (c.isEmpty()) {
                        anser = "C";
                        break;
                    } else {
                        g = c.pop();
                    }                      
                }

            }
        }
        System.out.println(anser);
    }

}

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

string Replace(string s,int a,int b,string t){
  for(int i=a;i<=b;i++){
    s[i]=t[i-a];
  }
  return s;
}

string Reverse(string s,int a,int b){
  int i=a;
  int j=b;
  while(i<j){
    swap(s[i],s[j]);
    i++;
    j--;  
  }
  return s;
}

void Print(string s,int a,int b){
  for(int i=a;i<=b;i++){
    cout<<s[i];
  }
  cout<<endl;
}

int main(){
  string str;
  cin>>str;
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    string command;
    cin>>command;
    int a,b;
    cin>>a>>b;
    if(command=="replace"){
      string t;
      cin>>t;
      str=Replace(str,a,b,t);
    }else if(command=="reverse"){
      str=Reverse(str,a,b);
    }else if(command=="print"){
      Print(str,a,b);
    }
  }
  return 0;
}



Measured memory_bytes: 3220
/*input
4
3 3 3 2
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define YY cout<<"YES\n"
#define NN cout<<"NO\n"
#define yy cout<<"Yes\n"
#define nn cout<<"No\n"
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int a[maxn];
multiset<int> st;
int main()
{
	IOS;
	int n;
	cin>>n;
	REP(i,n) cin>>a[i];
	int mx=*max_element(a,a+n);
	REP(i,n) st.insert(a[i]);
	REP(i,mx+1){
		int cur=max(i,mx-i);
		if(!st.count(cur)){
			cout<<"Impossible\n";
			return 0;
		}
		st.erase(st.lower_bound(cur));
	}
	for(int i:st){
		if(i<(mx+1)/2+1){
			cout<<"Impossible\n";
			return 0;
		}
	}
	cout<<"Possible\n";
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			Map<String, String> map = new HashMap<String, String>();
			while (n-- > 0) {
				String k = scanner.next();
				String v = scanner.next();
				map.put(k, v);
			}
			int m = scanner.nextInt();
			while (m-- > 0) {
				String ans = scanner.next();
				if (map.containsKey(ans))
					ans = map.get(ans);
				System.out.print(ans);
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 70088
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
using static System.Array;

class MainClass : Scanner
{
    static void Main()
    {
        string S = RString();
        string T = RString();

        int N = S.Length;
        int M = T.Length;
        int max = 0;
        for (int i = 0; i < N-M+1; i++)
        {
            int same = 0;
            for (int j = 0; j < M; j++)
            {
                if (S[i + j] == T[j]) same++;
            }
            max = Math.Max(max,same);
        }
        WriteLine(M-max);
    }
}

class Scanner
{
    public static int RInt() => int.Parse(Console.ReadLine());
    public static long RLong() => long.Parse(Console.ReadLine());
    public static string RString() => Console.ReadLine();
    public static double RDouble() => double.Parse(Console.ReadLine());

    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static string[] RStrings() => Console.ReadLine().Split();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static T1 ReadStream<T1>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadStream<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadStream<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadStream<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}

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


int n, m; 

vector<int> p;

int main() {
	cin >> n >> m;
	Graph v(m);
	vector<int> p(m);

	for (int i = 0; i < m; i++)
	{
		int k;
		cin >> k;
		for (int j = 0; j < k; j++)
		{
			int x;
			cin >> x;
			v[i].push_back(x - 1);
		}
	}

	rep(i,m) cin >> p.at(i);

	int ans = 0;
	
	for (int i = 0; i < (1<<n); i++)
	{
		bool ok = 1;
		for (int j = 0; j < m; j++)
		{
			int cnt = 0;
			for (auto t : v.at(j)) {
				if ((1 << t) & i)cnt++;
			}
			if (cnt % 2 != p[j])ok = 0;
		}
		ans += ok;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3636
n = int(input())
b = -2

remains = []
if n == 0:
    print(0)
else:
    while n != 0:
        remain = n%b
        n = n//b

        if remain<0:
            remain += -b
            n += 1
        remains.append(remain)

    remains = list(map(str,remains))
    ans = ''.join(remains)[::-1]
    print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll         long long int 
#define pb         push_back
#define umap       unordered_map
#define mod        1000000007
#define all(x)     (x).begin(), (x).end()
#define rall(x)    (x).rbegin(), (x).rend()
#define MN(a,b,c)  min(a,min(b,c))
#define MX(a,b,c)  max(a,max(b,c))
#define pr1         pair<ll,ll>
#define F          first
#define S          second
#define mP         make_pair
#define f(i,n)     for(int i=0;i<n;i++)
#define f1(i,x,y)  for(int i=x;i<=y;i++)
#define f2(i,x,y)  for(int i=x;i>=y;i--)
#define yes        cout<<"Yes"<<"\n"
#define no         cout<<"No"<<"\n"
#define modsum(a,b)  ((a%mod)+(b%mod))%mod
#define modpro(a,b)  ((a%mod)*(b%mod))%mod
//__builtin_popcount(x)
//__builtin_parity(x)   =(number of set bits)%2
//__builtin_clz(x)      to count the number of leading  zeroes 
//__builtin_ctz(x)      to count the number of trailing zeroes 
//__gcd(a,b)
using namespace std;
ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=((result%M) *(x%M))%M;
        x=((x%M)*(x%M))%M;
        n=n/2;
    }
    return result;
}
ll binaryExponentiation(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
        if(result<0)return result;
    }
    return result;
}
ll pow1(ll x,ll y)
{
    ll z=1;
    while(y--){z=z*x;}
    return z;
}
int main()
{
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
  int x;cin>>x;
  cout<<1-x;
}


  

Measured memory_bytes: 3652