akhauriyash/Code-Regression huggingface dataset:
package main

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

func out(x ...interface{}) {
	// fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

type bit []int

func (p *bit) init(n int) {
	*p = make([]int, n+1)
}
func (p bit) sum(i int) int {
	if i == 0 {
		return 0
	}
	return p[i] + p.sum(i-(i&-i))
}
func (p bit) add(i, x int) {
	if i >= len(p) {
		return
	}
	p[i] += x
	p.add(i+(i&-i), x)
}

func main() {
	sc.Split(bufio.ScanWords)
	N, K := getInt(), getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt() - K
	}

	s := make([]int, N+1)
	for i := 0; i < N; i++ {
		s[i+1] = s[i] + a[i]
	}

	b := make([]int, N)
	for i := 1; i <= N; i++ {
		b[i-1] = s[i]
	}
	out(s)
	sort.Ints(b)
	out(b)
	bm := make(map[int]int)
	for i := 0; i < N; i++ {
		bm[b[i]] = i + 1
		out(bm)
	}
	var tree bit
	tree.init(N + 2)
	for i := 0; i < N; i++ {
		tree.add(bm[b[i]], 1)
	}
	// tree.add(bm[0], -1)
	out("---")
	out(tree)

	ans := 0
	for i := 1; i <= N; i++ {
		pos := lowerBound(b, s[i-1])
		ans += tree.sum(N+1) - tree.sum(pos)
		tree.add(bm[s[i]], -1)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 17152
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<limits>
#include<algorithm>
#include<numeric>
#include<utility>
#include<iomanip>

using ULLI = unsigned long long int;
using LLI = long long int;

using namespace std;

template<class T>
class ModCal{
private:
    const ULLI MAX = 1000000;
    ULLI mod;

    std::vector<T> fac;
    std::vector<T> finv;
    std::vector<T> inv;

    void COMinit() {
        fac.resize(MAX);
        finv.resize(MAX);
        inv.resize(MAX);

        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++){
            fac[i] = fac[i - 1] * i % mod;
            inv[i] = mod - inv[mod%i] * (mod / i) % mod;
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
public:
    ModCal(ULLI _mod){
        this->mod = _mod;
        ModCal<T>::COMinit();
    }
    ModCal(){
        this->mod = 0;
    }

    T add(T a, T b){
        T tmp;
        tmp = a + b;
        if(mod != 0) tmp %= mod;
        return tmp;
    }

    T sub(T a, T b){
        T tmp;
        tmp = a - b;
        if(mod != 0){
            if(tmp < 0) tmp += mod;
            tmp %= mod;
        }
        return tmp;
    }

    T mul(T a, T b){
        T tmp;
        tmp = a * b;
        if(mod != 0) tmp %= mod;
        return tmp;
    }

    T modinv(T a, T m){
        T b = m, u = 1, v = 0;
        while (b) {
            T t = a / b;
            a -= t * b; std::swap(a, b);
            u -= t * v; std::swap(u, v);
        }
        u %= m;
        if (u < 0) u += m;
        return u;
    }

    T div(T a, T b){
        if(mod == 0){
            return a / b;
        }
        a %= mod;
        T tmp = a * ModCal<T>::modinv(b, mod) % mod;
        return tmp;
    }

    T pow(T a, T b){
        T tmp = 1;
        while(b > 0){
            if(mod != 0){
                if(b & 1) tmp = tmp * a % mod;
                a = a * a % mod;
            }else{
                if(b & 1) tmp *= a;
                a *= a;
            }
            b >>= 1;
        }
        return tmp;
    }

    // 以下の関数はMODを設定しない限り使えない
    // 無理やり使う場合は "ModCal<T> cal(Tの最大値)" でオブジェクトを作る
    T com(T n, T k){
        if(n < k) return 0;
        if(n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
    }

    T fact(T n){
        return fac[n];
    }
};

struct S{
    int A;
    int B;
    double v;

    S(int A, int B){
        this->A = A;
        this->B = B;
    }

    bool operator<(const S &l) const{
        return static_cast<double>(B)/A < static_cast<double>(l.B)/l.A;
    };
};

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

    for(auto c : S){
        printf("%c", 'A'+(c-'A'+N)%26);
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int r = Math.min(a+b, b+c);
		int r1 = Math.min(r, c+a);
		System.out.println(r1);
	}
}


Measured memory_bytes: 22612
import math

ABCDList = input().split()
A = int(ABCDList[0])
B = int(ABCDList[1])
C = int(ABCDList[2])
D = int(ABCDList[3])

Takahashi_Dead = int( math.ceil( A / D ) )
Aoki_Dead = int( math.ceil( C / B ) )
if(Aoki_Dead <= Takahashi_Dead):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9180
package main

import "fmt"

func scanNums(n int, s string) [][]int {
	nums := make([][]int, 2)
	for i := 0; i < 2; i++ {
		nums[i] = make([]int, n)
	}

	nums[0][0] = 0
	nums[1][n-1] = 0
	for i := 1; i < n; i++ {
		nums[0][i] = nums[0][i-1] + count(s[i-1], 'W')
	}
	for i := n - 2; i >= 0; i-- {
		nums[1][i] = nums[1][i+1] + count(s[i+1], 'E')
	}

	return nums
}

func count(b byte, r byte) int {
	if b == r {
		return 1
	}
	return 0
}

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	nums := scanNums(n, s)

	min := n
	for i := 0; i < n; i++ {
		if nums[0][i]+nums[1][i] < min {
			min = nums[0][i] + nums[1][i]
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 7296
io = STDIN
n=io.gets.chomp.to_i
$a={}
(1..n).each do |i|
  $a[i]=io.gets.chomp.to_i
end
$cnt = 1
$busy={}

def check(i)
  while $a[i]!=2
    $busy[i]=true
    $cnt += 1
    i=$a[i]
    return -1 if $busy[i]
  end
  $cnt
end
puts check(1)


Measured memory_bytes: 14716
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <unordered_set>
#include <cmath>
#define endl '\n'
#define ll long long
//#define mod 1000000007
#define NCONS 100001

using namespace std;


int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	int x, a, b; cin >> x >> a >> b;
	if (abs(x - a) < abs(x - b))
		cout << 'A';
	else
		cout << 'B';
	
	return 0;
}

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

using namespace std;

const int mod = 1000000007;

bool comp(long long &a, long long &b) { return abs(a) < abs(b); }

long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

long long mod_inverse(long long x, long long mod) { return mod_pow(x, mod - 2, mod); }

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

  vector<long long> A(N);
  vector<long long> pA, nA;
  int cnt_p = 0, cnt_n = 0, cnt_z = 0;

  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] == 0) {
      cnt_z++;
    }
    if (A[i] >= 0) {
      pA.push_back(A[i]);
      cnt_p++;
    } else {
      nA.push_back(A[i]);
      cnt_n++;
    }
  }

  // 答えが負 or 0 になる場合
  if ((cnt_n == N && K % 2 == 1) || (N == K && cnt_n % 2 == 1)) {
    long long ans = 1;
    // 絶対値が小さい方からK個選ぶ
    sort(A.begin(), A.end(), comp);
    for (int i = 0; i < K; i++) {
      ans = (ans * A[i]) % mod;
    }

    ans = (ans + mod) % mod;
    cout << ans << "\n";
    return 0;
  }

  sort(pA.begin(), pA.end(), greater<long long>());
  sort(nA.begin(), nA.end());

  // 絶対値が大きい方からK個選ぶ
  long long ans = 1;
  sort(A.rbegin(), A.rend(), comp);

  int cnt_pA = 0, cnt_nA = 0;
  for (int i = 0; i < K; i++) {
    if (A[i] >= 0) {
      cnt_pA++;
    } else {
      cnt_nA++;
    }
    ans = (ans * A[i]) % mod;
  }
  ans = (ans + mod) % mod;

  // 答えが負になるとき
  if (cnt_nA % 2 == 1) {
    if (cnt_nA == cnt_n) { // minus は全部使ってる (minus を減らすしかない)
      ans = (ans * mod_inverse(nA[cnt_nA - 1], mod)) % mod;
      ans = (ans + mod) % mod;
      ans = (ans * pA[cnt_pA]) % mod;
    } else if (cnt_pA == cnt_p) { // plus は全部使ってる
      ans = (ans * mod_inverse(pA[cnt_pA - 1], mod)) % mod;
      ans = (ans + mod) % mod;
      ans = (ans * nA[cnt_nA]) % mod;
    } else {
      if (cnt_pA == 0) {
        ans = (ans * mod_inverse(nA[cnt_nA - 1], mod)) % mod;
        ans = (ans + mod) % mod;
        ans = (ans * pA[0]) % mod;
      } else {
        long long px = pA[cnt_pA - 1], py = pA[cnt_pA];
        long long nx = nA[cnt_nA - 1], ny = nA[cnt_nA];

        if (px * py > nx * ny) {
          ans = (ans * mod_inverse(nA[cnt_nA - 1], mod)) % mod;
          ans = (ans + mod) % mod;
          ans = (ans * pA[cnt_pA]) % mod;
        } else {
          ans = (ans * mod_inverse(pA[cnt_pA - 1], mod)) % mod;
          ans = (ans + mod) % mod;
          ans = (ans * nA[cnt_nA]) % mod;
        }
      }
    }
  }

  cout << (ans + mod) % mod << "\n";

  return 0;
}

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

using namespace std;
using ll = long long;


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

	int ans = 0, past = 0;
	for(int i = 1; i <= n; i++) {
		if(n - i <= past) {
			ans = i;
			break;
		}
		past += i;
	}
	for(int i = ans; i >= 1; i--) {
		if(n - i >= 0) {
			cout << i << endl;
			n -= i;
		}
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = (int)(n)-1; 0 <= i; i--)
#define rrep1(i, n) for (int i = (int)(n); 1 <= i; i--)

#define each(it, c) \
    for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define all(obj) (obj).begin(), (obj).end()

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x) cerr << #x << " = " << (x) << endl;

#define endl "\n"

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 lint;

using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, t, a;
    cin >> n >> t >> a;
    t *= 1000;
    a *= 1000;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int ans = 0;
    int min = 1e8;
    rep(i, n) {
        int tmp = t - h[i] * 6;
        if (abs(a - tmp) < min) {
            ans = i;
            min = abs(a - tmp);
        }
    }
    cout << ans + 1 << endl;
}

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

using namespace std;

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

	string s;

	cin >> s;

	if(s.length()==3)
	{
		reverse(s.begin(),s.end());
	}

	cout << s << '\n';
	
	return 0;
}

Measured memory_bytes: 3580
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;

vector<vector<int> > g(100001);
int vis[100001];

void dfs(int node)
{
	vis[node] = 1;
	
	for(int i = 0;i<g[node].size();i++)
	{
		int y = g[node][i];
		
		if(vis[y]) continue;
		dfs(y);
	}	
}

int main()
{
	int n,m;cin>>n>>m;
	
	for(int i = 0;i<m;i++)
	{
		int x,y;cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);	
	}
	
	int count = 0;
	
	for(int i = 1;i<=n;i++)
	{
		if(vis[i]) continue;
		
		count++;
		
		dfs(i);	
	}	
	
	cout<<count-1<<endl;
	
	return 0;
}

Measured memory_bytes: 9928
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);

int main()
{
    int N, K, Q;
    cin >> N >> K >> Q;

    vector<int> c(N, 0);
    int t;
    for (int i = 0; i < Q; i++) {
        cin >> t;
        c[t - 1]++;
    }

    for (int i = 0; i < N; i++) {
        if (K - Q + c[i] > 0) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  int R,G;
  cin >> R >> G;
  int ans = 1;
 for (int i=0; i<R; i++) {
   if (ans < G) {
     ans *= 2;
   }
   else {
     ans += G;
   }
 }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

// Segment Tree
template <typename T>
class SegTree {
public:
  SegTree(ll _n) {
    n = 1;
    while (n < _n) { n *= 2; }
    dat = vector<T>(2 * n - 1, 0);
  }

  // void update(ll k, T a) {
  //   k += n - 1;
  //   dat[k] = a;
  //   while (k > 0) {
  //     k = (k - 1) / 2;
  //     dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2];
  //   }
  // }

  void add(ll k, T a) {
    k += n - 1;
    dat[k] += a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2];
    }
  }

  // Calculate the sum of [a, b)
  T query(ll a, ll b) {
    return _query(a, b, 0, 0, n);
  }

  // Calculate the sum of [a, b)
  // k is the index (dat[k]). This is matched to [l, r)
  T _query(ll a, ll b, ll k, ll l, ll r) {
    // The intersection of [a, b) and [r, l) is blank.
    if (r <= a || b <= l) { return 0; }

    if (a <= l && r <= b) {  // [r, l) is completely included in [a, b)
      return dat[k];
    } else {
      ll vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);
      ll vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);
      return vl + vr;
    }
  }

private:
  ll n; // The size of source data. The power of 2.
  vector<T> dat; // The data. The size if 2*n-1. The last n elements(dat[n..2*n-2]) are leaves(source data). The first n-1 elements are nodes.
};

// int main(int argc, char** argv) {
//   int arr[] = { 1, 3, 2, 7, 9, 11 };
//   int n = 6;
//
//   SegTree<int> st(n);
//   rep(i, n) {
//     st.add(i, arr[i]);
//   }
//
//   cout << st.query(1, 5) << endl; // 21
//   cout << st.query(0, 4) << endl; // 13
//   cout << st.query(3, 5) << endl; // 16
//
//   st.add(4, 10);
//   cout << st.query(3, 5) << endl; // 26
// }

int main(int argc, char** argv) {
  ll N;
  cin >> N;
  vector<ll> L(N);
  rep(i, N) {
    cin >> L[i];
  }
  sort(all(L)); // Now, L is sorted

  // Here, we want to calculate the count of c < a + b. c is the largest number.
  // This is calculated by BIT.
  // add(a+b, 1).
  // sum(MAXA + MAXB) - sum(c).

  ll ans = 0;
  SegTree<ll> tree(2010);
  tree.add(L[0] + L[1], 1);

  for (ll i = 2; i < N; ++i) {
    ll c = L[i];
    // For Debug
    // cout << "L["<<i<<"]: "<< L[i] << endl;
    // cout << tree.query(c+1, 2010) << endl;

    ans += tree.query(c+1, 2010); // The count of c < a + b
    rep(j, i) { // 0, 1, .. i-1.
      tree.add(L[j] + c, 1);
    }
  }

  cout << ans << endl;
}


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

int main(void){
    string s,t;
    cin >> s >> t;

    t.pop_back();

    if(s == t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3572
import java.util.*;
import java.io.*; 
import java.math.BigInteger;
import java.text.*;
//Solution Credits: Taranpreet Singh
public class Main{
    //SOLUTION BEGIN
    void solve(int TC) throws Exception{
        int x1 = ni(), y1 = ni(), x2 = ni(), y2 = ni();
        int dx = x2-x1, dy = y2-y1;
        int x3 = x2-dy, y3 = y2+dx;
        dx = x3-x2;dy=y3-y2;
        int x4 = x3-dy,y4 = y3+dx;
        pn(x3+" " + y3+" " + x4+" " + y4);
    }
    //SOLUTION ENDS
    long mod = (int)1e9+7, IINF = (long)1e18;
    final int MAX = (int)1e5+1, INF = (int)1e9, root = 3;
    DecimalFormat df = new DecimalFormat("0.00000000");
    double PI = 3.141592653589793238462643383279502884197169399375105820974944, eps = 1e-8;
    static boolean multipleTC = false, memory = true;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        int T = (multipleTC)?ni():1;
        //Solution Credits: Taranpreet Singh
        for(int i = 1; i<= T; i++)solve(i);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n(){return in.next();}
    String nln(){return in.nextLine();}
    int ni(){return Integer.parseInt(in.next());}
    long nl(){return Long.parseLong(in.next());}
    double nd(){return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{    
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }   
            return str;
        }
    }
}

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

using i64 = int64_t;

constexpr int INF = 1e9 + 100;

struct Edge{
    int from, to, c;
};

struct State{
    int num, tm;
    bool operator<(const State &rhs)const{
        return tm > rhs.tm;
    }
};

using Graph = vector<vector<Edge>>;

int main(){
    int n, m;
    cin >> n >> m;
    Graph graph(n+1, vector<Edge>());
    for(int i=0;i<m;++i){
        int a, b, c;
        cin >> a >> b >> c;
        graph[a].push_back((Edge){a, b, c});
    }

    vector<int> mini(n+1, INF);
    mini[1] = 0;
    priority_queue<State> que;
    que.push((State){1, 0});
    int ans = -1;
    while(!que.empty()){
        auto cur = que.top(); que.pop();
        if(mini[cur.num] < cur.tm)continue;
        for(auto e: graph[cur.num]){
            if(cur.tm > e.c)continue;
            if(e.to == n){
                ans = max(ans, e.c);
            }else{
                if(e.c >= mini[e.to])continue;
                mini[e.to] = e.c;
                que.push((State){e.to, e.c});
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9004
using System;
using System.Collections.Generic;
using System.Runtime;
using System.Numerics;
using System.Linq;

namespace ABC153
{
    class B
    {
        static int[] table;
        static int[] hn;
        static int[] a,b;
        static void Main(string[] args)
        {
            int ans = int.MaxValue;
            hn = Console.ReadLine().Split().Select(int.Parse).ToArray();
            table = new int[hn[0]+10000];
            a = new int[hn[1]]; b = new int[hn[1]];
            table[0] = 0;
            for (int i = 0; i < hn[1]; i++)
            {
                int[] ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
                a[i] = ab[0];b[i] = ab[1];
            }
            for (int i = 1; i < hn[0]+10000; i++)
            {
                int min = int.MaxValue;
                for (int j = 0; j < hn[1]; j++)
                {
                    if (i - a[j] <= 0) { min = min > b[j] ? b[j] : min; }
                    else
                    {
                        min = min > table[i-a[j]]+b[j] ? table[i - a[j]] +b[j] : min;
                    }
                }
                table[i] = min;
                if (hn[0] <= i) { ans = ans > table[i] ? table[i] : ans; }
            }
            Console.WriteLine(ans);
        }
    }
}


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

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

  stack<int> s;
  for (char c : str) {
    if (!s.empty() && c == 'T' && s.top() == 'S') {
      s.pop();
    } else {
      s.push(c);
    }
  }
  cout << s.size() << endl;

  return 0;
}

Measured memory_bytes: 1284
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int h, w; cin >> h >> w;
	int ans = INF;
	rep(i, 2) {
		rep(j, w - 1) {
			int a = (j + 1)*h;
			int b = (h / 2)*(w - j - 1);
			int c = ((h + 1) / 2)*(w - j - 1);
			chmin(ans, max({ a,b,c }) - min({ a,b,c }));
		}
		swap(h, w);
	}
	chmin(ans, ((h + 2) / 3)*w - (h / 3)*w);
	chmin(ans, ((w + 2) / 3)*h - (w / 3)*h);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, m, w, ans = 0, count = 0;
  map<lli, lli> pr;
  cin >> n;
  vlli d(n);
  rep(i, 0, n)
  {
    cin >> d[i];

    count = pr[d[i]];

    count++;
    pr[d[i]] = count;
    count = 0;
  }

  // for (auto x : pr)
  // {
  //   cout << "before: " << x.first << " : " << x.second << endl;
  // }

  cin >> m;
  vlli t(m);
  rep(i, 0, m)
  {
    cin >> t[i];
    count = pr[t[i]];
    count--;
    pr[t[i]] = count;
    if (count < 0)
    {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  // for (auto x : pr)
  // {
  //   cout << x.first << " : " << x.second << endl;
  // }
}

Measured memory_bytes: 18664
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {

    int N;
    int[] a;

    private int calc(int max,int b) {
        return Math.min(Math.abs(max / 2 - b),Math.abs((max+1) / 2 - b));
    }

    private void solve() {
        N = nextInt();
        a = new int[N];
        for(int i = 0;i < N;i++) {
            a[i] = nextInt();
        }

        Arrays.sort(a);

        int max = a[N-1];

        int minIndex = 0;
        for(int i = 0;i < N-1;i++) {
            int min = calc(max,a[i]);

            if (min < calc(max,a[minIndex])) {
                minIndex = i;
            }
        }

        out.println(a[N-1] + " " + a[minIndex]);
    }
    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

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

Measured memory_bytes: 36840
function main(arg) {
  const inputLines = arg.trim().split('\n');
  const n = inputLines[0].split('');
  let ans = '';
  n.forEach((c) => {
    if (c === '1') {
      ans += '9';
    } else {
      ans += '1';
    }
  });
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 30596
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		long[][] in = new long[n][3];
		for (int i = 0; i < n; i++) {
			in[i][0] = sc.nextLong();
			in[i][1] = sc.nextLong();
			in[i][2] = sc.nextLong();
		}
		long[] a = new long[n];
		long max = 0, sum = 0;;
		String format = "%".concat(String.valueOf(3)).concat("s");
		String s;
		long h1,h2,h3;
		for (int i = 0; i < 8; i++) {
			s = String.format(format, Integer.toString(i,2)).replace(' ', '0');
			h1 = s.charAt(0)=='0'?1:-1;
			h2 = s.charAt(1)=='0'?1:-1;
			h3 = s.charAt(2)=='0'?1:-1;
			for (int j = 0; j < n; j++) {
				a[j] = h1*in[j][0]+h2*in[j][1]+h3*in[j][2];
			}
			Arrays.parallelSort(a);
			for (int j = 0; j < m; j++) {
				sum += a[n-j-1];
			}
			max = Math.max(max,sum);
			sum = 0;
		}
		System.out.println(max);
		sc.close();
	}
}

Measured memory_bytes: 27068
from collections import defaultdict
import sys
N=int(input())
A=[int(i) for i in input().split()]
dd=defaultdict(int)
for a in A:
    if a%4==0:
        dd[4]+=1
    elif a%2==0:
        dd[2]+=1
    else:
        dd[1]+=1
a=dd[1]
b=dd[2]
c=dd[4]
if a>c:
    if N%2==1 and a==c+1 and b==0:
        print('Yes')
        sys.exit()
    print('No')
    sys.exit()
print('Yes')

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


int main(){

int a,b,c,d,n,count;

while(cin >> n){
for(a=0;a<10;a++)
for(b=0;b<10;b++)
for(c=0;c<10;c++)
for(d=0;d<10;d++){
if(a+b+c+d==n)count++;
}
cout << count << endl;
a=0;b=0;c=0;d=0;count=0;
}
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<P> cb(m);
    rep(i,m)  cin >> cb[i].second >> cb[i].first;
    sort(ALL(cb), greater<P>());
    sort(ALL(a)); 
    int ni = 0;
    rep(i,n){
        if(ni < m && a[i] < cb[ni].first){
             a[i] = cb[ni].first;
             cb[ni].second--;
        }
        if(ni < m && cb[ni].second == 0) ni++;
    }
    ll ans = 0;
    rep(i,n) ans+=a[i];
    cout << ans << endl;
    
    return 0;
}

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

int cmp(const void* p, const void* q) {
	return *(int*)p - *(int*)q;
}

int main(void) {
	int n;
	int a[100000] = { 0 };
	int bit[3][300] = { 0 };
	int max = 0, mid = 1000000001, min = 0;
	int max_cnt = 0, mid_cnt = 0, min_cnt = 0;
	int temp;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	if (n % 3) {
		for (int i = 0; i < n; i++) {
			if (a[i]) {
				printf("No");
				break;
			}
			if (i == n - 1) {
				printf("Yes");
			}
		}
	}
	else {
		qsort(a, n, sizeof(int), cmp);
		min = a[0];
		for (int i = 0; i < n; i++) {
			if (min == a[i])min_cnt++;
			else if (min < a[i] && a[i] < mid) {
				mid = a[i], mid_cnt++;
			}
			else if (mid == a[i])mid_cnt++;
			else if (mid < a[i]) {
				max = a[i];
				max_cnt++;
			}
			else if (max == a[i])max_cnt++;
		}
		//printf("min=%d  mid=%d max=%d\n", min, mid, max);
		//printf("min_cnt=%d  mid_cnt=%d max_cnt=%d\n", min_cnt, mid_cnt, max_cnt);
		if (min == 0 && max == 0) {
			if (min_cnt == n || min_cnt *2 ==  mid_cnt) printf("Yes");
			else printf("No");
		}
		else {
			if (min_cnt == mid_cnt && mid_cnt == max_cnt) {
				temp = min;
				for (int j = 0; temp != 0; j++) {
					bit[0][j] = temp % 2;
					temp /= 2;
				}
				temp = mid;
				for (int j = 0; temp != 0; j++) {
					bit[1][j] = temp % 2;
					temp /= 2;
				}
				temp = max;
				for (int j = 0; temp != 0; j++) {
					bit[2][j] = temp % 2;
					temp /= 2;
				}
				for (int i = 0; i <= floor(log2(max)); i++) {
					temp = 0;
					for (int j = 0; j < 3; j++) {
						temp += bit[j][i];
					}
					if (temp % 2) {
						printf("No");
						break;
					}
					else if (i == floor(log2(max))) {
						printf("Yes");
					}
				}
			}
			else printf("No");
		}
	}
	return 0;
}


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

using namespace std;

string a, b;
int dp[3010][3010];
stack<char> st;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	memset(dp, 0, sizeof(dp));
	cin >> a >> b;
	int sza = a.length();
	int szb = b.length();
	for(int i = 1; i <= sza; i++) {
		for(int j = 1; j <= szb; j++) {
			if(a[i-1] == b[j-1]) {
				dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
				dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
			}
			else {
				dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
			}
		}
	}
	int index = dp[sza][szb];
    char lcs[index+1]; 
    lcs[index] = '\0';
   
    int i = sza, j = szb; 
    while (i > 0 && j > 0) 
    {
       if (a[i-1] == b[j-1]) 
       { 
           lcs[index-1] = a[i-1];
           i--; j--; index--;
       }  
       else if (dp[i-1][j] > dp[i][j-1]) 
          i--; 
       else
          j--; 
    } 
	cout << lcs << endl;
}



Measured memory_bytes: 35712
#include <cstdio>

int w, money;

int main(){
	while(scanf("%d", &w)){
		if(w == -1) break;
		money = 4280-1150;
		if(w > 30) money -= 10*125+10*140+(w-30)*160;
		else if(w > 20) money -= 10*125+(w-20)*140;
		else if(w > 10) money -= (w-10)*125;
		printf("%d\n", money);
	}
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double

ll modpower(ll a, ll r, ll mod){ //a^r
    ll x = 1;
    a %= mod;
    while (r > 0) {
        if (r & 1) x = x * a % mod;
        r >>= 1;
        a = a * a % mod;
    }
    return x;
}

ll modinv(ll a, ll mod){
    return modpower(a, mod-2, mod);
}

vector<ll> fact;
vector<ll> invfact;

void set_fact(ll n, ll mod){
    fact.resize(n+1, 1);
    invfact.resize(n+1, 1);
    for (ll i = 2; i <= n; i++) {
        fact[i] = fact[i-1] * i % mod;
    }
    invfact[n] = modinv(fact[n], mod);
    for (ll i = n-1; i >= 2; i--) {
        invfact[i] = invfact[i+1] * (i+1) % mod;
    }
    return;
}

ll comb(ll n, ll k, ll mod) {
    if (k > n || k < 0) return 0;
    if (k == n || k == 0) return 1;
    return fact[n] * invfact[n-k] % mod * invfact[k] % mod;
}
int main() {
    int H, W, N;
    cin >> H >> W >> N;
    vector<pair<ll, ll>> block(N);
    for (int i = 0; i < N; i++) cin >> block[i].first >> block[i].second;
    sort(block.begin(), block.end());
    
    ll mod = 1e9+7;
    set_fact(200005, mod);
    vector<ll> dp(N, 0);
    for (int i = 0 ; i < N; i++) {
        ll x = block[i].first, y = block[i].second;
        dp[i] += mod-comb(x+y-2, y-1, mod);
        for (int j = 0; j < i; j++) {
            if (i == j) continue;
            ll ax = block[j].first, ay = block[j].second;
            if (ax <= x && ay <= y) dp[i] += mod-comb(x-ax+y-ay, x-ax, mod)*dp[j]%mod;
        }
        dp[i] %= mod;
    }
    ll ans = comb(H+W-2, H-1, mod);
    for (int i = 0; i < N; i++) ans += dp[i] * comb(H+W-block[i].first-block[i].second, H-block[i].first, mod) % mod;
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6444
while(True):
 a,op,b=raw_input().split()
 if(op=="?"):break
 if(op=="+"):
  print int(a)+int(b)
 if(op=="-"):
  print int(a)-int(b)
 if(op=="*"):
  print int(a)*int(b)
 if(op=="/"):
  print int(a)/int(b)

Measured memory_bytes: 4216
#
# abc064 a
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 3 2"""
        output = """YES"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2 3 4"""
        output = """NO"""
        self.assertIO(input, output)


def resolve():
    r, g, b = map(int, input().split())
    x = 100*r + 10*g + b
    ans = "NO"
    if x % 4 == 0:
        ans = "YES"
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16204
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;


typedef long long i64;
const int inf = (int)1.05e9;


int main()
{
	int a, b, c;
	int x, y;

	scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);

	int ans = inf;

	ans = x * a + y * b;

	for(int z = 0; z <= 2 * max(x, y) + 5; z += 2) {

		int rx = max(0, x - z / 2);
		int ry = max(0, y - z / 2);

		int t = rx * a + ry * b + z * c;
		ans = min(ans, t);
	}

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

	return 0;
}

/* waffle */


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
using namespace std;
const double pi = acos(-1);
const double eps = 1e-10;


template<class T>
bool equals(T a,T b){ return fabs((a)-(b)) < eps; }

struct Point{
    double x, y;
    Point(){}
    Point(double x, double y) : x(x), y(y){}
    Point operator + (Point p) { return Point(x+p.x, y+p.y); }
    Point operator - (Point p) { return Point(x-p.x, y-p.y); }
    Point operator * (double a) { return Point(x*a, y*a); }
    Point operator / (double a) { return Point(x/a, y/a); }
    double norm() {return x*x+y*y;}
    double abs() {return sqrt(norm());}

    bool operator < (const Point &p) const {
        return x!=p.x ? x<p.x : y<p.y;
    }
    bool operator == (const Point &p) const {
        return fabs(x-p.x) < eps && fabs(y-p.y) < eps;
    }
};

bool sort_x(Point a, Point b){ return !equals(a.x,b.x)?a.x<b.x:a.y<b.y; }
bool sort_y(Point a, Point b){ return !equals(a.y,b.y)?a.y<b.y:a.x<b.x; }

typedef Point Vector;
typedef vector<Point> Polygon;
double norm(Vector a) { return a.x*a.x+a.y*a.y; }
double abs(Vector a) { return sqrt(norm(a)); }
double dot(Vector a, Vector b) { return a.x*b.x+a.y*b.y; }
double cross(Vector a, Vector b) { return a.x*b.y-a.y*b.x; }

struct Segment {
    Point p1, p2;
    Segment(){}
    Segment(Point p1, Point p2):p1(p1),p2(p2){}
};
typedef Segment Line;

struct Circle{
    Point c;
    double r;
    Circle(){}
    Circle(Point c, double r) : c(c),r(r) {}
};

bool isOrthogonal(Vector a, Vector b){
    return equals(dot(a,b), 0.0);
}
bool isOrthogonal(Point a1, Point a2, Point b1, Point b2){
    return isOrthogonal(a1-a2, b1-b2);
}
bool isOrthogonal(Segment s1, Segment s2){
    return equals(dot(s1.p2-s1.p1, s2.p2-s2.p1),0.0);
}

bool isParallel(Vector a, Vector b){
    return equals(cross(a,b), 0.0);
}
bool isParallel(Point a1, Point a2, Point b1, Point b2){
    return isParallel(a1-a2, b1-b2);
}
bool isParallel(Segment s1, Segment s2){
    return equals(cross(s1.p2-s1.p1, s2.p2-s2.p1),0.0);
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll q;
    cin>>q;
    rep(i,q){
        double x0,y0,x1,y1,x2,y2,x3,y3;
        cin>>x0>>y0>>x1>>y1>>x2>>y2>>x3>>y3;
        Point p0(x0,y0),p1(x1,y1),p2(x2,y2),p3(x3,y3);
        if(isParallel(p0,p1,p2,p3)) cout<<2<<endl;
        else if(isOrthogonal(p0,p1,p2,p3)) cout<<1<<endl;
        else cout<<0<<endl;
    }
    return 0;
}



Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long n, ans = 0; cin >> n;
	if(n & 1) return cout << 0 << endl, 0;
	n /= 2;
	while(n) ans += n / 5, n /= 5;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	char s[8];
	scanf("%s",s);
	if(s[0]=='S'){
		printf("Cloudy");
	}
	else if(s[0]=='C'){
		printf("Rainy");
	}
	else{
		printf("Sunny");
	}
return(0);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<tuple<ld, ld, ld>>stars;
		for (int i = 0; i < N; ++i) {
			ld x, y, z; cin >> x >> y >> z;
			ld dis = sqrt(x*x + y*y + z*z);
			x /= dis; y /= dis; z /= dis;
			stars.push_back(make_tuple(x, y, z));
		}
		int T; cin >> T;
		vector<tuple<ld, ld, ld, ld>>eyes;
		for (int i = 0; i < T; ++i) {
			ld x, y, z, theta; cin >> x >> y >> z >> theta;
			ld dis = sqrt(x*x + y*y + z*z);
			x /= dis; y /= dis; z /= dis;
			eyes.push_back(make_tuple(x, y, z, theta));
		}
		vector<int>cansee(N);
		for (int i = 0; i < N; ++i) {
			ld sx, sy, sz;
			tie(sx, sy, sz) = stars[i];

			for (int j = 0; j < T; ++j) {
				ld ex, ey, ez, theta;
				tie(ex, ey, ez, theta) = eyes[j];
				ld num = sx*ex + sy*ey + sz*ez;
				ld num2 = cos(theta);
				if (cos(theta)<  sx*ex + sy*ey + sz*ez)cansee[i] = true;
			}

		}
		int ans = count(cansee.begin(), cansee.end(), 1);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3340
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long n;
long a[100005];
long gcd_list[2][100005];//[0]:less, [1]:over
long gcd_all;

//gcd
long gcd(long num1, long num2){
	if(num2 > num1){
		std::swap(num1, num2);
	}
	if(num2 == 0){
		return num1;
	}else{
		return gcd(num2, num1 % num2);
	}
}

int main(){
    scanf("%ld", &n);
    for(int i = 0; i < n; i++){
        scanf("%ld", a+i);
    }
    gcd_all = a[0];
    for(int i = 0; i < n; i++){
        gcd_all = gcd(gcd_all, a[i]);
    }
    gcd_list[0][0] = a[0];
    for(int i = 1; i < n; i++){
        gcd_list[0][i] = gcd(gcd_list[0][i-1], a[i-1]);
    }
    gcd_list[1][n-1] = a[n-1];
    for(int i = n-2; i >= 0; i--){
        gcd_list[1][i] = gcd(gcd_list[1][i+1], a[i+1]);
    }
    long ans = 0;
    for(int i = 0; i < n; i++){
        long res;
        if(i == 0){
            res = gcd_list[1][0];
        }else if(i == n-1){
            res = gcd_list[0][n-1];
        }else{
            res = gcd(gcd_list[0][i], gcd_list[1][i]);
        }
        ans = std::max(ans, res);
        //printf("  %d %ld\n", i, res);
    }
    printf("%ld\n", ans);
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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; }

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

bool isp(LL p) {
    if (p == 2) return true;
    if (p < 3) return false;
    if (p % 2 == 0) return false;
    for (LL i = 3; i * i <= p; i += 2) {
        if (p % i == 0) return false;
    }
    return true;
}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    LL X; cin >> X;
    while(!isp(X)){
        X++;
    }
    cout << X << endl;

}

Measured memory_bytes: 256
#include <stdio.h>


int main(void){
    int a, b, c;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if(c >= a && c <= b){
        
        printf("Yes\n");
    
    }else{
        printf("No\n");
    }
    
    
    
    return 0;
    
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <map>
#include <sstream>
#define ll long long
using namespace std;
// ver..(1.1)
string ent="\n";
string space=" ";
int main(){
   ios_base::sync_with_stdio(false);
   int n;
   cin >> n;

   int x;
   int cnt=0;
   int is_being_searched=1;
   for(int i=1;i<=n;i++){
      cin >> x;
      if(x==is_being_searched){
         cnt++;
         is_being_searched++;
      }
   }

   (cnt!=0)? cout << (n-cnt):cout << (-1);
   cout << ent;
}
/*
5 25

kpk=25
fpb=5

3 21

kpk=21
fpb=3

*/

Measured memory_bytes: 256