akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() { cin.tie(nullptr); ios_base::sync_with_stdio(false); }
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

signed main()
{
  string s;
  cin >> s;
  puts(s.find("AC") < s.length() ? "Yes": "No");

  return 0;
}



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

#define ll long long

int powerNumbers(int n)
{
    vector<int> v;
    v.push_back(1);

    for (ll i = 2; i * i <= n; i++) {
        ll j = i * i;
        v.push_back(j);
        while (j * i <= n) {
            v.push_back(j * i);
            j = j * i;
        }
    }

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

    return v[v.size()-1];
}

int main()
{
    int x;
    cin >> x;
    cout << powerNumbers(x);
    return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a;
    for (int i = 0; i < 5; i++) {
        cin >> a;
        if ( a == 0) {
            cout << i+1;
            break;
        }
    }
}


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

int N, M;
vector<vector<int>> graph;
vector<bool> vertex;
int ans;

void Dfs(int u) {
  vertex[u] = true;
  int visit = 0;
  for (int i = 0; i < N; i++) if (vertex[i]) visit++;
  if (visit == N) ans++;
  for (int i = 0; i < N; i++) if (graph[u][i] && !vertex[i]) Dfs(i);
  vertex[u] = false;
}

int main() {
  cin >> N >> M;
  graph.resize(N, vector<int>(N)), vertex.resize(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    graph[a - 1][b - 1]++;
    graph[b - 1][a - 1]++;
  }
  Dfs(0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define dl double
#define mp make_pair
#define pb push_back
#define F first
#define S second
using namespace std;

//***********************************************************************

// hash struct for unordered_map
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int MAXNUM = 5e3+5;
vector <int>vis(MAXNUM);
vector<int> pr;
void sieve() {
	pr.push_back(2);
	for(ll i=3;i<MAXNUM;i+=2) if(!vis[i]) {
		pr.push_back(i);
		for(ll j=i*i;j<MAXNUM;j+=2*i) vis[j]=true;
	}
}
//************************************************************************

void solve()
{
	string s;
	cin >>s;

	ll ans=0;
	int n=s.size();
	for(int i=0;i<n;i++)
	ans+=s[i]-'0';
	if(ans%9)
	cout << "No" << endl;
	else
	cout << "Yes" << endl;
}

int main()
{ 
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	ll t;
	//cin >> t;
	t=1;
	while(t--)
	{
		solve();
	}

	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    for(int T = 0; T < t ; T++){
        string s;
        cin >> s;
        cout << s[0] << s[1] << s[2] << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
N = gets.split('\n').map(&:to_f)
nums = gets.chomp.split(' ').map(&:to_f)
n = N[0].to_f
sum = 0;
for i in 0..n-1 do
  a = 1/nums[i]
  sum = sum + a
end

ans = 1/sum

puts ans



Measured memory_bytes: 1788
#include <iostream>
using namespace std;
int main() {
    int n,m;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int s=0;
    for(int h=0;h<n;h++)
        s+=a[h];
    cin>>m;
    while(m--){
        int f,g;
        cin>>f>>g;
        cout<<s-a[f-1]+g<<endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  
  int a,b,c,d;
  int flag1 = 0;
  int flag2 = 0;
  
  scanf("%d %d %d %d", &a, &b, &c, &d);
  
  while(a > 0){
  	a = a - d;
  	flag1++;
  }
  
  while(c > 0){
  	c = c - b;
  	flag2++;
  }
  
  if(flag1 >= flag2){
  	printf("Yes");
  }else{
  	printf("No");
  }
  
  return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for (int i = 1; i < s.length(); i++) if (s[i - 1] == s[i]) {
        cout << i << ' ' << i + 1;
        return 0;
    }
    for (int i = 2; i < s.length(); i++) if (s[i - 2] == s[i]) {
        cout << i - 1 << ' ' << i + 1;
        return 0;
    }
    cout << -1 << ' ' << -1;
}


Measured memory_bytes: 512
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextInt64() int64 {
	i, err := strconv.ParseInt(io.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}


func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

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

func (io *Io) PrintBool(b bool, trueS, falseS string) {
	if b {
		io.PrintLn(trueS)
	} else {
		io.PrintLn(falseS)
	}
}

func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func absi(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func b2i(b bool) int {
	if b {
		return 1
	}
	return 0
}

type Int64s []int64
func (f Int64s) Len() int {
	return len(f)
}
func (f Int64s) Less(i, j int) bool {
	return f[i] < f[j]
}

func (f Int64s) Swap(i, j int) {
	f[i], f[j] = f[j], f[i]
}


func solve(io *Io) {
	n := io.NextInt()

	used := map[string]bool{}
	s := io.Next()
	used[s] = true

	ok := true
	for i := 1; i < n; i++ {
		s2 := io.Next()
		exists := used[s2]
		if exists {
			ok = false
		}
		used[s2] = true

		if s[len(s)-1] != s2[0] {
			ok = false
		}
		s = s2
	}

	io.PrintBool(ok, "Yes", "No")
}

func main() {
	io := NewIo()
	defer io.Flush()

	solve(io)
}


Measured memory_bytes: 640
#include <iostream>
//#include <numeric>
#include <vector>
//#include <cstdint>
//#include <string>
//#include <cstdlib>
using namespace std;

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

	for (int i = 1; i < 10; i++) {
		if (a % i == 0&&a/i<10) {
			cout << "Yes";
			break;
		}
		if (i == 9) {
			cout << "No";
		}
	}

	return 0;

}

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

int main(){
    int K,N,sum = 0,max = 0;
    cin >> K >> N;
    int a[N],b[N];
    for (int i = 0; i < N; i++) cin >> a[i];
    for (int i = 0; i <= N-2; i++) {
        b[i] = a[i+1] - a[i];
        sum += b[i];
        if (max < b[i]) max = b[i];
    }
    b[N-1] = K - sum;
    if (max < b[N-1]) max = b[N-1];
    cout << K-max;
}

Measured memory_bytes: 1792
data = [int(i) for i in input().split(' ')]
A = data[0]
B = data[1]

count = 0
for i in range(A, B+1):
    i = str(i)
    l = len(str(i))
    l_half = l//2
    for j in range(l_half):
        if j == l_half-1:
            if i[j]==i[l-1-j]:
                count += 1
        if i[j]==i[l-1-j]:
            continue
        else:
            break
        
print(count)

Measured memory_bytes: 9096
#include<bits/stdc++.h>
#pragma GCC optimize ("-O3")
    using namespace std;
    #define ll long long
    #define ld long double
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define pll pair<ll,ll>
    #define ff first
    #define ss second
    #define pb push_back
    #define deb(x) cout<<#x<<" : "<<x<<endl;
    #define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
    #define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
    #define deb4(w,x,y,z) cout<<#w<<" : "<<w<<"\t"<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
    #define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define printv(a)  for(ll i=0;i<a.size();i++)  cout<<a[i]<<" ";
   
   
    const int mod=998244353.;
    const int N=1e6+5; 
   
    bool sortbysec(const pair<pair<ll,ll>,ll> &a, 
                      const pair<pair<ll,ll>,ll> &b) 
        { 
            return (a.second > b.second); 
        } 
        ll powermod(ll x, ll y, ll p)
        {
            ll res = 1;
            x = x % p;
            while (y > 0)
            {
                if (y & 1) res = (res*x) % p;
                y = y>>1;
                x = (x*x) % p;
            }
            return res;
        }
       
        bool isprime(int n) 
        { 
            if (n <= 1)  return false; 
            if (n <= 3)  return true; 
            if (n%2 == 0 || n%3 == 0) return false; 
            for (int i=5; i*i<=n; i=i+6) 
                if (n%i == 0 || n%(i+2) == 0) 
                   return false; 
           return true; 
        }
       
       
        int main()
    {
        FAST;
      ll n,k;
      cin>>n>>k;
      vll a(n);
      for(ll i=0;i<n;i++)
      cin>>a[i];
      ll dp[n];
      for(ll i=0;i<n;i++)
      dp[i]=1e9+5;
      dp[0]=0;
      for(ll i=0;i<n;i++)
      {
          for(ll j=i+1;j<=i+k;j++)
          {
              if(j<n)
              {
                  dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));
              }
          }
      }
      cout<<dp[n-1]<<"\n";
        
        
        
        return 0;
    }

Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc166/tasks/abc166_f

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  map<char, ll> ct;
  cin >> N >> ct['A'] >> ct['B'] >> ct['C'];

  V<string> ops(N);

  rep(i, N) cin >> ops[i];

  V<char> res(0);

  auto move = [&](char dest, char src) {
    ct[dest] += 1;
    ct[src] -= 1;
    res.push_back(dest);
  };

  auto handle = [&](char x, char y, ll index) {
    if (ct[x] == 0 && ct[y] == 0) drop("No");

    if (ct[x] < ct[y]) {
      move(x, y);
      return;
    }

    if (ct[x] > ct[y]) {
      move(y, x);
      return;
    }

    if (index == N - 1) {
      move(y, x);
      return;
    }

    if (ops[index + 1][0] == x || ops[index + 1][1] == x) {
      move(x, y);
    } else {
      move(y, x);
    }
  };

  rep(i, N) {
    string o = ops[i];

    if (o == "AB") {
      handle('A', 'B', i);
    } else if (o == "AC") {
      handle('A', 'C', i);
    } else if (o == "BC") {
      handle('B', 'C', i);
    }
  }

  cout << "Yes"
       << "\n";
  rep(i, N) cout << res[i] << "\n";
}


Measured memory_bytes: 6712
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;


ll ans, mx, mn = 1e8, flag, sum, cnt;
int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	flag = a[2]-a[1];
	a[0] +=flag;
	a[1] += flag;
	sum = a[2]-a[0];
	if(sum%2!=0) {
		cout<<(sum/2)+flag+2<<endl;	
	} else cout<<(sum/2)+flag<<endl;
}


Measured memory_bytes: 256
import java.lang.Math

val MOD: Int = 1000000000 + 7
val MODL: Long = MOD.toLong()

var fact = mutableListOf<Int>()

fun main(args: Array<String>)
{
    val n = read().toInt()
    calcFact(n)
    val p = read().split(" ").map{it.toInt()}.toIntArray()
    val q = read().split(" ").map{it.toInt()}.toIntArray()

    var a = 1
    for (i in 0 until n) {
        a += (p[i] - 1) * fact[n-1-i]
        for (k in i+1 until n) {
            if (p[k] > p[i]) p[k] -= 1
        }
    }

    var b = 1
    for (i in 0 until n) {
        b += (q[i] - 1) * fact[n-1-i]
        for (k in i+1 until n) {
            if (q[k] > q[i]) q[k] -= 1
        }
    }

    println(Math.abs(a-b))
}

fun calcFact(n: Int): Int {
    if (n == 0) {
        fact.add(1)
        return 1
    }

    val f = n * calcFact(n-1)
    fact.add(f)
    return f
}

fun read(): String = readLine()!!


Measured memory_bytes: 37944
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(a == 0 && b == 0) break;
			
			int c = b - a;
			
			int ax = 0;
			int bx = 0;
			int cx = 0;
			
			cx = c/1000;
			c -= cx*1000;
			bx = c/500;
			c -= bx*500;
			ax = c/100;
			
			System.out.println(ax + " " + bx + " " + cx);
			
			
			
			
		}
	}
}

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

long solve(long x, long y) {
  long xdivy = x / y, xmody = x % y;
  if (xmody == 0) {
    return (2 * xdivy - 1) * y;
  } else {
    return 2 * xdivy * y + solve(y, xmody);
  }
}

int main(int argc, char *argv[]) {
  // read inputs
  long N, X;
  scanf("%ld %ld", &N, &X);

  // solve
  long ans;
  if (X < N - X) {
    ans = N + 2 * X + solve(X, N - 2 * X);
  } else if (X > N - X) {
    ans = N + solve(X, N - X);
  } else {
    ans = 3 * X;
  }
  printf("%ld\n", ans);

  return 0;
}


Measured memory_bytes: 128
#[allow(dead_code)]
const MOD: usize = 1_000000000 + 7;

fn main() {
    let mut cin = Scanner::new();
    let s = cin.next_usize();
    println!("{}", if s % 10 == 9 || s / 10 == 9 { "Yes" } else { "No" });
}


struct Scanner {
    reader: std::io::Stdin,
    tokens: std::collections::VecDeque<String>,
}

impl Scanner {
    fn new() -> Self {
        Scanner {
            reader: std::io::stdin(),
            tokens: std::collections::VecDeque::new(),
        }
    }

    fn next(&mut self) -> String {
        if self.tokens.is_empty() {
            let mut s = String::new();
            loop {
                self.reader.read_line(&mut s).ok();
                let s = s.trim();
                if s.len() != 0 {
                    for it in s.split_whitespace() {
                        self.tokens.push_back(it.into())
                    }
                    break;
                }
            }
        }
        self.tokens.pop_front().unwrap()
    }

    fn next_generics<T>(&mut self) -> T where
        T: std::str::FromStr + std::marker::Copy,
        <T as std::str::FromStr>::Err: std::fmt::Debug
    {
        self.next().parse().unwrap()
    }
    
    #[allow(dead_code)] fn next_i32(&mut self) -> i32 { self.next_generics::<i32>() }
    #[allow(dead_code)] fn next_i64(&mut self) -> i64 { self.next_generics::<i64>() }
    #[allow(dead_code)] fn next_u64(&mut self) -> u64 { self.next_generics::<u64>() }
    #[allow(dead_code)] fn next_usize(&mut self) -> usize { self.next_generics::<usize>() }
    #[allow(dead_code)] fn next_isize(&mut self) -> isize { self.next_generics::<isize>() }
}



Measured memory_bytes: 4352
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]

ans=0
cnt=0
for i in range(n):
  for j in range(n):
    if s[i]==s[j]:
      cnt+=1
  for k in range(m):
    if s[i]==t[k]:
      cnt-=1
  ans=max(ans,cnt)
  cnt=0
print(ans)

Measured memory_bytes: 66232
#include<stdio.h>
int main(void)
{
	int n,i,j,tmp,count=0;
	scanf("%d",&n);
	int A[n];
	
	for(i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
	}	
	for(i=0;i<n;i++)
	{
		for(j=n-1;j>=i;j--)
		{
			if(A[j]<A[j-1])
			{
				tmp=A[j];
				A[j]=A[j-1];
				A[j-1]=tmp;
				count++;
			}
			
	
		}
	}
	for(i=0;i<n;i++)
	{
		printf("%d",A[i]);
		if(i!=n-1)
		{
			printf(" ");
		}
	}
	printf("\n");
	printf("%d\n",count);

	return 0;
}


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

using namespace std;

int main()
{
	string s;
	cin >> s;
	
	if (s.length() > 3 && s[0] == 'Y' && s[1] == 'A'&& s[2] == 'K'&& s[3] == 'I') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int MOD = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 素数
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// べき乗の余り
ll modpow(ll a, ll n){
    ll res = 1;
    while(n){
        if(n & 1){
            res = res * a % MOD;
        }
        a = a * a % MOD;
        n = n >> 1;
    }
    return res;
}

// コンビネーション
ll MAXN = 2e5+10;
vector<ll> inv(MAXN);
ll nCk(ll n, ll k) {
	ll res = 1;
	for(ll i = 1; i <= k; i++) {
		res = res*(n-i+1) % MOD;
	}
 
	for(ll i = 1; i <= k; i++) {
		res = res*inv[i] % MOD;
	}
	return res;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

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

    ll ans = 0;
    ll count = 10;
    if(n % 2 == 0){
        while(true){
            ans += n / count;
            count *= 5;
            if(n / count == 0){
                break;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 4680
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

int n, a[3];
char s[N][5], ans[N];

void f(int p, int q, int r) {
	ans[p] = q + 'A';
	a[q]++, a[r]--;
}

int main() {
	int i, x, y, t;
	cin >> n >> a[0] >> a[1] >> a[2];
	for(i=0; i<n; i++) scanf("%s", &s[i]);
	for(i=0; i<n; i++) {
		x = s[i][0] - 'A';
		y = s[i][1] - 'A';
		if(!a[x] && !a[y]) return puts("No"), 0;
		if(a[x]==1 && a[y]==1) {
			if(x==0) {
				t = s[i+1][0] - 'A';
				t==0 ? f(i, x, y) : f(i, y, x);
			} else {
				t = s[i+1][1] - 'A';
				t==2 ? f(i, y, x) : f(i, x, y);
			}
		} else a[x]<a[y] ? f(i, x, y) : f(i, y, x);
	}
	puts("Yes");
	for(i=0; i<n; i++) printf("%c\n", ans[i]);
	return 0;
}

Measured memory_bytes: 4404
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }

const int maxn = 2e5 + 5;
vi g[maxn];
ll push[maxn];
ll res[maxn];

void dfs(int u, int par, ll d){
	d += push[u];
	res[u] = d;
	for(int v : g[u]){
		if(v == par) continue;
		dfs(v, u, d);
	}
}

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

	int n, q;
	cin >> n >> q;
	for(int i = 0; i < n - 1; i++){
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	while(q--){
		int u, w;
		cin >> u >> w;
		push[u] += w;
	}
	dfs(1, 1, 0);
	for(int i = 1; i <= n; i++)
		cout << res[i] << " ";
}

Measured memory_bytes: 25600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, x, y;
	cin >> n >> x >> y;
	x--; y--;
	vector<vector<int>> ans(n,vector<int>(n));
	rep(i, n - 1) {
		for (int j = i + 1; j < n; ++j) {
			ans[i][j] = abs(j - i);
		}
	}
	vector<int> j_ans(n);
	rep(i, n - 1) {
		for (int j = i + 1; j < n; ++j) {
			ans[i][j] = min(ans[i][j], abs(x - i) + abs(y - j) + 1);
			j_ans[ans[i][j]]++;
		}
	}
	rrep(i, n) dunk(j_ans[i]);
	return 0;
}


Measured memory_bytes: 16000
n=int(input())+1
e=[input().split()for _  in[0]*~-n]
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for l in range(2,n):
 for i in range(1,n-l+1):
  j=i+l-1;m[i][j]=1e6
  for k in range(i,j):m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j])
print(m[1][n-1])


Measured memory_bytes: 5724
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimise ("ofast")
#pragma GCC optimise("unroll-loops")

using namespace std;

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

const int N = 200000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000000000000000;
const ll LOG = 25;

int n, m, dis[N];
bool mark[N];
vector<pii> G[N];
bool f = 0;

void DFS(int v){
	mark[v] = 1;
	for (auto u:G[v]){
		if (!mark[u.F]){
			dis[u.F] = dis[v] + u.S;
			DFS(u.F);
		}else{
			if (dis[u.F] != dis[v] + u.S) f = 1;
		}
	}
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= m; i++){
		int v, u, w;
		cin >> v >> u >> w;
		G[v].pb({u, w});
		G[u].pb({v, -w}); 
	}
	for (int i = 1; i <= n; i++){
		if (!mark[i]) DFS(i);
	}
	if (f) return cout << "No", 0;
	cout << "Yes";










	return 0;
}


Measured memory_bytes: 13568
function Main(input) {
    input = input.split("\n");
    var N = Number(input[0]);
    var inputA = input[1].split(' ').map(Number);
    var inputB = input[2].split(' ').map(Number);
    var inputC = input[3].split(' ').map(Number);
    var count = 0;
    for(var i=0; i < N;i++){
        count +=  inputB[ inputA[i] - 1 ] ;
            //if( inputA[i-1] === inputA[i] -1  ){
        if( inputA[i] === (inputA[i-1]+1)  ){
            //count += inputC[  inputA[i-1] -1 ];
            count += inputC[inputA[i] -2];
        }
    }
    console.log(count);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）

Main(require("fs").readFileSync("/dev/stdin", "utf8"))

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

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int N, T;
    cin >> N >> T;

    vector<int> c(N), t(N);
    for (int i = 0; i < N; i++) cin >> c[i] >> t[i];

    vector<int> ans;
    for (int i = 0; i < N; i++) if (t[i] <= T) ans.push_back(c[i]);

    if(ans.size() == 0) cout << "TLE";
    else cout << *min_element(ans.begin(), ans.end()) << endl;

    return 0;
}











































































Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int N, P = 0;
    int *D;
    cin >> N;
    D = new int[N];
    for (int i = 0; i < N; i++)
    {
        cin >> D[i];
    }

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (i != j)
            {
                P += D[i] * D[j];
            }
        }
    }
    cout << P / 2 << endl;
    return 0;
}

Measured memory_bytes: 888
def compare(h,w):
    hw=h**2+w**2

    tmp_h=150
    tmp_w=150
    tmp_hw=150**2+150**2

    for j in range(1,150):
        for i in range(1,j):
            ij=i**2+j**2
            if (hw < ij) or (hw == ij and h < i) : # ??\????????\???
                #print ("1",h,w,hw,i,j,ij,tmp_h,tmp_w,tmp_hw)
                if  (tmp_hw > ij) or (tmp_hw == ij and tmp_h > i):
                    #print ("2",h,w,hw,i,j,ij,tmp_h,tmp_w,tmp_hw)
                    tmp_h=i
                    tmp_w=j
                    tmp_hw=ij

    print(tmp_h,tmp_w)


import sys

for line in sys.stdin:
    h,w=map(int,line.split())
    if h!=0 and w!=0:
        compare(h,w)

Measured memory_bytes: 7676
import "dart:io";

main(){
  int a = int.parse(stdin.readLineSync());
  int b = int.parse(stdin.readLineSync());
  int c = int.parse(stdin.readLineSync());
  int x = int.parse(stdin.readLineSync());

  int ans = 0;
  for (int i = 0; i <= a; i++){
    for (int j = 0; j <= b; j++){
      if ((x - 500 * i - 100 * j) >= 0 && (x - 500 * i - 100 * j) % 50 == 0 && (x - 500 * i - 100 * j) / 50 <= c){
        ans++;
      }
      /*
      for (int k = 0; k <= c; k++){
        if (500 * i + 100 * j + 50 * k == x) ans++;
      }
      */
    }
  }
  print(ans);
}


Measured memory_bytes: 13140
//// Journey of Harry Singh from Diploma in Cse to Red Coder of India.///////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define maxn 210
const int MOD = 1000000007;
int dist[maxn][maxn];
constexpr int INF = INT_MAX;
int32_t main(){
int n,m,r,v,u,w;
cin>>n>>m>>r;
vector<int> p(r);
for(int i=0;i<r;i++)cin>>p[i];

sort(p.begin(),p.end());

for(int i=0;i<=maxn;i++)for(int j=0;j<=maxn;j++)if(i!=j)dist[i][j]=INF;


for(int i=1;i<=m;i++)
{
	cin>>v>>u>>w;
	dist[u][v]=dist[v][u]=w;
}

// flyod warshall
for (int k = 1; k <=n; k++)  
for (int i = 1; i <=n; i++)  
for (int j = 1; j <=n; j++)  
dist[i][j]=min(dist[i][k] + dist[k][j],dist[i][j]); 

// now we have  the mindis form each town to each towne     now check the every permutation bro
 int pasn = LLONG_MAX;
    do {
        int ans = 0;
        for (int i = 1; i < r; i++)
            ans += dist[p[i - 1]][p[i]];
        pasn = min(pasn, ans);
    } while (next_permutation(p.begin(), p.end()));
    cout << pasn << endl;




}

Measured memory_bytes: 640
n = int(input())

ans = 0
flag = 0

for i in range(0, n):
    x, y = input().split()
    if x == y:
        ans = ans + 1
    else:
        ans = 0
    if ans >= 3:
        flag = 1
if flag == 1:
    print("Yes")
else :
    print("No")


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<bool> vb;

const int MAXN = 101;
const int MAXV = 1e5+1;
const ll INF = 1e13;

int num[MAXN][2];

ll matrix[MAXV];

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

    int n,w,Tval=0; cin >> n >> w;
    for(int i=1; i<=n; i++){
        cin >> num[i][0] >> num[i][1];
        Tval += num[i][1];
	}
		
    for(int i=0; i<=Tval; i++){
        matrix[i] = INF;
    }
    matrix[0] = 0;
    
    for(int i=1; i<=n; i++){
        for(int j=Tval; j>=num[i][1]; j--){
        	matrix[j] = min(matrix[j], matrix[j-num[i][1]]+num[i][0]);
        }
    }
    
    int i;
    for(i=Tval; i>=0; i--){
    	if(matrix[i]<=w) break;
    }
    
    cout << i << '\n';

    return 0;
}



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

typedef std::tuple<string, int, int> mytuple;

// タプルの最初の要素から順番に比較　もしその要素が同じなら次の要素で比較
bool mycompare( const mytuple &lhs, const mytuple &rhs )
{
  if (std::get<0>(lhs) != std::get<0>(rhs)) return std::get<0>(lhs) < std::get<0>(rhs);
  if (std::get<1>(lhs) != std::get<1>(rhs)) return std::get<1>(lhs) > std::get<1>(rhs);
  return std::get<2>(lhs) < std::get<2>(rhs);
}

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

  vector<mytuple> p(N);

  for(int i = 0; i < N; i++) {
    int P;
    string S;
    cin >> S >> P;
    p.at(i) = make_tuple(S, P, i+1);
  }

  sort(p.begin(), p.end(), mycompare);

  for(int i = 0; i < N; i++){
    string s;
    int rank, num;
    tie(s, rank, num) = p.at(i);
    cout << num << endl;
  }
}


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

using namespace std;

const int N = 1e5 + 123;

signed main() {
    int n;
    cin >> n;
    int dp[N], h[N];
    // dp[i] - дает минимально возможную стоимость для достижения i камня
    for (int i = 0; i < n; i++)
        cin >> h[i];
    // Надо написать базу для dp 
    // Чтобы достичь 0-го камня, нам не нужно прыгать с любой ячейки, поэтому общая стоимость равна 0
    // Чтобы достичь 1-го камня, мы можем прыгать с 0-й ячейки с общей стоимостью = abs(h[1] - h[0])
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < n; i++) 
        // с камня можно добраться либо от (i - 1) - го камня или (i - 2) - го камня
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
    cout << dp[n - 1];
    return false;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define ll long long
#define mset(s, _) memset(s, _, sizeof s)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int main(void) {
  vector<ll> a;
  int n;
  cin >> n;
  ll A;
  rep(i, 0, n - 1) {
    cin >> A;
    if (A == 0) {
      cout << 0 << endl;
      return 0;
    }
    a.push_back(A);
  }

  ll prod = 1;
  rep(i, 0, n - 1) {
    if (a[i] <= 1000000000000000000 / prod) {
      prod *= a[i];
    } else {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << prod << endl;
  return 0;
}


Measured memory_bytes: 4328
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e15;
const int MAX=1e5;
const int N_MAX=(1e5)*2;

int N,Q;
using Graph=vector<int>;
Graph G[N_MAX];
vector<int>A(N_MAX,0);

void dfs(int i,int x){
    //iは親、xは根
    for(auto v:G[x]){
        if(v!=i){
            A[v]+=A[x];
            dfs(x,v);
        }
    }
}

signed main(){
    cin>>N>>Q;
    REP(i,N-1){
        int a,b;cin>>a>>b;a--;b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    REP(i,Q){
        int p,x;cin>>p>>x;
        A[p-1]+=x;
    }
    dfs(-1,0);
    REP(i,N){
        cout<<A[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
 ll n;
 cin >> n;
 ll a[n],i;
 for(i=0;i<n;i++)
 cin >> a[i];
 sort(a,a+n);
 ll mid = n/2;
 ll s = a[mid]-a[mid-1];
  cout << s;
  return 0;   
}

Measured memory_bytes: 1024
x, y = [int(i) for i in input().split()]

group_a = [1, 3, 5, 7, 8, 10, 12]
group_b = [4, 6 ,9, 11]
group_c = [2]

def checkGroup(num):
    if num in group_a:
        return 'a'
    elif num in group_b:
        return 'b'
    else :
        return 'c'
    
x_group = checkGroup(x)
y_group = checkGroup(y)

if x_group == y_group:
    print('Yes')
else :
    print('No')

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

int main()
{
    int a, b;
    char op;

    while (true) {
        cin >> a >> op >> b;

        switch (op) {
            case '+':
                cout << a + b << endl;
                break;
            case '-':
                cout << a - b << endl;
                break;
            case '*':
                cout << a * b << endl;
                break;
            case '/':
                cout << a / b << endl;
                break;
            case '?':
                return 0;
            default:
                break;
        }
    }
}

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

int main() {
int K;
string S;
cin >> K >> S;
if(S.size() > K){
for(int i = 0; i < K; i++){
cout << S.at(i);}
cout << "..." << endl;}
if(S.size() <= K){
cout << S << endl;}}


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

using namespace std;

int main(void)
{
    long long N;
    cin >>N;

    long long sqr = sqrt(N);

    long long sum = -1;
    for(int i=1;i<=sqr;i++){
        if(N%i==0){
            if(sum > N/i +i || sum == -1){
                sum = N/i+i;
            }
        }
    }

    cout << sum -2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
#define rep(i,n) for(int i = 0;i<n;i++)

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

	cout << 10- x/200 << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <limits.h>
int main(void)
{
    long int n, i, x, max=-1, maxans=-1;
    scanf("%ld", &n);
    long int a[n];
    for(i=0;i<n;i++){
        scanf("%ld", &a[i]);
        if(a[i]>max) max=a[i];
    }
    long int cnt[10*10*10*10*10+1]={0};

        for(i=0;i<n;i++){
            cnt[a[i]]++; cnt[a[i]+1]++;
            if(a[i]!=0) cnt[a[i]-1]++;
        }

        for(i=0;i<=max+1;i++){
            if(cnt[i]>maxans) maxans=cnt[i];
        }
            
    printf("%ld\n", maxans);
    return 0;
}


Measured memory_bytes: 1664
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#define mod 1000000007
using namespace std;
int main(){
    int n,d[100000];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&d[i]);
    }
    sort(d,d+n);
    printf("%d\n",d[n/2]-d[n/2-1]);
}

Measured memory_bytes: 512
import sys
from fractions import gcd

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

N = ri()
A = rl()
answer = 0
cur = 1
for i in range(N):
    if A[i] == cur:
        answer += 1
        cur += 1
print(N - answer if answer > 0 else -1)


Measured memory_bytes: 27180
class DisjointSet:
    def __init__(self, n):
        self.p = [x for x in range(n)]
        self.rank = [0 for x in range(n)]

    def find_set(self, x):
        if self.p[x] != x:
            self.p[x] = self.find_set(self.p[x])
        return self.p[x]

    def link(self, x, y):
        if self.rank[y] < self.rank[x]:
            self.p[y] = x
        else:
            self.p[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def union(self, x, y):
        self.link(self.find_set(x), self.find_set(y))

    def same(self, x, y):
        return (self.find_set(x) == self.find_set(y))

n, q = list(map(int, input().split()))

S = DisjointSet(n)

for i in range(q):
    com, x, y = list(map(int, input().split()))
    if com == 0:
        S.union(x, y)
    elif com == 1:
        if S.same(x, y):
            print(1)
        else:
            print(0)

Measured memory_bytes: 8036
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;

int main(){
  int a, b;
  cin >> a >> b;
  if( a + b == 15 ) cout << "+" << endl;
  else if( a*b == 15 ) cout << "*" << endl;
  else cout << "x" << endl;


  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	static final int MOD = 998244353;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[] vals = new int[N];
		int total = 0;
		for (int i = 0; i < vals.length; i++) {
			vals[i] = sc.nextInt();
			total += vals[i];
		}
		int[] pots2 = new int[N+1];
		pots2[0] = 1;
		for (int i = 1; i < N+1; i++) {
			pots2[i] = (2 * pots2[i-1]) % MOD;
		}
		int[] sums = new int[total + 1];
		int[] simple = new int[total + 1];
		sums[0] = simple[0] = 1;
		for (int i = 0; i < N; i++) {
			for (int j = total; j >= 0; j--) {
				sums[j] *= 2;
				sums[j] %= MOD;
				if (j >= vals[i]) {
					sums[j] += sums[j-vals[i]];
					simple[j] += simple[j-vals[i]];
					simple[j] %= MOD;
				}
				sums[j] %= MOD;
			}
		}
		long all = 1;
		for (int i = 0; i < N; i++) {
			all *= 3;
			all %= MOD;
		}
		all -= 3 * (long)pots2[N];
		all+=3;
		int min = (total + 1) / 2;
		for (int i = min; i < total; i++) {
			all -= 3 * (long)(sums[i]-2*simple[i]);
		}
		all %= MOD;
		all += MOD;
		all %= MOD;
		out.println(all);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 24016
N = int(input())
human = []
for i in range(N):
    A = int(input())
    hatugen = {}
    for j in range(A):
        x, y = map(int, input().split())
        hatugen[x] = y
    human.append(hatugen)
    
cnt = 0
for i in range(2 ** N):
    is_ok = True
    for j in range(N):
        if (i >> j) & 1:
            for K, V in zip(human[j].keys(), human[j].values()):
                k = K - 1
                if V ^ ((i >> k) & 1):
                    is_ok = False
                    break
    if is_ok:
        cnt = max(cnt, bin(i).count('1'))

print(cnt)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

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

    for (int i = 1; i <= 11000; i++) {
        int t8 = i * 0.08, t10 = i * 0.1;
        if (t8 == a && t10 == b) {
            cout << i << endl;
            exit(0);
        }
    }
    cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
 
using namespace std;
 
int main() {
  int n, k; cin >> n >> k;
  vector<int> as(n, 0);
  for (auto& a : as) cin >> a;
  
  vector<int> dp(n, 0);
  dp[0] = 0;
  dp[1] = abs(as[1] - as[0]);
  for (int i = 2; i < n; i++) {
    dp[i] = dp[i - 1] + abs(as[i] - as[i - 1]);
    for (int j = 2; j <= min(k, i); j++) dp[i] = min(dp[i], dp[i - j] + abs(as[i] - as[i - j]));
  }
  cout << dp[n - 1] << endl;
}

Measured memory_bytes: 3984
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();

        long n = sc.nextLong();

        long ans = long.MaxValue;

        for (int i = 1; i <= n / i; i++)
        {
            if (n % i == 0) ans = Math.Min(ans, i + n / i - 2);
        }

        Console.WriteLine(ans);
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

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

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

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

    public int nextInt()
    {
        return int.Parse(next());
    }

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

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

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

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

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


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

#include <atcoder/math>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace atcoder;
using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    for (auto _ : irange(0L, n)) {
        int64_t n, m, a, b;
        cin >> n >> m >> a >> b;

        cout << floor_sum(n, m, a, b) << endl;
    }
}

Measured memory_bytes: 3576
N,K = map(int, raw_input().split())
a = map(int, raw_input().split())

A = B = 0
for i in range(K):
    A += a[i]
for i in range(K, N):
    B += max(a[i], 0)
ans = max(A+B, B)
for i in range(N-K):
    A += a[i+K]-a[i]
    B += max(a[i], 0) - max(a[i+K], 0)
    ans = max(ans, A+B, B)
print ans


Measured memory_bytes: 11316
#include<stdio.h>
int main(void){
  int x,y,z,i,cnt=0;
  scanf("%d %d %d",&x,&y,&z);
  for(i=0;i<=(x-z);i+=z){
    i+=y;
    cnt++;
  }
  printf("%d",cnt-1);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int


int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    int x = 0;
    repi(i, s){
        if(*i == 'I') 
            ++x;
        else
            --x;
        ans = max(ans, x);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n, m = list(map(int, input().split()))
data = []
for i in range(m):
    data.append([i + 1] + list(map(int, input().split())))
    #data[0::] = cityNumber,
    #data[:0:] = prefect,
    #data[::0] = year
data = sorted(data, key = lambda x: (x[1], x[2]))
#prefect => year
ans = [[0,0,0] for i in range(m)]
#ans[::0] = city Number
#ans[0::] = prefect
#ans[:0:] = ID

pre = data[0][1]
num = 0
for i in range(m):
    ans[i][0] = data[i][1] # prefect
    ans[i][2] = data[i][0] #cityNumber
    if pre == data[i][1]:
        num += 1
    else:
        num = 1
    ans[i][1] = num
    pre = data[i][1]
ans = sorted(ans, key = lambda x:x[2])
for i in range(m):
    print("{:0=6}{:0=6}".format(ans[i][0],ans[i][1]))


Measured memory_bytes: 39392
class int(int):  
  def times(self, callback):
    for times in range(0,self):
      callback()

class list(list):
  def maps(self, callback):
    return list(map(callback, self))

  def each(self, callback):
    list(map(callback, self))
    return self

  # index will sent to the function as a second parameter.
  def each_with_index(self,callback):
    list(map(callback, self, range(0,len(self))))
    return self

# Make sure you initialize object with class name.
# Ex: int(10).times, array = list([1,2,3,4,5])

target, length = input().split()
target = int(target)
length = int(length)
nums = list(input().split())

def convert(arg):
    return int(arg)
nums = nums.maps(convert)

for i in range(0,101):
  a = target - i
  if a not in nums:
    print(a)
    exit()

  b = target + i
  if b not in nums:
    print(b)
    exit()


Measured memory_bytes: 9236
n, w = map(int, input().split())
knap = [list(map(int, input().split())) for _ in range(n)]

dp = [[float('inf')] * (10**5+1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
    for j in range(10**5+1):
        if j - knap[i][1] >= 0:
            dp[i+1][j] = min(dp[i][j-knap[i][1]] + knap[i][0], dp[i][j])
        else :
            dp[i+1][j] = dp[i][j]
for i in range(10**5, 0, -1):
    if dp[n][i] <= w :
        print(i)
        exit()



Measured memory_bytes: 330688