akhauriyash/Code-Regression huggingface dataset:
/******************************************
* AUTHOR : SHUBHAM KUMAR *
* NICK : { "CODECHEF" : "SCHELEON",
           "CODEFORCES" : "SCH3130N" } *     
* INSTITUTION : BIT MESRA *
******************************************/

#include "bits/stdc++.h"

using namespace std;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define sd(x) scanf("%lld",&x)
#define pds(x) printf("%lld ", x)
#define large 100005
#define MOD 1000000007
#define dd double
#define pb push_back
#define mk make_pair
#define rep0(i,b) for(int i=0;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define pll pair<ll, ll>
#define ld long double
#define vll vector<ll>
#define vpll vector<pll>
#define sortv(v) sort(v.begin(),v.end())  

template <typename T> void max_self(T& a, T b) {
    a = max(a, b);
}

using ll = long long int;
using ull = unsigned long long int;

ll ModE(ll x, ull y, ll p = MOD) 
{ 
    ll res = 1;
    x = x % p;    
    while (y > 0) 
    {   if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
}
ll a[large];
ll dp[3001][3001][2];
ll solve(ll i, ll j, ll turn){
	if(i == j){
		if(turn%2)
			return a[i];
		else
			return -a[i];
	}

	if(dp[i][j][turn] != -1)
		return dp[i][j][turn];

	if(turn%2){
		dp[i][j][turn] = max(a[i] + solve(i+1, j, turn^1), a[j] + solve(i, j-1, turn^1));
		return dp[i][j][turn];
	} else {
		dp[i][j][turn] = min(-a[i] + solve(i+1, j, turn^1), -a[j] + solve(i, j-1, turn^1));
		return dp[i][j][turn];
	}
}

int main() {
    #ifdef M_DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    fastio

    // ll T; cin>>T; while(T--){}
    ll n;
    cin>>n;
    rep0(i, 3001)
    	rep0(j, 3001)
    		rep0(k, 2)
    			dp[i][j][k]=-1;
    rep0(i, n)
    	cin>>a[i];
    cout<<solve(0, n-1, 1);

    return 0;
}

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

vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    rep(i,n){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
    k%=mod-1;
    if(k<0)k+=mod-1;
    ll ret=1;
    while(k){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return ret;
}
int main(){
    int n;
    cin>>n;
    int a[n];
    rep(i,n)cin>>a[i];
    vector<int> cnt(n+1);
    rep(i,n){
        cnt[a[i]]++;
    }
    if(a[0]!=0){
        cout<<0<<endl;
        return 0;
    }
    if(cnt[0]>1){
        cout<<0<<endl;
        return 0;
    }
    ll ans = 1;
    int sum = 0;
    rep(i,n){
        ans *= powmod(cnt[i],cnt[i+1]);
        sum += cnt[i];
        ans %= mod;
        if(cnt[i+1]==0)break;
    }
    if(sum!=n)cout<<0<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll in;
    cin>>in;
    cout<<(in/500*500)*2 + (in%500)/5*5<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
 	int a, b;
	char op;
	
	while(1){
		scanf("%d %c %d", &a, &op, &b);
		
		if(op == '+'){
			printf("%d\n", a + b);
		}
		else if(op == '-'){
			printf("%d\n", a - b);
		}
		else if(op == '*'){
			printf("%d\n", a * b);
		}
		else if(op == '/'){
			printf("%d\n", a / b);
		}
		else if(op == '?'){
			break;
		}
	}

	return 0;
   
}

Measured memory_bytes: 2720
#include <bits/stdc++.h>
#define SZ(c)       int(c.size())
#define FOR(i,a,b)  for (int i=a; i<(b); ++i)
#define DOWN(i,a,b) for (int i=(a)-1; i>=(b); --i)
using namespace std;
using i64 = long long;

int n;
int a[55];

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

  cin>>n;
  FOR(i,0,n) cin>>a[i];

  vector<pair<int,int>> res;
  int t=0;
  FOR(i,0,n) 
    if (abs(a[t])<abs(a[i])) t=i;

  if (a[t]!=0) {
    FOR(i,0,n) {
      if (i==t) continue;
      if ((a[t]<0 && a[i]>0) || (a[t]>0 && a[i]<0)) {
        a[i]+=a[t];
        res.emplace_back(t,i);
      }
    }
  }

  // FOR(i,0,n) cerr<<a[i]<<" ";
  // cerr<<endl;
  
  if (a[t]>0) {
    while (true) {
      int k=-1;
      FOR(j,0,n-1)
        if (a[j]>a[j+1]/* && (k==-1 || a[k]<a[j])*/) {
          k=j;
          break;
        }
      if (k==-1) break;
      a[k+1]+=a[k];
      res.emplace_back(k,k+1);
      // FOR(j,0,n) cerr<<a[j]<<' ';
      // cerr<<endl;
    }
  } else if (a[t]<0) {
    while (true) {
      int k=-1;
      FOR(j,1,n)
        if (a[j]<a[j-1]/* && (k==-1 || a[k]>=a[j])*/) k=j;
      if (k==-1) break;
      a[k-1]+=a[k];
      res.emplace_back(k,k-1);
      // FOR(j,0,n) cerr<<a[j]<<' ';
      // cerr<<endl;
    }
  }

  // FOR(i,0,n) cerr<<a[i]<<" ";
  // cerr<<endl;

  cout<<SZ(res)<<endl;
  assert(SZ(res)<=2*n);
  FOR(i,0,n-1) assert(a[i]<=a[i+1]);
  FOR(i,0,SZ(res))
    cout<<res[i].first+1<<' '<<res[i].second+1<<'\n';

  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"basic.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
#endif

int main(){
    string s; cin >> s;
    s[5] = ' ';
    s[13] = ' ';
    cout << s << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define _USE_MATH_DEFINES
using namespace std;

int main() {
	
	ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long int i,num,ele[100000],big = 0;
    cin>>num;
    for(i=0;i<num;i++) cin>>ele[i];
    long long int ans = 1,max=pow(10,18);
    for(i=0;i<num;i++){
    	if(ans!=0){
	    	if(ele[i]<=(max/ans)){
	    		ans*=ele[i];
			} 
	    	else big = 1;
		}
	}
	if(big == 1&&ans!=0) cout<<"-1";
	else cout<<ans;
    
	return 0;
}

Measured memory_bytes: 4396
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>

typedef long long ll;
using namespace std;

int main()
{
    int n, x, k = 1e9;
    cin >> n >> x;
    vector <int> m(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> m[i];
        x -= m[i];
        k = min(k, m[i]);
    }

    cout << n + x/k << endl; 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9

int sign[2] = { 1,-1 };

int main() {
	int N, M; cin >> N >> M;
	ll a[N], b[N], c[N];
	for (int i = 0; i < N; i++) cin >> a[i] >> b[i] >> c[i];
	ll ans = 0;

	for (int d1 = 0; d1 <= 1; d1++) {
		for (int d2 = 0; d2 <= 1; d2++) {
			for (int d3 = 0; d3 <= 1; d3++) {
				ll tmp[N];
				for (int i = 0; i < N; i++) tmp[i] = sign[d1] * a[i] + sign[d2] * b[i] + sign[d3] * c[i];
				sort(tmp, tmp + N, greater<ll>());
				ll tmp_sum = 0;
				for (int j = 0; j < M; j++) tmp_sum += tmp[j];
				ans = max(ans, tmp_sum);
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#include <numeric>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const double pi = 3.14159265358979323846;
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() {

    int n, x, t; cin >> n >> x >> t;
    int c = n / x;
    if (n % x != 0) {
        c++;
    }
    cout << c * t << endl;
}































































Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
const long long P = 1000000007;

int main() {
  int n;
  cin >> n;
  int d1,d2;
  int count = 0;
  for(int i = 0; i < n; i++) {
    cin >> d1 >> d2;
    if(d1 == d2) count++;
    else if(count < 3) count = 0;
  }
  if(count >= 3) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main() {
  long long N, maxM, minM, ans=0; cin >> N; maxM=N;
  ans += N-1; maxM/=2;
  while(maxM>=2) {
    long long tmp=N/maxM;
    minM=N/(tmp+1)+1;
    if(tmp==N%maxM) {ans+=maxM; maxM=minM-1; continue;}
    else if(tmp==N%minM) {ans+=minM; maxM=minM-1; continue;}
    else if(tmp>N%minM||tmp<N%maxM) {maxM=minM-1; continue;}
    else {
      long long maxMtmp=maxM, minMtmp=minM;
      while(maxMtmp!=minMtmp) {
        long long center=(minMtmp+maxMtmp)/2;
        if(tmp==N%center) {ans+=center; maxM=minM-1;break;}
        else if (tmp<N%center) minMtmp=center+1;
        else maxMtmp=center;
      }
    }
    maxM=minM-1;
  }
  if (N<=2) ans=0;
  cout << ans << "\n";
}
      

Measured memory_bytes: 256
// 9102019.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
int n, m, t;
int a[10000] = { 0 };
int ans = 0;
int main()
{
	cin >> n >> m >> t;
	for (int i = 0; i < n; i++) cin >> a[i];
	ans += a[0] - m;
	for (int i = 1; i < n; i++) {
		int tmp = a[i] - a[i - 1];
		if (tmp > 2 * m) {
			ans += tmp - 2 * m;
		}
	}
	if (t - (a[n - 1] + m) > 0) {
		ans += t - (a[n - 1] + m);
	}
	cout << ans << endl;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file



Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,sum=0,t;
  int a[100009];
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  a[n+1]=0;
  for(int i=0;i<=n;i++){
    sum+=abs(a[i]-a[i+1]);
  }
  for(int i=1;i<=n;i++){
    if(a[i-1]<=a[i]&&a[i]<=a[i+1]||a[i+1]<=a[i]&&a[i]<=a[i-1]){
      t=0;
    }
    else if(a[i-1]<=a[i+1]&&a[i+1]<=a[i]||a[i]<=a[i+1]&&a[i+1]<=a[i-1]){
      t=abs(a[i]-a[i+1])*2;
    }
    else{
      t=abs(a[i]-a[i-1])*2;
    }
    cout<<sum-t<<endl;
  }
  return(0);
}
  


Measured memory_bytes: 1664
#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
	int X, Y;
	cin >> X >> Y;
	cout << X + Y / 2 << endl;


	return 0;
}

Measured memory_bytes: 768
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()

mod=10**9+7

total=sum(a)

ans=0
for i in range(n-1):
  total-=a[i]
  ans+=a[i]*total
  ans%=mod

print(ans)

Measured memory_bytes: 31416
#include <bits/stdc++.h>
#include <string>
using namespace std;
void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

int main() {
    init();
    string s,c="";
    cin>>s;
    unsigned long long k,p=0;
    cin>>k;
    for(int i=0;s.size();i++){
        if(s[i]!='1'){
            cout<<s[i];
            return 0;}
            else if(i+1==k&&s[i]=='1'){
                    cout<<s[i];
            return 0;
}

    }}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  string S;cin>>S;
  
  if(S[0]=='9'||S[1]=='9'){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3592
function main(input) {
    const args = input.split('\n');
    const A = parseInt(args[0], 10),
          B = parseInt(args[1], 10),
          C = parseInt(args[2], 10),
          X = parseInt(args[3], 10);

    var count = 0;

    for (var a = 0; a <= A; ++a) {
        for (var b = 0; b <= B; ++b) {
            for (var c = 0; c <= C; ++c) {
                var sum = (a * 500) + (b * 100) + (c * 50);
                if (sum === X) ++count;
            }
        }
    }
    console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
  int n;
  map<int,int> m;
  for(int i=0;i<6;++i){
    cin >> n;
    m[n]++;
  }
  for(int i=1;i<5;++i){
    if(m[i]>2){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007


int main() {
  int N;
  cin >> N;
  ll a,M=0,m=1000000001;
  rep(i,N){
    cin >> a;
    M = max(M,a);
    m = min(m,a);
  }

  cout << M - m << endl;
}


Measured memory_bytes: 256
#include <vector> 
#include <queue>
#include <map>
#include <set>
#include <utility> //Pair
#include <algorithm>
#include <sstream> // istringstream>> ostring stream<<
#include <iostream>
#include <stack>
#include <iomanip>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (4) << f << endl; Prints x.xxxx
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <limits>
using namespace std;

//M lazy ;)
typedef long long ll;
typedef vector <int> vi;
typedef pair< int ,int > pii;
typedef istringstream iss;
typedef ostringstream oss;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define ln length()
#define rep(i,n) for(int i=0;i<n;++i)
#define fu(i,a,n) for(int i=a;i<n;++i)
#define fd(i,n,a) for(int i=n;i>=a;--i)
#define all(a)  a.begin(),a.end()
#define ESP (1e-9)

#define mems(s, n) memset(s, n, sizeof(s))
#define gi(n) scanf("%d",&n)
#define sii(n) scanf("%lld",&n)
#define gl(n) cin >> n
#define pi(n) printf("%d",n)
#define pll(n) printf("%lld",n)
#define ps printf(" ")
#define pn printf("\n")
#define dg(n,s); printf("%s %d",s,n)
#define imax numeric_limits<int>::max()
#define imin numeric_limits<int>::min()
#define lmax numeric_limits<ll>::max()
#define lmin numeric_limits<ll>::min()
#define MOD 100000007

template < class T > inline T max_(T a,T b) {return a > b ? a : b ;}
template < class T > inline T min_(T a,T b) {return a < b ? a : b ;}
template < class T > inline T gcd(T a,T b) {if(a < 0) return gcd(-a,b); if(b < 0)return gcd(a,-b); return (b == 0) ? a : gcd(b ,a % b);}
template < class T > inline T lcm(T a,T b) {if(a < 0) return lcm(-a,b); if(b < 0)return lcm(a,-b); return a * (b / gcd(a , b));}

#define L1 1000000000000LL
int one[1010];
int two[1010];
int L[1010][1010];
vector < int > ans;

void ip(ll &number)
{
    bool negative = false;
    register int c;
    number = 0;
    c = getchar();
    if (c=='-')
    {negative = true;
        c = getchar();}
    for (; (c>47 && c<58); c=getchar())
         number = number *10 + c - 48;
    if (negative) number *= -1;
}



    int main() {
        ll ar[26]={0};
        string s;
        cin>>s;
        rep(i,s.ln){
            ar[s[i]-'a']++;
        }
        int boo = -1;
        rep(i,26){
            if(ar[i]== 0){
                boo = i;
                break;
            }
        }
        if(boo!= -1){
            char o = 'a'+ boo; 
            cout<<o;
        }
        else
            cout<<"None";
        return 0;
    }


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    string a, b;
    cin >> a >> b;
    int na = sz(a);
    int nb = sz(b);
    if (na < nb) cout << "LESS" << endl;
    else if (na > nb) cout << "GREATER" << endl;
    else {
        rep(i, na) {
            int da = a[i] - '0';
            int db = b[i] - '0';
            if (da > db) {
                puts("GREATER");
                return 0;
            } else if (da < db) {
                puts("LESS");
                return 0;
            }
        }
        puts("EQUAL");
    }
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	std::vector<int> a(3);
	for(int i = 0; i < 3; i++) scanf("%d", &a[i]);
	sort(begin(a), end(a));
	
	if(a == std::vector<int>{5, 5, 7}) printf("YES\n");
	else printf("NO\n");
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>

#define STONE_NUM 2000001

using namespace std;
#define ASCII 48
int main() {
	int K, X;

	cin >> K >> X;
	for (int i = X - (K - 1); i < X + K -1; i++) {
		cout << i;
		cout << " ";
	}
	
	cout << X+K -1 << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    vector<int> maxp(N, -INF);
    vector<int> suship;
    multiset<int> st;
    rep(i, N) {
        int s, v;
        cin >> s >> v;
        s--;
        chmax(maxp[s], v);
        suship.push_back(v);
    }
    sort(suship.begin(), suship.end(), greater<int>());
    sort(maxp.begin(), maxp.end(), greater<int>());
    int tmp = 0;
    rep(i, K) {
        tmp += suship[i];
        st.insert(suship[i]);
    }
    int ans = 0;
    rep(i, K) {
        int add = maxp[i];
        int back = *st.begin();
        tmp += add;
        if (back > add) {
            st.erase(st.begin());
            tmp -= back;
        } else {
            //cout << add << " " << back << endl;
            st.erase(st.find(add));
            tmp -= add;
        }
        chmax(ans, tmp + (i + 1) * (i + 1));
    }
    cout << ans << endl;

    return 0;
}


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

int n, m;
vector<vector<int>> edges;
vector<bool> v;

void dfs(int ver, vector<int> &com) {
	v[ver] = 1;
	com.push_back(ver);
	for (int nb : edges[ver]) {
		if (!v[nb]) dfs(nb, com);
	}
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	cin >> n >> m;
	edges.resize(n + 1);
	v.resize(n + 1);
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		edges[x].push_back(y);
		edges[y].push_back(x);
	}
	
	int ans{};
	for (int i = 1; i <= n; i++) {
		vector<int> c;
		if (!v[i]) dfs(i, c);
		ans = max(ans, (int) c.size());
	}
	cout << ans;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if (a+b == c+d) {
    cout << "Balanced" << endl;
  }
  if (a+b > c+d) {
    cout << "Left" << endl;
  }
  if (a+b < c+d) {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
int main()
{
    int n;
    double a,sum=0;
    string b;
    cin>>n;
    while(n--){
        cin>>a>>b;
        if(b=="JPY") sum+=a;
        else sum+=a*380000;
    }
    printf("%lf\n",sum);
}


Measured memory_bytes: 256
import math 
import bisect
import heapq
from collections import deque

h,w=map(int,input().split())
M=[]
M=[input() for _ in range(h)]
 
def bfs(x,y):
    dist=[[-1]*w  for _ in range(h)]
    seen=[[False]*w for _ in range(h)]
    stk=[(x,y,0)]
    while stk:
        px,py,dst=stk.pop(0)
        if seen[px][py]:
            continue
        seen[px][py]=True
        
        if M[px][py]=='#':
            dist[px][py]=0
            continue
        
        for x,y in [(-1,0),(1,0),(0,-1),(0,1)]:
            if px+x<0 or px+x>=h or py+y<0 or py+y>=w:
                continue
            else:
                stk.append((px+x,py+y,dst+1))
        dist[px][py]=dst
    ans=0
 
    for i in range(h):
        ans=max(max(dist[i]),ans)
    return ans
ans = 0
for i in range(h):
    for j in range(w):
        if M[i][j]=='#':
            continue
        ans=max(bfs(i,j),ans)
print(ans)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(int, n);
	map<string, int> mp;
	inc(i, n) {
		IN(string, s);
		mp[s]++;
	}
	for(auto s: { "AC", "WA", "TLE", "RE" }) {
		OUT(s, "x", mp[s]);
	}
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
/// ye tec khaphan ke yadam bemone : age jayi didi soale masir hamiltoni mikhad rasasho bokon yal oilery;https://mobomovie1.top/series/%D8%AF%D8%A7%D9%86%D9%84%D9%88%D8%AF-%D8%B3%D8%B1%DB%8C%D8%A7%D9%84-%D9%81%D8%B1%DB%8C%D9%86%D8%AC-fringe-2008-2013-%D8%A8%D8%A7-%D8%B2%D9%8A%D8%B1%D9%86%D9%88%D9%8A%D8%B3-%D9%81%D8%A7%D8%B1/
/// age ye ja mikhasti to dp az ozv i k ta entekhab koni bejash ye log bezan (nominal) hamoon 2**k va o 1 ent kon
const int N=2e5+100;

vector <int> g[N];
ll a[N];
ll ans[N];
vector <int> ras;
ll h[N];
ll ma[N];
ll mi[N];
ll dfs(ll v,ll p){

    mi[v]=(ll)100000000;
    if (a[v]!=0){
        mi[v]=a[v]+h[v];
        ma[v]=a[v]-h[v];
    }
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u==p){
            continue;
        }
        h[u]=h[v]+1;
        dfs(u,v);

        ma[v]=max(ma[v],ma[u]);
        mi[v]=min(mi[v],mi[u]);
    }
}
ll dfs2(ll v,ll p){
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u==p){
            continue;
        }
            ll p1=-ans[v]+mi[u]-h[v];
            if (p1==0){
                ans[u]=ans[v]-1;
               // cout << v << " " << ans[v] << endl;
            }
            else{
                ans[u]=ans[v]+1;
                //cout << v << " " << ans[v] << endl;
            }
          // cout << u << " WEG " << ans[u]  << " " << mi[u] << " " << h[v] << endl;
            dfs2(u,v);

    }
}
int32_t main(){
    ll n;
    cin >> n;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    ll k;
    cin >> k;
    for (int i=0;i<k;i++){
        ll x;
        cin >> x;
        ras.pb(x);
        ll y;
        cin >> y;
        y++;
        a[x]=y;
    }
    ans[ras[0]]=a[ras[0]];
    dfs(ras[0],-1);
    dfs2(ras[0],-1);
    for (int i=1;i<=n;i++){
        if (a[i]>0 && a[i]!=ans[i]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes" << endl;
    for (int i=1;i<=n;i++){
        cout << ans[i]-1 << endl;
    }


}



/*
7
1 2
2 3
3 4
4 5
3 6
6 7
3
1 5
5 5
6 4
*/












Measured memory_bytes: 20348
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int n;
    cin>>n;
    vi v(n);
    int s = 0;
    for(int i = 0; i < n; i++){
        cin>>v[i];
        s+=v[i];
    }   
    int ans = 0;
    for(int i = 0; i < n; i++){
        s-=v[i];
        ans+=((s%mod)*v[i])%mod;
    }
    ans%=mod;    
    cout<<ans;
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}


Measured memory_bytes: 4776
#include <stdio.h>
#include <vector>
#include <utility>
#include <string>
#include <queue>

int main()
{
  int N, Q;
  std::vector< std::pair< std::string, int > >
  process;

  scanf("%d %d", &N, &Q);
  process.resize(N);
  for (int i = 0; i < N; i++) {
    char name[20];
    int time;
    scanf("%s %d", name, &time);
    process[i] = std::make_pair(std::string(name), time);
  }

  std::queue< std::pair< std::string, int > >
  que;
  for (int i = 0; i < N; i++) {
    que.push(process[i]);
  }

  int exec = 0;
  while (que.size()) {
    std::pair< std::string, int >
    prc = que.front();
    que.pop();
    if (prc.second <= Q) {
      exec += prc.second;
      printf("%s %d\n", prc.first.c_str(), exec);
    }
    else {
      exec += Q;
      prc.second -= Q;
      que.push(prc);
    }
  }

  return 0;
}



Measured memory_bytes: 6436
#include <stdio.h>

int main(){
	int i;
	int a[100];
	int n;
	scanf("%d",&n);
	for(i = 0;i < n;i++)
		scanf("%ld", &a[i]);
	for(i = n-1;i>=0;i--)
		if(i==0)
			printf("%d\n", a[i]);
		else
			printf("%d ", a[i]);
	return 0;
}

Measured memory_bytes: 596
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int a,b;
int main()
{
    fast;
    cin>>a>>b;
    if(a>0)
	   cout<<"Positive"<<endl;
    else if(b>=0)
	   cout<<"Zero"<<endl;
    else if((a&1)^(b&1))
	   cout<<"Positive"<<endl; 
    else 
	   cout<<"Negative"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main() {
    int n,k;cin>>n>>k;
    int h;int count=0;
    rep(i,n){
        cin>>h;
        if(h>=k)count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read


n = "".join(["0",input()])

ov = 10**9
eq = 0

L = len(n)-1
for i,x in enumerate(n):
    x = int(x)
    ov,eq = min(ov+9-x,eq+x+1), min(ov+10-x, eq+x)


print(eq)    
    



Measured memory_bytes: 5492
import java.util.*;
import java.math.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int p = sc.nextInt();
    int q=sc.nextInt();
    int r = sc.nextInt();
    int ans = p+q;
    int ans2 = q+r;
    int ans3 = Math.min(ans, ans2);
    System.out.println(Math.min(ans3, r+p));


  }
}

Measured memory_bytes: 24020
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N,M,X;
    cin >> N>>M>>X;
    int counth = 0;
    int countl = 0;
    for (int i = 0; i < M; i++) {
        int A = 0;
        cin >> A;
        if(A > X){
            counth++;
        }else{
            countl++;
        }
    }
    cout << min(counth,countl) << endl;
}


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

#define MIN(a,b) ((a)<(b)?(a):(b))


int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int s = n - 1;
	while (s >= 0) {
		///cerr << s << ":";
		cout << a[s] << " ";
		s -= 2;
	}
	s = n%2;
//	cerr << endl;
	while (s <n) {
		//cerr << s << ":";
		cout << a[s] << " ";
		s += 2;
	}

	return 0;
}

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

map<char,int> mp;

bool solve(int h,int w){
    int x4=0,x2=0,x1=0;
    if(h%2&&w%2) x4 = (h-1)*(w-1)/4,x2 = (h+w-2)/2,x1 = 1;
    else if(h%2) x4 = (h-1)*w/4,x2 = w/2;
    else if(w%2) x4 = h*(w-1)/4,x2 = h/2;
    else x4 = h*w/4;

    for(auto ite = mp.begin();ite != mp.end();++ite){
        int x = ite->second;

        if(x/4>=x4) x -= 4*x4,x4 = 0;
        else x4 -= x/4,x %= 4;

        if(x/2>=x2) x -= 2*x2,x2 = 0;
        else x2 -= x/2,x %= 2;

        if(x1 && x==x1) x -= 1,x1 = 0;

        if(x) return false; 
    }
    if(x4||x2||x1) return false;
    else return true;
}

int main(){
    int h,w;
    cin >> h >> w;
    for(int i = 0;i < h;i ++){
        for(int j = 0;j < w;j ++){
            char a;
            cin >> a;
            mp[a] ++;
        }
    }
    cout << (solve(h,w)?"Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 256
K=int(input())

if K%7==0:
    L=9*K//7
else:
    L=9*K

if L%2==0 or L%5==0:
    print(-1)
    exit()

mod=1
ans=0
for i in range(L):
    mod*=10
    mod=mod%L
    if mod==1:
        ans=i+1
        break

print(ans)

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

#define MOD 1000000007

int main(){
    int N; cin >> N;
    int M; cin >> M;
    long long  ans = 1;
    if(N == M+1){
        for(int i = 1; i <= N; i++){
            ans *= i;
            ans %= MOD;
        }
        for(int i = 1; i <= M; i++){
            ans *= i;
            ans %= MOD;
        }
        cout << ans << endl;
    }
    else if(N+1 == M){
        for(int i = 1; i <= N; i++){
            ans *= i;
            ans %= MOD;
        }
        for(int i = 1; i <= M; i++){
            ans *= i;
            ans %= MOD;
        }
        cout << ans << endl;
    }
    else if(N == M){
        for(int i = 1; i <= N; i++){
            ans *= i;
            ans %= MOD;
        }
        for(int i = 1; i <= M; i++){
            ans *= i;
            ans %= MOD;
        }
        ans *= 2;
        ans %= MOD;
        cout << ans << endl;
    }
    
    else{
        cout << 0 << endl;;
    }

    return 0;
}

Measured memory_bytes: 256
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H, W = map(int, raw_input().split())
S = [raw_input().split() for i in xrange(H)]

for h in xrange(H):
	for w in xrange(W):
		if S[h][w] == "snuke":
			print alpha[w] + str(h + 1)
			exit()

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  //黄色があるかどうか次第
  bool flag = false;
  for(int i=0;i<N;i++){
    char S;
    cin >> S;
    if(S == 'Y'){
      flag=true;
    }
  }
  if(flag){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }
}

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

int get_square(int x){
  return x*x;
}
int main(){
  vector<int> area_anss;
  int d;
  while(cin>>d){
  int area=0;
  for(int i=1;i<600/d;i++){
    area=area+get_square(i*d)*d;
    }
  area_anss.push_back(area);
  }
  for(int i=0;i<area_anss.size();i++){
    cout<<area_anss[i]<<endl;
  }
}

Measured memory_bytes: 3092
#include<stdio.h>
int main(void)
{
int d,m1,m2,m3,i;
 m1=0;
 m2=0;
 m3=0;
for(i=0;i<10;i++){
 scanf("%d",&d);
  if(d>m1){
	m3=m2;
	m2=m1;
	m1=d;
  }else if(d>m2){
	m3=m2;
	m2=d;
  }else if(d>m3){
	m3=d;
  }
}
printf("%d\n%d\n%d\n",m1,m2,m3);
return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define END(x) cout << x << endl; exit(0);
#define IPT(v, n) NREP(){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, minimum, maximum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> n >> k;
    vl h(n);
    IPT(h, n)

    ans = 0;
    NREP() {
        if (h[i] >= k) ans++;
    }
    MSG(ans)
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
const ll INF = ll(1e9);
const int N = 2e5 + 5;
const ll mod = 1000000007 ;
using namespace std;

ll binpow(ll x, ll y) {
	ll z = 1;
	while (y) {
		if (y % 2) z = (z * x) % mod;

		y = y / 2;
		x = (x * x) % mod;
	}
	return z % mod;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);


	ll tc = 1;

//	cin >> tc;

	while (tc--) {

		int k, a, b;
		cin >> k >> a >> b;

		ll ans = 0;
		while (ans < a) {
			ans += k;
		}

		if (ans >= a and ans <= b) {
			cout << "OK" << endl;

		}
		else {
			cout << "NG" << endl;
		}
	}

}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
	long long res = 1;
	int n, l, r;
	cin >> n;
	l = 0; 
	r = n - 1;
	vector<int> t(n), a(n);
	int i;
	for (i = 0; i < n; i++)
	{
		cin >> t[i];
		if (t[i] > t[l])
			l = i;
	}
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
		if (i > 0)
			if ((a[i - 1] == a[0]) && (a[i] != a[0]))
				r = i - 1;
	}
	if ((l > r) || (t[l] != a[r]))
	{
		cout << 0 << endl;
		return 0;
	}
	int h = 0;
	for (i = 0; i < l; i++)
	{
		if (t[i] > h)
			h = t[i];
		else
			res *= t[i];
		res %= 1000000007;
	}
	for (i = l + 1; i < r; i++)
	{
		res *= t[i];
		res %= 1000000007;
	}
	h = 0;
	for (i = n - 1; i > r; i--)
	{
		if (a[i] > h)
			h = a[i];
		else
			res *= a[i];
		res %= 1000000007;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1152
S = input()
N = len(S) + 1
A = [0]*N
for i in range(N-1):
    if S[i] == "<":
        A[i+1] = max(A[i]+1, A[i+1])
for i in range(N-2, -1, -1):
    if S[i] == ">":
        A[i] = max(A[i], A[i+1]+1)
print(sum(A))

Measured memory_bytes: 23348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=100005,INF=1<<30;

ll dp[MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<vector<ll>> A(N,vector<ll>(N));
    
    for(int i=0;i<N;i++) for(int j=0;j<N;j++) cin>>A[i][j];
    
    for(int bit=0;bit<(1<<N);bit++){
        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++){
                if((bit&(1<<i))&&(bit&(1<<j))){
                    dp[bit]+=A[i][j];
                }
            }
        }
    }
    
    dp[0]=0;
    for(int bit=0;bit<(1<<N);bit++){
        for(int S=bit;;S=(S-1)&bit){
            chmax(dp[bit],dp[S]+dp[bit^S]);
            if(S==0) break;
        }
    }
    
    cout<<dp[(1<<N)-1]<<endl;
}



Measured memory_bytes: 4132
import sys
import numpy as np

n=int(sys.stdin.readline())
h=np.array(sys.stdin.readline().split(),dtype='int64')
h=h[::-1]
miss=0
for i in range(n):
    if i==0:
        pre=h[i]
    elif pre+1==h[i]:
        pass
    elif pre==h[i]:
        pass
    elif pre+1<h[i]:
        miss=1
        break
    else:
        pre=h[i]

if miss==1:
    print('No')
else:
    print('Yes')
    


Measured memory_bytes: 24640
#include<stdio.h>
int main(void){
  long long a,b,c,k,ans=0;
  scanf("%lld %lld %lld %lld",&a,&b,&c,&k);
  if(a>=k){
    ans=k;
  }else{
    ans+=a;
    if(b>=k-a){
      ans+=0;
    }else{
      ans-=k-a-b;
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 1732
/*-----------------------------------------------,
|  __                                       __   |
| |  |--.-----.---.-.----.----.-----.-----.|  |_ |
| |  _  |  -__|  _  |  __|  __|  -__|  _  ||   _||
| |_____|_____|___._|____|____|_____|   __||____||
|                                   |__|         |
`-----------------------------------------------*/
#include<algorithm>
#include<array>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
typedef long long ll; typedef long double ld ;using namespace std;
#define INF 1000000000000
#define MOD 10000007
#define ALL(name) (name).begin(),(name).end()
#define REP(counter, limit) for (long long counter = 0; counter < limit; counter++)
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
struct setupios{setupios(){ios::sync_with_stdio(0);cin.tie(nullptr); /*cout<<fixed<<setprecision(20);*/};}setupios;
int main() {

  int n;
  string s;
  cin>>n>>s;
  int ans=0;
  int x=0;
  REP(i,n){
    if(s[i]=='I')x++;
    else x--;
    ans=max(ans,x);
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main(){

   fast
   long double a,b;
   cin>>a>>b;
   long long int c = a*b;
   cout<<c;
}

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

int main(){
   int A, B;
   cin >> A >> B;
   bool flag = false;
   for (int i=10; i<1001; i++){
      if ((int(0.08*i) == A) && (int(0.1*i) == B)){
         flag = true;
         cout << i << endl;
         break;
      }
   }
   if (!flag)
      cout << -1 << endl;
}



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

int main(){
    ll N, M, Q;
    cin>>N>>M>>Q;
    vector<ll> A(N+2);
    vector<ll> B(M+2);
    A[0] = -(1LL<<60);
    B[0] = -(1LL<<60);
    rep(i, N) cin>>A[i+1];
    rep(i, M) cin>>B[i+1];
    A[N+1] = 1LL<<60;
    B[M+1] = 1LL<<60;
    rep(i, Q){
        ll x; cin>>x;
        ll sl = *--lower_bound(ALL(A), x);
        ll sr = *lower_bound(ALL(A), x);
        ll tl = *--lower_bound(ALL(B), x);
        ll tr = *lower_bound(ALL(B), x);
    //cout << sl << " " << sr << " " << tl << " " << tr << endl;
        ll res = 1LL<<60;
        res = min(res, max(sr, tr)-x);
        res = min(res, x - min(sl, tl));
        res = min(res, tr-sl+tr-x);
        res = min(res, sr-tl+sr-x);
        res = min(res, x-sl+tr-sl);
        res = min(res, x-tl+sr-tl);
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>

int N, K;
int A[271828];

int main(void) {
	int i;
	if (scanf("%d%d", &N, &K) != 2) return 1;
	for (i = 1; i <= N; i++) {
		if (scanf("%d", &A[i]) !=1) return 1;
	}
	for (i = K + 1; i <= N; i++) {
		puts(A[i] > A[i - K] ? "Yes": "No");
	}
	return 0;
}


Measured memory_bytes: 2428
import java.io.PrintWriter

val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    var n=nextInt()
    var vs=readLine()!!.split(" ").map { it.toLong() }
    var a=0L
    for(x in vs){
        a=x-a
    }
    var re=mutableListOf<Long>()
    a/=2
    for(x in vs){
        re.add(2*a)
        a=x-a
    }
    pw.println(re.joinToString(" "))
    pw.flush()
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }
fun listOfLong() = listOfString().map { it.toLong() }
fun listOfDouble() = listOfString().map { it.toDouble() }


Measured memory_bytes: 80920
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<bool> ap(27, false);
	rep(i, n) {
		ap[s[i] - 'a'] = true;
	}
	int ans = upper;
	rep(i, 26) {
		if (!ap[i]) continue;
		string t = s;
		char ch = 'a' + i;
		t.insert(t.begin(), ch);
		t += ch;
		int N = t.size();
		int streak = 0;
		int stroke = 0;
		rep(j, N) {
			if (ch != t[j]) streak++;
			else {
				chmax(stroke, streak);
				streak = 0;
			}
		}
		chmax(stroke, streak);
		chmin(ans, stroke);
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int s,w;
  cin >> s >> w;
  if (w >= s)
    cout << "unsafe" << endl;
  else
    cout << "safe" << endl;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
int A[200100];
int cnt[200100];

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

  std::cin >> N;

  for(int i=0;i<N;++i){
      std::cin >> A[i];
      A[i] -= 1;
      cnt[A[i]] += 1;
  }

  ll sum = 0;

  for(int i=0;i<N;++i){
      sum += 1ll * cnt[i] * (cnt[i] - 1) / 2;
  }

  for(int i=0;i<N;++i){
      ll res = sum;
      res -= 1ll * cnt[A[i]] * (cnt[A[i]] - 1) / 2;
      res += 1ll * (cnt[A[i]] - 1) * (cnt[A[i]] - 2) / 2;
      std::cout << res << std::endl;
  }
}


Measured memory_bytes: 3712