akhauriyash/Code-Regression huggingface dataset:
/*    ####################  */
/*   # I_LOVE_THUY_LINH #  */
/*  ####################  */
#include <bits/stdc++.h>
#define ll long long
#define db double
#define ld long double
#define ii pair<int,int>
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define matrix vector<vector<ll>>
#define fir first
#define sec second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define sz(a) int((a).size())
#define ms(s,val) memset(s,val,sizeof(s))
#define bitcount(n) __builtin_popcountll(n)
#define getbit(s,k) ((s >> k)&1)
#define turnbit(s,k) (s | (1<<k))
#define offbit(s,k) (s & ~(1<<k))
#define flipbit(s,k) (s ^ (1<<k))
#define prec(n) fixed<<setprecision(n)
#define sqr(x) (ll)(x)*(ll)(x)
#define lcm(a,b) ((ll)a/__gcd((ll)a,(ll)b)*(ll)(b))
#define gcd(a,b) __gcd(a,b)
using namespace std;
const int INF = int(1e9);
int n, k;

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> k;
    vector<int> a(n);
    for (int &i: a) cin >> i;
    sort(all(a));

    ll ans = 0;
    for (int i = 0; i < n - k; i++)
        ans += (ll)a[i];
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; using namespace atcoder;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, K, A[50][50];
ll BASE = 1000000000;
int edge_numbers[50][50];
string ans2[50];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];

	mcf_graph<int, ll> g(N + N + 2);
	int st = N + N;
	int gl = st + 1;

	g.add_edge(st, gl, N * K, BASE);
	rep(x, 0, N) g.add_edge(st, x, K, 0);
	rep(y, 0, N) g.add_edge(y + N, gl, K, 0);
	rep(x, 0, N) rep(y, 0, N) edge_numbers[y][x] = g.add_edge(x, y + N, 1, BASE-A[y][x]);

	auto p = g.flow(st, gl, N * K);
	ll ans = -(p.second - BASE * N * K);
	printf("%lld\n", ans);

	rep(y, 0, N) rep(x, 0, N) ans2[y] += ".";
	rep(y, 0, N) rep(x, 0, N) if (0 < g.get_edge(edge_numbers[y][x]).flow) ans2[y][x] = 'X';
	rep(y, 0, N) printf("%s\n", ans2[y].c_str());
}







Measured memory_bytes: 4012
from collections import defaultdict

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp%i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = int(input())
d = defaultdict(int)

for i in range(2,n+1):
  F = factorization(i)
  for j in F:
    d[j[0]] += j[1]
    
ans = 1
for v in d.values():
  ans *= v+1
  ans %= 1000000007
  
print(ans%1000000007)

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

static const ULL M = 1000000007;

struct RMQ {
	UL N;
	vector<ULL> V;
	RMQ(UL n) {
		N = 1; while (N < n) N <<= 1;
		V.resize(N * 2 - 1);
	}
	ULL query(UL l, UL r, UL a = ~0u, UL b = ~0u, UL i = ~0u) {
		if (a == ~0u) { a = 0; b = N; i = 0; }
		if (r <= a || b <= l) return 0;
		if (l <= a && b <= r) return V[i];
		return max(query(l, r, a, (a + b) >> 1, (i << 1) + 1),
			query(l, r, (a + b) >> 1, b, (i << 1) + 2));
	}
	void upd(UL p, ULL v) {
		UL i = p + N - 1;
		V[i] = v;
		while (i != 0) {
			i = (i - 1) >> 1;
			V[i] = max(V[(i << 1) + 1], V[(i << 1) + 2]);
		}
	}
};

struct Problem {
public:

	UL N;
	UL H[200000];
	ULL dp[200000];

	void Solve() {
		scanf("%u", &N);
		rep(i, N) { scanf("%u", &H[i]); H[i]--; }
		RMQ Q(N);
		rep(i, N) {
			ULL A;
			scanf("%llu", &A);
			dp[i] = A + Q.query(0, H[i] + 1);
			Q.upd(H[i], dp[i]);
		}
		printf("%llu", Q.query(0, N));
	}
};

int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}


Measured memory_bytes: 6656
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tarek
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACirclePond solver = new ACirclePond();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACirclePond {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            double t = in.nextDouble();
            double res = 2 * 3.14 * t;
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }
}



Measured memory_bytes: 33436
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	int fun(int a, int b, int c, int d, int e, int f) {
		return a * 100 + b * 101 + c * 102 + d * 103 + e * 104 + f * 105;
	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int X = sc.nextInt();

		sc.close();

		int Z = 1000;

		for (int a = 0; a < Z; a++) {
			if (fun(a, 0, 0, 0, 0, 0) > X) {
				break;
			}
			for (int b = 0; b < Z - a; b++) {
				if (fun(a, b, 0, 0, 0, 0) > X) {
					break;
				}
				for (int c = 0; c < Z - (a + b); c++) {
					if (fun(a, b, c, 0, 0, 0) > X) {
						break;
					}
					for (int d = 0; d < Z - (a + b + c); d++) {
						if (fun(a, b, c, d, 0, 0) > X) {
							break;
						}
						for (int e = 0; e < Z - (a + b + c + d); e++) {
							if (fun(a, b, c, d, e, 0) > X) {
								break;
							}
							for (int f = 0; f < Z - (a + b + c + d + e); f++) {
								int q = fun(a, b, c, d, e, f);
								if (q == X) {
									out.println(1);
									return;
								}
								if (q > X) {
									break;
								}
							}
						}
					}
				}
			}
		}

		out.println(0);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 23764
// https://atcoder.jp/contests/abc141/tasks/abc141_a
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, [ next / $t:tt ]) => {
        {
            let len = read_value!($iter, usize);
            (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        s: chars
    };
    let w = match s[0] {
        'S' => "Cloudy",
        'C' => "Rainy",
        'R' => "Sunny",
        _ => unreachable!("invalid weather")
    };
    println!("{}", w);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=999999999;

int main() {
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   if(abs(a-c)<=d||abs(b-a)<=d&&abs(c-b)<=d){cout<<"Yes"<<endl;}
   else{cout<<"No"<<endl;}
return 0;}

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

long long a[100001];

int main()
{
	int n;
	cin>>n;
	
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]==0ll)
		{
			cout<<0<<endl;
			return 0;
		}
	}
		
	long long mul=1ll;
	for(int i=1;i<=n;i++)
	{
		if(1000000000000000000ll/mul<a[i])
		{
			cout<<-1<<endl;
			return 0;
		}
		mul*=a[i];
	}
	cout<<mul<<endl;
	return 0;
}

Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code!
int main() 
{
    buff();
    ll a, v, b, w, t;
    cin >> a >> v;
    cin >> b >> w;
    cin >> t;
    ll dist = llabs(b - a);
    ll speed_diff = v - w;
    if(speed_diff <= 0) cout << "NO\n";
    else {
        ll take = (dist / speed_diff) + !!(dist % speed_diff);
        if( take <= t ) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}



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

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

   int n ;
   cin >> n ;
   vector<int>a(n) ;
   for(int i = 0 ; i < n ; i++ ){
     cin >> a[i] ;
   }

   int mx = 0 ;
   vector<int>bk ;
   bk.push_back(a[0]) ;
   for( int i = 1 ; i < n ; i++ ){
      if( bk.back() < a[i] ){
        mx = max((int)bk.size(), mx);
        bk.clear();
      }
      bk.push_back(a[i]) ;
   }
   mx = max( (int)bk.size() , mx ) ;
   cout << mx - 1 ;


}


Measured memory_bytes: 1276
#include <vector>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <functional>

const int INF = 1001001000;
const int MOD = (int)1e9 + 7;

using ll = long long;

using namespace std;

typedef pair<int,int> P;

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

int main(){
  int n;
  vector<int> t;
  vector<int> x;
  vector<int> y;

  cin >> n;
  t.resize(n);
  x.resize(n);
  y.resize(n);

  for( int i = 0; i < n; ++i){
    cin >> t[i] >> x[i] >> y[i];
  }

  int t1,x1,y1;
  t1 = 0;
  x1 = 0;
  y1 = 0;
  int f = true;
  int tmp1;
  for( int i = 0; i < n; ++i){
    t1 = t[i] - t1;
    x1 = x[i] - x1;
    y1 = y[i] - y1;
    tmp1 = t1 - x1 - y1;
    if( tmp1%2 == 1 || tmp1 < 0){
      f = false;
      break;
    }
  }

  if(f){
    cout << "Yes" << endl;
  }else{
    std::cout << "No" << '\n';
  }

}


Measured memory_bytes: 1408
"""
Union-Find Tree / Disjoint Set Union (DSU)
"""


def init_unionfind(N):
    global parent, rank, NUM_VERTEX
    NUM_VERTEX = N
    parent = [-1] * N
    rank = [0] * N


def find_root(x):
    p = parent[x]
    if p == -1:
        return x
    p2 = find_root(p)
    parent[x] = p2
    return p2


def unite(x, y):
    x = find_root(x)
    y = find_root(y)
    if x == y:
        return  # already united
    if rank[x] < rank[y]:
        parent[x] = y
    else:
        parent[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1


def is_connected(x, y):
    return (find_root(x) == find_root(y))


def num_components():
    return len(set(find_root(x) for x in range(NUM_VERTEX)))

# --- end of library ---


def main_yosupo():
    # verified: https://judge.yosupo.jp/problem/unionfind
    N, Q = [int(x) for x in input().split()]
    init_unionfind(N)
    for q in range(Q):
        typ, u, v = [int(x) for x in input().split()]
        if typ == 0:
            unite(u, v)
        else:
            print(1 if is_connected(u, v) else 0)


def main_abl():
    N, M = map(int, input().split())
    init_unionfind(N)
    for _i in range(M):
        a, b = map(int, input().split())
        unite(a - 1, b - 1)

    print(num_components() - 1)


# tests
T1 = """
3 1
1 2
"""
TEST_T1 = """
>>> as_input(T1)
>>> main_abl()
1
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g, name=k)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


if __name__ == "__main__":
    # main_yosupo()
    main_abl()
    # _test()


Measured memory_bytes: 81608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n)cin >> a[i];
    int ans = 0;
    rep(i, n){
        if(i % 2 == 0 && a[i] % 2 == 1)ans++;
    }
    cout << ans << endl;
}

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

int main()
{
   string S;
   cin >> S;
   bool input_d = false; 
   for(int i = 1; i < S.length(); i++){
      if(S[i-1] == S[i])
         input_d = true;
   }
   !input_d ? cout << "Good" << endl : cout << "Bad" << endl;
   return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException
	{
		 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		 String line = br.readLine();
		 StringTokenizer st = new StringTokenizer(line);
		 int a = Integer.parseInt(st.nextToken());
		 int b = Integer.parseInt(st.nextToken());
		 if(a % 2 == 0 || b % 2 == 0) 
		 {
			 System.out.println("Even");
		 }
		 else 
		 {
			 System.out.println("Odd");
		 }
	}
}


Measured memory_bytes: 21332
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: usize
    }

    let mut cnt = vec![1; n + 1];

    let mut ans = 0;
    for i in 1..=n {
        ans += cnt[i] * i;
        for j in (i * 2..=n).step_by(i) {
            cnt[j] += 1
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 80144
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  vector<int> ans(s.size()+1, 0);
  rep(i, s.size()){
    if(s.at(i) == '<'){
      ans.at(i+1) = ans.at(i) + 1;
    }
  }
  rrep(i, s.size()){
    if(s.at(i) == '>'){
      ans.at(i) = max(ans.at(i), ans.at(i+1)+1);
    }
  }
  ll sum = 0;
  rep(i, ans.size()) sum += ans.at(i);
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 5792
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
typedef long long ll;
typedef long double ld;

using namespace std;
bool f(char &a,char &b,char &c){
    return a!=b&&b!=c&&a!=c;
}
int main(){
    cs;
    ll l,r=0,g=0,b=0,t,ans;string s;
    cin>>l>>s;
    rep(i,l){
        switch(s[i]){
            case 'R':r++;break;
            case 'G':g++;break;
            case 'B':b++;break;
            default:;
        }
    }
    t=(l-1)/2;
    ans=r*g*b;
    repp(i,1,t){
        int tt=l-1-2*i;
        repp(j,0,tt){
            if(f(s[j],s[j+i],s[j+2*i])) ans--;
        }
    }
    cout<<ans;
    
}


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

int main(){
    vector<int> array(7);

    for(int i=0; i<7; i++){
        array[i] = 0;
    }

    int n;
    int tmp;

    while(cin >> n, n != 0){
        for(int i=1; i<=n; i++){
            cin >> tmp;

            if(tmp < 10){
                array[0]++;
            }else if(tmp <= 19){
                array[1]++;
            }else if(tmp <= 29){
                array[2]++;
            }else if(tmp <= 39){
                array[3]++;
            }else if(tmp <= 49){
                array[4]++;
            }else if(tmp <= 59){
                array[5]++;
            }else{
                array[6]++;
            }
        }
        for(int i=0; i<7; i++){
            cout << array[i] << endl;
            array[i] = 0;
        }
    }
    return 0;
}

Measured memory_bytes: 0
n=int(input())
s=input().split(' ')

print(' '.join(s))

for i in range(1,n):
	v=int(s[i])
	j=i-1
	while j>=0 and int(s[j])>v:
		s[j+1]=s[j]
		j-=1
	s[j+1]=str(v)
	print(' '.join(s))


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int n,m;
    cin >> n >> m;
    pair<int , int> A[n + 1];
    REP(i,n){
        int a,b;
        cin >> a >> b;
        A[i] = mp(a,b);
    }
    sort(A,A+n);
    A[n] = mp(INF,-INF);
    priority_queue<int> Q;

    int day = 1;
    int id = 0;
    int ans = 0;
    while(day <= m){
        if(A[id].fi <= day){
            Q.push(  A[id].se);
            id ++ ;
        }
        else{
            if(Q.size() >= 1){
            ans += Q.top();
            Q.pop();
            }
            day ++;
        }
    }
    cout << ans << endl;

}

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

ans = sum(B)

for i in range(N-1):
    if A[i]+1 == A[i+1]:
        #print(str(A[i])+ " : " +str(A[i+1]))
        ans += C[A[i]-1]

print(ans)


Measured memory_bytes: 38256
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>

// type alias
using lint = long long;
using ldouble = long double;
template <class T>
using greater_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T>>;


/* ----- class ----- */

template <class Cost = int>
struct Edge {
    int src, dst;
    Cost cost;
    Edge(int src = -1, int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = int>
using Edges = std::vector<Edge<Cost>>;

template <class Cost = int>
using Graph = std::vector<std::vector<Edge<Cost>>>;


/* ----- debug ----- */

#if __has_include("../setting/source/debug.hpp")
#include "../setting/source/debug.hpp"
#endif


/* ----- short functions ----- */

template <class T>
inline T sq(T a) { return a * a; }

template <class T>
inline T iceil(T n, T d) { return (n + d - 1) / d; }

template <class T>
T gcd(T a, T b) {
    while (b > 0) {
        a %= b;
        std::swap(a, b);
    }
    return a;
}

template <class T, class U>
T ipow(T b, U n) {
    T ret = 1;
    while (n > 0) {
        if (n & 1) ret *= b;
        n >>= 1;
        b *= b;
    }
    return ret;
}

// 0-indexed
template <class T, class U>
inline T kthbit(T a, U k) { return (a >> k) & 1; }

template <class T, class U>
inline T mask(T a, U k) { return a & ((1 << k) - 1); }

template <class T>
std::map<T, int> compress(std::vector<T>& v) {
    std::sort(v.begin(), v.end());
    v.erase(std::unique(v.begin(), v.end()), v.end());

    std::map<T, int> rev;
    for (int i = 0; i < v.size(); ++i) rev[v[i]] = i;
    return rev;
}

template <class T>
T Vec(T v) { return v; }

template <class T, class... Ts>
auto Vec(size_t l, Ts... ts) {
    return std::vector<decltype(Vec<T>(ts...))>(l, Vec<T>(ts...));
}


/* ----- constants ----- */

// const int INF = std::numeric_limits<int>::max() / 3;
// const lint INF = std::numeric_limits<lint>::max() / 3;
// const ldouble PI = acos(-1);
// const ldouble EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));


using namespace std;

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

    map<string, lint> cnt;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());

        if (!cnt.count(s)) cnt[s] = 0;
        ++cnt[s];
    }

    lint ans = 0;
    for (auto p : cnt) {
        lint k = p.second;
        ans += k * (k - 1) / 2;
    }

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


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

#define ll long long

typedef pair< int, int > ii;
typedef vector< ii > vii;

void solve(){
	ll n, m; cin>>n>>m;
	if(n == 1 || m == 1){
		cout<<1<<endl;
		return;
	}	
	cout<<(n * m + 1) / 2<<endl;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	solve();
	return 0;
}



Measured memory_bytes: 3620
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

const long long MAXN = 1e6 + 1;
using namespace std;

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


long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int kek[MAXN];
vector <int> g[MAXN];

int p[MAXN];
int deg[MAXN];

set<pair <int, int> > s;

void dfs(int v, int par) {
    p[v] = par;
    deg[v] = deg[par] + 1;
    s.insert({-deg[v], v});
    for (int i : g[v]) {
        if (g[i].size() == 1) {
            kek[v] ++;
        }
        if (i == par) continue;
        dfs(i, v);
    }
}

int used[MAXN];
main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    for (int i = 1; i < n; i++) {
        int v = readInt(), u = readInt();
        g[v].pb(u);
        g[u].pb(v);
    }
    dfs(1, 0);
    for (int i = 1; i <= n; i++) {
        if (kek[i] >= 2) {
            cout << "First";
            return 0;
        }
    }
    for (;!s.empty();) {
        pair <int, int> tmp = *s.begin();
        s.erase(s.begin());
        if (used[tmp.S]) continue;
        if (p[tmp.S] == 0 || used[p[tmp.S]]) {
            cout << "First";
            return 0;
        }
        int parent = p[tmp.S];
        used[tmp.S] = used[parent] = 1;
    }
    cout << "Second";
    return 0;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,m;
    cin >> n >> m;
    Yes(n == m);
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	int n;
	cin>>n;
	int ans=1000-n%1000;

	if(ans!=1000)cout<<ans<<endl;
	else cout<<0<<endl;

	return 0;
}


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

int main() {
    int x,y,z,k;
    cin >> x >> y >> z >> k;

    vector<ll> a(x),b(y),c(z);
    for (int i = 0; i < x; i++) cin >> a[i];
    for (int i = 0; i < y; i++) cin >> b[i];
    for (int i = 0; i < z; i++) cin >> c[i];

    vector<ll> ab;

    for (int i = 0; i < x; i++) {
        for (int j = 0; j < y; j++) {
            ab.push_back(a[i] + b[j]);
        }
    }

    sort(ab.rbegin(),ab.rend());
    sort(c.rbegin(),c.rend());

    vector<ll> ans;
    for (int i = 0; i < min(k, (int)ab.size()); i++) {
        for (int j = 0; j < min(k, (int)c.size()); j++) {
            ans.push_back(ab[i] + c[j]);
        }
    }
    sort(ans.rbegin(),ans.rend());
    for (int i = 0; i < k; i++) cout << ans[i] << '\n';
}

Measured memory_bytes: 43368
n = int(input())
a = []
b = []
for i in range(n):
    x, y = list(map(int, input().split()))
    a.append(x)
    b.append(y)
a_s = sorted(a)
b_s = sorted(b)
if n%2==0:
    min_05 = (a_s[n//2] + a_s[n//2-1])%2
    max_05 = (b_s[n//2] + b_s[n//2-1])%2
    m_min = (a_s[n//2] + a_s[n//2-1])//2
    m_max = (b_s[n//2] + b_s[n//2-1])//2
    c = (m_max-m_min)*2+1
    if max_05:
        c += 1
    if min_05:
        c -= 1
    print(c)
else:
    m_min = a_s[n//2]
    m_max = b_s[n//2]
    print(m_max-m_min+1)

Measured memory_bytes: 102864
#include<stdio.h>
#include<stdlib.h>
#define MAX 100005
#define NIL -1
 
struct Node
{
  int p,l,r;
};
 
struct Node T[MAX];
int n,D[MAX];
 
void print(int v)
{
  int i,c;
  printf("node %d: ",v);
  printf("parent = %d, ",T[v].p);
  printf("depth = %d, ",D[v]);
 
  if( T[v].p == NIL )
    printf("root, ");
  else if( T[v].l == NIL )
    printf("leaf, ");
  else
    printf("internal node, ");
 
  printf("["); 
  for( i = 0, c = T[v].l;c != NIL; i++, c = T[c].r)
    {
      if(i) printf(", ");
      printf("%d",c);
    }
  printf("]\n");
}
 
void rec(int v, int p)
{
  D[v]=p;
  if( T[v].r != NIL)
    rec(T[v].r,p);
  if( T[v].l != NIL )
    rec(T[v].l,p+1);
}
 
 
int main()
{
  int i,j,d,v,c,l,r,n;
 
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      T[i].p=T[i].l=T[i].r=NIL;
    }
 
  for( i = 0; i < n; i++ )
    {
      scanf("%d",&v);
      scanf("%d",&d);
      for( j = 0; j < d; j++ )
	{
	  scanf("%d",&c);
	  if(j==0)T[v].l=c;
	  else T[l].r=c;
	  l=c;
	  T[c].p=v;
	}
    }
  for( i = 0; i < n; i++ )
    {
      if( T[i].p == NIL )
	r=i;
    }
  rec(r,0);
  for( i = 0; i < n; i++ ) 
    print(i);
 
  return 0;
}



Measured memory_bytes: 6404
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define endl '\n'
const int mod=1e9+7,u=1e5+5;

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

    string s,t;
    cin>>s>>t;
    int n=s.size(),m=t.size();

    int dp[n+1][m+1];
    for(int i=0;i<=n;i++){
        dp[i][0]=0;
    }   
    for(int i=0;i<=m;i++){
        dp[0][i]=0;
    }

    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i-1]==t[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }

    int x=n,y=m;
    string ans;
    while(x>0 and y>0){
        if(s[x-1]==t[y-1]){
            ans+=s[x-1];
            x--;
            y--;
        }
        else if(dp[x][y]==dp[x-1][y]){
            x--;
        }
        else{
            y--;
        }
    }
    reverse(all(ans));
    cout<<ans;

    return 0;
}

Measured memory_bytes: 70656
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;


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

        int N = sc.nextInt();
        long[] f = new long[N+1];
        Arrays.fill(f, 0);

        for(long x=1; x<=100; x++) for(long y=1; y<=100; y++) for(long z=1; z<=100; z++){
            long n = x*x + y*y + z*z + x*y + y*z + z*x;
            if(n <= N) f[(int)n]++;
        }
        for(int n=1; n<=N; n++) System.out.println(f[n]);
        
    }
}


Measured memory_bytes: 38924
#include <stdio.h>

int main(void) {
    char line[256];
    int h, w, k;
    char c[6][6];

    fgets(line, 256, stdin);
    sscanf(line, "%d %d %d", &h, &w, &k);
    for (int i = 0; i < h; i++) {
        fgets(line, 256, stdin);
        sscanf(line, "%s", &c[i]);
    }

    int ans = 0;
    for (int maskR = 0; maskR < (1 << h); maskR++) {
        for (int maskC = 0; maskC < (1 << w); maskC++) {
            int black = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (((maskR >> i) & 1) == 0 && ((maskC >> j) & 1) == 0 && c[i][j] == '#') black++;
                }
            }
            if (black == k) ans++;
        }
    }

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

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

constexpr int MAX_N = 2000;

#define USE_DIVISOR
#ifdef USE_DIVISOR
constexpr int DIVISOR = 1e9 + 7;
#endif

vector<vector<long long>> combination_vec(MAX_N + 1, vector<long long>(MAX_N + 1, 0));
void init_combination() {
  for (int n = 0; n < combination_vec.size(); ++n) {
    combination_vec[n][0] = 1;
    combination_vec[n][n] = 1;
  }
  for (int n = 1; n < combination_vec.size(); ++n) {
    for (int r = 1; r < n; r++) {
      combination_vec[n][r] = (combination_vec[n - 1][r - 1] + combination_vec[n - 1][r]);
#ifdef USE_DIVISOR
      combination_vec[n][r] %= DIVISOR;
#endif
    }
  }
}

template<typename T>
T combination(T n, T r) {
  return combination_vec[n][r];
}

int main() {
  init_combination();

  long long N, K;
  cin >> N >> K;
  long long S{N - K};

  for (long long i{1}; i <= K; ++i) {
    long long ans = combination(S + 1, i);
    ans *= combination(K - 1, i - 1);
    cout << ans % DIVISOR << endl;
  }
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
const ll mod = 1e9+7;

int main(){
    ll S;
    cin >> S;
    vector<ll> A(S+1);
    A[0] = 1;
    for(int i=1; i<=S; i++) {
        for(int j=0; j<=i-3; j++) {
            A[i] += A[j];
            A[i] %= mod;
        }
    }
    cout << A[S] << endl;
}

Measured memory_bytes: 3564
ass = [ i for i in range(5)]
for i in range(5):
  ass[i] = int(input())

k = int(input())

flag = True
for i in range(5):
  for j in range(i+1, 5):
    dist = ass[j] - ass[i]
    if dist > k:
      flag = False
      
if flag:
  print('Yay!')
else:
  print(':(')

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;

int main() {
    const int INF = 10e+7;

    vector<pair<int,int>> v; // (g, yen)
    v.push_back(make_pair(2, 380));
    v.push_back(make_pair(3, 550));
    v.push_back(make_pair(5, 850));
    v.push_back(make_pair(2*5, 380*5*80/100));
    v.push_back(make_pair(3*4, 550*4*85/100));
    v.push_back(make_pair(5*3, 850*3*88/100));

    int dp[501];
    for (int i=0; i<=500; ++i) dp[i] = INF;
    dp[0] = 0;
    for (int i=0; i<(int)v.size(); ++i) {
        for (int j=0; j<=500; ++j) {
            int k = j + v[i].first;
            if (dp[j] != INF && k <= 500) {
                dp[k] = min(dp[k], dp[j] + v[i].second);
            }
        }
    }

    int n;
    while (cin >> n && n != 0) {
        cout << dp[n / 100] << endl;
    }

    return 0;
}

Measured memory_bytes: 1192
from decimal import Decimal

x = int(input())
now = 0
while True:
    tmp = now ** 5
    need = abs(tmp - x)
    sqrt = Decimal(str(need)) ** Decimal("0.2")
    if sqrt % 1 == 0:
        if tmp - x > 0:
            print(now, int(sqrt))
        else:
            print(now, int(sqrt) * -1)
        break
    now += 1


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

int main()
{
    char c;
    cin >> c;

    string vowel = "aiueo";

    if (vowel.find(c) == string::npos)
    {
        cout << "consonant" << endl;
    }
    else
    {
        cout << "vowel" << endl;
    }
}


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

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define each(i,mp) for(auto& i:mp)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const lb pi=acos(-1);
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll n;cin>>n;
  ll a[n];rep(i,0,n)cin>>a[i];

  map<ll,ll>mp;
  rep(i,0,n){
    mp[a[i]]++;
  }
  map<ll,bool>hv;
  ll MAX = 1000010;
  vector<bool>v(MAX,true);
  rep(i,0,n){
    if(!hv[a[i]]){
      for(ll j=2;a[i]*j<MAX;j++){
        v[a[i]*j]=false;
        // out(a[i]<<":"<<a[i]*i);
      }
      hv[a[i]]=true;
    }
  }

  ll ans=0;
  rep(i,0,n){
    // out(a[i]<<":"<<v[a[i]]);
    if(mp[a[i]]==1&&v[a[i]])ans++;
  }

  out(ans);

  // // エラトステネスのふるい

  // vector<int> is_prime(MAX, 1);
  // is_prime[0] = 0, is_prime[1] = 0;
  // for (int i = 2; i < MAX; ++i) {
  //     if (!is_prime[i]) continue;
  //     for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
  // }


  // rep(i,0,n){
  //   ll k=a[i];
  //   if(!hv[k]&&mp[k]<=1){
  //     bool e=true;
  //       for(int i=1;i*i<=k;i++){
  //         if(k%i==0){
  //           if(k/i==k){
  //             if(mp[k/i]-1>=1){
  //               e=false;
  //               break;
  //             }
  //           }else{
  //             if(mp[k/i]>=1){
  //               e=false;
  //               break;
  //             }
  //           }

  //           if(i==k){
  //             if(mp[i]-1>=1){
  //               e=false;
  //               break;
  //             }
  //           }else{
  //             if(mp[i]>=1){
  //               e=false;
  //               break;
  //             }
  //           }

  //         }
  //       }
  //     if(e)ans++;
  //     else{
  //       hv[k]=true;
  //     }
  //   }
  // }

  // out(ans);

  return 0;
}


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

using namespace std;

constexpr int INF = 1e8;
constexpr int MAX_N = 1e5;
int a, b, c;

void input()
{
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
}

void solve()
{
   if ((a + b > c && a + c > b && b + c > a)
      && (a > 0 && b > 0 && c > 0)) {
    if (a == b && b == c) {
      printf("Yes");
      return;
    }
    else
    {
      goto NO;
    }
  }

  NO:
    printf("No");
}

int main()
{
  input();
  solve();

  return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll r;
    cin >> r;

    cout << r*r << endl;
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int dp1[N],dp2[N];
char s[N];
int main()
{
    //ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int n;
    scanf("%d%s",&n,s+1);
    for(int i=1;i<=n;i++)
        dp1[i]=dp1[i-1]+(s[i]=='W');
    for(int i=n;i>0;i--)
        dp2[i]=dp2[i+1]+(s[i]=='E');
    int ans=n;
    for(int i=0;i<=n;i++)
        ans=min(dp1[i]+dp2[i+1],ans);
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq  priority_queue<double, std::vector<double>, std::greater<double>>

int lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

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



//20:10
int main(){
    int N,X;
    cin >> N >> X;
    vector<int> L(N);
    int ans = 1;
    int dis = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> L[i];
        dis += L[i];
        if(dis <=X){
            ans++;
        }
        else{
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>

using namespace std;

int main(){
	int m[5];
	int t;
	for(int i=0;i<5;i++) scanf("%d",&m[i]);
	if(m[0]<0){
		t=m[2]*((-1)*(m[0]))+m[3]+(m[4]*m[1]);
	}
	else if(m[0]==0){
		t=m[3]+(m[4]*m[1]);
	}
	else{
		t=(m[1]-m[0])*m[4];
	}
	printf("%d\n",t);
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Apr 19 21:01:53 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    std::vector<Int> ans(n);
    REP(i, n - 1) {
        Int x;
        std::cin >> x;
        ans[x - 1]++;
    }
    for (Int x : ans) std::cout << x << "\n";
}


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

const int DMAX = 1e5 + 10;

int n, a, b;

vector <int> V[DMAX];

int distA[DMAX];
int distB[DMAX];

void dfs(int node, int father, int dist[]);

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

    int i,x,y;

    cin >> n >> a >> b;

    for (i = 1; i < n; i++) {
        cin >> x >> y;
        V[x].push_back(y);
        V[y].push_back(x);
    }

    dfs(a, 0, distA);
    dfs(b, 0, distB);

    int best = 0;
    for (i = 1; i <= n; i++)
        if (distA[i] <= distB[i])
            best = max(best, distB[i]);

    cout << best - 2 << '\n';
    return 0;
}
void dfs(int node, int father, int dist[]){
    dist[node] = dist[father] + 1;
    for (auto& nghb : V[node])
        if (nghb != father)
            dfs(nghb, node, dist);
}


Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   int r,g,b,n;
   cin>>r>>g>>b>>n;
   int res=0;
   for(int i=0;i<=n/r;i++)
   {
      for(int j=0;j<=n/g;j++)
      {
            int rem=n-i*r-j*g;
            if(rem%b==0&&rem>=0)
              res++;
      }
   }
   cout<<res<<endl;
   return 0;
}

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;

int main(){
	//~ double Min=LLONG_MAX;
	//~ vector<int>v;
	//~ for(int i=111111111;i>=1;i--){
		//~ int a=i,c=0;
		//~ while(a)c+=a%10,a/=10;
		//~ double d=i/(double)c;
		//~ if(i<=100000000){
			//~ if(d<=Min)v.push_back(i);
		//~ }
		//~ Min=min(Min,d);
	//~ }
	//~ reverse(v.begin(),v.end());
	//~ for(int i:v){
		//~ cout<<i<<endl;
	//~ }
	vector<ll>v;
	for(int i=1;i<=9999;i++)v.push_back(i);
	for(int i=5;i<=16;i++){//桁数
		for(int j=10000;j<=99999;j++){
			ll d=j+1;rep(k,i-5)d*=10;d--;
			v.push_back(d);
		}
	}
	vector<ll>ans;
	double Min=LLONG_MAX;
	for(int i=v.size()-1;i>=0;i--){
		ll a=v[i],c=0;
		while(a)c+=a%10,a/=10;
		double d=v[i]/(double)c;
		if(d<=Min){
			ans.push_back(v[i]);
		}
		Min=min(Min,d);
	}
	reverse(ans.begin(),ans.end());
	int k;scanf("%d",&k);
	rep(i,k){
		cout<<ans[i]<<endl;
	}
}

Measured memory_bytes: 18152
program donot_be_late
    implicit none
    integer d, t, s
    real ans, a, b

    read *, d, t, s

    a=real(d)
    b=real(s)
    ans=a/b
    if(t>=ans)then
        print *,"Yes"
    else
        print *,"No"
    endif
end program donot_be_late

Measured memory_bytes: 2788
import itertools

dests = set()
for i in range(3):
    a, b = map(int, input().split())
    dests.add((a, b))
    dests.add((b, a))

for routes in itertools.permutations(dests, 3):
    routes = list(routes)
    visited = {
        1: False,
        2: False,
        3: False,
        4: False,
    }
    last = None
    ok = True
    for route in routes:
        a, b = route
        if last is not None and last != a:
            ok = False
            break
        else:
            visited[a] = True
            visited[b] = True
            last = b
    if ok and False not in visited.values():
        print('YES')
        exit()

print('NO')
exit()


Measured memory_bytes: 3064