akhauriyash/Code-Regression huggingface dataset:
///cREATED bY BERNARB.01
#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 tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef priority_queue<int,vector<int>,greater<int>> pqil;
typedef priority_queue<int> pqig;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef priority_queue<pii> pqiig;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int, int> mii;
#define mid ((l+r)/2)
#define PB push_back
#define PP pop_back
#define PF push_front
#define DF pop_front
#define F first
#define S second
#define MP make_pair
#define C continue
#define B break
#define R return
#define sz(v) (int)(v).size()
#define len(s) (int)(s).length()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(arr, x) memset((arr), (x), sizeof (arr))
#define loop(n) for(int i=0; i<(n); i++)
#define lop(a, n) for(int i=(a); i<(n); i++)
#define jloop(n) for(ll j=0; j<(n); j++)
#define kloop(n) for(ll k=0; k<(n); k++)
#define gloop(n) for(ll g=0; g<(n); g++)
#define rloop(n) for(ll i=(n)-1; i>=0; i--)
#define sgm(y) (((y)*((y)+1))/2)
const ll LINF = 2e17+423;
const int INF = 2e9 + 69;
const ll mod = 1e9+7; //998244353;
const ld pi = acos(-1.0);
const ld cmpf = 1e-9;
//__int128_t
//      -ASCII-
//a -> z | A -> Z | 0 -> 9
//97 122 | 65  90 | 48  57
#define endl '\n'
ll po(ll,ll);






































int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a[3];
    loop(3) cin >> a[i];
    ll sum = 0;
    loop(3) sum+=a[i];
    if(sum>=22) cout << "bust";
    else cout << "win";
    R 0;
}
/*

*/



























































ll po(ll x, ll n){
  if(n==0) R 1%mod;
  ll y = po(x, n/2)%mod;
  y = ((y%mod)*(y%mod));
  if(n%2) y = (y*(x%mod))%mod;
  R y%mod;
}


Measured memory_bytes: 256
/* 
chirag11032000
Chirag Thakur
*/

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

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#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 eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void testCase();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	testCase();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void testCase() {
	int n, m;
	cin >> n >> m;
	vector < int > diff(n + 2);
	for (int i = 1; i <= m; ++i) {
		int l, r;
		cin >> l >> r;
		++diff[l], --diff[r + 1];
	}
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		diff[i] += diff[i - 1];
		if (diff[i] == m) {
			++cnt;
		}
	}
	cout << cnt << "\n";
}

Measured memory_bytes: 640
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int z=a-(d-b);
    int w=b+c-a;
    int x=c-(d-b);
    int y=d+c-a;
    cout<<x<<" "<<y<<" "<<z<<" "<<w<<endl;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:102400000,102400000")
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <iomanip>
#include <bitset>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define SZ(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define pi acos(-1)
#define mod 1000000007
#define inf 1000000007
#define ll long long
#define ull unsigned long long
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
#define N 200005
#define _DEBUG
template <class U,class T> void Max(U &x, T y){if(x<y)x=y;}
template <class U,class T> void Min(U &x, T y){if(x>y)x=y;}
template <class T> void add(int &a,T b){a=(a+b)%mod;}
inline int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%mod;
        a=1LL*a*a%mod;b>>=1;
    }
    return ans;
}
int pow(int a,int b,int c){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%c;
        a=1LL*a*a%c;b>>=1;
    }
    return ans;
}

int a[N];
char s[N];
int main(){
    //srand(time(NULL)+clock());
    int T,ca=0,k,i,j,m=0,K,n;
    scanf("%d%s",&n,s);
    rep(i,0,n)a[i+1]=a[i]+(s[i]=='.');
    int ans=min(a[n], n-a[n]);
    rep(i,0,n){
        K=(i+1-a[i+1])+(a[n]-a[i+1]);
        Min(ans, K);
    }
    printf("%d\n",ans);
    //cerr<<(1.*clock()-start)/CLOCKS_PER_SEC<<"\n";
}




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

using namespace std;
using lli = int_fast64_t;
using ulli = unsigned long long;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = copy(x);cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;



int main() {
	int L, R, d;
	cin >> L >> R >> d;
	int ans = 0;
	for (int i = L; i <= R; i++) {
		if (i % d == 0) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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<typename T>
struct BIT{
    private:
        vector<T> array;
        const int n;
    public:
        BIT(int _n) : array(_n + 1, 0), n(_n) {}
        // [1, i], i is 1-indexed
        T sum(int i){
            T s = 0;
            while(i > 0){
                s += array[i];
                i -= i & -i;
            }
            return s;
        }
        // [i, j), i and j are 1-indexed
        T sum(int i, int j){
            T ret_i = sum(i-1);
            T ret_j = sum(j);
            return ret_j - ret_i;
        }
        // i is 1-indexed
        void add(int i, T x){
            while(i <= n){
                array[i] += x;
                i += i & -i;
            }
        }

		void clear(){
			rep(i,n+1) array[i] = 0;
		}

        // debug
        void print(){
            for(int i = 1; i < (int)array.size(); ++i){
                cout << sum(i, i+1) << " ";
            }
            cout << endl;
        }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    BIT<int> bit0(n), bit1(n), bit2(n), bit3(n);
    vector<int> a(n+1);
    rep(i,n){
        cin >> a[i+1];
        bit0.add(i+1, a[i+1]);
    }
	if(k <= 50){
		rep(i,k){
			if(i%2 == 0){
				bit2.clear();
				bit3.clear();
				for(int j = 1; j <= n; ++j){
					int b = 0;
					b += bit0.sum(j) + bit1.sum(j) * j;
					b -= bit0.sum(j-1) + bit1.sum(j-1) * (j-1);
					int lb = max(1, j - b), ub = min(n, j + b);
					bit2.add(lb, 1 - lb);
					bit3.add(lb, 1);
					bit2.add(ub+1, ub);
					bit3.add(ub+1, -1);
				}
			}
			else{
				bit0.clear();
				bit1.clear();
				for(int j = 1; j <= n; ++j){
					int b = 0;
					b += bit2.sum(j) + bit3.sum(j) * j;
					b -= bit2.sum(j-1) + bit3.sum(j-1) * (j-1);
					int lb = max(1, j - b), ub = min(n, j + b);
					bit0.add(lb, 1 - lb);
					bit1.add(lb, 1);
					bit0.add(ub+1, ub);
					bit1.add(ub+1, -1);
				}
			}
		}
		if(k%2 == 0){
			for(int j = 1; j <= n; ++j){
				int ans = 0;
				ans += bit0.sum(j) + bit1.sum(j) * j;
            	ans -= bit0.sum(j - 1) + bit1.sum(j - 1) * (j - 1);
            	cout << ans << " ";
			}
		}
		else{
			for(int j = 1; j <= n; ++j){
				int ans = 0;
				ans += bit2.sum(j) + bit3.sum(j) * j;
            	ans -= bit2.sum(j - 1) + bit3.sum(j - 1) * (j - 1);
            	cout << ans << " ";
			}
		}
		cout << endl;
	}
	else{
		rep(i,n) cout << n << " ";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 7160
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n;
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	cout<<n+n*n+n*n*n;
	re 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	ll A, B, N;
	cin >> A >> B >> N;

	ll tmp = min(N, B - 1);
	cout << (A * tmp) / B - A * (tmp / B) << "\n";
}

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

#define MAX 200001

int main(void) {
    int n;
    long R[MAX];
    int min, max_v;
    
    cin >> n;
    
    for(int i = 0; i < n; ++i) cin >> R[i];
    
    min = R[0];
    max_v = R[1] - R[0];
    for(int i = 1; i < n; ++i) {
        if(max_v < R[i] - min) max_v = R[i] - min;
        if(R[i] < min) min = R[i];
    }
    
    cout << max_v << endl;
}


Measured memory_bytes: 4644
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned long;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

    void Solve() {
        UL Q; cin >> Q;
        list<int> A;
        auto itr = A.begin();
        rep(i, Q) {
            UL c; cin >> c;
            if (c == 0) {
                int x; cin >> x; A.insert(itr, x);
                itr--;
            }
            else if (c == 1) {
                int d; cin >> d;
                if (d > 0) while (d--) itr++;
                else while (d++) itr--;
            }
            else if (c == 2) {
                auto buf = itr; buf++;
                A.erase(itr); itr = buf;
            }
        }
        for (int i : A) cout << i << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}



Measured memory_bytes: 18604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String data = sc.next();

        //String???Int????????????
        String[] datas = data.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		}

    	selectionSort(A);
	}



	private static void selectionSort(int[] A) {
		int cnt =0;
		for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		}
		disp(A);
		System.out.println(cnt);
	}



	private static void disp(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		}
		System.out.println();
	}

}

Measured memory_bytes: 26308
//Resting_Prince
#include<bits/stdc++.h>
#define mod 1000000007
#define inf 1e18
#define PI 3.141592653589
#define fi first
#define se second 
#define sv(v) sort(all(v));reverse(all(v))
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mk make_pair
#define en '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double ld;

int main()
{
    cout<<fixed<<setprecision(12);
    ll n,i,j,k;
    ld s,a[200005];
    cin>>n;
    rep(i,0,n-1)cin>>a[i];s=0;
    rep(i,0,n-1)
    {
        s+=(ld(1)/a[i]);
    }
    cout<<ld(1/s);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#include <stack>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define Max(a,b) ((a) < (b) ? (b) : (a))
#define Min(a,b) ((a) > (b) ? (b) : (a))
#define AAA (1000000007) 


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairII;


ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll powD(ll a, ll b) {
	ll ans = 1;
	a %= AAA;
	for (int i= 0; i <b; i++)
	{
		ans *= a;
		ans %= AAA;
	}
	return ans;
}



int main() {
	int i, j, k;

	int N, M, K;

	ll Num[61][2] = { {0} };

	cin >> N;

	rep(i, 0, N) {
		ll x;
		cin >> x;
		rep(j, 0, 61) {
			ll mask = (ll)1 << j;
			Num[j][(x & mask)==mask] ++;
		}

	}
	ll ans = 0;
	rep(i, 0, 61) {
		ll sum = Num[i][0] * Num[i][1];
		sum %= AAA;
		sum *= powD(2, i);
		sum %= AAA;
		ans = (sum + ans) % AAA;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
#include<set>
#include <cstdint>
using namespace std;
using ll = __int64_t;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;
const ll mod=1e9+7;


//II→factorialを計算するrange
constexpr ll MOD = 998244353;
template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};


int main(void){
      int n;
      cin>>n;
      int a[n];
      rep0(i,n) cin>>a[i];
      constexpr int V=1e6+3;
      vector<modint<MOD>> w(V+2,0);
      vector<modint<MOD>> c(V+3,0);
      vector<modint<MOD>> s(V+3,0);
      vector<modint<MOD>> sum1(V+3,0);
      vector<modint<MOD>> sum2(V+3,0);
      constexpr modint<MOD> I=1;
      constexpr modint<MOD> II=2;
      w[0]=0;
      for(int i=1;i<V;i++){
            modint<MOD> j=i;
            w[i]=I/j;
      }
      for(int i=1; i<V;i++){
            for(int j=2*i;j<V;j+=i){
                  w[j]-=w[i];
            }
      }
      for(int i=0;i<n;i++){
            c[a[i]]+=I;
      }
      for(int d=1;d<V;d++){
            for(int j=d;j<V;j+=d){
              //if(c[j].a==0) continue;
                  modint<MOD> l=j;
                  sum1[d]+=(l*c[j]);
            }
      }
      for(int d=1;d<V;d++){
            for(int j=d;j<V;j+=d){
              //if(c[j].a==0) continue;
                  modint<MOD> l=j;
                  sum2[d]+=(l*l*c[j]);
            }
      }
      for(int d=1;d<V;d++){
            s[d]=((sum1[d]*sum1[d])-sum2[d]);
      }
      modint<MOD> ans=0;
      for(int d=1;d<V;d++){
            ans+=w[d]*s[d];
      }
      cout<<(ans/II).a<<endl;
      return 0;
}


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

int digit_count(int64_t x){
  int digit=0;

  while(x>0){
    x/=10;
    digit++;
  }

  return digit;

}//桁数をカウントする関数(long受け取り)
 
int main() {

  int64_t N;

  cin>>N;

  int ans=10;

  int64_t r=sqrt(N);

  for(int64_t i=1;i<=r;i++){
    int64_t B;
    if(N%i==0){
      B=N/i;
    }

    int d=digit_count(B);

    if(d<ans) ans=d;
  }//iをNまで走査する必要はない。iがBより大きくなる瞬間、すなわち√Nまで走査すれば十分である。

  cout << ans << endl;
  
  return 0;
}

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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

char b[1001][1001];
Int d[1001][1001];

int main() {
    Int h, w;
    cin >> h >> w;
    pair<Int, Int> s, t;
    cin >> s.first >> s.second;
    s.first--, s.second--;
    cin >> t.first >> t.second;
    t.first--, t.second--;
    for (Int i = 0; i < h; i++) {
        for (Int j = 0; j < w; j++) {
            cin >> b[i][j];
            d[i][j] = INF;
        }
    }
    d[s.first][s.second] = 0;
    deque<pair<Int, Int>> q;
    q.push_back(s);
    while (not q.empty()) {
        pair<Int, Int> p = q.front();
        q.pop_front();
        Int dy[4] = {-1, 0, 1, 0};
        Int dx[4] = {0, 1, 0, -1};
        for (Int i = 0; i < 4; i++) {
            Int ny = p.first + dy[i];
            Int nx = p.second + dx[i];
            if (ny < 0 or ny == h or nx < 0 or nx == w) continue;
            if (b[ny][nx] == '#') continue;
            if (d[ny][nx] > d[p.first][p.second]) {
                d[ny][nx] = d[p.first][p.second];
                q.push_front({ny, nx});
            }
        }
        for (Int i = p.first - 2; i <= p.first + 2; i++) {
            for (Int j = p.second - 2; j <= p.second + 2; j++) {
                if (i < 0 or h <= i or j < 0 or w <= j) continue;
                if (b[i][j] == '#') continue;
                if (d[i][j] > d[p.first][p.second] + 1) {
                    d[i][j] = d[p.first][p.second] + 1;
                    q.push_back({i, j});
                }
            }
        }
    }
    print(d[t.first][t.second] == INF ? -1 : d[t.first][t.second]);
    return 0;
}


Measured memory_bytes: 12488
using System;

namespace ABC169C
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = Console.ReadLine().Trim().Split(' ');
            ulong a = ulong.Parse(t[0]);
            string s = t[1].Replace(".", ""); // 3桁の整数になる
            ulong b = ulong.Parse(s);
            ulong ans = a * b / 100;
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27600
#include<stdio.h>
int main(){
    unsigned short num;
    unsigned short i;
    unsigned short elt[100];
    for(i = 0;i < 100;i++){
        elt[i] = 0;
    }
    scanf("%d", &num);
    for(i = 0;i < num;i++){
        scanf("%d", &elt[i]);
    }
    for(i = num - 1;i > 0;i--){
        printf("%d ", elt[i]);
    }
    printf("%d\n", elt[0]);
    return 0;
}



Measured memory_bytes: 2036
#include <iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    if(n==2){
    for(int i=1;i<a[0];i++){
        if(a[0]%i==0&&a[1]%i==0)cout<<i<<endl;
    }
    }
   
    if(n==3){
    for(int i=1;i<a[0];i++){
        if(a[0]%i==0&&a[1]%i==0&&a[2]%i==0)cout<<i<<endl;
    }
    }
}

Measured memory_bytes: 3100
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<math.h>
typedef long long ll;
using namespace std;

int main()
{
	ll N; scanf("%lld", &N);
	ll x, y;
	for (x = sqrt(N); x > 0; --x) {
		if (N%x == 0) {
			y = N / x;
			break;
		}
	}
	printf("%lld", x + y - 2);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>

using namespace std;
int main()
{
  int s;
  cin >> s;
  std::vector<int> list;
  list.push_back(s);

  auto contain_same_val = [&list](int n_1) -> int
  {
    for (int i = 0; i < list.size(); ++i)
    {
      if (list[i] == n_1) {
        return list.size();
      }
    }
    return -1;
  };
  auto func = [](int n)
  {
    if (n%2 == 0)
    {
      return n/2;
    }
    else
    {
      return 3*n+1;
    }
  };

  int next = func(s);
  while(contain_same_val(next) < 0)
  {
    list.push_back(next);
    next = func(next);
  }

  list.push_back(next);
  cout << list.size() << endl;
  return 0;
}

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

int main() {
  int a,b,c,x,y;cin>>a>>b>>c>>x>>y;
  int ans=min(x,y)*min(a+b,2*c);
  if(x>y)ans+=min(a,2*c)*abs(x-y);
  if(x<y)ans+=min(b,2*c)*abs(x-y);
  cout<<ans<<endl;
}

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

#define ll long long 
#define int ll
#define endl "\n"

signed main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	//freopen("input.txt", "r", stdin); 
	//freopen("output.txt", "w", stdout);
	
	map <string, int> mp;
	int n;
	cin >> n;
	
	while (n--){
		string this_;
		cin >> this_;
		mp[this_]++;
	}	
	
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
		
}

Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {

    static void printBWD(String str, int n) {
        if (n < str.length()) {
            printBWD(str, n + 1);
            System.out.print(str.charAt(n));
        }
        return;
    }

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.next();
        printBWD(line, 0);
        System.out.println();
    }
}

Measured memory_bytes: 26048
#include <iostream>

using namespace std;

int main(void){
	int n;
	int m;
	int dist[21][21];
	
	cin >> n;
	cin >> m;

	for( int i = 0;i < 21;i++ ){
		for( int j = 0;j < 21;j++ ){
			dist[i][j] = 99999;
		}
	}
	for( int i = 0;i < 21;i++ ){
		dist[i][i] = 0;
	}

	for( int i = 0;i < m;i++ ){
		int a1,b1,c1,c2;
		scanf("%d,%d,%d,%d",&a1,&b1,&c1,&c2 );
		dist[a1][b1] = c1; dist[b1][a1] = c2;
	}

	for( int k = 1;k <= n;k++ ){
		for( int i = 1;i <= n;i++ ){
			if( dist[i][k] == 99999 ) continue;
			for( int j = 1;j <= n;j++ ){
				dist[i][j] = min( dist[i][k] + dist[k][j], dist[i][j] );
			}
		}
	}

	int x1,x2,y1,y2;

	scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);

	cout << y1 - ( dist[x1][x2] + dist[x2][x1] + y2 ) << endl;
	return 0;
}

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

int main(){
	int N, i, j, k;
	cin >> N;
	
	int ans=0;
	for(i=1; i<=N; i++){
		for(j=1; j<=N; j++){
			for(k=1; k<=N; k++){
				ans += __gcd(__gcd(i,j),k);
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  string ss, t;
  cin >> ss >> t;
  ll n = ss.size(), m = t.size();
  priority_queue<string, vector<string>, greater<string>> ans;
  for (ll i = 0; i < n - m + 1; i++) {
    for (ll j = 0; j < m; j++) {
      if (ss[i + j] != '?' && ss[i + j] != t[j]) break;
      if (j == m - 1) {
        string s;
        for (ll k = 0; k < n; k++) {
          if (k == i) {
            s += t;
            k += m - 1;
            continue;
          }
          if (ss[k] == '?') s += 'a';
          else s += ss[k];
        }
        ans.push(s);
      }
    }
  }
  if (ans.size() > 0) cout << ans.top() << endl;
  else cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin>>n>>m;
  long long kotae=0;
  int kakeru=1;
  for(int i=1;i<=m;i++)kakeru*=2;
  //cout<<kakeru<<endl;
  kotae=((n-m)*100+1900*m)*kakeru;
  cout<<kotae<<endl;
  return 0;
}

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

using namespace std;

int main()
{
   int n;
   float sol = 0;
	cin>>n;
   for(int i = 0 ; i < n ; i++)
   {
    float val;
    cin>>val;
    sol+=(1/val);
   }
  
  //cout<<sol<<endl;

   cout<<(1/sol)<<endl;
   return 0;

}

Measured memory_bytes: 384
s = 'HAKUTYUMU' + input()
 
 
while s != 'HAKUTYUMU':
    next_s = s
 
    if s[-5:] == 'dream':
        next_s = s[:-5]
    if s[-7:] == 'dreamer':
        next_s = s[:-7]
    if s[-5:] == 'erase':
        next_s = s[:-5]
    if s[-6:] == 'eraser':
        next_s = s[:-6]
 
    if s == next_s:
        print('NO')
        exit()
 
    s = next_s
 
print('YES')

Measured memory_bytes: 9176
n = int(input())
v = [int(i) for i in input().split()]
if [v[0]] * n == v:
    print(n // 2)
    exit()
even_n = {}
odd_n = {}
for i in range(0, n):
    if (i + 1) % 2 == 0:
        if str(v[i]) in even_n:
            even_n[str(v[i])] += 1
        else:
            even_n[str(v[i])] = 1
    if (i + 1) % 2 == 1:
        if str(v[i]) in odd_n:
            odd_n[str(v[i])] += 1
        else:
            odd_n[str(v[i])] = 1
even_n = sorted(even_n.items(), key=lambda x: x[1], reverse=True)
odd_n = sorted(odd_n.items(), key=lambda x: x[1], reverse=True)
unchanged = 0
if even_n[0][0] != odd_n[0][0]:
    unchanged = even_n[0][1] + odd_n[0][1]
else:
    unchanged = max(even_n[0][1] + odd_n[1][1], even_n[1][1] + odd_n[0][1])
print(n - unchanged)


Measured memory_bytes: 24284
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int c = 1;
        while(x != 0) {
            System.out.println("Case " + c + ": " + x);
            c++;
            x = scan.nextInt();
        }
    }
}


Measured memory_bytes: 41872
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

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

  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  vector<pair<int, int>> v(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    int b, c;
    cin >> b >> c;
    v[i] = {c, b};
  }
  sort(a.begin(), a.end());
  sort(v.begin(), v.end(), greater<pair<int, int>>());

  long long ans = 0;
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (j < m && a[i] < v[j].first) {
      ans += v[j].first;
      v[j].second--;
      if (v[j].second == 0)
        j++;
    } else {
      ans += a[i];
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(n, k);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }
    
    int ans = -INF;
    rep(i, data.size()+1) {
        for (int j = data.size(); j >= 0; j--) {
            if (i + data.size() - j > k) {
                //std::cout << "??" << std::endl;
                continue;
            }
            if (j < i) {
                //std::cout << "???" << std::endl;
                continue;
            }
            vi funami;
            for (int l = 0; l < i; l++) {
                funami.pb(data[l]);
            }
            for (int l = j; l < data.size(); l++) {
                funami.pb(data[l]);
            }
            /*
            std::cout << i << " " << j << std::endl;
            rep(l, funami.size()) {
                std::cout << funami[l] << " ";
            }
            cout << endl;
            */
            sort(all(funami));
            int yui = 0, kyoko = k - funami.size();
            rep(l, funami.size()) {
                if (funami[l] < 0) {
                    if (kyoko) {
                        kyoko--;
                    } else {
                        yui += funami[l];
                    }
                } else {
                    yui += funami[l];
                }
            }
            ans = max(ans, yui);
        }
    }

    std::cout << ans << std::endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		int y = Integer.parseInt(s.substring(0, 4));
		int m = Integer.parseInt(s.substring(5, 7));
		int d = Integer.parseInt(s.substring(8));

		String ans = "TBD";

		if (y <= 2019) {
			if (m <= 4) {
				if (d <= 30) {
					ans = "Heisei";
				}
			}
		}

		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n), f(n);
  REP(i, n) { cin >> a[i]; }
  REP(i, n) { cin >> f[i]; }
  sort(ALL(a));
  sort(ALL(f));
  reverse(ALL(f));
  // max Ai*Fi <= tにできるか
  ll ng = -1, ok = f[0] * a[n - 1];
  while (ng + 1 < ok) {
    ll m = (ok + ng) / 2;
    ll need = 0;
    REP(i, n) {
      if (a[i] * f[i] <= m) continue;
      need += -m / f[i] + a[i];
    }
    if (need <= k)
      ok = m;
    else
      ng = m;
  }
  cout << ok << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <algorithm>
// #include <atcoder/all>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
#define REP(i, m, n) for (ll(i) = (ll)(m); i < (ll)(n); ++i)
#define REP2(i, m, n) for (ll(i) = (ll)(n)-1; i >= (ll)(m); --i)
#define rep(i, n) REP(i, 0, n)
#define rep2(i, n) REP2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define rall(hoge) (hoge).rbegin(), (hoge).rend()
#define en '\n'
using Edge = pair<ll, ll>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
template <class T> inline void print(T x) { cout << x << '\n'; }
template <class T> bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)
ll n;
Graph G;
vl dist;
void dfs(ll cur, ll par, ll color) {
    dist[cur] = color;
    for (auto nx :G[cur]) {
        if (nx.first == par) continue;
        if (nx.second & 1) {
            dfs(nx.first,cur,1-color);
        } else {
            dfs(nx.first,cur,color);
        }
    }

}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    G.assign(n, vector<Edge>());
    rep(i,n-1) {
        ll u,v,w;
        cin >> u >> v >> w;
        --u;--v;
        G[u].push_back(Edge(v,w));
        G[v].push_back(Edge(u,w));
    }
    dist.assign(n,0);
    dfs(0,-1,1);
    for (auto res :dist) print(res);

    return 0;
}


Measured memory_bytes: 13316
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 1e16;

void solve(long long K, long long A, long long B) {
  if (A + 2 <= B && A + 1 <= K) {
    K -= A + 1;
    ll ans = B;
    ans += (B - A) * (K / 2) + K % 2;
    print(ans);
  } else {
    print(K + 1);
  }
}

int main() {
  long long K;
  scanf("%lld", &K);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(K, A, B);
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, ll> P;
const ll INF = (ll)1e18;
const int MAXN = 100005;
vector<P> G[MAXN];
int n, m;

ll dijkstra(int start) {
  vector<ll> dist(n, INF);
  priority_queue<pair<ll, int>, vector<pair<ll, int> >, greater<pair<ll, int> > > q;
  dist[start] = 0;
  q.emplace(0, start);
  while (!q.empty()) {
    pair<ll, int> cur = q.top(); q.pop();
    ll d = cur.first;
    int v = cur.second;
    if (dist[v] < d) continue;
    for (int i = 0; i < G[v].size(); ++i) {
      P next = G[v][i];
      ll d2 = next.second + d;
      int u = next.first;
      if (d2 < dist[u]) {
	dist[u] = d2;
	q.emplace(d2, u);
      }
    }
  }
  return dist[n - 1];
}
int main() {
  cin >> n >> m;

  for (int i = 0; i < n - 1; ++i) G[i + 1].push_back(P(i, 0LL));
  for (int i = 0; i < m; ++i) {
    int l, r;
    ll c;
    cin >> l >> r >> c;
    l--; r--;
    G[l].push_back(P(r, c));
  }

  ll ans = dijkstra(0);
  if (ans == INF) puts("-1");
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
int main() {
  ll N; cin >> N;
  string s, t; cin >> s >> t;
  ll p[53];
  p[0] = 1;
  if (s[0] == t[0]) {p[1] = 3;}
  else {p[2] = 6;}
  
  for (ll i = 2; i <= 52; i++) {
    if (s[i-1] == t[i-1]) {
      if (s[i-2] == t[i-2]) {
        p[i] = p[i-1]*2%mod;
      } else {
        p[i] = p[i-1];
      }
    } else {
      if (i >= 3 && s[i-2] == s[i-1] && s[i-3] == t[i-3]) {
        p[i] = p[i-2]*2%mod;
      }
      if (i >= 3 && s[i-2] == s[i-1] && s[i-3] != t[i-3]) {
        p[i] = p[i-2]*3%mod;
      }
      if (i == 2 && s[i-2] == s[i-1]) {
        p[i] = 6;
      }
    }
  }
  cout << p[N] << endl;
}

Measured memory_bytes: 256
#include <iostream> 
#include <bits/stdc++.h>
#include <vector> 
#include <algorithm> 
#include <string>
#include <cmath>
#include <iomanip> 
#include<climits> 
#include <utility>   
#include <set>
#include <numeric> 
#include <iterator>
#include <map> 
using namespace std; 
#define ll long long int
typedef pair<ll,ll> p;

int main() {
   int h1,h2,m1,m2,k;
   cin>>h1>>m1>>h2>>m2>>k;
   int p=h2-h1;
   p=p * 60;
  // cout<<p<<endl;
   int q=m2-m1;
   //cout<<q<<endl;
   p=p+(q)-k;
   cout<<p<<endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
    int main(void){
        int N, M, C;
        scanf("%d%d%d", &N, &M, &C);
        int B[M];
        int A[N][M];
        for (int i = 0; i < M; i++){
            scanf("%d", &B[i]);
        }
        for (int i = 0; i < N; i++){
            for (int j = 0; j < M; j++){
                scanf("%d", &A[i][j]);
            }
        }
     
        int ans = 0;
        int tmp;
        for (int i = 0; i < N; i++){
            tmp = 0;
            for (int j = 0; j < M; j++){
                tmp += A[i][j] * B[j];
            }
            if (tmp + C > 0){
                ans += 1;
            }
        }
        printf("%d\n", ans);
     
        return 0;
    }

Measured memory_bytes: 256
def side(a, b, c):
  return (c[1]-a[1])*(b[0]-a[0])-(b[1]-a[1])*(c[0]-a[0])>0
def isIn(x):
  return (side(p0, p1, x)==side(p1, p2, x)==side(p2, p0, x))

for _ in [0]*input():
  P = map(int, raw_input().split())
  p0 = P[0:2]
  p1 = P[2:4]
  p2 = P[4:6]
  print ['NG','OK'][isIn(P[6:8])!=isIn(P[8:])]

Measured memory_bytes: 4296
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main(){
    int a,b;
    string op;
    while (1) {
        cin >> a >> op >> b;
        if (op == "+") {
            cout << a + b << endl;
        } else if (op == "-") {
            cout << a - b << endl;
        } else if (op == "*") {
            cout << a * b << endl;
        } else if (op == "/") {
            cout << a / b << endl;
        } else {
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;

int main() {

  int N,R;
  cin>>N>>R;
  if(N>=10)cout<<R<<endl;
  else cout<<100*(10-N)+R<<endl;
  //vector<int> A(N);
  //for(int i=0; i<N; i++){cin>>A[i];}
  //vector<vector<int>> A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  //cout <<  << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i = a; i < b; i++)
#define pb push_back
typedef long long ll;
const int mod = 1e9+7;
int dp[3005][3005];
void self_add(int &a, int b)
{
    a+=b;
    if(a >= mod) a-=mod;
}
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;

    dp[1][1] = 1;
    fo(j,2,n+1)
    {
        vector <int>pre(n+1);
        fo(k,1,j) pre[k] = (pre[k-1] + dp[j-1][k])%mod;
        fo(i,1,j+1)
        {
            int l, r;
            if(s[j-2] == '>') l = i, r = j-1;
            else l = 1, r = i-1;
            dp[j][i] += ((pre[r] - pre[l-1] + mod) % mod);
            dp[j][i] %= mod;
            /*fo(k,1,j)
            {
                //int a = k;
                //if(k >= i) a++;
                //assert(a != i);
                //if((a < i) != (s[j-2] == '<')) continue;
                if(s[j-2] == '>' && i <= k) continue;
                if(s[j-2] == '<' && i > k) continue;
                self_add(dp[j][i], dp[j-1][k]);
            }*/
        }
    }
    int res = 0;
    fo(i,1, n+1) self_add(res, dp[n][i]);
    cout << res << endl;


}


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


int main()
{
	int N;//参加人数
	int D;//日数
	int X;//余り
	int A[100];//人数
	int ans = 0;//凝っ吸う

	cin >> N;
	cin >> D >> X;
	for (int i = 0; i < N; i++) cin >> A[i];

	for (int i = 1; i <= N; i++) {//A[i]
		for (int j = 1; j<=D; j++) {//何個食べられるか
			if (j == 1) {
			
				ans++;
			}
			else if (((j-1)*A[i-1] + 1) <= D) {
			
				ans++;
			}
			else {
				
				break;
			}
		}
	}
	cout << ans+X << endl;

    return 0;
}



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

#define i64 long long int
#define ran 202202

int n, p;
char s[ran];
int rem[ran], f[ran];

int main() {
	scanf("%d%d", &n, &p);
	scanf("%s", s);
	
	i64 ans = 0LL;
	if(p==2 || p==5) {
		for(int i=0;i<n;i++)
			if((s[i]-'0')%p==0) ans += i+1;
		printf("%lld\n", ans);
		return 0;
	}
	
	int pw = 1;
	for(int i=n-1;i>=0;i--) {
		rem[i] = (rem[i+1] + (s[i]-'0')*pw) % p;
		pw = pw * 10 % p;
	}
	
	memset(f, 0, sizeof f);
	f[0] = 1;
	for(int i=0;i<n;i++) {
		ans += f[rem[i]];
		f[rem[i]]++;
	}
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 2048
N = gets.to_i
P = N.times.map{
	gets.split.map(&:to_i)
}
s = 0.0
(0..N-2).each{|i|
	(i+1..N-1).each{|j|
		s += Math.sqrt((P[j][0]-P[i][0])**2 + (P[j][1]-P[i][1])**2)
	}
}
p 2*s/N


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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

int main() {
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
    reverse(sa.begin(), sa.end());
    reverse(sb.begin(), sb.end());
    reverse(sc.begin(), sc.end());
    int cnt = 0;
    char turn;
    while (sa.size() || sb.size() || sc.size()) {
        cnt++;
        if (cnt == 1) turn = sa[sa.size() - 1];
        else if (turn == 'a') {
            if (sa.size() > 0) turn = sa[sa.size() - 1];
            else break;
            sa.pop_back();
        } else if (turn  == 'b') {
            if (sb.size() > 0) turn = sb[sb.size() - 1];
            else break;
            sb.pop_back();
        } else {
            if (sc.size() > 0) turn = sc[sc.size() - 1];
            else break;
            sc.pop_back();
        }
    }
    if (turn == 'a') cout << 'A' << endl;
    else if (turn == 'b') cout << 'B' << endl;
    else cout << 'C' << endl;
}

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

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1000000007;

int main(){
	ll x,y,len=0;
	cin>>x>>y;

	ll tmp=x;
	while(tmp <= y){
		tmp *= 2;
		len++;
	}

	cout<< len <<endl;

	return 0;
}

Measured memory_bytes: 256
kazu = int(input())
numbers_list = list(map(int, input().split()))
count = 0
seisu = 0
while True:
    for index in range(kazu):
        if numbers_list[index] % 2 != 0:
            seisu = 1
            break
        else:
            numbers_list[index] = numbers_list[index] / 2
    if seisu == 1:
        break
    count += 1
print(count)

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

using namespace std;

int main()
{
    string S, T;

    cin >> S >> T;

    for(int i = 0; i < S.size(); i++){
	if(S == T){
	    cout << "Yes" << endl;
	    return 0;
	}
	char c = S.at(S.size()-1);
	for(int j = S.size()-1; j >= 1; j--){
	    S.at(j) = S.at(j-1);
	}
	S.at(0) = c;
    }
    cout << "No" << endl;
    
}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  for(int i=min(a,b); i>0; i--) {
     if(a%i==0 && b%i==0) {
       c--;
       if(c==0) {
         cout << i << endl;
         return 0;
       }
     }
  }
  
  return 0; 
}

Measured memory_bytes: 256