akhauriyash/Code-Regression huggingface dataset:
def resolve():
    N = int(input())
    XY = []
    for i in range(N):
        A = int(input())
        xy = [list(map(int, input().split())) for _ in range(A)]
        XY.append(xy)
    
    ans = 0
    for _bits in range(1<<N):
        bits = list(map(int, bin(_bits)[2:].zfill(N)))
        unmatch = False
        for i in range(N):
            if bits[i] == 0:
                continue
            for x, y in XY[i]:
                if bits[x-1] != y:
                    unmatch = True
                    break
            if unmatch:
                break
        else:
            ans = max(ans, bin(_bits).count('1'))
    print(ans)



if '__main__' == __name__:
    resolve()

Measured memory_bytes: 9256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
#include <stdbool.h>
//#include <limits.h>
#include <math.h>

bool primeCheck(int m)
{
  bool b = true;
  int i;
  if (m == 1) return false;
  if (m == 2) return true;
  for (i = 2; i < sqrt((double)m); i++)
  {
    if (m % i != 0)
      continue;
    b = false;
    break;
  }
  if (m % i == 0)
    b = false;
  return b;
}

int main() {
  int x;
  scanf("%d", &x);
  while (!primeCheck(x)) x++;
  printf("%d\n", x);
  return 0;
}


Measured memory_bytes: 128
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(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 modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    string s,t;
    cin>>s>>t;
    ll n=s.length();
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]!=t[i])
            ans++;
    }
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 15640
#include <bits/stdc++.h>
#define REP(i,x,y) for(int i=(int)x;i<=(int)y;i++)
#define PER(i,x,y) for(int i=(int)x;i>=(int)y;i--)
#define FOR(i,x,y) for(int i=(int)x;i< (int)y;i++)
#define fi first
#define se second
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long LL;
typedef long double db;
typedef pair<int,int> PII;
const   int N=100005;
const   int P=1e9+7;


char s[N];
int main(){
	scanf("%s",s+1);
	FOR(i,1,strlen(s+1)){
		if(s[i]=='A'&&s[i+1]=='C'){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
    return 0;
}

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

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
template<typename T> void read_vec(vector<T>& v, size_t n);
void write();
template<typename First, typename... Rest> void write(First& first, Rest&... rest);
template<typename T> void write(vector<T>& v, size_t n, char divider);

int main(){
    ll N;
    read(N);
    vector<ll> d;
    read_vec(d, N);
    ll ans = 0;
    for(ll i = 0; i < N - 1; i++){
        for(ll j = i + 1; j < N; j++){
            ans += d[i] * d[j];
        }
    }
    write(ans);
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列として入力を受け取る
template<typename T>
void read_vec(vector<T>& v, size_t n){
    for(size_t i = 0; i < n; i++){
        T t;
        cin >> t;
        v.push_back(t);
    }
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First& first, Rest&... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write(vector<T>& v, size_t n, char divider){
    for(size_t i = 0; i < n; i++){
        cout << v[i] << divider;
    }
}
//

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	int s=0;
	int k2;

   
    if(n>=k)
    {
    
	  k2= n-k;	
      k=k*x;
      k2=k2*y;
      s=s+k+k2;
     
    }
    
    
    else
    {
    	
    	s=s+(n*x);
    	
    	
	}
    
    cout<<s<<endl;
	
	return 0;
	
}


Measured memory_bytes: 3596
package main

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

func solve() {
	n := getInt()
	permutation := make([]string, 0)
	var rec func(string, int)
	rec = func(s string, bit int) {
		if len(s) == n {
			permutation = append(permutation, s)
			return
		}

		for i := 0; i < n; i++ {
			if bit&(1<<uint(i)) > 0 {
				continue
			}
			ns := s + strconv.Itoa(i)
			nb := bit | (1 << uint(i))
			rec(ns, nb)
		}
	}
	rec("", 0)

	var p, q string
	for i := 0; i < n; i++ {
		p += strconv.Itoa(getInt() - 1)
	}
	for i := 0; i < n; i++ {
		q += strconv.Itoa(getInt() - 1)
	}
	var a, b int
	for i, s := range permutation {
		if s == p {
			a = i
		}
		if s == q {
			b = i
		}
	}
	ans := abs(a - b)
	fmt.Fprintln(wr, ans)
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 5248
#include <iostream>
#include <algorithm>

using namespace std;

bool check(string s) {
    for (int i = 1; i < s.size(); i++) {
        if (s[i] == s[i-1]) return false;
    }
    return true;
}

char reverse(char s) {
    return s == '0' ? '1' : '0';
}

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

    int cnt = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == (i % 2) + '0') {
            cnt++;
        }
    }
    cout << min(cnt, (int) (s.size() - cnt)) << endl;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

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

    int ans = 0;
    rep(i,N-2) {
        // if (S[i] == 'A' & S[i+1] == 'B' & S[i+2] == 'C') ++ans;
        if (S.substr(i, 3) == "ABC") ++ans;
    }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cctype>
using namespace std;
const int N=2e5;
int n,k,hea,tai;
bool arr[N*6+1],rev;
int main()
{
	scanf("%d%d",&n,&k);
	hea=n,tai=1;
	for(int i=1;i<=n;++i) {
		char c=getchar();
		while(!isalpha(c)) {
			c=getchar();
		}
		arr[i]=c=='A';
	}
	for(int i=1;(i<=n*5)&&(i<=k);++i) {
		if(arr[tai]^rev) {
			arr[tai]^=1;
		} else {
			arr[++hea]=arr[tai++];
			rev^=1;
		}
	}
	if(k>n*5) {
		k-=n*5;
		if(arr[tai]^rev) {
			putchar(k&1?'B':'A');
			for(int i=2;i<=n;++i) {
				putchar(i&1?'A':'B');
			}
		} else {
			for(int i=1;i<=n;++i) {
				putchar(i&1?'B':'A');
			}
		}
	} else {
		for(int i=tai;i<=hea;++i) {
			putchar(arr[i]^rev?'A':'B');
		}
	}
	putchar('\n');
	return 0;
}


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

typedef long long ll;

const int N = 55;
int a[N];
int n;
double res;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    res = a[0];
    for (int i = 1; i < n; ++i) {
        res = (res + a[i]) / 2;
    }
    cout << res << endl;

    return 0;
}



Measured memory_bytes: 3828
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	for(int i=1;i<=9;++i)
	for(int j=1;j<=9;++j)
		printf("%dx%d=%d\n",i,j,i*j);
}



}
int main() try{
	mainmain();
}
catch(...){}

Measured memory_bytes: 1092
using System;

namespace ITP1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c = 0;
            string[] num = Console.ReadLine().Split();

            a =int.Parse(num[0]);
            b = int.Parse(num[1]);
            c = int.Parse(num[2]);

            if(a<b&&b<c)
            {
                Console.WriteLine("Yes");
            }else
            {
                Console.WriteLine("No");
            }
        }
    }
}



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

int main(){
	long n;
	cin >> n;
  //vector<long> A;
	long A[n];
	long x;
	long B[n];
  B[0] = 0;
	for(long i = 1; i < n; i++){
      cin >> x;
      //A.push_back(x - 1);
      A[i] = x - 1;
      B[i] = 0;
    }
  
  
  for(long i = 1; i < n; i++){
      B[A[i]]++;
    }
	
  for(long i = 0; i < n; i++){
      printf("%ld\n", B[i]);
    }
    return 0;
}


Measured memory_bytes: 6876
#include<cstdio>
#include<algorithm>
int a[20][20],c[20],x,n,m,ans=0x7fffffff,t[20];
void dfs(int i,int cost){
    if(i==n+1){
        for(int i=1;i<=m;i++)if(t[i]<x)return;
        ans=std::min(ans,cost);return;
    }
    for(int j=1;j<=m;j++)t[j]+=a[i][j];
    dfs(i+1,cost+c[i]);
    for(int j=1;j<=m;j++)t[j]-=a[i][j];
    dfs(i+1,cost);
}
int main(){
    scanf("%d%d%d",&n,&m,&x);
    for(int i=1;i<=n;i++){
        scanf("%d",c+i);
        for(int j=1;j<=m;j++)scanf("%d",a[i]+j);
    }
    dfs(1,0);
    printf("%d\n",ans==0x7fffffff?-1:ans);
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;

using namespace std;

const ll MOD = 1000000007;

int main(){
    string s; cin >> s;
    int n = s.size();
    ll arr = 1; ll a = 0; ll ab = 0; ll abc = 0;

    for (int i = 0; i < n; i++){
        if (s[i] == 'A') a = (arr + a)%MOD;
        else if (s[i] == 'B') ab = (a + ab)%MOD;
        else if (s[i] == 'C') abc = (ab + abc)%MOD;
        else {
            abc = (ab + abc*3)%MOD;
            ab = (a + ab*3)%MOD;
            a = (arr + a*3)%MOD;
            arr = arr*3%MOD;
        }
    }

    cout << abc << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
	int n,k,x,y;
	scanf("%d %d %d %d",&n,&k,&x,&y);
	if (n > k) {
		n = k*x+(n-k)*y;
	} else {
		n = n*x;
	}
	printf("%d\n",n);
	return 0;
}


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

using namespace std;

int n, cnt;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	int a[n];
	for (int i=0; i<n; i++) {
		cin >> a[i];
		if (a[i] == cnt + 1) cnt++;
	}
	if (cnt) cout << n - cnt << endl;
	else cout << -1 << endl;
}

Measured memory_bytes: 1024
/*
頂点は0-indexedを想定
LCAに特化したHLD
構築にO(N)、クエリにO(logN) ダブリングより早い！！
depは根が1
参考:
https://ei1333.github.io/luzhiled/snippets/tree/heavy-light-decomposition.html
https://codeforces.com/blog/entry/53170
verify:
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C
*/

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

using Graph=vector<vector<int>>;

struct LCA{
    Graph g;
    vector<int> sz,head,par,in,dep;
    LCA(Graph &g):g(g),sz(g.size(),1),head(g.size()),par(g.size()),in(g.size()),dep(g.size()){}

    void dfs_sz(int idx,int p,int d){
        par[idx]=p;
        dep[idx]=d;
        if(g[idx].size() && g[idx][0]==p) swap(g[idx][0],g[idx].back());
        for(int &next:g[idx]){
            if(next==p) continue;
            dfs_sz(next,idx,d+1);
            sz[idx]+=sz[next];
            if(sz[g[idx][0]]<sz[next]) swap(g[idx][0],next);
        }
    }

    void dfs_hld(int idx,int p,int &times){
        in[idx]=times++;
        for(int next:g[idx]){
            if(next==p) continue;
            head[next]=(next==g[idx][0] ? head[idx]:next);
            dfs_hld(next,idx,times);
        }
    }
    //rootは根
    void build(int root){
        dfs_sz(root,-1,1);
        int times=0;
        dfs_hld(root,-1,times);
    }

    int lca(int u,int v){
        while(true){
            if(in[u]>in[v]) swap(u,v); //vの方を深くする
            if(head[u]==head[v]) return u;
            v=par[head[v]];
        }
    }
    //uとvの最短距離
    int dis(int u,int v){
        int p=lca(u,v);
        return dep[u]+dep[v]-dep[p]*2;

    }
};

signed main(){
    int N,Q;
    cin>>N;
    Graph g(N);
    for(int i=0;i<N;i++){
        int k;
        cin>>k;
        while(k--){
            int c;
            cin>>c;
            g[i].push_back(c);
            g[c].push_back(i);
        }
    }
    LCA lca(g);
    lca.build(0);
    cin>>Q;
    while(Q--){
        int x,y;
        cin>>x>>y;
        cout<<lca.lca(x,y)<<endl;
    }
}


Measured memory_bytes: 20184
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] arr = new long[3*n];
		for(int i = 0; i < 3*n; i++) {
			arr[i] = sc.nextLong();
		}
		Arrays.sort(arr);
		long count = 0L;
		for(int i = 0, k = n; i < n; i++,k++) {
			count += arr[k];
			k++;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 97944
n,h = map(int,input().split())
a = [0]*n
b = [0]*n
for i in range(n):
  a[i],b[i] = map(int,input().split())
a.sort()
b.sort()
b.reverse()
c = 0
for x in b:
  if x <= a[-1] or h <= 0:
    break
  h -= x
  c += 1
print(c+max(0,(h+a[-1]-1)//a[-1]))

Measured memory_bytes: 11312
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
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; }
 
int main()
{
    int h, w; cin >> h >> w;
    string s[h];
    vector<int> wallh[h], wallw[w];
    rep(i, h) cin >> s[i];

    rep(i, h) wallh[i].push_back(-1);
    rep(i, w) wallw[i].push_back(-1);
    rep(i, h) rep(j, w){
        if(s[i][j]=='#'){
            wallh[i].push_back(j);
            wallw[j].push_back(i);
        }
    }
    rep(i, h) wallh[i].push_back(w);
    rep(i, w) wallw[i].push_back(h);

    // rep(i, h) prvec(wallh[i]);
    // rep(i, w) prvec(wallw[i]);

    int ans = 0;
    rep(i, h) rep(j, w){
        if(s[i][j]=='#') continue;

        auto hp = upper_bound(ALL(wallh[i]), j);
        auto wp = upper_bound(ALL(wallw[j]), i);

        chmax(ans, *hp - *(hp-1) - 1 + *wp - *(wp-1) - 1 - 1);
    }
    pr(ans);
    return 0;}

Measured memory_bytes: 45216
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var n int
	fmt.Sscan(getNextLine(scanner), &n)
	aaa := make([]int, n)
	sum := 0
	for i := 0; i < n; i++ {
		fmt.Sscan(getNextLine(scanner), &aaa[i])
		sum += aaa[i]
	}
	dp1 := chokudai(3, sum, n, aaa)
	dp2 := chokudai(2, sum, n, aaa)
	ans := int64(0)
	for i := 0; i <= sum; i++ {
		ans += dp1[i]
		if sum%2 == 0 && i == sum/2 {
			ans += dp2[i] * 3
		}
		if i >= (sum+sum%2)/2 {
			ans -= 3 * dp1[i]
		}
		if ans < 0 {
			ans += 998244353
		}
		ans %= 998244353
	}
	fmt.Println(ans)
}

func chokudai(sp int, sum int, n int, aaa []int) []int64 {
	prev := 0
	current := 1
	fact := 1
	for i := sp - 1; i > 0; i-- {
		fact *= i
	}
	var dp [2][]int64
	dp[prev] = make([]int64, sum+1)
	dp[current] = make([]int64, sum+1)
	dp[prev][0] = 1
	dp[current][0] = 1
	for i := 0; i < n; i++ {
		for j := 0; j <= sum; j++ {
			dp[current][j] = dp[prev][j] * int64(fact)
			if aaa[i] <= j {
				dp[current][j] += dp[prev][j-aaa[i]]
			}
			dp[current][j] %= 998244353
		}
		prev, current = current, prev
	}
	return dp[prev]
}


Measured memory_bytes: 4352
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  string s;
  cin >> s;
  
  
  if(s[0]==s[1] && s[1]==s[2] || s[1]==s[2] && s[2]==s[3])
    cout << "Yes" << endl;
  
  else 
    cout << "No" << endl;


 return 0;
}

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

int main() {
  int N, M, C, ans = 0, sum;
  cin >> N >> M >> C;
  vector<int> B(M), A(M);
  for(int i = 0; i < M; i++) {
    cin >> B.at(i);
  }
  for(int i = 0; i < N; i++) {
    for(int i = 0; i < M; i++) {
      cin >> A.at(i);
    }
    for(int i = 0; i < M; i++) {
      sum += A.at(i) * B.at(i);
    }
    if(sum + C > 0)ans++;
    sum = 0;
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main(){

	int cards[4][13];

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 13; j++){
			cards[i][j] = 0;
		}
	}

	int n;
	cin >> n;
	char mark;
	int num;
	for (int i = 0; i < n; i++){
		cin >> mark >> num;
		if (mark == 'S'){
			cards[0][num-1] = 1;
		}
		else if (mark == 'H'){
			cards[1][num-1] = 1;
		}
		else if (mark == 'C'){
			cards[2][num-1] = 1;
		}
		else if (mark == 'D'){
			cards[3][num-1] = 1;
		}
	}

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 13; j++){
			if (cards[i][j] == 0){
				if (i == 0){
					cout << 'S' << " ";
				}
				else if (i == 1){
					cout << 'H' << " ";
				}
				else if (i == 2){
					cout << 'C' << " ";
				}
				else if (i == 3){
					cout << 'D' << " ";
				}
				cout << j+1 << endl;
			}
		}
	}

}

Measured memory_bytes: 1164
N, M = map(int, input().split())
ac = [0] * N
wa = [0] * N

WA = 0

for i in range(M):
    p, s = input().split()
    p = int(p) - 1

    if ac[p] == 0 and s == 'AC':
        ac[p] = 1
        WA += wa[p]

    wa[p] += 1

print(sum(ac), WA)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

void solve(int test_case) {
	string s;
	cin>>s;
	int cnt=0;
	for(int i=1;i<s.length();i++) {
		if(s[i]!=s[i-1])cnt++;
	}
	cout<<cnt;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
}	


Measured memory_bytes: 3684
#include<iostream>
#include<string>
using namespace std;
string S, T; bool ok = false;
int main() {
	while (cin >> S) {
		T = "";
		for (int i = 0; i < S.size(); i++) {
			if (S[i] == '.' || S[i] == ',') {

			}
			else {
				T += S[i];
			}
		}
		S = T;
		if (S.size() >= 3 && S.size() <= 6) {
			if (ok == true) { cout << ' '; }
			cout << S;
			ok = true;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1180
///////////////////// author : TrEbLeCleF /////////////////////
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define For(i, a) for (int i=0; i<(a); i++)
#define FORR(i,a,b) for (int i = (b)-1; i >= a; i--)
#define Forr(i,a) for (int i = (a)-1; i >= 0; i--)
/////////////////////////// ..... ///////////////////////////
#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__) 
void DBG() { cerr << "]\n";}
template<typename T, typename ...Args> void DBG(T first, Args... args){
cerr << first; if(sizeof...(args))cerr<<", "; DBG(args...); }
/////////////////////////// ..... ///////////////////////////
#define int ll
#define pb(x) push_back(x)
#define print(v,s,e) for(int i = s; i < e; i++)cout << v[i]<<" ";cout<<"\n";
#define INF 1e17
#define PI 3.14159265358979323846 
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
/////////////////////////// GLOBAL ///////////////////////////


/////////////////////////// GLOBAL ///////////////////////////
void solve(){
	int a,b,c,k; cin >> a >>b >> c >> k;
	while(b <= a){
		b *= 2;
		--k;
	}
	while(c <= b){
		c *= 2;
		--k;
	}
	cout << (k>=0?"Yes\n":"No\n");
}

int32_t main(){ 
	#ifndef ONLINE_JUDGE
		clock_t tStart = clock();
		freopen("TC", "r", stdin);
		//freopen("output.txt","w",stdout);
	#endif 
    ios_base:: sync_with_stdio(false); 
   	cin.tie(0); 
	int t=1;
	//cin >> t;
	for(int tt=1;tt<=t;tt++){
		//cout << "Case #"<<tt<<": ";
		solve();
	}
	#ifndef ONLINE_JUDGE
    	cerr << "\nRun Time -> "<<(double)(clock()-tStart)/CLOCKS_PER_SEC <<" sec\n";
    #endif
}

Measured memory_bytes: 3604
using namespace std;
#include <vector>
#include <cstdio>
#include <cmath>

int main(){
  int N, h0, h1, h2, v0, v1, v2;
  scanf("%d %d %d", &N, &h0, &h1);
  v0 = 0; v1 = abs(h1-h0);
  for(int i=2; i<N; i++){
    scanf("%d", &h2);
    v2 = min(v0+abs(h2-h0), v1+abs(h2-h1));
    v0 = v1; v1 = v2; h0 = h1; h1 = h2;
  }
  printf("%d\n", v1);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){
    int x,y,temp,i=1;
    while(1){
        scanf("%d %d",&x,&y);
        if(x==0&&y==0){
            break;
        }
        if(x>y){
            temp=x;
            x=y;
            y=temp;
        }
        printf("%d %d\n",x,y);
    }
    
    return 0;
}


Measured memory_bytes: 2692
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		while(in.hasNext()){
			long x = in.nextLong();
			long y = in.nextLong();
			long mx=x,my=y;
			while(y!=0){
				x = x%y;
				long test=x;
				x = y;
				y = test;
			}
			System.out.println(x+" "+(mx/x*my));
		}
	}
}

Measured memory_bytes: 17216
import java.util.Scanner;

public class Main{
    public static void main(String args[]){

    Scanner scan = new Scanner(System.in);

    int n = scan.nextInt();
    
    int v = n % 10;

    if (v == 2 || v == 4 || v== 5 || v == 7 || v == 9 ) {
        System.out.println("hon");
    } else if (v == 0 || v == 1 || v == 6 || v == 8 ) {
        System.out.println("pon");

    } else {
        System.out.println("bon");
    }

    
    



    
 

    //System.out.println();
    

    
    
        
    
      


      scan.close();
    }
  }

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

struct edge { int to,cost; };

int main() {
  int K,S;cin>>K>>S;

  int ans = 0;
  REP(x,K+1)REP(y,K+1) {
    int z = S-x-y;
    if (z<0 || z>K) continue;
    ans++;
  }

  OUT(ans);

  return 0;
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int,input().split()))
dp = [0] * 110000
for i in range(1,N):
  if i == 1:
    dp[i] = dp[i-1]+abs(h[i-1]-h[i])
  else:
    dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
print(dp[N-1])

Measured memory_bytes: 13976
fn main() {
	use std::io::Read;
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let m: usize = s.next().unwrap().parse().unwrap();
	let mut edges = vec![vec![]; n * 3];
	for _ in 0..m {
		let u = (s.next().unwrap().parse::<usize>().unwrap() - 1) * 3;
		let v = (s.next().unwrap().parse::<usize>().unwrap() - 1) * 3;
		edges[u].push(v + 1);
		edges[u + 1].push(v + 2);
		edges[u + 2].push(v);
	}
	let src = (s.next().unwrap().parse::<usize>().unwrap() - 1) * 3;
	let dst = (s.next().unwrap().parse::<usize>().unwrap() - 1) * 3;
	let mut dist = vec![std::i32::MAX; n * 3];
	dist[src] = 0;
	let mut q = std::collections::BinaryHeap::new();
	q.push((0, src));
	while let Some((cost, v)) = q.pop() {
		let cost = -cost;
		if cost > dist[v] {
			continue;
		}
		for &e in edges[v].iter() {
			let next_cost = cost + 1;
			if next_cost < dist[e] {
				dist[e] = next_cost;
				q.push((-next_cost, e));
			}
		}
	}
	if dist[dst] == std::i32::MAX {
		println!("-1");
	} else {
		println!("{}", dist[dst] / 3);
	}
}


Measured memory_bytes: 24956
#pragma GCC optimize("Ofast", "unroll-loops", "no-stack-protector")
#include <bits/stdc++.h>
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define mem(x, y) memset((x), (y), sizeof(x))
#define loli ios::sync_with_stdio(0), cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename Ta, typename Tb>istream &operator>>(istream &in, pair<Ta, Tb> &p){ return in >> p.F >> p.S; }
template<typename Ta, typename Tb>ostream &operator<<(ostream &out, pair<Ta, Tb> &p){ return out << p.F << " " << p.S; }
template<typename T>void arr_print(T a, T b){ T i = a; for(cout << *i++; i != b; i++) cout << " " << *i; cout << "\n"; }
template<typename T>ostream &print(T a){ return cout << a << "\n"; }
template<typename T, typename... Args>ostream &print(T a, Args ...args){ cout << a << " "; return print(args...); }

//--------------------Main Code--------------------

const ll MOD = 1000000007;

vector<ll> negs;
vector<ll> poss;

int main() {loli
	ll n, k, x, prod = 1, i, j;
	cin >> n >> k;
	for(i = 0; i < n; i++){
		cin >> x;
		if(x >= 0)
			poss.pb(x);
		else
			negs.pb(x);
	}
	if(k & 1 && poss.empty()){
		sort(negs.begin(), negs.end(), greater<ll>());
		for(int i = 0; i < k; i++)
			prod = prod * negs[i] % MOD;
	}
	else{
		sort(poss.begin(), poss.end(), greater<ll>());
		sort(negs.begin(), negs.end());
		for(i = j = 0; i < poss.size() && j < negs.size() && i + j < k;){
			if(poss[i] >= abs(negs[j]))
				i++;
			else
				j++;
		}
		for(; i < poss.size() && i + j < k; i++);
		for(; j < negs.size() && i + j < k; j++);
		if(j & 1){
			if(i > 0 && j > 0 && i < poss.size() && j < negs.size())
				if(poss[i] * poss[i - 1] > negs[j] * negs[j - 1])
					i++, j--;
				else
					i--, j++;
			else if(i > 0 && j < negs.size())
				i--, j++;
			else if(j > 0 && i < poss.size())
				i++, j--;
		}
		for(int k = 0; k < i; k++)
			prod = prod * poss[k] % MOD;
		for(int k = 0; k < j; k++)
			prod = prod * negs[k] % MOD;
	}
	cout << (prod + MOD) % MOD << "\n";
}

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

int num[4],
    kaisuu,
    ans;
    
int main(void){
    cin >> num[0] >> num[1] >> num[2] >> kaisuu;
    
    sort(num, num+3);
    
    while(kaisuu > 0){
        num[2] *= 2;
        kaisuu --;
    }
    
    ans = num[0] + num[1] + num[2];
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x[1000],b,ans=1000000000,ans1=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	for(int i=1;i<=100;i++){
		for(int j=0;j<n;j++){
			ans1+=(x[j]-i)*(x[j]-i);
		}
		ans=min(ans,ans1);
		ans1=0;
	}
	cout<<ans<<endl;
  return(0);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args){
		Main myMain = new Main();
		BufferedReader reader = 
				new BufferedReader(new InputStreamReader(System.in));
		
		String str;
		
		try{
		while(!((str = reader.readLine()).equals("END OF INPUT"))){
			String[] st = str.split(" ",0);
			
			System.out.println(myMain.Length(st));
		}
		reader.close();
		}catch(IOException e){
		}
	}
	
	public String Length(String[] str){
		String length = "";
		
		for(int i = 0; i < str.length; i++){
			length += String.valueOf(str[i].length());
		}
		
		return length;
	}
	
}

Measured memory_bytes: 16932
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])

def check_even(A, B):
    odd_flag=0
    while odd_flag!=1:
        for i, num in enumerate(A):
            if num%2 == 1:
                odd_flag=1
                break
            elif i==len(A)-1:
                A=A/2
                B+=1
    return B

def main():
    print(check_even(A, 0))

if __name__ == '__main__':
    main()

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

const int maxN = 100;

int n;
char sol[2*maxN];

string ask(vector<int> &v){
    cout << "? ";
    for(int i = 0; i < n; i++){
        cout << v[i] << " ";
    }
    cout<<endl;

    string res;
    cin >> res;
    return res;
}

int findPos(vector<int>&asking){
    for(int i = 0; i < n; i++){
        asking[i] = i+1;
    }

    string firstHalf=ask(asking);

    int st=1;
    int dr=n;
    int pos = -1;
    while(st <= dr){
        int mij = (st+dr)/2;
        asking.clear();
        for(int i = 0; i < n; i++){
            asking[i] = mij + i+1;
        }
        string res = ask(asking);
        if(res != firstHalf){
            pos = mij;
            dr = mij-1;
        } else {
            st = mij+1;
        }
    }

    if(firstHalf=="Red"){
        sol[pos]='R';
        sol[pos+n]='B';
    } else {
        sol[pos]='B';
        sol[pos+n]='R';
    }
    
    return pos;
}

void getOutside(int pos,vector<int>&outside){
    for(int i=1;i<pos;i++){
        outside.push_back(i);
    }
    for(int i=pos+n+1;i<=2*n;i++){
        outside.push_back(i);
    }

    int cntRed=0;
    int cntBlue=0;
    for(int i=0;i<(int)outside.size();i++){
        if(sol[outside[i]]=='R'){
            cntRed++;
        } else {
            cntBlue++;
        }
    }

    for(int i=0;i<(int)outside.size();i++){
        if(cntBlue>cntRed && sol[outside[i]]=='B'){
            outside.erase(outside.begin()+i);
            break;
        }
        if(cntRed>cntBlue && sol[outside[i]]=='R'){
            outside.erase(outside.begin()+i);
            break;
        }
    }
}

int main(){
    cin >> n;
    vector<int> asking(n);

    //se schimba intre pos si pos + 1
    //pos e firstHalf, pos+n e nonFirstHalf
    //pos+1 .. pos+n-1

    int pos=findPos(asking);

    for(int i = 1; i < pos; i++){
        asking.clear();
        for(int j = 0; j < n-1; j++){
            asking[j] = pos+j+1;
        }
        asking[n-1]=i;
        string res=ask(asking);
        if(res=="Red"){
            sol[i] = 'R';
        } else {
            sol[i] = 'B';
        }
    }

    for(int i = pos+n+1; i <= 2*n; i++){
        asking.clear();
        for(int j = 0; j < n-1; j++){
            asking[j]=pos+j+1;
        }
        asking[n-1]=i;
        
        string res=ask(asking);
        if(res=="Red"){
            sol[i] = 'R';
        } else {
            sol[i] = 'B';
        }
    }

    vector<int> outside;
    getOutside(pos,outside);

    asking.clear();
    for(int i=0;i<(int)outside.size();i++){
        asking[i]=outside[i];
    }
    for(int i=pos+1;i<pos+n;i++){
        asking[n-1]=i;
        string res=ask(asking);
        if(res=="Red"){
            sol[i]='R';
        } else {
            sol[i]='B';
        }
    }

    cout<<"! ";
    sol[2*n+1]=0;

    cout<<(sol+1)<<endl;
    fflush(stdout);

    return 0;
}

Measured memory_bytes: 724
#include<bits/stdc++.h>
using namespace std;
int n;
int a[25],b[25],c[25];
int s=0;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	   cin>>a[i];
	for(int i=1;i<=n;i++)
	   cin>>b[i];
	for(int i=1;i<n;i++)
	   cin>>c[i];
	   
	s=s+b[a[1]];
	for(int i=2;i<=n;i++)
	{
		s=s+b[a[i]];
		if(a[i]==a[i-1]+1)
		  s=s+c[a[i-1]];
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e7+1000;
typedef long long ll;
int cnt=0;
bool vis[maxn];
int pri[maxn];
int f[maxn];
int p[maxn];
ll sum[maxn];
void init(){
    for(int i=1;i<maxn;i++)f[i]=1;
    cnt=0;
    for(int i=2;i<maxn;i++){
        if(vis[i]==0){
            pri[++cnt]=i;
            f[i]=2;
        }
        for(int j=1;j<=cnt&&pri[j]*i<maxn;j++){
            vis[i*pri[j]]=1;
            if(i%pri[j]==0){
                f[i*pri[j]]=f[i]/2;
                break;
            }
            f[i*pri[j]]=f[i]*2;
        }
    }
    int k=0;
    for(int i=1;i<=cnt;i++){
        if(pri[i]*pri[i]*pri[i]>=maxn) break;
        p[++k]=pri[i]*pri[i]*pri[i];
    }
    for(int i=1;i<maxn;i++){
        for(int j=1;j<=k&&p[j]*i<maxn;j++){
            f[i*p[j]]=0;
            if(i%p[j]==0){
                break;
            }
        }
    }
    for(int i=1;i<maxn;i++){
        sum[i]=sum[i-1]+f[i];
    }
}
const double pi=acos(-1.0);
int main(){
	int k;
	int x1,y1,x2,y2;
	int x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2;
	int x0; int y0;
	x0=x1-x2;
	y0=y1-y2;
	x3=y0;
	y3=-x0;
//	cout<<x0<<" "<<y0<<endl;
//	cout<<x3+x2<<" "<<y3+y2<<endl;
	x0=-x0;
	y0=-y0;
	x4=-y0;
	y4=x0;
	cout<<x3+x2<<" "<<y3+y2<<" "<<x4+x1<<" "<<y4+y1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
 
int main() {

    int n;
    cin >> n;
    vector<int> x(n);
    rep(i,n)    cin>>x[i];

    int sum=0;
    int ans=100000000;
    rep(i,100) {
        rep(j,n) {
            sum+=((x[j]-(i+1))*(x[j]-(i+1)));
        }
        ans=min(ans,sum);
        sum=0;
    }

    cout<<ans<<endl;
    

 return 0;
}

Measured memory_bytes: 256
# from collections import deque
n, q = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
c = [0]*n
for _ in range(q):
    p, x = map(int, input().split())
    c[p-1] += x
used = [0]*n
used[0] = 1
next = [0]
while next:
    v = next.pop()
    cost = c[v]
    for nv in g[v]:
        if used[nv]:
            continue
        used[nv] = 1
        c[nv] += cost
        next.append(nv)

print(*c)

Measured memory_bytes: 55856
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int r;

int main() {
	cin >> r;
	cout << r*r << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a[] = new int[3];
		for (int i = 0; i < 3; i++) {
			a[i] = sc.nextInt();
		}
Arrays.sort(a);
int ans=0;

ans+=a[2]-a[1];
a[0]+=a[2]-a[1];
ans+=(a[2]-a[0])/2;
if((a[2]-a[0])%2==1){
ans+=2;
}
System.out.println(ans);
	}
}

Measured memory_bytes: 23764
#include <array>
#include <iostream>
#include <regex>
#include <string>
using namespace std;

int main() {
  string s;
  cin >> s;
  regex re_0("^keyence.*");
  regex re_1("^k.*eyence$");
  regex re_2("^ke.*yence$");
  regex re_3("^key.*ence$");
  regex re_4("^keye.*nce$");
  regex re_5("^keyen.*ce$");
  regex re_6("^keyenc.*e$");
  regex re_7(".*keyence$");
  smatch match;
  array<regex, 8> res{re_0, re_1, re_2, re_3, re_4, re_5, re_6, re_7};
  for (auto re : res) {
    if (regex_match(s, match, re)) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A, B; cin >> A >> B;
    for (int i = 0; i <= 2000; i++)
    {
        if(i * 8 / 100 == A && i / 10 == B) {
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long[] A=new long[N];
		long min=100000000;
		int mincount=0;
		for(int i=0;i<N;i++) {
			A[i]=sc.nextLong();
			if(A[i]<0) {
				mincount++;
			}
			if(Math.abs(A[i])<min) {
				min=Math.abs(A[i]);
			}
		}
		
		long sum=0;
		for(int i=0;i<N;i++) {
				sum+=Math.abs(A[i]);
		}
		if(mincount%2!=0) {
			sum-=2*min;
		}
		
		System.out.println(sum);
	}

}


Measured memory_bytes: 59592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >> n;
  vector<ll> a(n*3);
  for(int i = 0;i < n*3;i++)cin >> a[i];
  ll res = -1 * pow(10,18);
  ll nowf = 0;
  ll nowe = 0;
  priority_queue<ll> f;
  priority_queue<ll> e;
  vector<ll> maxf(n+1);
  vector<ll> maxe(n+1);
  
  for(int i = 0;i < n;i++){//前処理
    f.push(a[i] * -1);
    nowf += a[i];
  }
  maxf[0] = nowf;
  for(int i = 0;i < n;i++){
    nowf += a[i + n];
    f.push(a[i + n] * -1);
    nowf -= f.top() * -1;
    f.pop();
    maxf[i + 1] = nowf;
  }
  
  for(int i = 0;i < n;i++){//前処理
    e.push(a[3*n - i - 1]);
    nowe += a[3*n - i - 1];
  }
  maxe[n] = nowe;
  for(int i = 0;i < n;i++){
    nowe += a[2*n - i - 1];
    e.push(a[2*n - i - 1]);
    nowe -= e.top();
    e.pop();
    maxe[n - i - 1] = nowe;
  }
  
  for(int i = 0;i < n + 1;i++){
    res = max(res,maxf[i] - maxe[i]);
    //cout << maxf[i] << " " << maxe[i] << endl;
  }
  cout << res << endl;
}

Measured memory_bytes: 9544
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

void dfs(const ll& x, const ll& y, vector<vector<bool>>& grid, const ll& h, const ll & w) {
	grid[x][y] = false;
	for (ll dx = -1; dx <= 1; dx++) {
		for (ll dy = -1; dy <= 1; dy++) {
			ll nextx = x + dx;
			ll nexty = y + dy;
			if (0 <= nextx && nextx < h && 0 <= nexty && nexty < w && grid[nextx][nexty] == true) {
				dfs(nextx, nexty, grid, h, w);
			}
		}
	}
}

int main() {
	while (true) {
		ll w, h;
		cin >> w >> h;
		if (w == 0 && h == 0) {
			break;
		}
		vector<vector<bool>> grid(h);
		for (ll i = 0; i < h; i++) {
			grid[i].resize(w);
			for (ll j = 0; j < w; j++) {
				ll tmp;
				cin >> tmp;
				grid[i][j] = (tmp == 1 ? true : false);
			}
		}
		ll ans = 0;
		for (ll i = 0; i < h; i++) {
			for (ll j = 0; j < w; j++) {
				if (grid[i][j] == true) {
					ans++;
					dfs(i, j, grid, h, w);
				}
			}
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 3224
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>

using namespace std;

int main(void) {
	long long n, m, d;
	double ans;

	scanf("%lld %lld %lld", &n, &m, &d);

	if (d > 0) {
		ans = (2 * (double)(n - d)*(m - 1)) / (n*n);
	}
	else {
		ans = ((double)(n - d)*(m - 1)) / (n*n);
	}
	printf("%f\n", ans);

	return 0;
}









Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
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; }

unsigned long long digit_sum(unsigned long long n){
   if(n < 10)  return n;
   return digit_sum(n/10) + n%10;
}

int main()
{
    string s;
    cin >> s;
    ll sum = 0;
    rep(i, s.size())
    {
        sum += (s[i]-'0');
    }
    if(sum%9 ==0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    // unsigned long long N;
    // cin >> N;
    // unsigned long long x = digit_sum(N);
    // //cout << x << endl;
    // if((x%9) == 0)
    // {
    //     cout << "Yes" << endl;
    // }
    // else
    // {
    //     cout << "No" << endl;
    // }
    
    return 0;
}

Measured memory_bytes: 3748
// 有點不耐煩會破壞偉大的計劃

#include <bits/stdc++.h>

#define append push_back

using namespace std;
using ll = long long;

const int N = 1e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 1e-9, PI = acos(-1);
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};

void debug() {
	cerr << "\n";
}
template<typename Type1, typename... Type2>
void debug(Type1 a, Type2... b) {
    cerr << a << " ";
    debug(b...);
}

int main() {
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    long long n, m, x; cin >> n >> m >> x;

    vector<long long> a(n + 1);

    for(long long i = 0; i < m; i++) {
        long long pos; cin >> pos;
        a[pos]++;
    }

    long long ans1 = 0, ans2 = 0;
    for(long long i = x; i >= 0; i--){
        ans1 += a[i];
    }
    for(long long i = x; i <= n; i++){
        ans2 += a[i];
    }

    cout << min(ans1, ans2);

    return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

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

const ll INF = 1e10;
const ll MOD = 1e9 + 7;



int main(){
	ll N;
	vll X, Y;
	cin >> N;
	ll i, j;
	for (i = 0; i < N; i++){
		ll x;
		cin >> x;
		X.push_back(x);
		Y.push_back(x);
	}
	
	sort(Y.begin(), Y.end());

	ll d, u;
	d = Y[N / 2 - 1];
	u = Y[N / 2];

	for (i = 0; i < N; i++){
		if (X[i] < u){
			cout << u << endl;
		}
		else{
			cout << d << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 5476
while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    if op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)
    else:
        break


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b,p[100];
    cin>>n;
    cin>>a>>b;
    int ac=0,bc=0,cc=0;
    for(int i=0;i<n;i++){
        cin>>p[i];
        if(p[i]<=a){
            ac++;
        }
        else if(p[i]>b){
            cc++;
        }
        else {
            bc++;
        }
    }
    cout<<min(ac,min(bc,cc))<<endl;
}
//＼(^q^)／ｵﾜﾀ


Measured memory_bytes: 256
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int n; cin >> n;
    int x=n;
    int res=0;
    int d=log10(n)+1;
    rep(i,d){
        res+=x%10;
        x/=10;
    }
    if(n%res==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm> 
using namespace std;
int main(){
	int a,b,c,d,sum=0;
	cin>>a>>b>>c>>d;
	if(a>=b) sum+=b;
	else sum+=a;
	if(c>=d) sum+=d;
	else sum+=c;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256