akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <cstdint>

int main()
{
	int64_t a, b, c, d;
	std::cin >> a >> b >> c >> d;

	int64_t num[4] = {a * c, a * d, b * c, b * d};

	int64_t max = num[0];
	for(int i = 1; i < 4; i++)
	{
		if(num[i] > max)
		{
			max = num[i];
		}
	}

	std::cout << max << std::endl;

	return 0;
}

Measured memory_bytes: 3448
#include <stdio.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>


template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


class UnionFind {
public:
	vector<int> Parent;
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
	int root(int A) {
		if (Parent[A] < 0) {
			return A;
		}
		return Parent[A] = root(Parent[A]);
	}

	long long size(int A) {
		return -(long long)Parent[root(A)];
	}

	bool connect(int A, int B) {
		A = root(A);
		B = root(B);
		if (A == B) {
			return false;
		}
		if (size(A) < size(B)) {
			swap(A, B);
		}

		Parent[A] += Parent[B];
		Parent[B] = A;

		return true;
	}

};

class Edge {
public:
	int source, target; ll cost;
	Edge(int source = 0, int target = 0, ll cost = 0) :
		source(source), target(target), cost(cost) {}
	bool operator<(const Edge& e)const {
		return cost < e.cost;
	}
};

ll kuraskal(int N, vector<Edge>& edges) {
	ll totalCost = 0;
	sort(edges.begin(), edges.end());
	UnionFind uni(N + 1);
	for (int i = 0; i < edges.size(); i++) {
		Edge e = edges[i];
		if (uni.root(e.source) != uni.root(e.target)) {
			totalCost += e.cost;
			uni.connect(e.source, e.target);
		}
	}
	return totalCost;
}

bool isconnected(int n, vector<Edge>& edges) {
	UnionFind uni(n);
	for (auto& e : edges) {
		uni.connect(e.source, e.target);
	}
	return uni.size(0) == n;
}
void solve() {
	int n, m; cin >> n >> m; if (n == 0 and m == 0) exit(0);
	vector<Edge> edges; edges.reserve(m);
	for (int i = 0; i < m; i++) {
		int u, v, w; cin >> u >> v >> w;
		u--; v--;
		edges.emplace_back(u, v, w);
	}
	sort(edges.begin(), edges.end());
	if (!isconnected(n, edges)) {
		cout << -1 << "\n";
		return;
	}
	int res = inf;
	int lf = -1;
	int rg = 20000;
	while (rg - lf > 1) {
		int mid = (lf + rg) >> 1;
		bool ok = false; 
		for (int st = 0; st <= 10000; st++) {
			vector<Edge> ed;
			for (auto& e : edges) {
				if (st <= e.cost and e.cost <= st + mid) {
					ed.emplace_back(e);
				}
			}
			if (isconnected(n, ed)) ok = true;
			if (ok)break;
		}
		if (ok) rg = mid;
		else lf = mid;
	}
	cout << rg << "\n";
}

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

	int kkt = 89;
	while (kkt) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3356
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a; cin >> n >> a;
    cout << n*n-a;
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void)
{
	double min,max;
	double tmp;
	cin>>min;
	max=min;
	while(cin>>tmp)
	{
		if(tmp<min)min=tmp;
		if(tmp>max)max=tmp;
	}
	cout<<max-min<<endl;
}

Measured memory_bytes: 1280
#include <iostream>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  double ans=0;
  for (int i=1;i < n+1;i++){
    int sum=i;
    double coin=1.0;
    while (sum <k){
      sum*=2;
      coin/=2.0;
    }
    coin/=n;
    ans+=coin;
  }
  printf("%.10f\n",ans);
  return 0;
}
    
      
      

Measured memory_bytes: 256
from sys import exit

s = input()
t = input()

alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
alph_list = dict()
for i in range(26):
  alph_list[alphabet[i]] = i

counter = [[] for _ in range(26)]

for i in range(len(s)):
  key = s[i]
  counter[alph_list[key]].append(i)

ans = 0
ans_mod = 0
flag = True
for i in range(len(t)):
  key = alph_list[t[i]]
  if not counter[key]:
    flag = False
    break
  l, r = 0, len(counter[key])
  while r-l > 1:
    bit = (r+l)//2
    if counter[key][bit] >= ans:
      r = bit
    else:
      l = bit
  if r == len(counter[key]) and counter[key][l] < ans:
    ans_mod += 1
    ans = counter[key][0]+1
  elif l == 0 and counter[key][l] >= ans:
    ans = counter[key][l]+1
  else:
    ans = counter[key][r]+1
if flag:
  print(ans_mod*len(s)+ans)
else:
  print(-1)

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

int main(){
  int d, g;
  cin >> d >> g;

  int p[d], c[d];
  for (int i = 0; i < d; i++){
    cin >> p[i] >> c[i];
  }

  int ans = 10000;
  for (int i = 0; i < (1 << d); i++){
    bitset<10> completed(i);
    int rem = g, solved = 0;
    for (int j = 0; j < d; j++){
      if (completed.test(j)){
        rem -= 100 * (j + 1) * p[j] + c[j];
        solved += p[j];
      }
    }
    int k = d - 1;
    while (rem > 0 && k >= 0){
      if (!completed.test(k)){
        int a = min((rem + 100 * (k + 1) - 1) / (100 * (k + 1)), p[k] - 1);
        solved += a;
        rem -= 100 * (k + 1) * a;
      }
      k--;
    }
    if (rem <= 0) ans = min(ans, solved);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = N - K + 1
for i in range(1, K+1):
	if i > N - K + 1: print(0)
	else:
		print(A%1000000007)
		A *= (K-i)*(N-K+1-i)
		A //= i*(i+1)

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

using namespace std;

#define INF ((1<<30)-1)  //int32_t
#define MOD 1000000007
#define MOD2 

#define all(a)  (a).begin(),(a).end()

#define mkp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main(){

    bool flag=false;

    ll ans=0,sum=0;
    
    int n,m;
    cin >>n>>m;
    vector<pair<bool,int>> prob(n , pair<bool,int>(false,1));
    prob[0] = mkp(true,1);

    bool is1moved=false;
    for (int i = 0; i < m; i++){
        int x,y;
        cin >>x>>y;
        --x;--y;


    prob[y].first = prob[y].first || prob[x].first;

        if(prob[x].second == 1){
            prob[x].first = false;
        }
        prob[y].second += 1;
        prob[x].second -= 1;
    }
    
    for (int i = 0; i < n; i++)
    {
        if(prob[i].first)ans++;
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 1024
#define ll long long
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define UNIQUE(a) unique(a.begin(), a.end())
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>
#include <sstream>
#include <map>

using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

const ll mod = 1e9+7;

int main() {
	ll l, r;
	cin >> l >> r;
	ll min = 2019;
	ll tmp;

	for (ll i = l; i < r + 1; i++) {
		for (ll j = i + 1; j < r + 1; j++) {
			tmp = i * j % 2019;
			if (tmp < min)min = tmp;
			if (min == 0) {
				cout << min << endl;
				return 0;
			}
		}
	}
	cout << min << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let a = read_vec::<usize>();
    let b = read_vec::<usize>();
    let c = read_vec::<usize>();
    let mut ans = b.iter().sum::<usize>();
    for i in 0..n - 1 {
        if a[i] + 1 == a[i + 1] {
            ans += c[a[i] - 1];
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		boolean[] ans = new boolean[n+1];
		
		for(int i = 0; i < k; i++) {
			int d = sc.nextInt();
			for(int m = 0; m < d; m++) {
				int a = sc.nextInt();
				ans[a] = true;
			}
		}
		int cnt = 0;
		for(int i = 0; i < n; i++) {
			if(ans[i+1]==false) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 37352
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>

using namespace std;

int main()
{
    // 整数の入力
    long long N,K,now,i;
    now = 1;
    cin >> N >> K;
    for (i=0;i<N;i++){
        if (now + K < 2 * now){
            now = now + K;
        }else{
            now = 2 * now;
        }
    }
    cout << now << endl;

    return 0;
}

Measured memory_bytes: 256
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m;
    a.clear();a.reserve(n);

    fo(i,n)
    {
        cin>>in;
        a.pb(in/2);
    }

    cnt=1;

    for(auto x:a)
    {
        if(cnt>m)
        {
            cout<<0<<endl;
            return 0;
        }
        cnt=cnt*x/__gcd(x,cnt);
    }

    for(auto x:a)
    {
        x=cnt/x;
        if(x%2==0)
        {
            cout<<0<<endl;
            return 0;
        }
    }

    dbg(cnt);

    cnt=m/cnt;
    cnt=(cnt+1)/2;
    cout<<cnt<<endl;


}   aryanc403();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

#include <iostream>
#include <vector>
using namespace std;

//重複順列
vector<ll> buf;
void permutation(ll i, const ll size, const ll range_start, const ll range_end)
{
    if (i == size) {
      // ここで所望の作業を行う
      for(ll itr:buf){
        cout << itr;
      }
    }
    else{
        for(ll j = range_start; j <= range_end; ++j){
            buf[i] = j;
            permutation(i + 1, size, range_start, range_end);
        }
    }
}

int main(void)
{
  ll n, k, ans = 0;
  cin >> n >> k;
  vector<ll> UP(n+1),DOWN(n+1);
  ll mod = pow(10,9) +7;
  UP[0] = 0;
  DOWN[0] = n;
  FOR(i,1,n+1){
    UP[i] = UP[i-1]+i;
    DOWN[i] = DOWN[i-1]+(n-i);
  }
  FOR(i,k-1,n+1){
    ans = (ans + DOWN[i]-UP[i]+1) % mod;
  }
  cout << ans << endl;
}


Measured memory_bytes: 6372
#include <cstdio>
#include <vector>
#include <tuple>
#include <algorithm>

using namespace std;

int main() {
	int N;
	scanf("%d", &N);
	vector<tuple<int, int, int> > vec;
	for(int n=0; n<N; ++n) {
		int a, b;
		scanf("%d%d", &a, &b);
		vec.emplace_back(a+b, a, b);
	}
	sort(vec.begin(), vec.end());
	long long ret = 0;
	while(2<=vec.size()) {
		ret += get<1>(vec.back());
		vec.pop_back();
		ret -= get<2>(vec.back());
		vec.pop_back();
	}
	if(vec.size()) {
		ret += get<1>(vec.back());
		vec.pop_back();
	}
	printf("%lld\n", ret);

	return 0;
}


Measured memory_bytes: 1912
#include <iostream>
#include <vector>
using ln = long long;
#define rep(i,n) for(int i=1;i <= (int)(n) ; i++) //rep(i,n)=(int i=0; i < (int)(n) ; i++)
using namespace std;

int main(){
    ln n,m;
    cin >> n >> m;
    ln h[n+1];
    ln a[m+1],b[m+1];
    ln check[n+1]= {0};

    rep(i, n)
    {
        cin >> h[i];
    }

    int a_tn,b_tn;
    rep(i, m)
    {
        cin >> a[i] >> b[i];
        a_tn = a[i];
        b_tn = b[i];
        
        if(h[a_tn]>h[b_tn]){check[b_tn] = 1;}
        else if(h[a_tn]<h[b_tn]){check[a_tn] = 1;} 
        else
        {
            check[b_tn] = 1;
            check[a_tn] = 1;
        }   
    }

    int count = 0;
    rep(i, n)
    {
        if(check[i]==0){
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 6760
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 1e5 + 5;
int a[N];
void solve(){
	int n;
	cin >> n;
	int c1 = 0, c2 = 0, c4 = 0;
	fr(i, 1, n){
		cin >> a[i];
		if(a[i] & 1)
			c1++;
		else if(a[i] % 4 == 0)
			c4++;
		else
			c2++;
	}
	if(c2 == 0){
		cout << ((c1 > c4 + 1) ? "No" : "Yes");
	}
	else
		cout << ((c1 > c4) ? "No" : "Yes");
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1024
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define ll long long
#define S second
#define F first
using namespace std;
const ll inf = 1e18;
int n;
string s;
int main(){
	fast,cin>>n>>s;
	int ans = 1;
	for(int i=1;i<n;i++){
		if(s[i] == s[i-1]) continue;
		ans ++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <deque>
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<long long int>
#define vc vector<char>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(i = (a); i < (n); i++)
#define fi(i,a,n) for(i = (a); i <= (n); i++)
#define F first
#define S second

int main() {
    ll n;
    cin>>n;
    vi a(n);
    vi b(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    for(ll i=0;i<n;i++){
        cin>>b[i];
    }
    ll c=0;
    for(ll i=0;i<n;i++){
        if(a[i]>b[i]){
            c += (a[i]-b[i]);
        }
    }
    cout<<c<<endl;
}

Measured memory_bytes: 256
S = input()

if S == 'ooo':
    y = 700 + 300
if S == 'oox' or S == 'oxo' or S == 'xoo':
    y = 700 + 200
if S == 'oxx' or S == 'xox' or S == 'xxo':
    y = 700 + 100
if S == 'xxx':
    y = 700
    
print(str(y))

Measured memory_bytes: 8984
unittest
{
	assert( [ "6 1", "3" ].parse.expand.solve == 4 );
	assert( [ "10 2", "4", "5" ].parse.expand.solve == 0 );
	assert( [ "100 5", "1", "23", "45", "67", "89" ].parse.expand.solve == 608200469 );

	assert( [ "1 0", "" ].parse.expand.solve == 1 );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	auto as = new long[]( nm[ 1 ] );
	foreach( ref a; as )
	{
		input.popFront;
		a = input.front.to!( long );
	}
	return tuple( nm[ 0 ], as );
}

auto solve( long n, long[] as )
{
	const MOD = 10L ^^ 9 + 7;
	
	auto dp = new long[]( 2 + n );
	dp[ 1 ] = 1;
	foreach( a; as ) dp[ a + 1 ] = -1;
	for( auto i = 2L; i < dp.length; i++ )
	{
		if( dp[ i ] < 0 ) continue;							// この段は壊れているのでスキップ
		if( dp[ i - 2 ] < 0 && dp[ i - 1 ] < 0 ) break;		// 二段連続で壊れていて登れない
		dp[ i ] = ( max( dp[ i - 2 ], 0 ) + max( dp[ i - 1 ], 0 ) ) % MOD;
	}
	return dp[ $ - 1 ];
}


Measured memory_bytes: 4348
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;
int gcd(Int a, Int b) {
 return b != 0 ? gcd(b, a % b) : a;
}
int lcm(Int a, Int b) {
 return a / gcd(a, b)*b;
}

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


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

int main() {
  int N;
  cin >> N;
  
  vector<string> vec0(N);
  for(int i = 0; i < N; i++) {
    cin >> vec0.at(i);
  }
  
  int M;
  cin >> M;
  vector<string> vec1(M);
  for(int i = 0; i < M; i++) {
    cin >> vec1.at(i);
  }
  
  int X = 0;
  
  for(int i = 0; i < N; i++) {
    int count = 0;
    for(int j = 0; j < N; j++) {
      if(vec0.at(i) == vec0.at(j)) {
        count++;
      }
    }
    for(int j = 0; j < M; j++) {
      if(vec0.at(i) == vec1.at(j)) {
        count--;
      }
    }
    if(X < count) {
      X = count;
    }
  }
  cout << X << endl; 
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int n;
    string s[3];
    cin >> n;
    for (int i = 0; i < 3; i++) {
        cin >> s[i];
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        set<char> ss;
        for (int j = 0; j < 3; j++) {
            ss.insert(s[j][i]);
        }
        cnt += ss.size() - 1;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>

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

using namespace std;

inline int max(int a, int b) {
	if (b > a) swap(a, b);
	return a;
}

inline int min(int a, int b) {
	if (a > b) swap(a, b);
	return a;
}




int main() {
	int n;
	cin >> n;
	vector<int> d(n);
	rep(i, n) {
		cin >> d[i];
	}
	sort(d.begin(),d.end());
	cout << d[n / 2] - d[n / 2 -1] << endl;

	return 0;
}

Measured memory_bytes: 768
mode = []
count = [0 for i in range(100)]
while(1):
	try:
		n = int(input())
		count[n-1] = count[n-1] + 1
	except EOFError:
		max_ = max(count)
		for i in range(100):
			if count[i] == max_:
				mode.append(i+1)
		for i in mode:
			print(i)
		break


Measured memory_bytes: 5604
#include<iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
    double d,a;

    cin >> d;
    a = 100;
    int count =0;

    while (a < d) {
        a = a * 1.01;
        a = floor(a);
        count++;
    }



        cout << count;
    

    return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;

int main(){
    ll N;
    cin>>N;
    vvvll A(N);
    for(int i=0;i<N;i++){
        ll n;
        cin>>n;
        A[i].resize(n,vll(2));
        for(int j=0;j<n;j++) {
            cin>>A[i][j][0]>>A[i][j][1];
            A[i][j][0]--;
        }
    }
    
    vector<bool> truth(N,false);
    ll ans=0;
    for(ll count=pow(2,N)-1;count>=0;count--){
        //printf("count=%d\n",count);
        ll count_copy=count;
        for(int i=0;i<N;i++){
            if(count_copy%2==0) truth[i]=false;
            else truth[i]=true;
            count_copy/=2;
            //printf("truth[%d]=%d\n",i,(int)truth[i]);
        }
        
        bool ok=true;
        for(int i=0;i<N;i++){
            if(truth[i]){
                for(int j=0;j<A[i].size();j++){
                    //printf("A[%d][%d][%d]=%d,truth[%d]=%d\n",i,j,1,(int)A[i][j][1],A[i][j][0],(int)truth[A[i][j][0]]);
                    if(truth[A[i][j][0]]!=A[i][j][1]){
                        ok=false;
                        break;
                    }
                }
                if(!ok) break;
            }
        }
        
        if(ok){
            ll sum=0;
            for(int i=0;i<N;i++){
                if(truth[i]) sum++;
            }
            if(sum>ans) ans=sum;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        String s = sc.next();
        long k = sc.nextLong();
        for (int i = 0; i < k; i++) {
            if (s.charAt(i) != '1') {
                System.out.println(s.charAt(i));
                return;
            }
        }
        System.out.println(1);
    }
}


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

int mcxi(string s){
	  int ans = 0;
	  for(int i=0; i<s.size(); i++){
			if(s[i] != 'm' and s[i] != 'c' and s[i] != 'x' and s[i] != 'i' ){ // ??°???????????°
				  if(s[i+1] == 'm')
						ans += stoi(s.substr(i,1)) * 1000;
				  if(s[i+1] == 'c')
						ans += stoi(s.substr(i,1)) * 100;
				  if(s[i+1] == 'x')
						ans += stoi(s.substr(i,1)) * 10;
				  if(s[i+1] == 'i')
						ans += stoi(s.substr(i,1)) * 1;
				  i++;
			}
			else{
				  if(s[i] == 'm')
						ans += 1000;
				  if(s[i] == 'c')
						ans += 100;
				  if(s[i] == 'x')
						ans += 10;
				  if(s[i] == 'i')
						ans += 1;
			}
	  }
	  return ans ;
}

void to_int(int n){
	  string ans;
	  if(n >= 1000){
			int d = n/1000;
			if(d != 1){
				  ans += to_string(d);
			}
			ans += "m";
			n -= d*1000;
	  }
	  if(n >= 100){
			int d = n/100;
			if(d != 1){
				  ans += to_string(d);
			}
			ans += "c";
			n -= d*100;
	  }
	  if(n >= 10){
			int d = n/10;
			if(d != 1){
				  ans += to_string(d);
			}
			ans += "x";
			n -= d*10;
	  }
	  if(n >= 1){
			int d = n;
			if(d != 1){
				  ans += to_string(d);
			}
			ans += "i";
			n -= d;
	  }
	  cout << ans << endl;
}

int main(){
	  int n; cin >> n;
	  for(int i=0; i<n; i++){
			string s1,s2; cin >> s1 >> s2;
			int tmp = mcxi(s1) + mcxi(s2);
			to_int( tmp );
	  }
}

Measured memory_bytes: 3224
def get_digit(n): #桁数を求める関数
    return len(str(n))

def func(n):
    a = 1
    res = float('inf')
    while a**2 <= n:
        if n % a == 0:
            b = n // a
            res = min(res, max(get_digit(a), get_digit(b)))

        a += 1
    return res    

n = int(input())
print(func(n))

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

int main() {
    int a, b, c, buf;
    
    cin >> a >> b >> c;
    
    if (a > b) {
        buf = a;
        a = b;
        b = buf;
    }
    
    if (a > c) {
        buf = a;
        a = c;
        c = buf;
    }
    
    if (b > c) {
        buf = c;
        c = b;
        b = buf;
    }
    
    cout << a <<" "<< b <<" "<< c << endl;
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <vector>
#include <bitset>

using namespace std;

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

    // 10^100回 動かす -> 文字列の最大の長さ分位（かつ偶数）あればOK
    int step = 100000;

    // dp[i][j] := マスjにいる子が2^iステップ後にいるマス
    vector<vector<int>> dp(18, vector<int>(S.size()));

    for(int j = 0; j < S.size(); j++) {
        if (S[j] == 'L') {
            dp[0][j] = j - 1;
        } else {
            dp[0][j] = j + 1;
        }
    }

    // 2^{i+1}ステップ進む == 2^iステップ進んで2^iステップ進む
    for(int i = 0; i < 17; i++) {
        for(int j = 0; j < S.size(); j++) {
            dp[i + 1][j] = dp[i][dp[i][j]];
        }
    }

    // 100000ステップ動く -> 32 + 128 + 512 + 1024 + 32768 + 65536 ステップ動かせば良い
    vector<int> ans(S.size());
    for (int j = 0; j < S.size(); j++) {
        int now = j;
        for (int i = 0; i < 18; i++) {
            if (step >> i & 1) {
                now = dp[i][now];
            }
        }
        ans[now]++;
    }

    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 8056
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define MAXN 1000005
using namespace std;

typedef long long ll;
typedef pair < int , int > ii;

int n, arr[MAXN], dp[MAXN];

// dp[i] = i. tasa minimum kac maliyetle gliriz.

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

	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> arr[i];

	dp[0] = 0;
	dp[1] = abs(arr[1] - arr[0]);
	for(int i = 2; i < n; i++){

			dp[i] = min(dp[i-1] + abs(arr[i-1] - arr[i]), dp[i-2] + abs(arr[i-2] - arr[i]));
			// dp[i] 'yi hesapla

	}

	cout << dp[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int n,m,x;
vector<int> a;

void input(){
    cin >> n >> m >> x;
    a.resize(m);
    for(int i=0;i<m;i++) cin >> a[i];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    int l = 0;
    int r = 0;
    for(int i=0;i<m;i++){
        if(a[i] < x) l++;
        else r++;
    }
    cout << min(l,r) << endl;
}

Measured memory_bytes: 256
import numpy as np
 
N,M=map(int,input().split())
 
a=[]
 
for i in range(N):
  a.append(list(map(int,input().split())))
 
b=np.array(a).T
answer=0
 
#それぞれを正の方向と負の方向で考えた時の最大を取る
x=[1,1,1,1,-1,-1,-1,-1]
y=[1,1,-1,-1,1,1,-1,-1]
z=[1,-1,1,-1,1,-1,1,-1]

if M>0:
  for i in range(8):
    #それぞれの方向で考えて足し合わせる
    #[2,1,4]+[3,1,2]+[-2,-3,-1]=[3,-1,5]など
    t=np.sum(sorted(x[i]*b[0]+y[i]*b[1]+z[i]*b[2])[-M:])
    if answer<t:
      answer=t
print(answer)

Measured memory_bytes: 12536
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

char op[] = {'+', '-', '*'};
int solve(string s) {
  //cout << s << endl;
  for (int i=s.size()-1; i>=0; --i) {
    REP(j, 3) {
      if (s[i] == op[j]) {
        int left = solve(s.substr(0, i));
        int right = solve(s.substr(i+1));
        if (left == -1 || right == -1) return -1;
        int res;
        if (j == 0) res = left + right;
        else if (j == 1) res = left - right;
        else res = left * right;
        if (res >= 10000 || res < 0) return -1;
        return res;
      }
    }
  }
  if (s.size() >= 5) return -1;
  int res = atoi(s.c_str());
  if (res >= 10000 || res < 0) return -1;
  return res;
}

int main() {
  string s;
  while(cin >> s) {
    int res = solve(s.substr(0, s.size()-1));
    if (res == -1) cout << "E" << endl;
    else cout << res << endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int x;
	scanf("%d", &x);
	printf(x >= 30 ? "Yes\n" : "No\n");
}


Measured memory_bytes: 3720
import java.util.Arrays;
import java.util.Scanner;

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

		strArray = str.split(" ");
		Arrays.sort(strArray);

		if ("557".equals(String.join("", strArray))) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	long long X,cur=100; cin>>X;
	int ret=0;
	while(cur<X)
		ret++, cur=ll(1.01*cur);
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 3668
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define Rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int main() {
	string S;
	int w;
	cin >> S >> w;
	int n = S.size();
	for (int i = 0;w*i < n;i++) {
		cout << S[w*i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,r=0,w=0,r2=0,w2=0;
    cin>>n;
    char a[200000];
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]=='R'){
            r++;
        }
        else{
            w++;
        }
    }
    for(int i=r;i<n;i++){
        if(a[i]=='R'){
            r2++;
        }
        else{
            w2++;
        }
    }
    cout<<r2<<endl;
    return 0;
}

Measured memory_bytes: 3792
#include <cstdio>
#include <map>
#include <vector>
const int HASH = 131;
const int MAXN = 5005;
const int MOD = 1e9+7;
char S[MAXN];
int H[MAXN];
int N, size;

std::map<int, std::vector<int>> D;

bool compare(int a, int b) {
  for (int k = 0; k < size; ++k) {
    if (S[a-k] != S[b-k]) return false;
  }
  return true;
}

bool matches(int sum, int cur) {
  for (int pos: D.at(sum)) {
    if (pos + size > cur) break;
    if (compare(pos, cur)) {
      return true;
    }
  }
  return false;
}

bool find() {
  D.clear();
  int sum = 0;
  for (int i = 0; i < N; ++i) {
    sum = (1LL * HASH * sum + S[i]) % MOD;
    if (i >= size) {
      int old = 1LL * H[size] * S[i-size] % MOD;
      sum = (sum - old + MOD) % MOD;
    }
    if (i+1 >= size) {
      if (D.count(sum) && matches(sum, i)) {
        return true;
      }
      D[sum].push_back(i);
    }
  }
  return false;
}

void init() {
  H[0] = 1;
  for (int i = 1; i <= N; ++i) {
    H[i] = 1LL * H[i-1] * HASH % MOD;
  }
}

int solve() {
  int lo = 0;
  int hi = N/2;
  while (lo < hi) {
    size = (lo + hi + 1) / 2;
    if (find()) {
      lo = size;
    } else {
      hi = size-1;
    }
  }
  return lo;
}

int main() {
  scanf(" %d%s", &N, S);
  init();
  printf("%d\n", solve());
  return 0;
}

Measured memory_bytes: 768
"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});
/* 入力は 
computer
Nurtures computer scientists and highly-skilled computer engineers
who will create and exploit "knowledge" for the new era.
Provides an outstanding computer environment.
END_OF_TEXT
 */

reader.on('close', () => {
    var w = lines.shift().toLowerCase();
    var re = new RegExp("END_OF_TEXT.*");
    var t = lines.join(' ').toLowerCase().replace(re,'');

    console.log(t.split(/\s/).filter(x=>x===w).length)
});


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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var a = new int[N];
            var b = new int[N];
            var c = new int[N];
            for (int i = 0; i < N; i++)
            {
                var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
                a[i] = input[0];
                b[i] = input[1];
                c[i] = input[2];
            }

            var ans = new Dictionary<Act, int>[N];

            ans[0] = new Dictionary<Act, int> { { Act.A, 0 }, { Act.B, 0 }, { Act.C, 0 } };
            ans[0][Act.A] = a[0];
            ans[0][Act.B] = b[0];
            ans[0][Act.C] = c[0];

            for (int i = 1; i < N; i++)
            {
                ans[i] = new Dictionary<Act, int> { { Act.A, 0 }, { Act.B, 0 }, { Act.C, 0 } };
                ans[i][Act.A] = Max(ans[i - 1][Act.B] + a[i], ans[i - 1][Act.C] + a[i]);
                ans[i][Act.B] = Max(ans[i - 1][Act.A] + b[i], ans[i - 1][Act.C] + b[i]);
                ans[i][Act.C] = Max(ans[i - 1][Act.A] + c[i], ans[i - 1][Act.B] + c[i]);
            }

            Console.WriteLine(Max(ans[N - 1][Act.A], ans[N - 1][Act.B], ans[N - 1][Act.C]));
        }

        private static int Max(params int[] values)
        {
            return values.Max();
        }

        private enum Act { A, B, C }
    }
}


Measured memory_bytes: 40224
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.stream.Stream;

import java.util.Set;
import java.util.HashSet;

public class Main {

    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();
	    String line = "";

	    while((line = br.readLine()) != null){
		lines.add(line);
	    }
	    br.close();

	    //lines.add("2 3 4");
	    //lines.add("1 2 3");
	    //lines.add("0 1 3");
	    //lines.add("1 2 3 4");
	    //lines.add("1 0 2 1");
	    //lines.add("1 0 3 2");

	    Integer n, m, l = 0;
	    n = Integer.parseInt(lines.get(0).split(" ")[0]);
	    m = Integer.parseInt(lines.get(0).split(" ")[1]);
	    l = Integer.parseInt(lines.get(0).split(" ")[2]);

	    Long[][] A = new Long[n][m];
	    Long[][] b = new Long[m][l];
	    Long[][] C = new Long[n][l];

	    for (int i=1; i<n+1; i++) {
		String[] elements = lines.get(i).split(" ");
		for (int j=0; j<m; j++) {
		    A[i-1][j] = Long.parseLong(elements[j]);
		}
	    }
	    for (int i=n+1; i<n+m+1; i++) {
		String[] elements = lines.get(i).split(" ");
		for (int j=0; j<l; j++) {
		    b[i-n-1][j] = Long.parseLong(elements[j]);
		}
	    }

	    //          [l]
	    //      __________
	    //      |  |  |  |
	    //	    |  |  |  |
	    // [n]  |  |  |  |
	    //      |--|--|--|
	    //
	    for (int i=0; i<n; i++) {
		for (int j=0; j<l; j++) {
		    C[i][j] = 0L;
		}
	    }

	    for (int i=0; i<n; i++) {
		for (int j=0; j<m; j++) {
		    for (int k=0; k<l; k++) {
			//System.out.print(String.format("%d * %d ,", A[i][j], b[j][k]));
			Long x = A[i][j] * b[j][k];
			C[i][k] += x;
		    }
		}
	    }

	    for (int i=0; i<n; i++) {
		for (int j=0; j<l; j++) {
		    if (j == l-1) {
			System.out.println(C[i][j]);
		    } else {
			System.out.print(C[i][j] + " ");
		    }
		}
	    }

	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
}

Measured memory_bytes: 61452
n, m = list(map(int, input().split()))
if n>=m:
  print(0)
  exit()
x = list(map(int, input().split()))
x.sort()
start = [0 for i in range(n)]
s = [[0, i] for i in range(m)]
for i in range(1, m):
  s[i][0] = x[i]-x[i-1]
s.sort(reverse=True)
for i in range(1, n):
  start[i] = s[i-1][1]
ans = 0
for i in range(n):
  ans += x[start[i]-1]-x[start[i]]
print(ans)

Measured memory_bytes: 21324
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u) {
    int v;
    color[u] = GRAY;
    d[u] = ++tt;
    for ( v = 0; v < n; v++) {
        if (M[u][v] == 0 ) continue;
        if (color[v] == WHITE ) {
            dfs_visit(v);
        }
    }
    color[u] = BLACK;
    f[u] = ++tt;
}

void dfs() {
    int u;
    for ( u = 0; u < n; u++) {
        if ( color[u] == WHITE ) dfs_visit(u);
    }
    for (u = 0; u < n; u++) {
        printf("%d %d %d\n", u + 1, d[u], f[u]);
    }
}

int main() {
    int u, v, k, i, j;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) M[i][j] = 0;
    }
    
    for (i = 0; i < n; i++) {
        scanf("%d %d", &u, &k);
        u--;
        for ( j = 0; j < k; j++) {
            scanf("%d", &v);
            v--;
            M[u][v] = 1;
        }
    }
    
    dfs();
    
    return 0;
}


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

int main(){
  vector<vector<int>> grid(3,vector<int>(3));
  for (auto && a : grid) {
    for(auto &&b : a){
      cin>>b;
    }
  }
  bool flg = false;
  int a[3];
  int b[3];
  for (a[0] = 0; a[0] < 101; a[0]++) 
  for (a[1] = 0; a[1] < 101; a[1]++) 
  for (a[2] = 0; a[2] < 101; a[2]++) 
  {
    b[0] = grid[0][0] - a[0];
    b[1] = grid[1][1] - a[1];
    b[2] = grid[2][2] - a[2];

    if (a[0]+b[1] == grid[0][1] &&
        a[0]+b[2] == grid[0][2] &&
        a[1]+b[0] == grid[1][0] &&
        a[1]+b[2] == grid[1][2] &&
        a[2]+b[1] == grid[2][1] &&
        a[2]+b[0] == grid[2][0]  )
    flg = true;
  }
    cout << (flg ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

const int N=3e5+5;

ll dp[N],dp2[N],m=998244353,n,k,l[15],r[15];

int main()
{ios_base::sync_with_stdio(false);
cin>>n>>k;
rep(i,0,k-1)cin>>l[i]>>r[i];
dp[1]=1;
dp[2]=-1;
rep(i,1,n)
{

	dp[i]=(dp[i]+dp[i-1])%m;
	//o2(i,dp[i]);on;
	rep(j,0,k-1)
	{
		ll lo=i+l[j],hi=i+r[j]+1;
		//o2(lo,hi);on;
		if(lo<=n)dp[lo]=(dp[lo]+dp[i])%m;
		if(hi<=n)dp[hi]=(dp[hi]-dp[i])%m;
	}
}
ol((dp[n]+m)%m);
return 0;
}



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

int solve() {
  int N; cin >> N;
  vector<int> A(N), B(N), ordA(N), ordB(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  for (int i = 0; i < N; i++) cin >> B.at(i);
  iota(ordA.begin(), ordA.end(), 0);
  sort(ordA.begin(), ordA.end(),
       [&](int p, int q) { return A.at(p) < A.at(q); });
  iota(ordB.begin(), ordB.end(), 0);
  sort(ordB.begin(), ordB.end(),
       [&](int p, int q) { return B.at(p) < B.at(q); });
  for (int i = 0; i < N; i++) {
    if (A.at(ordA.at(i)) > B.at(ordB.at(i))) return 0;
  }
  for (int i = 0; i < N-1; i++) {
    if (A.at(ordA.at(i+1)) <= B.at(ordB.at(i))) return 1;
  }

  vector<int> vA(N), ordVA(N);
  for (int i = 0; i < N; i++) vA.at(i) = A.at(ordB.at(i));
  iota(ordVA.begin(), ordVA.end(), 0);
  sort(ordVA.begin(), ordVA.end(),
       [&](int p, int q) { return vA.at(p) < vA.at(q); });
  int cnt = 0;
  int i = 0;
  while (ordVA.at(i) != 0) {
    i = ordVA.at(i);
    cnt++;
  }
  if (cnt == N-1) return 0;
  return 1;
}

int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  string ans = solve() ? "Yes\n" : "No\n";
  cout << ans;
  return 0;
}





Measured memory_bytes: 2560
#include <stdio.h>

int main(void)
{
    int n;
    int h[101];

    int i, j;
    int ans;

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

    ans = 1;
    for(i=1;i<n;i++){
        for(j=0;j<i;j++){
            if(h[i] < h[j]){
                break;
            }
        }
        if(j == i){
            ans++;
        }
    }

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

    return 0;
}


Measured memory_bytes: 128
# 参考: https://beta.atcoder.jp/contests/abc059/submissions/3269205
N = gets.to_i
AS = gets.split.map(&:to_i)

results = [1, -1].map do |s|
  sum = 0
  count = 0
  AS.each do |a|
    s = s < 0 ? 1 : -1
    sum += a
    if sum == 0
      count += 1
      sum = s > 0 ? -1 : 1
      next
    end
    if s > 0
      if sum > 0
        count += sum + 1
        sum = -1
      end
    else
      if sum < 0
        count += -sum + 1
        sum = 1
      end
    end
  end
  count
end

p results.min

Measured memory_bytes: 8588
h, w = map(int, input().split())
c = [list(map(int , input().split())) for _ in range(10)]
a = [list(map(int , input().split())) for _ in range(h)]

import numpy as np
from scipy.sparse.csgraph import floyd_warshall

G = np.array(c)
dist = floyd_warshall(G)

#print(dist)
ans = 0
for i in range(h):
    for j in range(w):
        ai = a[i][j]
        if ai == -1:
            continue
        ans += dist[ai][1]
print(int(ans))

Measured memory_bytes: 28144