akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int a = Integer.valueOf(arr01[0]);
        int b = Integer.valueOf(arr01[1]);
        int m = Integer.valueOf(arr01[2]);

        int arr02[] = new int[a];
        int arr03[] = new int[b];

        int j = 0;
        for (String x : mylist.get(1).split(" ")) {
            arr02[j] = Integer.valueOf(x);
            j += 1;
        }

        j = 0;
        for (String x : mylist.get(2).split(" ")) {
            arr03[j] = Integer.valueOf(x);
            j += 1;
        }

        //        //配列一覧出力
        //        System.out.println(Arrays.toString(arr02));
        //        System.out.println(Arrays.toString(arr03));

        int mindata = Integer.MAX_VALUE;
        for (int i = 3; i < 3 + m; i++) {

            int temp = 0;
            String arr_temp[] = mylist.get(i).split(" ");

            int x = Integer.valueOf(arr_temp[0]);
            int y = Integer.valueOf(arr_temp[1]);
            int c = Integer.valueOf(arr_temp[2]);

            temp = arr02[x - 1] + arr03[y - 1] - c;
            mindata = Math.min(mindata, temp);

        }

        //        System.out.println(mindata);
        Arrays.sort(arr02);
        Arrays.sort(arr03);

        mindata = Math.min(mindata, arr02[0] + arr03[0]);
        System.out.println(mindata);

    }

}


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

int comp(const void *n1,const void *n2);

int main(void){
	int n,i,sum=0;
	int stick[200];
	
	scanf("%d",&n);
	for(i=0;i<2*n;i++) scanf("%d",&stick[i]);
	
	qsort(stick,2*n,sizeof(int),comp);
	for(i=0;i<2*n;i+=2){
		sum+=stick[i];
	}
	
	printf("%d\n",sum);
	return 0;
}

int comp(const void *n1,const void *n2){
	int d1,d2;
	d1=*((const int *)n1);
	d2=*((const int *)n2);
	return d1-d2;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

using namespace std;

int a,b,c,d;

int main(){
  cin>>a>>b>>c>>d;
  if( ((d >= abs(b-a)) && (d >= abs(c-b)) ) || (d>= abs(c-a)) ) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define endl "\n"
 
const LD EPS=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}


template<typename T, typename U>
ostream& operator << (ostream& os, const pair<T, U>& p)
{
	os<<'('<<p.first<<", "<<p.second<<')';
	return os;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}

template<typename Head, typename... Tail>
struct vector_demensions
{
	using type=vector<typename vector_demensions<Tail...>::type>;
};

template<typename Head>
struct vector_demensions<Head> { using type=Head; };

template<typename T>
vector<T> make_vectors(int size, T val)
{
	return vector<T>(size, val);
}

template<typename T=int, typename... Args>
auto make_vectors(int size, Args... tail)
	-> typename vector_demensions<Args..., T>::type
{
	auto val=make_vectors<T>(forward<Args>(tail)...);
	return vector<decltype(val)>(size, val);
}

int main()
{
	int n;
	cin>>n;
	auto a(read<int>(n));
	int l=0,r=0;
	LL ans=0;
	int ls=0,rs=0;
	while(1)
	{
		if(ls!=rs || r==n)
		{
			//print(l,r);
			if(ls==rs)
			ans+=(r-l);
			else
			ans+=(r-l-1);
			ls^=a[l];
			rs-=a[l];
			l++;
			if(l==n) break;
		}
		else
		{
			ls^=a[r];
			rs+=a[r];
			r++;
		}
	}
	print(ans);

}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)

int main(){
  ll N;
  cin >> N;
  ll tmp;
  vector<pair<ll, ll>> pairs;
  rep(i,N){
    cin >> tmp;
    pairs.push_back(make_pair(tmp, i+1));
  }
  
  sort(pairs.begin(), pairs.end());
    
  rep(i,N) cout << pairs[i].second << " ";

}

Measured memory_bytes: 2544
def main():
    D = int(input())
    c = list(map(int, input().split()))
    last = [0] * 27
    for d in range(1, D+1):
        s = list(map(int, input().split()))
        max_s = max(s)
        index_s = s.index(max_s)
        print(index_s + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  long long answer=0;
  for(int i = 1 ; i<= n ;i++){
    if(i%3==0 || i%5==0)answer+=0;
    else answer+=i;
  }
  cout<<answer;
}


Measured memory_bytes: 3608
def calc_third_root(q):
    x = q / 2
    while not (abs(x ** 3 - q) < 0.00001 * q):
        x = x - (x ** 3 - q) / (3.0 * x ** 2)
    return x

while 1:
    q = int(input())
    if q == -1:
        break
    result = calc_third_root(q)
    print("{:.6f}".format(result))


Measured memory_bytes: 5664
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) ((a)<<(b))
#define Rshift(a,b) ((a)>>(b))
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define sz(a) int(a.size())
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int s, w;
    cin >> s >> w;
    if (w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}


Measured memory_bytes: 3612
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 0
r = 10**9+1

def ok(x):
    cnt = 0
    for b in a:
        cnt += (b//x)
        if b%x == 0:
            cnt -= 1
    return cnt <= k

while r-l > 1:
    md = (l+r)//2
    if ok(md):
        r = md
    else:
        l = md
print(r)

Measured memory_bytes: 31140
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    double x[N];
    string u[N];
    for(int i = 0; i < N; i++)
    {
        cin >> x[i];
        cin >> u[i];
    }
    double sum = 0;
    for(int i = 0; i < N; i++)
    {
        if(u[i] == "JPY"){
            sum += x[i];
        }else{
            sum += x[i] * 380000.0;
        }
    }
    cout << sum << endl;
    
}

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

int main() {
  int N , A , B , C , D;
  
  cin >> N;
  
  D = N % 10;
  C = (N - D) % 100 / 10;
  B = (N - D - C * 10) % 1000 / 100;
  A = (N - D - C * 10 - B * 100) % 10000 / 1000;

    if ((A == B && B == C) || (B == C && C == D)) {
      cout << "Yes" << endl;
    }
  	else {
      cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#pragma region Template
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RNG(i, a, b) for(int i = a; i < b; i++)
#define RBF(i, v) for(auto& i : v)
#define ALL(x) x.begin(), x.end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;
template<typename T> using VP = vector<pair<T, T>>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }
#pragma endregion

signed main() {
	LL n, m, k;
	cin >> n >> m >> k;
	V<LL> a(n + 1, 0), b(m + 1, 0);
	RNG(i, 1, n+1) {
		LL ai;
		cin >> ai;
		a[i] = ai + a[i - 1];
	}
	RNG(i, 1, m + 1) {
		LL bi;
		cin >> bi;
		b[i] = bi + b[i - 1];
	}

	LL time = k, anum = 0, bnum=0, ans=0;
	RBF(ai, a) {
		if (k < ai) break;
		time = k - ai;
		auto iter = upper_bound(ALL(b), time);
		ans = max(ans, anum + distance(b.begin(), iter) - 1);
		anum++;
	}

	col(ans);
	return 0;
}


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

int main(){
    int n,m;
    int i;
    cin >> n >> m;
    int a[m];
    rep(i,m){
        cin >> a[i];
        n -= a[i];
    }
    if(n < 0){
        cout << -1 << endl;
    }else{

    cout << n << endl;

    }
    return 0;
}

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


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    s = readstr()
    l = []
    for i, x in enumerate(s):
        if not i % 2:
            l.append(x)

    print(''.join(l))


if __name__ == "__main__":
    main()


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

int main() {
	int N, D;
	cin >> N >> D;
	vector<vector<ll>> P(N,vector<ll>(D));
	for (int i = 0;i < N;i++) {
		for (int j = 0;j < D;j++)
			cin >> P[i][j];
	}
	ll cnt, c, ans = 0;
	for (int i = 0;i < N;i++) {
		for (int j = i + 1;j < N;j++) {
			cnt = 0;
			for (int k = 0;k < D;k++) {
				cnt += (abs(P[i][k] - P[j][k]))*(abs(P[i][k] - P[j][k]));
			}
			c = sqrt(cnt);
			if (c*c == cnt) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
s = str(input())


N = 0
number1 = list(range(10))


for i in range(0,n-2):
    if int(s[i]) in number1:
        number1.remove(int(s[i]))
        number2 = list(range(10))
        for j in range(i + 1,n - 1):
            
            if int(s[j]) in number2:
                number2.remove(int(s[j]))
                number3 = list(range(10))
                for k in range(j + 1,n):
                    if int(s[k]) in number3:
                        number3.remove(int(s[k]))
                        N += 1
                        if N == 1000:
                            break
"""
                        print(s[i]+s[j]+s[k])
                        print("{}{}{}".format(i,j,k))
"""
                        

print(N)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	vector<int> a(n, -1);
	for (int i = 0; i < n; ++i)
	{
		int x;
		cin >> x;
		x --;
		if (x == 0)
			a[x] = 0;
		else
		{
			if (a[x - 1] == x - 1)
				a[x] = x;
		}
	}
	int mx = *max_element(a.begin(), a.end());
	if (mx == -1)
		cout << -1 << '\n';
	else
		cout << n - mx - 1 << '\n';
	return 0;
}

Measured memory_bytes: 4008
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ull unsigned long long int 
#define pb push_back
#define xx first
#define yy second

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t;
	t=1;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		ll i,ans=0;
		ll cnt=0;
		for(i=0;i<n;i++)
		{
		    if(s[i]=='R')
		        cnt++;
		}
		
		for(i=0;i<cnt;i++)
		{
		    if(s[i]!='R')
		        ans++;
		}
		
		cout<<ans;
	}
}

Measured memory_bytes: 3732
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	if (s == "abc") cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


class Combination:
    def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

    def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD


C = Combination()

n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
for i in range(n):
    ans = (ans + A[i]*(i+2)) % MOD

ans = (ans * pow(4, n-1, MOD)) % MOD
print(ans)


Measured memory_bytes: 92492
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     PI                       acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void GO(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=200000+9,mod=1e9+7;
int main(){
    GO();

    int T;
  //  cin>>T;
    T=1;
    while(T--){

        string s;
        cin>>s;
        if(s[sz(s)-1]=='s') s+='e',s+='s';
        else
            s+='s';
       cout<<s<<"\n";

    }
}



















































































































































































Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int H, W; cin >> H >> W;
  string head = ""; rep(i, W+2) head += "#";
  string foot = ""; rep(i, W+2) foot += "#";  

  cout << head << endl;
  rep(i, H) {
    string a; cin >> a;
    cout << "#" << a << "#" << endl;
  }
  cout << foot << endl;
  return 0;
}

Measured memory_bytes: 256
#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 <iomanip>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
	int n;
	cin>>n;
	long long int ans = 0;
	string s;
	map<string,long long int> a;
	rep(i, n) {
		cin >> s;
		sort(s.begin(), s.end());
		ans+=a[s];
		a[s]++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 11136
#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>;

const double PI = acos(-1);

int main() {
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double angle_m = m / 60 * 2 * PI;
  double angle_h = (h / 12 + +m / 720) * 2 * PI;
  double ans = sqrt(a * a + b * b - 2 * a * b * cos(abs(angle_h - angle_m)));
  cout << fixed << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 4216
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

int main(void){
    char s[200005];
    ll a,b,c,d,n;
    scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
    scanf("%s",s);
    // ll [n];
    rep(i,a,c){
        if(s[i]=='#' && s[i-1]=='#' ){
            NO;
            return 0;
        }
    }

    if(c<d){
        rep(i,b,d){
            if(s[i]=='#' && s[i-1]=='#' ){
                NO;
                return 0;
            }
        }
        YES;
    }else{
        ll row=0;
        rep(i,b-2,d+1){
            if(s[i]=='.'){
                row++;
                if(row>2){
                    YES;
                    return 0;
                }
            }else{
                row=0;
            }
        }
        NO;
    }

    
    return 0;
}


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def bin_sort(A,n_min=None,n_max=None):
    if(n_min is None): n_min=min(A)
    if(n_max is None): n_max=max(A)
    bin=[0]*(n_max-n_min+1)
    for a in A: bin[a-n_min]+=1
    B=[]
    for i in range(n_min,n_max+1): B[len(B):len(B)]=[i]*bin[i-n_min]
    return B

def resolve():
    n=int(input())
    A=[0]*n
    for a in map(int,input().split()): A[a-1]+=1
    A=bin_sort(A,0,n)
    S=[0]*(n+1)
    for i in range(n): S[i+1]=S[i]+A[i]
    # output
    p=n; i=n
    for k in range(1,n+1):
        while(1):
            while(1):
                if(i<=0 or A[i-1]<p): break
                i-=1
            if(S[i]+p*(n-i)>=k*p): break
            p-=1
        print(p)
resolve()

Measured memory_bytes: 105512
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)[:x]
q=sorted(q,reverse=True)[:y]
print(sum(sorted(p+q+r, reverse=True)[:x+y]))

Measured memory_bytes: 23328
#include<bits/stdc++.h>
using namespace std;int dp[999],a[999],l[999],r[999],m[999],N,Q,i,j,k,OK;main(){cin>>N;for(i=0;i<N;i++)cin>>l[i]>>r[i]>>m[i];for(i=0;i<N;i++)for(j=0;j<400;j++)for(k=l[i];k<=r[i];k++)dp[j+k]=max(dp[j+k],dp[j]+m[i]);cin>>Q;for(i=0;i<Q;i++){cin>>a[i];OK=dp[a[i]]?OK:1;}if(OK)cout<<"-1\n";else for(i=0;i<Q;i++)cout<<dp[a[i]]<<endl;}

Measured memory_bytes: 1176
#include <iostream>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())



template <class T> inline int argmin(std::vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(std::vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



int main(void){
  int n; scanf("%d\n", &n);
  string s;
  Wint Data(n, Vint(26, 0));
  REP(i, n){
    cin >> s;
    vREP(ele, s) Data.at(i).at(ele - 'a')++;
  }
  string res;
  REP(j, 26){
    int mn = INFi;
    REP(i, n) chmin(mn, Data.at(i).at(j));
    REP(k, mn) res += (char)(j + 'a');
  }
  cout << res << BR;
  return 0;
}

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

int main(void){
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int ans = 0;
    int max_h = 0;
    for(int i = 0; i < n; i++)
    {
        bool flag = true;
        max_h = max(max_h, h.at(i));
        if(max_h != h.at(i)) flag = false;
        if(flag) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
/*
	　　　  　 ,ﾍ／L──- 、
	　　　   　Lﾆ)r_」=＝= ｲ
	　　 　,ﾍ、i ﾉノλﾉﾊﾉﾍ
	　　   ,'　｀(ﾊﾘ ﾟ ヮﾟﾉi)　',
	　　 .i　　 >〈(つ,i!と)　　i
	　　  vﾍγk´_/___i,ゝﾍノ
	　　　　　 ｀ﾞr_,ｨ_ｧﾞ´
*/
string s;
string ans;
cin >> s;
rep0(i,s.length() - 1) {
	if (s[i] == '0' || s[i] == '1') ans += s[i];
	else {
		if (ans.length() > 0) ans.pop_back();
	}
}
cout << ans; 
return 0;
}


Measured memory_bytes: 256
<?php
    fscanf(STDIN,"%s", $s);
    $array = str_split($s);
    $count = 0;
    for($i = 0; $i < count($array); $i++){
      if($array[$i] === '+'){
        $count += 1;
      }else{
        $count -= 1;
      }
    }
    echo $count;
    
  ?>

Measured memory_bytes: 4604
#include <stdio.h>

int main()
{
  int n, i, j, k, X, ans=0, x[256];
  scanf("%d", &n);
  while(n != 0)
    {
      for(i=0; i<n; i++)
        {
          scanf("%d", &x[i]);
        }
      for(j=0; j<n-1; j++)
        {
          X = x[0];
          for(k=0; k<n-j-1; k++)
            {
              if(X > x[k+1])
                {
                  x[k] = x[k+1];
                  x[k+1] = X;
                  ans++;
                }
              else
                {
                  X = x[k+1];
                }
            }
        }
      printf("%d\n", ans);
      ans=0;
      scanf("%d", &n);
    }
  return 0;
}

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

int main(){
	int a,b=0,c=0;
	string d,e;
	cin >>a;
	for(int i=0;i<a;i++){
		cin>>d>>e;
		if(d.compare(e)>0){b=b+3;}
		else if(d.compare(e)==0){b++;c++;}
		else if(d.compare(e)<0){c=c+3;}
	}
	cout <<b<<" "<<c<<endl;
	return 0;
}

Measured memory_bytes: 3192
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
int main(){
	ll n;	scanf("%lld", &n);
	printf("%lld\n", n * 800 - n / 15 * 200);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

const int N=1e6+5,Mo=1e9+7,inv3=(Mo+1)/3;

int n,inv[N];

int main() {
	scanf("%d",&n);
	inv[0]=inv[1]=1;fo(i,2,n) inv[i]=(ll)(Mo-Mo/i)*inv[Mo%i]%Mo;
	int ans=0;
	for(int pw=inv3,i=1;i<=n;i++,pw=(ll)pw*inv3%Mo) (ans+=(ll)inv[n-i+1]*pw%Mo)%=Mo;
	printf("%d\n",(ll)ans*inv[n]%Mo);
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
int lcm(int a, int b){
  return a / gcd(a,b) * b;
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int h,n; cin >> h >> n;
  int a;
  
  rep(i,n){
    int t; cin >> t;
    a += t;
  }
  
  if(a>=h) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int n,a[100]={0};
   cin>>n;
   for(int i=0;i<n;i++){
       cin>>a[i];

   }

   for(int i=n-1;i>=0;i--){
       if(i==n-1){
           cout<<a[i];
       }
       else{
       cout<<" "<<a[i];
}
}
   cout<<endl;

}


Measured memory_bytes: 3080
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);



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

	string S;
	cin >> S;
	int ans = 0;
	rep(i, 4)ans += S[i] == '+' ? 1 : (-1);
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int INF = 0x3f3f3f3f;
const int N = 100005;
#define ll long long
int cmp(int a,int b){
	return a>b;
}	
int gcd(int x, int y)
{
    while(y^=x^=y^=x%=y);
    return x;
}
int main(){
	int n;
	cin >> n;
	int a[200005],f[200005];
	memset(f,0,sizeof(f));
	for(int i=1;i<n;i++){
		cin >> a[i];
		f[a[i]] ++;
	}
	for(int i=1;i<=n;i++){
		cout << f[i] <<endl;
	}	
	return 0;
}



Measured memory_bytes: 5188
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int n,total=0;
	cin>>n;
	cin>>s;
	for(int i=0;i<n-2;i++){
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') total++;
	}
	cout<<total;
	return 0;
}

Measured memory_bytes: 256
n,m = list(map(int, input().split()))
dp = [1]*(n+1)
for _ in range(m):
    dp[int(input())] = 0

for index,value in enumerate(dp):
    if index == 0 or index == 1:
        continue
    if dp[index] == 0:
        continue
    dp[index] = dp[index-1] + dp[index -2]
print(dp[n]%1000000007)

Measured memory_bytes: 468856
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
#define N 100007
#define pb push_back;
vector<ll> v[N];
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);

int main()
{
    string s;
    cin>>s;
    ll sm=0;
    ll n=s.length();
    ll i;
    for(i=0;i<n;i++)
    {
        if(s[i]=='?')
        {
            s[i]='D';
        }
    }
    cout<<s;
}

Measured memory_bytes: 6096
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class220
    {
        static void Main()
        {
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NM[0], M = NM[1];
            int S = A.Sum();
            int count = 0;
            for (int i = 0; i < N; i++)
            {
                if (A[i] >= (double)S / (4 * M))
                {
                    count++;
                }
            }
            Console.WriteLine(count >= M ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13396
use std::io::*;
use std::str::FromStr;

pub 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")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}

use std::cmp::{max, min};
use std::collections::VecDeque;

fn main() {
  let n: usize = read();
  let a: Vec<f64> = read_n(n);
  // let mut keta_memo = vec![0; 42];
  let mut all_mul: f64 = 1.0;
  for i in &a {
    all_mul *= *i;
  }

  let mut all_add: f64 = 0.0;
  for i in a {
    all_add += all_mul / i;
  }

  println!("{}", all_mul / all_add);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define SQ(a) (a)*(a)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define ll long long int 
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

bool myfind(vector<string> &arr, int x)
{
	string key = arr[x];
	for (int i = 0; i < arr.size(); i++)
	{
		if (i != x && arr[i] == arr[x])
		{
			return true;
		}
	}
	return false;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	cout.tie(NULL);
	int n;
	cin >> n;
	vector<string> arr(n);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	bool flag = false;
	for (int i = 1; i < n; i++)
	{
		if (myfind(arr, i))
		{
			flag = true;
			break;
		}
		if (arr[i - 1].back() != arr[i].front())
		{
			flag = true;
			break;
		}
	}
	if (flag)
		cout << "No\n";
	else 
		cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 256
from itertools import accumulate
N, C = map(int, input().split())
STC = [list(map(int, input().split())) for _ in range(N)]

M = 10**5+1
merge = [[0]*(M+1) for _ in range(31)]
for i in range(N):
    s, t, c = STC[i]
    merge[c][s] += 1
    merge[c][t+1] -= 1
for c in range(31):
    merge[c] = list(map(lambda x: int(bool(x)), accumulate(merge[c])))

ans = []
for i in range(M+1):
    res = 0
    for j in range(31):
        res += merge[j][i]
    ans.append(res)
print(max(ans))


Measured memory_bytes: 121304
#include<stdio.h>
int main(void)
{
    int N,a[100];
    int i,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;
    
    scanf("%d",&N);
  
    for(i=0;i<N;i++)
      scanf("%d",&a[i]);
  
    for(i=0;i<N;i++){
      if(a[i]<=399) j++;
      else if(a[i]<=799) k++;
      else if(a[i]<=1199) l++;
      else if(a[i]<=1599) m++;
      else if(a[i]<=1999) n++;
      else if(a[i]<=2399) o++;
      else if(a[i]<=2799) p++;
      else if(a[i]<=3199) q++;
      else r++;
    }
  
      if(j>0) s++;
      if(k>0) s++;
      if(l>0) s++;
      if(m>0) s++;
      if(n>0) s++;
      if(o>0) s++;
      if(p>0) s++;
      if(q>0) s++;
  
      if(r==N) printf("1 %d\n",N);
      else printf("%d %d\n",s,s+r);
  
      return 0;
}
      


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define int long long 

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

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

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

  int s = 0, k = 0;
  for(int i = 1; s < n; i++){
    s += i;
    k = i;
  }

  for(int i = 1; i <= k; i++){
    if(i != s-n){
      cout << i << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Security;
using System.Xml.Serialization;

namespace AtCoderCs
{

    class Program
    {

        const int Mod = 1000000007;

        static void Main()
        {

            var arg = Console.ReadLine().ToCharArray();
            var compare = Console.ReadLine().ToCharArray();

            for (int i = 0, l = arg.Length; i < l; i++)
                if (arg[i] != compare[i])
                {
                    Console.WriteLine("No");
                    return;
                }

            Console.WriteLine("Yes");

        }


    }
}

Measured memory_bytes: 25792
#include"bits/stdc++.h"
using namespace std;
 
int h;
int w;
 
char buf[13][13];
 
vector<string> v;
 
 
vector<pair<int, bitset<10397> > > ava[13];
 
bitset<10397> dp[1 << 12];
 
vector<vector<pair<int, int> > > way;
 
set<int> us;
vector<pair<int, int> > C;
inline void dfs(int cur,bool pass=false) {
	if (cur == v[0].size()) {
		way.push_back(C);
		return;
	}
	if (us.count(cur)) {
		dfs(cur + 1,pass);
		return;
	}
	else {
		if(pass==false)dfs(cur + 1, true);
	}
	us.insert(cur);
	for (int i = cur + 1; i < v[0].size(); i++) {
		if (us.count(i))continue;
		C.push_back(make_pair(cur, i));
		us.insert(i);
		dfs(cur+1,pass);
		C.pop_back();
		us.erase(i);
	}
	us.erase(cur);
}
char tmp[13][13];
map<char, int> mp;
int main() {
	cin >> h >> w;
	if (h == 1 && w == 1) {
		puts("YES");
		return 0;
	}
	for (int i = 0; i < h; i++) {
		scanf("%s", buf[i]);
	}
	if (w == 1) {
		for (int i = 0; i < h; i++) {
			buf[0][i] = buf[i][0];
		}
		swap(h, w);
	}
	for (int i = 0; i < h; i++) {
		string emp = "";
		v.push_back(emp);
		for (int j= 0; j < w; j++) {
			v.back().push_back(buf[i][j]);
		}
	}
	dfs(0);
	if (h == 1) {
		for (int i = 0; i < w; i++) {
			mp[buf[0][i]]++;
			mp[buf[0][i]] %= 2;
		}
		int cc = 0;
		for (auto el : mp) {
			if (el.second) {
				cc++;
			}
		}
		if (cc > 1) {
			puts("NO");
		}
		else {
			puts("YES");
		}
		return 0;
	}
	for (int i = 0; i < v.size(); i++) {
		for (int j = i + 1; j < v.size(); j++) {
			bitset<10397> can;
			int len = v[i].size();
			for (int k = 0; k <way.size(); k++) {
				bool ok = false;
				for (auto it:way[k]) {
					int a = it.first;
					int b = it.second;
					if (v[i][a] != v[j][b] || v[i][b] != v[j][a]) {
						ok = true;
						break;
					}
				}
				if (ok)continue;
					can.set(k, true);
			}
			if(can.any())ava[i].push_back(make_pair(j, can));
		}
	}
	for (int i = 0; i <way.size(); i++) {
		dp[0].set(i, true);
	}
	for (int i = 0; i < v.size(); i++) {
		for (int j = (1<<12)-1; j>=0; j--) {
			if ((j >> i) & 1)continue;
			if (dp[j].any()) {
				for (int k = 0; k < ava[i].size(); k++) {
					int go = ava[i][k].first;
					if ((j >> go) & 1)continue;
					dp[j | (1 << i) | (1 << go)] |= (dp[j] & ava[i][k].second);
				}
			}
		}
	}
	int need = v.size() / 2;
	need *= 2;
	for (int i = 0; i < (1 << v.size()); i++) {
		int z = 0;
		for (int j = 0; j <v.size(); j++) {
			if ((i >> j) & 1) {
				z++;
			}
		}
		if (z == need) {
			if (dp[i].any()) {
				puts("YES");
				return 0;
			}
		}
	}
	puts("NO");
	return 0;
}


Measured memory_bytes: 6460
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cout<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

int n,m,ans=1,flg;
map<int,int> v;

int pow(int a, int r) {
    int sum = 1;
    while (r > 0) {
      if ((r & 1) == 1) {
        sum *= a;
        sum %= MOD;
      }
      a *= a;
      a %= MOD;
      r >>= 1;
    }
    return sum;
  }
  
int mypow(int a,int r){
	int ret=1;
	rep(i,r){
		ret*=a;
	}
	return ret;
}

map< int, int > prime_factor(int n) {
  map< int, int > ret;
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

main(){
	cin>>m>>n;
	int cn=n;
	/*for(int i=2;i*i<=n;i++){
		while(cn%i==0){
			//cout<<i<<endl;
			amp(v,i);
			cn/=i;
		}
	}*/
	v=prime_factor(n);
	for(auto x:v){
		cerr<<x.fi<<' '<<x.se<<endl;
	}
	for(auto x:v){
		if(x.se>=m){
			//ans*=(x.fi*(x.se/m));
			ans*=mypow(x.fi,(x.se/m));
			//cerr<<(x.fi*(x.se/m))<<endl;
			//dans;
			//flg=1;
		}
	}
	//if(flg==0)
	dans;
}



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

int main(){
    int N;
    cin >> N;
    vector<ll> C(N-1), S(N-1), F(N-1);
    for(int i=0; i<N-1; i++){
        cin >> C[i] >> S[i] >> F[i];
    }
    
    for(int i=0; i<N-1; i++){
        ll time=0;
        time += S[i];
        for(int j=i; j<N-1; j++){
            if(time < S[j]){
                time = S[j];
            }else if((time-S[j])%F[j]!=0){
                time += F[j]-(time-S[j])%F[j];
            }
            time += C[j];
        }
        cout << time << endl;
    }
    cout << 0;
}

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

int main(){
    int N;  cin >> N;
    vector<int> A(N,0);
    for(int i=0; i<N; i++) cin >> A[i];
    sort(A.begin(), A.end());

    vector<int> sum(N,0);
    sum[0] = A[0];
    for(int i=1; i<N; i++){
        sum[i] = sum[i-1] + A[i];
    }
    
    int ans = -1e9;
    int K = 0;
    for(int k=0; k<N-1; k++){
        if(ans < sum[N-1]-sum[k]*2){
            ans = sum[N-1]-sum[k]*2;
            K = k;
        }
    }
    cout << ans << endl;
    for(int i=1; i<=K; i++){
        cout << A[N-1] << " " << A[i] << endl;
        A[N-1] = A[N-1] - A[i];
    }
    for(int i=K+1; i<N-1; i++){
        cout << A[0] << " " << A[i] << endl;
        A[0] = A[0] - A[i];
    }
    cout << A[N-1] << " " << A[0] << endl;
}



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

int main(){
	int n;
	scanf("%d", &n);
	int a;
	scanf("%d", &a);
	int mask = 0;
	for(int i = 0; i < a; i++) {
		int t;
		scanf("%d", &t);
		mask |= (1 << t);
	}
	for(int i = mask; ; i = mask & (i - 1)) {
		int k = i ^ mask;
		printf("%d:", k);
		for(int j = 0; j < n; j++) {
			if(k & (1 << j))
				printf(" %d", j);
		}
		printf("\n");
		if(i == 0) break;
	}
}



Measured memory_bytes: 3212
<?php
list($N,$T) = explode(" ",trim(fgets(STDIN)));
for($i=0;$i<$N;$i++){
list($c[],$t[]) = explode(" ",trim(fgets(STDIN)));
}
$cost = 1001;
for ($k=0;$k<$N;$k++){
  if($t[$k]<=$T){
    if($c[$k]<$cost){
      $cost = $c[$k];
    }
  }

}
if ($cost ==1001){
  echo 'TLE';
}else{
  echo $cost;
}


Measured memory_bytes: 3828
#include <stdio.h>
#include <string.h>
#include <iostream>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
typedef long long ll;
const int MAXN=1100;
int main()
{
    ios;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans[5];
    ans[1]=a*c;
    ans[2]=a*d;
    ans[3]=b*c;
    ans[4]=b*d;
    ll x=max(ans[1],ans[2]);
    ll y=max(ans[3],ans[4]);
    cout<<max(x,y)<<'\n';
    return 0;
}

Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(10**9)
N, M ,Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
def dfs(A):
    global ans
    if len(A) == N:
        score = 0
        for a,b,c,d in abcd:
            if A[b-1] - A[a-1] == c:
                score += d
        ans = max(ans, score)
    else:
        for i in range(A[-1], M+1):
            dfs(A + [i])

for j in range(1, M+1):
    dfs([j])
    
print(ans)


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

using namespace std;

#define endl '\n'
#define ll long long
#define mod 1000000007

void solve(){
    int n;
    cin>>n;
    int c = 0;
    for(int i = 1;i<=n;i++){
        for(int j = 1;j*i<n;j++){
            c++;
        }
    }
    cout<<c;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    while(t--){
        solve();
    } 
    return 0;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>
#include <set>

using namespace std;


int main() {

    int N;
    cin >> N;
    vector<long> hs;

    for (int i = 0; i < N; i++) {
        long h;
        cin >> h;
        hs.push_back(h);
    }

    reverse(hs.begin(), hs.end());

    long current = hs[0];

    bool ok = true;

    for (int i = 1; i < N; i++) {
        if (current > (hs[i])) {
            current = hs[i];
        } else if (current == hs[i]) {
            continue;
        } else {
            hs[i] -= 1;
            if (current == hs[i]) {
                continue;
            } else {
                ok = false;
                break;
            }
        }
    }

    if (ok) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }

    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define _for(it, a) \
  for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  vector<int> p;
  p.pb(a);
  p.pb(b);
  p.pb(c);
  sort(all(p));
  if (p[0] == 5 && p[1] == 5 && p[2] == 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

// Built using Sublime-CHelper plug-in (beta)


Measured memory_bytes: 256