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

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;

#define all(a) a.begin(), a.end()
#define mp make_pair
#define pb push_back

void solve() {
    int h, w, k; cin >> h >> w >> k;
    int res = 0;
    vi isr(h), isc(w);
    vi row, col;

    vector<string> a(h);
    for (int i = 0; i < h; i++)
        cin >> a[i];

    function<void(int)> rec = [&](int num) {
        if (num == h + w) {
            ll cntb = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (!isr[i] && !isc[j])
                        cntb += (a[i][j] == '#');
                }
            }
            if (cntb == k) res++;
            return;
        }
        if (num < h) {
            rec(num + 1);
            isr[num] = 1;
            rec(num + 1);
            isr[num] = 0;
        } else {
            rec(num + 1);
            isc[num - h] = 1;
            rec(num + 1);
            isc[num - h] = 0;
        }
    };
    rec(0);
    cout << res;
}

int main() {
    solve();
}

Measured memory_bytes: 3624
#include <math.h>
#include <stdio.h>

int main(void)
{
  int i, n; scanf( "%d", &n );
  int a[n], b[n], sum = 0;
  a[0] = -1;
  for(i = 1;i < n;i++) { scanf( "%d", &a[i] ); }
  for(i = 0;i < n;i++) { b[i] = 0; } // init
  
  for(i = 1;i < n;i++) { b[ a[i] -1 ]++ ; }
  for(i = 0;i < n;i++) { printf( "%d\n", b[i] ); }
  
  return 0;
}

Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
int main(){
	
	int a[3];
	
	cin >> a[0] >> a[1] >> a[2];
	
	sort(a, a+3);
	
	if(a[0] == 5 && a[1] == 5 && a[2] == 7){
		cout << "YES";
		return 0;
	}
	
	else {
		cout << "NO";
		return 0;
	}
}

Measured memory_bytes: 3520
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 100000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
using namespace std;
//作者：中国江苏南京朱泽齐
int n,m;
char A[51][51], B[51][51];
bool check(int x, int y) {
	for(int i=0;i<m;i++) {
		for(int j=0;j<m;j++){
			if(A[x+j][y+i]!=B[j][i]){
				return false;
			}
		}
	}
	return true;
}
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>A[j][i];
		}
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<m;j++){
			cin>>B[j][i];
		}
	}
	for(int y=0;y<=n-m;y++){
		for(int x=0;x<=n-m;x++){
			if(check(x,y)){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
//
// Created by P218024 on 2018/04/20.
//

#include <bits/stdc++.h>
using namespace std;

int main() {
    int a, b, x;

//    ifstream in("C:\\Users\\P218024\\Documents\\Cpp Projects\\abc094\\sample.txt");
//    cin.rdbuf(in.rdbuf());

    cin >> a >> b >> x;
    cout << ((a <= x) && (x <= a + b) ? "YES" : "NO");

    return 0;
}





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

//vector…可変長、データの大きさに合わせてサイズを変える
//list…双方向リスト、要素を挿入、削除の多いとき
//forward_list
//array…固定長配列
//set…集合
//multiset
//bitset…2進数、固定長ビット列
//map…連想配列、キーと値を関連付ける
//multimap
//deque…双方向リスト
//stack…FILO, 深さ優先探索
//queue…FIFO, 幅優先探索
//priority_queue…格納された最大値から順に取り出す
//pair…二つの値を一組
//tuple…複数の値を一組

template<typename T>
void remove(std::vector<T>& vector, char index) {
    vector.erase(vector.begin() + index);
}

template<class T>
T ma(std::vector<T> &v) {
    T maxi = 0;
    for(auto &i:v) maxi = max(maxi, i);
    return maxi;
}
template<class T>
T mi(std::vector<T> &v) {
    T mini = 0;
    for(auto &i:v) mini = min(mini, i);
    return mini;
}
template <class T>
T pow(T x, T y, T n = numeric_limits<T>::max()) {
    if(y == 0) return 1;
    if(y % 2 == 0) return pow((x * x) % n, y / 2);
    return (x * pow(x, y - 1)) % n;
}

#define rep(i, n, m) for (int i = n; i <= m; i++)
#define Rep(i, n, m) for (int i = m; i >= 1; i--)

typedef long long ll;
typedef unsigned long long ull;

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    return !y ? x : gcd(x % y, y);
}

using Graph = vector<vector<int>>;

template <class T, class S>
class Edge {
  T to;  //辺の行き先
  S weight;  //辺の重み

public:
  Edge(T t, S w) : to(t), weight(w) {}
};

int ansi = 0;
ll ansl = 0;
double ansd = 0.0;

int main() {
  string s;
  cin >> s;
  int cont = 0;
  sort(s.begin(), s.end());
  rep(i, 0, s.size()-2) {
    if (s[i] == s[i+1])
      cont++;
  }
  if (cont == 2)
    cout << "Yes";
  else
  {
    cout << "No";
  }
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

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

int main(){
  ll N , K; cin >> N >> K;
  vector<ll> a(N);
  rep(i,N){
    ll v; cin >> v; v--;
    a[i] = v;
  }

  if(K < 1e6){
    ll minans = 0;
    rep(i,K){
      minans = a[minans];
    }
    cout << minans + 1 << endl;
    return 0;
  }

  vector<ll> reach;
  ll tmp = 0;
  map<ll, ll> m;
  // reachの作成
  reach.pb(0);
  m[0]++;
  while(1){
    tmp = a[tmp];
    m[tmp]++;
    reach.pb(tmp);
    if(m[tmp] > 1) break;
  }

  ll si = reach.back();
  reach.pop_back();
  ll start;
  rep(i,reach.size()){
    // startの探索
    if(reach[i] == si){
      start = i;
      break;
    }
  }

  // startからlastを繰り返す
  ll cir = reach.size() - start;

  /*
  rep(i,reach.size()) cout << reach[i] << " ";
  cout << endl;
  cout << start << " " << reach.size() << endl;
  */

  ll mar = (K - start) % cir;
  cout << reach[start + mar] + 1 << endl;

}


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

int gcd(int a, int b)
{
	if (a%b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a%b));
	}
}

int main()
{
	int K;
	cin >> K;
	uint64_t count = 0;
	for (int a = 1; a <= K; a++) {
		for (int b = a; b <= K; b++) {
			for(int c = b; c <= K; c++) {
				if (a == b && b == c) {
					count += gcd(gcd(a, b), c);
				}
				else if ((a == b && b != c) || (a != b && b == c)) {
					count += 3*gcd(gcd(a, b), c);
				}
				else {
					count += 6 * gcd(gcd(a, b), c);
				}
			}
		}
	}


	cout << count;
	return 0;



}



Measured memory_bytes: 3620
using System;

namespace A144_a
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var line = System.Console.ReadLine();
			var l = line.Split (' ');
			var a = Int32.Parse(l[0]);
			var b = Int32.Parse(l[1]);
			var ans = 0;

			if (a>9 | b>9){
				ans = -1;
			}else{
				ans = a*b;
			}
			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 13140
package main

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

var sc *bufio.Scanner

func init() {
	// 100MB
	bufsize := 100 * 1024 * 1024
	sc = bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, bufio.MaxScanTokenSize), bufsize)
	sc.Split(bufio.ScanWords)
}
func readInt() int              { return readIntArray(1)[0] }
func readInt2() (int, int)      { a := readIntArray(2); return a[0], a[1] }
func readInt3() (int, int, int) { a := readIntArray(3); return a[0], a[1], a[2] }
func readIntArray(n int) []int {
	s := readStringArray(n)
	a := make([]int, n)
	for i := range a {
		a[i], _ = strconv.Atoi(s[i])
	}
	return a
}
func readString() string            { return readStringArray(1)[0] }
func readString2() (string, string) { a := readStringArray(2); return a[0], a[1] }
func readStringArray(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i] = sc.Text()
	}
	return a
}
func max(ns ...int) int {
	max := ns[0]
	for _, n := range ns {
		if n > max {
			max = n
		}
	}
	return max
}
func min(ns ...int) int {
	min := ns[0]
	for _, n := range ns {
		if n < min {
			min = n
		}
	}
	return min
}
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	A, B, M := readInt3()
	a := make([]int, A)
	amin := math.MaxInt64
	for i := 0; i < A; i++ {
		a[i] = readInt()
		if amin > a[i] {
			amin = a[i]
		}
	}
	b := make([]int, B)
	bmin := math.MaxInt64
	for i := 0; i < B; i++ {
		b[i] = readInt()
		if bmin > b[i] {
			bmin = b[i]
		}
	}
	min := math.MaxInt64
	for i := 0; i < M; i++ {
		x, y, c := readInt3()
		r := a[x-1] + b[y-1] - c
		if min > r {
			min = r
		}
	}
	if min > amin+bmin {
		min = amin + bmin
	}
	fmt.Println(min)
}


Measured memory_bytes: 5504
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b;
  cin>>a>>b;
  cout<<max({a+b,a-b,a*b})<<endl;

  return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 102
#define WHITE 0
#define BLACK 1
#define GRAY 2


void init();
void visit(int);

int col[MAX];
int n, t = 0;
int d[MAX],f[MAX],edge[MAX],num[MAX][MAX],G[MAX][MAX];

void init(){

  int i,j;

  for(i = 0; i <= n; i++){
      col[i] = WHITE;
    }

}

void dFSearch(){
  int i;
  for(i = 1; i <= n; i++){
    if(col[i] == WHITE) visit(i);
  }
}

void visit(int u){
  int i,j;

  col[u] = GRAY;
  t += 1;
  d[u] = t;

  for(j = 0; j < n; j++){
    if(G[u][j] == 10) {
      if(col[j+1] == WHITE ){
    visit(j+1);
      }
    }
  }

  col[u] = BLACK;
  t = t + 1;
  f[u] = t;

}


int main(){

  int i,j,k = 0,vertex,number;

  scanf("%d\n",&n);
  init();

  for(i = 1; i <= n; i++){
    scanf("%d %d",&vertex,&edge[i]);
    for(j = 1; j <= edge[i]; j++){
      scanf("%d",&number);
      G[vertex][number-1] = 10;
    }
    scanf("\n");
  }

 dFSearch();

  for(i = 1; i <= n; i++){
    printf("%d %d %d\n", i, d[i], f[i]);
  }

  return 0;


}

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

ll v[200005], tempo[200005];

int main(){

    ll n, t; cin >> n >> t;
    for(int i = 1; i <= n; i++)
        cin >> v[i];
    
    ll res = t;
    for(int i = 2; i <= n; i++){
        if(v[i-1]+t <= v[i]) res += t;
        else res += v[i]-v[i-1];
    }
    cout << res << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    int a[N];
    vector<int> b(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b.begin(), b.end());
    int Q;
    cin >> Q;
    int x[Q], y[Q];
    for (int i = 0; i < Q; i++) {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (a[i] != b[i]) cnt++;
    }
    if (cnt == 0) {
        cout << "0\n";
        return 0;
    }
    for (int i = 0; i < Q; i++) {
        int k = 0;
        if (a[x[i]] != b[x[i]]) k++;
        if (a[y[i]] != b[y[i]]) k++;
        int t = a[x[i]];
        a[x[i]] = a[y[i]];
        a[y[i]] = t;
        if (a[x[i]] != b[x[i]]) k--;
        if (a[y[i]] != b[y[i]]) k--;
        cnt -= k;
        if (cnt == 0) {
            cout << i + 1<< "\n";
            return 0;
        }
    }
    cout << -1 << "\n";
    return 0;
}


Measured memory_bytes: 7560
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>

using namespace std;


int M, N;
long long p[100005], a[100005], b[100005], c[100005];
long long tmps[100005] = {};


int main() {

	cin >> N >> M;

	for (int i = 0; i < M; i++) {
		cin >> p[i];
	}
	for (int i = 0; i < N - 1; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}

	for (int i = 0; i < M-1; i++) {
		if (p[i] < p[i + 1]) {
			tmps[ p[i]-1 ] += 1;
			tmps[p[i + 1]-1] += -1;
		}
		else {
			tmps[p[i]-1] += -1;
			tmps[p[i + 1]-1] += 1;
		}
	}

	for (int i = 0; i < N; i++) {
		tmps[i + 1] += tmps[i];
	}

	long long ans = 0;

	for (int i = 0; i < N - 1; i++) {
		if (tmps[i] != 0) {
			ans += min(a[i]*tmps[i], b[i]*tmps[i] + c[i]);
		}
	}

	cout << ans << endl;


	return 0;
}




Measured memory_bytes: 6992
N = int(input())
m = 0
ans = 1
for i in range(N + 1):
    c = 0
    x = i
    while i > 0:
        if i % 2 == 0:
            i = i // 2
            c += 1
        else:
            break
    if m < c:
        m = c
        ans = x
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>
#include <regex>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define P pair<int, int>

using namespace std;
using ll = int64_t;

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

void solve(){
    int n;
    cin >> n;
    ll a[n];
    rep(i, n) cin >> a[i];

    sort(a, a+n);

    cout << a[n-1]-a[0] << endl;
}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		//System.out.print(" ");
		Scanner scan = new Scanner(System.in);
		ArrayList<String> suite = new ArrayList<String>();
		ArrayList<String> hikaku = new ArrayList<String>();
		ArrayList<Integer> lb = new ArrayList<Integer>();
		ArrayList<Integer> lf = new ArrayList<Integer>();
		ArrayList<Integer> lr = new ArrayList<Integer>();
		ArrayList<Integer> lv = new ArrayList<Integer>();
		int n =scan.nextInt();
		int m =scan.nextInt();
		int a[][] = new int[100][100];
		int b[][] = new int[100][100];
		for(int i =0; i<n; i++){
			for(int ii=0;ii<m;ii++){
				a[i][ii] = scan.nextInt();
			}
		}
		
		for(int i=0;i<m;i++){
			b[0][i] = scan.nextInt(); 
		}
		
		for (int i=0; i<n; i++){
			int keisan = 0;
			for(int ii=0; ii<m; ii++){
				keisan += a[i][ii] * b[0][ii];
			}
			System.out.println(keisan);
		}
	}
}

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

int main(){
    int X, N, p, ans, diff = 1;
    cin>>X>>N;
    set<int> s;
    while(N--){
        cin>>p;
        s.insert(p);
    }
    ans = X;
    bool flag = false;
    while(!flag){
        if(s.find(ans)==s.end())
            flag = true;
        else{
            if(ans>=X) ans-=diff;
            else ans+=diff;
            diff++;
        }
    }
    cout<<ans;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int a[n] = {};
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    cout << *max_element(a, a+n) - *min_element(a, a+n) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int main(){
	int m,k;
	scanf("%d%d",&m,&k);
	int x=pow(2,m)-1;
	if(k>x){
		printf("-1\n");
		return 0;
	}
	if(m==1&&k==1){
		printf("-1\n");
		return 0;
	}
	if(m==1){
		printf("1 1 0 0\n");
		return 0;
	}
	for(int i=0;i<=x;i++){
		if(i==k)continue;
		printf("%d ",i);
	}
	printf("%d ",k);
	for(int i=x;i>=0;i--){
		if(i==k)continue;
		printf("%d ",i);
	}
	printf("%d ",k);
}




Measured memory_bytes: 1792
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

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

    int T[n + 1], X[n + 1], Y[n + 1];
    T[0] = 0;
    X[0] = 0;
    Y[0] = 0;  
    FOR(i, 1, n + 1){
        cin >> T[i] >> X[i] >> Y[i];
    }

    int f = 1;
    FOR(i, 1, n + 1){
        int t_d = T[i] - T[i - 1];
        int x_d = abs(X[i] - X[i - 1]);
        int y_d = abs(Y[i] - Y[i - 1]);
        if(t_d == x_d + y_d){
            f = 1;
        }else if(((t_d - (x_d + y_d)) % 2 == 0) and (t_d > x_d + y_d)){
            f = 1;
        }else{
            f = 0;
            break;
        }
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 1408
/*
 * A.cpp
 *
 *  Created on: 2020/06/20
 *      Author: admin
 */


#include <iostream>


using namespace std;


int main(){
	int x;
	cin >> x;
	long res = 0; // result
	long count = 0; // sum
	while(true){
		count += x;
		res++;
		if(count%360 == 0) break;
	}

	cout << res<< endl;

}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  int T;
  cin>>T;
  map<string,int> ms;
  vector<string> vs({"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" });
  for(int i=0;i<12;i++) ms[vs[i]]=i;
  while(T--){
    int n,m;
    cin>>n>>m;
    vector<int> t(n+1,0),s(m);
    for(int i=0;i<n;i++){
      string x;
      cin>>x;
      t[i+1]=ms[x];
    }
    for(int i=0;i<m;i++){
      string x;
      cin>>x;
      s[i]=ms[x];
    }
    if(0){
      for(int i:s) cout<<i<<" ";cout<<endl;
      for(int i:t) cout<<i<<" ";cout<<endl;
    }
    
    auto check=[&](int x,int i){
      return x+(m-i)*2>=n+1;
    };

    if(n<=100){
      bool flg=0;
      vector<int> dp(1,0);
      for(int i=0;i<=m;i++){
	vector<int> nx;
	for(int x: dp){
	  if(i==m){
	    if(x+2>=n+1){
	      flg=1;
	      break;
	    }
	  }else{
	    if(x+1<=n&&(t[x+1]==s[i]))
	      if(check(x+1,i)) nx.emplace_back(x+1);
	    if(x+2<=n&&(t[x+2]==(s[i]+11)%12))
	      if(check(x+2,i))nx.emplace_back(x+2);
	    if(x-1>=0&&(t[x-1]==(s[i]+1)%12))
	      if(check(x-1,i)) nx.emplace_back(x-1);
	  }
	}
	sort(nx.begin(),nx.end());
	nx.erase(unique(nx.begin(),nx.end()),nx.end());
	if(0){
	  cout<<i<<":"<<endl;
	  for(int x:nx) cout<<x<<" ";cout<<endl;
	}
	swap(dp,nx);
	if(dp.empty()) break;
      }
      cout<<(flg?"Yes":"No")<<endl;
      continue;
    }
    
    bool flg=0;
    int h=n/2;
    vector<int> ff,tt;
    {
      vector<int> dp(1,0);
      for(int i=0;i<h;i++){
	vector<int> nx;
	for(int x: dp){
	  if(x+1<=n&&(t[x+1]==s[i]))
	    if(check(x+1,i)) nx.emplace_back(x+1);
	  if(x+2<=n&&(t[x+2]==(s[i]+11)%12))
	    if(check(x+2,i))nx.emplace_back(x+2);
	  if(x-1>=0&&(t[x-1]==(s[i]+1)%12))
	    if(check(x-1,i)) nx.emplace_back(x-1);
	}
	sort(nx.begin(),nx.end());
	nx.erase(unique(nx.begin(),nx.end()),nx.end());
	swap(dp,nx);
	if(dp.empty()) break;
      }
      ff=dp;
    }
    {
      vector<int> dp(1,n+1);
      for(int i=m;i>=h;i--){
	vector<int> nx;
	for(int x: dp){
	  if(x-1>=0&&(i==m||t[x]==s[i])) nx.emplace_back(x-1);
	  if(x-2>=0&&(i==m||t[x]==(s[i]+11)%12)) nx.emplace_back(x-2);
	  if(x+1<=n&&(i==m||t[x]==(s[i]+1)%12)) nx.emplace_back(x+1);
	}
	sort(nx.begin(),nx.end());
	nx.erase(unique(nx.begin(),nx.end()),nx.end());
	swap(dp,nx);
	if(dp.empty()) break;
      }
      tt=dp;
    }
    
    set<int> cnt;
    for(int i:ff) cnt.emplace(i);
    for(int i:tt) flg|=cnt.count(i);
    cout<<(flg?"Yes":"No")<<endl;
  }
  return 0;
}



Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;


int cums[100001],cumt[100001];

int main(){
    string s,t;
    cin >> s >> t;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A') cums[i+1]+=1;
        else if(s[i]=='B') cums[i+1]+=2;
        cums[i+2]+=cums[i+1];
    }
        for(int i=0;i<t.length();i++){
        if(t[i]=='A') cumt[i+1]+=1;
        else if(t[i]=='B') cumt[i+1]+=2;
        cumt[i+2]+=cumt[i+1];
    }
    int q;
    cin >> q;
    while(q--){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        if((cums[b]-cums[a-1])%3==(cumt[d]-cumt[c-1])%3) puts("YES");
        else puts("NO");
    }
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;
 
int main()
{
    std::string t,s;
    cin >> s;
    cin >> t;
    int c = 0;
    for(int i=0; i<s.size(); i++){
        if(s[i] != t[i]) c++;
    }
    cout << c << endl;
    //cout << "Yes" << endl;
    //cout << a << endl;
    
    return 0;
}

Measured memory_bytes: 3912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	priority_queue <int,vector<int>,less<int> >q;
	ll n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		q.push(x);
	}
	for(int i=0;i<m;i++)
	{
		ll a=q.top()/2;
		q.pop();
		q.push(a);
	}
	ll sum=0;
	while(!q.empty())
	{
		sum+=q.top();
		q.pop();
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 892
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%3==0 && a>=3){
            System.out.println("Possible");
        }else if(b%3==0 && b>=3){
            System.out.println("Possible");
        }else if((a+b)%3==0 && (a+b)>=3){
            System.out.println("Possible");
        }else{
        System.out.println("Impossible");
        }
    }

}


Measured memory_bytes: 21844
#include <iostream>
#include <queue>
#include <assert.h>   
#include <vector>
#include <algorithm>
#include <time.h>
#include <numeric>
#include <string>
#include <cstring>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <numeric>
#include <deque>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <cstdio>
using namespace std;


//#define double long double
//#define int long long
//#define int unsigned long long

#define ll long long
#define ld long double 
#define pi pair<int, int> 
#define pl pair<ll,ll>  
#define pd pair<ld,ld> 
#define str string  
#define mp make_pair
#define vi vector<int> 
#define vl vector<ll> 
#define vd vector<ld> 
#define vs vector<str> 
#define vpi vector<pi> 
#define vpl vector<pl> 
#define vpd vector<pd> 
#define si set<int> 
#define FF(i,j,n) for(signed i=j;i<=n;i++)  
#define DD(i,j,n) for(signed i=j;i>=n;i--) 
#define F(i,j,n) for(signed i=j;i<n;i++)   
#define D(i,j,n) for(signed i=j;i>n;i--) 
#define mem(a,b) memset(a,b,sizeof(a))
#define ndl cout << endl
#define ull unsigned long long 

const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;


#define sz(x) (signed)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend() 
#define rsz resize
#define ins insert 
#define ft front() 
#define bk back() 
#define fi first
#define se second
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define lb lower_bound 
#define ub upper_bound 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

//math


const int mod = 1e9 + 7;

ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int pct(int x) { return __builtin_popcount(x); } 
int bit(int x) { return 31-__builtin_clz(x); } // floor(log2(x)) 
int cdiv(int a, int b) { return a/b+!(a<0||a%b == 0); } // division of a by b rounded up, assumes b > 0 


//DEBUG, compile with -DLOCAL
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
  cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
  DBG(t...); }
#ifdef LOCAL 
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#define HERE cout << "===GOTHERE===" << endl
#else
#define dbg(...) 42
#define HERE 42
#endif


 /* ============== END OF HEADER ============== */





const int maxn = 1e5*3+20;

int n,_,q,k;

void solve(){
	str s;
	cin >> s;
	int n = sz(s);
	F(i,0,n){
		s[i] = 'x';
	}
	cout << s << endl;
}

signed main(){
  //clock_t t1 = clock();  
	IOS
	solve();
  
  //cout << "THE ALGORITHM TOOK: " << (clock() - t1) * 1.0 / CLOCKS_PER_SEC * 1000 << "ms"<< endl;
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
money = float('inf')
for bit in range(1 << N):
    S = [0]*N
    for i in range(N):
        if bit & (1 << i):
            S[i] = 1
    if S.count(1) >= K:
        sumnum = 0
        maxh = A[0]
        for i in range(1, N):
            if S[i] == 1:
                if A[i] > maxh:
                    maxh = A[i]
                else:
                    maxh += 1
                    sumnum += (maxh - A[i])
            else:
                maxh = max(maxh, A[i])

        money = min(money, sumnum)
print(money)

Measured memory_bytes: 43244
use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr;
}

impl<'a> Parse for std::str::SplitWhitespace<'a> {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let n: u32 = iter.to();
    let mut v = Vec::new();
    for i in 1..10 {
        for j in 1..10 {
            v.push(i * j);
        }
    }
    if v.into_iter().find(|&x| x == n).is_some() {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    S = input_raw[0]

    print min(S.count("1"), S.count("0")) * 2


if __name__ == '__main__':
    main()


Measured memory_bytes: 3056
my $s = <STDIN>;
chomp $s;
my ($N,$A,$B,$C) = split(/ /,$s);
#print "$N,$K\n";
my @data;
for(my $i=0;$i<$N;$i++){
    $s = <STDIN>;
    chomp $s;
    $data[$i] = $s;
}
my $zero = 0;
if($A ==0){ $zero++}
if($B ==0){ $zero++}
if($C ==0){ $zero++}

my %data2;
$data2{"A"}=$A;
$data2{"B"}=$B; 
$data2{"C"}=$C; 

my $flag = 0;
my $str;
$str .= "Yes\n";

    for(my $i=0;$i<$N;$i++){
        #print "i$i \n";
        my @dat =split(//,$data[$i]);
        if( ($data2{$dat[0]}==1)&&($data2{$dat[1]}==1) ){
            my @dat2 =split(//,$data[$i+1]);
            if( $dat[0] eq $dat2[0]){
                $data2{$dat[0]}++;
                $data2{$dat[1]}--;
                $str .= "$dat[0]\n";
            }elsif( $dat[0] eq $dat2[1]){
                $data2{$dat[0]}++;
                $data2{$dat[1]}--;
                $str .= "$dat[0]\n";
            }else{
                $data2{$dat[0]}--;
                $data2{$dat[1]}++; 
                $str .= "$dat[1]\n";
            }
        }elsif( $data2{$dat[0]} >= $data2{$dat[1]} ){
             if( $data2{$dat[0]}==0){ print "No";exit;}
             $data2{$dat[0]}--;
             $data2{$dat[1]}++;
             $str .= "$dat[1]\n";
        }else{
            $data2{$dat[0]}++;
            $data2{$dat[1]}--;
            $str .= "$dat[0]\n";
        }
    }
    
print "$str";
    

Measured memory_bytes: 13072
#include <bits/stdc++.h>
// B - KEYENCE String

using namespace std;

int main() {
    string S;
    int len,i;

    cin >> S;
    len = S.size() - 7;

    for (i = 0;i + len < S.size();i++) {
        if ((S.substr(0,i) + S.substr(i + len,S.size() - i - len)) == "keyence") {
            printf("YES\n");
            return 0;
        }
    }

    if (S.substr(S.size() - len,len) == "keyence") {
        printf("YES\n");
        return 0;
    }

    printf("NO\n");

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007LL

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

class minCostFlow {

	struct edge { ll to, cap, cost, rev; };

	ll V;
	vector<vector<edge>> G;
	vector<ll> dist;
	vector<ll> prevv;
	vector<ll> preve;

public:

	minCostFlow(ll n): G(n), dist(n), prevv(n), preve(n), V(n){
	}

	void addEdge(ll from, ll to, ll cap, ll cost) {
		G[from].push_back((edge){to, cap, cost, (ll)G[to].size()});
		G[to].push_back((edge){from, 0, -cost, (ll)G[from].size() - 1});
	}

	ll solve(ll s, ll t, ll f) {
		ll ret = 0;
		while(f > 0) {
			fill(dist.begin(), dist.end(), LLINF);
			dist[s] = 0;
			bool update = true;
			while(update) {
				update = false;
				for(ll v = 0;v < V;v++) {
					if(dist[v] == LLINF)continue;
					for(ll i = 0;i < G[v].size();i++) {
						edge &e = G[v][i];
						if(e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
							dist[e.to] = dist[v] + e.cost;
							prevv[e.to] = v;
							preve[e.to] = i;
							update = true;
						}
					}
				}
			}
			if(dist[t] == LLINF) {
				return LLINF;//流せない
			}

			ll d = f;
			for(ll v = t;v != s;v = prevv[v]) {
				d = min(d, G[prevv[v]][preve[v]].cap);
			}
			f -= d;
			ret += d * dist[t];
			for(ll v = t;v != s;v = prevv[v]) {
				edge &e = G[prevv[v]][preve[v]];
				e.cap -= d;
				G[v][e.rev].cap += d;
			}
		}
		return ret;
	}

};

char mp[55][55];
int dist[55][55];
minCostFlow mcf(2 * 55 * 55 + 2);
int mcf_s = 2 * 55 * 55;
int mcf_g = 2 * 55 * 55 + 1;
ll h, w;

void seica(int r, int c) {
	REP(i, 55)REP(j, 55)dist[i][j] = INF;
	dist[r][c] = 0;
	queue<P> q;
	q.push(MP(r, c));

	while(!q.empty()) {
		int y = q.front().FI;
		int x = q.front().SE;
		q.pop();

		mcf.addEdge(r * 55 + c, 55 * 55 + y * 55 + x, 1, - dist[y][x]);

		if(y + 1 < h && mp[y + 1][x] != '#' && dist[y + 1][x] > dist[y][x] + 1) {
			dist[y + 1][x] = dist[y][x] + 1;
			q.push(MP(y + 1, x));
		}
		if(x + 1 < w && mp[y][x + 1] != '#' && dist[y][x + 1] > dist[y][x] + 1) {
			dist[y][x + 1] = dist[y][x] + 1;
			q.push(MP(y, x + 1));
		}
	}
}

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

	REP(i, 55)REP(j, 55) {
		mcf.addEdge(mcf_s, i * 55 + j, 1, 0);
		mcf.addEdge(55 * 55 + i * 55 + j, mcf_g, 1, 0);
	}

	cin >> h >> w;

	REP(i, h) {
		REP(j, w) {
			cin >> mp[i][j];
		}
	}

	int cou = 0;
	REP(i, h) {
		REP(j, w) {
			if (mp[i][j] == 'o') {
				seica(i, j);
				cou++;
			}
		}
	}

	cout << -mcf.solve(mcf_s, mcf_g, cou) << endl;

	return 0;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root=NIL;
Node treeMinimum(Node x){
  if(x->left == NIL) return x;
  else treeMinimum(x->left);
}

Node treeMaximum(Node x){
  if(x->right == NIL) return x;
  else treeMaximum(x->right);
}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;
  else if(k < u->key) return treeSearch(u->left,k);
  else return treeSearch(u->right,k);
}

void treeDelete(Node z){
  Node y;
  Node x;
  Node a;
  if(z->left == NIL || z->right == NIL) y = z;

  else {
    while(1){
    if(z->right != NIL){
      y=treeMinimum(z->right);
      break;
    }

    a = z->parent;
    while(a != NIL && z->key == a->right->key){
      z = a;
      a = a->parent;
    }
    y=a;
    break;
  }
}

  if(y->left!=NIL) x = y->left;
  else x = y->right;

  if(x!=NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if(y!=z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else x = x->right;

  }
  z->parent = y;
  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}void preorder(Node u){
  if(u==NIL) return ;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20460
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d ;

  if( a + b > c + d) {
    cout << "Left" << endl;
  }
  else if ( a + b == c + d ){
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3612
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 10000007;
const int inf = 1001001001;



int main(void) {
  string s;
  cin >>s;
  int ans = 0;
  rep(i,s.size()-1){
    if(s[i]!=s[i+1]) ans++;
  }
  cout << ans << endl;
}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int a,b;
    Scd2(a,b);

    printf ("%d\n", max(0,a-b*2) );

    return 0;
}




Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  int sum = 0;
  for (auto& c : s) {
    sum += (c == '+' ? 1 : -1);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) {if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a, T b) {if(a>b){a=b;return 1;}return 0;}

vector<int> demical(ll n,int k,int l){
    vector<int> rtn(l);
    REP(i,l){
        rtn[i]=n%k;
        n/=k;
    }
    /*while(n>0){
        rtn.push_back(n%k);
        n/=k;
    }*/
    return rtn;
}

int n;
vector<int> a(3);

int main(){
    cin >> n;
    REP(i,3){
        cin >> a[i];
    }
    vector<int> l(8,1e6);
    REP(i,n){
        cin >> l[i];
    }
    int res = INT_MAX;
    ll f = pow(4,8);
    REP(i,f){
        int cost = 0;
        vector<int> v(4,0);
        vector<int> k = demical(i,4,8);
        REP(j,k.size()){
            v[k[j]]+=l[j];
            if(k[j]!=3)cost+=10;
        }
        REP(j,3){
            cost+=abs(v[j]-a[j]);
        }
        if(v[0]&&v[1]&&v[2]){
            chmin(res,cost);
        }
    }
    put(res-30);
    return 0;
}


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

int main(){
	char x,y;
	cin>>x>>y;
	if(x<y){
		cout<<"<"<<endl;
	}else if(x>y){
		cout<<">"<<endl;
	}else{
		cout<<"="<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;


int main(){
ll N;
string s;
cin>>N>>s;

ll nai=-100;
for(ll i=0;i<N;i++){
  if(s[i]=='#'){
    nai = i;
    break;
  }
}

if(nai==-100){
cout<<0<<endl;
return 0;
}

ll allb=0;

for(ll i=nai;i<N;i++){
  if(s[i]=='.'){
    allb++;
  } 
}


ll tmp = allb;

char now = '#';
for(ll i=nai;i<N;i++){

  if(now!=s[i]){
    if(tmp<allb){
      allb=tmp;
    }
  }


  if(s[i]=='#'){
    tmp++;
    now = s[i];
  } 
  else if(s[i]=='.'){
    tmp--;
        now = s[i];

  }
}


 if(tmp<allb){
      allb=tmp;
    }
cout<<allb<<endl;


}



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

int main()
{
	string s;
	cin >> s;
	int ans = 0;
	for(auto i = 0; i < 4; ++i){
		if(s[i] == '+') ++ans;
		else --ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define gcd __gcd
#define lcm(n, m) n * m / gcd(n, m)
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define ea(i, n) for(auto&& i: n)
#define so(n) sort(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// rtsq ルート, int 2*10^9, __gcd

int main() {
  char b;
  ci(b);
  if(b == 'A'){
    co('T');
  }
  else if(b == 'T'){
    co('A');
  }
  else if(b == 'C'){
    co('G');
  }
  else if(b == 'G'){
    co('C');
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
int a,b,c;
int k1,k2,k3;

int main(){
  cin >> a;
  if(a%2==0) cout << a << endl;
  else cout << a*2 << endl;
  
  return 0;
}


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

int main(){
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(N);
  for(int i=0; i<Q; i++){
    int B;
    cin >> B;
    A.at(B-1)++;
  }
  for(int i=0; i<N; i++){
    if(K-Q+A.at(i)>0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1000000007;
int fac[4040404];
int ifac[4040404];
int dp[2020][2020];
int C(int n,int m)
{
	if(n<m)
		return 0;
	return (long long)fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int main()
{
	int n,k,h;
	scanf("%d%d",&n,&k);
	if(k==1)
	{
		printf("1");
		return 0;
	}
	fac[0]=1;
	h=n*k;
	k--;
	for(int i=1;i<=h;i++)
		fac[i]=(long long)fac[i-1]*i%mod;
	ifac[0]=ifac[1]=1;
	for(int i=2;i<=h;i++)
		ifac[i]=(long long)(mod-mod/i)*ifac[mod%i]%mod;
	for(int i=2;i<=h;i++)
		ifac[i]=(long long)ifac[i-1]*ifac[i]%mod;
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=0;i<=n;i++)
		for(int j=max(i,1);j<=n;j++)
		{
			if(i)
				(dp[i][j]+=dp[i-1][j])%=mod;
			(dp[i][j]+=(long long)dp[i][j-1]*C(i+j*k-1,k-1)%mod)%mod;
		}
	printf("%d",(long long)dp[n][n]*fac[n]%mod);
	return 0;
}

Measured memory_bytes: 47616
n = int(input())
b = list(map(int, input().split()))
ans = []
index = 0
count = 0
while count <= 10000 and len(b) > 0:
    index = len(b) - 1
    while index >= 0:
        if index + 1 == b[index]:
            ans.append(b[index])
            del b[index]
            index = len(b) - 1
            continue
        index -= 1
        count += 1
if len(ans) == n:
    ans.reverse()
    for i in range(n):
        print(ans[i])
else:
    print(-1)

Measured memory_bytes: 39024
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll i, o, t, j, l, s, z;
    cin >> i >> o >> t >> j >> l >> s >> z;
    ll ret = 0;
    ret += 2 * (i / 2);
    ret += o;
    ret += (j / 2) * 2;
    ret += (l / 2) * 2;
    if (j % 2 == 1 && l % 2 == 1 && i % 2 == 1) {
        ret += 3;
    } else if (j % 2 == 1 && l % 2 == 1 && i > 0) {
        ret += 1;
    } else if (j % 2 == 1 && i % 2 == 1 && l > 0) {
        ret += 1;
    } else if (i % 2 == 1 && l % 2 == 1 && j > 0) {
        ret += 1;
    }
    cout << ret << "\n";
    return 0;
}

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

using namespace std;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<ll, ll> pii;

const int mn = 2e5 + 5;
const int mod = 1e9 + 7;

int n, k;
int a[mn];
set<int> s;

int main() {
#ifdef trote
    freopen("../1.txt", "r", stdin);
#endif
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= k; i++) s.insert(a[i]);
    int ans = 1;
    for (int i = k + 1; i <= n; i++) {
        s.insert(a[i]);
        if (a[i - k] == *s.begin() && a[i] == *s.rbegin()) ans--;
        s.erase(a[i - k]);
        ans++;
    }
    int u = 0;
    int l = 1;
    bool flag = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i - 1] < a[i]) {
            if (l <= i - k + 1 && !flag) u++, flag = 1;
        } else {
            l = i;
            flag = 0;
        }
    }
    if (u == 0) u = 1;
    printf("%d\n", ans - (u - 1));
    return 0;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

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

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int main(){
    ios::sync_with_stdio(false);
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int h=k/60;
    int m=k%60;
    h2-=h;
    m2-=m;
    cout << 60*(h2-h1)+(m2-m1) << endl;
    return 0;
}

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


typedef long long ll;

const int maxn=2e5+10;

int a[maxn];

int main()
{
	ll x,k,d;
	cin>>x>>k>>d;
	if( x<0 ) x=-x;
	ll num=abs(x/d);
	
	if( num>=k )
	{
		 cout<<abs(x-k*d)<<endl;
		
	} 
	else
	{
		k-=num;
		x-=num*d;
		if( k%2==1 )
		{
			cout<<abs(x-d)<<endl;
		}
		else cout<<abs(x)<<endl;
	}
} 

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

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

    return 0;
}

Measured memory_bytes: 256