akhauriyash/Code-Regression huggingface dataset:
timelist = []

for i in range(5):
    timelist.append(int(input()))

min_order = 10**9
for a in range(5):
    for b in range(5):
        if a == b:
            continue
        for c in range(5):
            if a == c or b == c:
                continue
            for d in range(5):
                if a == d or b == d or c == d:
                    continue
                for e in range(5):
                    if a == e or b == e or c == e or d == e:
                        continue
                    m = timelist[a]
                    mul = 10 - m%10 if m%10>0 else 0
                    m += mul + timelist[b]
                    mul = 10 - m%10 if m%10>0 else 0
                    m += mul + timelist[c]
                    mul = 10 - m%10 if m%10>0 else 0
                    m += mul + timelist[d]
                    mul = 10 - m%10 if m%10>0 else 0
                    m += mul + timelist[e]
                    min_order = min(min_order, m)
print(min_order)


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

using namespace std;
using ll=int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi=vector<int>;
using vii=vector<vi>;
using vl=vector<ll>;
using vll=vector<vl>;
using tpi=tuple<int, int, int>;

int main() {
    using vp=vector<pii>;
    int N, W;
    cin >> N >> W;
    vp items(N + 1);
    int v_sum = 0;
    for (int i = 1; i <= N; i++) {
        int w, v;
        cin >> w >> v;
        items[i] = make_pair(w, v);
        v_sum += v;
    }

    vll dp(N + 1, vl(v_sum + 1, 1e12 + 1));
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= v_sum; j++) {
            ll tmp = 1e12 + 1;
            if (j <= items[i].second) {
                dp[i][j] = min(dp[i][j], static_cast<ll>(items[i].first));
            }
            if (j >= items[i].second) {
                ll prev = dp[i - 1][j - items.at(i).second];
                if (prev == 1e12 + 10) {
                    prev = 0;
                }
                tmp = prev + items[i].first;
            }
            tmp = min(dp[i - 1][j], tmp);
            auto l = min(dp[i][j], tmp);
            dp[i][j] = l;
        }
    }

    for (int i = v_sum; i >= 1; i--) {
        if (dp[N][i] <= W) {
            cout << i << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}


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

int main() {
  int n, L, a, sum = 0, e = 10000;
  cin >> n >> L;
  for (int i = 1; i <= n; i++) {
    a = L + i - 1;
    sum += a;
    if (abs(a) < abs(e)) e = a;
  }
  cout << sum - e << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <tuple>
#include <algorithm>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>
using namespace std;
long long int MOD = 1000000000 + 7;
using ll = long long;
ll LARGE = 1000000;


int main() {
	ll n, xx, yy;
	cin >> n >> xx >> yy;
	vector<ll> cnt(n, 0);

	ll x = min(xx, yy);
	ll y = max(xx, yy);
	for (ll i = 1; i <= n - 1; ++i) {
		for (ll j = i + 1; j <= n; ++j) {
			ll d1 = j - i;
			ll d2 = abs(y - j) + abs(x - i) + 1;
			ll d = min(d1, d2);
			cnt[d]++;
		}
	}

	for (ll i = 1; i < n; ++i) {
		cout << cnt[i] << endl;
	}

	return 0;
}


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

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  vector<int> L(N+1, A[0]);
  FOR(i, 1, N) L[i] = __gcd(L[i-1], A[i]);

  vector<int> R(N+1, A[N-1]);
  RREP(i, N) R[i] = __gcd(R[i+1], A[i]);

  int ans = max(L[N-2], R[1]);
  REP(i, N-1){
    chmax(ans, __gcd(L[i], R[i+2]));
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2560
S = list(input()) #１文字ずつ
N = len(S)

cnt=[0]*26
al = [chr(ord('a') + i) for i in range(26)]
for i in range(N):
    for j in range(26):
        if S[i] == al[j]:
            cnt[j]+=1
# print(cnt)

out='yes'
for i in range(26):
    if cnt[i]>=2:
        out='no'

print(out)


Measured memory_bytes: 62040
#include <bits/stdc++.h>
 
#define pb push_back
#define ll long long        
using namespace std;
 
void scan()
{
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
 
}
const int N = 1e6 + 500;
const int mod = 1e9 + 7;

vector<int> g[N]; 
int was[N];
void dfs(int v)
{
	if (was[v])
	{
		return;
	}
	was[v] = 1;
	for (int i = 0; i < g[v].size(); i++)
	{
		dfs(g[v][i]);
	}
}
int main() 
{
    scan();     
    int n, m;
    cin >> n >> m;        
    for (int i = 1; i <= m; i++)
    {
    	int a, b, c;
    	cin >> a >> b >> c;
    	g[a].pb(b);
    	g[b].pb(a);
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++)
    {
    	if (was[i])
    	{
    		continue;
    	}
    	dfs(i);
    	ans++;
    }
    cout << ans;
}     
//JUDGE_ID: 295965SY
//Tis I

Measured memory_bytes: 33528
let prim a n =
  let d = Array.make n max_int in
  d.(0) <- 0;
  let z = Array.make n (-1) in
  let b = Array.make n false in
  let rec get_u i m u =
    if i = n then u
    else if b.(i) = false && m > d.(i) then get_u (i + 1) d.(i) i
    else get_u (i + 1) m u
  in
  let rec doit () =
    let u = get_u 0 max_int (-1) in
    if u <> (-1) then (b.(u) <- true; duduwa 0 u)
  and duduwa j u =
    if j = n then doit ()
    else begin
      if b.(j) = false && a.(u).(j) <> max_int && d.(j) > a.(u).(j) then begin
        d.(j) <- a.(u).(j);
        z.(j) <- u
      end;
      duduwa (j + 1) u
    end in
  doit ();
  let rec sum i acc =
    if i = n then acc
    else sum (i + 1) (acc + (if z.(i) <> (-1) then a.(i).(z.(i)) else 0))
  in sum 0 0

let () =
  let n = read_int () in
  let a = Array.make_matrix n n max_int in
  let rec read = function
    | (i, _) when i = n -> ()
    | (i, j) when j = n -> read (i + 1, 0)
    | (i, j) ->
      let x = Scanf.scanf " %d " (fun x -> x) in
      if x <> (-1) then a.(i).(j) <- x;
      read (i, j + 1)
  in read (0, 0);
  Printf.printf "%d\n" (prim a n)

Measured memory_bytes: 4564
#include<stdio.h>
#include<string.h>

int main(void) {
  const double RATE = 380000.0;
  const char *UNIT_JPY = "JPY";

  int N;
  double price, sum;
  char unit[4];
  scanf("%d", &N);
  for(int i=0;i<N;i++) {
    double x;
    scanf("%lf %s", &x, unit);
    if(strcmp(unit, UNIT_JPY) == 0) {
      sum += x;
    } else {
      sum += RATE * x;
    }
  }

  printf("%lf\n", sum);

  return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	int n;
	cin >> n;
	vl a(n);
	rep(i,0,n) {
		cin >> a[i];
	}
	ll k = 2;
	ll ret = a[0] - 1;
	rep(i,1,n) {
		if(k == a[i]) {
			k++;
		} else if(k < a[i]) {
			if(a[i]%k) {
				ret += a[i]/k;
			} else {
				ret += (a[i]/k)-1;
			}
		}
	}
	cout << ret << '\n';
	return 0;
}


Measured memory_bytes: 1024
let words str = Str.split (Str.regexp " ") str |> List.map int_of_string

let bs elem (a: int array) =
  let rec loop (i_min,i_max) =
    if i_min > i_max then false
    else
      let mid = (i_min+i_max)/2 in
      if a.(mid) = elem then true
      else
        loop (if a.(mid) < elem then mid+1,i_max else i_min,mid-1)
  in loop (0,(Array.length a) -1)


let () =
  let _ = read_int () in
  let s = read_line () |> words |> Array.of_list in
  let _ = read_int () in
  let t = read_line () |> words in
  List.fold_left (fun acc x -> match bs x s with true -> acc+1 | false -> acc)
    0 t
  |> Printf.printf "%d\n"

Measured memory_bytes: 16236
import java.util.Scanner;                                                                        
class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int count[][][] = new int[4][3][10];
        for(int i = 0; i <= 3; i++){
            for(int j = 0; j <= 2; j++){
                for(int e = 0; e <= 9; e++){
                    count[i][j][e] = 0;
                }
            }
        }
        for(int i =1; i <= n; i++){
        int b = in.nextInt();
        int f = in.nextInt();
        int r = in.nextInt();
        int v = in.nextInt();
        count[b-1][f-1][r-1] += v;
        }
        for(int i = 0; i <= 3; i++){
            for(int j = 0; j <= 2; j++){
                   for(int e = 0; e <= 9; e++){
                    System.out.print(" " + count[i][j][e]);
                }
                System.out.println();
            }
            if(i != 3){
            System.out.println("####################");
            }
        }
    }
}              

Measured memory_bytes: 29192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N;
    cin >> N;
    vector<iint> red(N), blue(N);
    for (int i = 0; i < N; i++) {
        cin >> red[i].first >> red[i].second;
    }
    for (int i = 0; i < N; i++) {
        cin >> blue[i].first >> blue[i].second;
    }
    sort(ALL(red), greater<iint> ());


    vector<bool> used(N, false);
    for (int i = 0; i < N; i++) {
        int v = -1; int y = 10000;
        for (int j = 0; j < N; j++) {
            if(used[j]) continue;
            if(red[i].first < blue[j].first && red[i].second < blue[j].second){
                if(blue[j].second < y){
                    v = j; y = blue[j].second;
                }
            }
        }
        if(v != -1) used[v] = true;
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if(used[i]) ans++;
    }

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

}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int a[2030];
int tac[200010];
int md=2019;
ll res;
int main()
{
	cin >>s;
	a[0]++;
	tac[s.size()]=0;
	int t=1;
	for (int i=s.size()-1;i>=0;i--)
	{
		tac[i]=(tac[i+1]+(s[i]-'0')*t)%md;
		t=(t*10)%md;
		a[tac[i]]++; 
	}
	for (int i=s.size()-1;i>=0;i--)
	{
		a[tac[i]]--;
		res+=a[tac[i]];
	}
	cout <<res;
	return 0;
}

Measured memory_bytes: 4540
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>

using namespace std;

const int nax = 1005;
char a[nax][nax];
int n,m;

int xx1,yy1;
int xx2,yy2;

int par[nax * nax];

int f(int v)
{
    if(par[v] == v) return v;
    return par[v] = f(par[v]);
}

void u(int x,int y)
{
    x = f(x);
    y = f(y);
    if(x == y) return;
    if(rand()%2) swap(x,y);
    par[x] = y;
}

vector<int> adj[nax * nax];

int d[nax * nax];
bool vis[nax * nax];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>m;
    cin>>xx1>>yy1;
    cin>>xx2>>yy2;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>a[i][j];
            par[i*m+j] = i * m + j;
        }
    }
    vector<int> dx = {-1,1,0,0};
    vector<int> dy = {0,0,-1,1};
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            for(int k=0;k<4;k++)
            {
                int x = dx[k];
                int y = dy[k];
                x += i;
                y += j;
                if(x >= 1 && x <= n && y >= 1 && y <= m)
                {
                    if(a[x][y] == '.' && a[i][j] == '.')
                    {
                        u(x * m + y,i * m + j);
                    }
                }
            }
        }
    }

    vector<int> go1 = {-2,-1,0,1,2};

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            for(int x=-2;x<=2;x++)
            {
                for(int y=-2;y<=2;y++)
                {
                    if(x == 0 && y == 0) continue;
                    int xd = x + i;
                    int yd = y + j;
                    if(xd < 1 || xd > n || yd < 1 || yd > m) continue;
                    if(a[i][j] != '.' || a[xd][yd] != '.') continue;
                    if(f(i * m + j) != f(xd * m + yd))
                    {
                        int s1 = f(i*m+j);
                        int s2 = f(xd*m+yd);
                        adj[s1].pb(s2);
                        adj[s2].pb(s1);
                    }
                }
            }
        }
    }

    int s1 = f(xx1 * m + yy1);
    int s2 = f(xx2 * m + yy2);
    vector<int> bfs;
    int wsk = 0;
    bfs.pb(s1);
    vis[s1] = true;
    while(wsk < bfs.size())
    {
        int akt = bfs[wsk++];
        for(auto x : adj[akt])
        {
            if(vis[x] == false)
            {
                d[x] = d[akt] + 1;
                vis[x] = true;
                bfs.pb(x);
            }
        }
    }

    if(vis[s2] == false) cout<<-1;
    else cout<<d[s2]<<endl;

    return 0;
}


Measured memory_bytes: 59264
/*<----------------------------------------------------------------------->

<-------------------------------------------------------------------------->
            _           __                _      _____ _____ _____ 
  ___ _   _| |__   ___ / _|_ __ ___  __ _| | __ |___  |___  |___  |
 / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ /    / /   / /   / / 
| (__| |_| | |_) |  __/  _| | |  __/ (_| |   <    / /   / /   / /  
 \___|\__,_|_.__/ \___|_| |_|  \___|\__,_|_|\_\  /_/   /_/   /_/   

*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vi;
typedef vector<pll> vpll;
typedef unordered_map <ll,ll> umap ; 
//#pragma GCC optimize "trapv"
#define loop(i,a,b) for(ll i=a ;i<b;i++)
#define For(i,n) for(int i=0;i<(ll)n;i++)
#define Rev(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define F first
#define S second
#define pb push_back
#define em emplace_back
#define all(v) (v).begin(),(v).end()
#define mems(x, y) memset(x, y, sizeof(x))
#define sz(v) (v).size()
#define mp(a,b) make_pair(a,b)
#define pf(n) cout<<n<<"\n"
#define pff(n) cout << n << " " ; 
long const M=1e9+7;
const long mxN =1e5+2 ;
const long mxNN =1e6+2 ;
void solve(){
    string s ; cin >> s ;
    if(s[3]==s[2] && s[5]==s[4]){
        pf("Yes") ;
        return ;
    }
    
    pf("No");
    
    
    
    
    
    
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve() ;
    //ll t ; cin >> t ; while(t--)solve();
	return 0;
}


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

int main()
{
	int N;
	cin >> N;
	vector<int64_t> A(N), B(N), C(N);

	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
	}
	for (int i = 0; i < N; ++i)
	{
		cin >> B[i];
	}
	for (int i = 0; i < N; ++i)
	{
		cin >> C[i];
	}

	sort(A.begin(), A.end());
	sort(C.begin(), C.end());

	int64_t count = 0;
	for (int i = 0; i < N; ++i)
	{
		auto it_a = lower_bound(A.begin(), A.end(), B[i], [](int64_t a, int64_t b) { return a < b; });
		auto it_c = lower_bound(C.begin(), C.end(), B[i], [](int64_t c, int64_t b) { return c <= b; });
		count += distance(A.begin(), it_a) * distance(it_c, C.end());
	}

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

Measured memory_bytes: 2560
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector<double> vd;
typedef std::vector<std::string> vs;
typedef std::vector<pii> vpii;
typedef std::vector<vi> vvi;
typedef std::vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  int h, w;
  cin >> h >> w;
  vvi v(h, vi(w));
  rep(i, h) rep(j, w) {
    char c;
    cin >> c;
    v[i][j] = c - '0';
  }
  vvi dp(h, vi(w, INF));
  dp[0][0] = 0;
  rep(i, h) rep(j, w) {
    if (i > 0) cmin(dp[i][j], dp[i - 1][j] + v[i][j]);
    if (j > 0) cmin(dp[i][j], dp[i][j - 1] + v[i][j]);
  }
  cout << dp.back().back() << endl;
}

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

using namespace std;

template <typename T,typename E>
struct SegmentTree{
  typedef function<T(T,T)> F;
  typedef function<T(T,E)> G;
  int n;
  F f;
  G g;
  T d1;
  E d0;
  vector<T> dat;
  SegmentTree(){};
  SegmentTree(int n_,F f,G g,T d1,
	      vector<T> v=vector<T>()):
    f(f),g(g),d1(d1){
    init(n_);
    if(n_==(int)v.size()) build(n_,v);
  }
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    dat.clear();
    dat.resize(2*n-1,d1);
  }
  void build(int n_, vector<T> v){
    for(int i=0;i<n_;i++) dat[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--)
      dat[i]=f(dat[i*2+1],dat[i*2+2]);
  }
  void update(int k,E a){
    k+=n-1;
    dat[k]=g(dat[k],a);
    while(k>0){
      k=(k-1)/2;
      dat[k]=f(dat[k*2+1],dat[k*2+2]);
    }
  }
  inline T query(int a,int b){
    T vl=d1,vr=d1;
    for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) vl=f(vl,dat[(l++)-1]);
      if(r&1) vr=f(dat[(--r)-1],vr);
    }
    return f(vl,vr);
  }
  
};

int main(){
    int n;
    cin >> n;
    vector<int> P(n);
    copy_n(istream_iterator<int>(cin), n, P.begin());
    SegmentTree<int,int> rmq(n,
                [](int a,int b){return max(a,b);},
                [](int a,int b){return b;},
                0);

    for (int i = 0; i < n; i++)
        rmq.update(i, P[i]);

    auto b_search = [&](auto ok, auto ng, auto check, auto i, auto r){
        while (abs(ok - ng) > 1){
            auto mid = (ok + ng) / 2;
            if (check(mid, r, i))
                ok = mid;
            else
                ng = mid;
        }
        return ok;
    };

    auto check = [&](auto mid, auto r, auto i){
        if (r < mid) swap(r, mid);
        return rmq.query(mid, r + 1) <= P[i];
    };

    int64_t ans = 0;
    for (int i = 0; i < n; i++){
        int l1 = b_search(i, -1, check, i, i);
        int l2 = b_search(max(0, l1 - 1), -1, check, i, max(0, l1 - 2));
        int r1 = b_search(i, n, check, i, i);
        int r2 = b_search(min(n - 1, r1 + 1), n, check, i, min(n - 1, r1 + 2));

        ans += (int64_t)(i - l1 + 1) * (r2 - r1) * P[i];
        ans += (int64_t)(r1 - i + 1) * (l1 - l2) * P[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int H, W;
    cin >> H >> W;
    char a[100][100];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
        }
    }

    for(int i=0;i<W+2;i++)
        cout << '#';
    cout << endl;
    for(int i=0;i<H;i++){
        cout << '#';
        for(int j=0;j<W;j++)
            cout << a[i][j];
        cout << '#' << endl;
    }
    for(int i=0;i<W+2;i++)
        cout << '#';
    cout << endl;
    
}

Measured memory_bytes: 256
from itertools import permutations, combinations

M = 10**9+7


def solve(n, x):
    res = 1
    k = 0
    for i in range(n):
        k += 1
        if x[i] < 2 * k - 1:
            res *= k
            res %= M
            k -= 1
    if k > 0:
        for i in range(1, k+1):
            res *= i
            res %= M
    return res


def solve2(n, x):
    res = 0
    for p in permutations(range(n)):
        done = set()
        ok = True
        for i in range(n):
            can_win = True
            k = 1
            for j in range(p[i]):
                if j in done:
                    continue
                can_win &= x[j] >= k
                k += 2
            ok &= can_win
            done.add(p[i])
        if ok:
            res += 1
    return res


def check():
    for n in range(1, 8):
        for x in combinations(range(1, 2 * n + 1), n):
            expected = solve2(n, list(x))
            output = solve(n, list(x))
            if output != expected:
                print('x: {}'.format(x), end='\t')
                print('output: {}'.format(output), end='\t')
                print('expected: {}'.format(expected), end='\n')
                return x

if __name__ == '__main__':

    # print(check())

    n = int(input())
    x = list(map(int, input().split()))
    print(solve(n, x))


Measured memory_bytes: 14388
#include"bits/stdc++.h"


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

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

const int maxn = 100010;
const int mod = 998244353;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n,ans;

int Es[maxn];

ll x[maxn],y[maxn];

void Work(){
	Es[0]=1;REP(i,1,n)Es[i]=(Es[i-1]<<1)%mod;
	ans=(1ll*Es[n]-1ll*n*(n+1)/2%mod-1+mod)%mod;
	REP(i,1,n)REP(j,i+1,n){
		int t=0;
		REP(k,j+1,n)if((x[j]-x[i])*(y[k]-y[i])-(x[k]-x[i])*(y[j]-y[i])==0)t++;
		ans=(ans-Es[t]+1+mod)%mod;
	}
	iout(ans);
}

void Init(){
	read(n);
	REP(i,1,n)read(x[i],y[i]);
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 256
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque

inf = 10 ** 15
mod = 10 ** 9 + 7

n,h = map(int, input().split())
blist = []
amax = 0
for i in range(n):
    a,b = map(int, input().split())
    amax = max(amax, a)
    blist.append(b)
# aが最大のやつじゃないとフル価値なし
ans = (h+amax-1)//amax
blist.sort(reverse = True)
btotal=0
for i,num in enumerate(blist):
    tmp = h
    if num <= amax:
        break
    else:
        btotal+=num
        tmp-=btotal
        if tmp <= 0:
            ans = min(ans, i+1)
            break
        else:
            ans = min((tmp+amax-1)//amax + i+1, ans)
print(ans)





Measured memory_bytes: 55896
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if a%10==0:
    a_q=a
else:
    a_q=(a//10+1)*10
if b%10==0:
    b_q=b
else:
    b_q=(b//10+1)*10
if c%10==0:
    c_q=c
else:
    c_q=(c//10+1)*10
if d%10==0:
    d_q=d
else:
    d_q=(d//10+1)*10
if e%10==0:
    e_q=e
else:
    e_q=(e//10+1)*10

r=[i for i in [a%10,b%10,c%10,d%10,e%10]  if i%10!=0]
if r==[]:
    r_min=10
else:
    r_min=min(r)

ans=a_q+b_q+c_q+d_q+e_q-10+r_min
print(ans)

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

int main() {
	//受け取り、前処理
	long N;
	cin >> N;
	vector<pair<long, long>> V(N);
	for (long i = 0; i < N; i++){
		long a;
		cin >> a;
		V.at(i) = make_pair(a, i);
	}
	sort(V.begin(), V.end());

	//計算
	long ans = 0;
	std::set<long> S;
	S.insert(0);
	S.insert(N + 1);
	for (long i = 0; i < N; i++){
		long num = V.at(i).second + 1;
		decltype(S)::iterator r = S.lower_bound(num);
		auto l = r;
		l--;
		S.insert(num);
		ans += (num - *l) * (*r - num) * (i + 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll

const int md = 1000000007;
const int INF = 1<<30;
const double PI = acos(-1);



struct vec2{
    double x,y;
    vec2(double x=0,double y=0) :x(x),y(y) {}
};



vec2 divid3(vec2& a,vec2& b, int n){
    if(n == 1){
        double x = (2*a.x + b.x)/3;
        double y = (2*a.y + b.y)/3;
        return {x,y};
    }else{
        double x = (a.x + 2*b.x)/3;
        double y = (a.y + 2*b.y)/3;
        return {x,y};
    }
}

vec2 tri(vec2& a,vec2& b){
    double dx = b.x - a.x;
    double dy = b.y - a.y;

    double nx = dx*cos(PI/3) - dy * sin(PI/3) + a.x;
    double ny = dx*sin(PI/3) + dy * cos(PI/3) + a.y;

    return {nx,ny};

}


void dfs(vec2& f,vec2& e, int n){
    if(n == 0) {
        printf("%.6f %.6f\n",f.x,f.y);
        //cout << e.x <<" " <<  e.y << endl;
        return;
    }

    vec2 a,b,c;
    a = divid3(f,e,1);
    c = divid3(f,e,2);
    b = tri(a,c);
    dfs(f,a,n-1);
    dfs(a,b,n-1);
    dfs(b,c,n-1);
    dfs(c,e,n-1);
}

int main(){
    int n; cin >> n;
    vec2 a = {0,0};
    vec2 b = {100,0};
    dfs(a,b,n);

    printf("%.6f %.6f\n",100.0,0.0);
}



Measured memory_bytes: 3212
#include <iostream>
#include <string>

int main(){
	std::string predict;
  	std::string actual;
  	std::cin >> predict;
  	std::cin >> actual;
  	unsigned int accumulator = 0u;
  	for(unsigned int i = 0u; i < 3u; ++i){
      	if(predict[i] == actual[i]){
          	++accumulator;
        }
    }
  	std::cout << accumulator;
  	return 0;
}

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



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    ll x;
//    x=1ll << 59;
//    ll y=(1ll << 59) - 1ll;
//    cout<<((double)(x)==(double)(x-1))<<endl;
    ll n;
    cin>>n;
    ll l1[n+1],l2[n+1],sl1[n+1],sl2[n+1];
    sl1[0]=0;
    sl2[0]=0;
    for(int i=1;i<=n;i++){
        cin>>l1[i];
        sl1[i]=sl1[i-1]+l1[i];
    }
    for(int i=1;i<=n;i++){
        cin>>l2[i];
        sl2[i]=sl2[i-1]+l2[i];
    }
    ll s=0;
    for(int i=1;i<=n;i++){
        s=max(s,sl1[i]+sl2[n]-sl2[i-1]);
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
  int A, B;  
  cin >> A >> B;
  
  // A <= N * 0.08 < A + 1
  // B <= N * 0.1 < B + 1
  
  // A / 0.08 <= N < (A + 1) / 0.08
  // B * 10 <= N < (B + 1) * 10
  
  int N = -1;
  
  for (int i = B*10; i < (B+1) * 10; i++){
    if (A <= i * 0.08 && i * 0.08 < A + 1) {
      N = i;
      break;
    }
  }
  cout << N << endl;

}



Measured memory_bytes: 384
N = int(input())
rest = [list(input().split()) for n in range(N)]

for n in range(N):
    rest[n][1] = int(rest[n][1])
    rest[n].append(n + 1)
    
rest.sort(key = lambda x: x[1], reverse = True)
rest.sort(key=lambda x: x[0], reverse=False)


for n in range(N):
    print(rest[n][2])

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

main(){
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    if (x-r>=0 && y-r>=0 && x+r<=w && y+r<=h) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

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

    int n, y;
    cin >> n >> y;
    

    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            if(n - i - j < 0) continue;
            if(10000 * i + 5000 * j + 1000 * (n - i - j) == y){
                cout << i << " " << j << " " << n - i - j << endl;
                return 0;
            }
        }
    }

    cout << -1 << " " << -1 << " " << -1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <fstream>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long ll;
#define REP(i, N) for (int i = 0; i < (int)N; i++)

struct edge { int dest, weight, height; };

int dfs(int prev, int node, vector<vector<edge>> &adjacentList) {
  int res = 0;
  for(edge &e : adjacentList[node]) {
    if(e.dest == prev) continue;
    if(e.height == -1) e.height = e.weight + dfs(node, e.dest, adjacentList);
    res = max(res, e.height);
  }
  return res;
}

vector<int> heightsOfTree(vector<vector<edge>> &adjacentList) {
  int n = adjacentList.size();
  vector<int> heights(n);
  for(int i = 0; i < n; i++)heights[i] = dfs(-1, i, adjacentList);
  return heights;
}

int main () {
  int n;
  cin >> n;
  vector<vector<edge>> adjacentList(n, vector<edge>());
  for(int i = 0; i < n - 1; i++) {
    int s, t, w;
    cin >> s >> t >> w;
    adjacentList[s].push_back(edge {t, w, -1});
    adjacentList[t].push_back(edge {s, w, -1});
  }

  vector<int> heights = heightsOfTree(adjacentList);
  for(int i: heights) {
    cout << i << endl;
  }

  return 0;
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    ll x;
    cin>>x;

    ll now=100;
    ll con=0;
    while(now<x){
        now+=now/100;
        con++;
    }
    cout<<con<<en;
}

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

    solve();
    //ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define FILE "chad"
#define ll long long
#define up(i,j,k) for(int i=(j);i<=(k);i++)
#define pii pair<int,int>
template<class T> bool cmin(T& a,T b){return a>b?a=b,true:false;}
template<class T> bool cmax(T& a,T b){return a<b?a=b,true:false;}
template<class T> T max(T& a,T& b){return a>b?a:b;}
template<class T> T min(T& a,T& b){return a<b?a:b;}
const int maxn=255000,inf=1e9,mod=9901;
int read(){
	int ch=getchar(),x=0,f=1;
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return f*x;
}
int p[maxn],a[maxn],b[maxn],n;

int main(){
	//freopen(FILE".in","r",stdin);
	//freopen(FILE".out","w",stdout);
	n=read();
	up(i,1,n)p[i]=read();
	
	up(i,1,n){
		a[i]=i;
		b[i]=n-i+1;
	}
	int Max=n+1;
	up(i,2,n){
		int t=Max-a[p[i]]-b[p[i]]+1;
		a[p[i]]+=t,b[p[i]]+=t;
		up(j,1,n){
			if(j<p[i])b[j]+=t;
			else if(j>p[i])a[j]+=t;
		}
		Max=a[p[i]]+b[p[i]];
	}
	up(i,1,n)printf("%d%c",a[i],i==n?'\n':' ');
	up(i,1,n)printf("%d%c",b[i],i==n?'\n':' ');
	return 0;
}



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

using namespace std;
typedef long long ll;

int N, M;
int p[20];
vector <int> v[20];

int main()
{
    ios_base::sync_with_stdio(0);
    
    cin >> N >> M;
    for (int i = 0; i < M; i++)
    {
        int k; cin >> k;
        for (int j = 0; j < k; j++)
        {
            int x; cin >> x;
            v[i].push_back(x - 1);
        }
    }
    for (int i = 0; i < M; i++)
        cin >> p[i];

    int ans = 0;
    for (int i = 0; i < (1 << N); i++)
    {
        bool bad = false;
        for (int j = 0; j < M; j++)
        {
            int cv = p[j];
            for (int x : v[j])
                if (i & (1 << x))
                    cv = 1 - cv;
            if (cv)
                bad = true;
        }
        if (!bad)
            ans++;
    }
    cout << ans << "\n";
}

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair
#define clamp(v,lo,hi) min(max(v,lo),hi)

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }
template<typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template<typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }


inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }

int main() {
    string s; cin >> s;
    int L=s.size();
    vi cnt(2,0);
    rep(i,L){
        cnt[s[i]-'0']++;
    }
    printf("%d\n", 2*min(cnt[0], cnt[1]));
    return 0;
}


Measured memory_bytes: 512
n,p=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
f=0
for i in a:
    if i%2!=0:
        f=1
if f==0:
    if p==0:
        print(2**n)
    else:
        print(0)
else:
    print(2**(n-1))


Measured memory_bytes: 3060
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <cstdlib>
#define PI acos(-1.0)
#define ll long long int
#define db double
#define ull unsigned long long int
#define Fill(x,y) memset(x,y,sizeof(x))
#define bug printf("!!!!!!\n");
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
using namespace std;
const db eps = 1e-6;
const int inf = 0x3f3f3f3f; //用这个可以直接mem
const ll INF = 1e18;
const int mod = 1e9+7;
const int maxn = 1e5+5;
int cas=1;
int vis[200];
void solve()
{
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1 ; i <= n ; i++) {
        int x;
        cin >> x;
        if (!vis[x]) ans++;
        vis[x] = 1;
    }
    cout << ans << endl;
}
int main()
{
   //  freopen("in.txt","r",stdin);
    //  freopen("out.txt","w",stdout);
    int t = 1 ;
    //scanf("%d",&t);
    while(t--){
       // printf("Case %d: ", cas++);
        solve();
        //printf("\n");
    }
}









Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ans=0
for i in range(N):
    ans+=B[A[i]-1]
    if i>=1:
        if A[i]-A[i-1]==1:
            ans+=C[A[i-1]-1]
print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>

using namespace std;

#define pb push_back
typedef long long ll;
typedef complex<int> P;


double ans = 0;
double x[21], y[21], z[21];

double f(int i, int j){
	return (x[i]-x[j]) * (x[i]-x[j])
	+ (y[i]-y[j]) * (y[i]-y[j])
	+ (z[i]-z[j]) * (z[i]-z[j]);
}

void bfs(int n, int m, int k, int i, vector<int> v){	
	if(k==m){
//		for(int a=0;a<v.size();a++) cout<< " "<< v[a]; cout<< endl;
		double sum = 0;
		for(int i2=0;i2<v.size();i2++){
			for(int j2=i2+1;j2<v.size();j2++){
				sum += f(v[i2], v[j2]);
			}
		}
		ans = max(ans, sum);
		return;
	}
	if(i>=n) return;
	
	bfs(n, m, k, i+1, v);
	v.push_back(i);
	bfs(n, m, k+1, i+1, v);
	return;
}

bool solve(){
	int n, m;
	cin>> n>> m;
	for(int i=0;i<n;i++){
		cin>> x[i]>> y[i]>> z[i];
	}
	
	ans = 0; vector<int> v;
	bfs(n, m, 0, 0, v);
	cout<< ans<< endl;
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	
	solve();

	return 0;
}

 

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

int main()
{
	int a, b, c;

	cin >> a >> b >> c;

	if ((a == 5 && b == 7 && c == 5) || (a == 5 && b == 5 && c == 7) || (a == 7 && b == 5 && c == 5))
		cout << "YES";

	else
		cout << "NO";
	
	return 0;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;// 任意長整数型
using bint = mp::cpp_int;// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;// ついでに有理数型
using rat = boost::rational<bint>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
int main(){ //srand((unsigned)time(NULL));
  while(1){
    ll n;double m=0;
    vector<ll> s;
    cin >> n;
    if(n == 0)break;
    s.resize(n);
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      m += s[i];
    }
    m /= n;
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans += pow(s[i]-m,2.0);
    }ans /= n;
    cout << syo(5) << sqrt(ans) << endl;
  }
}



Measured memory_bytes: 3284
alf = list("abcdefghijklmnopqrstuvwxyz")

h, w = map(int, input().split())

for i in range(h):
    line = list(input().split())
    if "snuke" in line:
        x = line.index("snuke")
        y = i

print(alf[x].upper(),y+1, sep='')


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

int main()
{
	string s;
	char c;
	for (int i = 0; i < 3; i++) {
		cin >> c;
		s += c;
	}
	if (stoi(s)%4 == 0) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}



	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 r = sc.nextInt();
        int g = sc.nextInt();
        int b = sc.nextInt();

        int sum = r * 100 + g * 10 + b;
        System.out.println(sum % 4 == 0 ? "YES" : "NO");
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
/*
         ########     ########   ########   #########   ##       #######   ##       #######
         #      #     #      #   #      #       #       # #      #     #   # #      #     #
         #      #     #      #   #      #       #       #  #     #     #   #  #     #     #
         ########     #      #   #      #       #       #   #    #     #   #   #    #     #
         ###          #      #   #      #       #       #    #   #######   #    #   #######
         #  #         #      #   #      #       #       #   #    #     #   #   #    #     #
         #   #        #      #   #      #       #       #  #     #     #   #  #     #     #
         #    #       #      #   #      #       #       # #      #     #   # #      #     #
         #     #      ########   ########       #       ##       #     #   ##       #     #     
*/

#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcount //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define debug(a)          \
    cerr << #a << ": ";   \
    for (auto i : a)      \
        cerr << i << " "; \
    cerr << '\n';
#define trace(a) cerr << #a << ": " << a << "\n"
#define print(ar, n)            \
    for (int u = 0; u < n; u++) \
    {                           \
        cout << ar[u] << " ";   \
    }                           \
    cout << endl;
#define int long long
#define M 1000000007
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
signed main()
{
    rootdada;
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     //   freopen("output.txt", "w", stdout);
    //     //  freopen("error.txt", "w", stderr);
    // #endif
    int n;
    cin >> n;
    if (n % 1000 == 0)
        cout << 0 << endl;
    else
    {

        int ans = ((n / 1000) + 1) * 1000 - n;

        cout << ans << endl;
    }
}

Measured memory_bytes: 3644
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = (int) 1e5 + 5;
const int mod = (int) 1e9 + 7;

int n, a[3 * N];
ll ans;

inline void solve () {
        scanf ("%d", &n); n *= 3;
        for (int i = 1; i <= n; i++) {
                scanf ("%d", &a[i]);
        }
        sort (a + 1, a + n + 1);
        for (int i = n / 3 + 1; i <= n; i += 2) {
                ans += a[i];
        }
        printf ("%lld\n", ans);
}

int tests = 1;

int main () {
//        freopen (".in", "r", stdin);
//        freopen (".out", "w", stdout);
//        scanf ("%d", &tests);
        while (tests--) {
                solve ();
        }
        return 0;
}


Measured memory_bytes: 1408