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

using namespace std;

int main() {
  string s;
  cin >> s;
  int i = 0, j = 0, ans = 1;
  int n = s.size();
  while (j < n) {
    while (j < n && s[i] == s[j]) j++;
    ans = max(ans, j - i + min(i, n - j));
    i = j;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
N = int(input())
T,X,Y =0,0,0
count = 0
for i in range(N):
    t,x,y = map(int,input().split())
    if abs(t-T) >= abs((x+y)-(X+Y)) and t%2==(x+y)%2:
        count+=1
T,X,Y=t,x,y
print('Yes' if count==N else 'No' )


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
using namespace std;
const int dx[4]={1,-1,0,0};
const int dy[4]={0,0,1,-1};

int main(){
    int n,p;
    string s;
    cin>>n;
    map<string,vector<pair<int,int>>> mp;
    for(int i=0;i<n;i++){
        cin>>s>>p;
        mp[s].push_back(make_pair(p,i+1));
    }
    for(auto& itr:mp){
        sort(itr.second.begin(),itr.second.end(),greater<pair<int,int>>());
    }
    for(auto& itr:mp){
        for(auto& i:itr.second){
            cout<<i.second<<endl;
        }
    }
    // for(auto& itr:mp){
    //     sort(itr.begin(),itr.end(),greater<pair<int,int>>());
    // }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, c, x, y, z;
	
	while(cin >> a >> b >> c >> x >> y >> z){
		z -= c;
		if(z < 0){
			z += 60;
			y--;
		}
		
		y -= b;
		while(y < 0){
			y += 60;
			x--;
		}
		
		cout << (x-a) << " " << y << " " << z << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;

	int sx, sy, gx, gy;
	int n;
	int[] xs, ys;
	int lx, ly;

	void run(){
		sx=sc.nextInt();
		sy=sc.nextInt();
		gx=sc.nextInt();
		gy=sc.nextInt();
		n=sc.nextInt();
		xs=new int[n];
		ys=new int[n];
		for(int i=0; i<n; i++){
			xs[i]=sc.nextInt();
			ys[i]=sc.nextInt();
		}
		lx=sc.nextInt();
		ly=sc.nextInt();
		solve();
	}

	void solve(){
		int[] dx={0, 1, 1, 0, -1, -1, 0};
		int[] dy0={1, 0, -1, -1, -1, 0, 0};
		int[] dy1={1, 1, 0, -1, 0, 1, 0};

		LinkedList<P> que=new LinkedList<P>();
		HashMap<P, Integer> map=new HashMap<P, Integer>();

		HashSet<P> wall=new HashSet<P>();
		for(int i=0; i<n; i++){
			for(int t=0; t<6; t++){
				wall.add(new P(xs[i], ys[i], t));
			}
		}

		que.addFirst(new P(sx, sy, 0));
		map.put(new P(sx, sy, 0), 0);

		for(; !que.isEmpty();){
			P p=que.removeLast();
			int[] dy=abs(p.x)%2==0?dy0:dy1;
			int op=abs(p.x*p.y*p.t)%6;
			for(int i=0; i<7; i++){
				P q=new P(p.x+dx[i], p.y+dy[i], (p.t+1)%6);
				if(abs(q.x)>lx||abs(q.y)>ly||wall.contains(q)){
					continue;
				}
				int ignore=map.get(p)+(i==op?0:1);
				if(map.containsKey(q)){
					if(ignore<map.get(q)){
						map.put(q, ignore);
						que.addFirst(q);
					}
				}else{
					map.put(q, ignore);
					if(ignore==map.get(p)){
						que.addLast(q);
					}else{
						que.addFirst(q);
					}
				}
			}
		}

		int min=INF;
		for(int i=0; i<6; i++){
			P p=new P(gx, gy, i);
			if(map.containsKey(p)){
				min=min(min, map.get(p));
			}
		}
		println((min<INF?min:-1)+"");
	}

	class P{
		int x, y, t;

		P(int x, int y, int t){
			this.x=x;
			this.y=y;
			this.t=t;
		}

		@Override
		public int hashCode(){
			return t*200*200+(y+100)*200+x;
		}

		@Override
		public boolean equals(Object o){
			P p=(P)o;
			return x==p.x&&y==p.y&&t==p.t;
		}
	}

	void println(String s){
		System.out.println(s);
	}

	void debug(Object... os){
		System.err.println(deepToString(os));
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 39000
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# # input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
# mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

x, k, d = inpm()
x = abs(x)
if(x - k * d >= 0):
    print(x - k * d)
    exit
else:
    z = x // d
    a = x - d * z
    b = k - z
    if(b % 2 == 0):
        print(a)
        exit
    else:
        print(d - a)
        exit


Measured memory_bytes: 74816
class uf():


    def __init__(self,n):
        self.size=n
        self.parents=list(range(n))


    def find(self,x):
        if self.parents[x]==x:
            return x
        self.parents[x]=self.find(self.parents[x])
        return self.find(self.parents[x])


    def union(self,a,b):
        x=self.find(a)
        y=self.find(b)
        if x==y:
            return
        if x>y:
            x,y=y,x
        self.parents[y]=x


    def roots(self):
        s=0
        for c in range(self.size):
            if self.find(c)==c:
                s+=1
        return s-1


n,m=map(int,input().split())
city=uf(n)
for c in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    city.union(a,b)
print(city.roots())

Measured memory_bytes: 12776
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define N 1000000007
using namespace std; 
 
ll exponentiation(ll base, ll exp) { 
    if (exp == 0) return 1; 
  	if (exp == 1) return base % N; 
  	ll t = (exponentiation(base, exp / 2))%N; 
    t = (t * t) % N; 
    if (exp % 2 == 0) return t; 
  	else return ((base % N) * t) % N; 
} 
int main(){
	ll n;
	cin>>n;
	ll hasil=0;
	hasil=(hasil+exponentiation(10,n))%N;
	hasil=(hasil-(2*((exponentiation(9,n))%N))%N)%N;
	hasil=(hasil+exponentiation(8,n))%N;
	cout<<(hasil+N)%N<<'\n';
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ld pi = 3.14159265358;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);
const ll MAX = 100000;
ll par[MAX];
ll ran[MAX];
void init(ll n){
    rep(i,n){
        par[i] = i;
        ran[i] = 0;
    }
}
ll find(ll x){
    if(x == par[x])return x;
    else return par[x] = find(par[x]);
}
void unite(ll x,ll y){
    x = find(x);
    y = find(y);
    if(x == y)return;
    if(ran[x] < ran[y]){
        par[x] = y;
    }
    else{
        par[y] = x;
        if(ran[x] == ran[y])ran[x]++;
    }
}
bool same(ll x,ll y){
    return find(x) == find(y);
}
ll size(ll x){
    return ran[find(x)];
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll V,E;
    cin >> V >> E;
    init(V);
    vector<tuple<ll,ll,ll>> edge(E);
    ll s,t,c;
    rep(i,E){
        cin >> s >> t >> c;
        edge[i] = make_tuple(c,s,t);
    }
    sort(all(edge));
    ll ans = 0;
    rep(i,E){
        tie(c,s,t) = edge[i];
        if(!same(s,t)){
            ans += c;
            unite(s,t);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5488
import sys

stdin = sys.stdin
na = lambda: map(int, stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())

def main():
  a, b = na()
  
  tmp = 1
  cnt = 0
  while tmp < b:
    tmp += a-1
    cnt += 1
  print(cnt)

main()

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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

/////////////////////////////////

ll k, a, b;
ll ans;

void solve() {
	k -= a;
	if (k <= 0) {
		printf("1\n");
		return;
	}
	ll c = a - b;
	if (c <= 0) {
		printf("-1\n");
		return;
	}
	ans = 1 + 2 * ( (k + c - 1) / c);
	printf("%lld\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

  scanf("%lld %lld %lld", &k, &a, &b);
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 256
li = []

for i in range(5):
    a = int(input())
    li.append(a)

b = int(input())

last = 0
flg = 0
for i in li:
    for j in li:
        if abs(i - j) > b:
            flg = 1

        last = i

if flg == 0:
    print("Yay!")
else:
    print(":(")


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

struct UnionFind{
    vector<int32> par;
    UnionFind(int32 n){
        par.resize(n,-1);
    }

    int32 root(int32 a){
        if(par[a] < 0)return a;
        return par[a] = root(par[a]);
    }

    bool unite(int32 a, int32 b){
        a = root(a);
        b = root(b);
        if(a == b)return false;
        par[a] += par[b];
        par[b] = a;
        return true;
    }

    bool same(int32 a, int32 b){
        return root(a) == root(b);
    }

    int32 deg(int32 a){
        return -par[root(a)];
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,m;
    cin >> n >> m;
    vector<int32> a(n);
    REP(i,n)cin >> a[i];
    UnionFind uf(n);
    REP(i,m){
        int32 x, y;
        cin >> x >> y;
        uf.unite(x,y);
    }
    map<int32,vector<int32>> connected;
    REP(i,n){
        connected[uf.root(i)].pb(a[i]);
    }
    int64 ans = 0;
    vector<int32> b;
    int32 cnt = 0;
    for(auto p : connected){
        auto vec = p.second;
        cnt++;
        sort(ALL(vec));
        ans += vec[0];
        FOR(i,1,vec.size())b.pb(vec[i]);
    }
    if(cnt == 1){
        ANS(0);
        return 0;
    }
    sort(ALL(b));
    if(b.size() < cnt - 2){
        cout << "Impossible\n";
        return 0;
    }
    REP(i,cnt-2){
        ans += b[i];
    }
    ANS(ans);
    return 0;
}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	bool ab, bc, ca, abc;
	ab = a == b;
	bc = b == c;
	ca = c == a;
	abc = ab && bc;
	
	if(abc) cout << 1;
	else if(ab || bc || ca) cout << 2;
	else cout << 3;
	
	cout << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int count = 0;
		
		while(n-- > 0)
		{
			if(calculate(sc.nextLong(),sc.nextLong(),d))
				count++;
		}
		System.out.println(count);
	}

	private static boolean calculate(long x,long y, int d) {
		x = x*x;
		y = y*y;
		x += y;
		double sqrt = Math.sqrt(x);
		if(sqrt > d)
			return false;
		return true;
		
	}

}


Measured memory_bytes: 60548
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        b solver = new b();
        solver.solve(1, in, out);
        out.close();
    }

    static class b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int[] T = new int[N];
            for (int i = 0; i < N; i++) {
                T[i] = in.nextInt();
            }

            int M = in.nextInt();
            int[] P = new int[M];
            int[] X = new int[M];
            for (int i = 0; i < M; i++) {
                P[i] = in.nextInt();
                X[i] = in.nextInt();
            }

            for (int i = 0; i < M; i++) {
                int sum = 0;
                for (int j = 0; j < N; j++) {
                    if (j + 1 == P[i]) {
                        sum += X[i];
                    } else {
                        sum += T[j];
                    }
                }
                out.println(sum);
            }
        }

    }
}



Measured memory_bytes: 23764
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const long long INF=4557430888798830399;
int n,A,B;
int a[5001];
long long dp[5001][5001];
long long ans=INF;
int main()
{
    memset(dp,63,sizeof(dp));
	scanf("%d%d%d",&n,&A,&B);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	dp[0][0]=0;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=n;j++)
        	if(a[i]>j) dp[i][j]=min(dp[i][j],dp[i-1][j]+A),dp[i][a[i]]=min(dp[i][a[i]],dp[i-1][j]);
			else dp[i][j]=min(dp[i][j],dp[i-1][j]+B);
	for(int i=0;i<=n;i++)
		ans=min(ans,dp[n][i]);
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 195712
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    let a:i64 = read();
    let b:i64 = read();
    let c:i64 = read();
    let d:i64 = read();

    println!("{}", if (c-b).abs() <= d && (b-a).abs() <= d || (c-a).abs() <= d {"Yes"} else {"No"});

}


Measured memory_bytes: 4352
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
const a = input[1].split(' ').map(Number);
const result = [];
result.push(a.reduce(function(a, b) {
  return a < b ? a : b;
}));
result.push(a.reduce(function(a, b) {
  return a > b ? a : b;
}));
result.push(a.reduce(function(a, b) {
  return a + b;
}));
console.log(result.join(' '));

Measured memory_bytes: 17388
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
 
const int MOD = 1e9 + 7;

int32_t main() {
   IOS
   int n;cin>>n;
   string s;cin>>s;
   vector<vector<int>>dp(n+1,vector<int>(n+1));
   dp[1][1]=1;
   for(int i=1;i<=n;i++)
   dp[1][i]=1;
   for(int l=2;l<=n;l++)
   {
	   for(int i=1;i<l;i++)
	   {
		   if(s[l-2]=='<' ){
			   dp[l][i]+=dp[l-1][i-1];
			   dp[l][i]%=MOD;
		   }
		   else{
			   dp[l][i]+=dp[l-1][n]-dp[l-1][i-1]+MOD;
			   dp[l][i]%=MOD;
		   }
	   }
	   if( s[l-2]=='<' )
	   {
		   dp[l][l]+=dp[l-1][l];
		   dp[l][l]%=MOD;
	   }
	   for(int i=1;i<=n;i++)
	   {
		   dp[l][i]+=dp[l][i-1];
		   dp[l][i]%=MOD;
	   }
   }
   cout<< dp[n][n] << endl;
	   
    
		
	
	
  
}
 
 


Measured memory_bytes: 72448
#include <iostream>

int main()
{
	int K;
	int res;
	std::cin >> K;
	if (K % 2 == 0)
	{
		res = (K / 2) * (K / 2);
	}
	else
	{
		res = ((K + 1) / 2) * (K / 2);
	}
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 256
void main()
{
    string n = readln.chomp;

    long total;
    foreach (x; n)
    {
        total += x - '0';
    }
    
    max(total, (n[0] - '1') + 9 * (n.length - 1)).writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

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

    int a, b;
    cin >> a >> b;

    if(a >= 13)
        cout << b;
    if(6 <= a && a <= 12)
        cout << b / 2;
    if(a <= 5)
        cout << 0;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <random>
#include <ctime>
#include <sstream>
#include <numeric>
#include <queue>
#include <sstream>
using namespace std;


int main(){
    vector<int> a(3) ;
    cin >> a.at(0) >> a.at(1) >> a.at(2) ;
    sort(a.begin(),a.end()) ;
    if (a.at(0) == a.at(1) || a.at(1) == a.at(2))
    {
        if (a.at(0) == a.at(1) && a.at(1) == a.at(2))
        {
            
        }else
        {
            cout << "Yes" << endl ;
            return 0 ;
        }
        
        
    }
    cout << "No" << endl ;
}


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

using namespace std;

using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;

int main(int argc, char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  i32 N, M;
  cin >> N >> M;
  
  if(M == N) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define int long long
int n, m, a[100010], ans;
struct node{
	int a, c;
	bool operator<(const node&rhs)const{
		return a > rhs.a;
	}
}d[100010];
signed main(){
	scanf("%lld%lld", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
	for(int i = 1; i <= m; ++i) scanf("%lld%lld", &d[i].c, &d[i].a);
	sort(a + 1, a + n + 1);
	sort(d + 1, d + m + 1);
	d[m + 1].c = 1e9;
	for(int i = 1, j = 1; i <= n; ++i){
		if(a[i] > d[j].a) ans += a[i];
		else ans += d[j].a, d[j].c--;
		if(d[j].c == 0) j++;
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 2560
N,M=map(int,input().split())
ans=0
memo=[0 for _ in range(M)]

for i in range(N):
  KA=list(map(int,input().split()))
  for i in range(1, KA[0]+1):
    memo[KA[i]-1]+=1
    
for m in memo:
  if m==N:
    ans+=1
    
print(ans)

Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int A, B; cin >> A >> B;
    
    cout << max(max(A+B, A-B), A*B) << endl;
    
    return 0;
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,w,z;
    char ca,cb,cc;
    cin>>a;
    if(1200>a) cout<<"ABC"<<endl;
    else if(2800>a) cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;
    return 0;
}


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

int h , w ;
bool vis[1001][1001] ; 
int path[1001][1001] ; 
bool valid(int x , int y) {
	return x>=0 && x < h && y>=0 && y < w ; 
}
int main() {
	
	cin >> h >> w ; 
	vector<string> s(h) ; 
	int inx , iny, fix, fiy ; 
	cin >> inx >> iny >> fix >> fiy ; 
	inx--; iny--; fix--; fiy--;
	string t ; 
	for(int i = 0 ; i < h ; ++i) {
		cin >> t ; 
		s[i] = t ; 
	}
	
	memset(vis,0,sizeof(false)) ; 
	for(int i =0 ; i < 1001; ++i) {
		for(int j = 0 ; j < 1001 ; ++j) 
			path[i][j] = 1e8 ; 
	}
	vector<int> ar = {-2,-1,0,1,2} ; 
	deque<pair<int,int>> q ; 
	q.push_front({inx,iny}) ;
	path[inx][iny] = 0 ; 
	vis[inx][iny] = 1;
	while(!q.empty()) {
		pair<int,int> u = q.front() ;
		int x = u.first ; 
		int y = u.second ;
		vis[x][y] = 1 ;
		q.pop_front() ; 
		for(int i = 0 ; i < 5 ; ++i) {
			for(int j = 0; j < 5 ; ++j) {
				int dx = ar[i] ; 
				int dy = ar[j] ;
				if(dx==0&&dy==0)
					continue ; 
				int new_x = x + dx ; 
				int new_y = y + dy ; 
				if(valid(new_x,new_y) && !vis[new_x][new_y] && s[new_x][new_y] == '.') {
					if(abs(dx)+abs(dy) > 1) {
						path[new_x][new_y] = min(path[new_x][new_y] , 1 + path[x][y]) ; 
						q.push_back({new_x,new_y}) ; 
					}
					else {
						path[new_x][new_y] = path[x][y] ; 
						q.push_front({new_x,new_y}) ; 
					}
					
				}
			}
		}
	} 
	if(path[fix][fiy] == 1e8) cout << -1 ; 
	else 
	cout << path[fix][fiy] ; 
	

	return 0 ; 
}


Measured memory_bytes: 12116
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using System.Numerics;
using static System.Math;
using static System.Console;

class E { static void Main() => new J(); }
class J
{
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	int MOD = 1000000007;
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var a = BigInteger.Parse(Console.ReadLine());
		var b = BigInteger.Parse(Console.ReadLine());
		Console.WriteLine(a > b ? "GREATER" : a < b ? "LESS" : "EQUAL");
	}
}

Measured memory_bytes: 13268
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
using namespace std;
int n; char ch[200010];
int main() {
	scanf("%s", ch); n = strlen(ch);
	int a = 0, b = 0;
	rep(i, 0, n - 1) if (ch[i] == 'Z') b = i;
	for (int i = n - 1; i >= 0; -- i) if (ch[i] == 'A') a = i;
	printf("%d\n", b - a + 1);
	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<ctime>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int x,a,b;
	scanf("%d %d %d",&x,&a,&b);
	abs(a-x)>abs(b-x)?printf("B"):printf("A");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

#define MAX (10+300000/7)

int gd[2*MAX];
int prime[35820];
int cnt;

int main(){
  REP(i,MAX){
    gd[2*i]   = 7*i + 1;
    gd[2*i+1] = 7*i + 6;
  }

  vector<bool> isPrime(gd[2*MAX-1]+1, true);

  for(int i=1; i<MAX*2; i++){
    if(isPrime[gd[i]]){
      prime[cnt++] = gd[i];
      for(int j=gd[i]+gd[i]; j<=gd[2*MAX-1]; j+=gd[i]){
        isPrime[j] = false;
      }
    }
  }

  int n;
  while(scanf("%d",&n), n-1){
    printf("%d:",n);
    REP(i,n){
      if(prime[i] > n) break;
      if(n % prime[i] == 0){
        printf(" %d",prime[i]);
      }
    }
    puts("");
  }
  return 0;
}

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

int main() {

    int N;
    cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X[i];

    ll ans = 1e18;
    for (int P = 0; P<=1000; ++P) {
        ll tmp = 0;
        rep(i, N) {
            tmp += (X[i] - P) * (X[i] - P);
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX 1000000000
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};
const ll INF = 10010010010001;
vector<vector<bool>> graph;
vector<bool> reached;
ll MOD = 998244353;

int main(){
    int N;
    cin >> N;
    unordered_map<ll,int> A;
    for(int i=0;i<N;i++){
        int x;
        cin >> x;
        A[x] ^= 1;
    }

    int ans = 0;
    for(auto a=A.begin();a!=A.end();a++){
        if(a->second == 1) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4388
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::HashSet;
use std::cmp;
use std::f64::consts;

fn main() {
    let mut x: i64 = read();
    let y: i64 = read();

    let mut count = 0;

    while x <= y {
        count+=1;
        x*=2;
    }

    println!("{}", count);
}

fn calc_distance(x: i32, y: i32, target_x: i32, target_y: i32) -> i32 {
    let diff_x = (target_x - x).abs();
    let diff_y = (target_y - y).abs();

    return diff_x + diff_y;
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// 最大公約数
fn gcd(a: i32, b: i32) -> i32 {
    match b {
        0 => a,
        _ => gcd(b, a % b)
    }
}

// 最小公倍数
fn lcm(a: i32, b: i32) -> i32 {
    a * b / gcd(a, b)
}

// 階乗
fn kaijou(n: i32)->i32 {
    if n == 1 {
        return n;
    }
    return n * kaijou(n-1);
}

Measured memory_bytes: 4352
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 524288
#define P 200003

constexpr ulli PRIME = 0xffffffff00000001;
constexpr ulli ntt_add(ulli a, ulli b)
{
    if(b>PRIME) b -= PRIME;
    ulli res = 0;
    if(__builtin_uaddll_overflow(a,b,&res))
        res -= PRIME;
    return res;
}
constexpr ulli ntt_sub(ulli a, ulli b)
{
    if(b>PRIME) b -= PRIME;
    ulli res = 0;
    if(__builtin_usubll_overflow(a,b,&res))
        res += PRIME;
    return res;
}
constexpr ulli ntt_mul(ulli a, ulli b)
{
    unsigned __int128 k = (unsigned __int128)a*b;
    ulli hh = k>>64>>32, hl = (uint)(k>>64), res = k;
    res = ntt_add(res,hl*-PRIME);
    res = ntt_sub(res,hh);
    return res;
}
constexpr ulli ntt_pow(ulli a, ulli b)
{
    ulli r = 1;
    while(b)
    {
        if(b&1) r = ntt_mul(r,a);
        a = ntt_mul(a,a);
        b >>= 1;
    }
    return r;
}
constexpr ulli ntt_find()
{
    ulli res = 2;
    while(ntt_pow(res,PRIME/2) != PRIME-1) ++res;
    return res;
}
constexpr ulli OMEGA = (ntt_pow(ntt_find(),PRIME/N));
static_assert(__builtin_popcount(N) == 1);
static_assert(PRIME%N == 1);
static_assert(ntt_pow(OMEGA,N/2) == PRIME-1);
uint ricr(uint k)
{
    k ^= (N-1);
    k ^= -1u >> 1 >> __builtin_clz(k);
    return k;
}
void ntt(ulli *a, ulli ow=OMEGA)
{
    for(int i=0,ii=0;i<N;++i,ii=ricr(ii))
        if(i<ii) std::swap(a[i],a[ii]);
    for(int n2=1,n=2;n2<N;n2=n,n*=2)
    {
        ulli w = ntt_pow(ow,N/n);
        for(ulli *p=a; p!=a+N; p+=n)
        {
            ulli k = 1;
            for(int i=0,j=n2;i<n2;++i,++j)
            {
                ulli e = p[i], o = p[j];
                ulli ok = ntt_mul(o,k);
                p[i] = ntt_add(e,ok);
                p[j] = ntt_sub(e,ok);
                k = ntt_mul(k,w);
            }
        }
    }
}
void ntt_inv(ulli *a)
{
    ntt(a,ntt_pow(OMEGA,PRIME-2));
    for(int i=0;i<N;++i) a[i] = ntt_mul(a[i],ntt_pow(N,PRIME-2));
}

int cnt[N];
ulli a[N];

int main()
{
    int n;
    lli ans = 0;
    scanf("%d", &n);
    for(int i=0;i<n;++i)
    {
        int k;
        scanf("%d", &k);
        ++cnt[k];
    }
    for(int i=0, k=1; i<P-1; ++i, k=k*2<P?k*2:k*2-P) a[i] = cnt[k];
    for(int i=0; i<P-1; ++i) cnt[i] = a[i];
    ntt(a);
    for(int i=0;i<N;++i) a[i] = ntt_mul(a[i],a[i]);
    ntt_inv(a);
    for(int i=0; i<P-1; ++i) a[i*2] = ntt_sub(a[i*2], cnt[i]);
    for(int i=0,k=1; i<N; ++i, k=k*2<P?k*2:k*2-P)
    {
        if(a[i] >= PRIME) a[i] -= PRIME;
        ans += k * a[i];
    }
    assert(ans%2==0);
    ans /= 2;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 6604
import java.util.*;

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

        String S = sc.nextLine();
        boolean ret = true;

        if (S.charAt(0) != 'A') {
            ret = false;
        }

        int cCount = 0;
        for (int i = 2; i < S.length() - 1; i++) {
            if (S.charAt(i) == 'C') cCount++;
        }
        if (cCount != 1) ret = false;

        int upperCount = 0;
        for (int i = 0; i < S.length(); i++) {
            if (Character.isUpperCase(S.charAt(i))) upperCount++;
        }
        if (upperCount != 2) ret = false;

        if (ret) {
            System.out.println("AC");
        } else {
            System.out.println("WA");
        }
    }
}

Measured memory_bytes: 23636
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 200010
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
ll s[N],QAQ[N],a[N],b[N];int head[N],go[N],tot=0;
struct Edge{int v,next;ll w;}edge[N*50];
inline void add(int x,int y,ll z){edge[++tot]=Edge{y,head[x],z};head[x]=tot;}
int main()
{	int n,m,p,top=0; ll sum=0; cin>>n>>m; a[++top]=n;
	for(rint i=1;i<=m;i++)
	{	scanf("%lld",&b[i]);
		while(top&&b[i]<=a[top]) top--; a[++top]=b[i];
	}
	go[1]=p=a[1];
	for(rint i=2;i<=top;i++)
	{	go[i]=++p; add(go[i],go[i-1],a[i]/a[i-1]);
		for(ll l=a[i]%a[i-1];;)
		{	if(!l) break; if(l<=a[1]){add(go[i],l,1);break;}
			int pos=upper_bound(a+2,a+top+1,l)-a-1;
			add(go[i],go[pos],l/a[pos]); l%=a[pos];
		}
	}
	s[go[top]]=1;
	for(rint j=top;j>=2;j--)
	for(rint i=head[go[j]];i;i=edge[i].next) s[to]+=edge[i].w*s[go[j]];
	for(rint i=a[1];i>=1;i--) sum+=s[i],QAQ[i]=sum;
	for(rint i=1;i<=a[1];i++) printf("%lld\n",QAQ[i]);
	for(rint i=a[1]+1;i<=n;i++) printf("0\n");
	return 0;
}


Measured memory_bytes: 20864
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;

using namespace std;

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

    int n,a[100005],b[100005],c[100005];
    cin>>n;
    reps(i,n){
	cin>>a[i]>>b[i]>>c[i];
    }

    int dp[100005][5];
    dp[1][1]=a[1];
    dp[1][2]=b[1];
    dp[1][3]=c[1];
    for(int i=2;i<=n;i++){
	dp[i][1]=a[i]+max(dp[i-1][2],dp[i-1][3]);
	dp[i][2]=b[i]+max(dp[i-1][1],dp[i-1][3]);
	dp[i][3]=c[i]+max(dp[i-1][1],dp[i-1][2]);
    }

    cout<<max(dp[n][1],max(dp[n][2],dp[n][3]))<<'\n';
    return 0;
}


Measured memory_bytes: 3328
// Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include "bits/stdc++.h"

#pragma region Template

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define llint long long int;

using namespace std;

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

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

#pragma endregion

bool is_valid(int num, const vector<bool>& NGs) {
	while (num) {
		if (NGs[num % 10]) return false;
		num /= 10;
	}
	return true;
}

/* Entry Point */
int main()
{
	/* fast_io */
	cin.tie(0);
	ios::sync_with_stdio(false);
	//

	string a;
	char c; 
	while (cin >> c) {
		if (c - 'B') a += c; 
		else if (a != "") a.pop_back(); 
	} 
	cout << a << endl;

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
#define int long long

int gcd(int a,int b){
	if(!b)return a;
	return gcd(b,a%b);
}
signed main(){
	int n;scanf("%lld",&n);
	int g;
	rep(i,n){
		int t;scanf("%lld",&t);
		if(i==0)g=t;
		else g=g/gcd(g,t)*t;
	}
	printf("%lld\n",g);
}


Measured memory_bytes: 256
import heapq
n,m=map(int,input().split())
list=[[] for i in range(m)]
h=[]
for i in range(n):
  a,b=map(int,input().split())
  if a<=m:
    list[a-1].append(-b)
ans=0
for i in range(m):
  for j in list[i]:
    heapq.heappush(h,j)
  if h:
    ans+=-heapq.heappop(h)
  else:
    continue
print(ans)  


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

void solve(vector<string> p) {
  char c;
  for (int i=0;i<8;i++)
  for (int j=0;j<8;j++)
  if (p[i][j]=='1') {
    if (p[i][j+1]=='1' && p[i+1][j]=='1' && p[i+1][j+1]=='1') c='A';
    else if (p[i+1][j]=='1' && p[i+2][j]=='1' && p[i+2][j]=='1') c='B';
    else if (p[i][j+1]=='1' && p[i][j+2]=='1' && p[i][j+3]=='1') c='C';
    else if (p[i+1][j]=='1' && p[i+1][j-1]=='1' && p[i+2][j-1]=='1') c='D';
    else if (p[i][j+1]=='1' && p[i+1][j+1]=='1' && p[i+1][j+2]=='1') c='E';
    else if (p[i+1][j]=='1' && p[i+1][j+1]=='1' && p[i+2][j+1]=='1') c='F';
    else if (p[i][j+1]=='1' && p[i+1][j]=='1' && p[i+1][j-1]=='1') c='G';
    cout<<c<<endl;
    return;
  }
}

int main(int argc, char const* argv[]) {
  string empty;
  while (true) {
    vector<string> plane(14);
    for (int i=0;i<8;i++) getline(cin, plane[i]);
    for (int i=0;i<8;i++) plane[i]+="000000";
    for (int i=8;i<14;i++) plane[i]="00000000000000";
    
    solve(plane);
    
    if (!getline(cin, empty)) break;
  }
  return 0;
}

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

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

int main() {
    int n;
    cin >> n;
    map<char,int> m[n];
    string firststr;
    cin >> firststr;
    sort(firststr.begin(),firststr.end());
    for(char c : firststr){
        m[0][c]++;
    }
    firststr.erase(unique(firststr.begin(), firststr.end()), firststr.end());

    for(int i=1;i<n;i++){
        string str;
        cin >> str;
        for(char c : str){
            m[i][c]++;
        }
    }
    
    string res = "";
    for(int i=0;i<firststr.length();i++){
        int mi = INT_MAX;
        for(int j=0;j<n;j++){
            mi = min(mi,m[j][firststr.at(i)]);
        }
        res += string(mi,firststr.at(i));
    }

    cout << res;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
D = list(map(int, input().split()))
m = int(input())
T = list(map(int, input().split()))

from collections import Counter
DC = Counter(D)
TC = Counter(T)
for k, v in TC.items():
	if v > DC[k]:
		print("NO")
		exit()
else:
	print("YES")

Measured memory_bytes: 127696
def solve():
    n = int(input())
    pattern = [[a, b] for a, b in zip(list(input()), list(input()))]
    pointer, ans = 0, 0
    if pattern[0][0] == pattern[0][1]:
        ans = 3
    else:
        ans = 6
    while pointer < n - 1:
        current = pattern[pointer][0]
        if current == pattern[pointer][1]:
            if pattern[pointer+1][0] == pattern[pointer+1][1]:
                ans *= 2
                # print("X->X")
            else:
                ans *= 2
                # print("X->Y")
            pointer += 1
        else:
            if pointer + 2 >= n - 1:
                break
            if pattern[pointer+2][0] == pattern[pointer+2][1]:
                ans *= 1
                # print("Y->X")
            else:
                ans *= 3
                # print("Y->Y")
            pointer += 2
    print(ans % 1000000007)

if __name__=="__main__":
    solve()

Measured memory_bytes: 38384
#include<stdio.h>
int main(){
	int a, b, c, d, e;
	int odd, even;
	scanf("%d %d", &a, &b);

	
	
	int ep = (a*(a-1))/2;
	int op = (b*(b-1))/2;
	
//	printf("odd %d\neven %d\n", odd, even);
	printf("%d\n",  ep+op);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
	fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
	string s;
	cin>>s;
	ll n= s.size();
	forn(i, 0, n){
		if(s[i] == '9'){
			s[i] ='1';
		}
		else {
			s[i] ='9';
		}
	}
	cout<<s<<endl;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		long a = sc.nextInt();
		long b = sc.nextInt();
		long x = a * b;

		long tmp = 0;
		if (a < b) {
			tmp = a;
			a = b;
			b = tmp;
		}

		long r = a % b;
		while (r != 0) {
			a = b;
			b = r;
			r = a % b;
		}

		System.out.println(x / b);
	}

}

Measured memory_bytes: 23380
//10/05/2020
#include<bits/stdc++.h>
#include<cmath>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define debug printf("Debug\n");
#define en '\n'


#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll id;
    ll cost;
    vector<ll>v;
};

//Algos
template<typename T> using Pbds=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

//Number Theory
class NumberTheory{
public:
    ll n;
    bool chk[99999995];
    ll GetMod(ll x,ll m);
    ll BigMod (ll b,ll p,ll m){if (p == 0) return 1;if (p%2 == 0){ll s = BigMod(b,p/2,m);return ((s%m)*(s%m))%m;}return ((b%m)*(BigMod(b,p-1,m)%m))%m;}
    ll ModInv (ll b,ll m){return BigMod(b,m-2,m);}
    ll gcd(ll a,ll b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
    ll lcm(ll a,ll b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
    void sieve(ll x);
    bool IsPrime(ll x);
    bool IsPrime1(ll x){return !chk[x];}
};

/*Containers*/
vector<ll>v;
deque<ll>dq;
stack<ll>stk;
map<ll,ll>mp;
unordered_map<ll,ll>ump;
set<ll>st;
multiset<ll>mst;
unordered_set<ll>ust;
unordered_multiset<ll>umst;
priority_queue<ll,deque<ll>,greater<ll>>pq;
Pbds<ll>ost;
ll n,m,X;
Node a[20];
ll c[15];
bool f=false;
ll ans=1e18;

void func(ll now,ll cost[],ll tot){
    //cout<<now<<' ';
    bool f1=true;
    for(ll i=0;i<m;i++){
        //cout<<cost[i]<<' ';
        if(cost[i]<X) f1=false;
    }
    //cout<<en;
    if(f1){
        f=true;
        ans=min(ans,tot);
    }
    if(now>n) return;
    Node x=a[now];
    ll tem[15];
    for(ll i=0;i<m;i++){
        tem[i]=cost[i];
        tem[i]+=x.v[i];
    }

    func(now+1,tem,tot+x.cost);
    func(now+1,cost,tot);
}

int main(){
    _fastio
    cin>>n>>m>>X;

    for(ll i=1;i<=n;i++){
        Node x;
        x.id=1;
        cin>>x.cost;
        for(ll j=1;j<=m;j++){
            ll p;
            cin>>p;
            x.v.emplace_back(p);
        }
        a[i]=x;
    }
    ll te[15];
    memset(te,0,sizeof(te));
    func(1,te,0);

    if(!f) cout<<-1<<en;
    else{
        cout<<ans<<en;
    }

    return 0;
}

void NumberTheory::sieve(ll x){
    for(ll i=2;i*i<=x;){
        if(chk[i]==0){
            for(ll j=i*i;j<=x;j+=i){
                chk[j]=1;
            }
        }
        if(i==2) i++;
        else i+=2;
    }
}
bool NumberTheory::IsPrime(ll x){
    bool f=true;
    for(ll i=2;i*i<=x;i++){
        if(!x%i){
            f=false;break;
        }
    }
}
ll GetMod(ll x,ll m){
    if(x>=0) return x%m;
    else{
        ll y=abs(x)/m;x+=(y*m+m+m);
        return x%m;
    }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  string S,T;
  cin >> S >> T;
  bool yay[30];
  bool yay2[30];
  FOR(i,0,30){
    yay[i] = 1;
    yay2[i] = 1;
  }
  map<char,int> s,t;
  int num = 0;
  FOR(i,0,S.size()){
    if(yay[S[i]-'a']){
      s.insert(make_pair(S[i],num));
      num++;
      yay[S[i]-'a'] = 0;
    }
  }
  num = 0;
  FOR(i,0,T.size()){
    if(yay2[T[i]-'a']){
      t.insert(make_pair(T[i],num));
      num++;
      yay2[T[i]-'a'] = 0;
    }
  }
  bool ans = 1;
  FOR(i,0,S.size()){
    if(s[S[i]] != t[T[i]])ans = 0;
  }
  cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 776
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

void RightSuns(vector<pair<long long, long long>>& rez, vector<long long>& a) {
	vector<long long> f_stack;
	vector<long long> s_stack;
	vector<long long> dimas;
	for (long long i = 0; i < a.size(); ++i) {
		while (!s_stack.empty() && s_stack.back() < a[i]) {
			rez[s_stack.back() - 1].second = i;
			s_stack.pop_back();
		}
		while (!f_stack.empty() && f_stack.back() < a[i]) {
			rez[f_stack.back() - 1].first = i;
			dimas.push_back(f_stack.back());
			f_stack.pop_back();
		}
		while (!dimas.empty()) {
			s_stack.push_back(dimas.back());
			dimas.pop_back();
		}
		f_stack.push_back(a[i]);
	}
}

void LeftSuns(vector<pair<long long, long long>>& rez, vector<long long>& a) {
	vector<long long> f_stack;
	vector<long long> s_stack;
	vector<long long> dimas;
	for (long long i = a.size() - 1; i >= 0; --i) {
		while (!s_stack.empty() && s_stack.back() < a[i]) {
			rez[s_stack.back() - 1].second = i;
			s_stack.pop_back();
		}
		while (!f_stack.empty() && f_stack.back() < a[i]) {
			rez[f_stack.back() - 1].first = i;
			dimas.push_back(f_stack.back());
			f_stack.pop_back();
		}
		while (!dimas.empty()) {
			s_stack.push_back(dimas.back());
			dimas.pop_back();
		}
		f_stack.push_back(a[i]);
	}
}

int main() {

	long long n, ans = 0;
	cin >> n;
	vector<long long> a(n);
	vector<pair<long long, long long>> left_suns(n, { -1, -1 });
	vector<pair<long long, long long>> right_suns(n, { n, n });
	for (long long i = 0; i < n; ++i) {
		cin >> a[i];
	}

	LeftSuns(left_suns, a);
	RightSuns(right_suns, a);

	for (long long i = 0; i < n; ++i) {
		if (left_suns[a[i] - 1].first == -1 && right_suns[a[i] - 1].first == -1) {
			continue;
		}
		ans += a[i] * (left_suns[a[i] - 1].first - left_suns[a[i] - 1].second) * (right_suns[a[i] - 1].first - i);
		ans += a[i] * (right_suns[a[i] - 1].second - right_suns[a[i] - 1].first) * (i - left_suns[a[i] - 1].first);
	}
	cout << ans;
}

Measured memory_bytes: 5240