akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n;
    cin >> n;
    vl a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    //   sort(a.begin(), a.end());
    map<ll, int> ma;
    for (int i = 0; i < n; ++i) {
        ma[a[i]]++;
    }
    bool ok = true;
    if (ma.size() == 1) {
        if (ma.begin()->first == 0)
            cout << "Yes"
                 << "\n";
        else
            cout << "No"
                 << "\n";
        return 0;
    } else if (ma.size() == 2) {
        ll n1, n2, num;
        auto it = ma.begin();
        n1 = it->first;
        num = it->second;
        ++it;
        n2 = it->first;
        if (num * 2 != it->second)
            ok = false;
        if (n1 != 0)
            ok = false;
    } else if (ma.size() != 3) {
        cout << "No"
             << "\n";
        return 0;
    } else {
        ll n1, n2, n3, num;
        auto it = ma.begin();
        n1 = it->first;
        num = it->second;
        ++it;
        n2 = it->first;
        if (num != it->second)
            ok = false;
        ++it;
        n3 = it->first;
        if ((n1 ^ n2) != n3)
            ok = false;
        if (num != it->second)
            ok = false;
    }
    if (ok)
        cout << "Yes"
             << "\n";
    else
        cout << "No"
             << "\n";
    return 0;
}

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

int main(){
     char s[15];
     for(int i=0;i<10;i++){
     	cin>>s[i];
	 }
     s[3]='8';
     for(int i=0;i<10;i++){
     	cout<<s[i];
	 }
	return 0;
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

template<class T>
struct ModInt {
    T x;
    ModInt(T x = 0) :x(x% mod) {}
    ModInt& operator+=(const ModInt a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(const ModInt a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator*=(const ModInt a) {
        (x *= a.x) %= mod;
        return *this;
    }
    ModInt operator+(const ModInt a) const {
        ModInt res(*this);
        return res += a;
    }
    ModInt operator-(const ModInt a) const {
        ModInt res(*this);
        return res -= a;
    }
    ModInt operator*(const ModInt a) const {
        ModInt res(*this);
        return res *= a;
    }
    ModInt pow(T t) const {
        if (!t) return 1;
        ModInt a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    ModInt inv() const {
        return pow(mod - 2);
    }
    ModInt& operator/=(const ModInt a) {
        return (*this) *= a.inv();
    }
    ModInt operator/(const ModInt a) const {
        ModInt res(*this);
        return res /= a;
    }
};
using mint = ModInt<long long>;


int n;
ll cnt[100005];
void solve() {
    mod = 998244353;
    cin >> n;
    rep(i, n) {
        int d; cin >> d;
        ++cnt[d];

        if (i == 0 && d != 0 || i != 0 && d == 0) { cout << 0 << endn; return; }

    }

    mint ans = 1;
    reps(i, n - 1) {
        ans *= mint(cnt[i - 1]).pow(cnt[i]);
    }

    cout << ans.x << endn;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 1024
s = input()
if 'S' in s and 'N' in s and 'W' in s and 'E' in s:
    print('Yes')
elif 'S' in s and 'N' in s and 'W' not in s and 'E' not in s:
    print('Yes')
elif 'S' not in s and 'N' not in s and 'W' in s and 'E' in s:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import numpy as np

N = int(input())

a = list(map(int, input().split()))

a.sort()

a_max = a[N - 1]

ave = a_max / 2


dif = 1000000000
difidx = -1
difidx2 = -1
p = 1
s = 1


for i in range(N):
    an = abs(a[i] - ave)
    if dif > an:
        dif = an
        difidx = i
    elif dif == an:
        difidx2 = i

ans = a[difidx2] if difidx2 > 0 else a[difidx]
ans2 = str(a_max)
if N > 3:
    print(str(a_max) + " " + str(ans))
else:
    if a[0] > a[1]:
        print(str(a[0]) + " " + str(a[1]))
    else:
        print(str(a[1]) + " " + str(a[0]))


Measured memory_bytes: 23084
m=10**9+7;
f=->a,b{b>0?a**b[0]*f[a*a%m,b/2]%m:1}
s=0;
b=(1..gets.to_i).map{|i|s=(s+f[i,m-2])%m}
s=i=0;r=1;
gets.split.map{|a|s+=a.to_i*(b[i]+b[-i+=1]-1)%m;r=r*i%m}
p s*r%m


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

int main() {
	long n;
	cin>>n;
	long a[n],b[100000],c[99998];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a +n);
	for(int i=0;i<100000;i++)b[i]=0;
	for(int i=0;i<n;i++){
		b[a[i]]++;
	}
	for(int i=0;i<99998;i++){
		c[i]=b[i]+b[i+1]+b[i+2];
	}
	sort(c,c +99998);
	if(n==1)cout<<1<<endl;
	else{
	cout<<c[99997]<<endl;
	}
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;

int arr[n+1]{0};
int a;
for(int i=0;i<n-1;i++)
{
    cin>>a;
    arr[a]++;
}

for(int i=1;i<=n;i++)
{
    cout<<arr[i]<<endl;
}



 return 0; 
}


Measured memory_bytes: 4416
N = int(input())
S = list(input())
dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = [i]
  else:
    dic[S[i]].append(i)
    
ans = 0
for j in range(1,N):
  cnt = 0
  for k in dic.values():
    check1 = False
    check2 = False
    for l in k:
      if l < j:
        check1 = True
      if j <= l:
        check2 = True
    if check1 and check2:
      cnt += 1
  ans = max(ans, cnt)
  
print(ans)

Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

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


Measured memory_bytes: 3636
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
towns = [0] * N
for i in range(N):
    x, y = map(int, input().split())
    towns[i] = (x, y)

def f(n):
    if n == 1:
        return 1
    else:
        return n * f(n - 1)

import math
def calc():
    total = 0
    for i in range(1, N):
        x1, y1 = towns[i]
        x2, y2 = towns[i - 1]
        l = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
        total += l
    return total

ans = 0
def g(n):
    global ans
    if n == N:
        ans += calc()
        return
    for i in range(n, N):
        towns[i], towns[n] = towns[n], towns[i]
        g(n + 1)
        towns[i], towns[n] = towns[n], towns[i]

g(0)
print(ans / f(N))

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

int main() {
  int a;
  cin >> a;
  if(a == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }else if(a == 23) {
    cout << "Christmas Eve Eve" << endl;
  }else if(a == 24) {
    cout << "Christmas Eve" << endl;
  }else if(a == 25) {
    cout << "Christmas" << endl;
  }
}

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

int main(){

    long long n, m;
    cin >> n;
    cin >> m;
    long long al[n];
    for(long long i=0;i<n;i++) cin >> al[i];

    double a[n];
    for(long long i=0;i<n;i++){
        a[i] = (double)al[i];
    }

    double sum = 0;
    for(long long i=0;i<n;i++){
        sum += a[i];
    }
    double x = sum/(4*m);

    long long cnt = n;
    for(long long i=0;i<n;i++){
        if(a[i]<x) cnt--;
    }

    if(cnt >= m){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

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


long long mypow(long long x, long long y);
    //////////////////////////////////////////
    //    整数用のpow
    //    in   : 整数, 整数
    //    out  : 整数 
    //    ver  : 1.0
    //    概要 : 正の整数での使用のみを想定
    //    include: NA
    //////////////////////////////////////////


int main(){
    long long K;
    long long tmp = 26;
    long long keta = 1;
    int moji;
    std::cin >> K;

    //最大桁数を探る
    while(1){
        if(tmp >= K){
            break;
        }else{
            keta++;
            tmp = tmp + mypow(26, keta);
        }

    }

    vector<char> ans(keta);

    tmp = K;
    for(int i = 1; i < keta; i++){
        tmp = tmp - mypow(26, i);
    }

    double dtmp = (double)tmp - 1.0;
    // std::cout << tmp << "\n";
    for(long long i = keta - 1; i >= 0; i--){
        //97がa
        //各桁数の文字を特定していく
        // std::cout << dtmp << "\n";
        if(i != 0){
            moji = (int)round(floor(dtmp/(double)mypow(26, i))) + 97;
            // std::cout << moji << " ";

            dtmp = dtmp - (double)(moji - 97) * (double)mypow(26, i);
            ans[keta - 1 - i] = moji;
        }else{
            ans[keta - 1] = (int)dtmp + 97;
            // std::cout << ans[keta -1] << "\n";
        }
    }

    for(int i = 0; i < ans.size(); i++){
        std::cout << ans[i];
    }

}

long long mypow(long long x, long long y){
    long long ans = 1;
    for(long long i = 0; i < y; i++){
        ans = ans * x;
    }
    return ans;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
 
using namespace std;
/**************************************************************************/
/*int main()
{
	fastIO;
	int n,i,j,k;
	cin>>n;
	j = n / 4 + 10;
	fo(i,j)
	{
		k = n - (i * 4);
		if(i==1)continue;
		if(k<0)break;
		if(k%11==0)
		{
			if(k/11==1)continue;
			cout<<"Yes";
			return(0);
		}
	}
	cout<<"No";
	return(0);
}*/
int main()
{
	ll n,k,i,j,p,q,r;
	cin>>n>>k;
	cout<<(n%k!=0);
}
/*************************************************************************/ 

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;//

const int64 infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

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

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N, M;
  cin >> N >> M;
  vector< int > A(M);
  cin >> A;
  int sum = accumulate(begin(A), end(A), 0);
  if(sum > N)cout << -1 << endl;
  else cout << N - sum << endl;
}


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

#define INF 1e9
using namespace std;

int main() {

    int N, L; cin >> N >> L;

    vector<int> R(N);

    int min_r = INF;
    int ans = 0;

    for (int i = 0; i < N; ++i) {
        R[i] = L + (i+1) - 1;
        if (abs(R[i]) < abs(min_r)) {
            min_r = R[i];
        }
        ans += R[i];
    }

    ans -= min_r;

    cout << ans << endl;
}

Measured memory_bytes: 256
X=int(input())
if(X<100):
    print(0)
    exit()
dp=[0]*100001
dp[100:106]=[1]*6
for i in range(106,X+1):
    for j in range(100,106):
        if(dp[i-j]==1):
            dp[i]=1
            break
print(dp[X])

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

  template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double n,f;
  int r;
  while(cin >> n){
    if(n < 0) break;
    string s = "",s2 = "";
    r = int(n);
    f = n - int(n);
    rep(i,8){
      if(r & (1 << i)){
        s += "1";
      }
      else{
        s += "0";
      }
    }
    rep(i,4){
      f *= 2;
      if(f >= 1){
        f-=1;
        s2+="1";
      }
      else{
        s2+="0";
      }
    }
    bool t = true;
    if( f > 0){
      t = false;
    }
    if( r < (1 << 9) && t){
      reverse(all(s));
      cout << s+"."+s2 << endl;
    }
    else cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 3196
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	LL x, y; cin >> x >> y;

	if (abs(x - y) <= 1) {
		cout << "Brown" << endl;
	}
	else {
		cout << "Alice" << endl;
	}

	return 0;
}

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

using namespace std;

int main() {
    string s;

    cin >> s;

    if (s.size() == 3) {
        reverse(s.begin(), s.end());
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100000 + 5;

int main() {	
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    ll k;
    cin >> k;
    if(k % 2 == 0 || k % 5 == 0)  {
        cout << -1;
        return 0;
    }
    int cnt = 1;
    ll tmp = 7;
    while(tmp % k != 0) {
        tmp = tmp * 10 + 7;
        tmp %= k;
        cnt++;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1e6+10;
int read(){int x;scanf("%lld",&x);return x;}
int n,x,t;
signed main() {
	//freopen("test.in","r",stdin);
	//freopen("test.out","w",stdout);
	cin>>n>>x>>t;
	int cnt=ceil(n*1.0/x);
	cout<<t*cnt<<'\n';
	return 0;
}

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

using namespace std;

#define INF (1<<29)

int main()
{
    int m, nmin, nmax;
    while (cin >> m >> nmin >> nmax, m) {
        vector<int> P(m);
        for (int i = 0; i < m; i++) {
            cin >> P[i];
        } 
        int gap = P[nmin-1] - P[nmin], res = nmin;
        for (int i = nmin; i < nmax; i++) {
            if (gap < P[i] - P[i+1]) {
                gap = P[i] - P[i+1];
                res = i + 1;
            } else if (gap == P[i] - P[i+1]) {
                res = i + 1;
            }
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 2996
#include <stdio.h>
 
int main(){
    char ch;
    while((ch = getchar()) != EOF){
            if(ch >= 97 && ch <= 122)
                printf("%c",ch-32);
            else if(ch >= 65 && ch <= 90)
                printf("%c",ch+32);
            else
                printf("%c",ch);
    }
}


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


int main(){
  int n;
  cin >> n;
  bool f = false;
  rep(i, n){
    int x;
    cin >> x;
    if(x%2 == 1){
      f = true;
    }
  }
  cout << (f?"first":"second") << endl;
}


Measured memory_bytes: 256
from heapq import heappop,heappush
n = int(input())
A = list(map(int,input().split()))
h_queue = []
ans = 0
for i in range(n):
    heappush(h_queue,A[i])
for i in range(n-1):
    a1 = heappop(h_queue)
    a2 = heappop(h_queue)
    a3 = (a1+a2)/2
    heappush(h_queue,a3)

print(heappop(h_queue))

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	vint A(N); cin >> A;
	if (A[0] != 0) { cout << -1 << endl; return; }

	ll num = 0;
	for (int i = 1; i < N; i++) {
		if (A[i] > A[i-1]+1) { cout << -1 << endl; return; }
		if (A[i] <= A[i-1]) num += A[i-1];
	}
	num += A[N-1];
	cout << num << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3936
#include <iostream>
#include <fstream>
#include <vector>
#include <array>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <random>
#include <limits>
#include <string>
#include <sstream>
#include <iomanip>

#include <cassert>
#include <cmath>
#include <ctime>

#pragma comment(linker, "/STACK:200000000")

using namespace std;

mt19937 mt (736);

void solve (istream &cin = std::cin, ostream &cout = std::cout)
{
    long long a, b, c, x, y;

    cin >> a >> b >> c >> x >> y;

    auto ans = numeric_limits<long long>::max ();

    for (int i = 0; i <= max (x, y) + 1; i++)
        ans = min (ans, 2 * c * i + max (0ll, x - i) * a + max (0ll, y - i) * b);

    cout << ans << endl;
}

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

#ifdef LOCAL
    solve ();

    cout << "clock: " << clock () << endl;
#else
    solve ();
#endif // LOCAL

    return 0;
}


Measured memory_bytes: 256
N = int(input())
d = {}

for _ in range(N):
    k = input()
    if k not in d:
        d[k] = 1
    else:
        d[k] += 1

M = int(input())
for _ in range(M):
    k = input()
    if k in d:
        d[k] -= 1

# print(d, max(d.values()))

if max(d.values()) < 0:
    print(0)
else:
    print(max(d.values()))


Measured memory_bytes: 3060
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInteger

getInt = readInt <$> BS.getLine

calc k n s
  | k > n = s
  | otherwise = calc (k + 1) n s'
  where
    d = n `div` k
    s' = s + ((d + 1) * k * d) `div` 2

main = do
  n <- getInt
  print $ calc 1 n 0


Measured memory_bytes: 4840
#include <iostream>
using namespace std;
int main(){
	int a,b;
	char c;
	while(1){
		cin>>a>>c>>b;
		if(c=='?')return 0;
		
		if(c=='+'){
			cout<<a+b;
		}
		else if(c=='-'){
			cout<<a-b;
		}
		else if(c=='*'){
			cout<<a*b;
		}
		else if(c=='/'){
			cout<<a/b;
		}
		cout<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll long long
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test int t; cin>>t; while(t--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define f0(i,n) for( ll i = 0; i < ( n ); i ++)
#define f1(i,n) for(i = 1; i <= ( n ); i ++)
#define f(i,m,n) for(auto i = ( m ); i <= ( n ); i ++)
#define nl cout<<"\n"
#define  mod 1000000007
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(x) ((ll)x.size())
#define mem(a, b) memset(a, b, sizeof(a));
#define make_graph(k) int x,y; f0(i,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
#define dekh cout<<"dekh"

#define o_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setpll tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update>
typedef vector<ll> vl;




/*ll Pow(ll a, ll b, ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll x = a*a;
        x%=m;
        return Pow(x,b/2,m);
    }
    return (a*Pow(a,b-1,m))%m;
}
*/
vector<ll>adj[200005];
 ll vis[200005]={0};

//ll p;ll arr[200005];

void dfs(ll x)
{
    cout<<x;nl;
    vis[x]=1;

    for(auto child : adj[x])
    {   if(!vis[child])
         {
             dfs(child);
         }
    }

}




ll n,k;
ll arr[100005];
ll dp[100005];
ll solve(ll i)
{
    if(i>=n-1)return 0;
    if(dp[i]!=-1)return dp[i];
    ll ans=INT_MAX;
    for(ll ind=1;ind<=k;ind++)
    {
        if(i+ind<n){
         ans = min(ans, solve(i+ind)+ abs(arr[i+ind]-arr[i]));
        }
    }

    //ll ans = (solve(i+1)+abs(arr[i+1]-arr[i]));
    //f(i+2<n)
      //  ans= min(ans,   solve(i+2)+ abs(arr[i+2]-arr[i]));
        return dp[i]=ans;
   // return ans;

}

int main()
{
    fast
 mem(dp,-1);
   // ll n;
    cin>>n>>k;
    f0(i,n)cin>>arr[i];
    cout<<solve(0);


}





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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    char x;
    cin>>x;
    if(x>='A'&&x<='Z')
        cout<<"A\n";
    else
        cout<<"a\n";
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;	
void func(long long a){
	long long denom = 10;
	long long ans = 0;
	if(a % 2 != 0){
		cout << ans << endl;
	} else {
		ans += a / 10;
		a /= 10;
		while(a){
			ans = ans + (a / 5);
			a = a / 5;
		}
		cout << ans << endl;
	}
			
}



int main(){
	long long n;
	cin >> n;
	func(n);
}


Measured memory_bytes: 3580
#include <iostream>

using namespace std;

int main()
{
  string palabra;
  string firstSide = "";
  string secondSide = "";
  cin >> palabra;

  int n = palabra.length();
  for (int i = 0; i < (n - 1) / 2; i++)
  {
    firstSide += palabra[i];
  }

  for (int i = ((n + 3) / 2) - 1; i < n; i++)
  {
    secondSide += palabra[i];
  }

  if (firstSide == secondSide)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}

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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){
	ll a, b, c;
	cin >> a >> b >> c;
	ll s = a + b + c;
	cout << s - max({a,b,c}) << nl;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


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

int main(){
  int n; cin >> n;
  map<int, int> s, t;
  for (int i = 0; i < n; i++) {
    int k; cin >> k;
    if (i % 2 == 1) s[k]++;
    else t[k]++;
  }
  vector<pair<int, int>> u, v;
  for (auto it = s.begin(); it != s.end(); it++) {
    u.push_back({it->second, it->first});
  }
  for (auto it = t.begin(); it != t.end(); it++) {
    v.push_back({it->second, it->first});
  }
  int x = u.size(); int y = v.size();
  u.push_back({0, 0}); v.push_back({0, 0});
  sort(u.begin(), u.end()); sort(v.begin(), v.end());
  if (u[x].second != v[y].second) {
    cout << n - (u[x].first + v[y].first) << endl;
  } else {
    cout << min(n-(u[x].first + v[y-1].first), n-(u[x-1].first + v[y].first)) << endl;
  }
  return 0;
}

Measured memory_bytes: 6136
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

class Program
{
    public Program()
    {
        int[] inputs = Console.ReadLine().Split().Select(int.Parse).ToArray(); 
        int n = inputs[0];
        int limitTime = inputs[1];
        int minCost = int.MaxValue;
        foreach(int i in Enumerable.Range(0, n))
        {
            inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int cost = inputs[0];
            int time = inputs[1];
            if(time <= limitTime && 
                minCost > cost)
                minCost = cost;
        }
        Console.WriteLine(minCost == int.MaxValue ? "TLE" : minCost.ToString());

    }
    static void Main(string[] args)
    {
        var p = new Program();
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;


Int n, a;
Int cnt[330000], cntcnt[330000];
Int ans[330000];

int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a;
        cnt[a]++;
    }
    int kind = 0;
    for(int i = 1;i <= n;i++){
        cntcnt[cnt[i]]++;
        if(cnt[i] > 0)kind++;
    }
    int sum = 0;
    for(int i = 1;i <= n;i++){
        kind -= cntcnt[i];
        sum += cntcnt[i] * i;
        Int maxK = (sum + kind * i) / i;
        ans[maxK] = i;
    }
    for(int i = n-1;i > 0;i--){
        ans[i] = max(ans[i+1], ans[i]);
    }
    for(int i = 1;i <= n;i++)cout << ans[i] << endl;
    
    return 0;
}

Measured memory_bytes: 8320
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
#define rep(i,n) for ( int i =0; i < n ; i ++)
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int abs(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int n,m;
  cin>> n>>m;
  vector<int> x(m);

  rep(i,m){
    cin>>x[i];
  }
  
  sort(x.begin(),x.end());
  ll ans =0;
  if(n>=m){
    cout<<0<<endl;
  }
  else{
    vector<int> l(m);
    rep(i,m-1){
      l[i] = x[i+1]-x[i];

    }
    sort(l.begin(),l.end());
    reverse(l.begin(),l.end());
    rep(i,m-n){
      ans += l[i+n-1]; 
    }
    cout<<ans <<endl;
  }
  
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
  cin>>n>>m;
  int a[n];
  float sum=0.0;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    sum+=a[i];
  }
  sum/=(4*m);
  int count=0;
  for(int i=0;i<n;i++)
  {
    if(a[i]>=sum)
      count++;
  }
  if(count>=m)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}
  
    

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ansCnt = 0
for i in range(0, A + 1):
    for j in range(0, B + 1):
        for k in range(0, C + 1):
            total = 500 * i + 100 * j + 50 * k
            if total == X:
                ansCnt += 1

print(ansCnt)

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

int main() {
  int n,k;
  cin >>n >>k;
  int a[n]={};
  rep(i,n){
    int g;
    cin >>g;
    a[g-1]++;
  }
  sort(a,a+n);
  int ans=0;
  for(int i=0;i<n-k;i++){
    ans+=a[i];
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
    char a,b;
    cin>>a>>b;
    int x,y;
    if(a=='H') x=1;
    else x=-1;
    if(b=='H') y=1;
    else y=-1;
    x=x*y;
    if(x==1) cout<<"H"<<endl;
    else cout<<"D"<<endl;

return 0;
}


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

#define ll long long
#define PI 3.14159265358979323846 
int main() {
	ll a, b;
	long double c;
	long double h, m;
	long double sita;
	cin >> a >> b >> h >> m;

	h *= 30;
	h += m / 60 * 30;
	m *= 6;
	if (h > m)sita = h - m;
	else sita = m - h;
	if (sita > 180)sita = 360 - sita;
	sita = sita * PI / 180.0;
	c = pow(a, 2) + pow(b, 2) - 2 * a*b*cos(sita);
	c = sqrt(c);
	printf("%.20Lf",c);
	return 0;
}

Measured memory_bytes: 4168
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>

using namespace std;

using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

int main()
{
    int n;
    scanf("%d", &n);

    map<int, int> counts;

    for (int i = 0; i < n; i++)
    {
        int k;
        scanf("%d", &k);

        counts[k]++;
    }

    int rem = 0;

    for (auto& c : counts)
    {
        if (c.second < c.first)
            rem += c.second;
        else
            rem += c.second - c.first;
    }

    printf("%d", rem);

    return 0;
}

Measured memory_bytes: 4736
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
void output_result(int a[], int n)
{
    for(int i=1; i<=n; i++) {
        if(i > 1)
            cout << " ";
        cout << a[i];
    }
    cout << endl;
}
int main()
{
	int n, a[105], i, j, flag = 0;
	cin >> n;
	for(i = 1; i <= n; i++){
		cin >> a[i];
	}
	
	for(i = 1; i <= n - 1; i++){
		for(j = 1; j <= n - i; j++){
			if(a[j] > a[j+1]){
				swap(a[j], a[j+1]);
				flag++;
			}
		}
	}
	
	output_result(a, n);
	cout << flag << endl;
	return 0;
}


Measured memory_bytes: 3076
lines = $stdin.read
array = lines.split("\n")
s = array[0]
t = array[1]

# first
s_dash = s.split("").sort.join
# latter
t_dash = t.split("").sort.reverse.join

len = 0

while true
  #p s_dash.length
  #p t_dash.length
  #p len
  if s_dash.length <= len or t_dash.length <= len
    if s_dash.length < t_dash.length
      puts "Yes"
    else
      puts "No"
    end
    exit 0
  else
    if s_dash[len] == t_dash[len]
    else
      if s_dash[len] > t_dash[len]
        puts "No"
      else
        puts "Yes"
      end
      exit 0
    end
  end
  len += 1
end

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

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if((A==B&&B!=C)||(B==C&&C!=A)||(C==A&&A!=B)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

type set struct {
	B, C int
}

type setlist []set

func (a setlist) Len() int           { return len(a) }
func (a setlist) Less(i, j int) bool { return a[i].C > a[j].C } // 降順にした
func (a setlist) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc.Split(bufio.ScanWords)

	N, M := scanInt(), scanInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = scanInt()
	}
	sort.Ints(A)

	L := make(setlist, M)
	for i := 0; i < M; i++ {
		L[i].B, L[i].C = scanInt(), scanInt()
	}
	sort.Sort(L)

	a, l := 0, 0
	for a < N && l < M {
		if A[a] < L[l].C {
			A[a] = L[l].C
			L[l].B--
			if L[l].B == 0 {
				l++
			}
		}
		a++
	}

	ans := 0
	for _, v := range A {
		ans += v
	}

	fmt.Println(ans)
}


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

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  for(int i = 0; i < A; i++) {
    cin >> a.at(i);
  }
  for(int i = 0; i < B; i++) {
    cin >> b.at(i);
  }
  vector<vector<int>> m(M, vector<int>(3));
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < 3; j++) {
      cin >> m.at(i).at(j);
    }
  }
  int m_in = 1000000;
  for(int i = 0; i < M; i++) {
    int S = 0;
    S = a.at(m.at(i).at(0) - 1) + b.at(m.at(i).at(1) - 1) - m.at(i).at(2);
    m_in = min(m_in, S);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int s = 0;
  s = a.at(0) + b.at(0);
  m_in = min(m_in, s);
  cout << m_in << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

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

    string s; cin >> s;
    int n=4;
    for(int bit=0; bit<(1<<3); bit++){
        int sum=s[0]-'0';
        rep(i,3){
            if(bit&(1<<i)){
                sum+=s[i+1]-'0';
            }else{
                sum-=s[i+1]-'0';
            }
        }
        if(sum==7){
            rep(i,3){
                cout<<s[i];
                if(bit&(1<<i)) cout<<'+';
                else cout<<'-';
            }
            cout<<s[3]<<"=7"<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<string.h>
int main()
{
	char s[101];
	int i,j,length,flag=0;
	
	gets(s);
	length=strlen(s);
	for(i=0;i<length;i++)
	{
		if(s[i]=='C')
		{
			for(j=i;j<length;j++)
			{
				if(s[j]=='F')
				{
					flag=1;
					break;
				}
			}
		}
	}
	if(flag==1)
	  printf("Yes\n");
    else
      printf("No\n");
	
	return 0;
} 


Measured memory_bytes: 128
#include<iostream>//static_cast<***>(***)
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
//to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<map>//map
#include<iomanip>
#include<locale>
#include<utility>//swap

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define Inf 2147483647//int最大
#define llInf 9223372036854775807//llint最大
#define rapid cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9
#define print(a) printf("%.15f\n",a)

using namespace std;

typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

bool inte(double n) {//整数かどうかの判定
	if (ceil(n) == floor(n)) {//切り上げ関数,切り下げ関数
		return true;
	}
	else return false;
}

// (char)toupper(a[n])=文字列のn文字目を大文字で出力

// pow(a,b)=aのb乗

//グローバル関数
int a = 0, n = 0, x = 0, y = 0, ans = 0, cnt = 0, sum = 0;
string s = "";

int main(void) {
	rapid;

	string s;
	cin >> s;
	if (s == "ABC")cout << "ARC" << rt;
	else cout << "ABC" << rt;

	please AC;
}


//参考：---;

Measured memory_bytes: 3656
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	int a, b;
	cin >> a >> b;
	
	if (b == 1) {
		cout << 0 << endl;
	}
	else {
		if ((b - 1) % (a - 1) == 0)cout << (b - 1) / (a - 1) << endl;
		else cout << (b - 1) / (a - 1) + 1 << endl;
	}

	system("pause");
	return 0;
}


Measured memory_bytes: 504