akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
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; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}

/* main */
int n, m;
vec<vi> edges(100010);

void in(){
    cin >> n >> m;
    rep(i,0, n - 1 + m){
        int f, t; cin >> f >> t;
        f--; t--;
        edges[t].push_back(f);
    }

}



vi parent(100010, -1);
vi distan(100010, -1);
vec<bool> visited(100010, false);

int dfs(int v){

    if(sz(edges[v]) == 0){
        parent[v] = -1;
        return 0;
    }

    if(visited[v]) return distan[v];

    visited[v] = true;

    int par = -1;
    int dist = -1;

    rep(i,0,sz(edges[v])){
        int nxt = edges[v][i];
        int d = 1 + dfs(nxt);

        if(dist < d){
            par = nxt;
            dist = d;
        }
    }
    
    parent[v] = par;
    distan[v] = dist;
    return dist;

}


void solve(){

    rep(i,0,n){
        dfs(i);
    }

    rep(i,0,n){
        cout << parent[i] + 1 << (i == n - 1 ? "" : " "); 
    }
    cout << endl;

}


signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 11904
import sys
input = sys.stdin.readline

N,X=map(int,input().split())

num = [0]*N
pnum = [0]*N
num[0] = 1
pnum[0] = 1
for i in range(1,N):
    num[i] = 2*num[i-1]+3
    pnum[i] = 2*pnum[i-1]+1

position = [0]*(N+1)
position[N] = X
for i in reversed(range(1,N+1)):
    if num[i-1]+2 < position[i]:
        position[i-1] = position[i] -num[i-1]-2
    else:
        if position[i]-1 < 1: break
        position[i-1] = position[i]-1
        

dp = [0]*(N+1)
dp[0] = 1
for i in range(1,N+1):
    if position[i] == 0 or position[i] == 1: continue
    if position[i] < num[i-1]+2:
        dp[i] = dp[i-1]
    elif position[i] == num[i-1]+2:
        dp[i] = pnum[i-1] + 1
    else:
        dp[i] = dp[i-1] + pnum[i-1] + 1
#print(pnum)
#print(position)
print(dp[N])
    



Measured memory_bytes: 3064
N = int(input())
H = [int(i) for i in input().split()]

res = 0
cur_cnt = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    cur_cnt += 1
  else:
    cur_cnt = 0
  
  if cur_cnt > res:
      res = cur_cnt

print(res)


Measured memory_bytes: 14252
//
    //AtCoder Beginner Contest 136
    //C - Build Stairs
    //

    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <iomanip>
    #include <cmath>
    #include <ctime>
    #include <queue>
    #include <map>
    #include <set>
    #include <tuple>
    #include <functional>
    #include <cassert>

    using namespace std;

    #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
    #define REPD(i,n) for(ll i=n-1;i>=0;i--)
    #define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
    #define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
    #define ALL(x) (x).begin(),(x).end()
    #define RALL(x) (x).rbegin(),(x).rend()
    #define SIZE(x) (int)(x).size()
    #define SIZEL(x) (ll)(x).size()
    #define MSG(a) cout << #a << " " << a << endl;

    using ll = long long;
    using ld = long double;

    const double PI = 3.14159265358979323846;

    ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
    ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

        vector<ll> h(n);
        REP(i, n) cin >> h[i];

        string ans = "Yes";

        ll maxH = h[0];
        FOR(i, 1, n-1){
            if (maxH == h[i]) continue;
            if (maxH == h[i]-1) continue;
            
            if (maxH < h[i]) maxH = h[i]-1;
            else {
                ans = "No"; 
                break;
            }
        }
        cout << ans << endl;

        return 0;
    }


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
vector<int> no;
int an[1000100],n,x,y;
int co(int x){int y=0;while(x){y+=x%2;x/=2;}return y;}
void getans(int be,int l,int r,vector<int> x){
	if (x.size()==0){an[be]=l;return ;}
	int sum=0,p=l,g=0;
	vector<int> y;
	y.clear();
	for (int i=0;i<x.size();i++){
		if ((l&(1<<x[i]))!=(r&(1<<x[i]))){
			sum++;
			if (sum%2==0) p=p^(1<<(x[i]));
			if (sum!=1)y.push_back(x[i]);
			else g=x[i];
		}else y.push_back(x[i]);
	}
	if (y.size()>=1&&sum%4==1)p=p^(1<<y[0]);
	getans(be,l,p,y);
	getans(be+(1<<(y.size())),p^(1<<g),r,y);
}
int main(){
	read(n);read(x);read(y);
	for (int i=0;i<n;i++)no.push_back(i);
	if (!(co(y^x)%2)) puts("NO");
	else{
		puts("YES");
		getans(0,x,y,no);
		for (int i=0;i<(1<<n);i++) cout<<an[i]<<' ';cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1664
#include<stdio.h>
#define N 8
#define F -1
#define NF 1

void init(void);
void print(void);
void rec(int);

int row[N],col[N],dp[2*N-1],dn[2*N-1],A[N][N];

int main(){
  int i,j,k,a,b;

  init();

  for(i = 0;i < N;i++){
    for(j = 0;j < N;j++){
      A[i][j] = 0;
    }
  }

  scanf("%d",&k);

  for(i = 0;i < k;i++){
    scanf("%d%d",&a,&b);
    A[a][b] = 1;
  }

  rec(0);

  return 0;
}

void init(void){
  int i;

  for(i = 0;i < N;i++){
    row[i] = F;
    col[i] = F;
  }

  for(i = 0;i < 2*N-1;i++){
    dp[i] = F;
    dn[i] = F;
  }
}

void print(void){
  int i,j;

  for(i = 0;i < N;i++){
    for(j = 0;j < N;j++){
      if(A[i][j]){
	if(row[i] != j){
	  return;
	}
      }
    }
  }

  for(i = 0;i < N;i++){
    for(j = 0;j < N;j++){
      if(row[i] == j){
	printf("Q");
      } else {
	printf(".");
      }
    }
    printf("\n");
  }
}

void rec(int i){
  int j;
  if(i == N){
    print();
    return;
  }

  for(j = 0;j < N;j++){
    if(col[j] == NF || dp[i + j] == NF || dn[i - j + N - 1] == NF){
      continue;
    }
    row[i] = j;
    col[j] = NF;
    dp[i + j] = NF;
    dn[i - j + N -1] = NF;
    rec(i + 1);
    row[i] = F;
    col[j] = F;
    dp[i + j] = F;
    dn[i - j + N - 1] = F;
  }
  
}



Measured memory_bytes: 2104
using System;

namespace _0644
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] sum = new int[n + 1];
			for (int i = 0; i < n; i++)
			{
				sum[i + 1] = sum[i] + int.Parse(Console.ReadLine());
			}
			int[,] dp = new int[n + 1, 50001];//value is max length
			for (int i = 1; i <= 50000; i++) dp[0, i] = 1145141919;
			for (int i = 1; i <= n; i++)
			{
				for (int j = 0; j <= 50000; j++) dp[i, j] = 1145141919;
				dp[i, sum[i]] = sum[i];
				for (int j = i - 1; j >= 0; j--)
				{
					int len = sum[i] - sum[j];
					for (int k = 0; k <= 50000; k++)
					{
						dp[i, Math.Min(k, len)] = Math.Min(dp[i, Math.Min(k, len)], Math.Max(dp[j, k], len));
					}
				}
			}
			int ret = int.MaxValue;
			for (int i = 0; i < sum[n]; i++) ret = Math.Min(ret, dp[n, i] - i);
			Console.WriteLine(ret);
		}
	}
}


Measured memory_bytes: 27396
using System;
using System.Collections.Generic;
using System.Linq;

namespace B {
    class Program {
        static void Main (string[] args) {
            var NMC = Console.ReadLine ().Split (' ').Select (c => int.Parse (c)).ToList ();
            var N = NMC[0];
            var M = NMC[1];
            var C = NMC[2];
            var BMs = Console.ReadLine ().Split (' ').Select (c => int.Parse (c)).ToList ();
            var ANss = Enumerable.Range (0, N).Select (_ => Console.ReadLine ().Split (' ').Select (c => int.Parse (c)).ToList ()).ToList ();

            var sol = ANss.Select (ANs => Enumerable.Range (0, M).Select (k => ANs[k] * BMs[k]).Sum () + C).Where (sum => sum > 0).Count ();
            Console.WriteLine (sol);
        }
    }
}

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

using namespace std;

int main()
{
	int new_start, new_end;
	int no;

	cin >> new_start >> new_end;
	cin >> no;
	
	for (int i = 0; i < no; i++)
	{
		int started, ended;
		cin >> started >> ended;
		
		if (new_end > started && new_start < ended)
		{
			cout << 1 << endl;
			return 0;
		}
	}

	cout << 0 << endl;
}


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

class UniFind
{
public :
    map<string,string> par;
    map<string,int> cost;

    string find (string x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = find(par[x]);
        }
    }

    void uni (string x, string y) {
        x = find(x);
        y = find(y);

        if (cost[x] < cost[y]) {
            par[y] = x;
        } else {
            par[x] = y;
        }
    }

    bool same (string x, string y) {
        return (find(x) == find(y));
    }

    int sum (string x) {
        return cost[find(par[x])];
    }
};

int main ()
{
    UniFind p;

    int n; cin >> n;
    vector<string> v(n);
    for (int i = 0; i < n; i++) {
        int c;
        cin >> v[i] >> c;
        p.par[v[i]] = v[i];
        p.cost[v[i]] = c;
    }

    int m; cin >> m;
    for (int i = 0; i < m; i++) {
        string s1, s2;
        cin >> s1 >> s2;

        string f1 = p.find(s1), f2 = p.find(s2);
        p.uni(f1, f2);
    }

    long long res = 0;
    for (int i = 0; i < n; i++) {
        res += p.sum(v[i]);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 2184
#include <bits/stdc++.h>
using namespace std;
//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
// 許容する誤差ε
#define EPS (1e-10)
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void print(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void print(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
//typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;



map<string, int> mp;
string str[200];
signed main(){
  int ans = 1, n;cin >> n;
  rep(i,n){
    cin >> str[i];
    if(mp[str[i]])ans = 0;
    mp[str[i]] = 1;
  }
  rep(i,n-1){
    int size1 = str[i].size(), size2 = str[i+1].size();
    if(str[i][size1-1] != str[i+1][0])ans = 0;
  }
  cout << (ans ? "Yes" : "No") << endl;
	return 0;
}










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

using namespace std;

long long inf=1000000007;

int main(){
	long long n;
	string s;
	cin>>n>>s;
	long long ans=0;

	for(long long i=0;i<=999;i++){
		string S=to_string(i);

		while(S.size()<3){
			S="0"+S;
		}

		long long now=0;

		for(long long j=0;j<n;j++){
			if(s.at(j)==S.at(now)) now++;
			if(now==3){
				ans++;
				break;
			}
		}
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3728
#!usr/bim/python
#! -*- coding: utf-8 -*-


import numpy as np

qhsd = raw_input()
qhsd = qhsd.split()
qhsd = map(int,qhsd)

n = raw_input()
n = int(n)

a = np.zeros(4,dtype = np.int64)
a[0] = qhsd[0]*8
a[1] = qhsd[1]*4
a[2] = qhsd[2]*2
a[3] = qhsd[3]

b = np.zeros(4,dtype = np.int64)
for i in range(4):
    b[i] = np.argmin(a)
    a[np.argmin(a)] = max(a)+1

l = [0.25,0.5,1,2]

new_qhsd = [qhsd[0]*4,qhsd[1]*2,qhsd[2],qhsd[3]]
new_l = [1,1,1,2]

ans = 0

for i in b:
    x = n / new_l[i]
    n = n % new_l[i]
    ans += new_qhsd[i] * x
    #print i, x, n, ans

print ans


Measured memory_bytes: 16392
package main

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

/*-----------Main-----------*/

func main() {
	n, m, x := readI(), readI(), readI()
	c := make([]int, n)
	a := make([][]int, n)

	for i := 0; i < n; i++ {
		c[i] = readI()
		a[i] = make([]int, m)
		a[i] = readIs(m)
	}

	bmax := pow(2, n) - 1
	ans := -1

	for bits := 0; bits <= bmax; bits++ {
		foo := make([]int, m+1)
		for book := 0; book < n; book++ {
			if bit(bits, book) {
				foo[0] += c[book]
				for i := 1; i <= m; i++ {
					foo[i] += a[book][i-1]
				}
			}
		}
		good := true
		for i := 1; i <= m; i++ {
			if foo[i] < x {
				good = false
				break
			}
		}
		if good {
			if ans == -1 {
				ans = foo[0]
			} else {
				if foo[0] < ans {
					ans = foo[0]
				}
			}
		}
	}
	fmt.Println(ans)
}

func pow(a, b int) int {
	c := 1
	for i := 0; i < b; i++ {
		c *= a
	}
	return c
}

func bit(bits, i int) bool {
	return (bits>>uint64(i))&1 == 1
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-3.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


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

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

  int ans = 1000;
  for ( int k = 0; k <= s.size()-t.size(); k++ ) {
    int ch = 0;
    for ( int i = 0; i < t.size(); i++ ) {
      if ( t[i] != s[k+i] ) { ch++; }
    }
    ans = min(ans, ch);
  }

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


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll n; cin >> n;
    ll ans = n-1;
    for (ll i = 2; i*i <= n; i++) {
        if (n % i == 0) {
            ll j = n/i;
            ll tr = i + j - 2;
            ans = min(ans,tr);
        }
    }
    cout << ans << '\n';
}



Measured memory_bytes: 256
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned long long llu;

const int INF = 1e9;
const int MOD = 1e9+7;
const double PI = 2*acos(0.0);

signed main()
{
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    vector<double> v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    while(v.size()>1)
    {
        sort(v.begin(),v.end());
        double curr = (v[0] + v[1]) / 2;
        reverse(v.begin(),v.end());
        v.pop_back();
        v.pop_back();
        v.push_back(curr);
    }           
    cout<<setprecision(6)<<v[0]<<endl;
    return 0;
}

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

public class Main 
{	
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);

		int[][] n = new int[2][6];
		for(int i=0; i<2; i++)
		{
			for(int j=0; j<6; j++)
			{
				n[i][j] = scanner.nextInt();
			}
		}
		
		boolean match = false;
		for(int i=0; i<99999; i++)
		{
			Random random = new Random();
			int d = random.nextInt(4);
				
			int[] buf = new int[6];
			for(int j=0; j<6; j++)
			{
				buf[j] = n[1][j];
			}
					
			switch(d)
			{
				case 0:
					n[1][0] = buf[4];
					n[1][1] = buf[0];
					n[1][5] = buf[1];
					n[1][4] = buf[5];
					break;
				case 1:
					n[1][0] = buf[1];
					n[1][1] = buf[5];
					n[1][5] = buf[4];
					n[1][4] = buf[0];
					break;
				case 2:
					n[1][0] = buf[2];
					n[1][2] = buf[5];
					n[1][5] = buf[3];
					n[1][3] = buf[0];
					break;
				case 3:
					n[1][0] = buf[3];
					n[1][3] = buf[5];
					n[1][5] = buf[2];
					n[1][2] = buf[0];
					break;
			}
			
			boolean is = true;
			for(int j=0; j<6; j++)
			{
				if(n[0][j] != n[1][j])
				{
					is = false;
					break;
				}
			}
			if(is)
			{
				match = true;
				break;
			}
		}
		
		System.out.println(match?"Yes":"No");
	}
}

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

using namespace std;

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

	int ans = 0;
	for (int i = 0; i < str.size();++i) {
		if (str[i] =='+') {
			ans++;
		} else {
			ans--;
		}
	}


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


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

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

	int ans = 0;
	for (int i = 0; i < n - 2; i++) {
		if(s.at(i) == 'A' && s.at(i+1) == 'B' && s.at(i+2) == 'C') ans++;
	}

	cout << ans << endl;

 	return 0;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    bool chk = true;
    while(chk){
        chk = false;
        for(int i=0;i<s.length()-1;i++){
            if(s[i] > s[i+1]){
                swap(s[i],s[i+1]);
                chk = true;
            }
        }
        for(int i=0;i<t.length()-1;i++){
            if(t[i] < t[i+1]){
                swap(t[i],t[i+1]);
                chk = true;
            }
        }
    }
    if(s < t)cout << "Yes"<<endl;
    else cout << "No"<<endl;
    
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N, K;
	cin >> N >> K;
	int64 res = N%K;
	N %= K;
	REP(i, 10) {
	  N = abs(N-K);
	  chmin(res, N);
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  string S, T; cin >> S >> T;
  int N = S.size();
  int ans = 0;
  rep(i, N){
    if(S.at(i) != T.at(i)){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3844
#abc160d
n,x,y=map(int,raw_input().split())
d=[0]*(n-1)
for i in range(n):
 for j in range(i+1,n):
  d[min(j-i-1,abs(x-1-i)+abs(y-1-j))]+=1
for res in d:
 print res


Measured memory_bytes: 2820
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;
int main(){
    int N;
    cin >>N;
    long long L[90];
     L[0]=2;
     L[1]=1;

     for(int i=2;i<=N;i++){
         L[i]=L[i-1]+L[i-2];
     }
cout << L[N]<<endl;
 return 0;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n+1);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int ans=0;
  int cnt=1;
  for(int i=0;i<n;i++){
    if(a[i]==a[i+1]){
      cnt++;
    }
    else{
      ans+=cnt/2;;
      cnt=1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
py = [list(map(int, input().split())) for i in range(m)]
py = [[py[i][0], py[i][1], i] for i in range(m)]
py = sorted(py)
p_list = [1 for _ in range(n+1)]
result = []
for i in range(m):
    result.append([py[i][2], py[i][0], p_list[py[i][0]]])
    p_list[py[i][0]] += 1
result = sorted(result)
for a, b, c in result:
    print("{:06}{:06}".format(b, c))

Measured memory_bytes: 41504
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
    private static final StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int x = readInt();
        int rate = 8;
        if (599 < x && x < 800) rate = 7;
        else if (799 < x && x < 1000) rate = 6;
        else if (999 < x && x < 1200) rate = 5;
        else if (1199 < x && x < 1400) rate = 4;
        else if (1399 < x && x < 1600) rate = 3;
        else if (1500 < x && x < 1800) rate = 2;
        else if (1799 < x && x < 2000) rate = 1;

        System.out.print(rate);
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static double readDouble() {
        read();
        return Double.parseDouble(builder.toString());
    }

    private static BigDecimal readBigDecimal() {
        read();
        return new BigDecimal(builder.toString());
    }

    private static float readFloat() {
        read();
        return Float.parseFloat(builder.toString());
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

}


Measured memory_bytes: 32272
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        for(int i=1; i<=1000; i++) {
            if(k * i >= a && k * i <=b) {
                System.out.println("OK");
                return;
            }
        }
        System.out.println("NG");
    }
}

Measured memory_bytes: 26912
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

// index が条件を満たすかどうか
bool f(vector<ll>& a, int len, int k)
{
    rep(i, a.size()) {
        k -= (a[i]+len-1)/len-1;
    }
    return k >= 0;
}

// 汎用的な二分探索のテンプレ。[s, t)からf(x)=trueとなる最小のxを探す
int meguru_search(vector<ll>& a, int s, int t, int k)
{
    int ng = s-1;
    int ok = t;
    while (abs(ok - ng) > 1)
    {
        int mid = (ok + ng) / 2;
        if (f(a, mid, k)) ok = mid;
        else ng = mid;
    }
    //okがtなら全ての要素でfalse
    //okがsなら全ての要素でtrue
    return ok;
}

void solve()
{
    IN(n, k);
    VIN(ll, a, n);
    ll res = meguru_search(a, 1, 1000000009LL, k);
    cout << res << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define LCIN(n) long long(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
class Edge{
public:
    LL from,to,cost;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        cost = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
int main(){
    CIN(A);
    CIN(B);
    CIN(C);
    CIN(D);
    if(abs(A-B)<=D&&abs(B-C)<=D){
        COUT("Yes");
    }else if(abs(A-C)<=D){
        COUT("Yes");
    }else{
        COUT("No");
    }
    return 0;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)

#define ll long long int

int ctoi(char c) {return c-'0';}
int ord(char c) {return c-'a';}
int len(string s) {return s.length();}
int itoc(int i) {return i+'a';}

int main() {
vector<int> v{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int K;
cin>>K;
cout<<v[K-1]<<endl;
return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;
long long n,c;
    
//status unsolved
long long cald(long long x1,long long x2){
    if(x1>x2)swap(x1,x2);
    return min(x1+c-x2,x2-x1);
}

int main(){
    cin>>n>>c;
    long long x[n+1],v[n+1];
    x[0]=0,v[0]=0;
    long long dp[n+1];

    rep(i,n+1)dp[i]=0;

    rep2(i,n){
        cin>>x[i]>>v[i];
    }

    long long vsum[n+1],r[n+1],l[n+1];
    vsum[0]=0;
    rep2(i,n)vsum[i]=vsum[i-1]+v[i];

    l[n]=vsum[n]-vsum[n-1]-(c-x[n]);

    for(int i=n-1;i>=1;i--){
        l[i]=max(l[i+1],vsum[n]-vsum[i-1]-(c-x[i]));
    }
    r[0]=0;
    for(int i=1;i<=n;i++){
        r[i]=max(r[i-1],vsum[i]-x[i]);
    }
    
    long long ans=-1;


    for(int i=0;i<=n;i++){
        //ただ右に行く時
        long long now=vsum[i]-x[i];
        ans=max(ans,now);

        if(i<n){
        //右->左に行く時
            now=vsum[i]-2*x[i]+l[i+1];
            ans=max(ans,now);
        }
    }

    for(int i=n;i>=1;i--){
        //ただ左に行く時
        long long now=vsum[n]-vsum[i-1]-(c-x[i]);
        ans=max(ans,now);

        //左->右で移動する時
        now=vsum[n]-vsum[i-1]-2*(c-x[i])+r[i-1];
        ans=max(ans,now);
    }
    cout<<ans<<endl;
    
    return 0;

}
/*


*/


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

int main(){
    int n;
    cin >> n;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        if(s=="AC") ac++;
        if(s=="WA") wa++;
        if(s=="TLE") tle++;
        if(s=="RE") re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    constexpr i64 mod = 1000000007;
    int n;
    std::cin >> n;

    i64 ret = 1;
    std::vector<int> ss { 0, 0, 0 };
    for (int i = 0; i < n; i++) {
        int a;
        std::cin >> a;
        i64 f = 0;
        for (int &s : ss) if (s == a) {
            if (!f) s++;
            f++;
        }
        if (!f) {
            std::cout << 0 << std::endl;
            return 0;
        }
        ret = ret * f % mod;
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <cstdio>
//#include <iomanip>//"cout<<fixed<<setprecision(n)<<sth<<endl;"
//#include <string>//"reverse(s's it,s's it)"
//#include <functional>//"greater<T>" "sort(a,a+n,greater<int>());""
//#include <cmath>//"abs" "sqrt"
//#include <numeric>//"accumulate(inputit,inputit,init,(optional) object)"
//#include <algorithm>//"lower_bound(it,it,v)" "next_permutation(a,a+n)"
//"reverse(v's it,v's it)"(v: vector)
using namespace std;
#define pb push_back//also for STRING
#define fi first
#define sc second
#define mp make_pair
#define is insert
#define ps push//TMP//stack,(priority) queue,
#define fr front//TMP//queue//for priority, use top().
//Add other types in the same way.

typedef long long ll;

#define MAX_N 100000

int main(){
	int n;
	long long a[MAX_N];
	cin>>n;
	for(int i=0;i<n;++i) cin>>a[i];
	sort(a,a+n,greater<ll>());
	for(int i=0;i+1<n;++i){
		if(a[i]!=a[i+1]) continue;
		for(int j=i+2;j+1<n;++j){
			if(a[j]!=a[j+1]) continue;
			cout<<a[i]*a[j]<<endl;
			return 0;
		}
	}
	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
play_dict = {"_blank": 0}
old_s = "_blank"
for _ in range(n):
  s, t = input().split()
  play_dict[s] = play_dict[old_s] + int(t)
  old_s = s

print(max(play_dict.values()) - play_dict[input()])

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

int main()
{
    short n, i, element, count = 0;
    cin >> n;
    for (i = 0; i < n;i++)
    {
        cin >> element;
        if (element != i + 1) count += 1;
    }
    if (count > 2) cout << "NO";
    else cout << "YES";         
}

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

typedef long double ld;

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
	ll n,m;
	cin>>n>>m;
	
	cout<<((n*(n-1)) + (m*(m-1)))/2<<endl;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;
    vector<int> ans(4, 0);
    for(int i = 0; i < n; ++i){
        string s;
        cin >> s;
        if(s == "AC")   ++ans[0];
        else if(s == "WA")  ++ans[1];
        else if(s == "TLE") ++ans[2];
        else    ++ans[3];
    }
    cout << "AC x " << ans[0] << endl;
    cout << "WA x " << ans[1] << endl;
    cout << "TLE x " << ans[2] << endl;
    cout << "RE x " << ans[3] << endl;
}

Measured memory_bytes: 3656
#include<stdio.h>

int main(void)
{
    int N, i, j, t=0, t2=9999999;
    scanf("%d", &N);
    int X[N];
    
    for(i=0; i<N; i++) {
        scanf("%d", &X[i]);
    }

    for(i=1; i<100; i++) {
        t = 0;
        for(j=0; j<N; j++) {
            t += (i-X[j])*(i-X[j]);
        }
        if(t2 > t) {
            t2 = t;
        }
    }

    printf("%d\n", t2);

    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=105,INF=1<<30;
ll dp[MAX][MAX];

ll rui(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return ans;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<ll> h(N+2,1),num(N+2,1),hi(N+2,1);
    vector<ll> SE;
    SE.push_back(1);
    for(int i=0;i<N;i++){
        cin>>h[i+1];
        SE.push_back(h[i+1]);
    }
    if(N==1){
        cout<<rui(2,h[1])<<endl;
        return 0;
    }
    
    sort(all(SE));
    SE.erase(unique(all(SE)),SE.end());
    
    ll M=SE.size();
    
    for(int i=0;i<N+2;i++){
        for(int j=0;j<M;j++){
            if(SE[j]==h[i]){
                num[i]=j;
                break;
            }
        }
    }
    
    for(int i=0;i<M;i++){
        hi[i]=SE[i];
    }
    
    dp[0][0]=1;
    
    for(int i=1;i<=N;i++){
        if(h[i-1]>=h[i]){
            for(ll from=M-1;from>=num[i];from--){
                dp[i][num[i]]+=dp[i-1][from]*2;
                dp[i][num[i]]%=mod;
            }
            for(ll j=num[i]-1;j>=0;j--){
                dp[i][j]+=dp[i-1][j];
            }
        }else{
            dp[i][num[i]]+=dp[i-1][num[i-1]]*2%mod;
            
            for(ll j=num[i]-1;j>=num[i-1];j--){
                dp[i][j]+=dp[i-1][num[i-1]]*2%mod*rui(2,h[i]-hi[j+1])%mod*(rui(2,hi[j+1]-hi[j])-1)%mod;
            }
            
            for(ll j=num[i-1]-1;j>=0;j--){
                dp[i][j]+=dp[i-1][j]*rui(2,h[i]-h[i-1])%mod;
            }
        }
    }
    
    ll ans=0;
    
    for(int j=0;j<M;j++){
        ans+=dp[N][j];
        ans%=mod;
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 384
a, b, m = map(int, input().split())
ref = list(map(int, input().split()))
micro = list(map(int, input().split()))
tk = [list(map(int, input().split())) for i in range(m)]

mini = min(ref) + min(micro)

amount = 10 ** 6
for i in tk:
    if ref[i[0]-1] + micro[i[1]-1] - i[2] < amount:
        amount = ref[i[0]-1] + micro[i[1]-1] - i[2]

print(min(mini, amount))

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

using namespace std;
typedef long long ll;

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

  int l = 0, r = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      l++;
    } else {
      l = max(0, l - 1);
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == ')') {
      r++;
    } else {
      r = max(0, r - 1);
    }
  }

  string ans = s;
  for (int i = 0; i < r; i++) {
    ans = '(' + ans;
  }
  for (int i = 0; i < l; i++) {
    ans += ')';
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<math.h>
#include<unordered_set>
#include<string.h>
#include<unordered_map>
#include<numeric>
#include <iomanip>
#include<string.h>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;

#define FOR(i,N) for(int i=0;i<N;i++)

ll mod=1e9+7;


int main() {
    int n,m;
    cin>>n>>m;
    map<char,int>ma;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            char c;
            cin>>c;
            ma[c]++;
        }
    }
    if((n%2)&&(m%2)){
        int two=0,one=0;
        for(auto a:ma){
            if(a.second%2==1){
                one++;
            }
            if(a.second%4==2){
                two++;
            }
        }
        if(one!=1){
            cout<<"No"<<endl;
            return 0;
        }
        if(two>n/2+m/2){
            cout<<"No"<<endl;
            return 0;
        }
    } else if((n%2)||(m%2)){
        int c=0;
        for(auto a:ma){
            if(a.second%4){
                if(a.second%2==0){
                    c++;
                } else {
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
        if(n%2==0){
            if(c>n/2){
                cout<<"No"<<endl;
                return 0;
            }
        }
        if(m%2==0){
            if(c>m/2){
                cout<<"No"<<endl;
                return 0;
            }
        }
     
    } else {
        for(auto a:ma){
            if(a.second%4){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


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

template <typename T>
struct LRPrique {
    using F = function<int(int)>;
    const F f;
    priority_queue<T> L;
    priority_queue<T, vector<T>, greater<>> R;
    int L_sz, R_sz;
    T L_sum, R_sum;
    // f(sz) -> size of L
    // e.g.) median : [](int sz) -> int { return (sz + 1) / 2; }
    LRPrique(F f)
        : f(f), L_sz(0), R_sz(0), L_sum(0), R_sum(0) {}
    void L_push(T x) {
        ++L_sz;
        L_sum += x;
        L.emplace(x);
    }
    void R_push(T x) {
        ++R_sz;
        R_sum += x;
        R.emplace(x);
    }
    T L_pop() {
        T ret = L.top();
        L.pop();
        --L_sz;
        L_sum -= ret;
        return ret;
    }
    T R_pop() {
        T ret = R.top();
        R.pop();
        --R_sz;
        R_sum -= ret;
        return ret;
    }
    void emplace(T x) {
        if (L.empty() or L.top() > x)
            L_push(x);
        else
            R_push(x);
    }
    void flatten() {
        int gL_sz = f(L_sz + R_sz);
        while (L.size() < gL_sz) {
            T tp = R_pop();
            L_push(tp);
        }
        while (L.size() > gL_sz) {
            T tp = L_pop();
            R_push(tp);
        }
    }
    T get() {
        flatten();
        return L.top();
    }
};

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    // MedianPrique
    LRPrique<ll> lr([](int sz) -> int { return (sz + 1) / 2; });

    int Q;
    cin >> Q;
    ll margin = 0;

    while (Q--) {
        int T;
        cin >> T;
        if (T == 1) {
            int a, b;
            cin >> a >> b;
            lr.emplace(a);
            margin += b;
        } else {
            ll med = lr.get();
            ll mn  = margin + (lr.R_sum - med * lr.R_sz) + (med * lr.L_sz - lr.L_sum);
            cout << med << ' ' << mn << endl;
        }
    }
}


Measured memory_bytes: 6568
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(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 FOr(i,x,y)  for(int i=int(x);i>=int(y);--i)
#define pi acos(-1) 
#define mk make_pair
#define pa pair<ll,ll>
#define lf else if
#define IL inline
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define Mul(x,y)    ((x)=1LL*(x)*(y)%mod)
#define Add(x,y)    ((x)=((x)+(y))%mod)
#define Max(x,y)    ((x)=((x)<(y)?(y):(x)))
#define Min(x,y)    ((x)=((x)>(y)?(y):(x)))
#define E(x)        return writeln(x),0
#define LL			(long long)
#define p(x)        printf("~%lld~\n",LL(x))
#define pp(x,y)     printf("~~%lld %lld~~\n",LL(x),LL(y))
#define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",LL(x),LL(y),LL(z))
#define pppp(a,b,c,d)	printf("~~~%lld %lld %lld %lld\n",LL(a),LL(b),LL(c),LL(d))
#define f_in(x)     freopen(x".in","r",stdin)
#define f_out(x)    freopen(x".out","w",stdout)
#define open(x)     f_in(x),f_out(x)
#define fi first
#define se second
#define GuYue		puts("\nGuYueNa________________________________________________________________________________")
typedef complex<double> E;
namespace cqz{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_; 
#endif 
#define NEG 1
    static const int GYN=2333333;
    char SZB[GYN],*S=SZB,*T=SZB;
    inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,GYN,stdin); if (S==T) return '\n';  }   return *S++;    }
#if NEG
    inline ll read(){    ll x=0,g=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') g=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*g; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
	void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);}
	void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);}
	void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);}
	void writeln(ll x){write(x);puts("");}
}using namespace cqz;
const ll mod=1e9+7,N=100010;
ll sum[N],f[N],a[N],n,A,B,last,pos;
ll Qsum(ll x,ll y){if (x>y)return 0;return (sum[y]-(x?sum[x-1]:0ll))%mod;}
int main(){
	n=read(),A=read(),B=read();if (A>B)swap(A,B);
	For(i,1,n)a[i]=read();a[++n]=2e18;
	f[1]=f[0]=sum[0]=1;	sum[1]=2;
	For(i,3,n)if (a[i]-a[i-2]<A)return puts("0"),0;
	last=0;pos=0;
	For(i,2,n){
		for(;a[i]-a[pos+1]>=B;++pos);
		f[i]=Qsum(last,pos);
		sum[i]=(sum[i-1]+f[i])%mod;
		if (a[i]-a[i-1]<A)last=i-1;
	}
	writeln((f[n]+mod)%mod);
}
/*
f[i]	i是ｂ的答案．．．
*/

Measured memory_bytes: 4480
#include<iostream>
#include<cstdio>
using namespace std;
int step(int &x,int &y,int h,int w)//奇数行=>;偶数行<=
{
    if((x%2==1 && y==w && x==h)||(x%2==0 && x==h && y==1))return 0;
    if(x%2==1)if(y==w){x++;return 0;}else {y++;return 0;}
    if(x%2==0)if(y==1){x++;return 0;}else {y--;return 0;}
    return 0;
}
int main()
{
    int h,w,n,g[105][105],a[10002];
    cin>>h>>w>>n;
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    int x=1,y=1;
    int temp=1;
    int color=0;
    while(temp<=h*w)
    {
        color++;
        for(int j=1;j<=a[color];j++)
        {
            temp++;
            g[x][y]=color;
            step(x,y,h,w);
        }
    }
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
            if(j!=w)printf("%d ",g[i][j]);else printf("%d\n",g[i][j]);
    return 0;
}



Measured memory_bytes: 384