akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>


using namespace std;
string yn(bool a)
{
  if (a){return "Yes";}
  else{return "No";}
}

int main()
{
  ios::sync_with_stdio(false);
  string s;
  int x,y;
  cin>>s>>x>>y;
  vector<int> a,b;
  bool f=1;
  int tmp=0;
  for(auto itr=s.begin();itr !=s.end();itr++)
  {
    if(*itr=='F'){tmp++;}
    else {
      if(f){a.push_back(tmp);}
      else{b.push_back(tmp);}
      f=!f;
    tmp=0;
  }

  }
  if(f){a.push_back(tmp);}
  else{b.push_back(tmp);}
  x-=a[0];
  x=abs(x);
  y=abs(y);
  a.erase(a.begin());
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  int suma=0,sumb=0;
  for(auto itr=a.begin();itr !=a.end();itr++)
  {
    //cout<<*itr<<endl;
    suma+=*itr;
  }
  for(auto itr=b.begin();itr !=b.end();itr++)
  {
    sumb+=*itr;
    //cout<<*itr<<endl;
  }
  int flag=0;
  //cout<<x<<' '<<y<<' '<<suma<<' '<<sumb;
  if((suma-x)%2 or (sumb-y)%2){flag=0;}
  else
  {
    if(suma<x or sumb<y){flag=-2;}
    x=(suma-x)/2;
    y=(sumb-y)/2;
    //cout<<x<<' '<<y;
    vector<int> dpx(8001),dpy(8001);
    for(int i=0;i<8001;i++){dpx[i]=0;dpy[i]=0;}
    dpx[0]=1;dpx[suma]=1;
    dpy[0]=1;dpy[sumb]=1;
    for(auto itr1=a.begin();itr1 !=a.end();itr1++)
    {
      if(dpx[x]!=0 or dpx[suma-x]!=0){flag+=1;break;}
      for(int i=suma;i>-1;i--)
      {
        if(dpx[i]==1){dpx[i+*itr1]=1;}
      }
      if(dpx[x]!=0 or dpx[suma-x]!=0){flag+=1;break;}

    }
    if(a.size()==0 and x==0){flag+=1;}
    //cout<<flag<<endl;
    for(auto itr2=b.begin();itr2 !=b.end();itr2++)
    {
      if(dpy[y]!=0 or dpy[sumb-y]!=0){flag+=1;break;}
      for(int i=sumb;i>-1;i--)
      {
        if(dpy[i]==1){dpy[i+*itr2]=1;}
      }
      if(dpy[y]!=0 or dpy[sumb-y]!=0){flag+=1;break;}
    }
    if(b.size()==0 and x==0){flag+=1;}
  }
  cout<<yn(flag>=2)<<endl;




  return 0;

}

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

#define ll long long int

using namespace std;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> V(n);
    for (auto & v : V) cin >> v;
    sort(V.begin(), V.end());
    ll res = 0;
    for (ll i = 0 ; i < k; ++i) {
        res += V[i];
    }
    cout <<res<< endl;

}


Measured memory_bytes: 3636
S = input()

if int(S[2:]) in range(1, 13):
    if int(S[:2]) not in range(1, 13):
        print("YYMM")
    else:
        print("AMBIGUOUS")
elif int(S[:2]) in range(1, 13):
    if int(S[2:]) not in range(1, 13):
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i = x; i < n; i++)
#define MAX 100
#define INF 1000000001

// enum {
//   AST_INT,
//   AST_SYM,
//   AST_STR,
//   AST_FUNCALL,
// };



// double winProb(int Rp, int Rq) {
//     return 1/(1+pow(10, (Rq-Rp)/400.));
// }

// int R[1<<10];
// double dp[12][1<<10];
int n;
vector<int> a;
int b[10];
int main() {
  cin >> n;
  REP(i,0,n) {
      int temp;
      cin >> temp;
      a.push_back(temp);
  }
  
  long long ans = 0;
  for(auto u: a) {
      ans += u - 1;
  }
  
  cout << ans << endl;
}

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

ll COM[100][100];


void COMinit(){
  for(ll i = 0; i < 100; i++){for(ll j = 0; j < 100; j++){ COM[i][j] = 0;}}
  
  for(ll i = 0; i < 100; i++){  COM[i][0] = 1; COM[i][i] = 1;}
  
  for(ll i = 1; i < 99; i++){
    for(ll k = 1; k <= i; k++){
      COM[i+1][k] += COM[i][k-1] + COM[i][k];}
  }
}
        
int main(){
 int N,A,B; COMinit();
  
  cin >> N >> A >> B; vector<ll> v(N);
 
   for(ll i = 0; i < N; i++){ cin >> v[i];}
  
  sort(v.rbegin(),v.rend());
  long double sum = 0.0;
  for(ll i = 0; i < A; i++){ sum += v[i];} //平均の最大値自体は簡単に求まる
  ll cnt = 0; 
  
  for(ll i = A; i <= B; i++){
    vector<ll> vec; long double res = 0.0;
    
    for(ll j = 0; j < i; j++){ vec.push_back(v[j]); res += v[j];}

    if( abs(res/i - sum/A) > 1e-7){continue;}
    ll test = vec.back(); ll count = 0; ll n = 0;
    
    for(ll j = 0; j < i; j++){ if(vec[j] == test){ count++;}}
    for(ll k = 0; k < N; k++){ if(v[k] == test){ n++;}}
    
    cnt += COM[n][count];
  }

  
  cout <<fixed << setprecision(10) << sum/A << endl;
  cout << cnt << endl; return 0;}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*2
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128(void)
{
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t;
	t = (x ^ (x << 11)); x = y; y = z; z = w; return(w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
	string s;
	cin >> s;
	REP(i, s.length()) {
		if (s[i] == 'A') cout << "T";
		else if (s[i] == 'T') cout << "A";
		else if (s[i] == 'G') cout << "C";
		else cout << "G";
	}
	cout << endl;
	return 0;
}

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

int main() {

  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  A = 100 * A;
  B = 100 * B;
  
  double rate = 0;
  int answerWater = 0;
  int answerSuger = 0;
  
  for (int i = 0; i <= F / A; i++) {
    int F_ = F - (A * i);
    for (int j = 0; j <= F_ / B; j++) {
      int water = A * i + B * j;
      int suger_ = water * E / 100;
      for (int k = 0; k <= suger_ / C; k++) {
        int suger2_ = suger_ - (C * k);
        for (int l = 0; l <= suger2_ / D; l++) {
          int suger = C * k + D * l;
          if (suger_ < suger) {
            continue;
          }
          int sugerWater = water + suger;
          if (F < sugerWater) {
            continue;
          }
          double rate_ = (double) suger / sugerWater * 100;
          if (rate <= rate_) {
            rate = rate_;
            answerWater = sugerWater;
            answerSuger = suger;
          }
        }
      }
    }
  }  

  cout << answerWater << " " << answerSuger << endl;

  return 0;

}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
   
  if( (A/D) > (C/B)){
    cout << "Yes" <<endl;
  }
  else{
    if (((A/D+1) == (C/B)) && ((C%B) == 0))
       cout << "Yes" <<endl;
    
    else if((A/D) == (C/B)){
      if((A%D == 0) && (C%B > 0))
        cout << "No" <<endl;
      
      else
        cout << "Yes" <<endl;
    }
    
    else
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 3592
n, m = map(int, raw_input().split())

mod = int(1e9) + 7

if n > m:
  n, m = m, n

def p(n):
  ret = 1
  for i in xrange(1, n + 1):
    ret = ret * i % mod
  return ret
    

def solve(n, m):
  if n == m:
    return p(n) * p(m) * 2 % mod
  else:
    return p(n) * p(m) % mod

if n == m or n + 1 == m:
  print(solve(n, m))
else:
  print(0)


Measured memory_bytes: 2568
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N, M;
	cin >> N >> M;
	vector<int> X(M);
	REP(i, M) cin >> X[i];
	if (N >= M) {
		cout << 0 << "\n";
		return 0;
	}
	sort(X.begin(), X.end());
	vector<int> d(M - 1);
	REP(i, M - 1) d[i] = X[i + 1] - X[i];
	sort(d.begin(), d.end(), greater<int>());
	int res = X[M - 1] - X[0];
	REP(i, N - 1) res -= d[i];
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val s = sc.next()
    val sum = s
      .map {
        case c if c == '(' => 1
        case _             => -1
      }
      .scan(0)(_ + _)
    val min = sum.min
    (1 to (-min)).foreach(_ => print('('))
    print(s)
    (1 to (sum.last - min)).foreach(_ => print(')'))
    println()
  }
}


Measured memory_bytes: 27336
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int N, a[110];
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	sort(a, a + N);
	cout << a[N - 1] - a[0] << endl;
	return 0;
}

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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (auto& v : A)cin >> v;
  vector<int64_t> ls(N + 1, 0), rs(N + 1, 0);
  for (int i = 0; i < N; ++i)ls[i + 1] = ls[i] + A[i];
  for (int i = N - 1; i >= 0; --i)rs[i] = rs[i + 1] + A[i];
  int64_t ans = INT64_MAX;
  for (int i = 0; i < N; ++i)
    ans = min(ans, abs(ls[i] - rs[i]));
  cout << ans << endl;
}


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

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

  int n, k; cin >> n >> k;
  vll a(n);
  REP(i, n){
    cin >> a[i];
  }
  vll aposi(n);
  ll su = 0;
  REP(i, n) {
    aposi[i] += max(a[i], 0ll);
    su += aposi[i];
  }

  ll now = 0;
  ll nowpo = 0;
  REP(i, k) {
    now += a[i];
    nowpo += aposi[i];
  }

  ll ma = max(0ll, now) + su - nowpo;
  FOR(i, k, n) {
    now += a[i] - a[i-k];
    nowpo += aposi[i] - aposi[i-k];
    chmax(ma, max(0ll, now) + su - nowpo);
  }
  cout << ma << endl;


}








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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  double sum = 0;
  for (int i = 0; i < n; i++)
  {
    sum += (double)1 / a[i];
  }
  double ans = (double)1 / sum;
  if (float(ans) == ans)
  {
    cout << ans << endl;
  }
  else
  {
    cout << fixed << setprecision(14) << (double)1 / sum << endl;
  }
}


Measured memory_bytes: 3688
/**
 *    author: codeforces-yuhongtao 
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<iomanip>
#include<sstream>
using namespace std;
#define pi acos(-1.0) 
#define ms(x,n) memset(x,n,sizeof(x));
#define pb push_back
typedef long long ll;//string::npos
typedef long long iint;
ll gcd(ll a,ll b){ return a%b==0?b:gcd(b,a%b); }
const int inf=0x3f3f3f3f;
const int maxn=5e5+5;
const int mod=1e9+7;
//priority_queue<ll,vector<ll>,greater<ll> > q;//小根堆 
//vector<int> vt[205];
//pair<int,int> p;
//map<int,int> m;
//int fr[maxn][205];
map<int,int> m;

int main(){
	ios::sync_with_stdio(false);
	int n,x;
	cin>>n;
	for(int i=2;i<=n;i++){
		cin>>x;
		m[x]++;
	}
	for(int i=1;i<=n;i++){
		cout<<m[i]<<endl;
	} 
}


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

int main(){
    int T[101][101], r, c;

    cin >> r >> c;
    for(int i = 0;i < r ; i++){
        for(int j = 0;j < c ; j++){
            cin >> T[i][j];
        }
    }

    for(int i = 0; i <= r; i++) T[i][c] = 0;
    for(int j = 0; j <= c; j++) T[r][j] = 0;

    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            T[i][c] += T[i][j];
            T[r][j] += T[i][j];
            T[r][c] += T[i][j];
        }
    }

    for(int i = 0; i <= r; i++){
        for(int j = 0; j <= c; j++){
            if( j )cout << " ";
            cout << T[i][j];
        }
        cout << endl;
    }
    return 0;

}


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



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

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

Measured memory_bytes: 256
sub f{my($u,$t,$p)=@_;push@$t,$u;$_-$p&&f($_,$t^R,$u)for@$u}@a=$,=$";$#a=<>;map{push@$_,$u-$_+$;for($u,$;)=split}<>;f 1,b;map{$s=--$x;$s+3>$.or$a[$_]||=$s+=3for@$_}@b>$./3&@0>$./3?(0,b):($c=@b>@0?b:0,$c);print map$_||3*++$z,@a

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

typedef struct point{
    double x;
    double y;
}vect;

double dot(vect a,vect b){
    return a.x*b.x+a.y*b.y;
}

double cross(vect a,vect b){
    return a.x*b.y-a.y*b.x;
}

int main() {
    int q;
    point p0,p1,p2,p3;
    cin>>q;
    for (int i = 0; i < q; ++i) {
        cin>>p0.x>>p0.y>>p1.x>>p1.y>>p2.x>>p2.y>>p3.x>>p3.y;
        vect v1,v2;
        v1.x=p1.x-p0.x;
        v1.y=p1.y-p0.y;

        v2.x=p3.x-p2.x;
        v2.y=p3.y-p2.y;

        if (!dot(v1,v2))
            cout<<"1"<<endl;
        else if (!cross(v1,v2))
            cout<<"2"<<endl;
        else
            cout<<"0"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3212
//Deep Godhani
//DAIICT

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

#define N 100000000000
#define PI acos(-1)
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define ll long long int
#define ld long double
#define precision(x,d) cout << fixed << setprecision(d) << x
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))

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

ld fact(int n)
{
  ld ans = 1;
  for(int i=1;i<=n;i++)
  {
    ans = ans*i;
  }
  return ans;
}

ld ncr(int n,int r)
{
  return (ld) fact(n)/(fact(r)*fact(n-r));
}

void primeFactors(int n)
{
    while (n % 2 == 0)
    {
        cout << 2;
        n = n/2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            cout << i;
            n = n/i;
        }
    }
    if (n > 2)
        cout << n;
}

void solve()
{
    ll n,k;
    cin >> n >> k;
    ll h[n];
    for(int i=0;i<n;i++)
    {
      cin >> h[i];
    }

    vector<ll> dp(n,INT_MAX);

    dp[0] = 0;

    for(int i=1;i<n;i++)
    {
      for(int j=1;j<=k && i>=j;j++)
      {
        dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
      }
    }

    cout << dp[n-1] << endl;
}

int main()
{
    FAST;
    ll t=1;
    //cin >> t;
    while(t--)
    {
      //cout << "************" << endl;
      solve();
      //cout << "************"  << endl;
    }
		return 0;
}


Measured memory_bytes: 1792
/*
    ThunderClap and Flash
    Raunaq Singh
*/
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod) + (b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod) * (b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod) - (b%mod) + mod)%mod;}

void Flash(){
    string ss = "ACL";
    ll k;
    cin>>k;
    while (k--) {
        cout<<ss;
    }
    cout<<"\n";
}

int main(int argc, char const *argv[]){ 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    #endif
    ThunderClap;
    ll t = 1;
    //cin>>t;
    for(ll i = 1; i <= t; i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
  public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

int main()
{
    long long N;
    scanf("%lld", &N);
    vector<ll> a(5), b(5);
    ll min = LLONG_MAX;
    ll index = -1;
    for (int i = 0; i < 5; i++)
    {
        ll tmp;
        cin >> tmp;
        if (tmp < min)
        {
            min = tmp;
            index = i;
        }
    }

    cout << (N + min - 1) / min + 4 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
stack<int>st;
queue<int>q;
vector<long long int >v;
set<int>stt;
set<int>::iterator set_it;
map<string,int>mp;
//initialy map er all index er value zero thake;
//map er jonno this pointer(->) use korte hoy
//akta value dakhar jonno staristics pointer(*) use  korte hoy
// one more value print korar jonno this pointer(->) use korte hoy (must be)
map<string,int>::iterator map_it;
long long int a[20007];
long long int i,j,k,l,m,n,flag=0,cnt=0,sum=0,mx=0,mn=0;
string s,s1,s2,t,u;
int main()
{
    long long  int tc,a,b,d,e;
    //char c;
    cin>>s>>t>>a>>b>>u;
    if(s==u)
    {
        cout<<a-1<<" "<<b<<endl;
        return 0;
    }
    else
    {
        cout<<a<<" "<<b-1<<endl;
        return 0;

    }

    return 0;

}






Measured memory_bytes: 256
import itertools
n = int(input())
p = input().replace(' ', '')
q = input().replace(' ', '')

for i, num in enumerate(itertools.permutations(range(1,n+1))):
    num = ''.join(map(str, list(num)))
    if num == p:
        break
for j, num in enumerate(itertools.permutations(range(1,n+1))):
    num = ''.join(map(str, list(num)))
    if num == q:
        break

print(abs(i-j))

Measured memory_bytes: 3064
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

struct Edge {
  int to, cost;
};

struct P {
  int v, d;
};

int main() {

  int n, m;
  cin >> n >> m;

  map<pair<int, int>, int> idx;
  // {駅, 会社}
  vector<vector<Edge>> g(n + m * 2 + 1);
  auto add_edge = [&](pair<int, int> from, pair<int, int> to, int cost) {
    if (!idx.count(from)) idx[from] = idx.size();
    if (!idx.count(to)) idx[to] = idx.size();
    g[idx[from]].push_back(Edge{idx[to], cost});
  };
  rep(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    add_edge({a, c}, {b, c}, 0); // 同じ会社
    add_edge({b, c}, {a, c}, 0);
    add_edge({a, c}, {a, 0}, 0); // 降りる
    add_edge({b, c}, {b, 0}, 0);
    add_edge({a, 0}, {b, c}, 1); // 乗り換え
    add_edge({b, 0}, {a, c}, 1);
  }

  const int inf = 1000000000;
  vector<int> dist(n + m * 2 + 1, inf);
  deque<P> q;
  if (!idx.count({0, 0})) idx[{0, 0}] = idx.size();
  dist[idx[{0, 0}]] = 0;
  q.push_back(P{idx[{0, 0}], 0});
  while (q.size() > 0) {
    auto cur = q.front();
    q.pop_front();
    for (auto e : g[cur.v]) {
      auto nd = cur.d + e.cost;
      if (nd < dist[e.to]) {
        dist[e.to] = nd;
        if (e.cost == 0) {
          q.push_front(P{e.to, nd});
        } else {
          q.push_back(P{e.to, nd});
        }
      }
    }
  }
  if (!idx.count({n - 1, 0})) idx[{n - 1, 0}] = idx.size();
  auto ans = dist[idx[{n - 1, 0}]];
  if (ans == inf) ans = -1;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 64256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, N;
    cin >> H >> W >> N;
    if(H < W) swap(H, W);
    cout << (N + H - 1) / H << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <stack>
#include <tuple>

using namespace std;

int main()
{
    vector<string> player(3);
    cin >> player[0] >> player[1] >> player[2];
    int cur_player = 0;
    vector<int> index(3, 0);
    while (true)
    {
        if (index[cur_player] == player[cur_player].size()) break;
        char next_player = player[cur_player][index[cur_player]];
        index[cur_player]++;
        cur_player = next_player - 'a';
    }
    cout << char(cur_player + 'A') << endl;
}

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

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    set<int> waterS, sugarS;
    for (int i = 0; i <= 30; i++)
    {
        for (int j = 0; j <= 30; j++) {
            int x = A * 100 * i + B * 100 * j;
            if (x <= F)
                waterS.insert(x);
        }
    }

    for (int i = 0; i <= 3000; i++) {
        for (int j = 0; j <=  3000; j++)
        {
            int y = C * i + D * j;
            if ( y <= F)
                sugarS.insert(y);
        }
    }

    double max_per = -1.0;
    int max_f, max_s;

    for (auto x : waterS) {
        for (auto y : sugarS)
        {
            // cout << y << endl;
            // cout << x << " " << y << endl;
            if (x + y > F)
                continue;
            if (y > x/100*E)
                continue;
            double c_per = ((double)y * 100) / ((double)x + y);
            if (max_per < c_per) {
                max_per = c_per;
                max_f = x+y;
                max_s = y;
            }
        }
    }

    cout << max_f << " " << max_s << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define ar array
#define pb push_back


int main()
{
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("outputc.txt","w",stdout);
	// #endif
	
	//int t;
	//cin>>t;
	//while(t--)
	{
		int n;
		cin>>n;
		ll a[n][3];
		for(int i=0;i<n;i++)
		{
			cin>>a[i][0]>>a[i][1]>>a[i][2];
		}
		ll dp[n][3];
		memset(dp,-0x3f,sizeof(dp));
		dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
		for(int i=1;i<n;i++)
		{
			dp[i][0]=max({dp[i][0],dp[i-1][1]+a[i][0],dp[i-1][2]+a[i][0]});
			dp[i][1]=max({dp[i][1],dp[i-1][0]+a[i][1],dp[i-1][2]+a[i][1]});
			dp[i][2]=max({dp[i][2],dp[i-1][0]+a[i][2],dp[i-1][1]+a[i][2]});
		}
		cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
	}
		
}


Measured memory_bytes: 8280
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
    string S;
    cin >> S;
    int ans = 10000;
    for(int i=0; i<S.size()-2; i++)
    { 
         int a,b,c,x;
         a = S[i] - '0';
         b = S[i+1] - '0';
         c = S[i+2] - '0';
         x = a*100+b*10+c;
         ans = min(ans,abs(x-753));
    }
    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 rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    string s=to_string(n);
    ll x=0;
    rep(i,s.size()){
        x+=s[i]-'0';
    }
    if(n%x==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

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

typedef long long ll;

using namespace std;

int INF = 1e9;

int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n), f(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> f[i];

  sort(a.begin(), a.end());
  sort(f.begin(), f.end(), greater<ll>());

  ll su = 0;
  rep(i,n) su += a[i];
  if(su <= k){
    cout << 0 << endl;
    return 0;
  }

  ll mi = -1, ma = 0;
  rep(i,n) ma = max(ma, a[i]*f[i]);

  while((ma-mi) > 1){
    ll kd  = 0;
    ll mid = (ma + mi) / 2;
    rep(i,n){
      kd += a[i] - min(a[i], mid / f[i]);
    }
    if(kd <= k) ma = mid;
    else        mi = mid;
  }  
  cout << ma << endl;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s,t;
    bool b=false;
    vector<char> vs,vt;
    cin>>s>>t;
    
    for(int i=0;i<t.size();i++){
        vt.push_back(t[i]);
    }
    
    for(int i=0;i<s.size();i++){
        vs.push_back(s[i]);
        
        if(s[i]!=t[i]){
            b = true;
        }
    }

    if(b!=true){
        cout<<"Yes"<<"\n";
    } else {
        cout<<"No"<<"\n";
    }
    return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll K;
ll A[202020];

ll cut(ll v) {
	ll num=0;
	int i;
	FOR(i,N) {
		num+=(A[i]-1)/v;
		if(num>K) return num;
	}
	return num;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	FOR(i,N) cin>>A[i];
	
	ll L=(1<<30);
	
	for(i=29;i>=0;i--) {
		if(cut(L-(1<<i))<=K) L-=1<<i;
	}
	cout<<L<<endl;
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 5112
//
// author  : Abhishek
//
#include <bits/stdc++.h>
#include<chrono>

#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)

using namespace std;
using namespace chrono;

const ll MOD = 1000000007;
const ll N = 300005;  // array size
const ll inf = 10000000000000000;


void print(vector<ll> v) {
    ll i;
    fo(i, v.size())cout << v[i] << " ";
    cout << "\n";
}

void print(vector<pair<ll, ll> > v) {
    ll i;
    fo(i, v.size()) {
        cout << v[i].first << " " << v[i].second << "\n";
    }
}

vector<ll> read(ll n) {
    ll i;
    vector<ll> arr(n, 0);
    fo(i, n)cin >> arr[i];
    return arr;
}

vector<ll> read(ll n, ll k) {
    ll i;
    vector<ll> arr(n + k, 0);
    Fo(i, k, n + k)cin >> arr[i];
    return arr;
}

bool isEven(ll n) {
    return n % 2 == 0;
}

bool isOdd(ll n) {
    return n % 2 != 0;
}


void solve() {
    ll t = 1;
//    cin >> (t);
    while (t--) {

        ll i, j, k, n, m, p, q, x, y, a, b, l, r;
        ll h;
        cin >> h >> n;
        vector<ll> arr(n);
        arr = read(n);
        y = accumulate(all(arr), 0);
        if (y >= h) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }

    }
}

int main() {

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

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif

    auto start = high_resolution_clock::now();

    solve();

    ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
#ifndef ONLINE_JUDGE
    cerr << "Time: " << duration.count() / 1000.0 << endl;
#endif


    return 0;
}




Measured memory_bytes: 4776
from collections import Counter
import copy
from itertools import combinations


def A(x):
  return 1000 - x % 1000 if x % 1000 != 0 else 0


def B(n, ss):
  keys_values = Counter(ss)
  orders = ['AC', 'WA', 'TLE', 'RE']
  for order in orders:
    if order in keys_values:
      print("{} x {}".format(order, keys_values[order]))
    else:
      print("{} x {}".format(order, 0))


def C(h, w, k, g):

  def _get_num_black(c_list, r_list):
    num_black = 0
    for i in range(h):
      if i in r_list:
        continue
      for j in range(w):
        if j in c_list:
          continue
        num_black += (1 if g[i][j] == '#' else 0)
    return num_black

  num_choice = 0
  for i in range(k + 1):
    for j in range(k - i + 1):
      comb_c = list(combinations(range(w), j))
      comb_r = list(combinations(range(h), i))
      for c_list in comb_c:
        for r_list in comb_r:
          num_black = _get_num_black(c_list, r_list)
          if num_black == k:
            num_choice += 1
          print(h, i, r_list, w, j, c_list, num_black, k)
  return num_choice


def C2(H, W, K, g):
  """All copied."""
  c = []
  for i in range(H):
    c.append([])
    for j in range(W):
      c[i].append(g[i][j])

  ans = 0
  for h in range(H + 1):
    for w in range(W + 1):
      for h2 in combinations(list(range(H)), h):
        for w2 in combinations(list(range(W)), w):
          paint = copy.deepcopy(c)
          for h3 in h2:
            for i in range(W):
              paint[h3][i] = "r"
          for i in range(H):
            for w3 in w2:
              paint[i][w3] = "r"
          count_black = 0
          for i in range(H):
            count_black += paint[i].count("#")
            #print(count_black,paint[i])
          if count_black == K:
            ans += 1

  return ans

def C3(H, W, K, g):
  """Change the calculation of count_black."""
  c = []
  for i in range(H):
    c.append([])
    for j in range(W):
      c[i].append(g[i][j])

  ans = 0
  for h in range(H + 1):
    for w in range(W + 1):
      for h2 in combinations(list(range(H)), h):
        for w2 in combinations(list(range(W)), w):
          count_black = 0
          for i in range(H):
            if i in h2:
              continue
            for j in range(W):
              if j in w2:
                continue
              count_black += (1 if c[i][j] == '#' else 0)
          if count_black == K:
            ans += 1

  return ans


def main():
  h, w, k = map(int, input().split())
  g = []
  for i in range(h):
    g.append(input())
  print(C3(h, w, k, g))


if __name__ == '__main__':
  main()


Measured memory_bytes: 9548
Str = input()
q = int(input())
for loop in range(q):
    command = list(map(str,input().split()))
    a = int(command[1])
    b = int(command[2])
    if command[0]=="print":print(Str[a:b+1])
    elif command[0]=="reverse":Str = Str[:a]+Str[a:b+1][::-1]+Str[b+1:]
    else:Str = Str[:a]+command[3]+Str[b+1:]


Measured memory_bytes: 5612
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mxn=1e6+6;
int n,E,T,w[mxn];
ll d[mxn];
multiset<ll>s1,s2;
int main(){
	ios_base::sync_with_stdio(false);
	int pv=1;
	cin>>n>>E>>T;
	for(int i=1;i<=n;++i)cin>>w[i];
	w[n+1]=E,d[1]=w[1];
	for(int i=1;i<=n;++i){
		ll r=1e15,tp;
		s2.insert(d[i]-w[i]);
		for(;pv<=i and (w[i]-w[pv])*2>T;){
			s2.erase(s2.find(d[pv]-w[pv]));
			s1.insert(d[pv]-1ll*3*w[pv]);
			++pv;
		}
		if(!s1.empty()){
			tp=*s1.begin();
			if(r>tp+w[i]*3ll)r=tp+w[i]*3ll;
		}
		tp=*s2.begin();
		if(r>tp+w[i]+T)r=tp+w[i]+T;
		d[i+1]=w[i+1]-w[i]+r;
	}
	cout<<d[n+1]<<endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }


int main() {
  int n;
  ll x;
  cin >> n >> x;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  ll mini = 0;
  REP(i,1,n) {
    if( ( a[i] + a[i-1] ) > x ) {
      ll diff = (a[i]+a[i-1]) - x;
      mini += diff;
      a[i] -= diff;
      if( a[i] < 0 ) a[i] = 0;
    }
  }
  cout << mini << endl;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int tot=0;
    for(int i=0; i<n; i++){
        cin >> a.at(i);
        tot ^= a.at(i);
    }
    for(int i=0; i<n; i++){
        cout << (tot^a.at(i)) << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3884
import sys
sys.setrecursionlimit(1000000)
def main():
  n, m = map(int, input().split())
  ab = [list(map(lambda x:int(x)-1, input().split())) for _ in range(m)]
  ad_list = make_ad_list(n, ab)
  global searched
  global ans
  searched = [0 for _ in range(n)]
  searched[0] = 1
  ans = 0
  dfs(0, n, ad_list)
  print(ans)

def make_ad_list(n, l):
  ad_list = [[] for _ in range(n)]
  for a, b in l:
    ad_list[a] += [b]
    ad_list[b] += [a]

  return ad_list

def dfs(v, n, ad_list):
  global searched
  global ans
  if sum(searched) == n:
    ans += 1
    return
  for u in ad_list[v]:
    if searched[u] == 0:
      searched[u] = 1
      dfs(u, n, ad_list)
      searched[u] = 0
  return 

if __name__ == "__main__":
  main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
string S;int a[3],i;
main(){
cin>>S;if(S=="mewmew"){goto E;}
for(i=0;i<S.size()-1;i++){
if(S.substr(i,2)=="mw"){goto E;}
}
for(int i=0;i<S.size();i++){
if(S[i]=='m'){a[0]++;}
else if(S[i]=='e'){a[1]++;}
else{a[2]++;}
if(!(a[0]>=a[1]&&a[1]>=a[2])){goto E;}
}
cout<<"Cat"<<endl;goto F;
E:;
cout<<"Rabbit"<<endl;
F:;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) int((a).size())
#define LOWB(x) (x & (-x))
#define UNIQUE(a) sort(ALL(a)), (a).erase(unique(ALL(a)), (a).end())
#define INF 1e9
#define INF_LL 4e18
#define rep(i,a,b) for(__typeof(b) i=a; i<(b); ++i)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
/*-----------------------------------*/
const int maxn = 100010;
int n;
vi a;
ll dp[maxn][2];

int main() {
  cin >> n;
  a.resize(n);
  for (int i=0; i<n; i++) cin >> a[i];

  dp[0][0] = a[0];
  dp[0][1] = -a[0];

  for (int i=0; i<n-1; i++) {
    dp[i+1][0] = max(dp[i][0] + a[i+1], dp[i][1] - a[i+1]);
    dp[i+1][1] = max(dp[i][0] - a[i+1], dp[i][1] + a[i+1]);
  }
  cout << dp[n-1][0] << endl;
  return 0;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
void sort2array(double *a,long *b,long n){
    for(int i=0;i<n;i++){
        b[i]=i;
    }
    sort(b,b+n,[a](long i,long j)->bool {return a[i]<a[j];} );
}
//bを何回足せばaを超えるか
int wtover(int a,int b){
    if(a%b>0)return (a/b)+1;
    else return a/b;
}
const int INF=100000001,ID_MAX=20;
int bi_e[ID_MAX]={0};
//2進数表示したときの最高桁
int bi_max(long n){
    int m=0;
    for(m;pow(2,m)<=n;m++);m=m-1;
    return m;
}
//bi_eに二進数表示したやつを代入
void bi_exs(long n){
    rep(i,ID_MAX){
        bi_e[i]=0;
    }
    if(n<pow(2,ID_MAX)){
        int m=bi_max(n);
        long l;
        for(m;m>-1;m--){
            l=pow(2,m);
            bi_e[m]=n/l;
            n=n%l;
        }
    }
}
//x^n mod m (nが負の時は０)
long myPow(long x, long n, long m){
  if(n<0)return 0;
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}


int main(){
    int i,s,w;
    //入力
    cin>>s>>w;
    //処理
    //出力
    w>=s?cout<<"unsafe"<<endl:cout<<"safe"<<endl;
}

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

int main(void)
{
  int point;
  int single_hit;
  int out;
  int inning;
  string event;

  cin >> inning;

  for(int i = 0 ; i < inning ; i++)
    {
      point = 0;
      out = 0;
      single_hit = 0;

      while(1)
	{
	  if(out == 3) break;
	  
	  cin >> event;
	  if(event == "HIT") single_hit++;	  
	  if(event == "OUT") out++;
	  if(event == "HOMERUN") 
	    {
	      point += (single_hit + 1);
	      single_hit = 0;
	    }
	  if(single_hit == 4)
	    {
	      point++;
	      single_hit--;
	    }
	}
      cout << point << endl;
    }
  return 0;
}

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

int main() {
  int table[3][3];
  bool bingo[3][3];
  int N;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> table[i][j];
      bingo[i][j] = false;
    }
  }
  cin >> N;
  int B[N];
  for (int k = 0; k < N; ++k) {
    cin >> B[k];
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        if (table[i][j] == B[k]) {
          bingo[i][j] = true;
        }
      }
    }
  }
  bool ans = false;
  for (int i = 0; i < 3; ++i) {
    bool flag = true;
    for (int j = 0; j < 3; ++j) {
      if (!bingo[i][j]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      ans = true;
    }
  }
  
  for (int j = 0; j < 3; ++j) {
    bool flag = true;
    for (int i = 0; i < 3; ++i) {
      if (!bingo[i][j]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      ans = true;
    }
  }
  
  {
    bool flag = true;
    for (int i = 0; i < 3; ++i) {
      if (!bingo[i][i]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      ans = true;
    }
  }

  {
    bool flag = true;
    for (int i = 0; i < 3; ++i) {
      if (!bingo[i][3 - i - 1]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      ans = true;
    }
  }

  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int a, b, c, d, e, f;

map<P, P> memo;

P calc(int x, int y) {
    P k = make_pair(x, y);
    if (memo.count(k) == 0) {
        P ret;
        P res = make_pair(x, y);
        if (x + 100 * a <= f) {
            ret = calc(x+100*a, y);
            if (res.first == 0 || res.second * (ret.first + ret.second) <= ret.second * (res.first + res.second)) res = ret;
        }
        if (x + 100 * b <= f) {
            ret = calc(x+100*b, y);
            if (res.first == 0 || res.second * (ret.first + ret.second) <= ret.second * (res.first + res.second)) res = ret;
        }

        if (x + c <= f && y + c <= (x - y) / 100 * e) {
            ret = calc(x+c, y+c);
            if (res.first == 0 || res.second * (ret.first + ret.second) <= ret.second * (res.first + res.second)) res = ret;
        }
        if (x + d <= f && y + d <= (x - y) / 100 * e) {
            ret = calc(x+d, y+d);
            if (res.first == 0 || res.second * (ret.first + ret.second) <= ret.second * (res.first + res.second)) res = ret;
        }
        memo[k] = res;
    }
    return memo[k];
}

void solve() {
    P res = calc(0, 0);
    cout << res.first << " " << res.second << endl;
}

void input() {
    cin >> a >> b >> c >> d >> e >> f;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    solve();
}

Measured memory_bytes: 768
#include <iostream>
#include<stdio.h>
#include<string>
#include<cmath>
using namespace std;
string a,b;
int c;
int main() {
    cin >> a >> b;
   string tmp = a+b;
   c=stoi(tmp);
   int i = 1;
   while(i <= 1000){
       if(c == i * i) {
          puts("Yes");
           return 0;
       }
      i++;
   }
     puts("No");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<20;
int dx[]={1,1, 1,0,-1,-1,-1,0};
int dy[]={0,1,-1,1,0,-1, 1,-1};


int main(){
    int n;cin >> n;
    vector<int> a(n),b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    set<int> st;
    for (int i = 1; i <= 50; i++) {
        st.insert(i);
    }
    LL ans = 0;
    for (int c = 51; c > 0; c--) {
        st.erase(c);
        vector<vector<int>> d(52,vector<int> (52,INF));
        for(auto s:st){
            for (int i = 0; i <= 50; i++) {
                d[i][i%s] = 1;
            }
        }
        for (int i = 0; i <= 50; i++) {
            d[i][i] = 0;
        }
        for (int k = 0; k <= 50; k++) {
            for (int i = 0; i <= 50; i++) {
                for (int j = 0; j <= 50; j++) {
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
        bool f = true;
        for (int i = 0; i < n; i++) {
            if(d[a[i]][b[i]] == INF){
                f = false;
                break;
            }
        }
        if(c==51){
            if(!f){
                cout << -1 << endl;
                return 0;
            }
        }
        else{
            if(!f){
                st.insert(c);
                ans += (1LL<<c);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#import<bits/stdc++.h>
using namespace std;long L,R,D,M=998244353,l,r,d,z,A['   '];map<int,int>m;main(){cin>>l>>r;for(m[l]=1;l--;A[l]=++z%=M)z*=10;for(;cin>>L>>R>>D;cout<<z<<" "){z=(z+D*(A[--L]-A[R]))%M;auto t=m.lower_bound(l=L);for(d=t->second;z=(z-t->second*(A[l]-A[r=min(R,l=t->first)])%M+M)%M,r<R;t=m.erase(t));m[L]=d;m[R]=D;}}

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

signed main(){
    long double d, t, s;
    cin>>d>>t>>s;
    long double _t = d/s;
    if(_t<t || abs(_t-t)<=1e-9)cout<<"Yes\n";
    else cout<<"No\n";
}

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

int main(){
	int a,b;
	cin >> a >> b;
	cout << (a-1) * (b-1) << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
XY=[tuple(map(int,input().split())) for _ in range(n)]
dist=0
for i in range(n):
    for j in range(i+1,n):
        dist+=((XY[i][0]-XY[j][0])**2+(XY[i][1]-XY[j][1])**2)**0.5
dist*=2/n
print(dist)

Measured memory_bytes: 38384
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        int m =sc.nextInt();
        long[] high = new long[n+1];
        long[] max = new long[n+1];
        int a =0;
        int b =0;
        int cnt =0;
        for(int i=1;i<=n;i++) {
        	high[i] = sc.nextLong();
        	max[i] = 0;
        	//System.out.println(high[i]);
        }
        for(int i = 0;i<m;i++) {
        	a=sc.nextInt();
        	b=sc.nextInt();
        	if(max[a]<high[b]) {
        		max[a] =high[b];
        	}
        	if(max[b]<high[a]){
        		max[b] = high[a];
        	}
        }
        for(int i=1;i<=n;i++) {
        	if(max[i]<high[i]) {
        		cnt+=1;
        	}
        }
      

System.out.println(cnt);



	}
}

Measured memory_bytes: 61136