akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    string s;
    cin >> s;
    if(s.size() % 2 == 1){
        cout << "No" << endl;
        return 0;
    }
    rep(i,s.size()){
        if(s.at(i) == 'h'){
            if(s.at(i+1) != 'i'){
                cout << "No" << endl;
                return 0;
            }
            i++;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
from collections import deque
N,D,A = map(int, input().split())
ps = []
def ceil(a,b):
    return -(-a//b)

for i in range(N):
    x,h = map(int, input().split())
    ps.append([x,h])

ps.sort()
damage = 0
cnt = 0
q = deque([])
for x,h in ps:
    while len(q) > 0 and q[0][0] < x:
        # 範囲外のものはダメージを与えられない
        _, d = q.popleft()
        damage -= d
    # 残りダメージ
    h_rest = h - damage
    if h_rest <= 0: continue
    num = ceil(h_rest, A)
    damage += num * A
    cnt += num
    r = x + 2*D
    q.append((r,num*A))
print(int(cnt))


Measured memory_bytes: 81624
a, b, c = map(int, input().split())
if a == b:
  if a == c:
    print(1)
  else:
    print(2)
elif a == c:
  if a == b:
    print(1)
  else:
    print(2)
elif b == c:
  if a == b:
    print(1)
  else:
    print(2)
else:
  print(3)


Measured memory_bytes: 3060
/*
    Created by vasu090 on 19 Apr, 2020
*/
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

#define rep(i, a, b) for(auto (i)=a;i<b;i++)
#define list(i, N) for(auto (i)=0;i<N;i++)

typedef long long ll;
typedef vector <ll> vi;
typedef pair <ll, ll> pi;
#define mp make_pair
#define pb push_back
#define eb emplace_back

#define int ll
#define INF 1e18+5
#define mod 1000000007

template<class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n; cin >> n;
    vi a(n+1); rep(i,1,n+1) cin >> a[i];
    vi b(n+1); rep(i,1,n+1) b[i] = -1;

    //work from the back
    for(int i=n;i>0;i--){
        //i is the multiple we are referring to
//        cout << "b[" << i << "] = " << b[i] << '\n';
        const int cura = a[i];
        /*
         * now go through all the numbers in the forward direction
         * and find the current sum we've gotten
         * if its equal to 'cura', then 0
         * else 1
         */
        int cursum = 0;
        for(int j=i+i;j<=n;j+=i) cursum += b[j];
        cursum %= 2;
        if(cursum<0) cursum+=2;
//        cout << "cursum for i : " << i << " is  " << cursum << " with cura : " << cura << "\n";
        b[i] = (int)cursum!=cura;
//        cout << "b[" << i << "] = " << b[i] << '\n';
    }

    int cnt = 0; vi ans;
    rep(i,1,n+1){
        if(b[i]==1){
            cnt++; ans.eb(i);
        }
    }

    cout << cnt << "\n";
    for(auto c: ans) cout << c << " ";
    cout << '\n';

//    rep(i,1,n+1) cout << b[i] << " ";

    return 0;
}

Measured memory_bytes: 5108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  const ll mod=1000000007;
  ll n;
  cin >> n;
  ll i;
  if(n==1){
    cout << 0 << endl;
    return 0;
  }
  ll a=1,b=1,c=1;
  for(i=0;i<n;i++){
    a=a*10%mod;
    b=b*9%mod;
    c=c*8%mod;
  }
  a=a%mod,b=b%mod,c=c%mod;
  ll ans=a-b-b+c;
  if(ans<=0){
    ans+=mod+mod+mod;
  }
  ans=ans%mod;
  cout << ans << endl;
}

Measured memory_bytes: 3628
n=int(input())
a=list(map(int,input().split()))
cnt_odd=0
cnt_even=0
cnt_4=0
for i in range(n):
  if a[i]%2!=0:
    cnt_odd+=1
  else:
    cnt_even+=1
    if a[i]%4==0:
      cnt_4+=1
if cnt_even-cnt_4==0:
  if cnt_4+1>=cnt_odd:
    print("Yes")
  else:
    print("No")
else:
  if cnt_4>=cnt_odd:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 14252
import sys

readline = sys.stdin.readline
N = int(readline())
CSF = [tuple(map(int, readline().split())) for _ in range(N-1)]
for i in range(N):
    time = 0
    for c, s, f in CSF[i:N-1]:
        if time < s:
            time = s
        else:
            time = (time+f-1)//f*f
        time += c
    print(time)


Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
            System.out.println("Possible");
            return;
        }
        System.out.println("Impossible");
    }

}


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

int a[200001],b[200001];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++)
		cin>>b[i];
	priority_queue<pair<int,int> > pq;
	long long int ans=0;
	for(int i=0;i<n;i++)
		if(a[i]!=b[i])
			pq.push(make_pair(b[i],i));
	while(!pq.empty()){
		auto now=pq.top();pq.pop();
		int neighbor=b[(now.second+1)%n]+b[(now.second+n-1)%n];
		if(b[now.second]-a[now.second]<neighbor){
			cout<<-1<<endl;
			return 0;
		}
		ans+=(b[now.second]-a[now.second])/neighbor;
		b[now.second]=a[now.second]+(b[now.second]-a[now.second])%neighbor;
		if(a[now.second]!=b[now.second])
			pq.push(make_pair(b[now.second],now.second));
	}
	cout<<ans<<endl;
}


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

typedef long long ll;

int dx[] = {1,0,0,-1,0,0};
int dy[] = {0,1,0,0,-1,0};
int dz[] = {0,0,1,0,0,-1};
ll A,B,C,N;
ll x[1000+10],y[1000+10],z[1000+10];

bool space(int vx,int vy, int vz,int cur){

    for(int i=0; i<cur; i++){
        if(vx == x[i] && vy == y[i] && vz == z[i]) return true;
    }

    if(vx < 0 || vy < 0 || vz < 0 || vx >= A || vy >= B || vz >= C) return true;

    return false;
}

int main(){
    cin>>A>>B>>C>>N;
    int cnt = 0;
    ll sum = 0;
    for(int i=0; i<N; i++){
        cin>>x[i]>>y[i]>>z[i];
        cnt = 0;

        for(int j=0; j<6; j++){
            int vx = x[i]+dx[j];
            int vy = y[i]+dy[j];
            int vz = z[i]+dz[j];
            if(space(vx,vy,vz,i)) cnt++;
        }

        sum += (6-cnt*2);
    }

    sum += 2*(A*B+B*C+C*A);

    cout<<sum<<endl;

    return 0;
}


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

using namespace std;

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


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

int main()
{
	int n; cin >> n;
	int pre; cin >> pre;
	int num;
	long long int req = 0;
	for(int i = 1; i < n; ++i)
	{
		cin >> num;
		req += max(0, pre - num);
		pre = max(pre, num);
	}
	cout << req;
}

Measured memory_bytes: 3620
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
D = []
for j in range(M):
    B, C = map(int, input().split())
    D.append((B,C))
#list is sorted by C in D
D = sorted(D, key = lambda x: x[1], reverse = True) 

i = 0
for j in range(M):
    b, c = D[j]
    for k in range(i, min(N, i+b)):
        if A[k] < c:
            A[k] = c
    i = i + b
print(sum(A))

Measured memory_bytes: 23276
n=int(input())
v=[[int(i) for i in input().split()] for j in range(n)]

s=0.0
for i in range(n-1):
  for j in range(i+1,n):
    s += ((v[i][0]-v[j][0])**2+(v[i][1]-v[j][1])**2)**(1/2)
print(2/n*s)


Measured memory_bytes: 3060
#include<stdio.h>

int main() {

    int N, A, B;
    int sum;

    scanf("%d", &N);
    scanf("%d", &A);
    scanf("%d", &B);

    sum = N * A;

    if (sum <= B) {
        printf("%d\n", sum);
    } else {
        printf("%d\n", B);
    }

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
  int num[100] = {0};
  int x, i, max=0;
  while(scanf("%d", &x) != EOF){
    num[x-1] += 1;
  }
  for(i=0;i<100;i++){
    if(max<num[i]){
      max = num[i];
    }
  }
  for(i=0;i<100;i++){
    if(max == num[i]){
      printf("%d\n", i+1);
    }
  }
  return 0;
}

Measured memory_bytes: 596
// 解き直し.
// ABC 128解説.
// https://img.atcoder.jp/abc128/editorial.pdf
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
LL S[123321];

int main() {
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    for(int i = 0; i < N; i++) scanf("%lld", S + i);
    
    // 2. 解説通り.
    // 以下の情報から, 計算するとのこと.
    // 0, (N - 1) - k * C, C, (N - 1) - (k - 1) * C, 2 * C, ... k * C, N - 1.
    // -> f(k + 1, C) = f(k, C) + S[N - 1 - k * C] + S[k * C] (k >= 0)
    LL ans = 0;
    for(int c = 1; c < N; c++){
        LL cur = 0, bef = 0;
        map<LL, int> route; // 経路情報を保存.
        for(int k = 0; k < (N - 1) / c; k++){
            
            // 2-1. 経路情報チェック.
            // すでに通っていた場合は, 終了.
            int pos1 = N - 1 - k * c;
            int pos2 = k * c;
            route[pos1]++, route[pos2]++;
            if(route[pos1] != 1 || route[pos2] != 1) break;
            
            // 2-2. cur更新.
            cur = bef + S[pos1] + S[pos2];
            
            // 2-3. 最終得点更新.
            ans = max(ans, cur);
            
            // 2-4. bef更新.
            bef = cur;
        }
    }
    
    // 3. 出力 ～ 後処理.
    printf("%lld\n", ans);
    return 0;
    
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

ll r, d, x;
int main() {
    cin >> r >> d >> x;
    for (int i = 0; i < 10; ++i) {
        x = r * x - d;
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 3556
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define fe(vec,lambda) std::for_each(vec.begin(), vec.end(), lambda );
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}


ll a,b,c;
vector<ll>v;
map<ll,ll>m;
void input(){
    cin>>a>>b>>c;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
}
void src(){
    cout<< (accumulate(v.begin(),v.end(),0ll) == *max_element(v.begin(),v.end())*2 ? "Yes":"No") ;
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
    //ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int X_max = -200;
    int Y_min=200;

    for(int i=0;i<N;i++){
    int x=sc.nextInt();
      if(x>X_max){
        X_max=x;
      }
    }
    for(int i=0;i<M;i++){
    int  y=sc.nextInt();
      if(y<Y_min){
        Y_min=y;
      }
    }

    for(int Z=X+1;Z<Y;Z++){
      if(X_max<Z && Z<=Y_min){
        //System.out.println(Z);
        System.out.println("No War");
        break;
      }
      if(Z==Y-1){
        System.out.println("War");
      }
    }
  }


}


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

int main()
{
    int N;
    // 
    cin >> N;
    //
    if( 1 <= N && N <=999)
    {
        cout << "ABC" << endl;
    }
    else
    {
        cout << "ABD" << endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin>>s;
    rep(i,4){
        cout<<s[i];
    }
    cout<<" ";
    FOR(i,4,12){
        cout<<s[i];
    }
    cout<<endl;
}

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

using namespace std;

#define ll long long

int main()
{
	ll N, W;
	cin >> N >> W;
	ll w[N], v[N];
	for(ll i = 0; i < N; i++)
		cin >> w[i] >> v[i];
	ll ans[N][W+1];
	for(ll i = 0; i < W+1; i++)
	{
		if(i >= w[0])
			ans[0][i] = v[0];
		else
			ans[0][i] = 0;
	}
	for(ll i = 1; i < N; i++)
	{
		for(ll j = 0; j < W+1; j++)
		{
			if(j-w[i] < 0)
				ans[i][j] = ans[i-1][j];
			else
				ans[i][j] = max(ans[i-1][j], ans[i-1][j-w[i]] + v[i]);
		}
	}
	cout << ans[N-1][W];
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

struct Edge {
	int to, cap, rev;
};
vector< vector<Edge> > G;
int dist[110][110];

void add_edge(int from, int to, int cap) {
//	cout << from << " " << to << " " << cap << endl;
	G[from].pb({to, cap, (int)G[to].size()});
	G[to].pb({from, 0, (int)G[from].size()-1});
}
int cost[3000];
void bfs(int s) {
	fill(cost, cost+3000, inf);
	queue<int> Q; Q.push(s); cost[s] = 0;
	while ( !Q.empty() ) {
		int v = Q.front(); Q.pop();
		EACH(e, G[v]) {
			if (e.cap > 0 && cost[v]+1 < cost[e.to]) {
				cost[e.to] = cost[v]+1;
				Q.push(e.to);
			}
		}
	}
}
bool used[3000];
int dfs(int s, int t, int f) {
	if (s == t) return f;
	if (used[s]) return 0;
	used[s] = true;
	EACH(e, G[s]) {
		if (e.cap > 0 && cost[e.to] == cost[s]+1) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s, int t) {
	int res = 0;
	while (1) {
		bfs(s);
		if (cost[t] == inf) break;
		while (1) {
			fill(used, used+3000, false);
			int f = dfs(s, t, inf);
			if (f == 0) break;
			res += f;
		}
	}
	return res;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
/*
	G.resize(4);
	add_edge(0, 1, 5);
	add_edge(0, 2, 4);
	add_edge(1, 2, 3);
	add_edge(1, 3, 10);
	add_edge(2, 3, 5);
	cout << max_flow(0, 3) << endl;
	return 0;
*/
	int N, M, L;
	while ( cin >> N >> M >> L, N || M || L ) {
		fill(dist[0], dist[110], inf);
		REP(i, M) {
			int u, v, d; cin >> u >> v >> d;
			dist[u][v] = min(dist[u][v], d);
			dist[v][u] = min(dist[v][u], d);
		}
		REP(i, N) dist[i][i] = 0;
		REP(k, N) REP(i, N) REP(j, N) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
		vector<P> task(L);
		REP(i, L) {
			int p, t; cin >> p >> t;
			task[i] = P(p, t);
		}
		int s = L*2, t = s+1;
		G = vector< vector<Edge> >(t+1);
		REP(i, L) REP(j, L) {
			if (i == j) continue;
			if (task[i].second+dist[task[i].first][task[j].first] > task[j].second) continue;
			add_edge(i, L+j, 1);
		}
		REP(i, L) add_edge(s, i, 1);
		REP(i, L) add_edge(L+i, t, 1);
		cout << L - max_flow(s, t) << endl;
	}
}

Measured memory_bytes: 18560
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var e = Array.ConvertAll(line, int.Parse);
        Array.Sort(e);
        for (int i = 1; i < 4; i++)
            if (e[0] != e[i]) { Console.WriteLine("no"); goto end; }
        for (int i = 5; i < 8; i++)
            if (e[4] != e[i]) { Console.WriteLine("no"); goto end; }
        for (int i = 9; i < 12; i++)
            if (e[8] != e[i]) { Console.WriteLine("no"); goto end; }
        Console.WriteLine("yes");
        end:;
    }
}

Measured memory_bytes: 9112
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, M, R = getNM()

d = [[float("inf")] * N for i in range(N)]
list_R = [int(i) - 1 for i in input().split()]
for i in range(M):
   x, y, z = getNM()
   d[x - 1][y - 1] = min(d[x - 1][y - 1], z)
   d[y - 1][x - 1] = min(d[x - 1][y - 1], z)

def warshall_floyd(dist):
    for k in range(N):
        # i:start j:goal k:中間地点でループ回す
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    #return dist

warshall_floyd(d)

ans = float('inf')
for case in permutations(list_R):
    x1 = case[0]
    opt = 0
    for j in range(1, R):
        x2 = case[j]
        opt += d[x1][x2]
        x1 = x2
    ans = min(ans, opt)
print(ans)

Measured memory_bytes: 78680
import math
N,X = map(int,input().split())
x = list(map(int,input().split()))
y = [abs(x[i]-X) for i in range(N)]
if N == 1:
    print(y[0])
    exit(0)
ans = math.gcd(y[0],y[1])
for i in range(2,N):
    ans = min(ans,math.gcd(y[i],ans))
print(ans)

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

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
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, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

const int INF = 1001001001;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

void solve() {
  int t;
  cin >> t;
  while (t--) {
    i64 n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    map<i64, i64> memo;
    auto dfs = [&](auto dfs, i64 x) -> i64 {
      if (memo.count(x)) {
        return memo[x];
      }
      if (x == 0) return 0;
      if (x == 1) return d;
      auto f = [&](i64 y) -> i64 {
        if (y >= x) return 1e18;
        return dfs(dfs, y);
      };
      i64 ret = 1e18;
      if ((f80) d * (f80) x < ret) {
        ret = d * x;
      }
      {
        i64 l = x / 2 * 2, r = l + 2;
        amin(ret, f(l / 2) + (x - l) * d + a);
        amin(ret, f(r / 2) + (r - x) * d + a);
      }
      {
        i64 l = x / 3 * 3, r = l + 3;
        amin(ret, f(l / 3) + (x - l) * d + b);
        amin(ret, f(r / 3) + (r - x) * d + b);
      }
      {
        i64 l = x / 5 * 5, r = l + 5;
        amin(ret, f(l / 5) + (x - l) * d + c);
        amin(ret, f(r / 5) + (r - x) * d + c);
      }
      return memo[x] = ret;
    };
    cout << dfs(dfs, n) << endl;
  }
}


Measured memory_bytes: 4780
N, Y = map(int, input().split())
ans = (-1, -1, -1)
for i in range(N + 1):
    for j in range(N + 1 - i):
        if N - i - j >= 0 and 10000 * i + 5000 * j + 1000 * (N - i - j) == Y:
            ans = (i, j, N - i - j)

print(ans[0], ans[1], ans[2])

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

long long  N, M;
vector<bool> h(100010, true);
vector<long long> dp(100010, -1);

int rec(long long i){
    if(dp[i]!=-1) return dp[i];
    if(h[i]==false) return 0;
    if(i==0) return 1;
    
    long long res = 0;
    if(h[i-1]) {
        res += rec(i-1);
        res %= 1000000007;
    }
    if(i>1) if(h[i-2]) {
        res += rec(i-2);
        res %= 1000000007;
    }
    return dp[i] = res;
}

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

    REP(i, M){
        int a;
        cin >> a;
        h[a] = false;
    }

    cout << rec(N) << endl;

   return 0;
}

Measured memory_bytes: 4096
//Littleboy123 Template 1.1

#include <bits/stdc++.h>
using namespace std;

//pragmas
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
*/

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define COUT(a) cout << (a) << '\n'
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)

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

//End of template

int main(){
	init();

	//debug
	/*
	ifstream in("input.in");
	streambuf *cinbuf = std::cin.rdbuf();
	cin.rdbuf(in.rdbuf());
	
	ofstream out("out.txt");
	streambuf *coutbuf = std::cout.rdbuf();
	cout.rdbuf(out.rdbuf());
	*/
	//end debug

	int n;
	cin >> n;
	ld arr[n];
	FOR(i, 0, n){
		cin >> arr[i];
	}
	ld ans = 0;
	FOR(i, 0, n){
		ans += 1/arr[i];
	}
	cout << fixed << setprecision(9) << ld(1)/ans << nl;
	return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left

INF = 2 * 10**10

A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
ans = []
for x in X:
    sr = bisect_left(S, x) 
    sl = sr -1
    if sr != len(S) and S[sr] == x:
        sl = sr
    tr = bisect_left(T, x)
    tl = tr - 1
    if tr != len(T) and T[tr] == x:
        tl = tr

    ll = INF if sl == -1 or tl == -1 else x - min(S[sl], T[tl])
    rr = INF if sr == len(S) or tr == len(T) else max(S[sr], T[tr]) - x
    lsrt = INF if sl == -1 or tr == len(T) else 2*(x-S[sl]) + (T[tr] - x)
    ltrs = INF if tl == -1 or sr == len(S) else 2*(x-T[tl]) + (S[sr] - x)
    rslt = INF if tl == -1 or sr == len(S) else 2*(S[sr] - x) + (x - T[tl])
    rtls = INF if sl == -1 or tr == len(T) else 2*(T[tr] - x) + (x - S[sl])

    ans.append(min(ll, rr, lsrt, ltrs, rslt, rtls))
print(*ans, sep='\n')

Measured memory_bytes: 21864
#include <iostream>
#include <vector>

void reverse(std::vector<int> &_in)
{
    for(int i = 0; i < _in.size() / 2; i++) {
        int tmp = _in[i];
        _in[i] = _in[_in.size() - i - 1];
        _in[_in.size() - i - 1] = tmp;
    }
}

int main(void)
{
    int n;
    std::cin >> n;
    std::vector<int> nums(n);
    for(int i = 0; i < n; i++) {
	std::cin >> nums[i];
    }
    reverse(nums);
    for(int i = 0; i < n; i++) {
	std::cout << nums[i];
	if(i != n - 1) { std::cout << " ";}
    }
    std::cout << std::endl;
    return 0;
}

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

using namespace std;
using ll=long long;
using Graph = vector<vector<int>>;

int main() {

    ll n;cin >> n;
    vector<ll> a(n),b(n),c(n);
    ll dp[n][3];
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i] >> b[i] >> c[i];
    }

    dp[0][0] = a[0];dp[0][1] = b[0];dp[0][2] = c[0];

    for (int i = 1; i < n ; ++i)
    {
        if(dp[i-1][1]+a[i]<dp[i-1][2]+a[i]) dp[i][0] = dp[i-1][2]+a[i];
        else dp[i][0] = dp[i-1][1]+a[i];
        if(dp[i-1][2]+b[i]<dp[i-1][0]+b[i]) dp[i][1] = dp[i-1][0]+b[i];
        else dp[i][1]= dp[i-1][2]+b[i];
        if(dp[i-1][0]+c[i]<dp[i-1][1]+c[i]) dp[i][2] =dp[i-1][1]+c[i];
        else  dp[i][2] = dp[i-1][0]+c[i];
    }
    ll mx=0;
    for (int i = 0; i < 3; ++i)
    { 
        if(mx<dp[n-1][i]) mx = dp[n-1][i];
    }
    cout << mx;
 return 0;

}




Measured memory_bytes: 4992
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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; }

//https://qiita.com/drken/items/a14e9af0ca2d857dad23

vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N,M; cin>>N>>M;
  vector<ll> vec=enum_divisors(M);
  for(auto v:vec) if(v>=N) {cout<<M/v<<endl; return 0;}
  return 0;
}

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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

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

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const int INF = INT_MAX;

template<typename T> inline constexpr auto sqr(T x) { return (x) * (x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }

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

	VI A(N);
	rbf(a, A) {
		cin >> a;
	}
	int sum = 0;
	rbf(a, A) {
		sum += a;
	}
	downsort(A);

	double Mth = static_cast<double>(A[M - 1]);
	double limit = sum / (4.0 * M);

	if (Mth < limit) COL("No");
	else COL("Yes");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
int main(){
    string s;cin >> s;
    int k;cin >> k;
    vector<string> v;
    for(int i=1;i<=5;i++){
        for(int j=0;j<s.size();j++){
            string t;
            for(int k=0;k<i;k++){
                if(j+k>=s.size()) continue;
                t+=s[j+k];
            }
            v.push_back(t);
        }
    }
    sort(v.begin(),v.end());
    int cnt=0;
    string pre="";
    for(int i=0;i<v.size();i++){
        if(pre!=v[i]){
            cnt++;
            pre=v[i];
        }
        if(cnt==k){
            cout << pre << endl;
            return 0;
        }
        //cout << pre << " " << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 1660
N = int(input())
L= sorted(list(map(int, input().split())))


ans = 0
for i in range(N):
  for j in range(i, N):
    for k in range(j, N):
      if len(list(set([L[i], L[j],  L[k]]))) == 3:
      	#print([L[i], L[j], L[k]])
        if L[k] < L[i] + L[j]:
          ans +=  1
print(ans)

Measured memory_bytes: 9200
#include<stdio.h>
int max(int A,int B){
  if(A>=B) return A;
  else return B;
}
int main(void){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);
  if(max(max(A,B),C)==A){
    printf("%d",A*10+B+C);
  }
  else if(max(max(A,B),C)==B){
    printf("%d",B*10+A+C);
  }
  else if(max(max(A,B),C)==C){
    printf("%d",C*10+B+A);
  }

  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    vector<vector<long>> vviDist(n+1,vector<long>(n+1,0));
    for(int i = 1; i < n+1; i++){
        for(int j = 1; j < n+1; j++){
            scanf("%ld", &vviDist[i][j]);
        }
    }
    
    long nAns = 0;
    for(int i = 1; i < n; i++){
        for(int j = i+1; j < n+1; j++){
            bool bLoad = true;
            for(int k = 1; k < n+1; k++){
                if(k == i || k == j){
                    continue;
                }
                if(vviDist[i][k] + vviDist[k][j] < vviDist[i][j]){
                    printf("-1");
                    return 0;
                }
                if(vviDist[i][k] + vviDist[k][j] == vviDist[i][j]){
                    bLoad = false;
                }
            }
            if(bLoad){
                nAns += vviDist[i][j];
            }
        }
    }
    
    printf("%ld", nAns);
    return 0;
}


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

int a[3];
int b[2];
int a_min;
int b_min;
int ans;

int main(){
	for(int i = 0; i < 3; i++){
		cin >> a[i];
	}
	for(int i = 0; i < 2; i++){
		cin >> b[i];
	}
	
	a_min = a[0];
	b_min = b[0];
	for(int i = 0; i < 3; i++){
		if(a_min > a[i]){
			a_min = a[i];
		}
	}
	for(int i = 0; i < 2; i++){
		if(b_min > b[i]){
			b_min = b[i];
		}
	}
	
	ans = a_min + b_min - 50;
	cout << ans << endl;
}

Measured memory_bytes: 1160
import java.util.Scanner;

class Main {
    public static int gcd(int a, int b) {
        if (a == 0)
            return b;
        return gcd(b%a,a);
    }
    public static void main(String[] args) {
        long sum = 0;
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        scanner.close();
        for (int i = 1; i <= num; i++) {
            for (int j = 1; j <= num; j++) {
                for (int k = 1; k <= num; k++) {
                    sum += gcd(i,gcd(j,k));
                }
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 35820
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
vector<ll> v;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    //cout << fixed << setprecision(15);

    ll N, X;
    cin >> N >> X;

    REP(i, N)
    {
        ll a;
        cin >> a;
        v.push_back(a);
    }
    v.push_back(X);
    sort(v.begin(), v.end());

    ll ans = v[1] - v[0];
    for (int i = 2; i < N + 1; ++i)
    {
        ans = gcd(ans, v[i] - v[i - 1]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1400
from fractions import gcd

n=int(input())
a=list(map(int,input().split()))

l=[0]*(n)
for i in range(n-1):
    l[i+1] = gcd(l[i],a[i])

r=[0]*(n)
for i in range(n-2,-1,-1):
    r[i] = gcd(r[i+1],a[i+1])

print(max([gcd(r[i],l[i]) for i in range(n)]))



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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

template <class T, class S>
using umap = std::unordered_map<T, S>;
using ll = long long;
using namespace std;

int main() {
    ll q, t, f, is_rev = 0;
    string s;
    char c;

    cin >> s >> q;

    REP(i, q){
      cin >> t;
      if(t==1){
        is_rev = (is_rev == 0) ? 1 : 0;
      }else{
        cin >> f >> c;
        if(f==1){
          if(is_rev==0){
            s.insert(s.begin(), c);
          } else {
            s += c;
          }
        }else{
          if(is_rev==0){
            s += c;
          } else {
            s.insert(s.begin(), c);
          }
        }
      }
    }
  
  	if(is_rev==0){
      cout << s << endl;
    } else {
      reverse(ALL(s));
      cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 900
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

typedef struct {
    long x;
    long y;
} Point;

int main() {
    int n;
    cin >> n;
    vector<pair<ll, ll>> v(n);
    for (int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        v[i].first = x;
        v[i].second = y;
    }

    sort(v.begin(), v.end());
    double ans = 0;
    ll count = 0;
    do {
        pair<ll, ll> pre = v[0];
        for (int i = 1; i < n; i++) {
            ll xdiff = pre.first - v[i].first;
            ll ydiff = pre.second - v[i].second;
            ans += sqrt(xdiff * xdiff + ydiff * ydiff);

            pre = v[i];
        }

        // cout << ans << endl;
        count++;
    } while (next_permutation(v.begin(), v.end()));

    ans = ans / count;
    printf("%.8lf\n", ans);
}


Measured memory_bytes: 256
#define rep(i,n) for (int i=0; i<(int)(n); ++i)

#include<bits/stdc++.h>
using namespace std;

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

    bool flg = true;

    if(N/100 == 7) flg = false;
    if(((N- (N/100)*100)) / 10 == 7) flg = false;
    if(((N- (N/100)*100)) % 10 == 7) flg = false;

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

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

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2")

using namespace std;

#define f first
#define s second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define up(x, v) upper_bound(all(x), v)
#define low(x, v) lower_bound(all(x), v)
#define bin(x, v) binary_search(all(x), v)
#define FOR(k, a, b) for(int k = (a); k < (b); ++k)
#define ROF(k, a, b) for(int k = (a); k > (b); --k)
#define fn(k, n) for(int k = 0; k < n; ++k)

#define EPS 1.0e-9

#define X real()
#define Y imag()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using point = pair<double, double>;
using Vector = complex<double>;

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	int N, R;

	cin >> N >> R;

	if(N >= 10) cout << R << '\n';
	else cout << R + 100 * (10 - N) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int l;cin>>l;
	double x = l / 3.0;
	cout <<fixed << setprecision(10) << x * x * x << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
  char w[11],s[1005];
  scanf("%s",w);
  int n=0;
  while(1){
    scanf("%s",s);
  if(!strcmp(s,"END_OF_TEXT")) break;
  for(int i=0;i<strlen(s);i++){
    if(s[i]<91)
      s[i]+=32;
  }
    if(!strcmp(s,w))
      n++;
  }
cout<<n<<endl;
return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0LL);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(){
    ll a, b;    cin >> a >> b;
    ll res = a*b;
    cout << res << endl;
    
}

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

constexpr int INF = 1e9;

int W, H;
int solve(int x, int y, int cnt, vector<vector<int>> v) {
    if(cnt > 10) {
        return INF;
    }
    int res = INF;
    int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
    for(int i=0; i<4; ++i) {
        int nx = x, ny = y;
        while(true) {
            if(nx + dx[i] < 0 || nx + dx[i] >= W || ny+dy[i] < 0 || ny+dy[i] >= H) {
                nx = -1;
                ny = -1;
                break;
            }
            if(v[nx+dx[i]][ny+dy[i]] == 3) {
                return cnt;
            }
            if(v[nx+dx[i]][ny+dy[i]] == 1) {
                if(nx == x && ny == y) {
                    nx = -1;
                    ny = -1;
                }
                break;
            }
            nx += dx[i];
            ny += dy[i];
        }
        if(nx != -1) {
            v[nx+dx[i]][ny+dy[i]] = 0;
            res = min(res, solve(nx, ny, cnt+1,v));
            v[nx+dx[i]][ny+dy[i]] = 1;
        }
    }
    return res;
}

int main() {
    while(cin >> W >> H, W) {
        vector<vector<int>> v(W, vector<int>(H));
        int sx=0, sy=0;
        for(int i=0; i<H; ++i) {
            for(int j=0; j<W; ++j) {
                cin >> v[j][i];
                if(v[j][i] == 2) {
                    sx = j, sy = i;
                }
            }
        }
        int res = solve(sx, sy, 1, v);
        if(res == INF) {
            cout << "-1" << endl;
        } else {
            cout << res << endl;
        }
    }
}


Measured memory_bytes: 3052
/**     Md. Mujahedul Azad (Turin)
        Hajee Mohammad Danesh Science & Technology University **/

#include <map>
#include <math.h>
#include <cstdio>
#include <vector>
#include <climits>
#include <cstring>
#include <algorithm>
using namespace std;

template<class T> T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template<class T> T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template<typename T> T power(T val, T p, T mod){val%=mod; T result=1; while(p>0){if(p&0x1)result=(result*val)%mod;val=(val*val)%mod;p>>=1;}return result;}
template<typename T> inline void read(T &res){int sign=1; res=0;char ch = getchar();while(true){if(ch == '-') break;if(ch >= '0' && ch <='9') break;ch = getchar();}if(ch == '-') sign = -1;else res = ch-'0';while(true){ch = getchar();if(ch < '0' || ch > '9') break;res = (res * 10 + (ch - '0'));}res *= sign;}

#define ff                  first
#define se                  second
#define sfr(a)              read(a)
#define G()                 getchar()
#define pb                  push_back
#define pi                  acos(-1.0)
#define sq(x)               ((x) * (x))
#define sfi(x)              scanf("%d", &x)
#define sfrr(a,b)           read(a), read(b)
#define inOut               {input; output;}
#define SZ(x)               ((int) (x).size())
#define all(x)              (x).begin(), (x).end()
#define mem(a,b)            memset((a),(b),sizeof(a))
#define Case                printf("Case %d: ", cases)
#define input               freopen("input.txt","r",stdin)
#define output              freopen("output.txt","w",stdout)

#define PF                  printf
#define CASE                printf("Case %d: ", cs);
#define CASEN               printf("Case %d:\n", cs);

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

const double eps=3e-8;
const int mx = 1e5+5;



int main(){
    ll n; sfr(n);
    ll lim = sqrt(n);
    for(int i=lim; i>0; i--){
        if(n%i == 0){
            ll ans = (abs(i-1) + abs(n/i - 1));
            printf("%lld\n", ans);
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
typedef pair<int,int> P;
typedef long long ll;
ll n,m,k,ans;
string s;

int main(){
  const long long INF = (1LL<<32);
  int v,e; cin >> v >> e;
  int s,t,d;
  long long g[v][v];
  bool frag = true;
  rep(i,v) {
    rep(j,v) {
      if(i == j) g[i][j] = 0;
      else g[i][j] = INF;
    }
  }
  rep(i,e){
    cin >> s >> t >> d;
    g[s][t] = d;
  }
  rep(k,v) {
    rep(i,v) {
      if(g[i][k] == INF) continue;
      rep(j,v){
        if(g[k][j] == INF) continue;
        g[i][j] = min(g[i][j], g[i][k]+g[k][j]);
      }
    }
  }
  rep(i,v) if(g[i][i] < 0) frag = false;
  if(frag){
    rep(i,v){
      rep(j,v){
        if(g[i][j] == INF) cout << "INF";
        else cout << g[i][j];
        if(j < v-1) cout << " ";
      }
      cout << "\n";
    }
  }else cout <<"NEGATIVE CYCLE\n";
}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long n,c,k,count=0;
  cin >> n >> c >> k;
  long long C=c;
  
  vector<int>t(n);
  for(int i=0; i<n; i++) cin >> t[i];
  sort(t.begin(),t.end());
  
  for(int i=0; i<n; i++){
    t[i]+=k;
    C--;
    for(int j=i+1; j<n; j++){
      if(j==n-1 && t[j]<=t[i])
      {
        i=j;
        break;
      }
      
      else if(C==0 || t[j]>t[i]){
        i=j-1;
        C=c;
        break;
     }
     C--;
    }
     count++;
   }
  
  cout << count << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    rep(i,n) cin >> x[i];

    ll ans=1e9;
    for(int i=1; i<=100; i++){
        ll sum=0;
        for(int j=0; j<n; j++){
            sum += (x.at(j) - i)*(x.at(j) - i);
        }
        ans = min(ans, sum);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3536