akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  int H,W,K;
  cin>>H>>W>>K;
  string s[H];
  rep(i,0,H){
    cin>>s[i];
  }
  int cnt=0;
  for(int bit=0 ; bit<(1<<H) ; bit++){
    for(int bit2=0 ; bit2<(1<<W) ; bit2++){
      int temp=0;
      for(int i=0 ; i<H ; i++){
        if(bit & (1<<i)){
          for(int j=0 ; j<W ; j++){
            if(bit2 & (1<<j)){
              if(s[i][j]=='#') temp++;
            }
          }
        }
      }
      if(temp==K) cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 3612
import java.util.*;
public class Main {
public static void main(String[] args)throws java.io.IOException{
	        Scanner scan = new Scanner(System.in);
	       
	        int n=scan.nextInt();
	        for(int i=1;i<=n;i++){
	        	System.out.println("Case "+i+":");
	        	msm(scan.nextInt(),1);
	        }
	    }
	    public static void msm(int n,int c){
	    	if(c==11)return ;
	    	String str =Integer.toString(n*n);
	    	StringBuilder sb=new StringBuilder();
	    	for(int i=0;i<8-str.length();i++)
	    		sb.append(0);
	    	sb.append(str);
	    	str = sb.toString().substring(2,6);
	    	int out =Integer.parseInt(str);
	    	
	    	System.out.println(out);
	    	msm(out,c+1);
	    	return ;
	    }
	     
}
	    

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

class Mondai
{
    static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(n => Int64.Parse(n)).ToArray();
        var r = line[0];
        var D = line[1];
        var x = line[2];
        for (int i=0;i<10;++i)
        {
            if(i<9)Console.WriteLine(r*x-D);
            else Console.Write(r * x - D);
            x = r * x - D;
        }
        
    }
}

Measured memory_bytes: 13396
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

long long n, a, b, c;
int main() {
	cin >> n;
	while (b < n) {
		++a;
		b += a;
	}
	c = b - n;

	for (int i = 1; i <= a; ++i) {
		if (i != c) { cout << i << endl; }
	}
}

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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template<class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template<class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

//IN
void IN() {}
template<class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

//OUTS
template<size_t> struct int_{};
template<class Tuple, size_t Pos>
ostream& print_tuple(ostream& out, const Tuple& t, int_<Pos>) {
  out << get<tuple_size<Tuple>::value-Pos>(t) << " ";
  return print_tuple(out, t, int_<Pos-1>());
}

template <class Tuple>
ostream& print_tuple(ostream& out, const Tuple& t, int_<1>) {
  return out << get<tuple_size<Tuple>::value-1>(t);
}

template<class... Args>
ostream& operator<<(ostream& out, const tuple<Args...>& t) {
  return print_tuple(out, t, int_<sizeof...(Args)>());
}

#define OUTS(...) cout << make_tuple(__VA_ARGS__) << "\n";

//OUTL
void OUTL() {}
template<class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}
// }}} End

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  VAR(int, n);
  i64 bad = 1, all = 1;
  rep(i, n) {
    VAR(i64, a);
    if (a % 2 == 0) bad *= 2;
    all *= 3;
  }
  OUTL(all - bad);
  return 0;
}


Measured memory_bytes: 256
//shipc_a.cpp
//Sat Jul  7 20:35:28 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
using ll=long long;

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

	if (a+b == 15){
		cout << "+" << endl;
	}else if (a*b == 15){
		cout << "*" << endl;
	}else {
		cout << "x" << endl;
	}
}

Measured memory_bytes: 256
string vlop( int n, int loop_num ){
	string s;
	foreach(i; 0..loop_num){
		s ~= n.to!string();
	}
	return s;
}
void main(){
	int a, b;
	readf("%d %d", &a, &b);
	writeln(a<=b? vlop(a, b): vlop(b, a));
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2796
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int seat[510][510] = {1};
int p[510];

int main(){
    string t;
    cin >> t;
    int len = t.size();
    rep(i,len){
        if(t[i] == '?'){
            t[i] = 'D';
        }
    }
    rep(i,len) cout << t[i]; cout << endl;
}



Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
int n,m,ans;
char s[40005];
map<char,int>mp;
int main()
{
    long long ans=0;
    scanf("%d",&n);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++)
    {
        mp[s[i]]++;
        for(int i0=i+1;i0<=n;i0++)
        {
            if(s[i]==s[i0])continue;
            int d=i-mp[s[i]]-mp[s[i0]],p=i0-i;
            if(i-p>=1&&s[i-p]!=s[i]&&s[i-p]!=s[i0])d--;
            ans+=d;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3824
let inline scan () = System.Console.ReadLine()
let inline split (s: string) = s.Split(' ')

let xs = scan () |> split |> Array.map int

let (m, app) =
  match xs |> Array.map (fun x -> x % 2) |> Array.sum with
    | 0 -> (1, 0)
    | 1 -> (0, 1)
    | 2 -> (1, 1)
    | 3 -> (0, 0)


let xs' = 
  [
    for x in xs do
      if x % 2 = m then
        yield x + 1
      else
        yield x
  ]

let max = List.max xs'
printfn "%i" <|
  (xs' |> Seq.map (fun x -> (max - x) / 2) |> Seq.sum) + app 


Measured memory_bytes: 14172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))

// n個の中からk個選ぶ 0~n-1 bitで表現 n<=18 k<=n
vector<ll> combination(ll n,ll k){
	vector<ll> ans;
	ll x = (1LL<<k)-1;
	ll f = x<<(n-k);
	while(1){
		ans.push_back(x);
		if(x==f)return ans;
		x += x&-x;
		ll pcount = bitset<64>(x).count();
		x|=(1LL<<(k-pcount))-1;
	}
}

int main(){
	int N,n,ans=-1;
	cin >> N;
	n = N/2;
	if(N==1){
		cout << 0 << endl;
		return 0;
	}
	vector<int> A(N),B(N);
	for(int i=0;i<N;i++) cin >> A[i];
	for(int i=0;i<N;i++) cin >> B[i];
	for(int ch=0; ch<=n; ch++){
		auto chodd = combination( n,ch );
		auto cheve = combination( N-n,ch );
		for(auto odds : chodd){
			for(auto eves : cheve){
				vector<pair<int,int>> odd,eve;
				for(int i=0;i<n;i++){
					if(odds&(1<<i)){
						eve.push_back({B[2*i+1],2*i+1});
					}else{
						odd.push_back({A[2*i+1],2*i+1});
					}
				}
				for(int i=0;i<N-n;i++){
					if(eves&(1<<i)){
						odd.push_back({B[2*i],2*i});
					}else{
						eve.push_back({A[2*i],2*i});
					}
				}
				sort(odd.begin(), odd.end());
				sort(eve.begin(), eve.end());
				vector<int> to_ind,value;
				for(int i=0;i<n;i++){
					value.push_back(eve[i].first);
					to_ind.push_back(eve[i].second);
					value.push_back(odd[i].first);
					to_ind.push_back(odd[i].second);
				}
				if(N&1){
					value.push_back(eve[n].first);
					to_ind.push_back(eve[n].second);
				}
				bool none = false;
				for(int i=0;i<N-1;i++) if(value[i]>value[i+1]) none = true;
				if(none) continue;
				int cnt = 0;
				set<int> se;
				for(int i=0;i<N;i++)se.insert(i);
				for(int i=0;i<N;i++){
					auto ind = se.lower_bound(to_ind[i]);
					int indc = 0;
					auto ite = se.begin();
					while(ite!=ind){ite++;indc++;}
					cnt += indc;
					se.erase(to_ind[i]);
				}
				if(ans==-1) ans = cnt;
				ans = min(ans,cnt);
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
s=input()
place=[]
for i in range(1,len(s)):
  if s[i]!=s[i-1]:
    place.append(i)
ans=[0 for i in range(len(s))]
cur_p=place[0]
cur_p_i=0
is_l=False
set_place=set(place)
for i in range(len(s)):
  if i in set_place:
    if is_l:
      cur_p_i+=2
      cur_p=place[cur_p_i]
    is_l=not is_l
  if (i-cur_p)%2==0:
    ans[cur_p]+=1
  else:
    ans[cur_p-1]+=1
print(" ".join(map(str,ans)))


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

using namespace std;
int main(){
	int a[3];
	int ans=0;
	for(int i=0;i<3;i++){
		cin>>a[i];
	}
	sort(a,a+3);
	ans++;
	for(int i=1;i<3;i++){
		if(a[i]!=a[i-1])ans++;
	}
	if(ans!=2)cout<<"No";
	else cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vi vector<int>
#define Vi vector<vector<int>>
#define ll long long
#define P pair<int,int>
#define vp  vector<P>
#define mod 1000000009
using namespace std;
int main(){
	int n,ac=0,wa=0,tle=0,re=0;
	cin>>n;
	while(n--){
		string temp;
		cin>>temp;
		switch(temp[0]){
			case 'A' : ac++; break;
			case 'W' : wa++; break;
			case 'T' : tle++; break;
			case 'R' : re++; break;
		}
	}
	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: 3632
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
ll dp[300][1000000];


ll n,k;
vector<ll> d;
void solve(){
    cin >> n >> k;
    int a=1;
    while (a*a<=n){
        d.push_back(a);
        if (a!=n/a) d.push_back(n/a);
        a+=1;
    }
    d.push_back(INF);d.push_back(0);
    int l=d.size();
    sort(d.begin(),d.end());
    d.push_back(INF);
    //cout << l << endl;
    dp[0][0]=0;
    Rep(i,1,l) dp[0][i]=1;
    rep(i,k){
        dp[i+1][0]=0;
        per1(j,l-2){
            dp[i+1][l-j-1]=(dp[i+1][l-j-2]+(n/d[j]-n/d[j+1])*dp[i][j]%mod) %mod;
        }
    }

    cout << dp[k][l-2] << endl;

    
}

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

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

int main() {
    int n, num, maximum = 0;
    cin >> n;
    map<string, int> temp;
    rep(i, n) {
        string t;
        cin >> t;
        temp[t]++;
    }
    for(auto itr = temp.begin(); itr != temp.end(); itr++) {
        if(itr -> second > maximum) maximum = itr -> second;
    }
    for(auto itr = temp.begin(); itr != temp.end(); itr++) {
        if(itr -> second == maximum) cout << itr -> first << endl;
    }
}

Measured memory_bytes: 25216
#include <iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include<iomanip>
#include<map>

using namespace std;
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define i64 int64_t
#define tos(x) to_string(x)


int main() {
	int n;
	cin >> n;
	vector<int> cl(3);
	vector<int> data(n);
	ff(i, 0, n) {
		cin >> data.at(i);
	}
	i64 ans = 1;
	ff(i, 0, n) {
		int y = data.at(i);
		int x = 0;
		ff(j, 0, 3) {
			if (cl.at(j) == y) {
				x++;
			}
		}
		ff(j, 0, 3) {
			if (cl.at(j) == y) {
				cl.at(j)++;
				break;
			}
		}
		ans *= x;
		ans %= 1000000007;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] sequence = new int[n];
    double denominator = 0;
    for(int i = 0; i < n; i++){
      sequence[i] = sc.nextInt();
      denominator += 1.0/sequence[i];
    }
    System.out.println(1/denominator);
  }
}

Measured memory_bytes: 21716
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	t := nextInts(n)
	m := nextInt()
	s := sum(t)
	for i := 0; i < m; i++ {
		p, x := nextInt(), nextInt()
		d := t[p-1] - x
		puts(s - d)
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func sum(a []int) int {
	ret := 0
	for _, v := range a {
		ret += v
	}
	return ret
}


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

int main() {
  int n,k,q; cin>>n>>k>>q;
  map<int,int> d;
  for(int i=0; i<q; i++){
    int a; cin>>a;
    a-=1;
    d[a]+=1;
  }
  
  for(int j=0; j<n; j++){
    int win=d[j];
    if (k-q+win>0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 5376
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		if(x < 0 || y < 0){
			System.out.println("No");
		}else if( (x - r) < 0){
			System.out.println("No");
		}else if( (x + r) > W){
			System.out.println("No");
		}else if( (y - r) < 0){
			System.out.println("No");
		}else if( (y + r) > H){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
}




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

// コンテスト中のみ
//#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const ll INF = 1LL << 60;

int n;
ll fib[45];
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n;
	fib[0] = 1; fib[1] = 1;
	for (int i = 2; i <= 44; i++) {
		fib[i] = fib[i - 1] + fib[i - 2];
	}
	cout << fib[n] << endl;
	return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string s,t;
  cin>>s>>t;
  int ans=0;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i]){
      ++ans;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3852
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

ll INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    string s;
    cin >> s;
    int i = 0;
    if(s.size()%2==1){
        cout << "No" << endl;
        return 0;
    }
    while(i<s.size()){
        if(s[i]=='h' && s[i+1]=='i') i+=2;
        else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(S: str):
    batsu_list = []
    maru_list = []
    for idx, s in enumerate(S):
        if idx == len(S)-1:
            break
        if S[idx] == 'R' and S[idx+1] == 'L':
            batsu_list.append(idx+1)

    for idx, s in enumerate(S):
        if idx == 0:
            maru_list.append(idx)
        if idx == len(S)-1:
            break
        if S[idx] == 'L' and S[idx+1] == 'R':
            maru_list.append(idx+1)
    maru_list.append(len(S))

    result = [0 for s in S]
    for idx, batsu in enumerate(batsu_list):
        left = batsu_list[idx] - maru_list[idx]
        right = maru_list[idx+1] - batsu_list[idx]
        result[batsu-1] += left//2
        result[batsu] += left//2
        if left % 2 == 1:
            result[batsu-1] += 1
        result[batsu] += right//2
        result[batsu-1] += right//2
        if right % 2==1:
            result[batsu] += 1

    print(' '.join([str(i) for i in result]))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14724
#include<bits/stdc++.h>
using namespace std;
int n;
double a[3000],dp[3000][3000];
int main(){
cin>>n;
for(int k=1;k<=n;k++){
   cin>>a[k];
}
dp[1][0]=(double)1-a[1];
dp[1][1]=a[1];
for(int k=2;k<=n;k++){
  for(int i=0;i<=n;i++){
        if(i>k)
        continue;
   if(i==0){
    dp[k][i]=((double)1-a[k])*dp[k-1][i];
  continue;
   }
    double t=dp[k-1][i-1]*a[k];
    double c=dp[k-1][i]*(double)((double)1-a[k]);
    dp[k][i]=c+t;
  }
}
double ans=0;
for(int k=(n/2)+1;k<=n;k++)
    ans+=dp[n][k];
    cout<<fixed;
cout<<setprecision(9)<<ans;
return 0;
}


Measured memory_bytes: 68864
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,ans=0;
  cin>>a>>b;
  int plug=1;
  while(true){
    if(b>plug){
      plug--;
      plug+=a;
      ans++;
    }
    else{
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
require 'matrix'

n, m, x = gets.split.map(&:to_i)
a = Matrix.zero(n, m + 1)
n.times do |i|
  b = gets.split.map(&:to_i)
  0.upto(m) do |j|
    a[i, j] = b[j]
  end
end
min = Float::INFINITY
1.upto(2 ** n - 1) do |bit|
  ans = 0
  sum = 0
  v = 0
  1.upto(m) do |j|
    v = Vector.elements(bit.to_s(2).rjust(n, "0").split('').map(&:to_i))
    sum = (a.column(j).covector * v)[0]
    break if sum < x
  end
  if sum >= x
    ans = (a.column(0).covector * v)[0]
    min = ans if min > ans
  end
end
puts (min == Float::INFINITY ? -1 : min)

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

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

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

	bool ok = 0;
	vector<vector<int>> d(n, vector<int>(3));
	for(int i = 0; i < n; i++) {
		cin >> d[i][0] >> d[i][1];
		if(i >= 2 && d[i][0] == d[i][1] && d[i - 1][0] == d[i - 1][1] && d[i - 2][0] == d[i - 2][1])
			ok = 1;	
	}

	if(ok)
		cout << "Yes" << '\n';

	else
		cout << "No" << '\n';
}


Measured memory_bytes: 3636
using System;
using System.Linq;

namespace D
{
    class Program
    {

        private static MinAndMax data = new MinAndMax();

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long tmp = 0L;
            var sum = Console.ReadLine()
                .Split()
                .Select(i =>
                {
                    tmp += long.Parse(i);
                    return tmp;
                })
                .ToArray();

            long ans = long.MaxValue;
            MinAndMax leftData;
            MinAndMax rightData;
            for (var i = 2; i < N - 1; i++)
            {
                // dataの初期化
                data.Min = 0;
                data.Max = 10000000000;
                LeftJudge(sum, 0, i, sum[i - 1]);
                leftData = data;

                // dataの初期化
                data.Min = 0;
                data.Max = 10000000000;
                RightJudge(sum, i, N - 1, sum[i - 1]);
                rightData = data;

                long min = Math.Min(leftData.Min, rightData.Min);
                long max = Math.Max(leftData.Max, rightData.Max);
                ans = Math.Min(ans, max - min);
            }
            Console.WriteLine(ans);
        }

        static void RightJudge(long[] array, int lidx, int ridx, long offset = 0L)
        {
            int middle = (ridx + lidx) >> 1;
            long left = array[middle] - offset;
            long right = array[array.Length - 1] - array[middle];
            if (Math.Abs(right - left) < data.Diff)
            {
                data.Min = Math.Min(left, right);
                data.Max = Math.Max(left, right);
            }
            if (left < right && ridx - lidx > 1)
            {
                RightJudge(array, middle, ridx, offset);
            }
            else if (left > right && ridx - lidx > 1)
            {
                RightJudge(array, lidx, middle, offset);
            }
        }

        static void LeftJudge(long[] array, int lidx, int ridx, long end)
        {
            int middle = (ridx + lidx) >> 1;
            long left = array[middle];
            long right = end - array[middle];
            if (Math.Abs(right - left) < data.Diff)
            {
                data.Min = Math.Min(left, right);
                data.Max = Math.Max(left, right);
            }
            if (left < right && ridx - lidx != 1)
            {
                LeftJudge(array, middle, ridx, end);
            }
            else if (left > right && ridx - lidx != 1)
            {
                LeftJudge(array, lidx, middle, end);
            }
        }
    }
    struct MinAndMax
    {
        public long Min;
        public long Max;
        public long Diff { get { return Max - Min; } }
    }
}


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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> a(m);
  rep(i, m) cin >> a.at(i);
  vector<int> s(n + 1, 0);
  rep(i, n + 1) {
    int cost = 0;
    if (find(a.begin(), a.end(), i) != a.end()) {
      cost = 1;
    }
    if (i == 0) {
      s.at(i) = cost;
    } else {
      s.at(i) = s.at(i - 1) + cost;
    }
  }
  int res = min(s.at(n) - s.at(x), s.at(x) - s.at(0));
  cout << res << endl;

  return 0;
}


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

int main()
{
  string S;
  cin >> S;
  
  if (S == "ABC")
  {
    printf("ARC");
  }
  else
  {
    printf("ABC");
  }
  
  return 0;
}


Measured memory_bytes: 3720
from collections import deque
n=int(input())
s=input()
ans=deque(s)
cnt=0
for i in range(n):
  if (cnt==0)and(s[i]==')'):
    ans.appendleft('(')
  elif (cnt!=0)and(s[i]==')'):
    cnt-=1
    pass
  elif s[i]=='(':
    cnt+=1
if cnt>0:
  ans.append(')'*cnt)
print(''.join(ans))

Measured memory_bytes: 3316
#include<iostream>
using namespace std;
int main(){
  int n;
  scanf("%d", &n);
  long long x;
  int a1=0,a2=0,a4=0;
  for(int i=0;i<n;i++){
    scanf("%lld",&x);
    if(x%4 == 0){
      a4++;
    } else if(x%2 == 0){
      a2++;
    } else {
      a1++;
    }
  }
  if(a1 > a4){
    if(a1 == (a4 + 1) && a2 == 0){
      printf("Yes");
    } else {
      printf("No");
    }
  } else {
    printf("Yes");
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,a[100],now_money=1000;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }

  for(int i=0;i<n-1;i++){
    long long stock=0;
    if(a[i] < a[i+1]){
      stock = now_money / a[i];
      now_money += (a[i+1] - a[i]) * stock;
    }
  }
  cout << now_money << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, m;
int cum[100010];

signed main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int l, r; cin >> l >> r;
		int ma = 0;
		int q = sqrt(r);
		for (int j = 1; j <= q; j++) {
			int p = r / j;
			int s = (l - 1) / p + 1;
			int t = r / p;
			cum[max(ma + 1, s)]++;
			cum[t + 1]--;
			ma = t;
		}
		for (int j = q; j >= 1; j--) {
			if (j*j == r)continue;
			int s = (l - 1) / j + 1;
			int t = r / j;
			cum[max(ma + 1, s)]++;
			cum[t + 1]--;
			ma = t;
		}
	}
	for (int i = 1; i <= m; i++) {
		cum[i] += cum[i - 1];
		cout << cum[i] << endl;
	}
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
 
void solve(){
    ll n,k;
    cin>>n>>k;
    ll h[n];
    ll ans = 0;
    loop(i,0,n) cin>>h[i];
    loop(i,0,n){
        if(h[i] >= k) ans++;
    }
    print(ans);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
  
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int n,a[1005];

bool check(int x)
{
	int t=x%10;
	x/=10;
	while(x)
	{
		if(x%10!=t-1)return 0;
		t=x%10;
		x/=10;
	}
	return 1;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",a+i);
	int ans=-1;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(check(a[i]*a[j]))
				ans=max(ans,a[i]*a[j]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3216
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))

#define fillInt(xs)        \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%ld", &xs[i]);
#define fillDouble(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%lf", &xs[i]);
#define fillString(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define concat(xs, ys) (xs).insert((xs).end(), (ys).begin(), (ys).end())

const int mod = 1000000007;

long sum[32][2];

struct tome {
  long s;
  long t;
  long x;
};

struct dd {
  long start = INF;
  long end = INF;
  long x = INF;
};

dd dds[200005];

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

  long n, q;
  cin >> n >> q;

  vector<tome> tomes;
  rep(i, n) {
    long s, t, x;
    cin >> s >> t >> x;
    tomes.push_back(tome({s, t, x}));
  }
  sort(tomes.begin(), tomes.end(), [](tome lhs, tome rhs) {
     return lhs.x < rhs.x;
  });

  vector<long> ds;
  rep(i, q) {
    long d;
    cin >> d;
    ds.push_back(d);
  }

  rep(i, n) {
    int l1 = lbv(ds, tomes[i].s - tomes[i].x);
    int l2 = lbv(ds, tomes[i].t - tomes[i].x);
    if (l1 == q) continue;
    int now = l1;
    while(now < l2) {
      if (dds[now].start != INF) {
        now = dds[now].end;
      } else {
        dds[now].start = l1;
        dds[now].end = l2;
        dds[now].x = tomes[i].x;
        now++;
      }
    }
  }

  rep(i, q) {
    cout << (dds[i].x == INF ? -1: dds[i].x) << endl;
  }
}


Measured memory_bytes: 15468
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

int main() {
	int k,a,b;
	cin >> k >> a >> b;
	for (int i = a; i <= b; i++) {
		if (i % k == 0) {
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
int main()
{
	int n,l,i,sum=0;
	char a[1000000];
	scanf("%s",a);
	l=strlen(a);
	for(i=0;i<l;i++)
	{
		sum+=a[i]-'0';
	}
//	printf("%d\n",sum);
	if(sum%9==0)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
}

Measured memory_bytes: 1800
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.nextInt();
		int q = sc.nextInt();
		String s = sc.next();
		AC2 ac = new AC2(s);
		int[] anses = new int[q];
		for (int i = 0; i < q; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			anses[i] = ac.getAC(l, r);
		}
		for (int ans : anses) {
			System.out.println(ans);
		}
		
	}
	
}

class AC2 {
	int[] acCounts;
	AC2(String s) {
		acCounts = new int[s.length()];
		boolean isBeforeA = false;
		int acCount = 0;
		for (int i = 0; i < s.length(); i++) {
			char ch = s.charAt(i);
			if (isBeforeA) {
				if (ch == 'C') {
					acCount++;
					acCounts[i] = acCount;
					isBeforeA = false;
					continue;
				}
			}
			acCounts[i] = acCount;
			isBeforeA = (ch == 'A') ? true : false;
		}
	}
	int getAC(int l, int r) {
		return acCounts[r - 1] - acCounts[l - 1];
	}
}


Measured memory_bytes: 81768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    Int n; cin>>n;
    vector<Int> a(n,0);
    for(Int i=0; i<n; i++) cin>>a[i];
    Int m; cin>>m;
    vector<Int> b(m,0);
    bool flag=true;
    for(Int i=0; i<m; i++) {
        cin>>b[i];
    }
    if(includes(a.begin(),a.end(),b.begin(),b.end())) cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 5872
#include <iostream>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define REP(i, n) for(LL i=0; i<(n); i++)
#define FOR(i, m, n) for(LL i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define MP make_pair
#define PB push_back
#define INF INT_MAX

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	LL a, b, c, ans = 0;
	cin >> a >> b >> c;
	if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1)ans = 0;
	else if (a == b && b == c)ans = -1;
	else {
		while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
			LL A = a, B = b, C = c;
			a = (B + C) / 2;
			b = (A + C) / 2;
			c = (A + B) / 2;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>
#include <chrono>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

s64 update_score(const set<int>& last, int day, int prev, int c, int max_d)
{
    s64 ret = 0;
    auto itr = last.upper_bound(day);
    int l, r;
    if (itr == last.end())
    {
        r = max_d + 1;
        l = *--itr;
    }
    else
    {
        r = *itr;
        l = *--itr;
    }
    ret -= (s64)((day - prev) + (r - 1 - prev)) * (r - day) / 2;
    ret += (s64)((day - l) + (r - 1 - l)) * (r - day) / 2;

    return c * ret;
}

int main()
{
    chrono::system_clock::time_point start;
    start = chrono::system_clock::now();

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

    const int DAY = 365;
    const int NUM = 26;
    const int LIM = 1900;
    int d;
    cin >> d;
    s64 c[NUM];
    rep (i, NUM)
    {
        cin >> c[i];
        c[i] = -c[i];
    }

    int s[DAY][NUM];
    rep (i, d) rep (j, NUM) cin >> s[i][j];

    set<int> last[NUM];
    rep (i, NUM) last[i].insert(0);

    // random
    int t[DAY];
    srand(chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count());
    rep (i, d)
    {
        t[i] = rand() % NUM;
    }

    // random
    s64 v;
    v = 0;
    rep (i, d)
    {
        v += s[i][t[i]];
        last[t[i]].insert(i + 1);
        rep (j, NUM)
        {
            v += c[j] * ((i + 1) - *last[j].rbegin());
        }
    }

    s64 score = v;
    int T = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();
    int cnt = 0;
    while (T < LIM)
    {
        int dd = cnt++ % d + 1;//random() % d + 1;
        int q = random() % NUM;
        int p = t[dd - 1];
        v += s[dd - 1][q] - s[dd - 1][p];

        last[p].erase(dd);
        last[q].insert(dd);
        auto itr = last[q].lower_bound(dd);
        int prevq = *--itr;

        v += update_score(last[p], dd, dd, c[p], d);
        v += update_score(last[q], dd, prevq, c[q], d);
        if (T < rand() % LIM || score < v)
        {
            t[dd - 1] = q;
            score = v;
        }
        else
        {
            v = score;
        }
        T = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();
    }

    rep (i, d)
    {
        cout << t[i] + 1 << "\n";
    }

    // cout << "after: " << score << "\n";
    // cout << "cnt = " << cnt << "\n";

    return 0;
}



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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;

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

    vector<vector<int>> dp(n, vector<int>(n, -1));

    auto get = [&](int i, int j) {
        if (i == n || j == n) return 0;
        return dp[i][j];
    };

    for (int i = n - 1; i >= 0; i--) {
        for (int j = n - 1; j >= 0; j--) {
            if (s[i] != s[j]) dp[i][j] = 0;
            else dp[i][j] = get(i + 1, j + 1) + 1;
        }
    }

    int ans = 0;
    rep(i, n) {
        rep(j, n) {
            int now = dp[i][j];
            now = min(now, abs(i - j));
            cmax(ans, now);
        }
    }
    cout << ans << endl;
}





Measured memory_bytes: 98304
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define sort(vec) sort(vec.begin(),vec.end())
#define reverse(vec) reverse(vec.begin(),vec.end())
int gcd(int x,int y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
int w,h,n;
int x[200],y[200],a[200];
int maxx,maxy,minx=0,miny=0;
signed main(){
    cin>>w>>h>>n;
    maxx=w;
    maxy=h;
    rep(i,n){
        cin>>x[i]>>y[i]>>a[i];
        if(a[i]==1)minx=max(minx,x[i]);
        else if(a[i]==2)maxx=min(maxx,x[i]);
        else if(a[i]==3)miny=max(miny,y[i]);
        else maxy=min(maxy,y[i]);
    }
    int wi=maxx-minx;
    int hi=maxy-miny;
    int ans=wi*hi;
    if(maxx<=minx||maxy<=miny)ans=0;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256