akhauriyash/Code-Regression huggingface dataset:
//om nama sivaya
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define pb push_back
using namespace std;
void solve(){
    int n;
    cin>>n;
    double p[n];
    for(int i=0;i<n;i++)
    cin>>p[i];
    double dp[n+1][n+1]={},su=0;
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        dp[i][0]=dp[i-1][0]*(1-p[i-1]);
        for(int j=1;j<=i;j++){
            dp[i][j]=((dp[i-1][j-1]*p[i-1])+(dp[i-1][j]*(1-p[i-1])));
        }
    }
    for(int i=(n/2)+1;i<=n;i++)
    su+=dp[n][i];
    cout<<fixed<<setprecision(10)<<su;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tt=1;
    //cin>>tt;
    while(tt--){
        solve();
    }
}


Measured memory_bytes: 73984
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005

void solve(){
   string s;
   cin >> s;
   int n=s.size();
   int i,j;
   for(i=0; i<n; i++){
       if(s[i]=='?')s[i]='D';
   }
   cout << s << '\n';


}


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

        int t;
        t=1;
       // cin >> t;
        while(t--){
            solve();
        }
        

}

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

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

 int k=0;
 for(int i=0;i<N;i++){
   if(S[i]=='R'){
     k++;
   }
 }

 int l=0,m=0;
 for(int i=0;i<k;i++){
   if(S[i]=='W'){
     l++;
   }
 }
 for(int i=k;i<N;i++){
   if(S[i]=='R'){
     m++;
   }
 }
 cout<<max(l,m)<<endl;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;

int n, pos;
vector<int> pre, in, post;

void recon(int l, int r)
{
    // 左部分木と右部分木に分ける
    if (l >= r) {
        return;
    }
    int root = pre[pos++];
    int m = distance(in.begin(), find(in.begin(), in.end(), root));
    recon(l, m);
    recon(m + 1, r);
    post.push_back(root);
}

void solve()
{
    pos = 0;
    recon(0, (int)pre.size());
    rep(i, n)
    {
        if (i)
            cout << " ";
        cout << post[i];
    }
    cout << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int k;
    cin >> n;
    rep(i, n)
    {
        cin >> k;
        pre.push_back(k);
    }

    rep(i, n)
    {
        cin >> k;
        in.push_back(k);
    }

    solve();

    return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
typedef long long ll;
main()
{
    ll x,y;
    while(scanf("%lld%lld",&x,&y)==2)printf("%s\n",(labs(x-y)<=1)?"Brown":"Alice");
    return 0;
}

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

const int N = 6e2 + 5;

int A[N][N], B[N][N], n, m, x, y, D1, D2, C[N][N];

bool vis[N][N];

queue < pair <int, int> > q;

vector < pair <int, int> > Dir;

void prework(int D) {
  for(int i = 0; i < n * 2; ++ i) {
	for(int j = 0; j < n * 2; ++ j) {
	  if(i * i + j * j == D) {
		Dir.push_back(make_pair(i, j));
		Dir.push_back(make_pair(-i, j));
		Dir.push_back(make_pair(i, -j));
		Dir.push_back(make_pair(-i, -j));
	  }
	}
  }
}

void solve(int x, int y, int A[N][N]) {
  q.push(make_pair(x, y));
  vis[x][y] = 1;
  A[x][y] = 0;
  while(!q.empty()) {
	pair <int, int> ind = q.front();
	q.pop();
	for(int i = 0; i < (int) Dir.size(); ++ i) {
	  int nx = ind.first + Dir[i].first, ny = ind.second + Dir[i].second;
	  if(nx < 0 || ny < 0 || nx >= 2 * n || ny >= 2 * n) continue;
	  if(vis[nx][ny]) continue;
	  vis[nx][ny] = 1;
	  A[nx][ny] = A[ind.first][ind.second] ^ 1;
	  q.push(make_pair(nx, ny));
	}
  }
}

void solve(int D, int A[N][N]) {
  memset(A, 0, sizeof(A));
  Dir.clear();
  prework(D);
  memset(vis, 0, sizeof(vis));
  for(int i = 0; i < 2 * n; ++ i) {
	for(int j = 0; j < 2 * n; ++ j) {
	  if(!vis[i][j]) {
		solve(i, j, A);
	  }
	}
  }
}

int cxt[2][2];

void Solve(int x, int y) {
  int tot = n * n;
  for(int i = 0; i < n * 2; ++ i) {
	for(int j = 0; j < n * 2; ++ j) {
	  if((A[i][j] == x && B[i][j] == y) && tot) {
		printf("%d %d\n", i, j);
		-- tot;
	  }
	}
  }
}


int main() {
  cin >> n >> D1 >> D2;
  solve(D1, A);
  solve(D2, B);
  
  for(int i = 0; i < n * 2; ++ i) {
	for(int j = 0; j < n * 2; ++ j) {
	  ++ cxt[A[i][j]][B[i][j]];
	}
  }
  for(int i = 0; i < 2; ++ i) {
	for(int j = 0; j < 2; ++ j) {
	  if(cxt[i][j] >= n * n) {
		Solve(i, j);
		return 0;
	  }
	}
  }
}


Measured memory_bytes: 4736
<?php
list($s) = strs();
$cntx = 0;
$k = strlen($s);
for ($i = 0; $i < $k; ++$i)
    if ($s[$i] === 'x') ++$cntx;
echo $cntx <= 7 ? 'YES' : 'NO';
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


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

int main(){
 string a;
cin>>a;
   for(int i=0;i<5;i++){
    cout<<a.at(i);
}
   cout<<" ";
    for(int i=0;i<7;i++){
    cout<<a.at(6+i);
}
     cout<<" ";
     for(int i=0;i<5;i++){
    cout<<a.at(14+i);
}
     cout<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;

int main() {
  int x;
  cin >> x;
  if (400 <= x && x <= 599) {
    cout << 8 << endl;
  }
  if (600 <= x && x <= 799) {
    cout << 7 << endl;
  }
  if (800 <= x && x <= 999) {
    cout << 6 << endl;
  }
  if (1000 <= x && x <= 1199) {
    cout << 5 << endl;
  }
  if (1200 <= x && x <= 1399) {
    cout << 4 << endl;
  }
  if (1400 <= x && x <= 1599) {
    cout << 3 << endl;
  }
  if (1600 <= x && x <= 1799) {
    cout << 2 << endl;
  }
  if (1800 <= x && x <= 1999) {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 3632
from math import sqrt

N = int(input())
P = [list(map(int, input().split())) for _ in range(N)]

total = 0.0
for i in range(N-1):
  for j in range(i+1, N):
    total += sqrt((P[i][0]-P[j][0])**2 + (P[i][1]-P[j][1])**2)

print(total * 2 / N)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
int main(){
    int N,A,B;
    cin>>N>>A>>B;
    vector<int64_t> V;
    for(int i=0;i<N;i++){
        int x;
        cin>>x;
        V.push_back(x);
    }
    int64_t ans=0;
    for(int i=1;i<N;i++){
        if((V[i]-V[i-1])*A>B){
            ans+=B;
        }else{
            ans+=(V[i]-V[i-1])*A;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1400
#include<stdio.h>
int main()
{
	int h,w,i,j;
	char a[101][101];
	while(scanf("%d %d",&h,&w)!=EOF)
	{
		for(i=0;i<h;i++)
			scanf("%s",a[i]);
		
			for(i=0;i<w+2;i++)
		printf("#");
		
		printf("\n");
		
		
		for(i=0;i<h;i++)
		printf("#%s#\n",a[i]);
		
		
		for(i=0;i<w+2;i++)
		printf("#");
		
		printf("\n");
	}
	return 0;
 } 

Measured memory_bytes: 128
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
	cout << endl;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	cout << head;
	if (sizeof...(tail) != 0) cout << " ";
	print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
	for (auto& a : vec) {
		cout << a;
		if (&a != &vec.back()) cout << " ";
	}
	cout << endl;
}
template <class T>
void print(vector<vector<T>> &df) {
	for (auto& vec : df) {
		print(vec);
	}
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

#ifdef _DEBUG
signed solve()
#else
signed main()
#endif
{
	auto X = IN();
	if (X == 1)
	{
		print(1);
		return 0;
	}
	vector<i64> v;
	FOR(i, 1, X)
	{
		v.push_back(i*i);
		v.push_back(i*i*i);
		v.push_back(i*i*i*i);
		v.push_back(i*i*i*i*i);
	}
	ALL(sort, v);
	UNIQUE(v);
	auto uit = upper_bound(v.begin(), v.end(), X);
	uit--;
	print(*uit);
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		
		int[] a = new int[4];
		int[] b = new int[4];
		
		int sumA = 0, sumB = 0;
		
		for(int i = 0; i < 4; i++){
			a[i] = in.nextInt();
			sumA += a[i];
		}
		
		for(int i = 0; i < 4; i++){
			b[i] = in.nextInt();
			sumB += b[i];
		}
		
		if(sumA < sumB){
			System.out.println(sumB);
		}
		else{
			System.out.println(sumA);
		}
		
	}
}

Measured memory_bytes: 17180
#![allow(unused_imports)]
#![allow(unused_variables)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap};

fn main() {
    input! {
        n: usize,
        k: usize,
    }
    let mut hs = HashSet::new();
    for _ in 0..k {
        input! {
            d: usize,
            a: [usize; d],
        }
        for i in a {
            hs.insert(i);
        }
    }
    let ans = n - hs.len();
    println!("{}", ans);
}


Measured memory_bytes: 2120
fun main(args: Array<String>) {

    var (N, t, a) = readLine()!!.split(" ").map(String::toInt)
    t -= 1
    a -= 1

    val graph = Array(N) {
        mutableListOf<Int>()
    }

    repeat(N - 1) {
        val (v1, v2) = readLine()!!.split(" ").map(String::toInt).map { it - 1 }
        graph[v1].add(v2)
        graph[v2].add(v1)
    }

    fun calcDistance(v: Int): IntArray {
        val distance = IntArray(N)
        fun dfs(v: Int, d: Int, parentV: Int) {
            distance[v] = d
            for (adjacencyV in graph[v]) {
                if (adjacencyV == parentV) {
                    continue
                }
                dfs(adjacencyV, d + 1, v)
            }
        }
        dfs(v, 0, -1)
        return distance
    }


    val distanceT = calcDistance(t)
    val distanceA = calcDistance(a)

    var ans = 0
    for (i in 0 until N) {
        if (distanceT[i] < distanceA[i]) {
            ans = Math.max(ans, distanceA[i])
        }
    }

    println(ans - 1)
}

Measured memory_bytes: 81920
#include<stdio.h>
int main()
{
	int m,d,d1,d2,prod=0,i,j;
	scanf("%d %d",&m,&d);
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=d;j++)
		{
			if(j<=9)
			continue;
			d1=j%10;
			d2=j/10;
			if(d1>=2&&d2>=2&&d1*d2==i)
			prod++;
		}
	}
	printf("%d",prod);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	ll n=0;
	cin>>n;
	vector<ll> a(n);
	for(ll i=0;i<n;i++) cin>>a[i];
	ll sum=0;
	for(int i=0;i<n-1;i++){
	sum+=max(0LL,a[i]-a[i+1]);
	a[i+1]+=max(0LL,a[i]-a[i+1]);
	}
	cout<<sum<<'\n';
	return 0;
}


Measured memory_bytes: 4760
/*
मनस्वी म्रियते कामं कार्पण्यं न तु गच्छति ।
अपि निर्वाणमायाति नानलो याति शीतताम् ॥
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define p2d(v) for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v) for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v) for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

    ll n;
    ll a,b;
    cin>>n>>a>>b;

    ll x = a/n;
    ll y = b/n;

    if(x < y || ((a%n == 0) || (b%n == 0)))
    {
        cout<<"OK";
    }
    else
    {
        cout<<"NG";
    }
        
        












    return 0;
}       

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

class Graph01
{
    int V;
    using Pint = pair<int, int>;
    vector<vector<Pint> > E;

public:
    Graph01(int N) : V(N)
    {
        E.resize(V);
    }
    void add_edge(int from, int to, int cost)
    {
        E[from].push_back(make_pair(to, cost));
    }
    int bfs01(int s, int t)
    {
        deque<Pint> deq;
        vector<int> checked(V, 0);

        deq.push_front(Pint(s, 0));

        while(!deq.empty())
        {
            Pint now = deq.front();
            deq.pop_front();
            if (now.first == t) return now.second;
            if (checked[now.first]) continue;
            checked[now.first] = 1;
            for (auto e: E[now.first])
            {
                if (e.second) deq.push_back(Pint(e.first, now.second+1));
                else deq.push_front(Pint(e.first, now.second));
            }
        }
    }
};

int K;

int main()
{
    cin >> K;
    Graph01 graph(K);
    for (int i=1; i<K; i++)
    {
        graph.add_edge(i, (i*10)%K, 0);
        graph.add_edge(i, (i+1)%K, 1);
    }
    cout << graph.bfs01(1, 0) + 1 << endl;
}


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

using namespace std;

#define MAX 400010
typedef long long ll;

int bit[MAX], n;

void init()
{
    n = MAX-1;
    memset(bit, 0, sizeof(bit));   
}

int sum(int i)
{
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & -i;
    }
    return s;
}

void add(int i, int x)
{   
    while (i <= n) {
        bit[i] += x;
        i += i & -i;
    }
}

int get_val(int N, int key)
{
    int l = 0, idx = N;
    while (idx - l > 0) {
        int mid = (l + idx) / 2;
        if (sum(mid) < key) {
            l = mid + 1;
        } else {
            idx = mid;
        }
    }
    return l;
}

int main()
{
    ll Q, lim, x;
    int q;
    while (1) {
        scanf("%lld %lld", &Q, &lim);
        if (Q == 0 && lim == 0) break;
        ll idx = 1;
        init();
        map<ll, ll> i2v, v2i;
        while (Q--) {
            scanf("%d %lld", &q, &x);
            switch (q) {
                case 0: {
                    i2v[idx] = x; v2i[x] = idx;
                    add(idx, 1); idx++;
                    int r = sum(idx);
                    if (r > lim) {
                        add(get_val(idx, r - lim), -1);
                    }
                    break;
                }
                case 1: {
                    add(get_val(idx, x), -1);
                    break;
                }
                case 2: {                   
                    printf("%lld\n", i2v[get_val(idx, x)]);
                    break;
                }
                case 3: {
                    add(v2i[x], -1);
                    break;
                }
            }
        }
        puts("end");
    }
    return 0;
}

Measured memory_bytes: 54744
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main(void) {
  string s;
  cin>>s;
  int c=0;
  if(s[0]!='A') {
    cout<<"WA"<<endl;
    return 0;
  }
  for(int i=2; i<=s.size()-2; i++) {
    if(s[i]=='C') {
      c++;
    }
  }
  if(c!=1) {
    cout<<"WA"<<endl;
    return 0;
  }
  for(int i=0; i<s.size(); i++) {
    if(s[i]<'a' or s[i]>'z') {
      if((i<2 or i>s.size()-2) and i!=0) {
	cout<<"WA"<<endl;
	return 0;
      }
      if(2<=i and i<=s.size()-2 and s[i]!='C') {
	cout<<"WA"<<endl;
	return 0;
      }
    }
  }
  cout<<"AC"<<endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
numlist=list(map(int,input().split()))#リストに対してしか実行できない関数を使うため、入力した値をリスト化する
sortnumlist=sorted(numlist,reverse=True)#リストの中身を降順にしたやつをsortnumlistと言う変数名つけた

#リストのインデックス０、２、４・・・の合計がAliceの得点、１、３、５・・・の合計がBobの得点に等しい

alice_total = 0#Aliceの得点を初期化
bob_total = 0#Bobの得点を初期化
for x,y in enumerate (sortnumlist):#リストの要素のインデックスと値を別々に取り出す
    if x %2 ==0:
        alice_total = alice_total + y
    elif x %2 ==1:
        bob_total = bob_total + y
        
#print(alice_total)
#print(bob_total)

answer = alice_total  - bob_total
print(answer)


Measured memory_bytes: 9112
nums = []
for i in range(5):
    nums.append(int(input()))
k = int(input())
s = "Yay!"
for i in range(5):
    for m in range(5 - i):
        a = nums[i]
        if abs(a - nums[m]) > k:
             s = ":("
             break
print(s)



Measured memory_bytes: 3060
readInt() = parse.(Int,split(readline()))

function solve()
    N,K = readInt()
    R,S,P = readInt()
    T = readline()
    win = ones(Bool,N)
    for i in K+1:N
        T[i]==T[i-K] && win[i-K]==true && (win[i]=false)
    end
    ans = 0
    for i in 1:N
        win[i]==false && continue
        ans += (T[i]=='r' ? P : T[i]=='s' ? R : S)
    end
    println(ans)
end
solve()

Measured memory_bytes: 175104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

int digsum(int n) {
    int res = 0;
    while(n > 0) {
        res += n % 10;
        n /= 10;
    }
    return res;
}

int main() {

    int n;
    cin >> n;

    int res = digsum(n);
    if(n % res == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <cstring>
using namespace std;
int main(){
  int n;
  int d,r;
  scanf("%d",&n);
  scanf("%d%d",&d,&r);
  int cnt = 0;
  for (int i = 1; i <= n; i++){
     int x;
     scanf("%d",&x);
     cnt++;
     for (int j = 1;j <= 1000; j++){
         if (j * x + 1 <= d) cnt++;
         else break;
     }
  }
  printf("%d",cnt +  r);
}

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

typedef long long ll;

typedef pair<ll, ll> P;
struct edge { ll to, cost; };

const int MAX_V =200000;
const ll INF = 1LL<<60;

int V;
vector<edge> G[MAX_V];
ll d[MAX_V];

void dijkstra(ll s) {
    // greater<P>を指定することでfirstが小さい順に取り出せるようにする
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        rep(i,G[v].size()) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    ll N, M, S;
    cin >> N >> M >> S;
    V = N * 4000;
    vector<ll> u(M), v(M), A(M), B(M), C(N), D(N);
    rep(i, M) {
        cin >> u[i] >> v[i] >> A[i] >> B[i];
        u[i]--;
        v[i]--;
        rep(j, 2501) {
            G[u[i] + (j + A[i]) * N].push_back({v[i] + j * N, B[i]});
            G[v[i] + (j + A[i]) * N].push_back({u[i] + j * N, B[i]});
        }
    }
    rep(i, N) {
        cin >> C[i] >> D[i];
        C[i] = min(C[i], 2500LL);
        rep(j, 2501) {
            G[i + j * N].push_back({i + min(j + C[i], 2500LL) * N, D[i]});
        }
    }
    dijkstra(min(2500LL, S) * N);
    rep(i, N - 1) {
        ll ans = 1e18;
        rep(j, 2501) {
            ans = min(ans, d[i + 1 + j * N]);
        }
        cout << ans << "\n";
    }
}

Measured memory_bytes: 26260
import java.util.Arrays;
import java.util.Iterator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        
        int[] list = new int[n];
        for (int i = 0; i < list.length; i++) {
			list[i] = sc.nextInt();
		}
        
        Arrays.sort(list);
        
        int sum = 0;
        for (int i = 0; i < k; i++) {
			sum += list[list.length - i - 1];
		}
        
        System.out.println(sum);
       
    }
}

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

bool has3(int x){
while(x){
if(x%10==3) return true;
x/=10;}
return false;

}

void call(int n){
for(int x=1; x<=n; x++){
if(x%3==0||has3(x)){
cout<<" "<<x;

}
} cout<<endl;
}


int main() {
	int n; 
cin>>n;
call(n);// your code goes here
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main()
{
	char s[4];
	scanf("%s",s);
	if(s[0]!=s[1]&&s[0]!=s[2]&&s[1]!=s[2]){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

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

int main() {
    string a;
    cin >> a;
    int cnt = 0;
    for (int i = 0; i < 3; i++) {
        // cout << a[i] << endl;
        if (a[i] == '1') {
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long;
using ll = long long;
#define rep(i,n) for(lint (i) = 0;(i) < (lint)(n);(i)++)
#define repInRange(i,start,end) for(lint (i) = (start);(i) < (end);++(i))
using pl = pair<lint,lint>;
using Vecint = vector<lint>;
using Llist = list<lint>;

ll pow(ll k,ll l) {
	ll ret = 1;
	rep(i,l) {
		ret *= k;
	}
	return ret;
}

template <typename T>
T sum(vector<T> vec) {
	ll ret = 0;
	rep(i,vec.size()) {
		ret += vec.at(i);
	}
	return ret;
}

void Main() {
	string s;
	tuple<ll,ll,ll,ll> c(0,0,0,0);
	cin >> s;
	rep(i,s.size()) {
		switch (s[i]) {
		case 'N':
			get<0>(c) = 1;
			break;
		case 'E':
			get<1>(c) = 1;
			break;
		case 'W':
			get<2>(c) = 1;
			break;
		case 'S':
			get<3>(c) = 1;
			break;
		}
	}
	if ((!(get<0>(c)^get<3>(c))) && (!(get<1>(c)^get<2>(c)))) {
		cout << "Yes" << '\n';
		return;
	}
	cout << "No" << '\n';
	return;
}

signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define endl "\n"
    #define ll long long int
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define f first
    #define s second

    using namespace std;
int power(int base, int exp)
{
    if (exp == 0)
       return 1;
    else if (exp == 1)
       return base;
    else
    {
       int calc;
       if (exp % 2 == 0)
       {
         calc = power(base, exp/2);
         calc =(calc* calc)%mod;
       }
       else
       {
         calc = (base*power(base, exp-1))%mod;
       }
       return calc%mod;
    }
}
int main()
{
    long long int t=1,n,k,x,y;
    while(t--)
    {
        long long int s=0,d,e;
        cin>>n;
        int a[n];
        unordered_map<int,int>m;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s=s+a[i];
        }
        cin>>k;
        while(k--)
        {
            cin>>x>>y;
            d=m[x];
            e=m[y];
            s=s-d*x;
            s=s+d*y;
            m[y]=e+d;
            m[x]=0;
            cout<<s<<endl;
        }
    }
    return 0;

}


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

int main(void) {
  int n;
  cin >> n;
  
  for (int i = 0; i < 3; i++) {
  	if (n % 10 == 7) {
    	cout << "Yes" << endl;
      	return 0;
    }
    n /= 10;
  }
  cout << "No" << endl;
  return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    data_type n,r,mean1,mean2,sum=0,sum1=0,temp;
    cin>>n;
    vector<data_type> vc(n);
    for(auto &i:vc)
        cin>>i;
    temp=accumulate(vc.begin(),vc.end(),0LL);
    if(temp%n!=0)
      mean1=temp/n,mean2=temp/n+1;
    else
     mean1=mean2=temp/n;

    for(auto i:vc)
        {
            sum+=(i-mean1)*(i-mean1);
            sum1+=(i-mean2)*(i-mean2);

        }

    cout<<min(sum,sum1)<<endl;


    return 0;
}




Measured memory_bytes: 256
use std::io;

fn main() {
    let mut input_line: String = String::new();
    io::stdin().read_line(&mut input_line).expect("Err");

    let inputs: Vec<&str> = input_line.split_whitespace().collect();

    let n: i64 = inputs[0].parse().unwrap();
    let border: i64 = 10_i64.pow(9) + 7;
    let mut power: i64 = 1;

    for i in 1..n+1{
        // println!("current power:{} (i:{})", power, i);
        power = power % border * i;
    }

    print!("{}", power % border);

}

Measured memory_bytes: 2108
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    int n,x,c=0;
    cin >> n >> x;
    vector<int>y(n);
    for(int i=0;i<n;i++){
        cin >> y[i];
    }
    sort(y.begin(),y.end());
    x-=accumulate(y.begin(),y.end(),0);
    while(y[0]<=x){
        x-=y[0];
        c++;
    }
    cout << n+c;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	static int[][] field1,field2;
	static byte[][][][] dp;
	static int sXL,sXR,sYL,sYR;
	static boolean ans;
	static int[] v1={0,1,0,-1};
	static int[] v2={1,0,-1,0};
	static int w,h;
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		while(true){

			w=cin.nextInt();
			h=cin.nextInt();
			if(w+h==0){
				return ;
			}
			ans=false;
			field1=new int[h][w];
			field2=new int[h][w];
			dp=new byte[h][w][h][w];
			for(int i=0;i<h;i++){
				for(int j=0;j<2;j++){
					String s=cin.next();
					int[][] a;
					if(j==0){
						a=field1;
					}
					else{
						a=field2;
					}
					for(int k=0;k<s.length();k++){
						int b=0;
						if(s.charAt(k)=='%'){
							b=1;
						}
						else if(s.charAt(k)=='#'){
							b=-1;
						}
						else if(s.charAt(k)=='L'){
							sXL=i;
							sYL=k;
						}
						else if(s.charAt(k)=='R'){
							sXR=i;
							sYR=k;
						}
						a[i][k]=b;
					}
				}
			}
			Queue<byte[]> q=new LinkedList<byte[]>();
			q.add(new byte[]{(byte) sXL,(byte) sYL,(byte) sXR,(byte) sYR});
			while(!q.isEmpty()){
				byte[] poll=q.poll();
				int a=poll[0];
				int b=poll[1];
				int c=poll[2];
				int d=poll[3];
				if(dp[a][b][c][d]==1||ans){
					continue;
				}
				dp[a][b][c][d]=1;
				if(field1[a][b]==1&&field2[c][d]==1){
					ans=true;
					break;
				}
				if(field1[a][b]==1){
					continue;
				}
				if(field2[c][d]==1){
					continue;
				}
				for(int i=0;i<4;i++){
					int aa=a+v1[i];
					int bb=b+v2[i];
					int cc=c+v1[i];
					int dd=d+-v2[i];
//					System.out.println(aa+" "+bb+" "+cc+" "+dd+" "+i);
					if(aa<0||aa>=h){
						aa-=v1[i];
					}
					if(bb<0||bb>=w){
						bb-=v2[i];
					}
					if(cc<0||cc>=h){
						cc-=v1[i];
					}
					if(dd<0||dd>=w){
						dd-=-v2[i];
					}
//					System.out.println(aa+" "+bb+" "+cc+" "+dd+" "+i);
					if(field1[aa][bb]==-1){
						aa-=v1[i];
						bb-=v2[i];
					}
					if(field2[cc][dd]==-1){
						cc-=v1[i];
						dd-=-v2[i];
					}
					if(dp[aa][bb][cc][dd]==1)continue;
					q.add(new byte[]{(byte)aa,(byte)bb,(byte)cc,(byte)dd});
				}

			}
//			bt(sXL,sYL,sXR,sYR);
			if(ans){
				System.out.println("Yes");
			}
			else{
				System.out.println("No");
			}
		}
	}
	static void bt(int a,int b,int c,int d){
//		if(dp[a][b][c][d]||ans){
//			return ;
//		}
//		dp[a][b][c][d]=true;
		if(field1[a][b]==1&&field2[c][d]==1){
			ans=true;
		}
		if(field1[a][b]==1){
			return;
		}
		if(field2[c][d]==1){
			return;
		}
		for(int i=0;i<4;i++){
			int aa=a+v1[i];
			int bb=b+v2[i];
			int cc=c+v1[i];
			int dd=d+-v2[i];
//			System.out.println(aa+" "+bb+" "+cc+" "+dd+" "+i);
			if(aa<0||aa>=h){
				aa-=v1[i];
			}
			if(bb<0||bb>=w){
				bb-=v2[i];
			}
			if(cc<0||cc>=h){
				cc-=v1[i];
			}
			if(dd<0||dd>=w){
				dd-=-v2[i];
			}
//			System.out.println(aa+" "+bb+" "+cc+" "+dd+" "+i);
			if(field1[aa][bb]==-1){
				aa-=v1[i];
				bb-=v2[i];
			}
			if(field2[cc][dd]==-1){
				cc-=v1[i];
				dd-=-v2[i];
			}
			bt(aa,bb,cc,dd);
		}
	}
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N; cin >> N;
  vector<int> b(N);
  rep(i, N) {
    cin >> b[i];
  }
  vector<int> ans;
  rep(_, N) for (int i = b.size() - 1; i >= 0; i--) {
    if (i == (b[i] - 1)) {
      ans.push_back(b[i]);
      b.erase(b.begin() + i);
      break;
    }
  }

  if (b.empty()) {
    rep(i, N) cout << ans[N - 1 - i] << endl;
  } else {
    cout << -1 << endl;
  }
}


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

int main() {
  string o,e;
  cin>>o>>e;
  for (int i=0;i<o.size()+e.size();i++) {
    if (i%2==0) cout<<o.at(i/2);
    else cout<<e.at((i-1)/2);
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

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

	ll N;
	cin >> N;

	vector<ll> L(N);
	for (ll i = 0; i < N; ++i)
	{
		cin >> L[i];
	}

	sort(L.begin(), L.end(), greater<ll>());

	ll s = 0;
	for (ll i = 1; i < N; ++i)
	{
		s += L[i];
	}

	if (L[0] < s)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
#define mod 1000000007 
using namespace std;

const int maxn=1e6+5;
int n;
ll inv[maxn],ip[maxn];

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

inline ll qpow(int x,int k){
	ll ss=1,tmp=x;
	while(k > 0){
		if(k & 1) ss=ss*tmp%mod;
		tmp=tmp*tmp%mod;
		k>>=1;
	}
	return ss;
}

void pre(){
	inv[0]=inv[1]=1;
	go(i,n+1,2) inv[i]=(-1ll*(mod/i)*inv[mod%i]%mod+mod)%mod;
	ip[0]=1; ip[1]=qpow(3,mod-2);
	go(i,n+1,2) ip[i]=ip[i-1]*ip[1]%mod;
}

inline void add(ll &a,ll b){ a=a+b; if(a >= mod) a-=mod; return ; }

int main(){
	#ifndef ONLINE_JUDGE
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	#endif
	n=rd(); pre();
	ll ans=0;
	go(i,n+1,1)
		add(ans,ip[i]*inv[n]%mod*inv[n-i+1]%mod);
	printf("%lld",ans);
	return 0;
}//Faze


Measured memory_bytes: 15872
#include<cstdio>
#include<queue>
char a[1000][1001];
int d[1000][1000];
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
int h,w;
int main(){
    scanf("%d%d",&h,&w);
    std::queue<std::pair<int,int>> q;
    for(int i=0;i<h;i++)scanf("%s",a[i]);
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(a[i][j]=='#'){
                q.push({i,j});
                d[i][j]=0;
            }else{
                d[i][j]=-1;
            }
        }
    }
    while(!q.empty()){
        int x=q.front().first;
        int y=q.front().second;
        q.pop();
        for(int i=0;i<4;i++){
            if(x+dx[i]>=0 && x+dx[i]<h && y+dy[i]>=0 && y+dy[i]<w && d[x+dx[i]][y+dy[i]]==-1){
                d[x+dx[i]][y+dy[i]]=d[x][y]+1;
                q.push({x+dx[i],y+dy[i]});
            }
        }
    }
    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(ans<d[i][j])ans=d[i][j];
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 13328
import sys

n = int(input())
s = [int(input()) for i in range(n)]
s.sort()

ans = sum(s)

for i in s:
	if(ans%10==0):
		if(i%10!=0):
			print(ans-i)
			sys.exit()
	else:
		print(ans)
		sys.exit()

print(0)

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

int n,x,k=1;

int main() 
{
	cin>>n;	
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if(x==k) k++;
	}
	k--;
	if(k==0)
		cout<<"-1"<<endl;
	else
		cout<<n-k<<endl;
	return 0;
}

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

template <typename T>
struct Edge {
    Edge(const std::size_t from_, const std::size_t to_, const std::size_t reverse_, const T capacity_) : from{from_}, to{to_}, reverse{reverse_}, capacity{capacity_}, flow{0} {}
    std::size_t from;
    std::size_t to;
    std::size_t reverse;
    T capacity;
    T flow;
};

template <typename T>
class Flow
{
public:
    Flow(const std::size_t v) : m_v{v}, m_e{0}
    {
        m_table.resize(v);
    }
    void addEdge(const std::size_t from, const std::size_t to, const T capacity)
    {
        m_e++;
        m_table[from].push_back(Edge<T>{from, to, m_table[to].size(), capacity});
        m_table[to].push_back(Edge<T>{to, from, m_table[from].size() - 1, 0});
    }

    T FordFulkerson(const std::size_t s, const std::size_t t)
    {
        std::vector<bool> checked(m_v);
        T flow = 0;
        while (true) {
            for (std::size_t i = 0; i < m_v; i++) {
                checked[i] = false;
            }
            const T f = dfs_ff(s, t, INF, checked);
            if (f == 0) {
                break;
            }
            flow += f;
        }
        return flow;
    }

    static constexpr T INF = std::numeric_limits<T>::max() / 100;

private:
    T dfs_ff(const std::size_t pos, const std::size_t t, const T flow, std::vector<bool>& checked)
    {
        if (pos == t) {
            return flow;
        }
        checked[pos] = true;
        for (auto& e : m_table[pos]) {
            if (not checked[e.to]) {
                const T res = e.capacity - e.flow;
                if (res > 0) {
                    const T d = dfs_ff(e.to, t, std::min(flow, res), checked);
                    if (d > 0) {
                        e.flow += std::min(d, res);
                        m_table[e.to][e.reverse].flow -= std::min(d, res);
                        return d;
                    }
                }
            }
        }
        return 0;
    }

    const std::size_t m_v;
    std::size_t m_e;
    std::vector<std::vector<Edge<T>>> m_table;
};
int main()
{
    std::size_t V, E;
    std::cin >> V >> E;
    Flow<int> f(V);
    for (std::size_t i = 0; i < E; i++) {
        std::size_t u, v;
        int c;
        std::cin >> u >> v >> c;
        f.addEdge(u, v, c);
    }
    std::cout << f.FordFulkerson(0, V - 1) << std::endl;
    return 0;
}

Measured memory_bytes: 3164
x = input()
k=x.split(" ")
N = int(k[0])
T = int(k[1])


c = []
t = []

for i in range(N):
    p = input()
    y = p.split(" ")
    if int(y[1]) <= T:
        c.append(int(y[0]))
        t.append(int(y[1]))

if len(c) <=0:
    print("TLE")
else:
    print(min(c))


Measured memory_bytes: 3064
package main

import (
	"fmt"
)

type UnionFind struct {
	par  []int
	size []int
}

func NewUnionFind(size int) *UnionFind {
	return new(UnionFind).init(size)
}

func (uf *UnionFind) init(size int) *UnionFind {
	uf = new(UnionFind)
	uf.par = make([]int, size)
	uf.size = make([]int, size)

	for i := 0; i < size; i++ {
		uf.par[i] = i
		uf.size[i] = 1
	}
	
	return uf
}

func (uf *UnionFind) Unite(p int, q int) {
	rp := uf.Root(p)
	qp := uf.Root(q)
	if rp == qp {
		return
	}
	if uf.size[rp] < uf.size[qp] {
		uf.par[rp] = uf.par[qp]
		uf.size[qp] += uf.size[rp]
	} else {
		uf.par[qp] = uf.par[rp]
		uf.size[rp] += uf.size[qp]
	}
}

func (uf *UnionFind) Root(p int) int {
	for uf.par[p] == p {
		return p
	}
	uf.par[p] = uf.Root(uf.par[p])
	return uf.par[p]
}

func (uf *UnionFind) Size(p int) int {
	return uf.size[uf.Root(p)]
}

func (uf *UnionFind) Same(p int, q int) bool {
	return uf.Root(p) == uf.Root(q)
}

func main() {

	var N, M, K int
	fmt.Scanf("%d %d %d\n", &N, &M, &K)
	uf := NewUnionFind(N)
	friends := make([]int, N)
	for i := 0; i < M; i++ {
		var A, B int
		fmt.Scanf("%d %d\n", &A, &B)
		uf.Unite(A-1, B-1)
		friends[A-1]++
		friends[B-1]++
	}
	blocks := make([]int, N)
	for i := 0; i < K; i++ {
		var A, B int
		fmt.Scanf("%d %d\n", &A, &B)
		if uf.Same(A-1, B-1) {
			blocks[A-1]++
			blocks[B-1]++
		}
	}
	for i := 0; i < N; i++ {
		ans := uf.Size(i) - friends[i] - blocks[i] - 1
		fmt.Printf("%v ", ans)
	}
	fmt.Println()
}


Measured memory_bytes: 9744
// Bismillahir Rahmanir Rahim
// Mr_Emrul

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

typedef long long int ll;
typedef pair <ll, ll> pll;
typedef pair <ll, pll> plp;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
const ll MX = 1000005;

#define LCM(a,b)        (a / __gcd(a,b) ) *-b
#define gcd(a,b)        __gcd(a,b)
#define all(x)          (x).begin(), (x).end()
#define mem(a, n)       memset(a,n,sizeof(a))
#define for1(i, n)      for(i=1; i<=n; i++)
#define for0(i, n)      for(i=0; i<n; i++)
#define rof0(i, n)      for(i=n-1; i>=0; i--)
#define rof1(i, n)      for(i=n; i>=1; i--)
#define forab(i, a, b)  for(i=a; i<=b; i++)
#define rofab(i, a, b)  for(i=b; i>=a; i--)
#define pb              push_back
#define pbb             pop_back
#define YES             cout << "YES" << endl
#define NO              cout << "NO" << endl
#define sin(s)          getline(cin, s)
#define scf(a)          cin >> a
#define scf2(a, b)      cin >> a >> b
#define scf3(a, b, c)   cin >> a >> b >> c
#define scf4(a,b,c,d)   cin >> a >> b >> c >> d
#define pnf(a)          cout << (a) << endl
#define pnf2(a, b)      cout << (a) << " " << (b) << endl
#define pnf3(a, b, c)   cout << (a) << " " << (b) << " " << (c) << endl
#define pnfa(a)         cout << (a) << " "
#define pf(a)           cout << (a)
#define sp              cout << " "
#define nl              cout << endl
#define sz(n)           n.size()
#define clear(v)        v.clear()
#define bug(n)          cout << ">> " << n << " <<" << endl
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define in              freopen("in.txt", "r", stdin)
#define out             freopen("out.txt", "w", stdout)
#define fast            {ios_base::sync_with_stdio(false); cin.tie(0);}
#define F               first
#define S               second
#define mpp             make_pair

int main()
{
    ll a, b, c;
    scf3(a, b, c);
    if(b-a==c-b)
        YES;
    else
        NO;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}

struct UnionFind {
  vector<int> data;
  UnionFind(int sz) {data.assign(sz, -1);}
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return false;
    if (data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }
  int find(int k) {
    if(data[k] < 0) return (k);
    return data[k] = find(data[k]);
  }
  int size(int k) {
    return -data[find(k)];
  }
};

int main() {
  ll n; cin >> n;
  vector<P> x, y;
  rep(i, n) {
    int a, b; cin >> a >> b;
    x.push_back(P(a, i));
    y.push_back(P(b, i));
  }

  sort(all(x));
  sort(all(y));

  priority_queue<tuple<int, int, int>> pq;
  rep(i, n-1) pq.push(make_tuple(x[i].first - x[i+1].first, x[i].second, x[i+1].second));
  rep(i, n-1) pq.push(make_tuple(y[i].first - y[i+1].first, y[i].second, y[i+1].second));

  UnionFind uf(n);
  int cnt = 0;
  ll ans = 0;
  while (cnt < n-1) {
    int w, u, v;
    tie(w, u, v) = pq.top(); pq.pop();
    if (uf.unite(u, v)) {
      ans -= w;
      cnt++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7144
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int a[200001];
int main(){
    int n,ai;
    cin>>n;
    int cnt=1;
    int mx=1;
    rep(i,n){
        cin>>ai;
        --ai;
        a[ai]=i;
    }
    FOR(i,1,n){
        if(a[i]>a[i-1]) ++cnt;
        else cnt=1;
        mx=max(mx,cnt);
    }
    cout<<n-mx<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

typedef string::const_iterator state;
class parse_error {};

void cmpinc(state &it, char expected) {
	if (*it == expected) {
		it++;
	}
	else {
		cerr << "Expected '" << expected << "',";
		cerr << "got '" << *it << "'";

		cout << endl;
		throw parse_error();
	}
}

char az(char c) {
	return (c - 'A' + 26) % 26 + 'A';
}

/*

EBNF

cipher = {string};
string = letter | '[' cipher ']';
letter = ['+'|'-'](( 'a' - 'Z' ) | '?');

*/

char c;//?????°??¨

string cipher(state &it);
string str(state &it);
char letter(state &it);

bool flag; //?????????????

string cipher(state &it) {
	string ret = "";
	while (*it != '$' && *it != ']') {
		ret += str(it);
	}
	return ret;
}


string str(state &it) {
	string ret = "";
	string t;
	flag = false;

	switch (*it) {
	case '[':
		it++;
		t = cipher(it);
		reverse(t.begin(), t.end());
		ret = t;
		cmpinc(it, ']');
		break;
	default:
		ret = letter(it);
		break;
	}

	return ret;
}

char letter(state &it) {
	char ret = '\0';

	switch (*it) {

	case '+':
		it++;
		ret = az(letter(it) + 1);
		if (flag)ret = '?';
		break;
	case '-':
		it++;
		ret = az(letter(it) - 1);
		if (flag)ret = '?';
		break;
	case '?':
		flag = true;
		ret = *it;
		it++;
		break;
	default:
		if (*it >= 'A'&&*it <= 'Z') {
			ret = *it;
			it++;
		}
		break;
	}

	return ret;
}


int main() {
	for (string s; getline(cin, s), s != "."; ) {
		s += "$";

		state it = s.begin();
		string ans = cipher(it);

		for (size_t f = ans.find("?"); f != string::npos; f = ans.find("?")) {
			ans.replace(f, 1, "A");
		}

		cout << ans << endl;

	}
	return 0;
}

Measured memory_bytes: 1192
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring> 

using namespace std;

#ifdef DEBUG_MODE
#define DBG(n) n;
#else
#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;


int main() {
	ll n, m; cin >> n >> m;
	ll ans = 0;
	REP(i, m) {
		int a; cin >> a;
		if (a > m)ans++;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3100