akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <complex>
#include <cmath>
#include <cstdio>

using namespace std;

const double eps = 1e-12;

double cross(complex<double> a, complex<double> b) {
    return a.real() * b.imag() - a.imag() * b.real();
}

int main() {
    complex<double> t1, t2, t3, p;
    while(cin >> t1.real() >> t1.imag() >> t2.real() >> t2.imag() >> t3.real() >> t3.imag() >> p.real() >> p.imag()) {
        int plus = 0;
        if (cross(t1 - p, t2 - t1) > 0)plus++;
        if (cross(t2 - p, t3 - t2) > 0)plus++;
        if (cross(t3 - p, t1 - t3) > 0)plus++;
        if (plus == 3 || plus == 0)cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(n);
    for(int &A:a){
        cin>>A;
    }
    int sum=0;
    for(int &p:a){
        sum+=p;
    };
    int r;
    if(sum%(4*m)){
        r=sum/(4*m)+1;
    }else{
        r=sum/(4*m);
    }
    int count=0;
    for(int &p:a){
        if(p>=r){
            count++;
        }
    }
    if(count<m) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
src = [input() for i in range(H)]

ans1 = [['#'] + ['.']*(W-1) for i in range(H)]
ans2 = [['.']*(W-1) + ['#'] for i in range(H)]

for i in range(1,H-1):
    for j in range(1,W-1):
        if i%2:
            ans1[i][j] = '#'
            ans2[i][j] = src[i][j]
        else:
            ans1[i][j] = src[i][j]
            ans2[i][j] = '#'

for row in ans1:
    print(''.join(row))
print('')
for row in ans2:
    print(''.join(row))

Measured memory_bytes: 7796
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const int N = 205;
const int B = 62;

int t;
int n;
ll a[N];
string s;

ll basis[B];
void gauss_add(ll x){
    // printf("add %lld\n",x);
    FORD(i,B){
        if(!(x & (1LL<<i)))continue;

        if(basis[i] == 0){
            basis[i] = x;
            // printf("now %lld, at %d\n",x,i);
            return;
        }

        x ^= basis[i];
    }
}

bool gauss_check(ll x){
    // printf("check %lld\n",x);
    FORD(i,B){
        if(!(x & (1LL<<i)))continue;

        // printf("try %d, %lld\n",i,basis[i]);
        if(basis[i] == 0)return false;

        x ^= basis[i];
        // printf("> %lld\n",x);
    }
    assert(x == 0);
    // printf("ok\n");
    return true;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);

    cin>>t;
    while(t--){
        cin>>n;
        FOR(i,n)cin>>a[i];
        cin>>s;

        FOR(i,B)basis[i] = 0;

        bool lose = false; // whether player 0 loses
        FORD(i,n){
            if(s[i] == '0'){
                gauss_add(a[i]);
            }else{
                if(gauss_check(a[i])){
                    // safe
                }else{
                    lose = true;
                    // printf("fail!\n");
                }
            }
        }

        if(lose)cout << 1 << endl;
        else cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 3608
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
from fractions import gcd
#import random


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N = I()
    S, T = map(str, input().split())

    for i in range(N*2):
        if i % 2 == 0:
            print(S[i//2], end='')
        else:
            print(T[i//2], end='')

    print()


if __name__ == '__main__':
    main()


Measured memory_bytes: 63980
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int k, s;
  cin >> k >> s;
  int cnt = 0;
  for (int i = 0; i <= k; i++) {
    int x = s-i;
    if (x < 0) break;
    for (int j = 0; j <= k; j++) {
      if (x-j < 0) break;
      if (x-j <= k) cnt++;
    }
  }
  dump(cnt);
  return 0;
}


Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

Int factorial(Int n, Int mod = 1) {
    Int ret = 1;
    if (mod == 1) {
        for (Int i = 1; i <= n; i++) {
            ret *= i;
        }

        return ret;
    } else {
        for (Int i = 1; i <= n; i++) {
            ret *= i;
            ret %= mod;
        }

        return ret;
    }
}

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

    Int n, m;
    cin >> n >> m;

    if (n < m) {
        swap(n, m);
    }

    if (n == m + 1) {
        cout << factorial(n, MOD) * factorial(m, MOD) % MOD << endl;
    } else if (n == m) {
        cout << 2 * factorial(n, MOD) * factorial(m, MOD) % MOD << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


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

int main(void) {
    int a[4], temp;

    if(scanf("%d %d %d", &a[0], &a[1], &a[2]) == 1);

    for(int i = 0; i < 3; i++) {
        for(int j = i; j < 3; j++) {
            if (a[i] < a[j]) {
                temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
        }
    }

    printf("%d", abs(a[0] - a[1]) + abs(a[1] - a[2]));

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#define rep(i,n) for(int i = 0; i < (long int)n; i++)
typedef long long ll;
using namespace std;

int main(){
  int n,l,min = 200,taste = 0,a=1;
  cin >> n >> l;
  for(int i = 1; i <= n; i++){
    taste += l + i - 1;
    if(abs(l+i-1) < min){
      min = abs(l+i-1);
      if(l+i-1 < 0){
        a = -1;
      }
    }
  }

  cout << taste-min*a;
  return 0;
}


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

int main(void){
  int n,S;
  while(cin>>n>>S,n||S){
    vector<int> a(n);
    for(int i=0;i<n;++i) cin>>a[i];
    int cnt=0;
    for(int i=0;i<n-1;++i){
      for(int j=i+1;j<n;++j){
        if(S<a[i]+a[j])++cnt;
      }
    }
    cout<<cnt<<endl;
  }
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;
using ll = long long;

int main(void)
{
    int N, K;
    cin >> N >> K;
    vector<int> count(N, 0);

    for (int i = 0; i < K; i++)
    {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++)
        {
            int a;
            cin >> a;
            a--;
            count[a]++;
        }
    }

    int ans = 0;

    for (int i = 0; i < N; i++)
    {
        if (count[i] == 0)
        {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
//#define LOCAL
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define ft first
#define sd second
#define sz size()
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
//cout << fixed << setprecision(12) <<x<<endl;

int main(){
fastIO;
#ifdef LOCAL
     freopen("in.txt", "r", stdin);
#endif

int a[3];
int sum=0;
forn(i,0,3){ cin>>a[i];
sum+=a[i];
}
sort(a,a+3);
cout<<sum-a[2]<<endl;
}


Measured memory_bytes: 3616
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main()
{
	double r;
	
	cin >> r;

	cout << fixed << setprecision(5) << M_PI * r * r << " " << 2 * M_PI * r << endl;

	return 0;
}

Measured memory_bytes: 3188
#!python3

LI = lambda: list(map(int, input().split()))

# input
N, M = LI()
AB = [LI() for _ in range(M)]

link = [[] for _ in range(N)]


def create_link():
    for a, b in AB:
        link[a - 1].append(b - 1)
        link[b - 1].append(a - 1)


def dfs(v=0, s=set()):
    s = s | {v}
    if len(s) == N:
        return 1
    ans = 0
    for u in link[v]:
        if u in s:
            continue
        ans += dfs(u, s)
    return ans


def main():
    create_link()
    ans = dfs()
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
    int m,f,r;
    while(1){    
        scanf("%d %d %d",&m,&f,&r);
        if(m == -1 && f == -1 && r == -1) break;    
        if(m == -1 || f == -1){
            puts("F");
        } else if(m + f >= 80){
            puts("A");
        } else if(m + f >= 65){
            puts("B");
        } else if(m + f >= 50){
            puts("C");
        } else if(m + f >= 30){
            if(r>=50) puts("C");
            else puts("D");
        } else {
            puts("F");
        }
    }
    return 0;
} 
        


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5 + 10;

char get_win(char c) {
    if(c == 'r') return 'p';
    if(c == 'p') return 's';
    return 'r';
}

typedef pair<char, int> pa;

int main() {
    int n, k;
    ll r, s, p;
    cin >> n >> k >> r >> s >> p;
    map<char, ll> mon;
    mon['r'] = r;
    mon['s'] = s;
    mon['p'] = p;
    string st;
    cin >> st;
    ll ans = 0;
    string ss;
    for(int i = 0; i < n; i++) {
        char win = get_win(st[i]);
        if(i < k) {
            ss.push_back(win);
            ans += mon[win];
        } else {
            if(win != ss[i-k]) {
                ss.push_back(win);
                ans += mon[win];
            } else {
                for(auto p : mon) {
                    if(p.first == win) continue;
                    if(i+k >= n) {
                        ss.push_back(p.first);
                        break;
                    }
                    if(get_win(st[i+k]) != p.first) {
                        ss.push_back(p.first);
                        break;
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = breads >>= main'
    where
        main' (_ : a : b : _) = breads >>= print . solve a b 

solve :: Int -> Int -> [Int] -> Int 
solve a b = check 0
    where
        check acc (x : y : zs) = check (acc + (min b $ a * (y - x))) (y : zs)
        check acc _ = acc

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)


Measured memory_bytes: 2940
#include "bits/stdc++.h"
#define REP(i, m, n) for(long long i = m; i < n; ++i)
#define CO(n) cout << n << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

string S,T;

int main()
{
    ios::sync_with_stdio(false);
    cin >> S >> T;
    int ls = S.size();
    int lt = T.size();
    if (ls < lt) {
        CO("UNRESTORABLE");
        return 0;
    }
    int tstart=-1;
    for (int i=ls-lt; 0<=i; --i){
        // CO(i);
        bool flag = true;
        REP(j,0,lt){
            if (S[i+j]!='?' && S[i+j]!=T[j]){
                flag = false;
                break;
            }
        }
        if (flag){
            tstart = i;
            break;
        }
    }
    if (tstart == -1){
        CO("UNRESTORABLE");
        return 0;
    }
    int i = 0;
    while(i<ls){
        if (i==tstart){
            cout << T;
            i += lt-1;
        }
        else if (S[i]=='?')cout << 'a';
        else cout << S[i];  
        ++i;
    }
    cout << endl;
    return 0;
}

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

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using i32 = int_fast32_t;
using u32 = uint_fast32_t;
using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using usize = size_t;

namespace chrono = std::chrono;
using namespace std::literals;

#define all(c) (c).begin(), (c).end()

__attribute__((constructor))
void fast_iostream() {
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
}

using graph = std::vector<std::vector<u32>>;

std::vector<u32> tin;
std::vector<u32> fup;
std::vector<bool> used;
u32 timer = 0;

u32 ans = 0;

void dfs(const graph& g, u32 v, u32 p) {
  used[v] = true;
  tin[v] = fup[v] = timer++;
  for (u32 next: g[v]) {
    if (next == p) continue;
    if (used[next]) {
      fup[v] = std::min(fup[v], tin[next]);
    } else {
      dfs(g, next, v);
      fup[v] = std::min(fup[v], fup[next]);
      if (fup[next] > tin[v]) {
        ans += 1;
      }
    }
  }
}

int main() {
  u32 n, m;
  cin >> n >> m;
  graph g(n);
  for (u32 i = 0; i < m; ++i) {
    u32 x, y;
    cin >> x >> y;
    --x; --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }

  tin.resize(n, 0);
  fup.resize(n, 0);
  used.resize(n, false);
  for (u32 i = 0; i < n; ++i) {
    if (!used[i]) {
      dfs(g, i, n);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;

#define all(a) begin(a),end(a)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=1e9+7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int mul(int a,int b){
  return ((a)*1ll*(b))%mod;
}

void add(int &a,int b){
  a+=b;
  if(a>=mod)a-=mod;
}

int sub(int a,int b){
  a-=b;
  if(a<0){
    a+=mod;
  }
  return a;
}

int powz(int a,int b){
  int res=1;
  while(b){
    if(b&1){
      res=mul(res,a);
    }
    b/=2;
    a=mul(a,a);
  }
  return res;
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
  input>>x.F>>x.S;
  return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}

template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}

template<typename T>
vector<pair<T,int>> getvec(int n){
  vector<pair<T,int>>a(n);
  for(int i=0;i<a.size();i++){
    cin>>a[i].F;
    a[i].S=i;
  }
  return a;
}

const int N=200005;

void solve(){
  int n,k;
  cin>>n>>k;
  vector<int>a(n);
  for(int i=0;i<k;i++){
    int m;
    cin>>m;
    for(int j=0;j<m;j++){
      int val;
      cin>>val;
      val--;
      a[val]=1;
    }
  }
  int ans=0;
  for(int i=0;i<n;i++){
    ans+=(a[i]==0);
  }
  cout<<ans;
  
}

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc=1;
  //cin>>tc;
  for(int _=0;_<tc;_++){
    // cout<<"Case #"<<_+1<<": ";
    solve();
    if(_!=tc-1){
      cout<<'\n';
    }
  }
}



Measured memory_bytes: 3652
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a1 = sc.nextInt(), b1 = sc.nextInt(), b2 = sc.nextInt();
        int a2, a3, b3, c1, c2, c3, A, B, C, X, Y, Z, P, Q;
        int N;
        a2 = a3 = b3 = c1 = c2 = c3 = 0;
        for(int i = 300; i > 0; i--){
            c1 = i - a1 - b1;
            b3 = i - b1 - b2;
            c3 = i - a1 - b2;
            c2 = i - c1 - c3;
            a2 = i - b2 - c2;
            a3 = i - b3 - c3;
            A = a1 + a2 + a3;
            B = b1 + b2 + b3;
            C = c1 + c2 + c3;
            X = a1 + b1 + c1;
            Y = a2 + b2 + c2;
            Z = a3 + b3 + c3;
            P = a1 + b2 + c3;
            Q = a3 + b2 + c1;
            if(A == B && B == C && C ==  X && X == Y && Y == Z && Z == P && P == Q)
                break;
        }
        System.out.println(a1 + " " + b1 + " " + c1);
        System.out.println(a2 + " " + b2 + " " + c2);
        System.out.println(a3 + " " + b3 + " " + c3);
    }
}

Measured memory_bytes: 24020
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x)      x.begin(), x.end()
#define rep(i,n)    for (int i = 0; i < (n); ++i)
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    int N;
    i64 a[100010];
    i64 b[100010];

    cin >> N;
    rep(i, N+1) {
        cin >> a[i];
    }
    rep(i, N) {
        cin >> b[i];
    }

    i64 ans = 0;
    rep(i, N) {
        i64 d = min(a[i], b[i]);
        ans += d;

        b[i] -= d;

        d = min(a[i+1], b[i]);
        ans += d;
        a[i+1] -= d;
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1792
N = int(input().strip())
a = [int(str) for str in input().strip().split()]


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)


b = sorted(list(set(a)))[::-1]
m = b[0]
for i in b[1:]:
    m = lcm(m, i)

m -= 1

print(sum([m % aa for aa in a]))

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

using namespace std;

int main(){
    int n; cin>>n;
    vector<int> v(n), c(n);
    for (int i=0; i<n; ++i) cin>>v[i];
    for (int i=0; i<n; ++i) cin>>c[i];
    int m = -1e9;
     for(int i=0; i<(1<<n); ++i){
        int x = 0, y = 0;
        for (int j=0; j<n; ++j) {
            if (i&(1<<j)){
                x+=v[j];
                y+=c[j];
            }
        }
        m = max(m, x-y);
    }
    cout<<m;
    return 0;
}

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

using namespace std;

void solve(){
	int x; cin>>x;
	if(x>=400 && x < 600) cout << "8\n";
	else if(x>=600 && x < 800) cout << "7\n";
	else if(x>=800 && x < 1000) cout << "6\n";
	else if(x>=1000 && x < 1200) cout << "5\n";
	else if(x>=1200 && x < 1400) cout << "4\n";
	else if(x>=1400 && x < 1600) cout << "3\n";
	else if(x>=1600 && x < 1800) cout << "2\n";
	else if(x>=1800 && x < 2000) cout << "1\n";
}

int main(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
		//cout << "\n";
	}
	return 0;
}


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

public class Main {
	public static void main (String[] args) {
	Scanner s=new Scanner(System.in);	
	int n=s.nextInt();
	int m=s.nextInt();
	int k=s.nextInt();
	int a[]=new int[n];
	int c[]=new int[n];
	int d[]=new int[m];
	for(int i=0;i<n;i++)
	{a[i]=s.nextInt();
	c[i]=a[i];}
	Arrays.sort(c);
	int b[]=new int[m];
	for(int i=0;i<m;i++)
	{b[i]=s.nextInt();
	d[i]=b[i];}
	Arrays.sort(d);
	int min=c[0]+d[0];
	for(int i=0;i<k;i++)
	{int p=s.nextInt();
	int q=s.nextInt();
	p--;
	q--;
	int r=s.nextInt();
	min=Math.min(min,a[p]+b[q]-r);
	}
	System.out.println(min);
	}
}

Measured memory_bytes: 155164
const { parse } = require("path");

function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    let N = parseInt(input[0][0], 10);
    let M = parseInt(input[0][1], 10);
    let bitVec = Array.from({length:N}, () => true);
    let H = input[1].map(e => parseInt(e, 10));
    let AB;
    for (let i = 0; i < M; i++){
        AB = input[i + 2].map(e => parseInt(e, 10));
        if (H[AB[0] - 1] > H[AB[1] - 1]){
            bitVec[AB[1] - 1] = false;
        } else if (H[AB[0] - 1] < H[AB[1] - 1]) {
            bitVec[AB[0] - 1] = false;
        } else {
            bitVec[AB[1] - 1] = false;
            bitVec[AB[0] - 1] = false;
        }
    }
    let ans = 0;
    for (let x of bitVec){
        if (x) ans++;
    }
    console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 79088
n = int(input())
a = list(map(int,input().split()))
p1,p2,p4 = (0,0,0)
for i in a:
    if i %4 ==0:
        p4 +=1
    elif i%2 ==0:
        p2 +=1
    else:
        p1+=1
ans ="Yes"
if p4+1 < p1 or(p4+1 ==p1 and p2 !=0):
    ans ="No"
print(ans)

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

import static java.lang.System.in;

public class Main {
    ArrayList<Integer>[] graph;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n+1];
        int[] pos = new int[n+1];
        for(int i=1;i<=n;i++) {
            a[i]=sc.nextInt();
            pos[a[i]] = i;
        }
        TreeSet<Integer> ts = new TreeSet<>();
        ts.add(0); ts.add(n+1);
        long ans = 0;
        for(int i=1;i<=n;i++){
            int lo = ts.lower(pos[i]);
            int hi = ts.higher(pos[i]);
            ans += ((long)(pos[i]-lo))*((long)(hi-pos[i]))*i;
            ts.add(pos[i]);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 93980
void main() {
	auto ip = readAs!(int[]), H = ip[0], W = ip[1];
	auto s = readMatrix!char(H, W);
	auto cost = new int[][](H, W);
	foreach(ref v; cost) v[] = -1;
	if(s[0][0] == '#' ) cost[0][0] = 1;
	else cost[0][0] = 0;
	//auto visited = new bool[][](H, W);
	//visited[0][0] = true;
	bool isBlack(int x, int y) {
		if(0 <= x && x <= H && 0 <= y && y <= W) return s[x][y] == '#';
		else return true;
	}

	int dfs(int x, int y) {

		debug writefln("%d %d", x, y);
		if(0 <= x && x <= H && 0 <= y && y <= W) {
			if(cost[x][y] != -1) return cost[x][y];
			//if(visited[x][y]) return cost[x][y];
			auto tmp = min(
				dfs(x-1, y) + (!isBlack(x-1, y) && isBlack(x, y))
				, dfs(x, y-1) + (!isBlack(x, y-1) && isBlack(x, y))
				);
			//visited[x][y] = true;
			return cost[x][y] = tmp;
		}
		return (int.max - 10000);
	}
	dfs(H-1, W-1).writeln;
	debug cost.each!writeln;
}

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

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 380
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>
#include<random>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
//#define MOD 998244353
#define MAX 100000

typedef long long int ll;
typedef unsigned long long int ull;

using namespace std;

template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return true; } return false; }

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


	string S;

	cin >> S;

	ll N = S.size();
	vl D(N,0);

	ll dst = 0;

	range(i, 1, N) {
		if (S[i - 1] == 'R' && S[i] == 'L') {
			dst = i;
			D[i]++;
		}
		else if (S[i] == 'L') {
			D[dst - (i - dst) % 2]++;
		}
	}

	rrep(i, N-1){
		if (S[i + 1] == 'L' && S[i] == 'R') {
			dst = i;
			D[i]++;
		}
		else if (S[i] == 'R') {
			D[dst + (dst-i) % 2]++;
		}
	}


	rep(i, N) {
		cout << D[i] << " ";
	}
	cout << endl;


	return 0;
}



Measured memory_bytes: 1472
#include<bits/stdc++.h>
using namespace std;
#define MAX 1000000007
#define ll long long int
vector<ll> adj[100001],nodes;
ll c[100001],dp[100001];
bool vis[100001];
ll n,k;
void dfs2(ll i){
  vis[i]=true;
  for(ll j=0;j<adj[i].size();j++){
    if(!vis[adj[i][j]]) dfs2(adj[i][j]);
    dp[i]=max(dp[i],1+dp[adj[i][j]]);
  }
}
  
void dfs(ll i){
  c[i]=-1;
  for(ll j=0;j<adj[i].size();j++){
    if(!c[adj[i][j]]) dfs(adj[i][j]);
  }
  c[i]=1;
  nodes.push_back(i);
}
void topo(){
  memset(c,0,sizeof c);
  for(int i=1;i<=n;i++){
    if(!c[i]) dfs(i);
  }
}
  
int main(){
  
  cin>>n>>k;
  ll arr[n];
  for(ll i=0;i<n;i++) cin>>arr[i];
  sort(arr,arr+n);
  bool dp[k+1];
  memset(dp,false,sizeof dp);
  for(ll i=1;i<=k;i++){
    for(ll j=0;j<n;j++){
      if(i-arr[j]>=0 && dp[i-arr[j]]==false) {dp[i]=true;break;}
    }
  }
  if(dp[k]) cout<<"First";
  else cout<<"Second";
    
  
  
}

Measured memory_bytes: 2688
#include<iostream>
#include<cmath>
using namespace std;
int dp[100001][3];
int a[100001][3];
int n;
int f(int p, int c)
{
	if(dp[p][c]!=-1)
		return dp[p][c];
	if(p==n-1)
		return dp[p][c]=a[p][c];
	dp[p][c]=0;
	for(int i = 0; i < 3; i++)
		if(i!=c)
			dp[p][c]=max(dp[p][c], f(p+1, i));
	dp[p][c]+=a[p][c];
	return dp[p][c];
}
int main()
{
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			cin >> a[i][j];
			dp[i][j]=-1;
		}
	}
	cout << max(max(f(0, 0), f(0, 1)), f(0, 2)) << '\n';
}

Measured memory_bytes: 8832
#[allow(unused_imports)]
use { proconio::{fastout, input, marker::*}, std::cmp::*, std::collections::*, };

#[fastout]
fn main() {
   input! {
      s: Bytes,
      t: Bytes
   }
   let n = s.len();
   let mut ans = 0;
   for i in 0..n {
      if s[i] != t[i] {
         ans += 1;
      }
   }
   println!("{}", ans);
}


Measured memory_bytes: 2844
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1105;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> tree_set;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
string s[N];
int dp[N][N];
int solve(int x, int y)
{
    if(x<0||y<0)
        return 0;
    if(dp[x][y]!=-1)
        return dp[x][y];
    if(s[x][y]=='#')
        dp[x][y] = 0;
    else
        dp[x][y] = solve(x-1,y) + solve(x,y-1);

    dp[x][y]%=MOD;
    return dp[x][y];
}
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    /*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int n,m;
    cin>>n>>m;
    for (int i = 0; i < n; ++i)
        cin>>s[i];
    fill(dp,-1);
    dp[0][0] = 1;



    cout<<solve(n-1,m-1)<<endl;


    printclock;
    return 0;
}


Measured memory_bytes: 10880
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N;
string S,T;

ll dp[200020][2];

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

int main(){
  cin>>S;
  cin>>T;
  N=S.size();

  dp[0][0]=0;
  ll x=0;
  bool big=false;
  bool end=false;
  for(int i=0;i<N;i++){
    if(T[i]!='?'){
      add(dp[i+1][1],dp[i][1]*10+(T[i]-'0')*x);
      if(S[i]>T[i]&&big==false&&end==false){
          add(dp[i+1][1],dp[i][0]*10+(T[i]-'0'));
          add(x,1);
      }else if(S[i]==T[i]&&end==false) add(dp[i+1][0],dp[i][0]*10+(T[i]-'0'));

      if(S[i]>T[i]) big=true;
      if(S[i]<T[i]){
          end=true;
          dp[i+1][0]=0;
      }
    }else{
      for(int j=0;j<=9;j++){
        add(dp[i+1][1],dp[i][1]*10+(j)*x);
      }
      if(big==false&&end==false){
          add(dp[i+1][0],dp[i][0]*10+(S[i]-'0'));
          for(int j=0;j<(S[i]-'0');j++){
            add(dp[i+1][1],dp[i][0]*10+j);
          }
      }
      x=x*10%MOD;
      if(big==false&&end==false) add(x,S[i]-'0');
    }
  }

  ll ans=0;
  for(int j=0;j<=1;j++) add(ans,dp[N][j]);
  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 6476
int n, m, a[100010], b[100010], c[100010];
int main() {
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; ++i) {
        scanf("%d%d",&a[i],&b[i]);
        ++c[a[i]], ++c[b[i]];
    }

    for(int i = 0; i < m; ++i) {
        if(c[a[i]]&1|c[b[i]]&1) {
            printf("NO");
            return 0;
        }
    }
    printf("YES");
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string a,c;
  cin>>a>>c;
  ll b=a.size();
  ll d=0;
  for(ll i=0;i<b;i++){
    if(a.at(i)!=c.at(i))d+=1;
  }
  cout<<d<<endl;
}


Measured memory_bytes: 3900
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPP(i, n) for(int i = 1; i <= n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const ll MOD = 1000000007;
const ll INF = MOD;

int main() {
    int n; cin >> n;
    vector<p> xy(n);
    REP(i,n) cin >> xy[i].first >> xy[i].second;
    set<p> XY;
    REP(i,n) XY.emplace(xy[i]);
    int ans = n;
    REP(i,n) {
        REP(j,n) {
            if(i==j) continue;
            ll f = xy[j].first - xy[i].first;
            ll s = xy[j].second - xy[i].second;
            int res = 0;
            REP(k,n) {
                if(XY.count(p(xy[k].first+f, xy[k].second+s))) continue;
                res ++;
            }
            ans = min(res,ans);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8

n = int(input())
s = list(input())

for (i, x) in enumerate(s):
    if x == "E":
        s[i] = 1
    elif x == "W":
        s[i] = 0

left = 0
right = sum(s[1:n])
center = s[0]
min_changed_num = right

for i in range(1, n):
    left = left + (1 - center)
    center = s[i]
    right = right - center
    changed_num = left + right
    if min_changed_num > changed_num:
        min_changed_num = changed_num

print(min_changed_num)


Measured memory_bytes: 8268
import random
import time
import copy

t1=time.time()
d=int(input())
c=input()
cl=[int(n) for n in c.split()]
sl=list()
for i in range(d):
    s=input()
    sl=sl+[int(n) for n in s.split()]
tl=list()
for i in range(d):
    tl.append(random.randint(1,26))
sat=0
for i in range(d):
    sat+=sl[i*26+tl[i]-1]
last=list()
for i in range(26):
    last.append([a for a, x in enumerate(tl) if x==i+1])
dec=0
for i in range(26):
    if last[i]==list():
        dec+=(d*(d+1)/2)*cl[i]
    else:
        for v in range(len(last[i])):
            if v!=len(last[i])-1:    
                dec+=cl[i]*(last[i][v+1]-last[i][v]-1)*(last[i][v+1]-last[i][v])/2
            else:
                dec+=cl[i]*(d-last[i][v]-1)*(d-last[i][v])/2
        dec+=cl[i]*(last[i][0])*(last[i][0]+1)/2
        
def dechf(c,last):
    decha=0
    if last[c]==list():
        decha+=(d*(d+1)/2)*cl[c]
    else:
        for v in range(len(last[c])):
            if v!=len(last[c])-1:    
                decha+=cl[c]*(last[c][v+1]-last[c][v]-1)*(last[c][v+1]-last[c][v])/2
            else:
                decha+=cl[c]*(d-last[c][v]-1)*(d-last[c][v])/2
        decha+=cl[c]*(last[c][0])*(last[c][0]+1)/2
    return(int(decha))


oldlast=copy.deepcopy(last)
oldans=sat-int(dec)
oldtl=copy.copy(tl)
t2=time.time()
newans=0
while t2-t1<1.85:
    if round(t2)%2==0:
        d1=random.randint(1,d)
        d2=random.randint(1,d)
        if d1==d2:
            continue
        q1=tl[d2-1]
        q2=tl[d1-1]
        cha=sl[(d1-1)*26+q1-1]-sl[(d1-1)*26+tl[d1-1]-1]+sl[(d2-1)*26+q2-1]-sl[(d2-1)*26+tl[d2-1]-1]
        c=tl[d1-1]-1
        dech=dechf(c,last)
        c=tl[d2-1]-1
        dech+=dechf(c,last)
        last[tl[d2-1]-1].remove(d2-1)
        last[tl[d1-1]-1].remove(d1-1)
        last[tl[d1-1]-1].append(d2-1)
        last[tl[d1-1]-1].sort()
        last[tl[d2-1]-1].append(d1-1)
        last[tl[d2-1]-1].sort()
        tl[d2-1]=q2
        tl[d1-1]=q1
        c=tl[d1-1]-1
        dech-=dechf(c,last)
        c=tl[d2-1]-1
        dech-=dechf(c,last)
        newans=oldans+cha+dech
    else:
        da=random.randint(1,d)
        q=random.randint(1,26)
        cha=sl[(da-1)*26+q-1]-sl[(da-1)*26+tl[da-1]-1]
        c=tl[da-1]-1
        dech=dechf(c,last)
        c=q-1
        dech+=dechf(c,last)
        last[tl[da-1]-1].remove(da-1)
        last[q-1].append(da-1)
        last[q-1].sort()
        c=tl[da-1]-1
        dech-=dechf(c,last)
        tl[da-1]=q
        c=tl[da-1]-1
        dech-=dechf(c,last)
        newans=oldans+cha+dech
    r=0
    if newans<oldans:
        if 2.7**((newans-oldans)/(1.85-(t2-t1)))<random.random():
            r=1
    if r==1:
        tl=copy.copy(oldtl)
        last=[i[:] for i in oldlast]
    else:
        oldans=newans
        oldtl=copy.copy(tl)
        oldlast=[i[:] for i in last]
    t2=time.time()
for i in range(d):
    print(tl[i])
        



Measured memory_bytes: 107308
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>

using namespace std;

int n;
int cnt;
deque<int> c;
int a[12];

void Op(deque<int> s)
{
  for (int i = 0; i < n; i++){
    c.push_back(count(s.begin(), s.end(), a[i]));
    a[i] = c.back();
  }
  cnt++;
}

int main()
{
  while (cin >> n, n){
    deque<int> s;
    int cn = 0;
    cnt = 0;

    for (int i = 0; i < n; i++){
      cin >> a[i];
      s.push_back(a[i]);
    }
    while (cn != n){
      Op(s);
	  cn = 0;
      for (int i = 0; i < n; i++){
		if (s.front() == c.front()){
          cn++;
        }
        s.pop_front();
        s.push_back(c.front());
        c.pop_front();
	  }
    }
    cout << cnt - 1 << "\n" << s[0];
    for (int i = 1; i < n; i++){
      cout << " " << s[i];
    }
  cout << endl;
  }
}

Measured memory_bytes: 1212
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/
/*** "ALHAMDULILLAH for Everything..." ***/
#include<bits/stdc++.h>
using namespace std;
#define  fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  debug      printf("Come here!")
#define  inf        1000000000000000000
#define  pb         push_back
#define  mp         make_pair
#define  sz(a)      a.size()
#define  mem(a,b)   memset(a,b,sizeof(a))
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "

#define  md         1000000007
#define  pi         acos(-1.0)
#define  cos(a)     cos(a*pi/180)
#define  sin(a)     sin(a*pi/180)
#define  tan(a)     tan(a*pi/180)
#define  cosi(a)    acos(a)/(pi/180)
#define  sini(a)    asin(a)/(pi/180)
#define  tani(a)    atan(a)/(pi/180)

#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  minpql     priority_queue<ll,vector<ll>,greater<ll> >

#define  setbits(x)     __builtin_popcountll(x)
#define  zerobits(x)    __builtin_ctzll(x)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/

int main()
{
    fastt;
    ll n, m, k, i, j, x=0,  s=1, y=1000000000000000000;
    long double  p=1000000000000000000.0, h, f=0;
    cin>>n;
    ll a[n];
    for(i=0; i<n; i++){
        cin>>a[i];
        if(a[i]==0)x=1;
    }
    sort(a, a+n);

    for(i=0; i<n; i++){
        if(a[i]<=y)h=p/(double)(a[i]);
        else{
            f=1;
            break;
        }
        if(h >= (double)(s)){
            s*=a[i];
        }
        else{
            f=1;
            break;
        }
    }
    if(x==1)cout<<0<<endl;
    else if(f==1)cout<<"-1"<<endl;
    else cout<<s<<endl;
    return 0;
}



Measured memory_bytes: 4440
#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()
typedef long long ll;

int main(){
    int n;
    cin >> n;
    int t[n];
    rep(i,n)cin >> t[i];
    int m;
    cin >> m;
    int p[m],x[m];
    rep(i,m)cin >> p[i] >> x[i];
    int sum = 0;
    rep(i,n) sum += t[i];
    rep(i,m){
        int ans = sum;
        ans -= t[p[i]-1];
        ans += x[i];
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll d = (c - a - b);
    if (d < 0) {
        cout << "No" << '\n';
    } else {
        if (d * d > 4 * a * b) {
            cout << "Yes" << '\n';
        } else {
            cout << "No" << '\n';
        }
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int h,i,heap[251];
  scanf("%d",&h);
  for(i=1;i<h+1;i++) scanf("%d",heap+i);
  for(i=1;i<h+1;i++){
    printf("node %d: key = %d, ",i,heap[i]);
    if(i!=1) printf("parent key = %d, ",heap[i/2]);
    if(i*2<=h) printf("left key = %d, ",heap[i*2]);
    if(i*2+1<=h) printf("right key = %d, ",heap[i*2+1]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main() {

    zoom;
    ll N;
    cin >> N;
    ll X = N / 1.08;
    if(N == (ll)(X * 1.08)) {
    	cout << X;
    	return 0;
    }
    if(N == (ll)((X + 1) * 1.08)) {
    	cout << X + 1;
    	return 0;
    }
    cout << ":(";
    return 0;
}

Measured memory_bytes: 256
from itertools import accumulate
import sys
sdin = sys.stdin.readline

n,m,q = map(int, sdin().split())

lr = []
for i in range(m):
    l,r = map(int, sdin().split())
    lr.append(tuple([l, r]))
        
pq = []
for _ in range(q):
    p,q = map(int, sdin().split())
    pq.append(tuple([p, q]))
    
# n×nフィールドを用意して各列車のl,r点をプロット
field = [[0 for _ in range(n+1)] for _ in range(n+1)]
for l, r in lr:
    field[l][r] += 1
    
# fieldのx方向の累積和を取る
field_cum = [list(accumulate(field[i])) for i in range(n+1)]    

# field_cumのy方向の累積和をとる
for r in range(1,n+1):
    for l in range(n+1):
        field_cum[r][l] += field_cum[r-1][l]

        
# 各クエリに対し、長方形内部にあるものの個数を求める
for p,q in pq:
    print(field_cum[q][q] - field_cum[p-1][q] - field_cum[q][p-1] + field_cum[p-1][p-1])


Measured memory_bytes: 46800
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
 
// T := [T][T]... | num 
 
int solve(string s, int &i){
    vector<int> v;
    if(isdigit(s[i])){
        int num = 0;
        while(isdigit(s[i])){
            num = num*10 + s[i]-'0';
            i++;
        }
        return num+1;
    }
    while(s[i] == '['){
        i++; // [
        v.push_back(solve(s,i));
        i++; // ]
    }
 
    sort(all(v));
    int n = v.size(), sum = 0;
    rep(k,(n+1)/2){
        sum += v[k];
    }
    return sum;
}
 
int main(void){
    int T;
    cin>>T;
    rep(_,T){
        string s;
        cin>>s;
        int index = 0;
        cout<<(solve(s,index)+1)/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 3124
L, R = map(int, input().split())
# R-L>=2019なら、[L,R]に2019の倍数が必ず存在する
# すなわちiやjが2019の倍数をとりうる
if R - L >= 2019:
    print(0)
else:
    ans = 2019
    for i in range(L, R + 1):  # L<=i<=R
        for j in range(i + 1, R + 1):  # i<j<=R
            ans = min(ans, i * j % 2019)
    print(ans)


Measured memory_bytes: 9156
#include <cstdio>
#include <algorithm>
#include <functional>
#include <queue>
#include <vector>

using namespace std;

struct cakes {
    long sum;
    int ia;
    int ib;
    int ic;
};

bool operator < (const cakes& left, const cakes& right) {
    return left.sum < right.sum || (left.sum == right.sum && (left.ia > right.ia || (left.ia == right.ia && (left.ib > right.ib || (left.ib == right.ib && left.ic > right.ic)))));
}

int main() {
    int x, y, z, k;
    scanf("%d %d %d %d", &x, &y, &z, &k);
    long a[x], b[y], c[z];
    for (int i=0; i<x; i++) scanf("%ld", a+i);
    for (int i=0; i<y; i++) scanf("%ld", b+i);
    for (int i=0; i<z; i++) scanf("%ld", c+i);
    sort(a, a+x, greater<long>());
    sort(b, b+y, greater<long>());
    sort(c, c+z, greater<long>());
    priority_queue<cakes> pq;
    int na=-1, nb=-1, nc=-1;
    pq.push(cakes({a[0]+b[0]+c[0], 0, 0, 0}));
    for (int i=0; i<k; i++) {
        cakes now = pq.top(); pq.pop();
        while (na == now.ia && nb == now.ib && nc == now.ic) {
            now = pq.top(); pq.pop();
        }
        na = now.ia; nb = now.ib; nc = now.ic;
        printf("%ld\n", now.sum);
        if (na + 1 < x) pq.push(cakes({a[na+1]+b[nb]+c[nc], na+1, nb, nc}));
        if (nb + 1 < y) pq.push(cakes({a[na]+b[nb+1]+c[nc], na, nb+1, nc}));
        if (nc + 1 < z) pq.push(cakes({a[na]+b[nb]+c[nc+1], na, nb, nc+1}));
    }
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
int a[13],vis[13],flag;
void dfs(int x,int l,int r)
{
   	int i;
   	if(x==11)return;
   	if(flag)return ;
   	if(a[x]>l)dfs(x+1,a[x],r);
   	else  if(a[x]>r)dfs(x+1,l,a[x]);
   	else  {flag=1;return;}
	   
}
int main()
{
	int T,i,j,k;
	scanf("%d",&T);
	while(T--)
	{
		flag=0;
		for(i=1;i<=10;i++)
		scanf("%d",&a[i]);
	memset(vis,0,sizeof(vis));
		dfs(1,0,0);
		if(flag)printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}

Measured memory_bytes: 1008
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> v(3);
  for(int i=0;i<3;i++){
      cin>>v[i];
  }
  if(v[0]==v[1]&&v[1]==v[2])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256