akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()

using namespace std;

template<class T>
class fenwick_tree {
private:
    const size_t size;
    const std::function<T(T, T)> f;
    const T unit;
    std::vector<T> a;
public:
    fenwick_tree(size_t size, std::function<T(T, T)> f, T unit) : size(size), f(f), unit(unit), a(size, unit) { }

    void update(size_t i, T x) {
        for (size_t j = i; j < size; j |= j + 1) {
            a[j] = f(a[j], x);
        }
    }

    T query(size_t i) const {
        T result = unit;
        for (size_t j = i; j > 0; j = (j & (j + 1))) {
            result = f(result, a[--j]);
        }
        return result;
    }
};

template <class T>
std::vector<size_t> argsort(const std::vector<T> &a) {
    std::vector<size_t> result(a.size());
    for (size_t i = 0; i < result.size(); ++i) {
        result[i] = i;
    }
    std::sort(result.begin(), result.end(), [&](size_t i, size_t j) { return a[i] < a[j]; });
    return result;
}

template <class Iterator>
unsigned long long inversion_number(Iterator first, Iterator last) {
    using T = typename std::iterator_traits<Iterator>::value_type;

    size_t n = std::distance(first, last);
    std::vector<size_t> a = argsort(std::vector<size_t>(first, last));
    unsigned long long result = 0;
    fenwick_tree<size_t> range_sum_query(n, [](size_t x, size_t y) { return x + y; }, 0);
    for (auto it = a.rbegin(); it != a.rend(); ++it) {
        result += range_sum_query.query(*it);
        range_sum_query.update(*it, 1);
    }
    return result;
}

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

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

    cout << inversion_number(all(a)) << endl;
    return 0;
}


Measured memory_bytes: 6808
#include <stdio.h>

int main(void){
	int A[3][3];
	int A_bin[3][3];
	int N;
	int b[100];
	int flag = 0;
	int k, i, j;

	for (i = 0; i < 3; i++) {
		for (j = 0; j < 3; j++) {
			scanf("%d", &A[i][j]);
			A_bin[i][j] = 0;
		}
	}
	scanf("%d", &N);
	for (k = 0; k < N; k++) {
		scanf("%d", &b[k]);
		for (i = 0; i < 3; i++) {
			for (j = 0; j < 3; j++) {
				if(A[i][j]==b[k]){ A_bin[i][j] = 1; }
			}
		}
	}


	for(k = 0; k < 3; k++){
		if ((A_bin[0][k] == 1)&&(A_bin[1][k] == 1)&&(A_bin[2][k] == 1)) { flag = 1; }
	}

	for(k = 0; k < 3; k++){
		if ((A_bin[k][0] == 1)&&(A_bin[k][1] == 1)&&(A_bin[k][2] == 1)) { flag = 1; }
	}
	
	if ((A_bin[0][0] == 1)&&(A_bin[1][1] == 1)&&(A_bin[2][2] == 1)) { flag = 1; }
	if ((A_bin[0][2] == 1)&&(A_bin[1][1] == 1)&&(A_bin[2][0] == 1)) { flag = 1; }


	if (flag == 1) { puts("Yes"); } else { puts("No"); }	

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int a[100]={0};
	int x;
	for(int i=0;i<s.length();i++){
		x=(int)(s[i]-'a');
		a[x]++;
	}
	int flag=1;
	for(int i=0;i<26;i++){
		if(a[i]%2!=0){
			flag=0;
			break;
		}
	}
	if(flag==1) cout<<"Yes"<<endl;
	else{
		cout<<"No"<<endl;
	}
return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int a;
    int b;
    int c;
    
    cin>>a;
    cin>>b;
    cin>>c;
    
    if(a<b&&b<c){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}



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

signed main(){
    int N;
    long long K;
    cin>>N>>K;
    vector<pair<int,int>> V(N);
    REP(i,N) cin>>V[i].first>>V[i].second;
    sort(V.begin(),V.end());
    REP(i,N){
        K-=V[i].second;
        if(K<=0){
            cout<<V[i].first<<endl;
            break;
        }
    }
}

Measured memory_bytes: 1024
#include<iostream>	// 入出力
#include<stdio.h>	// printf()が使える 小数は%fで
#include<math.h>	// 数学の関数
#include<vector>	// 配列
#include<string>	// 文字列
#include<map>		// 連想配列
#include<stack>		// スタック
#include<queue>		// キュー
#include<algorithm> // ソートとか

using namespace std;

using ll = long long;



int main()
{

	string S;

	cin >> S;

	for (int i = 0; i < S.length() - 1; ++i)
	{
		if (S[i] == 'A'&&S[i+1] == 'C')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	
	cout << "No" << endl;


	return 0;

}

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

use proconio::{input, fastout};

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

#[fastout]
fn main() {
    input! {
        n :usize,
        m :usize,
        ab :[(usize, usize); m],
        q :usize,
        vdc :[(usize, usize, usize); q]
    }

    let mut neighbors = vec![Vec::new();n];
    for (a, b) in ab {
        neighbors[a-1].push(b);
        neighbors[b-1].push(a);
    }
    
    let mut color = vec![0;n];
    let mut painted_radius = vec![-1;n];
    for &(v, d, c) in vdc.iter().rev() {
        paint(v, d, c, &neighbors, &mut color, &mut painted_radius);
    }

    for c in color {
        println!("{}", c);
    }
}

fn paint(v :usize, d :usize, c :usize, neighbors :&Vec<Vec<usize>>, color :&mut Vec<usize>, painted_radius :&mut Vec<isize>) {
    if painted_radius[v-1] >= d as isize {
        return;
    }
    if color[v-1] == 0 {
        color[v-1] = c;
    }
    painted_radius[v-1] = d as isize;
    if d > 0 {
        for &w in &neighbors[v-1] {
            paint(w, d-1, c, neighbors, color, painted_radius);
        }
    }
}

Measured memory_bytes: 14592
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n,m; cin >> n >> m;
    string s;cin >> s;
    reverse(all(s));
    vector<ll> res;

    ll now = 0;
    bool ok = true;
    while(now < n){
        ll temp = min(m,n-now);
        while(s[now + temp] == '1')temp--;
        res.emplace_back(temp);
        now += temp;
        if(temp <= 0){ok = false;break;}
    }
    if(!ok){
        cout << -1 << endl;
        return 0;
    }
    reverse(all(res));
    rep(i,res.size())cout << res[i] << " ";
    cout << endl;
}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> void mini(T &l, T r) {l = min(l, r);}
template <class T> void maxi(T &l, T r) {l = max(l, r);}

template <class T> using Tree = tree <T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(bool a) {
    return a ? "T" : "F";
}

string to_string(const char* s) {
    return to_string((string) s);
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define X first
#define Y second

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

const int N = 2e5 + 10;
const ll inf = (ll)1e18 + 10;

int n;
int a[N];

ll get(int x) {
    return x;
}

void run() {
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    ll ans = 0;
    int lst = 0;
    //bool ok = 1;
    for (int i = n; i >= 1; --i) {
        if (a[i] < lst) {
            ans = inf;
            //ok = 0;
            break;
        } else {
            debug("bf", ans);
            if (a[i] == lst) ans += 0;
            else ans += a[i];
            debug(ans, i, a[i], lst);
        }
        lst = a[i] - 1;
        lst = max(lst, 0);
    }
    if (a[1] != 0) {
        ans = inf;
        //ok = 0;
    }
    if (ans < inf/* && ok*/) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }
}

int main() {
    run();
    return 0;
}


Measured memory_bytes: 1024
x = int(input())
dp = [False] * (x + 1)
dp[0] = True
for i in range(x+1):
  if i >= 100:
    dp[i] |= dp[i-100]
    dp[i] |= dp[i-101]
    dp[i] |= dp[i-102]
    dp[i] |= dp[i-103]
    dp[i] |= dp[i-104]
    dp[i] |= dp[i-105]
print(dp[x]+0)

Measured memory_bytes: 39920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
const int INF=(int)2e9;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
const ll MOD=(ll)1e9+7;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define MAX 100005
#define wa cout<<"wa"<<endl;

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

int main(){
	int n;
	cin>>n;
	map<int,bool> m;
	int num;
	FOR(i,0,n){
		cin>>num;
		if (m[num]==true){
			m[num] = false;
		}else {
			m[num] = true;
		}
	}
	typedef map<int,bool>::iterator it_type;
	int ans=0;
	for(it_type it=m.begin();it!=m.end();it++){
		if (it->se==true){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}



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

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < 100000000; i++) {
        if (c == (a * i) % b) {
            cout << "YES";
            return 0;
        }
    }

    cout << "NO";

    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
    string S;
    int ans = 0;

    cin >> S;

    for(int i = 0;i < S.length() / 2;i++){
        if(S[i] != S[S.length() - i - 1])ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
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; }
typedef long long ll;
typedef pair<ll,ll> pint;
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b==0){
        return a;
    }
    else{
        return gcd(b,a%b);
    }
}

int main(){
    ll a,b,n;cin>>a>>b>>n;
    if(n<b){
        ll c = (n*a)/b-a*(n/b);
        cout<<c<<endl;
    }
    else{
        ll c= ((b-1)*a)/b-a*((b-1)/b);
        cout<<c<<endl;
    }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int N, M;
int A[310][310];
int pos[310], Cnt[310], Vis[310];
int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= N; ++i)
		for (int j = 1; j <= M; ++j)
			scanf("%d", &A[i][j]);
	for (int i = 1; i <= N; ++i)pos[i] = 1;
	int Ans = 0x3f3f3f3f, Max = 0;
	for (int i = 1; i <= M; ++i)
	{
		memset(Cnt, 0, sizeof (Cnt));
		for (int j = 1; j <= N; ++j)
			Cnt[A[j][pos[j]]]++;
		Max = 0;
		int k;
		for (int j = 1; j <= M; ++j)
			if (Cnt[j] > Max)
				Max = Cnt[j], k = j;
		Ans = min(Max, Ans);
		Vis[k] = 1;
		int j;
		for (j = 1; j <= N; ++j)
		{
			while (Vis[A[j][pos[j]]])
				pos[j] ++;
			if (pos[j] > M)break;
		}
		if (pos[j] > M)break;
	}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>

int main(void) {
	char line[101];
	int H, W, i, j;
	scanf("%d %d", &H, &W);
	for (i = 0; i < W+2; i++) {
		printf("#");
	}
	printf("\n");
	for (i = 0; i < H; i++) {
		printf("#");
		scanf("%s", line);
		printf("%s", line);
		printf("#\n");
	}
	for (i = 0; i < W+2; i++) {
		printf("#");
	}
	printf("\n");
	return 0;
}


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

void solve1() {
  string s, t;
  cin >> s >> t;
  int d = t.size();
  for (int i = 0; i < s.size(); i++) {
    int j = 0, k = i;
    for (; k < s.size() && j < t.size() && s[k] == t[j]; k++, j++) {
      ;
    }
    if (j == t.size()) {
      d = 0;
      break;
    }
    if (j != 0) {
      int c = 0;
      for (; j < t.size() && k < s.size(); k++, j++) {
        if (s[k] != t[j]) {
          c++;
        }
      }
      if (j < t.size()) {
        c = t.size();
      }
      if (c < d) d = c;
      continue;
    }
  }
  for (int i = s.size() - 1; i >= 0; i--) {
    int j = 0, k = i;
    for (; k >= 0 && j < t.size() && s[k] == t[t.size() - 1 - j]; k--, j++) {
      ;
    }
    if (j == t.size()) {
      d = 0;
      break;
    }
    if (j != 0) {
      int c = 0;
      for (; j < t.size() && k >= 0; k--, j++) {
        if (s[k] != t[t.size() - 1 - j]) {
          c++;
        }
      }
      if (j < t.size()) {
        c = t.size();
      }
      if (c < d) d = c;
      continue;
    }
  }
  cout << d << endl;
}

void solve2() {
  string s, t;
  cin >> s >> t;
  int c = t.size();
  // ÈúÄÊª°Ë∂≥Ëá≥Â∞ëËÉΩËØªÂà∞Â≠óÁ¨¶‰∏≤sÁöÑ4‰∏™Â≠óÁ¨¶
  for (int i = 0; i <= s.size() - t.size(); i++) {
    int count = 0;
    for (int j = 0, k = i; j < t.size(); j++, k++) {
      if (s[k] != t[j]) {
        count++;
      }
    }
    if (count < c) c = count;
  }
  cout << c << endl;
}

int main() {
  solve2();
  return 0;
}


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

ll sub(ll n){
  if(n<=0){
    return -1;
  }
  else{
    vector<ll> list(n+1);
    rep(i,n+1){
      if(i==0){
        list.at(i) = 0;
      }
      else if(i==1){
        list.at(i) = 1;
      }
      else{
        list.at(i) = (list.at(i-1)+list.at(i-2))%MOD;
      }
    }
  return list.at(n);
  }
}

ll ans(vector<ll> v,ll m){
  ll ans=1;
  for(ll i = 0;i<m;i++){
    if(i==0){
      ans *= sub(v.at(i));
      ans %= MOD;
    }
    else{
      ans *= sub(v.at(i)-v.at(i-1)-1);
      ans %= MOD;
   
    }
    if(ans < 0){
      ans = 0;
    }
  }
  return ans;
}

int main(){  
  ll N,M;
  cin >> N >> M;
  vector<ll> A(M);
  rep(i,M){
    cin >> A.at(i);
  }
  ll ANS = ans(A,M);
  if(M!=0){
    ANS *= sub(N-A.at(M-1));
  }
  else{
    ANS*=sub(N+1);
  }
  cout << ANS%1000000007 << endl;
}

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

//.define
//#define FILE_IN_OUT
#define RET(_x)                       return std::cout << (_x), 0;
#define all(_obj)                     (_obj).begin(), (_obj).end()
#define fori(_iterator, _begin, _end) for (int _iterator = (_begin); _iterator < (_end); ++_iterator)
#define forr(_iterator, _begin, _end) for (int _iterator = (_begin); _iterator >= (_end); --_iterator)
#define loop(_n)                      for (int i = 0; i < (_n); ++i)
#define divCeil(_dividend, _divider)  (((_dividend) - 1LL + (_divider)) / (_divider))
#define sz(_obj)                      static_cast<int>((_obj).size())
#define endl                          "\n"
template<typename Tp>
inline void outarr(Tp _array, const std::size_t _N, const char* _delim = " ") {
    Tp end = _array + _N;
    for (Tp current = _array; current != end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = std::int64_t;
using pii = std::pair<int, int>;
constexpr int INF = INT_MAX;
constexpr int MOD = 1e9 + 7;

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream сin  ("input.txt",  std::ios::in);
    std::ofstream сout ("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

   int n, f, s;
   cin >> n >> f >> s;
   int last, prev;
   loop(n) {
       cin >> last;
       if (i == n - 2) {
           prev = last;
       }
   }

   if (n == 1) {
       RET(abs(s - last));
   }

   cout << max(abs(s - last), abs(last - prev));

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int cnt=0;
    while(1){
        cnt++;
        if(cnt%2==0){
            a-=d;
        }
        if(cnt%2==1){
            c-=b;
        }
        if(a<=0||c<=0)break;
    }
    if(cnt%2==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace swap2
{
    class Program
    {
        static void Main(string[] args)
        {
            for(int t = 0; true; t++){
            string[] str = Console.ReadLine().Split(' ');
            if (str[0] == "0" && str[1] == "0") {
                break;
            }
            int[] answer = new int[2];
            for (int i = 0; i < 2; i++) {
                answer[i] = int.Parse(str[i]);
            }
            Array.Sort(answer);
            Console.WriteLine("{0} {1}", answer[0], answer[1]);
        }
        }

    }
}

Measured memory_bytes: 5920
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

let main() =
    let n = read int64
    match n with
    | _ when n < 2L -> 0L
    | _ when n % 2L <> 0L -> 0L
    | _ ->
        let mutable five = 0L
        let mutable v = 10L
        while v <= n do
            five <- five + (n / v)
            v <- v * 5L
        five
    |> puts
    ()

main()
writer.Close()


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

using namespace std;

struct StronglyConnectedComponents
{
  vector< vector< int > > gg, rg;
  vector< pair< int, int > > edges;
  vector< int > comp, order, used;

  StronglyConnectedComponents(size_t v) : gg(v), rg(v), comp(v, -1), used(v, 0) {}

  void add_edge(int x, int y)
  {
    gg[x].push_back(y);
    rg[y].push_back(x);
    edges.emplace_back(x, y);
  }

  int operator[](int k)
  {
    return (comp[k]);
  }

  void dfs(int idx)
  {
    if(used[idx]) return;
    used[idx] = true;
    for(int to : gg[idx]) dfs(to);
    order.push_back(idx);
  }

  void rdfs(int idx, int cnt)
  {
    if(comp[idx] != -1) return;
    comp[idx] = cnt;
    for(int to : rg[idx]) rdfs(to, cnt);
  }

  void build(vector< vector< int > > &t)
  {
    for(int i = 0; i < gg.size(); i++) dfs(i);
    reverse(begin(order), end(order));
    int ptr = 0;
    for(int i : order) if(comp[i] == -1) rdfs(i, ptr), ptr++;

    t.resize(ptr);
    set< pair< int, int > > connect;
    for(auto &e : edges) {
      int x = comp[e.first], y = comp[e.second];
      if(x == y) continue;
      if(connect.count({x, y})) continue;
      t[x].push_back(y);
      connect.emplace(x, y);
    }
  }
};


void solve()
{
  int V, E;
  cin >> V >> E;
  StronglyConnectedComponents scc(V);
  for(int i = 0; i < E; i++) {
    int s, t;
    cin >> s >> t;
    scc.add_edge(s, t);
  }
  vector< vector< int > > g;
  scc.build(g);
  vector< int > rev(V);
  for(int i = 0; i < V; i++) rev[scc[i]] = i;
  for(int i = 0; i < V; i++) cout << rev[i] << endl;
}

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

Measured memory_bytes: 7264
import sys
input = sys.stdin.readline
x,k,d=map(int,input().split())
x=abs(x)
if x<d:
    if k&1==0:
        print(x)
    else:
        print(abs(x-d))
    sys.exit()

val = x//d

if val>k:
    x-=(k*d)
    print(x)
    sys.exit()

x-=(val*d)
k-=val
if k&1==0:
    print(x)

else:
    ans = min(x+d,abs(x-d))
    print(ans)



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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    double r;
    cin >> r;
    printf("%.10lf\n", r * 2 * M_PI);
    return 0;
}



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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

ll N,A,B;
vector<ll> h;

// x回の爆発で充分かどうか
bool check(ll x){
    // A-Bダメージをp回与える
    ll p=0;
    rep(i,0,N){
        if (h[i] - B*x > 0){
            p += (h[i] - B*x +A-B-1)/(A-B);
        }
    }
    return x >= p;
}

signed main() {
    cin>>N>>A>>B;
    h.resize(N);
    rep(i,0,N){
        cin>>h[i];
    }

    ll ng=0, ok=1010101010LL;
    while(ng+1 < ok){
        ll m =(ng+ok)/2;
        if (check(m)){
            ok = m;
        }else{
            ng = m;
        }
    }
    cout<<ok<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;

int main() {
    
int n,k;
cin>>n>>k;
Vec vec(n);
for(int i=0;i<n;i++){
    cin>>vec[i];

}

for(int i=0;i<n-k;i++){

    if(vec[i]<vec[i+k]){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    

}


}
 

Measured memory_bytes: 4052
#include<iostream>
using namespace std;
int main(){
  int W,H,x,y,r;
  cin>>W>>H>>x>>y>>r;
  if(x-r<0||x+r>W||y-r<0||y+r>H)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 3080
#include<stdio.h>

int main(){
	int n,i;
	char s[10000];
	scanf("%d%s",&n,s);
	if(n%2==1)puts("No");
	else{
		for(i=0;i<n/2;i++){
			if(s[i]!=s[i+n/2]){
				puts("No");
				return 0;
			}
		}
		puts("Yes");
	}
	return 0;
}

Measured memory_bytes: 128
from collections import deque
# 両端を扱うならdequeが速い
# 内側を扱うならリストが速い

S = input()

q = deque()
for s in list(S):
    q.append(s)

Q = int(input())

direction = True

for _ in range(Q):
    line = input()

    # TrueならFalseに、FalseならTrueに変える
    if line == "1":
        direction = not direction

    else:
        if (direction and line[2] == '1') or (not direction and line[2] == '2'):
            # 左端に追加する場合
            q.appendleft(line[4])
        else:
            # 右端に追加する場合
            q.append(line[4])

if direction:
    print("".join(q))
elif not direction:
    q.reverse()
    print("".join(q))


Measured memory_bytes: 14372
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int A, B, K;
    cin >> A >> B >> K;
    FOR(i, A, B + 1, 1) {
        if (i < A + K || i > B - K) {
            cout << i << endl;
        }
    }
    return 0;
}


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

using namespace std;
const int N=5e5+5;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<(a+b-1)/b<<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() {
    int N, K, S;
    cin >> N >> K >> S;
    rep(i, K) cout << S << " ";
    rep(i, N - K) {
        if (S == 1e9) cout << "1";
        else cout << S + 1;
        if (i < N - K) cout << " ";
        else cout << endl;
    }
}

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

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

    vector<vector<int>> a(3,vector<int>(3)),c(3,vector<int>(3));
    int n,b;
    
    rep(i,3) rep(j,3) cin >> a[i][j];
    cin >> n;

    rep(i,n){
        cin >> b;
        rep(j,3) rep(k,3){
            if(b==a[j][k]) c[j][k]=1;
        }
    }
    bool ans=0;
    rep(i,3) if(c[i][0]+c[i][1]+c[i][2]==3 || c[0][i]+c[1][i]+c[2][i]==3) ans=1;
    if(c[0][0]+c[1][1]+c[2][2]==3 || c[0][2]+c[1][1]+c[2][0]==3) ans=1;

    if(ans==0) print("No");
    else print("Yes");
    return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:512000000")
#define _CRT_SECURE_NO_WARNINGS
/*#if !defined(YCM) && 0
#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx,tune=native")
#include <stdio.h>
#endif*/
//#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(bool);
void precalc();
clock_t start;
int main() {
#ifdef AIM
    freopen("/home/alexandero/ClionProjects/ACM/input.txt", "r", stdin);
    //freopen("/home/alexandero/ClionProjects/ACM/output.txt", "w", stdout);
    //freopen("out.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
    cout.sync_with_stdio(0);
    cin.tie(0);
    precalc();
    cout.precision(10);
    cout << fixed;
    //cin >> t;
    int testNum = 1;
    while (t--) {
        //cout << "Case #" << testNum++ << ": ";
        //cerr << testNum << endl;
        solve(true);
        //cerr << testNum - 1 << endl;
    }
    cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
    cerr << "\n\n time: " << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n\n";
#endif

    return 0;
}

//BE CAREFUL: IS INT REALLY INT?

template<typename T>
T binpow(T q, T w, T mod) {
    if (!w)
        return 1 % mod;
    if (w & 1)
        return q * 1LL * binpow(q, w - 1, mod) % mod;
    return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
    while (w) {
        q %= w;
        swap(q, w);
    }
    return q;
}
template<typename T>
T lcm(T q, T w) {
    return q / gcd(q, w) * w;
}

template <typename T>
void make_unique(vector<T>& a) {
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

template<typename T>
void relax_min(T& cur, T val) {
    cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
    cur = max(cur, val);
}

void precalc() {}

//#define int li
//const int mod = 1000000007;


void solve(bool read) {
    int p = 37;
    cout << p * p + p + 1 << " " << p + 1 << endl;
    for (int a = 0; a < p; ++a) {
        for (int b = 0; b < p; ++b) {
            for (int x = 0; x < p; ++x) {
                int y = (a * x + b) % p;
                cout << x * p + y + 1 << " ";
            }
            cout << p * p + a + 1 << "\n";
        }
    }
    for (int a = 0; a < p; ++a) {
        for (int y = 0; y < p; ++y) {
            cout << a * p + y + 1 << " ";
        }
        cout << p * p + p + 1 << "\n";
    }
    for (int i = 0; i <= p; ++i) {
        cout << p * p + i + 1 << " ";
    }
    cout << "\n";

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int INF = 100000000;

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

    int count = 0;
    REP(i, 4){
        REP(j, 4){
            if(s[i] == s[j]){
                count++;
            }
        }
    }
    if(count == 8){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	string S;

	cin >> S;

	cout << S.substr(0, 3) << '\n';



	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
	return 0;
}


Measured memory_bytes: 3656
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/21 8:23:51
File Name     :TEST.cpp
************************************************ */

#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define INF 0x3f3f3f3f
#define bug puts("--------------")
const int N = 1e6 + 10;
const int M = 2e6 + 10;
const ll mod = 1e9 + 7;
using namespace std;
int head[N],tot,head_c[N],tot_c;
int dfn[N],low[N];
int Stack[N],ins[N],c[N];int deg[N];
vector<int> scc[N];
int n,m,num,top,cnt;
struct Edge{
    int next;
    int to;
}edge[M],edge_c[M];
inline void add(int from,int to){
    edge[++tot].next = head[from];
    edge[tot].to = to;
    head[from] = tot;
}
inline void add_c(int from,int to){
    edge_c[++tot_c].next = head_c[from];
    edge_c[tot_c].to = to;
    head_c[from] = tot_c ;
    deg[to] ++;
}
void tarjan(int x){
    dfn[x] = low[x] = ++num;
    Stack[++top] = x,ins[x] = 1;
    for(int i = head[x];i;i = edge[i].next){
        int y = edge[i].to;
        if(!dfn[y]){
            tarjan(y);
            low[x] = min(low[x],low[y]);
        }
        else if(ins[y]) low[x] = min(low[x],dfn[y]);
    }
    if(dfn[x] == low[x]){
        cnt ++;int y;
        do{
            y = Stack[top--],ins[y] = 0;
            c[y] = cnt ,scc[cnt].push_back(y);
        }while(x != y);
    }
}
int pre[N],f[N];
void topsort(){
    queue<int> Q;
    for(int i = 1;i <= cnt;++i) if(!deg[i]) Q.push(i);
    while(Q.size()){
        int x = Q.front();
        Q.pop();
        for(int i = head_c[x];i;i = edge_c[i].next){
            int y =  edge_c[i].to;
            pre[y] = max(pre[y],f[x]);
            if(--deg[y] == 0){
                Q.push(y);
                f[y] = f[y] + pre[y];
            }
        }
    }
}
ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
char s[N];
ll dp[N][2];
int main(){
    s[0] = '0';
    cin >> (s + 1);
    int l = strlen(s  + 1);
    dp[l][0] = s[l] - '0';
    dp[l][1] = 10 - (s[l] - '0');
    for(int i = l - 1;i >= 0;i --){
        dp[i][0] = min(dp[i+1][0] + s[i] - '0',dp[i+1][1] + s[i]-'0' + 1);
        dp[i][1] = min(dp[i+1][0] + 10 - (s[i]-'0'),dp[i+1][1] + (10 - (s[i]-'0'+1)));
    }
    cout <<min(dp[0][0],dp[0][1]);
}

Measured memory_bytes: 43264
import math

def calc_combination(n):
    combination = math.factorial(n) / (math.factorial(2) * math.factorial(n - 2))

    return combination


N = int(input())

list_A = list(map(int, input().split(' ')))

tmp_sum = 0
sum_map = {}
for A in list_A:
    tmp_sum += A
    sum_map[tmp_sum] = sum_map.get(tmp_sum, 0) + 1

result = sum_map.get(0, 0)
for value in sum_map.values():
    if value >= 2:
        result += calc_combination(value)

print(int(result))

Measured memory_bytes: 38912
import java.util.*;

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

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int A = sc.nextInt();
		final int B = sc.nextInt();
		final int C = sc.nextInt();

		final int X = sc.nextInt();
		final int Y = sc.nextInt();

		long minCost = Long.MAX_VALUE;

		for (int i = 0, bound = Math.max(X, Y) * 2; i <= bound; i += 2) {
			long ab = i;
			long a = Math.max(X - i / 2, 0);
			long b = Math.max(Y - i / 2, 0);
			long cost = A * a + B * b + C * ab;
			minCost = Math.min(minCost, cost);
		}
		System.out.println(minCost);
		sc.close();

	}

}


Measured memory_bytes: 21716
n=int(input())
s=input()
l=0
r=0
for i in range(n):
  if r==0 and s[i]==')':
    l+=1
  elif s[i]=='(':
    r+=1
  elif r>0 and s[i]==')':
    r-=1
print('('*l+s+')'*r)

Measured memory_bytes: 3060
int main(int argc, char *argv[])
{
	int a;
	int b;
	scanf("%d %d\n", &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: 584
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>

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

int main(){
    string s; cin>>s;
    int n;
    n=s.size();
    vector<int> ans(n);
    rep(ri,2){
        
            int cnt=0;
            rep(i,n){
                if(s[i]=='R')cnt++;
                else{
                    ans[i]+=cnt/2;
                    ans[i-1]+=(cnt+1)/2;
                    cnt=0;
                }
            }
        
        
        
        
        reverse(ans.begin(), ans.end());
        reverse(s.begin(), s.end());
        rep(i, n){
            if(s[i] == 'L') s[i] = 'R';
            else s[i] = 'L';
            
        }
    }
    rep(i,n){
    printf("%d%c", ans[i],i==n-1? '\n':' ');
    }
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

// ================================================= //

/*
 1-index
 RangeAdd : [s,t] に xを加算
 RangeSum : [s,t] の総和を出力
 */
struct BIT {
    int N;
    vector<ll> bit1;
    vector<ll> bit2;
    BIT(int N):N(N) {
        /* BITは[1..N]で扱う */
        bit1.resize(N + 1, 0);
        bit2.resize(N + 1, 0);
    }
    
    void add1(int x, ll val){
        while (x <= N) {
            bit1[x] += val;
            x += x & -x;
        }
    }
    void add2(int x, ll val){
        while (x <= N) {
            bit2[x] += val;
            x += x & -x;
        }
    }
    
    // [l,r]
    void RangeAdd(int l,int r,ll val){
        // Update BIT1
        add1(l,val);
        add1(r+1,-val);
        
        // Update BIT2
        add2(l,val*(l-1));
        add2(r+1,-val*r);
    }
    
    ll sum1(int x){
        ll ret = 0;
        while (x) {
            ret += bit1[x];
            x &= (x - 1);
        }
        return (ret);
    }
    
    ll sum2(int x){
        ll ret = 0;
        while (x) {
            ret += bit2[x];
            x &= (x - 1);
        }
        return (ret);
    }
    
    ll sum(int x){
        return sum1(x)*x - sum2(x);
    }
    // [l,r]
    ll RangeSum(int l,int r){
        return sum(r) - sum(l-1);
    }
};



int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    
//    SegTree ST(n);
    BIT bit(n);
    while(q--){
        int com; cin >> com;
        if(com == 0){
            int s,t,x; cin >> s >> t >> x;
           //ST.update(s-1,t,x);
            bit.RangeAdd(s, t, x);
        }else{
            int s,t; cin >> s >> t;
            //cout << ST.query(s-1,t) <<endl;
            cout << bit.RangeSum(s, t) << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 4384
import sys

def bi_search(array, target):
    l, r = -1, len(array)-1
    while r-l > 1:
        mid = int((r+l)/2)
        if array[mid] > target:
            r = mid
        else:
            l = mid
    return r

N = int(sys.stdin.readline().strip())
l_list = list(sorted(list(map(int, sys.stdin.readline().strip().split(" ")))))
count = 0
#print(l_list)

for i in reversed(range(N)):
    a = l_list[i]
    for j in reversed(range(i)):
        b = l_list[j]
        index = bi_search(l_list[:j], a-b)
        """
        print("====")
        print(b-a)
        print(i, j, index)
        """
        if index > -1 and index < j and l_list[index] + b > a:
            count += (j-index)

print(count)


Measured memory_bytes: 57052
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		scan.close();
		String[] ary = s.split(" ");
		int l = ary.length;
		Deque<Integer> stack = new ArrayDeque<Integer>();
		for(int i = 0; i < l; i++) {
			String t = ary[i];
			if(t.equals("+")) {
				int a = stack.pop();
				int b = stack.pop();
				int c = b + a;
				stack.push(c);
			}else if(t.equals("-")) {
				int a = stack.pop();
				int b = stack.pop();
				int c = b - a;
				stack.push(c);
			}else if(t.equals("*")) {
				int a = stack.pop();
				int b = stack.pop();
				int c = b * a;
				stack.push(c);
			}else {
				int a = Integer.parseInt(t);
				stack.push(a);
			}
		}
		int ans = stack.pop();
		System.out.println(ans);
	}
}


Measured memory_bytes: 26164
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <map>

char ch;

int main()
{
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	std::cin >> ch;
	if (ch == 'A')
		std::cout << "T";
	else if (ch == 'T')
		std::cout << "A";
	else if (ch == 'C')
		std::cout << "G";
	else
		std::cout << "C";
	std::cout << "\n";
	return 0;
}

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

#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

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

  cout << setprecision(10) << R * 2 * M_PI << endl;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
long double p[3002];
long double dp[3002][3002] ; 
long double finding_more_heads(int n , int x , int z){
		 
		 if(n == 0 ){
			 if(x >= z)
				 return 1  ;
			else
			return 0 ;
		}
		
		if(dp[n][x] !=  -1.0)
		  return dp[n][x] ;
		  
		long double  ans = 0 ; 
		ans = ans + p[n-1] * finding_more_heads(n-1, x + 1 , z)  +
		             ( 1 - p[n-1] )*finding_more_heads(n-1 , x , z) ;
		 
		 dp[n][x] = ans ; 
		 return ans ;  
 }
	
int main(){
	int n ; 
	cin>> n ; 
   for(int i = 0 ; i < n ; ++i) cin>> p[i] ;
   
   cout<<fixed<<setprecision(10);
   //double x = -1.0234000 ; 
  // memset(dp , x , sizeof dp) ; 
  fill_n(&dp[0][0] ,3002*3002 , -1.0) ;  
   //cout<<dp[0][0]<<endl;
     cout<<finding_more_heads(n , 0, n/2 + 1)<<endl;
 }
     	
   


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
		int N, L;
	cin >> N >> L;
	if (L <= 0) {
		if (N + L <= 0) {
			ce((N - 1)*(L + L + N - 2) / 2)
		}
		else {
			ce(N*(L+L+N-1)/2)
		}
	}
	else {
		ce((N-1)*(L+1+L+N-1)/2)
	}
    return 0;
}



Measured memory_bytes: 256
l, r = map(int, input().split())
y = 2019
lmod = l % y
if r-l+1 >= y:
  print(0)
else:
  count = float("inf")
  for i in range(l, r):
    for j in range(i+1, r+1):
      if count > i*j%y:
        count = i*j%y
  print(count)

Measured memory_bytes: 3060
#![allow(non_snake_case)]
use proconio::input;

fn main() {
    use std::collections::BTreeSet;
    input!(N: usize);
    let mut set = BTreeSet::new();
    for _ in 0..N {
        input!(S: String);
        set.insert(S);
    }
    println!("{}", set.len());
}


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

int main(){
    int x,y,tmp;

    while(1){
        cin >> x >> y;
        if(x > y){
            tmp = x;
            x = y;
            y = tmp;
        }
        if(x == 0 && y == 0)break;

        cout << x << " " << y << endl;

    }

        return 0;
}


Measured memory_bytes: 3080