akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define tr(container, it) \
    for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const double pi = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;

ll div2(ll a){
    int s=0;
    while(a % 2 ==0){
        a/=2;s++;
    }
    return s;
}

void _(){
    int n;
    cin >> n;
    ll a,z=0;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        z+=div2(a);
    }
    cout << z;
}



int main() {
#if __MINGW32__
    freopen("E:\\Workspace\\Desktop\\cpp\\IO\\Input.txt", "r", stdin);
    freopen("E:\\Workspace\\Desktop\\cpp\\IO\\Output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}








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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  int e = 0;
  int s = 0;
  int es = 0;
  int ans = 0;
  for(int i=0;i<n;i++) {
    string str;
    cin>>str;
    int m = str.length();
    if(str[0] == 'B' && str[m-1] == 'A') {
      es++;
    } else if(str[0] == 'B') {
      s++;
    } else if(str[m - 1]=='A') {
      e++;
    }
    for(int j=1;j<m;j++) {
      ans += str[j-1]=='A' && str[j] == 'B';
    }
  }
  int dlt = min(s,e);
  if(dlt==0) {
    ans += max(0, es - (max(e,s) == 0));
  } else {
    ans += dlt;
    ans += es;
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    import java.util.Comparator
    val W, H = ni()
    val P = na(W)
    val Q = na(H)

    case class Path(v: Int, x: Int)
    val A = Array.ofDim[Path](W + H)
//    val A = new java.util.PriorityQueue[Path](H + W, new Comparator[Path] {
//      override def compare(o1: Path, o2: Path): Int = Integer.compare(o1.v, o2.v)
//    })
    rep(W)(i => A(i) = Path(P(i), 0))
    rep(H)(i => A(i + W) = Path(Q(i), 1))
    radixSort2(A)(_.v)
//    Sorting.quickSort(A)(Ordering.by(_.v))

    var ans = 0L
    val c = Array[Long](H + 1, W + 1)
//    while(!A.isEmpty) {
    rep(A.length) { i =>
      val p = A(i)
//      val p = A.poll()
      ans += c(p.x) * p.v
      c(p.x ^ 1) -= 1
    }

    out.println(ans)
  }

  def radixSort2[A: ClassTag](as: Array[A])(f: A => Int): Array[A] = {
    val n = as.length
    val xs = Array(as, new Array[A](n))
    val b = Array.ofDim[Int](65537)

    def step(k: Int, x: Int): Unit = {
      rep(n){ i => b(1 + (f(xs(x)(i)) >>> k & 0xffff)) += 1 }
      rep(65536, 1){ i => b(i) += b(i - 1) }
      rep(n){ i =>
        val j = f(xs(x)(i)) >>> k & 0xffff
        xs(x ^ 1)(b(j)) = xs(x)(i)
        b(j) += 1
      }
    }

    step(0, 0)
    java.util.Arrays.fill(b, 0)
    step(16, 1)

    as
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int): Array[Int] = map(n)(_ => ni())
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def rep(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def rep_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i))
    res
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    rep(as.length)(i => s += as(i))
    s
  }
}

Measured memory_bytes: 44556
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
using namespace std;
using ll = long long;
int main()
{
    ll a[3];
    cin >> a[0] >> a[1] >> a[2];
    for (int i = 0; i < 3; ++i)
    {
        if (a[i] & 1)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    if (a[0] == a[1] && a[1] == a[2])
    {
        cout << -1 << endl;
        return 0;
    }

    ll ans = 0, q[3];
    bool gok = true;
    while(1)
    {
        for (int i = 0; i < 3; ++i)
        {
            q[i] = a[i] / 2;
        }
        for (int i = 0; i < 3; ++i)
        {
            a[i] = q[(i + 1) % 3] + q[(i + 2) % 3];
        }
        ++ans;
        if (a[0] & 1 || a[1] & 1 || a[2] & 1) break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val (a, b) = readListOfInt()
    println(if((a*b) % 2 == 1) "Odd" else "Even")
    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    val rtn = v.map { it.toList() }.toList()
    return rtn 
}

fun gcd(a: Long, b: Long): Long = 
if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
if(b==0L) a else gcd(b, a % b)

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 37944
#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define loop(i,a,n) for(ll i=a;i<n;++i)
#define revloop(i,a,b) for(ll i=a;i>=b;--i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1000000000000000000
#define MOD 100000000 

void func()
{
   ll n;
   cin>>n;
   ll a[n+1];
   loop(i,1,n+1) cin>>a[i];
   ll ans=0;
   loop(i,1,n+1){
    if(i%2==1 && a[i] % 2==1){
        ++ans;
    }
   }
   cout<<ans<<"\n";
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w" , stdout);
    #endif
 
    ll t=1;
    //cin>>t;
    while(t--)
    {
        func();
    }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



int main()
{
        ll N;
        cin >> N;
        N *= 2;
        vll L(N);
        rep(i, 0, N) cin >> L[i];
        sort(all(L));
        ll ans = 0;
        rep(i, 0, N) {
                ans += L[i];
                ++i;
        }

        cout << ans << endl;
}


Measured memory_bytes: 3632
package main

import "fmt"

func main(){
	var n,sum int;
	fmt.Scan(&n)
	a := make([]int ,n)
	for i := 0 ; i < n ; i++ {
		fmt.Scan(&a[i])
		sum += a[i]
	}
	p := sum / n
	var min_a,min_b int
	for i := 0; i < n; i++ {
		min_a += (a[i]-p)*(a[i]-p)
		min_b += (a[i]-p-1)*(a[i]-p-1)
	}
	if min_a > min_b {
		fmt.Println(min_b)
	} else {
		fmt.Println(min_a)
	}
}


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

void solve()
{
    int k,a,b;
    cin>>k>>a>>b;

    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
            {
                cout<<"OK";
                return ;
            }

    }
    cout<<"NG";

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    solve();
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



map<char,char> ma;

int main() {
    int n, m;
    char x, y, s;
    while (cin >> n) {
        if (n == 0) break;
        ma.clear();
        for (int i = 0; i < n; ++i) {
            cin >> x >> y;
            ma[x] = y;
        }
        string str = "";
        cin >> m;
        for (int i = 0; i < m; ++i) {
            cin >> s;
            if (ma.count(s)) str += ma[s];
            else str += s;
        }
        cout << str << endl;
    }
    return 0;
}


Measured memory_bytes: 1340
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;

typedef long long int ll;
typedef pair<ll,ll> pp;
typedef long double ld;
typedef vector<pp> vpl;
//typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 

 
const ll N = 1000004;
const ll mod = 998244353;
const long long int inf = 10000000000;

#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
 
const ld pi = 3.14159265359;

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

 
void fastIO(void);
void decimal(int);
inline ll modmulti(ll, ll);
inline ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);




int main(){
	fastIO();
	ll n;
	set<string> s;
	string t;
	cin>>n;
	while(n--){
		cin>>t;
		s.insert(t);
	}
	cout<<s.size()<<endl;
}
	


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
inline ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
inline ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}

Measured memory_bytes: 19172
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 101;
int pref[N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    string s;
    cin >> s;
    string t;
    for (char c : s)
        if (c != 'A')
            t += c;
    if (t != "KIHBR") {
        cout << "NO" << endl;
        exit(0);
    }   
    vector <int> p;
    for (int i = 0; i < s.size(); ++i)
        if (s[i] != 'A')
            p.app(i);
    for (int i = 0; i < s.size(); ++i)
        pref[i + 1] = pref[i] + (s[i] == 'A');
    if (pref[p[0]] > 1 || pref[p[1]] - pref[p[0]] > 0 || pref[p[2]] - pref[p[1]] > 0 || pref[p[3]] - pref[p[2]] > 1 || pref[p[4]] - pref[p[3]] > 1 || pref[s.size()] - pref[p[4]] > 1) {
        cout << "NO";
    }   
    else {
        cout << "YES";
    }   
    cout << endl;
}   

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

typedef long long ll;
typedef long double ld;

#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)

bool plus_one(vector<int> &v){
  int N = v.size();
  
  int i = 0; v.at(i) ++;
  while(v.at(i) > 1 && i < N){
    v.at(i) = 0;
    v.at(i+1)++;
    i++;
    
    if(i==N-1){
      if(v.at(i)>1){
        return false;
        break;
      }
      return true;
      break;
    }
  }
  
  return true;
}

int main(){  
  int N, M;
  cin >> N >> M;
  
  vector<int> k(M);
  vector<vector<int>> s(10, vector<int>(10, -1));
  
  rep(i, M){
    cin >> k.at(i);
    rep(j, k.at(i)){
      cin >> s.at(i).at(j);
    }
  }
  
  vector<int> p(M);
  rep(i, M) cin >> p.at(i);
  
  vector<int> switch_state(N, 0);
  int res = 0;
  int temp = 0;  //onになっているスイッチの数を各電球に対してカウント
  int temp_ok = 1;
  bool state = true;
  
  while(state){
    rep(i, M){
      temp = 0;
      temp_ok = 1;
      rep(j, k.at(i)){
        if(s.at(i).at(j) > -1){
          if(switch_state.at(s.at(i).at(j) - 1) == 1) temp++;
        }
      }
      if(temp%2 != p.at(i)) temp_ok *= 0;
      if(temp_ok == 0) break;
    }
    if(temp_ok == 1) {
      res++;
      //rep(k, N) cout << switch_state.at(k) << " ";
      //cout << endl;
    }
    //rep(k, N) cout << switch_state.at(k) << " ";
    //cout << endl;      
    state = plus_one(switch_state);
  }
  
  cout << res;
  
  

}

Measured memory_bytes: 256
#include <math.h>
#include <bits/stdc++.h>
#include <deque>
#define ll long long
#define l long double
#define pi 3.14159265358979323846
#define mod 1000000007
#define val 1000000000000000000
using namespace std;
int main()
{
    ll a,b;
    cin>>a>>b;
    ll s=max(a+b,max(a-b,a*b));
    cout<<s<<endl;
}

Measured memory_bytes: 256
#![allow(dead_code, unused_variables, unused_macros, unused_imports)]

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input! {
        a: i32,
        b: i32,
        c: i32,
    }

    println!("{}", std::cmp::min(c, b / a));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,i,j,k;cin >> n;
  int a[n+1] = {};
  for(i=1;i<=100;i++){
    for(j=1;j<=100;j++){
      for(k=1;k<=100;k++){
        if(i*i+j*j+k*k+i*j+i*k+j*k <= n) a[i*i+j*j+k*k+i*j+i*k+j*k]++;
      }
    }
  }
  for(i=1;i<=n;i++) cout << a[i] << "\n";
}

Measured memory_bytes: 3476
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>

using ll = long long;
using namespace std;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const ll MOD = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
const double INF3 = 900000000000000;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()

int main() {
	string s, t;
	cin >> s >> t;
	int ruis[100010] = { 0 }, ruit[100010] = { 0 };
	for (int i = 0;i < s.size();i++) {
		if (s[i] == 'A')ruis[i + 1] = ruis[i] + 1;
		else ruis[i + 1] = ruis[i] + 2;
	}
	for (int i = 0;i < t.size();i++) {
		if (t[i] == 'A')ruit[i + 1] = ruit[i] + 1;
		else ruit[i + 1] = ruit[i] + 2;
	}
	int q;
	cin >> q;
	for (int i = 0;i < q;i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		int e = ruis[b] - ruis[a - 1];
		int f = ruit[d] - ruit[c - 1];
		if (abs(e - f) % 3 == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

}

Measured memory_bytes: 1664
S=input()
Q=int(input())
inv=False
head=""
last=""
for i in range(Q):
    qu=input().split(" ")
    if int(qu[0])==1:
        inv=not inv
    else:
        F=int(qu[1])
        if inv:
            F=3-F
        if F==1:
            head+=qu[2]
        else:
            last+=qu[2]

if inv:
    print(last[::-1]+S[::-1]+head)
else:
    print(head[::-1]+S+last)

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

int main() {
   int n;
   cin >> n;
   int l=1100,r=-1;
   rep(i,n){
      int a;
      cin >> a;
      l=min(a,l); r=max(a,r);
   }
   cout << r-l << endl;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(int i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(int i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(int i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    #define mp make_pair
    #define pb push_back
    #define M_PI           3.14159265358979323846  /* pi */
    typedef long double ld;
    typedef long long ll;
    typedef pair<int, int> pii;
    typedef vector<ll> vi;
    const int maxN = 70224;

    void solve(){
      string s;
      cin>>s;
      ll cnt=0;
      stack<char> st;
      rep(i,s.length()){
        if(st.empty()) st.push(s[i]);
        else if(st.top() == s[i]) st.push(s[i]);
        else {
          cnt+=2;
          st.pop();
        } 
      }
      cout<<cnt<<endl;
    }
    
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
      solve();
      return 0;
    }   

Measured memory_bytes: 512
N = int(input())
botton = []
for i in range(N):
  a = int(input())
  botton.append(a)
now = botton[0]
if now == 2:
  print(1)
else:
  flag = 0
  for i in range(N-1):
    now = botton[now-1]
    if now == 2:
      print(i+2)
      flag += 1
      break
  if flag == 0:
    print(-1)

Measured memory_bytes: 12976
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << (h2 - h1) * 60 + (m2 - m1) - k << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0])
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int a[101], dp[76];
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 2; i <= n; ++i)
	{
		for(int j = 2, k = i; j <= k; ++j)
		{
			for( ; !(k % j); k /= j, ++a[j]){}
		}
	}
	dp[1] = 1;
	for(int i = 0; i <= n; ++i)
	{
		for(int j = 75; j >= 1; --j)
		{
			for(int k = a[i]; k; --k)
			{
				if(j * (k + 1) <= 75)
				{
					dp[j * (k + 1)] += dp[j];
				}
			}
		}
	}
	printf("%d\n", dp[75]);
}

Measured memory_bytes: 256
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val t = in.readLine().toInt

    case class Elem(value: Long, cost: Long)

    def minCost(n: Long, a: Int, b: Int, c: Int, d: Int): BigInt = {
      val memo = mutable.HashMap.empty[Long, BigInt]
      memo.update(0L, 0L)
      memo.update(1L, d)

      def inner(n: Long): BigInt = {
        memo.getOrElseUpdate(n,
          List(
            BigInt(d) * n,
            BigInt(d) * (n - n / 5 * 5) + c + inner(n / 5),
            BigInt(d) * ((n + 4) / 5 * 5 - n) + c + inner((n + 4) / 5),
            BigInt(d) * (n - n / 3 * 3) + b + inner(n / 3),
            BigInt(d) * ((n + 2) / 3 * 3 - n) + b + inner((n + 2) / 3),
            BigInt(d) * (n - n / 2 * 2) + a + inner(n / 2),
            BigInt(d) * ((n + 1) / 2 * 2 - n) + a + inner((n + 1) / 2)
          ).min
        )
      }

      inner(n)
    }

    for (_ <- 0 until t) {
      val (n, a, b, c, d) = in.readLine().split("\\s+") match {
        case Array(n, a, b, c, d) => (n.toLong, a.toInt, b.toInt, c.toInt, d.toInt)
      }
      out.println(minCost(n, a, b, c, d))
    }

    out.flush()
  }
}

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

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;
using static Read;

class Program
{
    public static void Main()
    {
        var n = Int();
        var k = Int();
        var x = Int();
        var y = Int();
        int a, b;
        if(k < n)
        {
            a = k;
            b = n - k;
        }
        else
        {
            a = n;
            b = 0;
        }
        WriteLine($"{a * x + b * y}");
    }
}

static class Read
{
    static Queue<string> queue = new Queue<string>();
    static void Enqueue()
    {
        ReadLine().Split(' ').ToList().ForEach(a => queue.Enqueue(a));
    }
    public static int Int()
    {
        if(queue.Count == 0)
            Enqueue();
        return int.Parse(queue.Dequeue());
    }
    public static long Long()
    {
        if(queue.Count == 0)
            Enqueue();
        return long.Parse(queue.Dequeue());
    }
    public static double Double()
    {
        if(queue.Count == 0)
            Enqueue();
        return double.Parse(queue.Dequeue());
    }
    public static string String()
    {
        if(queue.Count == 0)
            Enqueue();
        return queue.Dequeue();
    }
    public static int[] IntArray()
    {
        return ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }
    public static long[] LongArray()
    {
        return ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
    }
    public static double[] DoubleArray()
    {
        return ReadLine().Split(' ').Select(a => double.Parse(a)).ToArray();
    }
    public static string[] StringArray()
    {
        return ReadLine().Split(' ');
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int n;
	cin>>n;
	rep(i,100000){
		if(i*108/100==n){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
	return 0;
}

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

using namespace std;

int main(){
    int d;
    int t;
    int s;
    cin >> d >> t >> s;
    string result = "No";
    if(d <= (t * s)){
        result = "Yes";
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3624
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
    ($line:expr, $name:ident, $t:tt) => {
        let $name = value!($line, $t);
    };
}

macro_rules! values_def {
    ($lines:expr, $n:expr, $name:ident, $t:tt) => {
        let $name = {
            let mut vec = Vec::new();
            for i in 0..$n {
                let mut next = $lines.next().unwrap().split_whitespace();
                vec.push(value!(next, $t));
            }
            vec
        };
    };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(t:#));
    // ?はD
    t.chars()
        .map(|x| if x == '?' { 'D' } else { x })
        .collect::<String>()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}
tests! {
    test1: "PD?D??P\n" => "PDPDPDP\n",
    test2: "P?P?\n" => "PDPD\n",
}


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

int main(){
    using namespace std;
    size_t N;
    cin >> N;
    vector<size_t> A(N), B(N), C(N), ans(N);
    copy(istream_iterator<size_t>(cin), istream_iterator<size_t>(), A.begin());
    partial_sum(A.cbegin(), A.cend() - 1, B.begin() + 1, __gcd<size_t>);
    partial_sum(A.crbegin(), A.crend() - 1, C.begin() + 1, __gcd<size_t>);
    transform(B.cbegin(), B.cend(), C.crbegin(), ans.begin(), __gcd<size_t>);
    cout << *max_element(ans.begin(), ans.end()) << endl;
    return 0;
}

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

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

    string s;
    long long count[5]{};
    for (int i = 0; i < n; i++) {
        cin >> s;
        if (s[0] == 'M') count[0]++;
        else if (s[0] == 'A') count[1]++;
        else if (s[0] == 'R') count[2]++;
        else if (s[0] == 'C') count[3]++;
        else if (s[0] == 'H') count[4]++;
    }

    long long ans = 0;
    for (int i = 0; i < 3; i++) {
        for (int j = i + 1; j < 4; j++) {
            for (int k = j + 1; k < 5; k++) {
                ans += count[i] * count [j] * count[k];
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3696
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

  std::vector<int> A;
  for (size_t i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.push_back(a);
  }

  int swap_count = 0;
  for (size_t i = 0; i < N; i++) {
    int j = N - 1;
    while (j > i) {
      if (A[j] < A[j - 1]) {
        swap(A[j], A[j - 1]);
        swap_count++;
      }
      j--;
    }
  }

  int a_last = A.back();
  A.pop_back();
  for (int a : A) {
    std::cout << a << ' ';
  }

  std::cout << a_last << '\n';

  std::cout << swap_count << '\n';

  return 0;
}



Measured memory_bytes: 3128
#include "bits/stdc++.h"

using namespace std;

void solve()
{
    int n;
    cin >> n;
    vector<int> ans(n);
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        ans[x - 1] = i;
    }
    for (int a : ans)
    {
        cout << a + 1 << ' ';
    }
    cout << endl;
}

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


Measured memory_bytes: 1152
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    long a = sc.nextLong();
    long b = sc.nextLong();
    long x = sc.nextLong();
    if (a > 0) {
      os.println(b / x - (a -  1) / x);
    } else {
      os.println(b / x + 1);
    }
  }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  string S;
  cin >> S;
  for(int i=S.size()-1;i>0;i--){
    if(i!=1 && i%2!=0)  continue;
    bool flag=true;
    for(int j=0;j<i/2;j++){
      if(S.at(j)!=S.at(i/2+j))  flag=false;
    }
    if(flag){
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    ll K, A, B;
    cin >> K >> A >> B;
    if(K <= A){
        cout << K+1 << "\n";
        return 0;
    }
    if(A+2 >= B){
        cout << K+1 << "\n";
        return 0;
    }

    ll c = (K-(A-1))/2;
    debug(c)
    debug(A-1)
    debug(c*(B-A))
    debug(K-(c*2+(A-1)))
    cout <<  (c-1)*(B-A) + B + K-(c*2+(A-1)) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
long long sales[4010];
#define foreach(r,p,it) for(r::iterator it=p.begin();it!=p.end();++it)

int main()
{
    int n;
    while(cin>>n)
    {
        if(n==0)break;
        vector<int> shains;
        shains.clear();
    
        memset(sales,0,sizeof(sales));
        long long num,tanka,kazu;

        for(int i=0;i<n;i++)
        {
            cin>>num>>tanka>>kazu;
            sales[num] += tanka*kazu;
            int f=0;
            for(int j=0;j<shains.size();j++)
            {
                if(shains[j] == num){f=1;break;}
            }
            if(f==0) shains.push_back(num);
        }
        int na = 0;
        for(int i=0;i<shains.size();i++)
        {
            //cout <<"NUMBER"<<*it <<endl;
            if(sales[shains[i]] >= 1000000){cout<<shains[i]<<endl;na=1;}
        }
        if(na==0)cout<< "NA"<<endl;
    }
    return 0;
}

Measured memory_bytes: 0
// class point	の練習（クラスの高度な実装）
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>
#include <vector>
#include <queue>


typedef long long llong;
using namespace std;

#define SMALL_LIMIT 1e-12

int main() {
	int n;
	double x1, x2, x3, x4;
	double y1, y2, y3, y4;
	double xa, ya, xb, yb;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		xa = x2 - x1; ya = y2 - y1;
		xb = x4 - x3; yb = y4 - y3;
		if (abs(xa*yb - ya * xb) < SMALL_LIMIT)cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}
 


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

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

// 分数の Ceil を求める関数
UInt Ceil(const UInt a, const UInt b) {
    if (a % b == 0) {
        return a / b;
    } else {
        return a / b + 1;
    }
}

int main(void) {
    string s, t;
    cin >> s >> t;
    Int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if (u == s) {
        cout << a - 1 << " " << b << endl;
    } else {
        cout << a << " " << b - 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3528
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;
import java.util.AbstractMap.SimpleEntry;
import java.util.HashSet;
import java.util.Iterator;

class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int mc = N / 100;
        //System.out.println(mc);
        if (N - mc * 100 <= mc * 5)
            System.out.println(1);
        else
            System.out.println(0);
    }
}

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<string> a(n), b(m);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int j = 0; j < m; j++) cin >> b[j];
	
	bool ans = false;
	for (int i = 0; i + m <= n; i++) {
		for (int j = 0; j + m <= n; j++) {
			bool res = true;
			for (int x = 0; x < m; x++) {
				for (int y = 0; y < m; y++) {
					res &= (a[i + x][j + y] == b[x][y]);
				}
			}
			ans |= res;
		}
	}
	
	cout << (ans ? "Yes" : "No") << '\n';
	
	return 0;
}

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

using namespace std;
using ll =long long;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
#define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());}
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; }
static const ll INF = 1LL << 60;
//Write From this Line

int main()
{
	ll n;
	cin >> n;
	string ans ="";
	while(n != 0){
		if(n % 2 == 0){
			ans += '0';
			n /= (-2);
		} else {
			ans += '1';
			if(n % 2 == -1) n += -1;
			n /= -2;
		}
	}
	reverse(ans.begin(),ans.end());
	if(ans.size() == 0) {
		cout << 0 << endl;
		return 0;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define QUEUE_SIZE 1000003
#define MAXN 10
#define MAXH 1001
#define MAXW 1001
#define INF (1<<29)

int begin, end;
int queue_x[QUEUE_SIZE];
int queue_y[QUEUE_SIZE];

void init() {
  begin = end = 0;
}

void push(int x, int y) {
  queue_x[end] = x;
  queue_y[end] = y;
  ++end;
}

int getX() {
  return queue_x[begin];
}

int getY() {
  return queue_y[begin];
}

void pop() {
  ++begin;
}

int empty() {
  if(end - begin == 0) return 1;
  else return 0;
}

int H, W, N;
char G[MAXH][MAXW];
int cost[MAXH][MAXW];
int posX[MAXN], posY[MAXN];
const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};

int bfs(int sx, int sy, int ex, int ey) {
  int i, j, x, y, nx, ny;
  for(i = 0; i < H; ++i) {
    for(j = 0; j < W; ++j) {
      cost[i][j] = INF;
    }
  }
  init();
  push(sx, sy);
  cost[sy][sx] = 0;
  while(!empty()) {
    x = getX();
    y = getY();
    pop();
    for(i = 0; i < 4; ++i) {
      nx = x + dx[i];
      ny = y + dy[i];
      if(0 <= nx && nx < W &&
         0 <= ny && ny < H && G[ny][nx] != 'X' && cost[ny][nx] == INF) {
        push(nx, ny);
        cost[ny][nx] = cost[y][x] + 1;
        if(nx == ex && ny == ey) {
          return cost[ny][nx];
        }
      }
    }
  }
  return INF;
}

int main() {
  int i, j, k, x, y, ans;
  scanf("%d %d %d", &H, &W, &N);
  for(i = 0; i < H; ++i) {
    for(j = 0; j < W; ++j) {
      scanf(" %c", &G[i][j]);
      if(G[i][j] == 'S') {
        posX[0] = j;
        posY[0] = i;
      } else if('1' <= G[i][j] && G[i][j] <= '9') {
        posX[G[i][j] - '0'] = j;
        posY[G[i][j] - '0'] = i;
      }
    }
  }
  ans = 0;
  for(i = 0; i < N; ++i) {
    ans += bfs(posX[i], posY[i], posX[i+1], posY[i+1]);
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 12876
import sys
class Heap:
    def __init__(self):
        self.heap = [None]*1000000
        self.root = 0
        self.size = 0
    
    def push(self, a:int):
        self.heap[self.size] = a
        b = self.size
        while b != 0 and self.heap[(b - 1) //2] < self.heap[b]:
            c = self.heap[(b - 1) //2]
            self.heap[(b - 1) //2] = self.heap[b]
            self.heap[b] = c
            b = (b - 1) //2
        self.size += 1
    
    def pop(self):
        a = self.heap[0]
        b = 0
        self.heap[b] = self.heap[self.size - 1]
        self.heap[self.size] = None
        self.size -= 1
        while (self.heap[b*2 + 1] is not None and self.heap[b] < self.heap[b*2 + 1]) or (self.heap[b*2 + 2] is not None and self.heap[b] < self.heap[b*2 + 2]):
            if self.heap[b*2 + 2] > self.heap[b*2 + 1]:
                c = self.heap[b]
                self.heap[b] = self.heap[b*2 + 2]
                self.heap[b*2 + 2] = c
                b = b*2 + 2
            else:
                c = self.heap[b]
                self.heap[b] = self.heap[b*2 + 1]
                self.heap[b*2 + 1] = c
                b = b*2 + 1
        return a
def main(): 
    x, y, A, B, C = map(int, input().split())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    r = list(map(int, input().split()))
    pq = Heap()
    p.sort()
    q.sort()
    for i in range(x):
        pq.push(p[len(p) - 1 - i])
    for i in range(y):
        pq.push(q[len(q) - 1 - i])
    for i in range(len(r)):
        pq.push(r[i])
    ans = 0
    for i in range(x + y):
        ans += pq.pop()
    print(ans)

main()


Measured memory_bytes: 117228