akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
1の数、2の数、3以上の数かな
2以上しかとらないか
2と3以上の数か

1=f
3~ = f

1 1 = 1 2 = s
2 2 = 3~ 3~ = f 1 3 = s 1 1= f1 0 = s
1 3~ = f 1 1 = s 1 0 = f

1 1 1 = f
1 1 3~ = f1 1 0 = s 1 0 = f
1 3 3 = f 0 3 3 = s 0 2 3 = f 2,2 = f
      = f 1 3 1 = s
3 3 3 = f 1 3 3 = f

1,1,1,3 = f
1,1,3,3 = f 1,1,2,3 = s1,2,3= f1,2,2,= s2,2= f1,2= s1,1=s
        = f 1,3,3 = s 3,3 = f 2,3 = s 2,2 = f 1,2 = s
(1,3)
1,0=f
0,1=f

2,0=s
1,1=f
0,2=s

3,0=f
2,1=f
1,2=f
0,3=f

4,0=s
3,1=f
2,2=s

交互にとってじりひんになる＝XORの判定
XOR=0にできれば不正者の勝ち
ああ、上からかえていくのか

XOR=
110001011とかだとしたら

6 4
110
100

010

101
100

001

110000
101111
011111

XOR自身が0ならスルー
XOR自身が1でもともと0ならスルー
XOR＆K

1回もとのものをかける？
101111
そこから1ひいたものをかける
101111
000000

結果、
110000
101111
011111
A^（A-1）をかけるのか
これは用意しておくやつ

ああ、1ひいてその桁が0になる保証がないのか
それどうするん。。。
ああ、1引いてその桁が0になっているかを確認すればいいのか

ああ、1引いてもっと上位桁がかわってしまうものが該当することもある？
それはない、1でひっかけてる

ああ、
3&(1<<2) = 2がかえってくるのか。01じゃないんだ
*/
int main(){
  ll N; cin>>N;
  vector<ll> A(N,0);
  vector<bool> used(N,false);
  ll x=0,cnt=0;
  for(ll i=0; i<N; i++) cin>>A[i];
  for(ll i=0; i<N; i++) x^=A[i];
  for(ll i=30; i>=0; i--){
    ll n=1<<i;
    if((x&n)==0) continue;
    for(ll j=0; j<N; j++){
      if(used[j]) continue;
      if((A[j]&n)==0) continue;//もともと0だったらだめ
      if(((A[j]-1)&n)==n) continue;//1ひいてその桁がかわらないならだめ
      used[j]=true;
      ll tmp=A[j]^(A[j]-1);
      x^=tmp;
      cnt++;
      break;
    }
    if((x&n)==n){
      cout<<-1<<endl;
      return 0;
    }
  }
  cout<<cnt<<endl;
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 998244353;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

template <typename T>
T mypow(T a, T b)
{
    if (b == 0)
        return 1;
    T tmp = mypow(a, b / 2);
    if (b % 2)
        return (((tmp * tmp) % MOD) * a) % MOD;
    else
        return (tmp * tmp) % MOD;
}

ll dp[310][100010][4];

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

    int n;
    cin >> n;
    int sum = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    dp[0][0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= sum; j++)
        {
            for (int k = 0; k < 4; k++)
            {
                if (dp[i][j][k] == 0)
                    continue;

                dp[i + 1][j + a[i]][k] += dp[i][j][k];
                dp[i + 1][j + a[i]][k] %= MOD;

                for (int b = 0; b < 2; b++)
                {
                    dp[i + 1][j][k | (1 << b)] += dp[i][j][k];
                    dp[i + 1][j][k | (1 << b)] %= MOD;
                }
            }
        }
    }
    ll ret = mypow(3LL, (ll)n);
    for (int j = 0; j <= sum; j++)
    {
        if (2 * j <= sum)
            continue;
        for (int k = 0; k < 4; k++)
        {
            ret = ret + MOD - 3 * dp[n][j][k] % MOD;
            ret %= MOD;
        }
    }
    if (sum % 2 == 0)
    {
        ret = ret + MOD - 3 * dp[n][sum / 2][1] % MOD;
        ret %= MOD;

        ret = ret + MOD - 3 * dp[n][sum / 2][3] % MOD;
        ret %= MOD;
    }
    cout << ret << endl;
}


Measured memory_bytes: 882944
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = false;

int main(){

    int n;
    cin >> n;

    string s;
    cin >> s;

    if(n % 2){
        cout << "No" << endl;
        return 0;
    }

    for(int i = 0; i < n / 2; i++){
        if( s[i] != s[i + n / 2] ){
            cout << "No" << endl;
            return 0;
        }
    } 
            cout << "Yes" << endl;


}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

int N, M;

void solve() {
    // 差が奇数
    int a = 1;
    int b = (M+1)/2*2;
    REP (i, (M+1)/2) {
        cout << a << " " << b << endl;
        a++; b--;
    }

    // 差が偶数
    a = (M+1)/2*2+1;
    b = 2*M+1;
    REP (i, M/2) {
        cout << a << " " << b << endl;
        a++; b--;
    }
}

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

Measured memory_bytes: 3620
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=[0]
b=[0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i + j)
print(ans)

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

  ll A=in<ll>(),B=in<ll>();
  ll C=(B-A+1)/2,N=(B-A+1)%2;
  ll M=C%2;
  if(N){
    if(A%2){
      cout << (A^M) << endl;
    }
    else cout << (B^M) << endl;
  }
  else{
    if(!(A%2)){
      cout << (0^M) << endl;
    }
    else cout << (A^B^(M^1)) << endl;
  }
 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N;
    cin >> N;
    cout << (N + 1) * N / 2 << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	if (A + B >= 10) {
		cout << "error" << endl;
	}
	else {
		cout << A + B << endl;
	}




}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
typedef pair<ll, int> P;

int n, w, s, e;

int main(){
	string S; cin >> S;
	for(int i=0; i<S.size(); i++){
		if(S[i] == 'N') n++;
		if(S[i] == 'W') w++;
		if(S[i] == 'S') s++;
		if(S[i] == 'E') e++;
	}
	if(n*s==0 && (n+s != 0)){
		cout << "No" << "\n";
		return 0;
	}
	if(w*e==0 && (w+e != 0)){
		cout << "No" << "\n";
		return 0;
	}
	cout << "Yes" << "\n";
	return 0;
}


Measured memory_bytes: 256
import math
A, B, C, D = map(int, input().split())
X= (C * D) // math.gcd(C, D)

ansB = (B-B//C)+(B-B//D)-(B-B//X)
ansA = ((A-1)-((A-1)//C))+((A-1)-(A-1)//D)-((A-1)-(A-1)//X)

print(ansB-ansA)

Measured memory_bytes: 62140
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	int n, c, k;
	scanf("%d%d%d", &n, &c, &k);
	vector<int> t(n);
	for(int i = 0; i < n; i++){
		scanf("%d", &t[i]);
	}
	sort(t.begin(), t.end());
	int ans = 0, i = n - 1, x;
	while(i >= 0){
		ans++;
		x = 0;
		int p = t[i];
		while(i >= 0 && x < c && t[i] >= p - k){
			i--;
			x++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<set>
#include<cstdio>
using namespace std;

int main(){
    int N;cin>>N;
    if(N>=1000)cout<<"ABD"<<endl;
    else cout<<"ABC"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <math.h>
#define REP0(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REP1(i,n) for((i)=1;(i)<=(long long)(n);(i)++)
#define ll long long
using namespace std;

ll i,j;
const ll MOD = 1000000000 + 7;

int main(){
    int n;
    ll ans=0;
   

    cin>>n;
    if(n==0)ans=1;
    
    
    
   
    
    cout<<ans<<'\n';
    return 0;
}

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

typedef long long ll;
typedef long double ld;

int dp[200005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        dp[i] = i;
    }
    for(int j=6; j<=n; j*=6){
        for(int i=j; i<=n; i++){
            dp[i] = min(dp[i], dp[i-j] + 1);
        }
    }
    for(int j=9; j<=n; j*=9){
        for(int i=j; i<=n; i++){
            dp[i] = min(dp[i], dp[i-j] + 1);
        }
    }
    cout << dp[n] << "\n";
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <numeric>
#include <algorithm>
#define rep(it, ifrom, ito) for (auto it = ifrom; it != ito; ++it)
#define all(a) a.begin(), a.end()

using namespace std;

int main(int argc, char* argv[]) {
    bool debug = argc == 2 && (strcmp(argv[1], "debug") == 0);
    int N, M;
    scanf("%d %d", &N, &M);
    vector<int> Ps, Ys;
    rep(i, 0, M) {
        int tmp0, tmp1;
        scanf("%d %d", &tmp0, &tmp1);
        Ps.push_back(tmp0);
        Ys.push_back(tmp1);
    }

    if (debug) {
        printf("N=%d, M=%d\n", N, M);
        rep(i, 0, M) {
            printf("P[%d]=%d Y[%d]=%d\n", i, Ps[i], Ys[i]);
        }
    }

    unordered_map<int, vector<int>> cities_in_P(N);
    rep(i, 0, M) {
        cities_in_P[Ps[i]].emplace_back(Ys[i]);
    }
    for (auto& item : cities_in_P) {
        sort(all(item.second));
    }

    vector<int> Yorder(M, 0);
    rep(i, 0, M) {
        auto& C = cities_in_P[Ps[i]];
        Yorder[i] = distance(C.begin(), lower_bound(all(C), Ys[i]));
    }

    rep(i, 0, M) {
        printf("%06d%06d\n", Ps[i], Yorder[i] + 1);
    }

    return 0;
}


Measured memory_bytes: 11380
#include <stdio.h>
int a, b, c;
int main() {
	scanf("%d%d", &a, &b);
	if (a > b) {
		c = a;
		a = b;
		b = c;
	}
	for (int i = 0; i < b; i++) {
		printf("%d", a);
	}
	printf("\n");
}

Measured memory_bytes: 128
w,h,n=map(int,input().split())

ma_x=w
ma_y=h
mi_x=0
mi_y=0

for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        if mi_x<x:
            mi_x=x
    elif a==2:
        if ma_x>x:
            ma_x=x
    elif a==3:
        if mi_y<y:
            mi_y=y
    elif a==4:
        if ma_y>y:
            ma_y=y

if ma_x-mi_x<0 and ma_y-mi_y<0:
  ma_x=mi_x
            
ans=(ma_x-mi_x)*(ma_y-mi_y)

if ans<0:
    ans=0

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int mo=1000000007;
const int N=2005;
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
struct Edge{
	int x,y,v;
	bool operator <(const Edge &a)const{
		return v<a.v;
	}
}E[N];
struct edge{
	int to,next,v;
}e[N];
int head[N],tot,n,m;
int fa[N],dep[N];
int fl[N],fav[N];
ll D;
void add(int x,int y,int v){
	e[++tot]=(edge){y,head[x],v};
	head[x]=tot;
}
void dfs(int x){
	for (int i=head[x];i;i=e[i].next)
		if (e[i].to!=fa[x]){
			fa[e[i].to]=x;
			dep[e[i].to]=dep[x]+1;
			fav[e[i].to]=e[i].v;
			dfs(e[i].to);
		}
}
int calc(int x,int y){
	int ans=0;
	for (;x!=y;){
		if (dep[x]<dep[y])
			swap(x,y);
		ans=max(ans,fav[x]);
		x=fa[x];
	}
	return ans;
}
int get(int x){
	return x==fa[x]?x:fa[x]=get(fa[x]);
}
void build_tree(){
	sort(E+1,E+m+1);
	For(i,1,n) fa[i]=i;
	For(i,1,m){
		int x=get(E[i].x);
		int y=get(E[i].y);
		if (x!=y){
			fl[i]=1; fa[x]=y;
			D-=E[i].v;
			add(E[i].x,E[i].y,E[i].v);
			add(E[i].y,E[i].x,E[i].v);
		}
	}
	For(i,1,n) fa[i]=0;
	dfs(1);
}
int main(){
	scanf("%d%d%lld",&n,&m,&D);
	For(i,1,m) scanf("%d%d%d",&E[i].x,&E[i].y,&E[i].v);
	build_tree();
	if (D<0) return puts("0"),0;
	int eq=0,geq=0;
	For(i,1,m) if (!fl[i]){
		ll dif=E[i].v-calc(E[i].x,E[i].y);
		if (dif==D) ++eq; 
		if (dif>D) ++geq;
	}
	int ans=2ll*(power(2,eq)+mo-1)*power(2,geq)%mo;
	if (D==0) ans=(ans+1ll*(power(2,n-1)-2)*power(2,m-(n-1)))%mo;
	printf("%d\n",ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

#define ll long long
const long long llINF = 1LL << 60;
const int iINF = 1LL << 20;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { 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; }

void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}


void execute()
{
    int N;
    ll K;
    cin >> N;
    cin >> K;

    int A[200000];
    for(int i = 0l; i < N; i++){
        cin >> A[i];
        A[i]--;
    }

    int l = 0;
    ll c = 1;
    int T[200000]={0};
    T[l] = c++;
    for(;;){
        l = A[l];
        if(T[l] != 0){
            break;
        }
        T[l] = c++;
    }

    int begin = T[l] - 1;

    ll n = (K <= begin) ? K : (((K - begin) % (c-1-begin)) + begin);
    int v = 0;
    for(int i = 0; i < n; i++){
        v = A[v];
    }

    cout << v + 1 << endl; 
}


Measured memory_bytes: 5216
n = list(map(int, input().split()))
sw = []
for x in range(n[1]):
    sw.append(list(map(int, input().split())))
p = list(map(int, input().split()))
kumi = 0

for a in range(2 **n[0]):
    akari = 0
    kai = []
    for b in range(n[0]):
        if ((a >> b)& 1):
            kai.append(b+1)
    #print(kai)
    for c in range(n[1]):
        hantei = 0
        for d in range(1,sw[c][0]+1):
            if kai.count(sw[c][d]) >= 1:
                hantei +=1
        if p[c] == 0 and hantei %2 ==0:
            akari += 1
        elif p[c] == 1 and hantei %2 !=0:
            akari += 1
    if akari == n[1]:
        kumi += 1

print(kumi)

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

#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define pb  push_back

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;

const int N = 2e5 + 3;

int main() {

    int WA[105000] = {0};
    bool AC[105000] = {false};
    int n, m;
    cin >> n >> m;
    int wa = 0, ac = 0;

    while(m--) {
        int prob;
        string status;
        cin >> prob >> status;
        if(AC[prob])
            continue;
        if(status == "AC") {
            AC[prob] = true;
            ac++;
            wa += WA[prob];
        }
        else {
            WA[prob]++;
        }
    }
    cout << ac << " " << wa << '\n';
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr long long MOD = 1000000007;
constexpr long long INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    long long N;cin >> N;long long A;
    vector<long long> V(3,-1);
    ll ans = 1;
    REP(i,N){
        cin >> A;
        ll cnt = 0;
        REP(i,V.size()){
            if(V[i] == A - 1) cnt++;
        }
        if(cnt == 0){
            cout << 0 << endl;
            return 0;
        }
        //cout << cnt << endl;
        ans *= cnt;
        ans %= MOD;
        REP(i,V.size()){
            if(V[i] == A - 1){
                V[i]++;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (void){
    int c[3][3],d=0,i,j;
    for(i = 0; i < 3; i++){
        for(j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    for(i = 0; i < 2; i++){
        for(j = 0; j < 2; j++){
            if(c[i+1][j] - c[i][j] == c[i+1][j+1] - c[i][j+1]){
                d++;
            }
        }
    }
    if(d==4){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }


int n,m,x,a[N];
vi v[N];

void solve() {
     cin>>n>>m>>x;
     rep(i,0,n) {
		    cin>>a[i];
		    rep(j,0,m) {
				    int y;
				    cin>>y;
				    v[i].pb(y);			    
				}	     
		 }
	 
	 int mini=1e17;
	 for(int i=0;i<(1<<n);i++) {
		   vi nax;
		   vi res(m,0);
		   int sum=0;
		   for(int j=0;j<n;j++) {
			     if((i&(1<<j))!=0) {
					   nax.pb(j);  
					 }
			   }
			   
			//~ rep(j,0,sz(nax))
			 //~ cout<<nax[j]<<" ";
			 //~ cout<<endl;   
		   for(int j=0;j<sz(nax);j++) {
			      sum+=a[nax[j]];
			      int f=0;
			      for(int k=0;k<m;k++) {
					     res[k]+=v[nax[j]][k];
					  }
				  rep(k,0,m) {
					     if(res[k]<x) {
							    f=1;
							    break;
							 } 
					  }
				  if(!f) {
					    mini=min(mini,sum);
					  }	  	  
			   }			   
		 }	 
	 	 
	 	 if(mini==1e17) cout<<-1<<endl;
	 	 else cout<<mini<<endl;     
 }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


Measured memory_bytes: 8236
#include <bits/stdc++.h>
#define mdsaqib std::ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define all(c) (c).begin(),(c).end()
#define endl '\n'
using namespace std;

int mx=0,pr=0;
vector <bool> Vis(2*1e5+5,false);
vector < vector <int>> A(2*1e5+5);

void dfs(int x){
    if(Vis[x])return;
    Vis[x]=true;
    pr++;
    mx=max(pr,mx);
    for(int i=0;i<A[x].size();i++){
        if(Vis[A[x][i]])continue;
        dfs(A[x][i]);
    }
}

signed main(){
    mdsaqib;
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        A[a].push_back(b);
        A[b].push_back(a);
    }
    for(int i=1;i<n+1;i++){
        if(!Vis[i]){
            dfs(i);
            pr=0;
        }
    }
    cout << mx;
    
}

Measured memory_bytes: 23512
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include<math.h>
#include<stdio.h>


int main()
{
	int a;
	std::cin >> a;
	int gohyaku = a / 500;
	a = a - (gohyaku * 500);
	int go = a / 5;
	std::cout << (gohyaku * 1000) + (go * 5) << std::endl;
	
}

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

typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > P(n);
  for (int i = 0; i < n; i++) {
    cin >> P[i].second >> P[i].first;
  }
  sort(P.begin(), P.end());
  ll t = 0;
  for (int i = 0; i < n; i++) {
    t += P[i].second;
    if (t > P[i].first) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  int N, K, Q, a;
  cin >> N >> K >> Q;
  vector<int> A(N, 0);
  for (int i = 0; i < Q; i++) {
    cin >> a;
    A[a-1]++;
  }
  for (int i = 0; i < N; i++) {
    if (K-Q+A[i] > 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 1408
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
#define ALL(X) X.begin(), X.end()
using lint = long long;
template <typename T>
void print_container(std::vector<T> vec)
{
    for (auto iter = vec.begin(); iter != vec.end(); ++iter)
    {
        std::cout << *iter << " ";
    }
    std::cout << std::endl;
}

int main()
{

    lint n;
    scanf("%lld", &n);

    lint ans1, ans2, ans3;

    for (lint i = 1; i <= 3500; ++i)
    {
        for (lint j = 0; j <= 3500; ++j)
        {
            lint num = n * i * j;
            lint den = 4 * i * j - n * i - n * j;
            if (den > 1 && num % den == 0)
            {
                ans1 = i;
                ans2 = j;
                ans3 = num / den;
                break;
            }
        }
    }

    printf("%lld %lld %lld", ans1, ans2, ans3);

    return 0;
}


Measured memory_bytes: 384
INF = 1000000000000
n, W = map(int, input().split())
values = []
weights = []
total = 10
for _ in range(n):
    w, v = map(int, input().split())
    weights.append(w)
    values.append(v)
    total += v
dp = [[INF for j in range(total)] for i in range(n+1)]
for i in range(n+1):
    dp[i][0] = 0
for i in range(1,n+1):
    for v in range(1,total):
        if v < values[i-1]:
            dp[i][v] = dp[i-1][v]
        else:
            dp[i][v] = min(dp[i-1][v],dp[i-1][v-values[i-1]]+weights[i-1]) 
res = 0
for i in range(total):
    if dp[n][i] <= W:
        res = i
print(res)

Measured memory_bytes: 171116
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
struct edge { int to, cost; };
P p[60];
map<P,int>mp;
signed main() {
	int n;
	cin >> n;
	rep(i,n) {
		cin >> p[i].first >> p[i].second;		
	}
	rep(i, n) {
		rep(j,n) {
			if (i != j) {
				mp[{p[i].first - p[j].first, p[i].second - p[j].second}]++;
			}
		}
	}
	int sum = 0;
	for (auto p : mp) {
		if (p.second > sum) {
			sum = p.second;
		}
	}
	cout << n - sum << endl;
}



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

const int MAX_N = 100010;
int main(void) {
	int N, M; cin >> N >> M;
	vector<int> H(MAX_N), v(MAX_N);

	for (int i = 1; i <= N; i++) {
		cin >> H[i];
	}

	for (int i = 0; i < M; i++) {
		int a, b; 
		cin >> a >> b;
		v[a] = max(v[a], H[b]);
		v[b] = max(v[b], H[a]);
	}

	int ans = 0;
	for (int i = 1; i <= N; i++) {
		if (H[i] > v[i]) ans++;
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 4040
#include<cstdio>
#include<iostream>
typedef long long ll;
using namespace std;
int main()
{
    ll x,y;
    cin>>x>>y;
    if(abs(x-y)<=1)
    {
        cout<<"Brown"<<endl;
    }
    else
    {
        cout<<"Alice"<<endl;
    }
}


Measured memory_bytes: 256
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll n;
    std::cin >> n;
    // vector<ll> a(n),b(n);
    vector<vector<ll>> ab(n,vector<ll>(2,0));
    
    for (int i = 0; i < n; i++) {
        std::cin >> ab[i][0];
    }
    for (int i = 0; i < n; i++) {
        std::cin >> ab[i][1];
    }
    
    vector<vector<ll>> dp((1<<n)+1,vector<ll>(100,1e10));
    
    dp[0][0] = 0;

    for (int i = 1; i < (1<<n); i++) {
        ll cnt = __builtin_popcount(i);
        // std::cout << bitset<10>(i) << std::endl;
        for (int j = 0; j < n; j++) {
            if(i&(1<<j)){
                // jをc+1番目として追加するとき
                // ab[j][abs(j-cnt)%2]以下なら追加できる
                
                // 移動のコストはiまでに動いてない0の数
                ll cost = 0;
                for (int t = 0; t < j; t++) {
                    if(!(i&(1<<t)))cost++;
                }
                for (int k = 0; k <= ab[j][abs(j-cnt+1)%2]; k++) {
                    // 移動のコスト
                    dp[i][ab[j][abs(j-cnt+1)%2]] = min(dp[i][ab[j][abs(j-cnt+1)%2]], dp[i&(~(1<<j))][k]+cost );
                }
            }
        }
    }
    ll ans = 1e10;
    for (int i = 0; i <= 50; i++) {
        ans = min(ans, dp[(1<<n)-1][i]);
    }
    if(ans==1e10){
        std::cout << -1 << std::endl;
        return 0;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 218300
#include<stdio.h>

int main(void){
  int hh,mm,ss,sec;
  scanf("%d%d%d",&hh,&mm,&ss);
  sec=-(3600*hh+60*mm+ss);
  scanf("%d%d%d",&hh,&mm,&ss);
  sec+=3600*hh+60*mm+ss;
  printf("%d %d %d\n",sec/3600,sec/60%60,sec%60);

  scanf("%d%d%d",&hh,&mm,&ss);
  sec=-(3600*hh+60*mm+ss);
  scanf("%d%d%d",&hh,&mm,&ss);
  sec+=3600*hh+60*mm+ss;
  printf("%d %d %d\n",sec/3600,sec/60%60,sec%60);

  scanf("%d%d%d",&hh,&mm,&ss);
  sec=-(3600*hh+60*mm+ss);
  scanf("%d%d%d",&hh,&mm,&ss);
  sec+=3600*hh+60*mm+ss;
  printf("%d %d %d\n",sec/3600,sec/60%60,sec%60);
  
  return 0;
}

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

using namespace std;


void solve()
{
    string s;
    cin >> s;
    int prev_max = 0, curr_max = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i]=='R')
            curr_max+=1;
        else
            curr_max=0;
        if(curr_max>prev_max)
            prev_max=curr_max;
        
    }
    cout<<prev_max<<endl;
}

int main()
{
    int t = 1;
    for (int i = 0; i < t; i++)
    {
        solve();
    }
    return 0;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
typedef long long ll;

int main(){
  char c;
  cin >> c;
  if((c=='a')||(c=='i')||(c=='u')||(c=='e')||(c=='o'))cout << "vowel" << endl;
  else cout << "consonant" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  int a,b;
  cin >> a >> b;

  int start = b-a+1;
  int goal = b+a-1;

  FOR(i,start,goal) cout << i << " ";

  cout << endl;

}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.nextLine();
        if(s.equals("ABC")){
            System.out.println("ARC");
        }else if(s.equals("ARC")){
            System.out.println("ABC");
        }
    }
}


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

int main()
{
    int i,n,t,s=0,ans=0;
    cin>>n;
    int a[n+1];
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<n;i++)
    {
        if(a[i]>=a[i+1])
            s++;
        else
        {
            if(ans<s)
                ans=s;
            s=0;
        }
    }
    if(ans<s)
        ans=s;
    cout<<ans;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
  	cin>>s;
  long long k;cin>>k;
  long long first_non = -1;
  for(long long i=0;i<s.length();i++){
  	if(s[i]-'0'>1){first_non=i;break;}
  }
  if(first_non == -1 || first_non>=k)cout<<1;
  else cout<<s[first_non]-'0';
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#define rrep(i,n) for (int i = 1; i <= n; ++i)
using namespace std;

constexpr int MX = 100000, mod = 1000000007;
struct Fact {
  int d[MX+1];
  constexpr Fact(): d() {
    d[0] = 1;
    long long x = 1;
    rrep(i,MX) {
      x = (x*i)%mod;
      d[i] = x;
    }
  }
};
constexpr Fact F = Fact();

int main() {
  char buf[10];
  fgets(buf, 10, stdin);
  printf("%d\n", F.d[atoi(buf)]);
  return 0;
}


Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class AWeatherPrediction {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        string s;
        cin >> s;
        if (s == "Sunny") cout << "Cloudy" << endl;
        if (s == "Cloudy") cout << "Rainy" << endl;
        if (s == "Rainy") cout << "Sunny" << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    AWeatherPrediction solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 764
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    n = int(input().rstrip())
    ans = ["" for _ in range(n)]
    a_list = [int(x) for x in input().rstrip().split(" ")]
    for i, a in enumerate(a_list):
        ans[a-1] = str(i+1)

    print(" ".join(ans))



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 21660
package main

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

var sc *bufio.Scanner

const bufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

type pair struct {
	pos int
	f   int
}

func lowerBound(a []pair, x pair) int {
	l := 0
	r := len(a)
	for l <= r {
		m := (l + r) / 2
		if len(a) == m {
			break
		}
		if a[m].pos >= x.pos || (a[m].pos == x.pos && a[m].f >= x.f) {
			r = m - 1
		} else {
			l = m + 1
		}
	}
	return l
}

func upperBound(a []pair, x pair) int {
	l := 0
	r := len(a)
	for l <= r {
		m := (l + r) / 2
		if len(a) == m {
			break
		}
		if a[m].pos <= x.pos || (a[m].pos == x.pos && a[m].f <= x.f) {
			l = m + 1
		} else {
			r = m - 1
		}
	}
	return l
}

type pairs []pair

func (b pairs) Len() int { return len(b) }
func (b pairs) Less(i, j int) bool {
	if b[i].pos == b[j].pos {
		return b[i].f < b[j].f
	}
	return b[i].pos < b[j].pos
}
func (b pairs) Swap(i, j int) { b[i], b[j] = b[j], b[i] }

type solver struct {
	a    []pair
	x    []int
	g    [][]pair
	ans  []int
	used []bool
}

func (s *solver) dfs(v int) int {
	s.used[v] = true
	res := s.x[v]
	debugf("dfscall: v: %d, res:%d\n", v, res)
	for _, e := range s.g[v] {
		if s.used[e.pos] {
			continue
		}
		r := s.dfs(e.pos)
		if r == 1 {
			s.ans = append(s.ans, e.f)
		}
		res ^= r
	}
	debugf("dfs ret: v: %d, res:%d, ans:%v\n", v, res, s.ans)
	return res
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, bufferSize)
	sc.Buffer(buf, 1e+7)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	s := solver{}
	s.a = make([]pair, n)
	s.x = make([]int, n+1)
	s.g = make([][]pair, n+1)
	s.used = make([]bool, n+1)

	for i := range s.a {
		s.a[i].pos = nextInt()
		s.a[i].f = nextInt()
	}
	sort.Sort(pairs(s.a))

	s.x[0] = s.a[0].f
	for i := 0; i < n-1; i++ {
		s.x[i+1] = s.a[i].f ^ s.a[i+1].f
	}
	s.x[n] = s.a[n-1].f

	for i := 0; i < m; i++ {
		l, r := nextInt(), nextInt()
		l = lowerBound(s.a, pair{l, 0})
		r = upperBound(s.a, pair{r, 1})
		s.g[l] = append(s.g[l], pair{r, i + 1})
		s.g[r] = append(s.g[r], pair{l, i + 1})
	}

	for i := 0; i <= n; i++ {
		if s.used[i] {
			continue
		}
		if s.dfs(i) == 1 {
			_, _ = fmt.Fprint(writer, "-1")
			return
		}
	}
	sort.Ints(s.ans)
	debugf("a:%v\n", s.a)
	debugf("x:%v\n", s.x)
	debugf("g:%v\n", s.g)
	debugf("ans:%v\n", s.ans)

	_, _ = fmt.Fprintf(writer, "%d\n", len(s.ans))
	for i, v := range s.ans {
		_, _ = fmt.Fprintf(writer, "%d", v)
		if i != len(s.ans)-1 {
			_, _ = fmt.Fprintf(writer, " ")
		}
	}
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


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

long long numA[101][101];
long long numB[101][101];
long long numC[101][101];

int main()
{
    int n = 0;
    int m = 0;
    int l = 0;
    
    cin >> n >> m >> l;
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> numA[i][j];
        }
    }
    
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < l; j++)
        {
            cin >> numB[i][j];
        }
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
        {
            for (int k = 0; k < m; k++)
            {
                numC[i][j] += numA[i][k] * numB[k][j];
            }
        }
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
        {
            if (j > 0)
            {
                cout << " ";
            }
            
            cout << numC[i][j];
        }
        
        cout << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3288
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def factorize_dict(n):
    b = 2
    fct = defaultdict(lambda: 0)
    while b ** 2 <= n:
        while n % b == 0:
            n //= b
            fct[b] += 1
        b += 1
    if n > 1:
        fct[n] += 1
    return fct


def main():

    N = in_n()

    prime = defaultdict(int)
    for i in range(1, N + 1):
        for k, v in factorize_dict(i).items():
            prime[k] += v

    def num(a):
        return len(list(filter(lambda x: x >= a, prime.values())))

    ans = num(74)
    if num(24) >= 1:
        ans += num(24) * (num(2) - 1)
    if num(14) >= 1:
        ans += num(14) * (num(4) - 1)
    if num(4) >= 2:
        ans += num(4) * (num(4) - 1) // 2 * (num(2) - 2)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9528
'use strict';
const main = val => {
  const yoho = val[0].trim()
  const res = val[1].trim()
  let ans = 0
  for(let i=0; i<yoho.length; i++){
    if(yoho[i] == res[i]) ans++
  }
  console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 7372
#include<cstdio>
#define MAXN 200005
#define LL long long
int n,x;
int a[MAXN];
bool b[MAXN];
int main()
{
	scanf("%d %d",&n,&x);
	if(x==1||x==2*n-1)
	{
		printf("No\n");
		return 0;
	}
	n=2*n-1;
	a[n/2+1]=x,a[n/2]=x-1,a[n/2+2]=x+1;
	b[x]=b[x+1]=b[x-1]=1;
	if(n/2-1>0&&x+2<=n)
		a[n/2-1]=x+2,b[x+2]=1;
	if(n/2+3<=n&&x-2>=1)
		a[n/2+3]=x-2,b[x-2]=1;
	int t=1;
	for(int i=1;i<=n;i++)
	{
		if(a[i]) continue;
		while(b[t]) t++;
		a[i]=t,b[t]=1;
	}
	printf("Yes\n");
	for(int i=1;i<=n;i++)
		printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 2432
#diverta2019 programming contest-B
R,G,B,n = map(int,input().split())
cnt = 0
for i in range(n//R + 1):
    for j in range(n - i*R + 1):
        c = n - (i*R + j*G)
        if c >= 0 and c%B == 0:
            cnt += 1
        else:
            pass
                
print(cnt)


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

ll N,K,Q; map<int,int> M; vll P;
void input(){
    cin>>N>>K>>Q;
    rep(i,Q){
        int a; cin>>a; 
        if(M[a]==0) M[a]=1;
        else M[a]++;
    }
    return;
}

void solve(){
    rep(i,N) {
        if(K+M[i+1]-Q>0) cout<<"Yes"<<"\n";
        else cout<<"No"<<"\n";
    }
    return;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c;
    cin>>k;
    int cnt=0;
    while(a>=b)
    {
        b*=2;
        cnt++;
    }
    while(b>=c)
    {
        c*=2;
        cnt++;
    }
    if(cnt<=k) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;

}

Measured memory_bytes: 3544
package main

import "fmt"

const mod int = 1e9 + 7

func main() {
	var n int
	fmt.Scan(&n)
	ts := make([]int, n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&ts[i])
	}
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}

	if ts[n-1] != as[0] {
		fmt.Println(0)
		return
	}

	ans := 1
	for i := 1; i < n-1; i++ {
		switch {
		case ts[i-1] == ts[i] && as[i] == as[i+1]:
			ans *= min(ts[i], as[i])
			ans %= mod
		case ts[i-1] < ts[i] && ts[i] > as[i]:
			ans = 0
		case as[i] < as[i+1] && as[i] > ts[i]:
			ans = 0
		case ts[i-1] == ts[i] && ts[i] < as[i]:
			ans = 0
		case as[i] == as[i+1] && ts[i] > as[i]:
			ans = 0
		}

		if ans == 0 {
			break
		}
	}

	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 6492
n, y = map(int, input().rstrip().split())
a, b, c = -1, -1, -1

for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i + 5000*j + 1000*(n-i-j) ==  y:
            a, b, c = i, j, n-i-j
            break
    else:
        continue
    break
print(a, b, c)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> p(N);
    for (auto& i : p) cin >> i;
    UnionFind uf(N);
    for (int i = 0, x, y; i < M; i++) {
        cin >> x >> y;
        uf.unite(x - 1, y - 1);
    }
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (uf.find(i) == uf.find(p[i] - 1)) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1024
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int h=sc.nextInt();
    int w=sc.nextInt();
    int[][] a=new int[h][w];
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        a[i][j]=sc.nextInt();
      }
    }
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        a[i][j]-=sc.nextInt();
      }
    }
    boolean[][][] dp=new boolean[h][w][25600];
    //0->12800
    dp[0][0][12800+a[0][0]]=true;
    dp[0][0][12800-a[0][0]]=true;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        for(int k=0;k<25600;k++){
          if(dp[i][j][k]){
            if(j<w-1){
              dp[i][j+1][k+a[i][j+1]]=true;
              dp[i][j+1][k-a[i][j+1]]=true;
            }
            if(i<h-1){
              dp[i+1][j][k+a[i+1][j]]=true;
              dp[i+1][j][k-a[i+1][j]]=true;
            }
          }
        }
      }
    }
    int ans=Integer.MAX_VALUE;
    for(int i=12800;i<25600;i++){
      if(dp[h-1][w-1][i]){
        ans=i-12800;
        break;
      }
    }
    for(int i=12800;i>=0;i--){
      if(dp[h-1][w-1][i]){
        ans=Math.min(12800-i,ans);
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 243252