akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
 
using namespace std;

const int MAX_N = 100001;

// 対象のノード番号の要素にそれに隣接するノード名とその距離のペアが入る
vector<std::pair<int, int>> vm[MAX_N];
int ans[MAX_N];

// 第1引数に対象ノード番号を入れる
// 第2引数はすでにチェックした番号を示す
void DFS(int target, int checked){
  for(int i=0; i < vm[target].size(); ++i){
    int nn = vm[target][i].first;  // 隣接ノード番号を格納
    if(nn == checked) continue;  //チェックしたものの場合は飛ばす
    
    if(vm[target][i].second % 2) {
      // 2で割り切れない場合、白黒を入れ替える
      if(ans[target]) ans[nn] = 0;
      else ans[nn] = 1;
    }else{
      ans[nn] = ans[target];
    }
    DFS(nn, target);
  }
}

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

  int u, v, w;
  for(int i=0; i<n-1; ++i){
    cin >> u >> v >> w;
    vm[u].push_back(std::make_pair(v,w));
    vm[v].push_back(std::make_pair(u,w));
  }
 
  DFS(1, 1);

  for(int i=1; i<=n; ++i){
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 9088
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

Int Max(const Int a, const Int b) {
    if (a >= b) {
        return a;
    } else {
        return b;
    }
}

int main(void) {
    Int a, b;
    cin >> a >> b;
    if (a <= 9 && b <= 9) {
        cout << a * b << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

int main(){
    string s;
    cin >> s;

    int a, b;
    a = b= -2;
    for(int i=0; i<s.length()-1; i++){
        if(s[i] == s[i+1]){
            a = i;
            b = i+1;
        }

        if(s[i] == s[i+2] && i+2<=s.length()-1){
            a = i;
            b = i+2;
        }
    }

    cout << a+1 << " " << b+1 << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define dd second
#define ff first
#define N 200005
#define pb push_back
#define pp pair<int,int>
using namespace std;

int n;
int tab[N];

int tab2[N];

main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> tab[i], tab2[i] = tab[i];

    sort(tab2, tab2+n);

    for(int i = 0; i < n; ++i) {
        int val = tab[i];
        int index = lower_bound(tab2, tab2+n, val)- tab2;
        int k = (n-1)/2;
        if(k < index) {
            cout << tab2[k] << " ";
        } else {
            cout << tab2[k+1] << " ";
        }
    }
    cout << endl;

}

Measured memory_bytes: 5376
from collections import defaultdict
N = int(input())
d = defaultdict(int)
for i in range(1, N+1):
    s = str(i)
    d[(s[0], s[-1])] += 1
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += d[(str(i), str(j))]*d[(str(j), str(i))]
print(ans)

Measured memory_bytes: 9456
fun main() {
  val cmp = compareBy<Pair<Int, Int>> { it.first }.thenBy { it.second }
  val mx = sortedSetOf<Pair<Int, Int>>(cmp)
  val my = sortedSetOf<Pair<Int, Int>>(cmp)
  val (n, q) = readLine()!!.split(" ").map { it.toInt() }
  var m = (n - 2L) * (n - 2L)
  repeat(q) {
    val (t, x) = readLine()!!.split(" ").map { it.toInt() }
    val p = if (t == 1) my.higher(x to 0) else mx.higher(x to 0)
    val h = p?.let { it.second } ?: n
    m -= h - 2
    if (t == 1) mx.add(h to x) else my.add(h to x)
  }
  println(m)
}

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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

typedef long long ll;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("E.in", "r", stdin);
	freopen ("E.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3;

int n, a[N], p[N]; ll ans[N];

int main() {

	File();

	n = read();
	For (i, 1, n) a[p[i] = i] = read();

	stable_sort(p + 1, p + n + 1, [&](int x, int y) { return a[x] > a[y]; });

	int now = p[1];
	For (i, 1, n) {
		chkmin(now, p[i]);
		ans[now] += 1ll * (a[p[i]] - a[p[i + 1]]) * i;
	}
	For (i, 1, n)
		printf ("%lld\n", ans[i]);

	return 0;

}

Measured memory_bytes: 2620
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/5/DPL_5_B"
// #include "../../math/combination.hpp"
// #include "../../math/modint.hpp"
#include <iostream>
constexpr const int MOD = (int)1e9 + 7;
#ifndef _MODINT_H_
#define _MODINT_H_
#include <iostream>
#include <assert.h>

template<int Mod>
struct ModInt {
    int v;
    ModInt(): v(0){}
    template<typename T>
    explicit ModInt(T t) {
        v = t % Mod;
        if (v < 0) v += Mod;
    }

    ModInt pow(int k) {
        ModInt res(1), x(v);
        while(k) {
            if (k % 2 == 1) res *= x;
            x *= x;
            k >>= 1;
        }
        return res;
    }

    template<typename T>
    ModInt& operator=(T a) { v = a % Mod; if (v < 0) v += Mod; return *this; }
    ModInt inv() { return pow(Mod - 2); }
    ModInt& operator+=(ModInt a) { v += a.v; if (v >= Mod) v -= Mod; return *this; }
    ModInt& operator-=(ModInt a) { v += Mod - a.v; if (v >= Mod) v -= Mod; return *this; }
    ModInt& operator*=(ModInt a) { v = 1LL * v * a.v % Mod; return *this; }
    ModInt& operator/=(ModInt a) { assert(a.v != 0); return (*this) *= a.inv(); }
    ModInt operator+(ModInt a) const { return ModInt(v) += a; }
    ModInt operator-(ModInt a) const { return ModInt(v) -= a; }
    ModInt operator*(ModInt a) const { return ModInt(v) *= a; }
    ModInt operator/(ModInt a) const { return ModInt(v) /= a; }
    ModInt operator-() { return ModInt(-v); }
    bool operator==(const ModInt a) const { return v == a.v; }
    bool operator!=(const ModInt a) const { return v != a.v; }
    bool operator<(const ModInt a) const { return v < a.v; }

    friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.v; }
    friend std::istream &operator>>(std::istream &is, ModInt &a) {
        int val;
        is >> val;
        a = ModInt(val);
        return is;
    }
};

#endif // #ifndef _MODINT_H_
#include <vector>

template <typename T>
// template typename `T` is supposed to be ModInt.
class Combination {
    std::vector<T> fac, finv;

public:
    explicit Combination(int size)
        : fac(size + 1)
        , finv(size + 1)
    {
        fac[0] = 1;
        finv[0] = 1;
        for (int i = 0; i < size; i++) {
            fac[i + 1] = fac[i] * T(i + 1);
            finv[i + 1] = finv[i] * T(i + 1).inv();
        }
    }

    T C(int n, int r) const
    {
        if (r < 0 || n < r)
            return T(0);
        return fac[n] * finv[r] * finv[n - r];
    }

    T P(int n, int r) const
    {
        if (r < 0 || n < r)
            return T(0);
        return fac[n] * finv[n - r];
    }

    T H(int n, int r) const
    {
        if (r < 0 || n < r)
            return T(0);
        return C(n + r - 1, r);
    }
};

int main()
{
    int n, k;
    std::cin >> n >> k;
    Combination<ModInt<MOD>> com(1000);
    auto ans = com.P(k, n);
    std::cout << ans << std::endl;
}



Measured memory_bytes: 3116
def main():
    s = input()
    is_prev_atgc = False
    now = 0
    maximum = 0
    target = ("A", "T", "G", "C")
    for char in s:
        if char in target:
            is_prev_atgc = True
            now += 1
            if maximum < now:
                maximum = now
        else:
            is_prev_atgc = False
            now = 0
    print(maximum)
if __name__ == "__main__":
    main()

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

template<typename T>T gcd(T a,T b){while(1){swap(a,b);if(a==0)return b;if(b==0)return a;a%=b;}}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}

int main(){

  ll a,b;
  cin>>a>>b;
  cout<<(lcm(a,b))<<endl;

}

Measured memory_bytes: 256
S = input()

alphabets = set(chr(ord('a')+x) for x in range(26))

bl1 = (S[0] == 'A')
bl2 = (S[2:-1].count('C') == 1)
bl3 = (set(S) - set('AC') <= alphabets)

answer = 'AC' if bl1 and bl2 and bl3 else 'WA'
print(answer)

Measured memory_bytes: 3060
import sys

if __name__ == "__main__":
    X, Y = map(int, (input().split(' ')))
    max = X
    min = Y
    if X < Y:
        print(X)
        sys.exit()
#        max = Y
#        min = X
    if max % min == 0:
        print(-1)
        sys.exit()
    sho = (pow(10, 18) // X)  + 1
    for i in range(1, sho):
        num = X * i
        if (num % Y != 0):
            print(num)
            sys.exit()
    print(-1)

Measured memory_bytes: 3064
#カードの枚数N
N = int(input())

#カードに書かれる数a
a = list(map(int, input().split()))
a = sorted(a, reverse = True)

#print(N)
#print(a)

Alice = 0
Bob = 0

#ターン数x
x = 0

#pop(n) ➡　配列のn番目の要素を抜き取る
while not(len(a) == 0):
    if x%2 == 0:
        Alice += a.pop(0)

        #print(Alice)
        x += 1
        #a = [:a(max)]

    else:
        Bob += a.pop(0)
        #print(Bob)
        x += 1

print(Alice - Bob)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = a; i < b; ++i)
#define ll long long
#define M 100000007
#define fr first
#define sc second
#define endl "\n"
#define vc vector
#define pb push_back
#define pii pair<ll, ll>
#define psi pair<string, ll>
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define PI 3.14159265
#define r0 return 0
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
const char char_max = (char)(((unsigned char) char(-1)) / 2);

int main() {
  fast
    ll n,sum=0;
    cin>>n;
    rep(i,1,n+1){
        if(i%3!=0&&i%5!=0) sum+=i;
    }
    cout<<sum;
}



Measured memory_bytes: 3644
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W;
	int h, w;

	cin >> H >> W;
	cin >> h >> w;
	cout << (H - h)*(W - w) << endl;
}

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

int main() {
  string a, b;
  cin >> a >> b;
  if((a=="H" && b=="H") || (a=="D" && b=="D")) cout << "H" << endl;
  else cout << "D" << endl;
  return 0;
}


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


ll findpow(ll a,ll b){
    ll cnt=0,i,j;
    while(a>1){
        a=a/b;
        cnt++;
    }
    return cnt;
}


int main(){
    ll i,j,k,sum=0,n,sum1=0,t,ans=1000000000,p,max1=0,l=0,m,b,c;
   // string c;
    cin>>n;
    ll a[n];
    map <ll,ll> mp;
    set <ll> st;
    for(i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]++;
        st.insert(a[i]);
    }
    for(auto itr=st.begin();itr!=st.end();itr++){
        sum+=(mp[*itr])*(mp[*itr]-1)/2;
    }
 //   cout<<sum<<endl;
    for(i=0;i<n;i++){
        k=mp[a[i]];
        sum1=sum-k*(k-1)/2;
        sum1+=(k-2)*(k-1)/2;
        cout<<sum1<<endl;
    }
    
    
    
    
    
   
   
   
    
    
	return 0;
}

Measured memory_bytes: 17024
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, 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")
    };
}

fn solve(n: usize, a: Vec<Vec<u32>>) -> u32 {
  let mut a_sums = a[0].clone();
  for i in 1..a_sums.len() {
    a_sums[i] += a_sums[i - 1];
  }
  let mut dp = vec![0; n];

  dp[0] = a[0][0] + a[1][0];
  for x in 1..n {
    dp[x] = std::cmp::max(a_sums[x], dp[x - 1]) + a[1][x];
  }

  *dp.last().unwrap()
}

fn main() {
  input! {
    n: usize,
    a: [[u32; n]; 2]
  };

  println!("{0}", solve(n, a));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

ll n,k;
ll ans=1;
vec al(1e5+10,-1);
vector<set<ll>> E(1e5+10);

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

//階乗,factで初期化
vector<ll> tfact(1e7+1);
void fact(ll n) {
  for(ll i=0;i<=n;i++) {
    if(i==0) {
      tfact[i]=1;
    }
    else {
      tfact[i]=tfact[i-1]*i%mod;
    }
  }
}

//nCk 繰り返し高速
ll comb(ll n, ll k) {
  return tfact.at(n)*mpow(tfact.at(k),mod-2)%mod*mpow(tfact.at(n-k),mod-2)%mod;
}

//nPk
ll perm(ll n,ll k) {
  return tfact.at(n)*mpow(tfact.at(n-k),mod-2)%mod;
}

void dfs(ll f) {
  ll count=0;
  for(ll t:E[f]) {
    if(al[t]<0) {
      al[t]=0;
      dfs(t);
      count++;
    }
  }
  if(f!=0) {
    if(k-2>0&&k-2>=count) {
      ans=ans*perm(k-2,count)%mod;
    }
    else {
      ans=0;
    }
  }
  else {
    if(k-1>0&&k-1>=count) {
      ans=ans*perm(k-1,count)%mod;
    }
    else {
      ans=0;
    }
  }
}
 
int main() {
  cin >> n >> k;
  if(k==1) {
    if(n==1) {
      cout << 1 << endl;
    }
    else {
      cout << 0 << endl;
    }
    return 0;
  }
  if(k==2) {
    if(n<=2) {
      cout << 2 << endl;
    }
    else {
      cout << 0 << endl;
    }
    return 0;
  }
  fact(k);
  for(ll i=0;i<n-1;i++) {
    ll a,b;
    cin >> a >> b;
    a--;
    b--;
    E[a].insert(b);
    E[b].insert(a);
  }
  al[0]=0;
  ans=k;
  dfs(0);
  cout << ans << endl;
}

Measured memory_bytes: 96768
#include <stdio.h>

char S[5];

int check[5];

int main() {

	scanf("%s",S);

	int i;

	for(i=0;i<3;i++){
	check[S[i]-'a']++;
	}

	if(check[0]==1&&check[1]==1&&check[2]==1){
	printf("Yes\n");
	}
	else{
	printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int k = Integer.parseInt(sc.next());
		
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		
		for(int i = 0 ; i <= 1000 ;i++) {
			if(k* i >= a && k*i <= b) {
				System.out.println("OK");
				return;
			}
		}
		System.out.println("NG");

	}

}


Measured memory_bytes: 35672
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const double pi=3.1415926536;
#define fo(i,n) for( ll int i=0;i<n;++i)
#define fos(j,i,n) for(ll int j=i;j<n;++j)
#define nax 100004
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define abs(x) ((x)<0?(-(x)):(x))
#define dis(k) cout << k << endl
#define forr(i,n) for( ll int i= n-1;i>=0;--i)
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ve vector
#define fi first
#define se second
#define setzero(a) memset(a,0,sizeof(a))
#define setinf(a) memset(a,0x7F,sizeof(a))
typedef ve< ll > vi;
typedef ve< vi > vvi;
typedef pair< ll ,ll > ii;


//weird debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
		sim > struct rge { c b, e; };
		sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
		sim > auto dud(c* x) -> decltype(cerr << *x, 0);
		sim > char dud(...);
		struct debug {
#ifdef LOCAL
			~debug() { cerr << endl; }
			eni(!=) cerr << boolalpha << i; ris; }
		eni(==) ris << range(begin(i), end(i)); }
		sim, class b dor(pair < b, c > d) {
			ris << "(" << d.first << ", " << d.second << ")";
		}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


/*Don't just sit and hope that God will solve this
  fucking do something, try to observe or solve it a different way.
  Use that pen and paper.
  If nothing works take a deep breath and start again.*/
vi adj[nax];
bool vis[nax];
ll indeg[nax];
ll dis[nax];

void dfs(ll x){
	vis[x]=1;
	for(auto y : adj[x]){
		dis[y]=max(dis[y],dis[x]+1);
		indeg[y]--;
		if(!indeg[y] && !vis[y]) dfs(y);
	}
}

void solve(){
	ll n,m;
	cin >> n >> m;
	while(m--){
		ll a,b;
		cin >> a >> b;
		adj[a].pb(b);
		indeg[b]++;
	}
	fo(i,nax)
		if(!vis[i] && !indeg[i]) dfs(i);
	ll ans=0;
	fo(i,nax) ans=max(ans,dis[i]);
	dis(ans);
}

int main(){
	fast;
	int t=1;
	int tt=1;
	//cin >> t;

	while(t--){
		//cout << "Case #" << tt << ": " ;
		tt++;
		solve();
	}
	return 0;
}



Measured memory_bytes: 16832
#include <stdio.h>

int main(){
  int a, b;
  scanf("%d %d", &a, &b);

  if(a < b){
        printf("a < b\n");
  }else if(a > b){
        printf("a > b\n");
  }else{
        printf("a == b\n");
  }


  return 0;
}


Measured memory_bytes: 2044
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

//#define int ll

int n,k;
int x[55],y[55];
int xary[55],yary[55];

signed main(){
    cin>>n>>k;
    rep(i,0,n){
        cin>>x[i]>>y[i];
        xary[i]=x[i];
        yary[i]=y[i];
    }
    
    sort(xary,xary+n);
    sort(yary,yary+n);
    
    ll ans=maxLL;
    
    rep(xi,0,n)rep(xj,xi+1,n){
        rep(yi,0,n)rep(yj,yi+1,n){
            int num=0;
            ll lx=xary[xi],rx=xary[xj];
            ll by=yary[yi],uy=yary[yj];
            rep(i,0,n){
                if(lx<=x[i] && x[i]<=rx && by<=y[i] && y[i]<=uy)num++;
            }
            if(num>=k)ans=min(ans,(rx-lx)*(uy-by));
        }
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n, k, q int
	fmt.Fscan(read, &n, &k, &q)

	score := make([]int, n)
	for i := 0; i < n; i++ {
		score[i] = 0
	}
	for i := 0; i < q; i++ {
		var a int
		fmt.Fscan(read, &a)
		score[a-1]++
	}
	for i := 0; i < n; i++ {
		if k-(q-score[i]) > 0 {
			fmt.Fprintln(write, "Yes")
		} else {
			fmt.Fprintln(write, "No")
		}
	}

}


Measured memory_bytes: 5120
#include <stdio.h>

int main(void) {
	char S[1024];
	int a, b, c, d;
	while (scanf("%s", S) == 1 && S[0] != '#') {
		int W = -1, H = -1;
		char board[16][16] = {{0}};
		int i, x = 0, y = 0;
		int count;
		if (scanf("%d%d%d%d", &a, &b, &c, &d) != 4) return 1;
		/* decode */
		for (i = 0; S[i] != '\0'; i++) {
			if (S[i] == 'b') {
				board[y][x++] = 'b';
			} else if (S[i] == '/') {
				if (W < 0) W = x;
				y++;
				x = 0;
			} else {
				x += S[i] - '0';
			}
		}
		/* move */
		H = y + 1;
		board[a - 1][b - 1] = 0;
		board[c - 1][d - 1] = 'b';
		/* encode */
		for (y = 0; y < H; y++) {
			count = 0;
			for (x = 0; x < W; x++) {
				if (board[y][x] == 'b') {
					if (count > 0) printf("%d", count);
					putchar('b');
					count = 0;
				} else {
					count++;
				}
			}
			if (count > 0) printf("%d", count);
			putchar(y + 1 < H ? '/' : '\n');
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){
  int n;
  int a[10000];
  a[0]=2;
  a[1]=1;
  cin >> n;
  iFOR(i,2,n+1)
    a[i]=a[i-1]+a[i-2];
  cout <<a[n] fin;
  
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
from collections import deque
from enum import Enum
import sys
import math
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
class Process:
    def __init__(self,arg_name,arg_value):
        self.name = arg_name
        self.value = arg_value
        self.finish_time = BIG_NUM
 
Q = deque()
 
N,LIMIT = map(int,input().split())
 
#プロセスの取得
for loop in range(N):
    input_str = list(map(str,input().split()))
    tmp_Process = Process(input_str[0],int(input_str[1]))
    Q.append((tmp_Process))   #末尾に追加
 
num_finish = 0
current_time = 0
 
while  True:
    tmp_Process = Q.popleft() #先頭から取り出し、FIFOを実現
 
    if tmp_Process.value <= LIMIT: #終了
        current_time += tmp_Process.value
        print("%s %d"%(tmp_Process.name,current_time))
        num_finish += 1
    else:
        tmp_Process.value -= LIMIT
        current_time += LIMIT
        Q.append((tmp_Process))
 
    if num_finish == N:
        break


Measured memory_bytes: 18036
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ASumOfTwoIntegers {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;

        int res = 0;
        FOR(i, 1, N) {
            int j = N - i;
            if (i >= j) break;
            res++;
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ASumOfTwoIntegers solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
//typedef __int128_t lll;
using namespace std;

#define P 1000000007
#define N_MAX 200002
ll fac[N_MAX+1], inv[N_MAX+1], finv[N_MAX+1];
ll comb(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}
void init(){
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for(int i = 2; i <= N_MAX; i++){
    fac[i] = (fac[i-1]*i)%P;
    inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
    finv[i] = (finv[i-1]*inv[i])%P;
  }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
//-------------------------------------------------------------------
vll dp(3001, 0), num(3001, -1);
vvl G = vv(3001, 0, 0, ll), d;

ll f(ll now){
  if(num[now]!=-1) return num[now];
  ll ret = 0;
  for(int i=0;i<G[now].size();i++){
    ll to = G[now][i];
    ll x = d[now][0] - d[to][0], y = d[now][1] - d[to][1];
    ret = (ret + pp(f(to), comb(x+y, y)))%P;
  }
  return num[now] = (comb(d[now][0]+d[now][1], d[now][0]) - ret + P)%P;
}
int main(int argc, char const *argv[]) {
  ll h, w, n;std::cin >> h >> w >> n;
  init();
  d.resize(n, vll(2, 0));
  re(i, n) {
    scanf("%lld %lld", &d[i][0], &d[i][1]);
    d[i][0]--, d[i][1]--;
  }
  d.push_back(vll{h-1, w-1});
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n;j++){
      if(i==j) continue;
      if(d[i][0]<=d[j][0]&&d[i][1]<=d[j][1]) G[j].push_back(i);
    }
  }
  std::cout << f(n) << '\n';
  return 0;
}


Measured memory_bytes: 53888
#include <iostream>
#include <sstream>
#include <iterator>
#include <algorithm>
#include <vector>
 
using namespace std;
 
int main(){
  int N;
  //cin>>N;
  string str;
  cin>>str;
  N=str.length();
  vector<int> neck(0);
  vector<int> disc(0);
  string sub;
  vector<int> ans(N,0);
  
  disc.push_back(-1);
  for(int i=0;i<N-1;++i){
    sub=str.substr(i,2);
    if(sub=="RL"){
       neck.push_back(i);
    }else if(sub=="LR"){
       disc.push_back(i);
    }
  }
  disc.push_back(N-1);
  
  for(int i=0;i<neck.size();++i){
    int a=neck[i];
    int min=disc[i];
    int max=disc[i+1];
    //cout<<min<<" "<<a<<" "<<max<<endl;
    for(int j=min+1;j<=max;++j){
      if((a-j)%2==0){
        ans[a]++;
      }else{
        ans[a+1]++;
      }
    }
  }
  for(int i=0;i<N-1;++i){
    cout<<ans[i]<<" ";
  }
  cout<<ans[N-1]<<endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

ll h[200001], a[200001];

template<typename T>class BIT {
    public:
    int n;
    T init;
    vector<T> bit;
    
    BIT(int n, T init): n(n), init(init){
        bit.resize(n);
        fill(bit.begin(), bit.end(), (T)init);
    }

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

    //bit[1]からbit[end]までのmax (閉区間)
    T get_max(int end){
        T ret = init;
        for(int i=end;i>=1;i-=i&-i) ret = max(ret, bit[i]);
        return ret;
    }
};


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

    BIT<ll> tree(n+1, 0LL);
    for(int i=0;i<n;++i) {
        ll aa = tree.get_max(h[i]-1);
        tree.add(h[i], aa+a[i]);
    }

    cout << tree.get_max(n) << "\n";
}

Measured memory_bytes: 4992
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		long A = sc.nextLong();
		long B = sc.nextLong();
		int K = sc.nextInt();
		
		for(int i = 0; i < K; i++){
			if(i % 2 == 0){
				if(A % 2 == 1) A--;
				B += A / 2;
				A /= 2;
			}else{
				if(B % 2 == 1) B--;
				A += B / 2;
				B /= 2;
			}
		}
		
		System.out.println(A + " " + B);
	}
}

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

int main(int argc,char* argv[]){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(min(B,D)-max(A,C)>0) cout << min(B,D)-max(A,C) << endl;
  else cout << "0" << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

modN = N % 26

char_s = ""
numZ = ord('Z')
numA = ord('A')
for c in S:
    numC = ord(c)
    if (numC + modN > numZ):
        char_s += chr(numA + (modN - (numZ - numC) - 1))
    else:
        char_s += chr(numC + modN)
print(char_s)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define ET cout << "\n"
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef bbq
#define debug(...) {\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}
#define DB(a,s,e) {for(int _i=s;_i<e;++_i) cerr << a[_i] << " ";cerr << "\n";}
template<typename T>void _do(T &&x){cerr<<x<<endl;}
template<typename T,typename ...S> void _do(T &&x,S &&...t){cerr<<x<<", ";_do(t...);}
template<typename a,typename b> ostream& operator << (ostream &s,const pair<a,b> &p){return s<<"("<<p.X<<","<<p.Y<<")";}
#else
#define debug(...)
#define DB(a,s,e)
#endif

const ll MOD=1e9+7;
ll dp[2005][2005],J[4000005],inv[4000005],invJ[4000005];

int main()
{
    IOS();
    ll n,k;
    cin >> n >> k,J[0]=J[1]=inv[1]=invJ[0]=invJ[1]=1,dp[0][0]=1;
    if(k==1)
        return cout << "1\n",0;
    for(ll i=2;i<=n*k;++i)
        J[i]=J[i-1]*i%MOD,inv[i]=(MOD-MOD/i)*inv[MOD%i]%MOD,invJ[i]=invJ[i-1]*inv[i]%MOD;
    for(int i=0;i<=n;++i)
        for(int j=i;j<=n;++j)
        {
            if(i)
                dp[i][j]=dp[i-1][j];
            if(i!=j)
                dp[i][j]=(dp[i][j]+dp[i][j-1]*J[i+j*(k-1)-1]%MOD*invJ[k-2]%MOD*invJ[i+j*(k-1)-k+1])%MOD;
        }
    cout << dp[n][n]*J[n]%MOD << "\n";
}

Measured memory_bytes: 125184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 1000000007
typedef long long ll;
#define all(v) (v).begin(),(v).end()
#define sz(x) int(x.size())
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int sum=0;
	rep(i,n-1){
		if(s.at(i)==s.at(i+1)){
			sum++;
		}
	}
	cout<<(n-sum)<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;


int main(){
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    vector<ll> k(M,0);
    vector<vector<ll>> s(M, vector<ll>(0));
    vector<ll> p(M,0);
    for(ll i=0;i<M;i++){
        cin>>k[i];
        for(ll j=0;j<k[i];j++){
            ll s1;
            cin >> s1;
            s[i].emplace_back(s1);
        ;}
    ;}
    for(ll j=0;j<M;j++){
        cin>>p[j]
    ;}
    ll ans=0;
    for(ll bits=0;bits<(1<<N);bits++){
        vector<bool> sw(N+1,0);
        for(ll i=0;i<N;i++){
            if(bits&(1<<i)){sw[i+1]=1;}
        ;}
        ll check=1;
        for(ll i=0;i<M;i++){
            ll counter=0;
            for(ll j=0;j<s[i].size();j++){
                if(sw[s[i][j]]){counter++;}
            ;}
            if(counter%2!=p[i]){check=0;break;}
        ;}
        if(check){ans++;}
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
//~ #pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));


using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(0)cout
#endif

const int maxn = (1e6)+7;
const int maxk = 20;
const int inf = (1e9)+7;
const LL LLinf = ((LL)1e18)+7LL;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

LL val[maxn];
VI wek[maxn];
LL deep[maxn];
LL m[maxn], M[maxn];
int n;
LL ile[maxn];
LL xd;

void dfs(int x, int f)
{
  ile[x] = 0LL;
  M[x] = 0;
  m[x] = 0;
  if(val[x])
  {
    ile[x]++;
    xd += deep[x];
  }
  for(auto s : wek[x])
    if(s != f)
    {
      deep[s] = deep[x] + 1;
      dfs(s, x);
      ile[x] += ile[s];
      M[x] += M[s] + ile[s];
    }
  for(auto s : wek[x])
    if(s != f)
    {
      // dbg(x, s, M[x], M[x] - M[s] - ile[s], m[s] + ile[s]);
      m[x] = max(m[x], -(M[x] - M[s] - ile[s]) + m[s] + ile[s]);
    }
}

LL licz(int x)
{
  xd = 0;
  for(int i = 0;i <= n;i++)
    m[i] = M[i] = 0;
  deep[x] = 0;
  dfs(x, -1);
  if(m[x] > 0)
    return LLinf;
  if(xd & 1)
    return LLinf;
  // dbg(x, xd, m[x]);
  // for(int i = 1;i <= n;i++)
  //   dbg(i, m[i], M[i]);
  return xd / 2LL;
}

int main()
{
	_upgrade
  cin>>n;
  string s;
  cin>>s;
  for(int i = 0;i < n;i++)
    val[i + 1] = s[i] - '0';
  for(int i = 1;i < n;i++)
  {
    int a, b;
    cin>>a>>b;
    wek[a].pb(b);
    wek[b].pb(a);
  }
  LL res = LLinf;
  for(int i = 1;i <= n;i++)
    res = min(res, licz(i));
  if(res == LLinf)
    cout<<-1;
  else
    cout<<res;
	return 0;
}


Measured memory_bytes: 31232
import heapq

N,M = (int(x) for x in input().split())
AB = []
sum = 0

for i in range(N):
    a,b = (int(x) for x in input().split())
    AB.append([a,b])

AB = sorted(AB , key = lambda x : x[0])
heap = []
heapq.heapify(heap)
j = 0

for i in range(M+1):
    while j<N and AB[j][0] < i+1:
        heapq.heappush(heap,-AB[j][1])
        j += 1

    if len(heap):
        sum += -heapq.heappop(heap)
                           
print(sum)
    


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main(){
  int n;
  cin >> n;
  if(n%2==0)cout << n << endl;
  else cout << 2*n << endl;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
struct INF { template<class T> operator T() { return numeric_limits<T>::max() / 2; } } INF;


template<class T>
struct SegmentTree { // セグメント木

    const T INF = numeric_limits<T>::max();

    int n;
    int size;
    vector<T> mins, maxs;

    SegmentTree(int _n) {
        n = 1;
        size = _n;
        while(n < _n) n *= 2;
        mins.assign(n*2,INF);
        maxs.assign(n*2,-INF);
    }

    void update(int k, T a) { // val[k] = a;
        k += n-1;
        maxs[k] = mins[k] = a;
        while(k > 0) {
            k = (k-1) / 2;
            mins[k] = min(mins[k*2+1], mins[k*2+2]);
            maxs[k] = max(maxs[k*2+1], maxs[k*2+2]);
        }
    }

    T Min(int l, int r) { // 閉区間 [l,r] の最小値
        return _min(l, r+1, 0, 0, n);
    }
    T _min(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return INF;
        if(a <= l && r <= b) return mins[k];
        else {
            T vl = _min(a, b, k*2+1, l, (l+r)/2);
            T vr = _min(a, b, k*2+2, (l+r)/2, r);
            return min(vl, vr);
        }
    }

    T Max(int l, int r) { // 閉区間 [l,r] の最大値
        return _max(l, r+1, 0, 0, n);
    }
    T _max(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return -INF;
        if(a <= l && r <= b) return maxs[k];
        else {
            T vl = _max(a, b, k*2+1, l, (l+r)/2);
            T vr = _max(a, b, k*2+2, (l+r)/2, r);
            return max(vl, vr);
        }
    }

    // 閉区間 [l,r] で x 以上の数が最初に現れるインデックスを返す
    // 無ければ一番後ろ (= r) を返す
    int lower_bound(int l, int r, T x) {
        while(abs(l-r) > 0) {
            int mid = (l+r) / 2;
            if(Max(l,mid) >= x) r = mid;
            else l = mid+1;
        }
        return Max(r,r) >= x ? l : r+1;
    }
};


int main(){

    int n, q;
    cin >> n >> q;

    SegmentTree<int> st(n);

    rep(i,n) {
        int a;
        cin >> a;
        st.update(i,a);
    }

    rep(i,q) {
        int t, a, b;
        cin >> t >> a >> b;
        if(t == 1) {
            a--;
            st.update(a,b);
        }
        if(t == 2) {
            a--; b--;
            cout << st.Max(a,b) << endl;
        }
        if(t == 3) {
            a--;
            cout << st.lower_bound(a,n-1,b) + 1 << endl;
        }
    }
}

Measured memory_bytes: 7500
import math
anslst = []
while True:
    n = int(input())
    if n == 0:
        break
    else:
        # 各データの値と平均の差の2乗の合計を、データの総数 n で割った値の正の平方根
        l = []
        x = 0
        l = list(map(float, input().split()))
        ave = sum(l)/n # 平均
        for i in range(n):
            x += (l[i] - ave) ** 2
        anslst.append(math.sqrt(x / n))
for i in anslst:
    print('{0:.8f}'.format(i))


Measured memory_bytes: 5704
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll N, M, L, K, X, Y, Z;
ll ans = 0;
int check(string s) {
	if (stoi(s) > N)return 1;
	vector<bool>flag(3, 0);
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '7')flag[0] = 1;
		else if (s[i] == '5')flag[1] = 1;
		else flag[2] = 1;
	}
	if (flag[0] == 1 && flag[1] == 1 && flag[2] == 1) ans++;
}

int dfs(string s,int count) {
	count++;
	if (count == 10)return 1;
	string tmp = s + "7";
	check(tmp);dfs(tmp,count);
	tmp = s + "5";
	check(tmp); dfs(tmp,count);
	tmp = s + "3";
	check(tmp); dfs(tmp,count);
}
int main() {
	cin >> N;
	int count = 0;
	string s;
	dfs(s,count);
	cout << ans << endl;
}


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

int main(int argc, char **argv)
{
        int n, m, l, r, ans;
        std::cin >> n >> m;
        std::vector<int> candidate;

        std::cin >> l >> r;
        
        for(int i = 1;i < m;i++){
                int tmp_l, tmp_r;
                std::cin >> tmp_l >> tmp_r;
                if(l < tmp_l){
                        l = tmp_l;
                }
                if(r > tmp_r){
                        r = tmp_r;
                }
        }

        if(l > r){
                ans = 0;
        }else{
                ans = r - l + 1;
        }
        
        std::cout << ans << std::endl;
        return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-

import numpy
import scipy

A = int(input()) # 500
B = int(input()) # 100
C = int(input()) # 50
X = int(input())

ok = 0
for i in range(A+1):
    m1 = X - 500*i
    if m1 >= 0:
        for j in range(B+1):
            m2 = m1 - 100*j
            if m2 >= 0:
                for k in range(C+1):
                    m3 = m2 - 50*k
                    if m3 == 0:
                        ok += 1
print(ok)



Measured memory_bytes: 12636
/*
    ThunderClap and Flash
    Raunaq Singh
*/
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod) + (b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod) * (b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod) - (b%mod) + mod)%mod;}

void Flash(){
    ll n;
    cin>>n;
    vector <vector <ll>> a (n, vector <ll> (2, 0));
    for (ll i = 0; i < n; i++) {
        cin>>a[i][0]>>a[i][1];
    }
    ll mx[4], mn[4];
    for (ll i = 0; i < 4; i++) {
        mx[i] = -1 * inf;
        mn[i] = inf;
    }
    for (ll i = 0; i < n; i++) {
        mx[0] = max(mx[0], -1 * a[i][0] - a[i][1]);
        mx[1] = max(mx[1], -1 * a[i][0] + a[i][1]);
        mx[2] = max(mx[2], a[i][0] - a[i][1]);
        mx[3] = max(mx[3], a[i][0] + a[i][1]);

        mn[0] = min(mn[0], -1 * a[i][0] - a[i][1]);
        mn[1] = min(mn[1], -1 * a[i][0] + a[i][1]);
        mn[2] = min(mn[2], a[i][0] - a[i][1]);
        mn[3] = min(mn[3], a[i][0] + a[i][1]);
    }
    ll ans = -1 * inf;
    for (ll i = 0; i < 4; i++) {
        ans = max(ans, mx[i] - mn[i]);
    }
    cout<<ans<<"\n";
}

int main(int argc, char const *argv[]){ 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    #endif
    ThunderClap;
    ll t = 1;
    for(ll i = 1; i <= t; i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}


Measured memory_bytes: 14260