akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<list>
#include<utility>
#include<tuple>
#include<map>
#include<unordered_map>
#include<complex>
#include<set>
#define itn int
#define retrun return
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
typedef long long llong;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通
string S;
llong K;
llong ANS = 0;
vector<llong> A;
int main() {
	cin >> S;
	cin >> K;

	llong tmp = 1;
	if (S.length() == 1) {
		A.push_back(1);
	}
	for (int i = 1; i < S.length(); i++) {
		if (S[i - 1] == S[i]) {
			tmp++;
			if (i == S.length() - 1) {
				A.push_back(tmp);
			}
		}
		else {
			A.push_back(tmp);
			tmp = 1;
		}
	}
	if (A.size() == 1) {
		ANS = (A[0] * K) / 2;
	}
	else if (S[0] == S[S.length() - 1]) {
		llong a = A[0];
		llong b = A[A.size() - 1];
		A[0] += A[A.size() - 1];
		A.pop_back();
		for (int i = 0; i < A.size(); i++) {
			ANS += A[i] / 2;
		}
		ANS *= K;
		ANS -= A[0] / 2;
		ANS += a / 2 + b / 2;

	}
	else {
		for (int i = 0; i < A.size(); i++) {
			ANS += A[i] / 2;
		}
		ANS *= K;
	}
	cout << ANS << endl;
	return 0;
}

Measured memory_bytes: 256
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())

# print(a,v)
# print(b,w)
# print(t)

if a <= b:
    if a + v * t >= (b + w * t):
        print('YES')
    else:
        print('NO')
else:
    if a - v * t <= (b - w * t):
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 9188
/* ****GT_18**** */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define INF			1000000000000000
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
using namespace __gnu_pbds;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll n;
		cin>>n;
		vector<pii> d;
		rep(i,0,n){
			ll x,y;
			cin>>x>>y;
			d.pb({x,y});
		}
		rep(i,2,n){
			if(d[i].F==d[i].S && d[i-1].F==d[i-1].S && d[i-2].F==d[i-2].S){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		cout<<"No"<<endl;
		

	}
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,e) for(int i=s;i<e;i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(),(a).end()
typedef long long LL;
const LL mod = 1000000007;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i=0;i<n;i++) a[i]=n-i;
    for(int i=0;i<m;i++){
        int x;cin >> x;
        a.push_back(x);
    }
    vector<bool> s(n+1,false);
    for(int i=a.size()-1;i>=0;i--){
        if(s[a[i]]==false){
            cout << a[i] << endl;
            s[a[i]]=true;
        }
        else continue;
    }
    return 0;
}



Measured memory_bytes: 4440
from collections import deque
H,W=map(int,input().split())
A= [list(input()) for _ in range(H)]
d= [[2000 for _ in range(W)] for _ in range(H)]
move= [ (0,1),(0,-1),(1,0),(-1,0) ]
z= [[False for _ in range(W)] for _ in range(H)]
ans=0

v=deque([])
for i in range(H):
    for j in range(W):
        if A[i][j]=="#":
            v.append( [i,j] )
            z[i][j]=True
            d[i][j]=0
while v:
    a=v.popleft()
    #print(a,v)
    for mv in move:
        s=a[0]+mv[0]
        t=a[1]+mv[1]
        if 0<=s<H and 0<=t<W:
            if z[s][t]==False:
                z[s][t]=True
                d[s][t]=d[a[0]][a[1]]+1
                v.append([s,t])
                ans=max(ans,d[s][t])
#print(d)
print(ans)

Measured memory_bytes: 181852
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(int X = 0; X < (N); X++)
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ceilint(A, B) ((A) + (B - 1)) / (B)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

int main(){

    int m,d;
    cin >> m >> d;

    int ans = 0;

    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= d; j++){
            int d1 = j / 10;
            int d2 = j % 10;

            if(d1 >= 2 && d2 >= 2 && i == d1 * d2){
              
              ans++;
        	}
        }
    }

    cout << ans << 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 ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
int inf=1000001000;
ll INF=1e18;
ll mod=1000000007;
ll MOD=INF;

int main() {
    string s;
    cin >> s;
    if (s[s.size()-1]=='s'){
        s.push_back('e');
        s.push_back('s');
    }
    else s.push_back('s');
    cout << s << endl;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, A, B;
  cin >> N >> A >> B;
  if(N == 1 && A != B || B < A) {
    cout << 0 << endl;
    return 0;
  }
  int mn = A*(N-1)+B;
  int mx = A+B*(N-1);
  cout << mx - mn + 1 << endl;


  return 0;
}


Measured memory_bytes: 256
/*Ankon Ghosh
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
///#include <ext/pb_ds/detail/standard_policies.hpp>*/
///using namespace __gnu_pbds;
using namespace std;
using ll=long long;
#define inf 1e16
#define MAX 100005
#define mod 998244353
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) printf("Case %lld: ",i)
#define setpre(number) cout<<fixed<<setprecision(10)<<number<<endl
#define pf(a) printf("%lld ",a)
#define pff(a,b) printf("%lld %lld\n",a,b)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll i=x;i<=y;i++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p make_pair
#define ff first
#define ss second
#define p_b push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define output freopen("output.txt","w",stdout)
map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp1;
vector<pair<ll,ll> >vpp,vp1;
vector<ll>v,v1,v2,fin;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll a,b,c,n,d,e,f,ta,sum=0,cnt=0,m,l,req,sz,maxi,k;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
int main()
{
    fast;
    cin>>n;
    ll x=1000-(n%1000LL);
    if(x==1000LL) x=0;
    cout<<x<<endl;
    //cout<<min(0LL,1000-(n%1000LL))<<endl;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int num[26];

int main()
{
  int n;
  string s;
  cin>>n>>s;
  REP(i,n) 
    num[s[i]-'a']++;
  
  ll ans = 1ll;
  REP(i,26) {
    ans = ans * (num[i] + 1) % MOD;
  }
  cout<<ans - 1<<endl;
  return 0;
}

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

using namespace std;

int main(){

    int n;
    cin >> n;
    vector<int> arr(n);
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    int cnt = 0;
    for(int i = 0; i+2 < n; i++){
        if( (arr[i] <= arr[i+1] && arr[i+1] <= arr[i+2]) || (arr[i] >= arr[i+1] && arr[i+1] >= arr[i+2]) )
            cnt++;
    }
    cout << cnt ;
    return 0;
}

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

#define ll long long 

using namespace std;

ll getMaxSet(int n, int W, vector <int>& w, vector <int>& v) {
	vector <vector <ll>> dp(W + 1, vector <ll>(n + 1, 0)); 
	for (int i = 1; i <= W; ++i) {
		for (int j = 1; j <= n; ++j) {
			dp[i][j] = max(dp[i][j - 1], 
			 (i - w[j - 1] >= 0) ? dp[i - w[j - 1]][j - 1] + v[j - 1] : 0);
		}
	}
	return dp[W][n];
}



int main() {
	int n, W, a, b;
	vector <int> w, v;
	cin >> n >> W;
	for (int i = 0; i < n; ++i)
		cin >> a >> b, w.push_back(a), v.push_back(b);
		
	cout << getMaxSet(n, W, w, v) << endl;
}



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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vi d(n);
    rep(i, n) cin >> d[i];
    VSORT(d);
    d.erase(unique(all(d)), d.end());
    cout << sz(d) << endl;
    return 0;
}


Measured memory_bytes: 3596
use std::cmp::max;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut s = sc.chars();

    let mut ans = 0;
    for pos in 0..n {
        if s[pos] != '.' {
            continue;
        }
        s[pos] = 'W';
        let w = capture(&s, 'W');
        let b = capture(&s, 'B');
        if b == 0 {
            ans = max(ans, w);
        }
        s[pos] = '.';
    }
    println!("{}", ans);
}

fn capture(s: &Vec<char>, color: char) -> usize {
    let n = s.len();
    let mut ans = 0;
    for left in 0..n {
        for right in (left + 1)..n {
            if s[left] != color || s[right] != color {
                continue;
            }
            if ((left + 1)..right).any(|i| s[i] == color || s[i] == '.') {
                continue;
            }
            let count = right - left - 1;
            ans = max(ans, count);
        }
    }
    ans
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



Measured memory_bytes: 5036
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int N;cin >> N;
    vector<LL> a(N);
    vector<LL> b(N);
    rep(i,N)cin >> a[i];
    rep(i,N)cin >> b[i];


    LL sa = 0;
    LL suma = 0;
    LL sumb = 0;

    rep(i,N){
        if(a[i] < b[i])sa += (b[i] - a[i] + 2 -1)/2;
        suma += a[i];
        sumb += b[i];
    }

    LL tmp = sumb - suma;



    if(tmp >= sa)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio> 

using namespace std;

int main()
{
    register char c;
    while((c = getchar()) != EOF)
    {
        if(c == 'C')
        {
            while((c = getchar()) != EOF)
            {
                if(c == 'F')
                {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val W = sc.nextInt()
    val H = sc.nextInt()
    val x = sc.nextInt()
    val y = sc.nextInt()
    val r = sc.nextInt()

    if (x - r < 0 || x + r > W || y - r < 0 || y + r > H) {
        println("No")
    } else if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= W) {
        println("Yes")
    }
}


Measured memory_bytes: 27152
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int h,w; cin >> h >> w;
  vector<vector<int>> a(h,vector<int>(w));
  rep(i,h)rep(j,w) cin >> a[i][j];
  
  rep(i,h)rep(j,w){
    int b; cin >> b;
    a[i][j] = abs(a[i][j] - b);
  }
  const int m = 80*80;
  
  vector<vector<vector<bool>>> dp(h,vector<vector<bool>>(w,vector<bool>(m+1,false)));
  dp[0][0][a[0][0]] = true;
  rep(i,h){
    rep(j,w){
      rep(k,m+1){
        if((i >= 1 && dp[i-1][j][k])||(j >= 1 && dp[i][j-1][k])){
          dp[i][j][abs(k-a[i][j])] = true;
          if(k + a[i][j] <= m){
            dp[i][j][k+a[i][j]] = true;
          }
        }
      }
    }
  }
  
  rep(i,m+1){
    if(dp[h-1][w-1][i]){
      cout << i << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<59;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e5;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vi a(13);

int main(){
	cin>>n;
	a[0]++;
	for(int i=0;i<n;i++){
		int A;
		cin>>A;
		a[A]++;
	}
	int res=0;
	for(int i=0;i<1<<13;i++){
		vi b;
		for(int j=0;j<13;j++){
			for(int k=0;k<a[j];k++){
				if((i>>j)%2^k%2) b.push_back(j);
				else b.push_back(24-j);
			}
		}
		sort(b.begin(),b.end());
		int tmp=24+b[0]-b[n];
		for(int j=0;j<n;j++) tmp=min(tmp,b[j+1]-b[j]);
		res=max(res,tmp);
	}
	cout<<res<<endl;
}

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

int main() {
    string s;
    cin >> s;
    rep(i, s.size()) {
        if((i + 1) % 2 == 0) {
            if(s[i] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if(s[i] == 'L') {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3604
import java.io.PrintWriter

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val xs = readLine()!!.split(' ').map { it.toInt() }
    val (m1, m2) = xs.sorted().slice(arrayOf(n / 2 - 1, n / 2).asIterable())
    val pw = PrintWriter(System.out)
    xs.forEach {
        if (it < m2) {
            pw.println(m2)
        } else {
            pw.println(m1)
        }
    }
    pw.flush()
}


Measured memory_bytes: 83044
fun main(args: Array<String>) {
    val (x, y,z) = readLine()!!.split(" ").map{ it.toInt() }
    val l = readLine()!!
    var ac = 0
    var bc = 0
    for (i in 0 until x){
        if (l[i] == 'a' && ac + bc < y + z){
            ac += 1
            println("Yes")
        }
        else if (l[i] == 'b' && ac + bc < y + z && bc < z){
            bc += 1
            println("Yes")
        }
        else println("No")
    }
}


Measured memory_bytes: 42368
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  if(s.size()>t.size()) {
    cout << "GREATER" << endl;
    return 0;
  }
  else if(s.size()<t.size()) {
    cout << "LESS" << endl;
    return 0;
  }
  for(int i=0; i<max(s.size(), t.size()); i++) {
    if(s.at(i)>t.at(i)) {
      cout << "GREATER" << endl;
      return 0;
    }
    else if(s.at(i)<t.at(i)) {
      cout << "LESS" << endl;
      return 0;
    }
  }
  cout << "EQUAL" << endl;
  return 0;
}

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

int main(void)
{
    int i;
    int answer= 0;
    char S[4];
    char T[4];
    
    scanf("%s", &S);
    
    scanf("%s", &T);
    
    
    for(i=0; i<3; i++)
    {
        if(S[i] == T[i])//同じであれば
        {
            //answer= answer + 1;
            answer++;
        }
        
    }
   
    printf("%d",answer);
    /*if(!strncmp(S, T, 1))//1
    {
        puts("111");
            if(!strncmp(S, T, 2))//2
            {
                puts("222");
                
                if(!strncmp(S, T, 2))//2
                {
                    puts("333");
                }
            }
            
        }*/
    

}
//S, C, R





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

using namespace std;

struct Test {
    long long b, l, u;
    long long get(long long X) const { return u*(X-b) + l*b; }
};

int main(){
    int N; long long X;
    while(cin >> N >> X){
        vector<Test> vt(N);
        for(auto& t : vt) cin >> t.b >> t.l >> t.u;
        sort(vt.rbegin(), vt.rend(), [&](const Test& a, const Test&b){return a.get(X) < b.get(X);});
        long long L = -1, R = N*X;
        while(R-L > 1){
            long long mid = (L+R)/2;
            int last = mid/X;
            int rest = mid%X;
            long long win = 0, maxIdx = N, maxVal = 0;
            if(rest > 0){
                long long border = vt[last].get(X);
                for(int i=0;i<N;i++){
                    long long v = (rest <= vt[i].b ? vt[i].l * rest :  vt[i].l * vt[i].b + vt[i].u * (rest - vt[i].b)) ;
                    v -= max(0LL, vt[i].get(X) - border);
                    if(v > maxVal){ maxVal = v; maxIdx = i; }
                }
            }
            if(maxIdx != N){
                win += (rest <= vt[maxIdx].b ? vt[maxIdx].l : vt[maxIdx].u) * (rest - vt[maxIdx].b);
            }
            int fullCnt = 0;
            for(int i=0;i<N;i++){
                if(i == maxIdx) continue;
                if(fullCnt < last){
                    win += vt[i].get(X);
                    ++fullCnt;
                }
                win -= vt[i].b * vt[i].l;
            }
            if(win >= 0) R = mid;
            else L = mid;
        }
        cout << R << endl;
    }
}

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

int n,x;
int a[210];
int main()
{
	scanf("%d%d",&n,&x);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	int ans=0;
	for (int i=1;i<=n;i++)
	{
		if (a[i]<=x)	x-=a[i],ans++;
		else {x=-1;ans++;break;}
	}
	if (x!=0)	ans--;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <utility>
using namespace std;

int main(){
	long long N, K;
	cin >> N >> K;
	vector<long long> A(N);
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	long long ans = (N - 1) / (K - 1);
	if((N - 1) % (K - 1) > 0) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 1024
#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<ll, ll> 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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<pair<string, P>> v;
    int n;
    cin >> n;
    rep(i,n){
        string s;
        int p;
        cin >> s >> p;
        v.emplace_back(s, P(p, i));
    }
    sort(v.begin(), v.end());
    vector<P> ord;
    rep(i,n){
        if(ord.empty() || v[i].first == v[i-1].first){
            ord.emplace_back(v[i].second);
        }
        else{
            sort(ord.rbegin(), ord.rend());
            for(auto p : ord){
                cout << p.second + 1 << endl;
            }
            ord.clear();
            ord.emplace_back(v[i].second);
        }
    }
    sort(ord.rbegin(), ord.rend());
    for(auto p : ord){
        cout << p.second + 1 << endl;
    }
	return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll n;
	string s1, s2;
	ll ans = 1;
	ll prev = 0;
	ll C = 1000000007;

	cin >> n >> s1 >> s2;

	REP(i, s1.size()) {
		if (s1[i] == s2[i]) {
			if (prev == 1) {
				ans = ans * 2 % C;
			}
			else if (prev == 2) {
				ans = ans % C;
			}
			else {
				ans = ans * 3 % C;
			}
			prev = 1;
		}
		else {
			if (prev == 1) {
				ans = ans * 2 % C;
			}
			else if (prev == 2) {
				ans = ans * 3 % C;
			}
			else {
				ans = ans * 6 % C;
			}
			prev = 2;
			i++;
		}
	}

	cout << ans << endl;
}

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

int limit[10];
vector<string> now;
vector<string> able;
vector<string> ableHead;
bool flag;

vector<int> allCount(vector<string>tmp){
	vector<int> ret(10,0);
	
	for(int si=0;si<tmp.size();si++){	
		for(int i=0;i<tmp[si].length();i++){
			ret[tmp[si][i]-'0']++;
		}
	}
	return ret;
}

bool malCheck(vector<string> tmp){
	vector<int> t = allCount(tmp);
	for(int i=0;i<10;i++){
		if(t[i]>limit[i])return true;
	}
	return false;
}

bool wantCheck(string s){
	if(s[1]==s[0]+1|| s[0] == s[1])return false;
	return true;
}

void bt2(){
	/* KèI[o[µ½ç²¯oµ */
	if(malCheck(now))return;
	
	/* 4R Êqª»ëÁ½Èç */
	if(now.size() == 5){
		flag = true;
		return;
	}
	
	for(int i=0;i<able.size();i++){
		vector<string> t = now;
		now.push_back(able[i]);
		bt2();
		now = t;
	}
}

int search(string s){
	now.clear();able.clear();ableHead.clear();
	fill(limit,limit+10,0);
	string chk;
	sort(s.begin(),s.end());
	chk = s;
	chk.erase(unique(chk.begin(),chk.end()),chk.end());
	
	/*Â¦*/
	for(int i=0;i<s.length();i++)limit[s[i]-'0']++;
	
	/* q Æ ª */
	for(int i=0;i<chk.length();i++){
	
		/* q */
		if(count(s.begin(),s.end(),chk[i]) >= 3){
			string t="";
			t+=chk[i];t+=chk[i];t+=chk[i];
			able.push_back(t);
		}
		
		/* ª */
		if(count(s.begin(),s.end(),chk[i]) >= 2){
			string t="";
			t+=chk[i];t+=chk[i];
			ableHead.push_back(t);
		}
		
	}
	/* q */
	for(int i=0;i<chk.length()-2;i++){
		if(chk[i+1]==chk[i]+1 && chk[i+2]==chk[i]+2){
			string t="";
			t+=chk[i];t+=chk[i]+1;t+=chk[i]+2;
			able.push_back(t);
		}
	}
	
	flag = false;
	
	/* ªÒ¿Tµ */
	for(int i=0;i<ableHead.size();i++){
		now.push_back(ableHead[i]);
		bt2();
		now.pop_back();
	}
	return flag;
}

int main(){
	string str,s;
	while( cin >> str ) {
		if(str.length() != 13){
			continue;
		}
		bool ret,f = false;
		for(int i=1;i<=9;i++){	
			if(count(str.begin(),str.end(),'0'+i)>=4)continue;
			s = str; s+='0'+i;
			ret = search(s);
			if(ret){
				cout << (f?" ":"") << i;
				f = true;
			}
		}
		cout << (f?"":"0") << endl;
	}
}

Measured memory_bytes: 928
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;




int main(){
	ll n;
	string s;
	cin >> n;
	cin >> s;
	
	int len = s.size();
	ll r = 0;
	ll g = 0;
	ll b = 0;
	for ( int i = 0; i < len; i++ ){
		if ( s[i] == 'R' ) r++;
		if ( s[i] == 'G' ) g++;
		if ( s[i] == 'B' ) b++;
	}
	
	ll count = 0;
	for ( int i = 0; i < len-2; i++ ){
		for ( int j = 1; i+j*2 < len; j++ ){
			if ( s[i] + s[i+j] + s[i+j*2] == 'R'+'G'+'B' )
				count++;
		}
	}
	
	cout << r*g*b-count << endl;
	
	return 0;
}




Measured memory_bytes: 3576
/*************************************************\
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

#include<bits/stdc++.h>
using namespace std;

#define         ikarus_101     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define         scl(x)         scanf("%lld",&x)
#define         scll(x,y)      scanf("%lld%lld",&x,&y)
#define         sclll(x,y,z)   scanf("%lld%lld%lld",&x,&y,&z)
#define         scc(x)         scanf("%c",&x)
#define         scs(x)         scanf("%s",&x)
#define         pfl(x)         printf("%lld\n",x)
#define         pfll(x,y)      printf("%lld %lld\n",x,y)
#define         pyes           puts("Yes")
#define         pno            puts("No")
#define         nel            printf("\n")
#define         spc            ' '
#define         nn             '\n'

#define         vcl            vector<ll>
#define         mpl            map<ll,ll>
#define         vpl            vector<pair<ll,ll>>
#define         pb             push_back
#define         mkp(x,y)       make_pair(x,y)
#define         F              first
#define         S              second
#define         vin(a)         for(auto &it : a) cin>>it
#define         vout(a)        for(auto it : a) cout<<it<<spc;cout<<nn
#define         yes            cout<<"YES"<<"\n"
#define         no             cout<<"NO"<<"\n"
#define         all(a)         a.begin(),a.end()
#define         sajo(str)      sort(str.begin(),str.end())
#define         rev(str)       reverse(str.begin(),str.end())
#define         usajo(str)     sort(str.rbegin(),str.rend())

#define         rep(i,n)       for ( i=0 ; i<n ; ++i )
#define         rep1(i,n)      for ( i=1 ; i<=n ; ++i )

#define         pi             2*acos(0.0)
#define         gcd(a,b)       __gcd(a,b)
#define         lcm(a,b)       (a/gcd(a,b))*b
#define         mem(a,b)       memset(a,b,sizeof (a))
#define         dec(x)         cout<<fixed<<setprecision(x)
#define         min3(a,b,c)    min(a,min(b,c))
#define         max3(a,b,c)    max(a,max(b,c))
#define         LIM            100005

typedef     unsigned long long      ull;
typedef     long long               ll;
typedef     long double             ld;

const   ll  N   =   2e5+7;
const   ll  M   =   1e9+7;
const   ll  lmx =   92233720368547758;

int main() {ikarus_101

      ll n,m,a,b,c,d,x,y,i,j,k;

      scll(x,y);
      if(2*x <= y  &&  y <= 4*x  &&  y%2==0) pyes;
      else pno;
      return 0;
}



Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string s,t;
  cin>>s>>t;
 
  vector<vector<int>>dp(s.length()+1,vector<int>(t.length()+1,0));
  
  for(int i = 0; i <= s.length(); i++){
    for(int j = 0; j <=t.length(); j++){
      if(i == 0 || j == 0)
        dp[i][j] = 0;
      else if (s[i - 1] == t[j - 1])
        dp[i][j] = 1 + dp[i - 1][j - 1];
      else
        dp[i][j] = max(dp[i - 1][j] , dp[i][j - 1]);
    }
  }

  string ans(dp[s.length()][t.length()],32);

  int i = s.length(), j = t.length();
  int index = dp[s.length()][t.length()] - 1;
  while(i > 0 && j > 0){
  	if(s[i - 1] == t[j - 1]){
  		ans[index--] = s[i - 1];
  		i--, j--;
  	}
  	else if(dp[i - 1][j] > dp[i][j - 1])
  		i--;
  	else
  		j--;
  }
  cout<<ans;
}

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

int a[40]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main()
{
	int k;
	scanf("%d",&k); 
	printf("%d",a[k]);
}

Measured memory_bytes: 256
cRewrite :: (Int, [Int]) -> (Int, [Int])
cRewrite (c, is)
    | all (==0) is || any odd is = (c, [])
    | otherwise                  = cRewrite (c + 1, map (`div`2) is)

main = getLine >> getLine >>= \cs -> print . fst $ cRewrite (0, map (read :: String -> Int) (words cs))

Measured memory_bytes: 1020
from heapq import *
n, m = map(int, input().split())
a = list(map(int, input().split()))


que = []

for v in a:
    heappush(que, -v)

for i in range(m):
    heappush(que, heappop(que) / 2)

print(-sum(int(v) for v in que))


Measured memory_bytes: 86424
from heapq import heapify, heappop, heappush
k, t = map(int, input().split())
a = list(map(int, input().split()))

que = []
heapify(que)

for i in range(t):
    heappush(que, (-a[i], i))

s = [-1]
while len(que) > 0:
    if len(que) == 1:
        a_i, idx = heappop(que)
        for _ in range(-a_i):
            s.append(idx)
        break
    else:
        a_i, idx_i = heappop(que)
        if s[-1] == idx_i:
            a_j, idx_j = heappop(que)
            s.append(idx_j)
            heappush(que, (a_i, idx_i))
            a_j += 1
            if a_j < 0:
                heappush(que, (a_j, idx_j))
        else:
            s.append(idx_i)
            a_i += 1
            if a_i < 0:
                heappush(que, (a_i, idx_i))

cnt = 0
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        cnt += 1
print(cnt)


Measured memory_bytes: 48856
#include <iostream>

using namespace std;

int main()
{
	int sx, sy, tx, ty;
	int i;
	cin >> sx >> sy >> tx >> ty;

	for (i = 0; i < tx - sx; i++) cout << "R";
	for (i = 0; i < ty - sy; i++) cout << "U";
	for (i = 0; i < tx - sx; i++) cout << "L";
	for (i = 0; i < ty - sy; i++) cout << "D";

	cout << "D";
	for (i = 0; i < tx - sx + 1; i++) cout << "R";
	for (i = 0; i < ty - sy + 1; i++) cout << "U";
	cout << "L";

	cout << "U";
	for (i = 0; i < tx - sx + 1; i++) cout << "L";
	for (i = 0; i < ty - sy + 1; i++) cout << "D";
	cout << "R";


	return 0;
}

Measured memory_bytes: 256
// Vicfred
// https://atcoder.jp/contests/abc135/tasks/abc135_c
// greedy
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main() {
    long n = readln.chomp.to!long;
    long[] as = readln.split.map!(to!long).array;
    long[] bs = readln.split.map!(to!long).array;

    long monsters = 0L;
    for(long i = n-1; i >= 0L; i--) {
        long bugs = min(bs[i], as[i+1]);
        //writefln("mate %d bichos", bugs);
        monsters += bugs;
        as[i+1] -= bugs;
        bs[i] -= bugs;
        bugs = min(as[i],bs[i]);
        //writefln("mate %d bichos", bugs);
        monsters += bugs;
        bs[i] -= bugs;
        as[i] -= bugs;
        //as.writeln;
        //bs.writeln;
    }
    monsters.writeln;
}



Measured memory_bytes: 10348
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

//import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] sp1 = (in.readLine()).split(" ");

		// Scanner sc = new Scanner(System.in);
		// String line1 = sc.nextLine();
		// String[] sp1 = line1.split(" ");

		int n = Integer.parseInt(sp1[0]);
		int k = Integer.parseInt(sp1[1]);

		int sum = 0;

		int[] w = new int[n];
		for (int i = 0; i < n; i++) {
			w[i] = Integer.parseInt(in.readLine());
			sum += w[i];
			//P = Math.max(P, w[i]);
		}

		//P = Math.max(P, sum / k);
		
		int P = sum / k;

		int kCount;
		int nCount;

		while (true) {
			nCount = 0;
			kCount = 0;
			while (nCount < n && kCount < k) {
				int weight = 0;
				while (nCount < n && weight + w[nCount] <= P) {
					weight += w[nCount];
					nCount++;
				}
				kCount++;
			}

			if (nCount == n) {
				System.out.println(P);
				break;
			}
			P++;
		}

	}

}

Measured memory_bytes: 35008
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cmath>		
#include <stdio.h>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int (i) = 0; (i) < int(n); i++)
#define mod 1000000007
#define fst first
#define pb push_back


int main()
{
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int x = x2 - x1;
	int y = y2 - y1;
	cout << x2 - y << " " << y2+x << " " << x1-y << " " << y1+x << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    if(k%2 == 0){
        p(a-b);
    }
    else{
        p(b-a);
    }
    
    return 0;
}

Measured memory_bytes: 256
loop do
    n = gets.to_i
    if n == 0
        break
    end

    a = gets.split(' ').map(&:to_i)
    ave_num = a.inject(:+) / n

    cnt = 0
    a.each{|num|
        if num <= ave_num
            cnt += 1
        end
    }
    p cnt
end



Measured memory_bytes: 7388
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <queue>
#include <iomanip>
#include <iterator>

#define MOD 1000000007
#define INF 1000000001

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


template <class T>
ostream &operator<<(ostream &o, const vector<T>&obj) {
    o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U>&obj) {
    o << "(" << obj.first << ", " << obj.second << ")"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const set<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const queue<T>&obj) {
    queue<T> obj_cp = obj;
    bool first = true;
    o << "{";
    while (!obj_cp.empty()) { o << (!first ? ", " : "") << obj_cp.front(); obj_cp.pop(); first = false; }
    o << "}"; return o;
}

void print() {
    cout << "\n";
}
template<class Head, class... Body>
void print(Head head, Body... body) {
    cout << head << " ";
    print(body...);
}


int main(int argc, char const *argv[]) {
    ll A, B, N;
    cin >> A >> B >> N;
    ll x = min(B-1, N);
    ll ans = (A*x)/B - A*(x/B);
    // print(x);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;

int main() {
	int N;
	cin >> N;
	vector<int>V(N);
	vector<int>P(N);
	vector<int>Q(N);
	rep(i, N) {
		V[i] = i + 1;
	}
	rep(i, N) {
		cin >> P[i];
	}
	rep(i, N) {
		cin >> Q[i];
	}
	bool flag = true;
	int a = 0;
	int b = 0;
	int cnt = 0;
	do {
		flag = true;
		cnt++;
		rep(i, N) {
			if (V[i] != P[i]) {
				flag = false;
			}
		}
		if (flag == true) {
			a = cnt;
		}
		flag = true;
		rep(i, N) {
			if (V[i] != Q[i]) {
				flag = false;
			}
		}
		if (flag == true) {
			b = cnt;
		}

	} while (next_permutation(V.begin(), V.end()));

	cout <<abs(a-b)<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
} 
vector<ll> dp1(1000000),dp2(30000000);
int main(){
    ll n;cin >> n;
    vl a(3),b(3);rep(i,3)cin >> a[i];rep(i,3)cin >> b[i];
    a.pb(1);b.pb(1);
    rep(i,5010){
        rep(j,4){
            chmax(dp1[i+a[j]],dp1[i]+b[j]);
        }
    }
    n=dp1[n];
    rep(i,25000010){
        rep(j,4){
            chmax(dp2[i+b[j]],dp2[i]+a[j]);
        }
    }
    cout << dp2[n] <<endl;
}

Measured memory_bytes: 245164
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D;cin>>D;
  if(D==25)
    cout<<"Christmas"<<endl;
  else if(D==24)
    cout<<"Christmas Eve"<<endl;
  else if(D==23)
    cout<<"Christmas Eve Eve"<<endl;
  else if(D==22)
    cout<<"Christmas Eve Eve Eve"<<endl;
}

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

int main(void)
{
    int n, k, x, y;
    int cost = 0;
    cin >> n >> k >> x >> y;
    for (int i = 1; i <= n; i++)
    {
        if (i <= k)
        {
            cost += x;
        }
        else
        {
            cost += y;
        }
    }
    cout << cost << endl;
}

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

int main() {
    cout.tie(0)->sync_with_stdio(0);
    int N; cin >> N;
    vector<int> heights(N);
    for (int i = 0; i < N; ++i) cin >> heights[i];
    int res = 0;
    for (int i = 0, j = 0; i < N; i = j) {
        while(j < N && (i == j || heights[j] <= heights[j-1])) ++j;
        res = max(res, j - i - 1);
    }
    cout << res << '\n';
}


Measured memory_bytes: 3744
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
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;
}

//a^n mod を計算する関数
long long modpow(long long a,long long n,long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n % 2 == 1) {
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//a^(-1) mod すなわちaの逆元を返す関数
long long modinv(long long a,long long mod) {
    return modpow(a,mod-2,mod);
}

//最大公約数をを返す関数
long long gcd (long long a,long long b) {
    if(a % b == 0) {
        return b;
    }else {
        return (gcd(b,a%b));
    }
}

const long long INF = 1LL << 60;
const long long P = 1000000007;

//nCkを求める関数
long long conbi (long long n,long long k) {
    long long res = 1;
    long long inv;
    for(long long i = n-k+1; i <= n; i++) {
        res *= i;
        res %= P;
    }
    for(long long i = 1; i <= k; i++) {
        inv = modinv(i,P);
        res *= inv;
        res %= P;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    int a[n];
    int count = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] % 2 != 0) {
            count++;
        }
    }
    if(count % 2 == 0) {
        cout << "YES";
    }else {
        cout << "NO";
    }
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int M = sc.nextInt();

            String ans = (N == M) ? "Yes" : "No";

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 21972
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	long a,b;
	cin >> a >> b;
	
	long ans = 0;
	rep(i,a,b+1){
		stringstream ss;
		ss << i;
		string s = ss.str();
		bool f = true;
		rep(i,0,s.size()/2){
			if(s[i] != s[s.size()-1-i]){
				f = false;
				break;
			}
		}
		
		if(f){
			ans++;
		}

	}

	P(ans);
	ret 0;
}

Measured memory_bytes: 256
import java.util

import scala.io.StdIn.readLine
import scala.io.StdIn.readInt
import java.util.Scanner
import java.util.ArrayList

object Main extends App {
  val sc = new Scanner(System.in)
  val x = sc.nextLong()
  val f = (x:Long)=>x*x*x*x*x
  for(i <- -1000 to 1000 ;j<- -1000 to 1000){
    if(f(i) - f(j) == x){
      println(f"$i $j")
      System.exit(0)
    }
  }





}

Measured memory_bytes: 55676
#include<cmath>
#include<iostream>
#include<cstdio>
using namespace std;

int main() {
	double x1, x2, y1, y2, d;

	cin >> x1 >> y1 >> x2 >> y2;

	d = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));

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

	return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
int main(){long long n,i,m=0,p,k,j;
  string x,y,z;
  cin>>n>>x>>y>>z;
  for(i=0;i<n;i++){
      if(x[i]==y[i]&&y[i]!=z[i]){
          m++;
      }if(z[i]==y[i]&&y[i]!=x[i]){
          m++;
      }if(x[i]==z[i]&&y[i]!=z[i]){
          m++;
      }if(x[i]!=y[i]&&y[i]!=z[i]&&x[i]!=z[i]){
          m+=2;
      }
  }cout<<m;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()

def main():
    N, T = map(int, input().split())
    A = deque(map(int, input().split()))
    time = 0
    start = 0
    stop = 0
    while A:
        a = A.popleft()
        if stop < a:
            time += stop - start
            start = a
            stop = a + T
        else:
            stop = a + T
    print(time + stop - start)


if __name__ == "__main__":
    main()


Measured memory_bytes: 100636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll l,r;cin>>l>>r;
    ll tl=l;
    while(tl%2019!=0) tl++;
    if(tl<=r){
        cout<<0<<endl;
    }else{
        ll ans=1e9;
        for(ll i=l;i<=r;i++)
        for(ll j=l;j<i;j++)
            ans=min(ans,(i*j)%2019);
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256