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

#define debug(x) cerr << #x << ": " << x << endl

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(rbegin(a), rend(a));
  int x = a[0] * 10 + a[1];
  int y = a[2];
  cout << x + y << '\n';  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <math.h>
#include <map>

#define say(s) cout << s << endl
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define vec vector

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

int main() {
  int n;
  cin >> n;
  map<ll, int> m;
  rep(i, n) {
    ll a;
    cin >> a;
    if(m[a] >= 1) {
      say("NO");
      return 0;
    }
    m[a] += 1;
  }
  say("YES");
  return 0;
}


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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (ll i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (ll i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x))
#define umin(m, x) (m = min(m, x))

#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()

#define bit(x, n) ((x) >> (n) & 1)
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

using ll = long long int;

using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;

using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;

const int INF = 1e9;
const ll LINF = 1e18;

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }


double dist(pair<int, int> p1, pair<int, int> p2) {
    return sqrt(pow(p1.first - p2.first, 2) + pow(p1.second - p2.second, 2));
}

typedef struct node {
    pair<int, int> p;
    double dist;
    vi left;
} Node;

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

    vector<pair<int, int>> p(n);
    stack<Node> node;

    rep(i, n) {
        cin >> p[i].first >> p[i].second;

        vi left;
        rep(j, n)
            if (j != i) left.push_back(j);

        node.push({p[i], 0, left});
    }

    double sum = 0;
    int cnt = 0;

    while (!node.empty()) {
        Node cur = node.top(); node.pop();
        if (cur.left.empty()) {
            sum += cur.dist;
            cnt++;
        } else {
            for (auto i : cur.left) {
                vi left;
                for (auto j : cur.left)
                    if (j != i) left.push_back(j);

                node.push({p[i], cur.dist + dist(cur.p, p[i]), left});
            }
        }
    }

    cout << fixed << setprecision(10) << sum / cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"
#define MOD 1000000007
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))

int main()
{	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	

	double w,h,x,y;
	cin>>w>>h>>x>>y;
	double area= (double(w)*double(h))/double(2);
	cout<<fixed<<setprecision(6)<<area<<" ";
	if( double(w)/(double)2 == double(x) && double(h)/(double)2 == double(y))
		cout<<"1";
	else cout<<"0";

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, M, p;
vector<int> X;

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M >> p;
  rep(i, M) {
    int x; cin >> x;
    X.pb(x);
  }
  X.pb(p);
  sort(all(X));
  uniq(X);

  int m = INF;
  rep(i, X.size()) {
    int right = X[i], left = X[(i+1)%(X.size())];
    //cout<<"left="<<left<<", right="<<right<<"\n";
    int a = 0, b = 0;
    if (right >= p) a = right-p;
    else a = right-p + N;
    if (left <= p) b = p - left;
    else b = p - left + N;
    m = min(m, min(a, b)*2 + max(a, b));
  }
  cout << 100LL*m << "\n";
  return 0;
}

Measured memory_bytes: 3240
#include <iostream>
#include <vector>
#include <algorithm>

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

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

  int ans = 0;
  int cnt = 0;
  cin >> prevh;
  rep(i, n-1)
  {
    cin >> nowh;
    if(prevh >= nowh)
    {
      ++cnt;
    }
    if(prevh < nowh || i == n -2)
    {
      ans = max(ans, cnt);
      cnt = 0;
    }
    prevh = nowh;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stack>
#include <cmath>
#include <string>
#define  endl "\n"
using namespace std;

void FastInput() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
void OutputFile()
{
    freopen("output.txt","w",stdout);
}



int main()
{

    FastInput();
    int s,w;
    cin>>s>>w;
    if(w>=s)
        cout<<"unsafe"<<endl;
    else
        cout<<"safe"<<endl;

    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int N,H,K;
	cin >> N>>H>>K;
	
	if (H - N == K - H)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
const int MAXN = (60);
const int mod = (int)1e9 + 7;

int n;
string s1, s2;

void read()
{
	cin >> n;
	cin >> s1 >> s2;
}

int dp[MAXN][4];
int c[MAXN][16][16];

int rec(int len, int maskl, int maskr)
{	
	if(len == 0)
	{
		if(maskl == 1 || maskr == 1) return 1;	
		return (maskl & maskr) == 0;
	}

	int &memo = c[len][maskl][maskr];
	if(memo != -1) return memo;

	memo = 0;
	if(__builtin_popcount(maskl) == 1)
	{
		for(int col1 = 1; col1 <= 3; col1++)
			for(int col2 = 1; col2 <= 3; col2++)	
				if(col1 != col2)	
				{
					int new_mask = (1 << col1) + (1 << col2);
					if(__builtin_popcount(new_mask & maskl) == 0)
						memo = (memo + rec(len - 2, new_mask, maskr)) % mod; 
				}

		return memo;
	}
	
	for(int col1 = 1; col1 <= 3; col1++)
		for(int col2 = col1 + 1; col2 <= 3; col2++)
		{
			int new_mask = (1 << col1) + (1 << col2);
			memo = (memo + rec(len - 2, new_mask, maskr)) % mod; 
		}
	
	return memo;
}

int C(int len, int L, int R) { return rec(len, (1 << L), (1 << R)); }

void solve()
{
	memset(c, -1, sizeof(c));

	dp[0][0] = 1;

	int last = 0, len = 0;
	for(int i = 1; i <= n; i++)
	{
		bool is_up = (s1[i - 1] == s2[i - 1]); 
		if(is_up)
		{
			for(int col = 0; col <= 3; col++)
				for(int col2 = 1; col2 <= 3; col2++)
					dp[i][col2] = ((long long)dp[i][col2] + dp[last][col] * 1ll * C(len, col, col2)) % mod; 

			last = i;
			len = 0;
		}
		else len++;
	}

	for(int col = 0; col <= 3; col++)
		for(int col2 = 0; col2 <= 3; col2++)
			dp[n + 1][col2] = ((long long)dp[n + 1][col2] + dp[last][col] * 1ll * C(len, col, col2)) % mod; 

	cout << dp[n + 1][0] << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	read();
	solve();
	return 0;
}



Measured memory_bytes: 384
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int i,j,k,x,y;
        for(i=0;;i++){
            x=sc.nextInt();
            y=sc.nextInt();
            if((x==0)&&(y==0)){
                break;
            }
            for(j=0;j<x;j++){
                for(k=0;k<y;k++){
                    System.out.print("#");
                }
                System.out.print("\n");
            }
            System.out.print("\n");
        }
    }
}


Measured memory_bytes: 37060
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	_ = nextInt()
	m := nextInt()

	llim := nextInt()
	rlim := nextInt()

	for i := 1; i < m; i++ {
		l := nextInt()
		r := nextInt()

		if i == 0 {
			llim = l
			rlim = r
		}
		if rlim < l { //重なってない
			fmt.Println(0)
			return
		}
		if r < llim { //重なってない
			fmt.Println(0)
			return
		}

		llim = max(llim, l)
		rlim = min(rlim, r)

	}

	fmt.Println(rlim - llim + 1)

}
func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int32_t main()
{
	IOS;
	int x;
	cin >> x;
	for(int i = 1; i <= 1e5; i++)
	{
		double cur = i * 1.08l;
		int y = floorl(cur);
		if(y == x)
		{
			cout << i;
			return 0;
		}
	}
	cout << ":(";
	return 0;
}

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

int N;//limit value
int Digit;//limit number of digit

int dfs(long long now, int depth,bool is3, bool is5, bool is7){
	if(now > N) return 0;//exceeded value limit?
	int count = is3 && is5 && is7? 1:0;//{3,5,7} all used -> +1
	if(depth >= Digit) return count;//limit of digits?
	count += dfs(now*10+3, depth+1, true, is5, is7);
	count += dfs(now*10+5, depth+1, is3, true, is7);
	count += dfs(now*10+7, depth+1, is3, is5, true);
	return count;
}

int main(){
	string s; cin>>s;
	Digit = s.size();
	N = stoi(s);
	cout<< dfs(0, 0, false, false, false) <<endl;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const int INF = 1e9;

int main(void){

	int A, B, M; cin >> A >> B >> M;
	vector<int> a(A);
	vector<int> b(B);
	REP(i,A) cin >> a[i];
	REP(i,B) cin >> b[i];
	vector<int> x(M);
	vector<int> y(M);
	vector<int> c(M);
	REP(i,M){
		cin >> x[i] >> y[i] >> c[i];
	}

	int ans = INF;
	REP(i,M){
		int tmp = a[x[i]-1] + b[y[i]-1] - c[i];
		ans = min(ans, tmp);
	}
	SORT(a);
	SORT(b);
	ans = min(ans, a.front() + b.front());

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 2176
H,W = map(int,input().split())
a = [[int(i) for i in input().split()] for _ in range(H)]
N = 0
ans = ""
for i in range(H):
    for j in range(W):
        if a[i][j] % 2 == 1:
            if j == W-1:
                if i != H-1:
                    N += 1
                    ans += "{} {} {} {}\n".format(i+1,j+1,i+2,j+1)
                    a[i+1][j] += 1
            else:
                N += 1
                ans += "{} {} {} {}\n".format(i+1,j+1,i+1,j+2)
                a[i][j+1] += 1
if N == 0:
    print(N)
else:
    print(N)
    print(ans)

Measured memory_bytes: 11060
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector <int>a(3);
	int choku = 0, ei = 0, don = 0;
	while (cin >> a[0] >> a[1] >> a[2]) {
		Sort(a);
		if (a[0] + a[1] <= a[2])
		{
		break;
		}
		int a2[3];
		rep(i, 3) {
			a2[i] = a[i] * a[i];
		}
		if (a2[0] + a2[1] == a2[2]) 
		{ 
			choku++;
		}
		else if (a2[0] + a2[1] > a2[2]) 
		{ 
			ei++;
	//cout << "shine" << endl;
		}
		else 
		{
			don++;
		}
	}
	cout << choku + ei + don << " " << choku << " " << ei << " " << don << endl;
	return 0;
}


Measured memory_bytes: 3116
sx,sy,tx,ty = map(int,input().split())
dx = tx-sx
dy = ty-sy
a = ['U','R','D','L']
print(
    a[0]*dy+
    a[1]*dx+
    a[2]*dy+
    a[3]*(dx+1)+
    a[0]*(dy+1)+
    a[1]*(dx+1)+
    a[2]+a[1]+
    a[2]*(dy+1)+
    a[3]*(dx+1)+
    a[0]
)

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

int n, m;
int main(){
    priority_queue<int, vector<int>, less<int> > q;
    int x;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {cin >> x; q.push(x);}

    int tmp;
    while (m--){

        tmp = q.top();
        //cout << tmp << endl;
        q.pop();
        q.push(tmp/2);
    }

    long long res = 0;
    while (q.empty() == 0){
        res = res + q.top();
        q.pop();
    }

    cout << res;

}




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

int main(){
    int n;
    cin>>n;
    int A[n];
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    
    int B[n];
    for(int i=0;i<n;i++){
        B[i]=0;
    }
    int one;
    int two;
    for(int i=1;i<n;i++){
        one=INT_MAX;
        two=INT_MAX;
        if(i-1>=0){
            one=abs(A[i]-A[i-1])+B[i-1];
        }
        if(i-2>=0){
            two=abs(A[i]-A[i-2])+B[i-2];
        }
        B[i]=min(one,two);
    }
    cout<<B[n-1]<<endl;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

public class Main {
    private static final boolean N_CASE = false;

    private long parse(String s) {
        String[] p = s.split("\\.");
        long ans = 0;
        if (p.length > 0) {
            ans += Long.parseLong(p[0]) * 100;
        }

        if (p.length > 1) {
            ans += Long.parseLong(p[1]);
        }
        return ans;
    }

    private void solve() {
        long A = sc.nextLong();
        long C = parse(sc.next());
        out.println((A * C) / 100);
    }

    private void run() {
        int T = N_CASE ? sc.nextInt() : 1;
        for (int t = 0; t < T; ++t) {
            solve();
        }
    }

    private static MyWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        int[] nextArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        List<Integer> nextList(int n) {
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(nextInt());
            }
            return list;
        }
    }

    private static class MyWriter extends PrintWriter {
        private MyWriter(OutputStream outputStream) {
            super(outputStream);
        }

        void printArray(int[] a) {
            for (int i = 0; i < a.length; ++i) {
                print(a[i]);
                print(i == a.length - 1 ? '\n' : ' ');
            }
        }

        void printlnArray(int[] a) {
            for (int v : a) {
                println(v);
            }
        }

        void printList(List<Integer> list) {
            for (int i = 0; i < list.size(); ++i) {
                print(list.get(i));
                print(i == list.size() - 1 ? '\n' : ' ');
            }
        }

        void printlnList(List<Integer> list) {
            list.forEach(this::println);
        }
    }

    public static void main(String[] args) {
        out = new MyWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().run();
        out.close();
    }
}

Measured memory_bytes: 32944
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

void swap(int &a,int &b)
{
    int tmp;
    tmp=a;
    a=b;
    b=tmp;
}

int main()
{
    int x,y,z;
    cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<" "<<y<<" "<<z<<endl;

    return 0;
}

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

string T{"MARCH"};
vector<int>
A{0,0,0,0,0,0,1,1,1,2},
B{1,1,1,2,2,3,2,2,3,3},
C{2,3,4,3,4,4,3,4,4,4};

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

	map<char,ll> S; for(auto c:T) S[c] = 0;

	while(N--){
		string s; cin>>s;
		for(auto c:T) if(s[0]==c) S[c]++;
	}

	ll ans = 0;
	for(int i=0; i<10; ++i)
		ans += S[T[A[i]]] * S[T[B[i]]] * S[T[C[i]]];
	cout<< ans <<endl;
}

Measured memory_bytes: 256
# 優先度付キューのimport
import heapq

n, m = map(int, input().split())

a = [int(i) * -1 for i in input().split()]

heapq.heapify(a)

for i in range(m):
    minPrice = heapq.heappop(a)
    # 負の切捨てが面倒なので正の値にしてからまた負に戻す
    minPrice = -(abs(minPrice) // 2)
    heapq.heappush(a, minPrice)

sum = 0
for i in a:
    sum += -i

print(sum)

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

s=input()
count=0
for i in range(3):
    #print(s[i:i+1])
    if s[i:i+1]==s[i+1:i+2]:
        count+=1
if count>0:
    print("Bad")
else:
    print("Good")


Measured memory_bytes: 3060
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <cmath>
#include <iomanip>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr ll BIGP = 1000000007L;
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> x(N);
    vector<ll> y(N);
    rep(i, N) cin >> x[i] >> y[i];
    //
    double total = 0.0;
    rep(i, N)
    {
        rep(j, N)
        {
            if (i == j)
            {
                continue;
            }
            ll dx = x[i] - x[j];
            ll dy = y[i] - y[j];
            ll dsqr = dx* dx + dy * dy;
            total += sqrt(dsqr);
        }
    }
    total /= double(N);
    outD(total);

    //
    return 0;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N,K;
  cin>>N>>K;
  ll a[N];
  rep(i,N) cin>>a[i];
  
  ll lb=0,ub=INF;
  
  while(ub-lb>1){
    ll mid=(lb+ub)/2;
    ll num=0;
    for(int i=0;i<N;i++){
      num+=(a[i]-1)/mid;
    }
    if(num>K) lb=mid;
    else ub=mid;
  }
  int ans=ub;
  if(ub>ans) ans++;
  cout<<ans<<endl;
  
}


Measured memory_bytes: 5160
import sys
sdin = sys.stdin.readline

w,h,n = map(int, sdin().split())
xy = [[0], [w], [0], [h]]
for _ in range(n):
    x,y,a = map(int, sdin().split())
    if a-1 < 2:
        xy[a-1].append(x)
    else:
        xy[a-1].append(y)
    
x_min = max([xy[0][i] for i in range(len(xy[0]))])
x_max = min([xy[1][i] for i in range(len(xy[1]))])
y_min = max([xy[2][i] for i in range(len(xy[2]))])
y_max = min([xy[3][i] for i in range(len(xy[3]))])

print(max(0, x_max-x_min) * max(0, y_max-y_min))

Measured memory_bytes: 3064
#include<stdio.h>
int Adj[100][100] = { 0 };
int Stack[100] = { 0 }, d[100] = { 0 }, f[100] = { 0 };
int main(){
    int n, u, k, v;
    int i, j;
    int id, t = 0, stc, pid, id_check;
     
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &u);
        scanf("%d", &k);
        for (j = 0; j < k; j++) {
            scanf("%d", &v);
            Adj[u - 1][j] = v;
        }
    }
     
    for (id_check = 0; id_check < n; id_check++) {
        if (d[id_check] != 0) {
            continue;
        } else {
            id = id_check;
            t++;
            d[id] = t;
            stc = 0;
            Stack[stc] = id;
             
            while (1) {
                pid = id;
                t++;
                for (i = 0; Adj[id][i] != 0; i++) {
                    if (d[ Adj[id][i] - 1 ] == 0) {
                        id = Adj[id][i] - 1;
                        d[id] = t;
                        stc++;
                        Stack[stc] = id;
                        break;
                    }
                }
                if (pid == id) {
                    Stack[stc] = 0;
                    f[id] = t;
                    stc--;
                    if (stc < 0) break;
                    id = Stack[stc];
                }
            }
        }
    }
     
    for (i = 0; i < n; i++) {
        printf("%d %d %d\n", i + 1, d[i], f[i]);
    }
    return 0;
}

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

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

    int n,cnt = 0,i,j;
    cin >> n;

    for(i = 1; i < n; i++){
        for(j = 1; i*j < n; j++){
            if(i*j < n) cnt++;
        }
    }
    cout << cnt;

    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x,y=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		if(x%2==0){
			if(x%3==0)continue;
			if(x%5==0)continue;
			y=1;
		}
	} 
	if(y)cout<<"DENIED";
	else cout<<"APPROVED";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main()
{
    int h,w;
    cin >>h >>w;
    vector<string> a(h);
    rep(i,h) cin >>a[i];

    int ct = 0;
    rep(i,h)rep(j,w) ct += (a[i][j]=='#');

    cout << (ct==h+w-1?"Possible":"Impossible") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
double inf =  1e9;
typedef pair<double,mp> mmp;

int main(){
 while(1){
  ll n,m,p,a,b;
  cin>>n>>m>>p>>a>>b;
  if( n == 0 ) break;
  vector<ll> t(n);
  for(ll i=0;i<n;i++)cin>>t[i];
  a--,b--;
  vector<vector<double> > dp( m , vector<double>( 1<<n , inf ) );
  
  vector<vector<mp> > g(m);
  for(ll i=0;i<p;i++){
   ll x,y,z;
   cin>>x>>y>>z;
   x--,y--;
   g[x].push_back( mp(z,y) );
   g[y].push_back( mp(z,x) );
  }

  double ans = inf;
  priority_queue<mmp,vector<mmp> , greater<mmp> > q;
  q.push( mmp( 0.0 , mp((1<<n)-1,a) ) );
 
  while(!q.empty() ){
   mmp now = q.top();
   q.pop();
   double time = now.first;
   ll ticket = now.second.first;
   ll nn = now.second.second;
 //  cout<<nn<<' '<<time<<endl;
   if( nn == b ){
    ans = time;
    break;
   }
   if( dp[nn][ticket] <=  time  ){
    continue;
   }
   dp[nn][ticket] = time;
   for(ll i=0;i<g[nn].size();i++){
    for(ll j=0;j<n;j++){
     if( (ticket>>j)&1 ){
      ll next = g[nn][i].second;
      double ntime = time + ( ( (double) g[nn][i].first ) / t[j]);
      ll nextt = ticket^(1ll<<j);
      if( dp[next][nextt] != inf ) continue;
      q.push( mmp( ntime , mp( nextt , next ) ) );

     }
    }
   }
  }
  for(ll i=0;i<(1<<n);i++) ans = min( ans , dp[b][i] );


  if( ans == inf ){
   cout<<"Impossible"<<endl;
  }else{
   //cout<<ans<<endl;
   printf("%0.9lf\n",ans);
  }

 }
    return 0;
}



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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int dp[16010];

void solve() {
    string S;
    cin >> S;
    ll X, Y;
    cin >> X >> Y;

    Vl hs, vs;
    bool is_x = true;
    ll cnt = 0;
    for (ll i = 0; i < (ll)S.size(); i++) {
        if (S[i] == 'F')
            ++cnt;
        else {
            if (is_x) {
                hs.emplace_back(cnt);
            }
            else {
                vs.emplace_back(cnt);
            }
            cnt = 0;
            is_x ^= true;
        }
    }
    if (cnt > 0) {
        if (is_x) {
            hs.emplace_back(cnt);
        }
        else {
            vs.emplace_back(cnt);
        }
    }

    bool ok = true;

    constexpr ll sht = 8000;

    memset(dp, 0, sizeof(dp));

    ll sum = 0;
    for (ll i = 1; i < (ll)hs.size(); i++) {
        sum += hs[i];
    }

    dp[sum + sht] = 1;
    for (ll i = 1; i < (ll)hs.size(); i++) {
        for (ll j = 0; j <= 16000; j++) {
            if (dp[j] == 1 && j - hs[i] * 2 >= 0) {
                dp[j - hs[i] * 2] = 1;
            }
        }
    }

    if (X - hs[0] + sht >= 0 && dp[X - hs[0] + sht] == 1) {
    }
    else {
        ok = false;
    }


    memset(dp, 0, sizeof(dp));

    sum = 0;
    for (ll i = 0; i < (ll)vs.size(); i++) {
        sum += vs[i];
    }

    dp[sum + sht] = 1;
    for (ll i = 0; i < (ll)vs.size(); i++) {
        for (ll j = 0; j <= 16000; j++) {
            if (dp[j] == 1 && j - vs[i] * 2 >= 0) {
                dp[j - vs[i] * 2] = 1;
            }
        }
    }

    if (Y + sht >= 0 && dp[Y + sht] == 1) {
    }
    else {
        ok = false;
    }

    cout << (ok ? "Yes\n" : "No\n");
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int a, b;

int main(void){
    
    scanf("%d %d", &a, &b);
    
    if((a * b) % 2 == 0) printf("Even\n");
    else printf("Odd\n");
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long LL;

int main(){
  int N;
  cin >> N;
  vector<LL> a_1;
  vector<LL> a_2;
  vector<LL> a_4;
  for(int i=0;i<N;i++){
	LL tmp;
	cin >> tmp;
	if(tmp%2==0){
	  if(tmp%4==0){
		a_4.push_back(tmp);
	  }else{
		a_2.push_back(tmp);
	  }
	}else{
	  a_1.push_back(tmp);
	}
  }
  LL sum=a_4.size()-a_1.size()-a_2.size()+1;

  if((sum>-1)||(a_1.size()==0)||(a_4.size()==a_1.size())){
	cout << "Yes" << endl;
  }else{
	cout << "No" << endl;
  }

  return 0;
}
  

Measured memory_bytes: 1528
#include<stdio.h>
#define INFTY 2000000000

void merge(int *,int,int,int);
void mergeSort(int *,int,int);
 
int S[100000000];
int L[1000000],R[1000000];
int count=0;

int main(){
  int i;
  int n;
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  mergeSort(S,0,n);

  for(i=0;i<n;i++){
    if(i!=0)printf(" ");
    printf("%d",S[i]);
  }
  printf("\n");
  printf("%d\n",count);
return 0;
}

void merge(int *A,int left,int mid,int right){
  int i,j,k;
  int n1,n2;

  n1=mid-left;
  n2=right-mid;

  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }

  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }

  L[n1]=INFTY;
  R[n2]=INFTY;

  i=0;
  j=0;

  for(k=left;k<right;k++){
    count++;
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }else{
      A[k]=R[j];
      j=j+1;
    }
  }
}

void mergeSort(int *A,int left, int right){
  int mid;

  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll n;
    cin >> n;
    vll m(5);
    rep(i, 5) cin >> m[i];
    ll a = INT64_MAX;
    rep(i, 5) a = min(a, m[i]);
    ll ans = 5 + ((n + a - 1) / a - 1);
    cout << ans << endl;
    return 0;
}


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

#define F first
#define S second
#define pb push_back
#define ll long long
#define int long long
#define ld double

using namespace std ;

const int MAXN = 101 * 1001 ; 

int cnt[MAXN] , can[MAXN] ; 

int32_t main()
{
	ios::sync_with_stdio(0) ; cin.tie(0) ; 
	int n , m ;
	cin >> n >> m ; 
	if(n%3==0||m%3==0) return cout << 0 << endl , 0 ; 
	int ans = min(n,m) ;  
	for(int i = 1 ; i < n ; i ++ ) 
	{
		int a = i * m , b = (m/2) * (n-i) , c = (m+1)/2 * (n-i) ;
		ans = min(ans,max({a,b,c})-min({a,b,c})) ; 
	}
	swap(n,m); 
	for(int i = 1 ; i < n ; i ++ ) 
	{
		int a = i * m , b = (m/2) * (n-i) , c = (m+1)/2 * (n-i) ;
		ans = min(ans,max({a,b,c})-min({a,b,c})) ; 
	}
	cout << ans << endl ; 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>

int main(void) {
  int n, m, c, a[22][22], b[22], ans = 0, kari;

  if(scanf("%d %d %d", &n, &m, &c) == 1);

  for(int i = 0; i < m; i++) {
    if(scanf("%d", &b[i]) == 1);
  }

  for(int i = 0; i < n; i++) {
    kari = 0;
    for(int j = 0; j < m; j++) {
      if(scanf("%d", &a[i][j]) == 1);
      kari += a[i][j] * b[j];
    }
    kari += c;
    if(kari > 0) {
      ans++;
    }
  }

  printf("%d", ans);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long
int inf = (1LL <<  62);
using namespace std;

signed main(){
    int s;
    int k;
    cin >> s >> k;
    string n;
    cin >> n;
    switch (n[k - 1]) {
        case 'A':
            n[k - 1] = 'a';
            break;
        case 'B':
            n[k - 1] = 'b';
            break;
        default:
            n[k - 1] = 'c';
            break;
    }
    cout << n;
}



Measured memory_bytes: 256
N,M = list(map(int, input().split()))
Hs = list(map(int, input().split()))

is_good = [True] * N

for i in range(M):
    a,b = list(map(int, input().split()))

    if Hs[a-1] == Hs[b-1]:
        is_good[a-1] = False
        is_good[b-1] = False
    elif Hs[a-1] < Hs[b-1]:
        is_good[a-1] = False
    else:
        is_good[b-1] = False

cnt = 0 
for v in is_good:
    if v:
        cnt += 1

print(cnt)

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

int main(){
	int a[3][3];
	for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>a[i][j];
	for(int i=0;i<2;i++){
		if(a[i][0]-a[i+1][0]!=a[i][1]-a[i+1][1]||a[i][0]-a[i+1][0]!=a[i][2]-a[i+1][2]){
			cout<<"No";
			return 0;
		}
		if(a[0][i]-a[0][i+1]!=a[1][i]-a[1][i+1]||a[0][i]-a[0][i+1]!=a[2][i]-a[2][i+1]){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-



def main():
  MOD = 2019
  modset = [[(i*j)%MOD for i in range(2019)] for j in range(2019)]
  L,R = map(int, input().split())

  ans = 2018
  for i in range(L,R+1):
    for j in range(L,i):
      ans = min(ans,modset[i%MOD][j%MOD])
      if ans==0:
        return ans
  return ans


if __name__ == "__main__":
  print(main())

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

int main(){
  int n;
  cin >> n;
  vector<int>d(n);
  
  for(int i=0;i<n;i++){
    cin >> d.at(i);
  }
  
  sort(d.begin(),d.end());
  reverse(d.begin(),d.end());
  
  int ans=1;
  
  for(int i=1;i<n;i++){
    if(d.at(i)<d.at(i-1))
      ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

struct UnionFind{
  vector<int> par;
  
  UnionFind(int n) : par(n){
    rep(i,n){
      par[i] = i;
    }
  }
  int root(int x){
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  
  void unite(int x, int y){
    if(root(x) == root(y)) return;
    par[root(x)] = root(y);
  }
  
  bool same(int x, int y){
    return root(x) == root(y);
  }
  
  void p(vector<int> &c){
    c=par;
    return;
  }
  
  void update_par(){
  for(int i=0;i<par.size();i++){
    root(i);
  }
  }
  
};

int main(){
  int n,k,l;
  cin>>n>>k>>l;
  int a,b;
  UnionFind r(n);
  UnionFind s(n);
  
  rep(i,k){
    cin>>a>>b;
    a--;
    b--;
    r.unite(a,b);
  }
  
  rep(i,l){
    cin>>a>>b;
    a--;
    b--;
    s.unite(a,b);
  }
  
  vector<int> c(n,-1),d(n,-1);
  
  r.update_par();
  s.update_par();
  
  r.p(c);
  s.p(d);
  
  /*
  rep(i,n){
    if(c[i]!=-1) continue;
    c[i]=i;
    Rep(j,i+1,n){
      if(r.same(i,j)) c[j]=i;
    }
  }
  
  rep(i,n){
    if(d[i]!=-1) continue;
    d[i]=i;
    Rep(j,i+1,n){
      if(s.same(i,j)) d[j]=i;
    }
  }
  */
  
  map<P,int> map;
  
  
  rep(i,n){
    map[P(c[i],d[i])]++;
  }
  
  rep(i,n){
    cout<<map[P(c[i],d[i])]<<endl;
  }
  
  /*rep(i,n){
    cout<<c[i]<<endl;
  }
  
  rep(i,n){
    cout<<d[i]<<endl;
  }
  */
  
}
  
  

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

using ll = long long;

ll arr[510][510] = {}, n, m, x, y;

int main(){
    cin >> n >> m >> x >> y;
    const ll area = x*y;
    const ll small = (1e9 - 1) / (area-1), big = - small * (area-1) - 1;

    assert(small <= 1e9 && big >= -1e9);
    assert(area * small - small + big < 0);

    ll sum = 0;
    for(ll i = 0; i < n; ++i){
        for(ll j = 0; j < m; ++j){
            if(i%x == x-1 && j%y == y-1) arr[i][j] = big, sum += big;
            else arr[i][j] = small, sum += small; } }
    
    if(sum <= 0) cout << "No" << endl;
    else{
        cout << "Yes" << endl;
        for(ll i = 0; i < n; ++i){
            for(ll j = 0; j < m; ++j){
                cout << arr[i][j] << ' '; } 
            cout << '\n'; } }
    return 0; }


Measured memory_bytes: 4864
#include<cstdio>
#define MN 100
char s[MN+5][MN+5];
int main()
{
	int n,m,i,j;
	scanf("%d%d",&n,&m);
	for(i=0;i<100;++i)for(j=0;j<100;++j)s[i][j]=i<50?'.':'#';
	for(i=1;i<m;++i)s[i/50*2][i%50*2]='#';
	for(i=1;i<n;++i)s[99-i/50*2][99-i%50*2]='.';
	puts("100 100");
	for(i=0;i<100;++i)puts(s[i]);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define FOR(i, n, m) for (ll i = (n); i < (m); ++i)
#define FORR(i, n, m) for (ll i = (m) - 1; i >= (n); --i) 
#define FORE(x, xs) for (auto &x: (xs))
#define ALL(v) v.begin(), v.end()
#define ZERO(a) memset(a,0,sizeof(a))

const int INF = 1000000009;
const int MOD = 1000000007;
const double EPS = 1e-14;
const double PI = acos(-1);

const int MAX = 1e4+15;
const int use[10] = {0,2,5,5,4,5,6,3,7,6};

string dp[MAX]; // dp[k]:k本残っているときの最大の数

int N, M, A;

bool comp_string_of_int(string a, string b) {
    if (a.size() != b.size()) return a.size() > b.size();
    REP (k, a.size()) {
        if (a[k] == b[k]) continue;
        return a[k] > b[k];
    }
    return true;
}

string update(string x, int n, string y) {
    string m = to_string(n);
    string z = ((x == "0") ? m : (comp_string_of_int(x+m, m+x) ? x+m : m+x));
    if (y == "-1") return z;
    return (comp_string_of_int(y, z) ? y : z);
}

int main() {

    cin >> N >> M;
    REP (i, N+14) dp[i] = "-1";
    dp[N] = "0";
    REP (i, M) {
        cin >> A;
        FORR (k, use[A], N+1) {
            if (dp[k] != "-1") dp[k-use[A]] = update(dp[k], A, dp[k-use[A]]);
        }
    }

    cout << dp[0] << endl;

}

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


vector<char> acids = {'A', 'T', 'G', 'C'};


bool is_acid(const char c) {
    return find(acids.begin(), acids.end(), c) == acids.end();
}


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

    for (char c: s) {
        if (is_acid(c)) {
            crt = 0;
        }
        else {
            crt++;
            ans = max(ans, crt);
        }
    }

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



Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
	if(s[1]=='S')
	{
		if(s[0]=='R'||s[2]=='R')
			puts("1");
		else
			puts("0");
	}	
	else
	{
		if(s[0]=='R'&&s[2]=='R')
			puts("3");
		else
			if(s[0]=='R'||s[2]=='R')
				puts("2");
			else
				puts("1");
	}
	return 0;
} 

Measured memory_bytes: 3600
/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

int dp[1005][1<<12];
int cost[1005];
int bt[1005];
void solve(){  
	int n,m;
	cin>>n>>m;
	memset(dp,127,sizeof dp);
	int lim = dp[0][0];
	dp[0][0] = 0;
	rep(i,0,m){
		int a,b;
		cin>>a>>b;
		int mask=0;
		rep(j,0,b){
			int x;
			cin>>x;
			--x;
			mask|=(1<<x);
		}
		cost[i]=a;
		bt[i]=mask;
	}  
	rep(i,0,m){
		rep(j,0,1<<n){
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
			dp[i+1][j|bt[i]]=min(dp[i+1][j|bt[i]],dp[i][j]+cost[i]);
		}
	}
	if(dp[m][(1<<n)-1]==lim){
		cout<<-1<<endl;
	}
	else cout<<dp[m][(1<<n)-1]<<endl;
}

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

Measured memory_bytes: 32512
n, m = map(int, input().split())
h = list(map(int, input().split()))
t = [1] * n
mi = 0

for i in range(m):
    a, b = map(int, input().split())

    if h[a - 1] < h[b - 1]:
        t[a - 1] = 0
    elif h[a - 1] > h[b - 1]:
        t[b - 1] = 0
    else:
        t[a - 1] = 0
        t[b - 1] = 0

print(t.count(1))

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

int main(void) {
	string s;
    cin >> s;
    
    bool isOk = true;
    int size = s.size();
    //奇数
    for (int i = 0; i < size; i += 2) {
        if (s[i] == 'L') {
            isOk = false;
            break;
        }
    }

    //偶数
    for (int i = 1; i < size && isOk == true; i += 2) {
        if (s[i] == 'R') {
            isOk = false;
            break;
        }
    }

    if (isOk) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    int x=sc.nextInt();
    int y=sc.nextInt();
    String ans="No";
    for(int i=0,j=x;i<=x&&j>=0&&(i+j)==x; i++,j--){
      if(i*4+j*2==y){
        ans="Yes";
        break;
      }
    }
    System.out.println(ans);
    System.out.flush();
    sc.close();
  }
}


Measured memory_bytes: 35616
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N, Ma, Mb;

	cin >> N >> Ma >> Mb;

	vector<vector<int>> dp(41 * 11, vector<int>(41 * 11, 1<<30));
	dp[0][0] = 0;
	for(int i = 0 ; i < N ; ++i) {
		int a, b, c;
		cin >> a >> b >> c;

		for(int j = dp.size() - 1 ; 0 <= j ; --j) {
			for(int k = dp[j].size() - 1 ; 0 <= k ; --k) {
				if(dp[j][k] != -1 && j + a < dp.size() && k + b < dp[j].size()) {
					dp[j+a][k+b] = min(dp[j+a][k+b], dp[j][k] + c);
				}
			}
		}
	}

	int result = 1 << 30;
	for(int i = 1 ; i < 100 ; ++i) {
		if(Ma * i < dp.size() && Mb * i < dp[0].size()) {
			result = min(result, dp[Ma*i][Mb*i]);
		}
	}
	if(result > 1 << 29)
		cout << -1 << endl;
	else
		cout << result << endl;
}


Measured memory_bytes: 1024
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

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

    int a = *max_element(A.begin(), A.end());
    pair<int,int> best(0, -a);
    for (int i = 0; i < n; ++i) {
        if (A[i] < a) {
            best = max(best, make_pair(min(a - A[i], A[i]), -A[i]));
        }
    }

    int b = -best.second;
    cout << a << " " << b << '\n';

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  vll A(n);
  FOR(i,0,n){
    ci(A[i])
  }
  SORT(A);
  co(A[n-1]-A[0])
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int pre[100010],sum[100010],ans[100010];
int findfather(int root){
	if(root==pre[root])
		return root;
	return pre[root]=findfather(pre[root]);
}
void join(int a,int b){
	a=findfather(a);
	b=findfather(b);
	if(a!=b){
		pre[a]=b;
		sum[b]+=sum[a];
	}
}
int main(){
	int n,m,k,x,y;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++){
		sum[i]=1;
		pre[i]=i;
	}
	memset(ans,0,sizeof(ans));
	while(m--){
		scanf("%d%d",&x,&y);
		ans[x]++;ans[y]++;
		join(x,y);
	}
	while(k--){
		scanf("%d%d",&x,&y);
		if(findfather(x)==findfather(y)){
			ans[x]++;ans[y]++;
		}
	}
	for(int i=1;i<=n;i++){
		printf("%d ",sum[findfather(i)]-ans[i]-1);
	}
	return 0;
} 

Measured memory_bytes: 2688
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();

		if(x==2||y==2) {
			System.out.println("No");
		}else if(x==1||x==3||x==5||x==7||x==8||x==10||x==12) {
			if(y==1||y==3||y==5||y==7||y==8||y==10||y==12) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}else if(x==4||x==6||x==9||x==11) {
			if(y==4||y==6||y==9||y==11) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}else if(y==1||y==3||y==5||y==7||y==8||y==10||y==12) {
			if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}else {
			if(x==4||x==6||x==9||x==11) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}

	}
}




Measured memory_bytes: 23636