akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(void)
{
	string s[3];
	for(int i=1;i<=3;i++)
	{
		cin >> s[i-1];
		transform(s[i-1].begin(),s[i-1].end(),s[i-1].begin(),::toupper);
	}
	cout << s[0][0] << s[1][0] << s[2][0] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int length = 0;
  int height = 0;
  int area = 0;
  int cir = 0;

  scanf("%d %d", &length, &height);
  area = length * height;
  cir = length*2 + height*2;

  printf("%d %d\n", area, cir);

  return 0;
}

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

int main(){
  char c;
  cin>>c;
  cout<<c;
  int n=-1;
  for(;cin>>c;) n++;
  cout<<n<<c<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    ll n,now;cin>>n;
    now=0;
    ll d[n][2];
    bool ans=false;
    rep(i,0,n-1){
        rep(j,0,1){
            cin>>d[i][j];
        }
        if(d[i][0]==d[i][1]){
            now++;
        }else{
            now=0;
        }
        if(now>=3){
            ans=true;
        }
    }
    if(ans){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}





Measured memory_bytes: 3632
while True:
    pc, member = map(int, input().split())
    if pc == 0:
        break
    # ログを受け取る
    log_count = int(input())
    logs = [list() for j in range(member)]
    counts = [0 for i in range(member)]
    for i in range(log_count):
        t, n, m, s = map(int, input().split())
        t -= 540; m -= 1;
        logs[m].append([t, n, s])
        counts[m] += 1
    # 問題受け取る
    question_count = int(input())
    for j in range(question_count):
        ts, te, m = map(int, input().split())
        ts -= 540; te -= 540; m -= 1;
        ans = 0; t = 0; i = 0; pcs = 0; pre = 0;
        for i in range(counts[m]):
            act = logs[m][i][2]
            now = logs[m][i][0]
            if ts <= now:
                if pcs > 0:
                    ans += min(now, te) - max(pre, ts)
            pre = max(ts, now)
            if act == 1:
                pcs += 1
            else:
                pcs -= 1
            if now >= te:
                break
        print(ans)



Measured memory_bytes: 6840
n, A, B = map(int, input().split())
l = [int(input()) for x in range(n)]

left = 0
right = 10**9


def is_ok(t):
    AB = A - B
    return sum(map(lambda x: max(0, x - B*t + (AB - 1)) // (AB), l)) <= t


while abs(left - right) > 1:
    now = (left + right) // 2
    if is_ok(now):
        right = now
    else:
        left = now

print([right, left][is_ok(left)])


Measured memory_bytes: 7072
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
  char x, y;
  cin>>x>>y;
  if(y-x>0)cout<<"<"<<endl;
  else if(y-x<0)cout<<">"<<endl;
  else cout<<"="<<endl;

  return 0;
}


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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int x, h;
  while (cin >> x >> h, x) {
    cout << x * x + hypot(h, x / 2.) * x * 2 << endl;
  }

  return 0;
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

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


Measured memory_bytes: 256
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	N := nextInt()
	K := nextInt()
	fmt.Println(K * intPow(K-1, N-1))
}

func intPow(a, b int) int {
	if b == 0 {
		return 1
	}
	r := a
	for ; b > 1; b-- {
		r *= a
	}
	if r <= 0 {
		log.Println("warning : intPow return <=0 value", r)
	}
	return r
}

func intMax(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func intMin(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func intSum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func intAbs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	return p[i].b < p[j].b
}

var nextReader func() string

func init() {
	nextReader = newScanner()
}

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640
/* /\ In The Name of ALLAH /\
    Author : Jawahiir Nabhan */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


int main()
{
    int d,t,s; cin>>d>>t>>s;

    double k = (double)(d)/s;
    if(k <= (double)(t)) cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 3568
#include <iostream>
#include <queue>
#include <vector>
#include <cstring>

using namespace std;

struct State {
    int x, y, dir, n;
    State(int x, int y, int dir, int n)
        : x{x}, y{y}, dir{dir}, n{n} {}
};

int H, W;
string commands;
vector<vector<char>> field;
vector<int> dir[4];
constexpr int dx[4] = {-1, +0, +1, +0};
constexpr int dy[4] = {+0, -1, +0, +1};

bool in_field(int x, int y)
{
    return (0 <= x && x < W && 0 <= y && y < H);
}

void init()
{
    for (int i = 0; i < 4; i++) {
        dir[i].clear();
    }
}

void make(int N)
{
    init();
    int nd = 1;
    for (int i = 0; i < N; i++) {
        if (commands[i] == 'L') {
            nd = (nd + 3) % 4;
        } else {
            nd = (nd + 1) % 4;
        }
        dir[nd].emplace_back(i);
    }    
}

bool solve(int sx, int sy, int gx, int gy)
{
    queue<State> Q;
    Q.push({sx, sy, 1, 0});
    
    bool d[H][W][4];
    memset(d, 0, sizeof(d));
    d[sy][sx][1] = 1;

    while (!Q.empty()) {
        State s = Q.front(); Q.pop();
        int x = s.x, y = s.y;
        if (x == gx && y == gy) return 1;
        
        // move forward
        int nx = s.x + dx[s.dir], ny = s.y + dy[s.dir];
        if (in_field(nx, ny) && field[ny][nx] != '#' && !d[ny][nx][s.dir]) {
            d[ny][nx][s.dir] = 1;
            Q.push({nx, ny, s.dir, s.n});
        }
        
        // turn
        for (int i = 0; i < 4; i++) {
            if (i == s.dir) continue;
            
            auto np = lower_bound(dir[i].begin(), dir[i].end(), s.n);
            if (np == dir[i].end()) continue;
            int nn = np - dir[i].begin();
            if (!d[y][x][i]) {
                d[y][x][i] = 1;
                Q.push({x, y, i, nn + 1});                
            }
        }
    }    
    return 0;
}

int main()
{
    int N, sx, sy, gx, gy;
    while (cin >> H >> W >> N, H) {
        cin >> commands;
        field.resize(H);
        for (int i = 0; i < H; i++) {
            field[i].resize(W);
            for (int j = 0; j < W; j++) {
                cin >> field[i][j];
                if (field[i][j] == 'S') { 
                    field[i][j] = '.';
                    sx = j; sy = i;
                } else if (field[i][j] == 'G') {
                    field[i][j] = '.';
                    gx = j; gy = i;
                }
            }
        }
        make(N);
        cout << (solve(sx, sy, gx, gy) ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 8020
n = int(input())

y = 0
ans = 0
for i in range(1, n + 1):
    if i % 2 == 0:
        continue
    for j in range(1, i + 1):
        if i % j == 0:
            y += 1
    if y == 8:
        ans += 1
    y = 0

print(ans)

Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

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

  int n; cin >> n;
  vector<double> v(n);
  REP(i, n) cin >> v[i];

  sort(v.begin(), v.end());
  
  double tmp = v[0];
  REP(i, n-1){
    tmp += v[i+1];
    tmp /= 2;
  }

  cout << fixed;
  cout << setprecision(10);
  cout << tmp << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
//using System.Collections.Generic;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            //input
            int N = Convert.ToInt32(Console.ReadLine());
            int[] B = Console.ReadLine().Split(' ').Select(t => Convert.ToInt32(t)).ToArray();

            int sum = 0;
            int before = 0;
            for(int i = 0; i < B.Length; i++)
            {
                if (i == 0)
                {
                    sum += B[i];
                }
                else
                {
                    sum += Math.Min(B[i], before);
                }
                before = B[i];
            }
            sum += B[B.Length - 1];

            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13396
N=int(input())
L=[i**5 for i in range(150)]
for i in L:
    if N-i in L:
        if i-N>0:
            print(L.index(i),L.index(i-N))
        else:
            print(L.index(i),-1*L.index(N-i))
        break
    elif N+i in L:
        print(L.index(i+N),L.index(i))
        break

Measured memory_bytes: 9160
#include <bits/stdc++.h>
#include <iostream>
#include <string>

#define f(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define inf INT_MAX
#define pb push_back
#define all(x) x.begin(),x.end()
#define debug(x) cout<<" [ " << #x << " is: " << x << " ] "<<endl;
#define fast ios_base::sync_with_stdio(0); cin.tie(0);

#define mem(x,i) memset(x,i,sizeof x)


using namespace std;

int main () {
	
	fast;

	string s;
	cin>>s;

	if (s[2]==s[3] && s[4]==s[5]){
		cout<<"Yes\n";
	}
	else {
		cout<<"No\n";
	}

	return 0;
}

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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int, int>
#define all(x) x.begin(), x.end()
#define Matrix vector<vector<int>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = ((int64_t)2e18);
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

signed main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t;

  // cin >> t;
  t = 1;

  while (t--) {
    int n;
    cin >> n;

    int l, r;
    cin >> l >> r;

    int v = l / n;

    int no = n;
    n *= v;
    string ans = "NG";
    if (l <= n && n <= r)
      ans = "OK";
    if (l <= n + no && n + no <= r)
      ans = "OK";

    cout << ans << endl;
  }
}

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

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

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let n = read::<usize>();
    let v = read_vec::<u64>();

    let mut a_even_sum = 0u64;
    for i in 0..n {
        if i % 2 == 1 {
            a_even_sum += v[i];
        }
    }
    let x1 = v.iter().fold(0u64, |sum, x| sum + x) - a_even_sum * 2;

    let mut v2 = Vec::new();
    v2.push(x1);

    let mut yama = (v[0] - (x1 / 2)) * 2;
    for i in 1..n {
        v2.push(yama);
        yama = (v[i] - (yama / 2)) * 2;
    }

    if v2.len() == n && yama == x1 {
        for j in 0..n {
            if j == n - 1 {
                println!("{}", v2[j]);
            } else {
                print!("{} ", v2[j]);
            }
        }
        return ();
    }
}


Measured memory_bytes: 10488
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int>a(n),b(n);
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        cin>>b[i];
    }
    int ans=0;
    rep(i,n){
        int sum1=0,sum2=0;
        for(int j=0; j<=i; ++j){
            sum1+=a[j];
        }
        for(int j=i; j<n; ++j){
            sum2+=b[j];
        }
        ans=max(ans,sum1+sum2);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

template<ll _mod>class combination_modulo{
    private:
        vector<ll>factorial_mod;
        inline ll pow_mod(ll x,ull y){x%=mod;return(y==0?1:y%2==0?pow_mod(x*x%mod,y/2):x*pow_mod(x,y-1))%mod;}
    public:
        const ll mod;
        combination_modulo(ll max_n):factorial_mod(max_n+1),mod(_mod)
        {
            factorial_mod[0]=1;
            for(ll i=1;i<=max_n;++i)factorial_mod[i]=factorial_mod[i-1]*i%mod;
        }
        ll operator()(ll n,ll r)
        {
            return n<r?0:factorial_mod[n]*pow_mod(factorial_mod[r]*factorial_mod[n-r],mod-2)%mod;
        }
};
int main()
{
    ll n=in();
    vector<ll>a(n+1);for(auto&i:a)i=in();

    ll d=accumulate(a.begin(),a.end(),0LL)-n*(n+1)/2;
    ll d1_idx=find(a.begin(),a.end(),d)-a.begin();
    ll d2_idx=a.rend()-find(a.rbegin(),a.rend(),d)-1;

    auto cm=combination_modulo<1000000007>(n+1);
    for(ll i=1;i<=n+1;++i){
        ll foo=cm(n+1,i)-cm(n+1-(d2_idx-d1_idx+1),i-1);
        if(foo<0)foo+=cm.mod;
        cout<<foo<<endl;
    }
}


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

using namespace std;

int main()
{
        // 整数の入力
    long long N,Y,i,j;
    cin >> N;
    cin >> Y;
    for (i=0;i<=N;i++){
        for (j=0;i+j<=N;j++){
            if(1000 * i + 5000 * j + 10000*(N- i-j) == Y){
                cout << (N- i-j) << " " << j << " " << i << endl;
                return 0;
            }
        }
    }


    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 100010
int Adj[MAXN],V[MAXN*2],nxt[MAXN*2],c;
void AddEdge(int u,int v)
{
	c++;V[c]=v,nxt[c]=Adj[u];Adj[u]=c;
}
int dp[MAXN][21],n,ans;
void dfs(int u,int p)
{
	for(int i=Adj[u];i;i=nxt[i])
		if(V[i]!=p)
		{
			int v=V[i];
			dfs(v,u);
			for(int j=0;j<=20;j++)
				dp[u][j]+=dp[v][j];
		}
	int k=0;
	for(int i=20;i>=0;i--)
		if(dp[u][i]>1)
		{
			k=i+1;
			break;
		}
	while(dp[u][k]) k++;
	dp[u][k]++;
	for(int i=0;i<k;i++)
		dp[u][i]=0;
	ans=max(ans,k);
}
int main()
{
	scanf("%d",&n);
	int u,v;
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&u,&v);
		AddEdge(u,v);
		AddEdge(v,u);
	}
	dfs(1,0);
	printf("%d\n",ans);
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int A, B, X;

	cin >> A >> B >> X;
	if (A == 0)
	{
		cout << B / X + 1 << endl;
	}
	else
	{
		cout << B / X - (A - 1) / X << endl;
	}

	return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
 
  if(A == 1 && B == 2){
    cout << 3;
  }
  else if(A == 1 && B == 3){
    cout << 2;
  }
  else if(A == 2 && B == 3){
    cout << 1;
  }
  else if(A ==2 && B == 1){
    cout << 3;
  }
  else if(A == 3 && B == 1){
    cout << 2;
  }
  else if(A == 3 && B == 2){
    cout << 1;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  if(n<1200){cout << "ABC" << endl; return 0;}
  if(n<2800){cout << "ARC" << endl; return 0;}
  cout << "AGC" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>

using namespace std;

int main() {
    int A[3];

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

    sort(A, A + 3);

    if ((A[0] == 5) && (A[1] == 5) && (A[2] == 7)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
 
 
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//int Q = Integer.parseInt(sc.next());
		//long L = Long.parseLong(sc.next());
		//char[] c = sc.next().toCharArray();
		Scanner sc = new Scanner(System.in);
		
		
		int N = Integer.parseInt(sc.next());
		int A = Integer.parseInt(sc.next())-1;
		int B = Integer.parseInt(sc.next())-1;
		int C = Integer.parseInt(sc.next())-1;
		int D = Integer.parseInt(sc.next())-1;
		
		char[] S = sc.next().toCharArray();
		boolean ans = true;
		boolean b_non_kabe = false;
		if(C<D){
			for(int i=B+1; i<N-1;i++){
				if(i==D)break;
				if(S[i]=='#' && S[i+1] == '#'){
					ans = false;
					break;
				}
			}
			if(ans){
				for(int i=A+1; i<N-1;i++){
					if(i==C)break;
					if(S[i]=='#' && S[i+1] == '#'){
						ans = false;
						break;
					}
				}
			}
			
			if(ans){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
		}else{//AがBを追い越すとき
			for(int i=B; i<N-1;i++){
				if(S[i]=='.' && S[i-1]=='.' && S[i+1]=='.')b_non_kabe = true;//追い越しポイント有り
				if(i==D)break;
				if(S[i]=='#' && S[i+1] == '#'){
					ans = false;
					break;
				}
			}
			if(ans){
				for(int i=A+1; i<N-1;i++){
					if(i==C)break;
					if(S[i]=='#' && S[i+1] == '#'){
						ans = false;
						break;
					}
				}
			}
			
			if(ans && b_non_kabe){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
		}

	}
	

	
}



Measured memory_bytes: 28164
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define mod  1073741824
#pragma GCC optimization ("O3")
using namespace std;
int main()
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,j =1;
    cin >> n;
    int A[n];
    for(int i=0;i<n;i++)
    {
      cin >> A[i];
      if(A[i] == j)
      { 
        j++;
      }
    }
    if(j == 1)
    {
      cout << -1;
    }
    else
    {
        cout << n - (j-1);
    }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<functional>
#include<map>
#include<math.h>
using namespace std;
#define int long long
typedef vector<int> vi;
typedef pair<int,int> pi;
#define pb push_back
#define mp make_pair
#define fr(i,s,e) for(int i=s; i<e; i++)
#define rf(i,s,e) for(int i=e; i>s; i--)
#define vfr(it, g1)  for (auto it = g1.begin(); it != g1.end(); it++)
#define pp pop_back
#define bs binary_search
#define ins insert
#define ln length
#define vsort(a) sort(a.begin(), a.end())
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rea(a,n)  for(int i=0; i<n; i++) cin>>a[i]
#define pra(a,n)  for(int i=0;i<n;i++) cout<<a[i]<<" "
#define lb lower_bound
#define ub upper_bound
#define lss bool operator < (const class_name& rhs) const {return object<rhs.object;}
#define grtr bool operator < (const class_name& rhs) const {return object>rhs.object;}
int32_t main()
{
    IOS;
    int s,w;
    cin>>s>>w;
    if(w>=s)
    cout<<"unsafe";
    else
    {
        cout<<"safe";
    }
    

}




Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
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;}

vector<int> enum_div(int n){
    vector<int> ret;
    for(int i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    int a=0;
    for(int i=1;i<=n;i+=2){
        vector<int> ans = enum_div(i);
        if(ans.size() == 8) a++;
    }
    cout<<a<<endl;
}

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

using namespace std;

int N;
vector<int> P(500*500+5);
bool a[505][505];
int d[505][505];

void dfs(int i, int j, int dst) {
    if (dst >= d[i][j]) return;
    d[i][j] = dst;
    if (i > 0) dfs(i-1, j, dst + (1 - a[i-1][j]));
    if (i < N-1) dfs(i+1, j, dst + (1 - a[i+1][j]));
    if (j > 0) dfs(i, j-1, dst + (1 - a[i][j-1]));
    if (j < N-1) dfs(i, j+1, dst + (1 - a[i][j+1]));   
}

void print() {
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << d[i][j] << " ";
        }
        cout << "\n";
    }
}

int main() {

    cin >> N;
    for (int i = 0; i < N*N; i++) cin >> P[i];

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            d[i][j] = min(min(i, N-i-1), min(j, N-j-1)) + 1;
        }
    }

    int s = 0;

    for (int r = 0; r < N*N; r++) {
        int i = (P[r]-1)/N;
        int j = (P[r]-1)%N;
        a[i][j] = true;
        int dst = d[i][j] - 1;
        if (i > 0) dst = min(dst, d[i-1][j]);
        if (i < N-1) dst = min(dst, d[i+1][j]);
        if (j > 0) dst = min(dst, d[i][j-1]);
        if (j < N-1) dst = min(dst, d[i][j+1]);
        s += dst;
       // cout << r+1 << " " << i << " " << j << " " << dst << "\n";
        dfs(i,j,dst);
       // if (r == 7) print();
    }

    cout << s << "\n";

    return 0;
}

Measured memory_bytes: 31812
import qualified Data.Vector as V

main :: IO ()
main = do
  n <- readLn
  print $ g n

f :: Int -> V.Vector (Int,Int)
f n = V.fromList [(x, n-x) | x <- [1..((n+1) `div` 2)]]

sod
  :: Int -> Int
sod n
  | q == 0 = r 
  | otherwise = r + sod q
  where
    (q,r) = quotRem n 10

sod2
  :: Int -> Int -> Int
sod2 x y = sod x + sod y

g :: Int -> Int
g = V.minimum . V.map (uncurry sod2) . f

Measured memory_bytes: 1020
import math
n=int(input())
a=1;c={"R":0,"G":0,"B":0}
m=998244353
for i in input():
	f,s,t=sorted(c.values())
	c[i]+=1
	a*=(s-f,t-s,1)[(c[i]>t)+(c[i]>s)]
	a%=m
print(math.factorial(n)*a%m)

Measured memory_bytes: 4172
#include "bits/stdc++.h"
#include "math.h"
#include "string.h"
#include "algorithm"
#include "stdlib.h"
 
using namespace std;
typedef int64_t ll;
typedef vector<int64_t> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())


int main(){
  double a,b,x;
  cin>>a>>b>>x;
  x/=a;
  x*=2;
  if(x<a*b){
    x/=b;
    cout<<fixed<<setprecision(10)<<atan(b/x)*180/M_PI<<endl;
  }
  else{
    x/=a;
    cout<<fixed<<setprecision(10)<<atan((2*b-x)/a)*180/M_PI<<endl;
  }
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int A[3]; cin >> A[0] >> A[1] >> A[2];
    int len=sizeof(A)/sizeof(int);
    sort(A, A+len);
    if(A[0] == 5 && A[1] == 5 && A[2] == 7) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int w,h,n;
    cin>>w>>h>>n;
    int xlow=0,xhigh=w,ylow=0,yhigh=h;
    for(int i=0;i<n;i++){
        int x,y,a;
        cin>>x>>y>>a;
        switch(a){
        case 1:
            xlow=max(xlow,x);
            break;
        case 2:
            xhigh=min(xhigh,x);
            break;
        case 3:
            ylow=max(ylow,y);
            break;
        case 4:
            yhigh=min(yhigh,y);
            break;
        }
    }
    int ans=(yhigh-ylow)*(xhigh-xlow);
    if(yhigh<ylow||xhigh<xlow){
        ans=0;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	    	Scanner sc = new Scanner(System.in);
	    	int a = sc.nextInt();
	    	int b = sc.nextInt();
	    	int c = sc.nextInt();
	    	if (a + b + 1 >= c) {
	    		System.out.println(c + b);
	    	} else {
	    		System.out.println(a + b + 1 + b);
	    	}
	}
}


Measured memory_bytes: 22228
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int n = sc.nextInt();
			
			int[] lArray = new int[n];
			
			for(int i = 0 ; i < n ; i++ ) {
				lArray[i] = sc.nextInt();
			}
			
			int count = 0;
			for(int i = 0 ; i < n ; i++ ) {
				for(int j = i+1; j < n ; j++ ) {
					for(int k = j+1; k < n ; k++ ) {
						int li = lArray[i];
						int lj = lArray[j];
						int lk = lArray[k];
						
						if ( li < (lj + lk) &&
								lj < (li + lk) &&
								lk < (li + lj) &&
								li != lj &&
								lj != lk &&
								lk != li) {
							count++;
						}
								
					}
				}
			}
			
			System.out.println(count);
		}
	}

}

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

const int INF = 10009;
const int N = 200000;

int vis[N], n;

inline int read() {
	char c=getchar(); int f=1,ret=0;
	while (c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();}
	while (c<='9'&&c>='0') {ret=ret*10+c-'0';c=getchar();}
	return ret * f;
}

int main() {
	n = read();
	vis[0] = 1;
	for (int i = 1; i <= n; i++) {
		int v = read();
		for (int j = INF; ~j; j--) {
			if (vis[j]) {
				vis[j + v] = 1;
			}
		}
	}
	for (int i = INF; ~i; i--) {
		if (vis[i] && (i % 10) > 0) {
			printf("%d\n", i);
			exit(0);
		}
	}
	puts("0");
	return 0;
}



Measured memory_bytes: 256
//abc099_a.cpp
//Sun Jun 10 20:59:32 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

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

	if (n<=999){
		cout << "ABC" << endl;
	}else {
		cout << "ABD" << endl;
	}
}

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;

int main(){
    ll n,ans=0;
    cin>>n;

    vector<ll>a(n);
    rep(i,n){
        cin>>a[i];
        a[i]%=mod;
    }

    vector<ll>A(n);
    A[n-1]=a[n-1];
    repr(i,n-2,0){
        A[i]=(a[i]+A[i+1])%mod;
    }

    rep(i,n-1){
        ans+=(a[i]*A[i+1])%mod;
    }

    cout<<ans%mod<<endl;
}


Measured memory_bytes: 6348
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
//#define INF (1LL<<31)-1
//#define MOD 998244353
#define MOD 1000000007

int main(){
    string s;
    cin>>s;
    bool f=1;
    rep(i,0,3){
        if(s[i]=='7'){
            f=0;
            cout<<"Yes\n";
            break;
        }
    }
    if(f)cout<<"No\n";
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
typedef long long ll;

using namespace std;

int main(){
  int N, K;
  cin >> N >> K;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int ans = 1;
  int i = K;
  while (i < N) { i += K - 1; ans ++; }
  
  cout << ans << endl;
}


Measured memory_bytes: 640
h,w,m = map(int,input().split())

tate = [0]*(h+1)
yoko = [0]*(w+1)

basyo = []

for i in range(m):
    hh,ww = map(int,input().split())
    basyo.append((hh-1,ww-1))
    
    tate[hh-1] += 1
    yoko[ww-1] += 1
    
tt,yy = 0,0
x = max(tate)

for i in tate:
    if i == x:
        tt += 1
        
y = max(yoko)
for i in yoko:
    if i == y:
        yy += 1
        
ans = x+y
pl = tt * yy

cur = 0
for i,j in basyo:
    if tate[i] + yoko[j] == ans:
        cur += 1
        
if pl > cur:
    print(ans)
else:
    print(ans-1)

Measured memory_bytes: 109208
// B - Frog 2
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define chmin(x,y) x=min(x,y)

int main(){
	int INF = 1e+9, N,K; cin>>N>>K;
	vector<int> H(N), dp(N, INF);
	rp(i, 0, N) cin>>H[i]; // i:[0,N-1]
	dp[0] = 0;
	rp(i, 1, N){ // i:[1,N-1]
		for(int k=1; k<=min(i,K); ++k) // k:[1,min(i,K)]
			chmin(
				dp[i],
				dp[i-k] + abs(H[i-k] - H[i])
			);
	}
	cout<< dp[N-1] <<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
#define mk make_pair
inline int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int k=1,kk=0;if (c=='-')c=getchar(),k=-1;
	while (c>='0'&&c<='9')kk=kk*10+c-'0',c=getchar();return kk*k;
}using namespace std;
void write(int x){if (x<0)putchar('-'),x=-x;if (x/10)write(x/10);putchar(x%10+'0');}
void writeln(int x){write(x);puts("");}
struct lsg{int x,y;}a[1000010],b[1000010];
char s[1000010];
map<pair<int,int>,int>mp;
int n,nn,ans;
signed main(){
	n=read();scanf("%s",s);
	nn=1ll<<n;for (int l=0;l<nn;l++){
		for (int i=0;i<n;i++)if (l>>i&1){
			a[l].x=a[l].x*27+s[i]-'a'+1;
		}else{
			a[l].y=a[l].y*27+s[i]-'a'+1;
		}
		for (int i=n-1;i>=0;i--)if (l>>i&1){
			b[l].x=b[l].x*27+s[i+n]-'a'+1;
		}else{
			b[l].y=b[l].y*27+s[i+n]-'a'+1;
		}
	}for (int i=0;i<nn;i++)mp[mk(a[i].x,a[i].y)]++;
	for (int i=0;i<nn;i++)ans+=mp[mk(b[i].x,b[i].y)];
	writeln(ans);
}





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

int main()
{	
	int w, h, x2, y2;
	cin >> w >> h >> x2 >> y2;
	
	cout << double(double(w) * double(h) / 2) << " " << ((x2 + x2 == w) && (y2 + y2 == h))?1:0;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
#include<cassert>

#define N 4
#define N2 16
#define LIMIT 100

using namespace std;

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
  int f[N2], space, MD;
};

Puzzle state;
int limit;
int path[LIMIT];

int getAllMD(Puzzle pz){
  int sum = 0;
  for(int i=0; i<N2; i++){
    if(pz.f[i] == N2) continue;
    sum += MDT[i][pz.f[i]-1];
  }
  return sum;
}

bool isSolved(){
  for(int i=0; i<N2; i++)
    if(state.f[i] != i+1) return false;
  return true;
}

bool dfs(int depth, int prev){
  if(state.MD == 0) return true;

  if(depth+state.MD > limit) return false;

  int sx = state.space / N;
  int sy = state.space % N;
  Puzzle tmp;

  for(int r=0; r<4; r++){
    int tx = sx + dx[r];
    int ty = sy + dy[r];

    if(tx<0 || ty<0 || tx>=N || ty>=N) continue;
       if(max(prev, r)-min(prev, r) == 2) continue;
       tmp = state;

       state.MD -= MDT[tx*N+ty][state.f[tx*N+ty]-1];
       state.MD += MDT[sx*N+sy][state.f[tx*N+ty]-1];
       swap(state.f[tx*N+ty], state.f[sx*N+sy]);
       state.space = tx*N+ty;
       if(dfs(depth+1,r) ) {path[depth] = r; return true; }
       state = tmp;
  }

    return false;

}


string iterative_deepening(Puzzle in){
  in.MD = getAllMD(in);

  for(limit = in.MD; limit <= LIMIT; limit++){
    state = in;
    if(dfs(0, -100) ){
      string ans = "";
      for(int i = 0; i<limit; i++) ans += dir[path[i]];
      return ans;
    }
  }

  return "unsolvable";
}

int main(){
  for(int i=0; i<N2; i++)
    for(int j=0; j<N2; j++)
      MDT[i][j] = abs(i/N - j/N) + abs(i%N - j%N);

  Puzzle in;

  for(int i=0; i<N2; i++){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = iterative_deepening(in);
  cout << ans.size() << endl;

  return 0;

}



Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX_V 111111
#define int long long
int V,E;
vector<int> G[MAX_V];
int used[MAX_V];
void add_edge(int a,int b){
  G[a].push_back(b);
  G[b].push_back(a);
}
int a[2];
bool dfs(int v,int c){
  if(~used[v]) return used[v]==c;
  bool f=1;
  a[c]++;used[v]=c;
  for(int i=0;i<(int)G[v].size();i++) f&=dfs(G[v][i],!c);
  return f;
}
typedef pair<int,int> P;
bool dp[2][MAX_V];
int solve(){
  int x=0;
  vector<P> v;
  memset(used,-1,sizeof(used));
  for(int i=0;i<V;i++){
    if(used[i]>=0) continue;
    a[0]=a[1]=0;
    if(dfs(i,0)){
      if(a[1]) v.push_back(P(a[1],a[0]));
      else x++;
    }else return -1;
  }
  int k=0,m=0;
  memset(dp[0],0,sizeof(dp[0]));
  dp[0][0]=1;
  for(int i=0;i<(int)v.size();i++){
    bool f=i%2;
    memset(dp[!f],0,sizeof(dp[!f]));
    for(int j=0;j<=m;j++){
      if(dp[f][j])
	dp[!f][j+v[i].first]=dp[!f][j+v[i].second]=1,
	  m=max(m,j+max(v[i].first,v[i].second));
    }
  }
  for(int i=0;i<V;i++){
    if(dp[v.size()%2][i]){
      for(int j=0;j<=x&&i+j<V;j++){
	//cout<<i+j<<":"<<(V-(i+j))*(i+j)<<endl;
	if((V-k)*k<(V-(i+j))*(i+j)) k=i+j;
      }
    }
  }
  return (V-k)*k-E;
}
signed main(){
  cin>>V>>E;
  for(int i=0,a,b;i<E;i++) cin>>a>>b,add_edge(a-1,b-1);
  cout<<solve()<<endl;
  return 0;
}

Measured memory_bytes: 11172
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>

#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPA(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#if defined(_MSC_VER)||__cplusplus > 199711L
#define AUTO(r,v) auto r = (v)
#else
#define AUTO(r,v) typeof(v) r = (v)
#endif
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it)
#define LL signed long  
#define int LL
#define INF  99999999
#define DEV 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
using namespace std;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size,-10) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}

};

int n, m;

typedef pair<int, int> point;

point points[10010];

struct  edge{
	int to, from;
	double cost;
};

vector<edge> graph;

UnionFind uf(10010);

signed main()
{
	//QUICK_CIN;
	//ifstream cin("debug.txt");

	cin >> n >> m;

	REP(i, n){
		cin >> points[i].first >> points[i].second;
	}

	auto dist = [](point a, point b)->double
	{
		auto dx = (a.first - b.first);
		auto dy = (a.second - b.second);
		return (double)sqrt(dx*dx + dy*dy);
	};

	edge p;
	REP(i, m){
		cin >> p.from >> p.to;
		--p.from; --p.to;
		p.cost = dist(points[p.from], points[p.to]);
		graph.push_back(p);
	}

	sort(graph.begin(), graph.end(), [](edge a, edge b){return a.cost > b.cost; });

	double res(0);


	REP(i, m){
		auto e = graph[i];

		if (!uf.findSet(e.from, e.to)){
			uf.unionSet(e.from, e.to);
		}
		else{
			res += e.cost;
		}
	}

	printf("%.3lf\n", res);
	return 0;
}

Measured memory_bytes: 2236
#include<bits/stdc++.h>
#define MOD 10000
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int dp1[502][2][10][500][3], dp2[502][2][10][500][3], m;
void solve(int dp[][2][10][500][3], string&a) {
	dp[0][0][0][0][0] = 1;
	rep(i, a.size())rep(j, 2)rep(k, 10)rep(l, m)rep(d, 3) {
		int s, g, p = a[i] - '0';
		if (d == 1) { s = k + 1; g = (j ? 9 : p); }
		else if (d == 2) { s = 0; g = (j ? k - 1 : min(k - 1, p)); }
		else { s = 0; g = (j ? 9 : p); }
		for (int x = s; x <= g; x++) {
			if (x&&k == x)continue;
			int y;
			if (d == 1)y = 2;
			else if (d == 2)y = 1;
			else {
				if (k == 0)y = 0;
				else if (x < k)y = 1;
				else y = 2;
			}
			(dp[i + 1][j || x < p][x][(l * 10 + x) % m][y] += dp[i][j][k][l][d]) %= MOD;
		}
	}
}
int main() {
	string a, b; cin >> a >> b >> m;
	int d = a.size() - 1;
	while (a[d] == '0') {
		a[d] = '9'; d--;
	}
	a[d]--;
	if (*a.begin() == '0'&&a.size() > 1)a = a.substr(1);
	solve(dp1, a); solve(dp2, b);
	int sum1 = 0, sum2 = 0;
	rep(i, 2)rep(j, 10)rep(t, 3) {
		(sum1 += dp1[a.size()][i][j][0][t]) %= MOD;
		(sum2 += dp2[b.size()][i][j][0][t]) %= MOD;
	}
	printf("%d\n", (sum2 + MOD - sum1) % MOD);
}

Measured memory_bytes: 73724
#include <bits/stdc++.h>
using namespace std;
long long n,k;
void solve()
{
    vector < long long > a(n),b(n);
    long long i,j;
    for (i=0;i<n;i++)
        cin>>a[i];
    b=a;
    for (i=1;i<n;i++)
        if (i<=k) b[i]=abs(a[i]-a[0]);
        else
        {
            long long mini=2000000000000000000;
            for (j=1;j<=k;j++)
                mini=min(mini,b[i-j]+abs(a[i]-a[i-j]));
            b[i]=mini;
        }
    cout<<b[n-1]<<endl;
}
int main()
{
    while(cin>>n>>k)
        solve();
}

Measured memory_bytes: 1792
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim();
  var S =Number(inputs);
  var h=Math.floor(S/3600);
  var m=Math.floor(S%3600/60);
  var s=S%60;
  console.log([h,m,s].join(':'));
  // ????????????????????????

});
process.stdin.resume();
process.stdin.setEncoding('utf8');

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

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

int a[4];

string re(string s, int x, int i){
    if(i == 4){
        if(x == 7){
            return s;
        }else{
            return "";
        }
    }
    string s1 = re(s + "+", x + a[i], i + 1);
    string s2 = re(s + "-", x - a[i], i + 1);
    if(s1 >= s2){
        return s1;
    }else{
        return s2;
    }
}

signed main(){
    string s;
    cin >> s;
    for(int i = 0; i < 4; i++){
        a[i] = s[i] - '0';
    }
    string ans = re("", a[0], 1);
    for(int i = 0; i < 4; i++){
        cout << a[i];
        if(i == 3){
            cout << "=7";
            continue;
        }
        cout << ans[i];
    }
}

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

#define printl(s) cout << s << endl;
#define print(s) cout << s << endl; return 0;
#define yes cout << "Yes" << endl; return 0;
#define no cout << "No" << endl; return 0;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n)+1; ++i)
using ll = long long;

const ll modseed = pow(10,9) + 7;

template <typename T>
vector<T> getValues(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
int N, cnt;

int main(){
  cin >> S;
  int len = 0;
  string t = "ACGT";
  rep(i,S.size()){
    if(S.at(i)== t.at(0) ||S.at(i)== t.at(1) ||S.at(i)== t.at(2) ||S.at(i)== t.at(3)){
      len++;
      cnt = max(len,cnt);
    }else{
      len=0;
    }
  }
  print(cnt);
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind, COM//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//
int main() {
	string S;
	cin >> S;
	if (S == "hi" || S == "hihi" || S == "hihihi" || S == "hihihihi" || S == "hihihihihi") {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}


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

int main()
{
	long int n, i;

	scanf("%ld", &n);

	long int min = n, min_new;

	for (i = 1; i*i <= n; i++)
	{
		if (n%i == 0)
		{
			min_new = i + (n / i) - 2;
			
			if (min_new < min)
			{
				min = min_new;
			}
		}
	}

	printf("%ld\n", min);


	return 0;
}


Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main(){
  string S;
  cin >> S;
  
  int n = S.length();
  int n0 = 0;
  for(int i = 0; i < n; ++i) if(S[i] == '0'){
    ++n0;
  }
  int n1 = n - n0;
  cout << 2 * min(n0, n1) << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
	int n, k, l[50], sum = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	sort(l, l + n, greater<int>());
	for (int i = 0; i < k; i++) {
		sum += l[i];
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
let () = Scanf.scanf "%d %d" @@ fun n t ->
  let cts = Array.to_list @@ Array.init n @@ fun _ ->
    Scanf.scanf "\n%d %d" @@ fun c t -> c, t in
  match
    List.concat @@ List.map (fun (ci, ti) ->
      if t < ti then [] else [ci]) cts
  with
  | [] -> print_endline "TLE"
  | c :: cs -> Printf.printf "%d\n" @@ List.fold_left min c cs


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

int main() {
	int n; cin >> n;
	vector<double>x(n);
	vector<string>u(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i]; cin >> u[i];
	}
	double ans = 0;
	for (int i = 0; i < n; i++) {
		if (u[i] == "BTC") ans += x[i] * 380000.0;
		else ans += x[i];
	}

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

Measured memory_bytes: 256