akhauriyash/Code-Regression huggingface dataset:
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
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 SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

int main(){
    
int a,b;
cin>>a>>b;
    a+=b;
    if(a>=10){
        cout<<"error"<<endl;
    }
    else{
        cout<<a<<endl;
    }





}


Measured memory_bytes: 256
let n = Int(readLine()!)!
let a = readLine()!.characters.split(" ").map{Int(String($0))!}
var ans = [0, 0]
for i in 0..<2 {
    var sum = 0
    for j in 0..<n {
        sum += a[j]
        if j % 2 == i {
            ans[i] += max(1+sum, 0)
            sum = min(sum, -1)
        } else {
            ans[i] += max(1-sum, 0)
            sum = max(sum, 1)
        }
    }
}
print(ans.minElement()!)

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


int main() {
    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int k;
    cin >> k;

    cout << a[k-1] << endl;


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second

#define END puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check();

int main() {
    clue();
    return 0;
}
int clue() {
    
    lli n,d;
    cin>>n>>d;
    // map<lli,lli>m;
    // map<lli,lli>::iterator it;
    list<pair<lli,lli> >m;
    list<pair<lli,lli> >::iterator it;

    lli count=0;
    while(n-->0) {
        lli x,y;
        cin>>x>>y;
        // m.insert(MP(x,y));
        m.pub(MP(x,y));
    }
    for(it=m.begin();it!=m.end();++it) {
        lli x,y;
        x=it->first MULTIPLY it->first;
        y=it->second MULTIPLY it->second;

        lli p=x+y;
        double dd=sqrt(p);
        if(dd<=d)++count;
    }
    // for(it=m.begin();it!=m.end();++it) {
    //     cout<<it->first<<" "<<it->second<<endl;
    // }

    cout<<count<<endl;
    return 0;
}

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

int main() {
	int x1,x2,x3,x4;
	int y1,y2,y3,y4;
	int x1x2,y1y2;
	
	cin >> x1 >> y1 >> x2 >> y2;

	x1x2 = x2 - x1;
	y1y2 = y2 - y1;
	
	x3 = x2 - y1y2;
	y3 = y2 + x1x2;
	
	x4 = x1 - y1y2;
	y4 = y1 + x1x2;
	
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;

  vector<int>A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  vector<int>B(N);
  for (int i = 0; i < N; i++) {
    B.at(A.at(i)-1) = i+1;
  }

  for (int i = 0; i < N; i++) {
    cout << B.at(i);
    if (i == N-1){
      cout << endl;
    }
    else {
      cout << ' ';
    }
  }
}
  

  
    
  

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

using namespace std;

typedef unsigned long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

lli n,c;
vll x,v;

template<class T,class Compare>
class segment_tree {
private:
  lli n;
  T d;
  vector<T>* v;
  T _query(lli a,lli b,lli k,lli l,lli r){
    if(r <= a || b <= l) return d;
    if(a <= l && r <= b) return this->v->at(k);
    else {
      T vl = _query(a,b,k*2+1,l,(l+r)/2);
      T vr = _query(a,b,k*2+2,(l+r)/2,r);
      return func(vl,vr);
    }
  }
public:
  segment_tree (){}
  segment_tree(lli n,T d = INT_MAX){
    this->n = 1;
    while(n > this->n) this->n <<= 1;
    v = new vector<T>(this->n*2,d);
    this->d = d;
  }
  void update(lli i,T x){
    i += n-1;
    this->v->at(i) = x;
    while(i > 0){
      i = (i-1)/2;
      this->v->at(i) = func(this->v->at(i*2+1),this->v->at(i*2+2));
    }
  }
  T query(lli a,lli b){
    return _query(a,b,0,0,n);
  }
  T func(T a,T b){
    if(Compare()(a,b)) return a;
    else return b;
  }
};
lli ans = 0;
lli fans;
lli mem;

int main(){
  cin >> n >> c;
  x = v = vll(n);
  for(lli i = 0;i < n;i++) cin >> x[i] >> v[i];
  vll sg(n);
  lli s = 0;
  for(int i = 0;i < n;i++){
    s += v[i];
    if(s > x[i]) sg[i] = s-x[i];
  }
  for(int i = 1;i < n;i++){
    sg[i] = max(sg[i-1],sg[i]);
  }
  vll gs(n);
  s = 0;
  for(int i = n-1;i >= 0;i--){
    s += v[i];
    if(s > (c-x[i]))gs[i] = s-(c-x[i]);
  }
  for(int i = n-1;i > 0;i--){
    gs[i-1] = max(gs[i],gs[i-1]);
  }
  ans = max(*max_element(sg.begin(),sg.end()),*max_element(gs.begin(),gs.end()));
  for(int i = 0;i < n-1;i++){
    if(sg[i]+gs[i+1] > x[i]) ans = max(ans,sg[i]-x[i]+gs[i+1]);
  }
  for(int i = n-1;i > 0;i--){
    if(gs[i]+sg[i-1] > c-x[i]) ans = max(ans,gs[i]-(c-x[i])+sg[i-1]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC90(void);
void ABC91(void);
void ABC92(void);
void ABC93(void);
void ABC94(void);
void ABC95(void);
void ABC96(void);
void ABC97(void);
void ABC98(void);
void ABC99(void);

int main(void){
    ABC97();
}

void ABC97(){
    int x,i,j,k,l,m,ma;
    cin>>x;
    ma=1;
    for(i=2;i<=x;i++){
        m=i;
        for(j=2;m<=x;j++){
            m*=i;
            if(m>ma&&m<=x)ma=m;
        }
    }
    cout<<ma<<endl;
}

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

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

const int INF = 100000000;
const double PI=3.14159265358979323846;

int main () {
    ll N;
    cin >> N;

    ll a[N], b[N];

    rep(i,N) {
        cin >> a[i];
    }
    rep(i,N) {
        cin >> b[i];
    }

    ll p,n;

    p=n=0;

    rep(i,N) {
        if (a[i]-b[i]>0) {
            p+=a[i]-b[i];
            //n-=(a[i]-b[i])*2;
        }
        else {
            n+=(b[i]-a[i])/2;
        }
    }

    if (n>=p) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

int main(){
  long n;
  std::string s;
  int i;
  s = "abcdefghijklmnopqrstuvwxyz";
  std::string res;
  res = "";
  std::cin >> n;
  while(n>0){
    n--;
    i = n % 26;
    n /= 26;
    res = s.at(i) + res;
  }
  std::cout << res;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;

int main() {
  ll n,k;
  cin >> n >> k;
  vec a(n);
  vec b(n);
  for(ll i=0;i<n;i++) {
    cin >> a[i] >> b[i];
  }
  ll ans=0;
  for(ll i=0;i<n;i++) {
    if((a[i]|k)==k) ans+=b[i];
  }
  for(ll i=0;i<=30;i++) {
    if(k&(1<<i)) {
      ll mask=((k>>(i+1))<<(i+1))+(1<<i)-1;
      ll sum=0;
      for(ll j=0;j<n;j++) {
        if((a[j]|mask)==mask) sum+=b[j];
      }
      ans=max(ans,sum);
    }
  }
  cout << ans << endl;
}

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

int main() {
    int n, m; cin >> n >> m;
    vector<int> h(n);
    vector<bool> ans(n, true);

    rep(i, n) cin >> h[i];
    rep(i, m) {
        int a, b;cin >> a >> b;
        a--; b--;
        if (h[a] == h[b]) {
            ans[a] = false;
            ans[b] = false;
        }
        else if (h[a] < h[b]) ans[a] = false;
        else ans[b] = false;
    }
    int sum = 0;
    rep(i, n) {
        if (ans[i] == true) {
            //cout << "#" << i+1 << endl;
            sum++;
        }
    }
    cout << sum << endl;
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;

typedef long long int ll;

ll f(vector<vector<ll> > &dp, ll r, ll c,ll w,ll v){
	if(w > r) return LLONG_MIN;
	else return dp[r-w][c-1] + v;
}

void solve(){
	ll N; cin >> N;
	ll W;
	cin >> W;
	vector<pair<ll,ll> > sack(N);
	for(int i = 0; i < N; i++){
		ll w, v;
		cin >> w >> v;
		sack[i] = mp(w,v);
	}
	sort(all(sack));
	
	vector<vector<ll> > dp(W+1,vector<ll>(N,0));
	
	for(ll i = sack[0].first; i < W+1; i++) dp[i][0] = sack[0].second;
	
	for(ll i = 0; i < W+1; i++){
		for(ll j = 1; j < N; j++){
			ll t = f(dp,i,j,sack[j].first, sack[j].second);
			dp[i][j] = max(dp[i][j-1], t);
		}
	}
	
//	for(ll i = 0; i < W+1; i++){
//		cout << i << ": ";
//		for(ll j = 0; j < N; j++){
//			cout << dp[i][j] << " ";
//		}
//		cout << endl;
//	}
	cout << dp[W][N-1] << endl;
}

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

	int T;
	//cin >> T;
	T = 1;
	while(T--){
		solve();
	}
	return 0;
}




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

typedef long long ll;
typedef pair<int, pair<int, int>> piii;
//loop
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//STL
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

//const
#define MOD 1000000007 //10^9+7:合同式の法

//acronym
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

const int INF = 1e9;

#define deg_to_rad(deg) ((deg)*M_PI / 180.0)

// const int MOD = 998244353;

void Main()
{
    char X, Y;
    cin >> X >> Y;

    if (X < Y)
    {
        cout << "<" << endl;
    }
    else if (X == Y)
    {
        cout << "=" << endl;
    }
    else
    {
        cout << ">" << endl;
    }
    
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;
import java.io.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		char a[] = sc.nextLine().toCharArray();
		for(int i = 0;i<a.length; i++) {
			if(a[i] == '9') a[i] = '1'; 
			else a[i] = '9';
		}
		System.out.println(a);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <fstream>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <list>
#include <vector>
#include <queue>
#include <bitset>
#include <cctype>
#include <algorithm>


typedef long long ll;
#define nn cout << '\n'
#define rep(n) for(int i = 0; i < n; i++)
#define repi(n) for(int i = 0; i <n; i++)

using namespace std;


void testcase() {
	ll n; cin >> n;
	//ll n1 = n;
	ll dec = 26;
	string s = "zabcdefghijklmnopqrstuvwxy";
	string res = "";
	
	while (n > 0) {
		ll idx = n % 26;
		res = s[idx] + res;
		if (idx == 0) {
			n -= 26;
		}
		n -= idx;
		n /= 26;
	}
	cout << res;
	


}


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

	int x = 1;
	rep(x) {
		testcase();
		nn;

	}
	return 0;
}

/*

*/

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

#define fi first
#define se second
#define FOR(a, b, c) for(int a = b;a <= c; ++a)
#define pb push_back

const int N = 2e5 + 10;
const int MOD = 1e9 + 7;
const int oo = 1e9;

typedef pair<int, int> ii;

int n, m;
int color[N], cnta[N], cntb[N];
vector<int> vi[N];
bool visit[N];
set<ii> st;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    FOR(i, 1, n) {
        char x; cin >> x;
        color[i] = x - 'A';
    }
    FOR(i, 1, m) {
        int u, v; cin >> u >> v;
        vi[u].pb(v);    vi[v].pb(u);
    }
    FOR(i, 1, n)    {
        cnta[i] = cntb[i] = 0;
        for(int v: vi[i])   {
            if(color[v] == 0) cnta[i] ++;
            else cntb[i]++;
        }
        st.insert(ii(cnta[i] * cntb[i], i));
    }
    while(!st.empty() && st.begin()->fi == 0)  {
        int u = st.begin()->se;
        st.erase(st.begin());
        visit[u] = true;
        for(int v: vi[u])   if(!visit[v])   {
            auto it = st.find(ii(cnta[v] * cntb[v], v));
            st.erase(it);
            if(color[u] == 0) cnta[v] --;
            else cntb[v] --;
            st.insert(ii(cnta[v] * cntb[v], v));
        }
    }
    if(st.size() > 0)cout << "Yes";
    else cout << "No";
}



Measured memory_bytes: 21632
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
  x=a[i]-i-1
  b.append(x)
b.sort()
if n%2==1:
  med=b[n//2]
else:
  x=b[(n//2)-1]
  y=b[(n//2)]
  med=(x+y)/2
  if med!=int(med):
    med=x
  else:
    med=int(med)
ans=0
for i in range(n):
  ans+=abs(b[i]-med)
print(ans)

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

int main(){
    ll N, x;
    cin >> N >> x;
    vector<ll> a(N);
    rep(i, 0, N) cin >> a[i];
    sort(a.begin(),a.end());
    ll ans = 0;
    rep(i, 0, N){
        if(i == N-1){
            if(x == a[N-1]) ans++;
            break;
        }
        if(a[i] <= x){
            ans++;
            x -= a[i];
        }else{
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
Q = int(input())

d = 0
X = [[], []]
for i in range(Q):
    q = input()
    if q[0] == "1":
        d = (d + 1) % 2
    else:
        a, f, c = q.split()
        x = (int(f) + d) % 2
        X[x].append(c)

if d == 0:
    v = "".join(X[1])[::-1] + S + "".join(X[0])
else:
    v = "".join(X[0])[::-1] + S[::-1] + "".join(X[1])
print(v)


Measured memory_bytes: 11184
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <vector>
#include <set>
using namespace std;

int main(){
    int N, ans = 0, v = 0;
    cin >> N;

    vector<int> h(N);

    for(int i = 0; i < N; i++){
        cin >> h.at(i);
    }

    for(int i = 0; i < N; i++){
        if(v >= h.at(i)){
            v = h.at(i);
        }
        else{
            ans += h.at(i) - v;
            v = h.at(i);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n) { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x) { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int m, t, p, r;
	while (cin >> m >> t >> p >> r, m) {
		vector<pair<int, pii>> score(t,pair<int,pii>(0,pii(0,0)));//point time team
		REP(i, t)
			score[i].second.second = -(i + 1);
		vvi pena(t, vi(p, 0));//team pro
		REP(j, r) {
			int time, t2, p2, ju;
			cin >> time >> t2 >> p2 >> ju;
			t2--;
			p2--;
			if (ju == 0) {
				score[t2].first--;
				score[t2].second.first += pena[t2][p2] * 20 + time;
			}
			else {
				pena[t2][p2]++;
			}
		}
		SORT(score);
		int ac;
		int ti;
		REP(i, t) {
			if (i == 0) {
				ac = score[i].first;
				ti = score[i].second.first;
				cout << -score[i].second.second;
			}else{
				if (ac == score[i].first&& ti == score[i].second.first)
					cout << "=";
				else
					cout << ",";
				cout<< -score[i].second.second;
				ac = score[i].first;
				ti = score[i].second.first;
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back







int main(){


  int n;
  cin>>n;
  vi length(n);
  rep(i,n){
    int tmp;
    cin>>tmp;
    length.at(i)=tmp;
  }
  
  sort(ALL(length));
  

  
  int count=0;
  
  for (int i=0;i<n;i++){
    for (int j=i+1;j<n;j++){
      int c=length.at(i)+length.at(j);
      int dis=distance(length.begin(),lower_bound(ALL(length),c));
      count+=(dis-1)-(j+1)+1;
    }
  }
  
  cout<<count<<endl;

}


















Measured memory_bytes: 256
import sys
n = int(input())
h = list(map(int,input().split()))

for i in range(n-1,0,-1):
    if (h[i-1] > h[i]):
        h[i-1]-=1
    if (h[i-1] > h[i]):
        print("No")
        sys.exit()
print("Yes")

Measured memory_bytes: 14704
#include <iostream>

int main()
{
    int time[5];
    for (int i = 0; i < 5; i++)
    {
        std::cin >> time[i];
    }

    for (int i = 0; i < 5; i++)
    {
        for (int j = i + 1; j < 5; j++)
        {
            if (((time[i] - 1) % 10) < ((time[j] - 1) % 10))
            {
                int tmp = time[i];
                time[i] = time[j];
                time[j] = tmp;
            }
        }
    }

    int amount = 0;
    for (int i = 0; i < 5; i++)
    {
        if (amount % 10 != 0)
        {
            amount += 10 - (amount % 10);
        }
        amount += time[i];
    }

    std::cout << amount;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <climits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

typedef pair<int, int> ii;
typedef long long int64;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    while (b < a && c) {
	b++;
	--c;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<string> RedCards(N);
  for(int i=0;i<N;i++) cin >> RedCards.at(i);
  
  int M;
  cin >> M;
  vector<string> BlueCards(M);
  for(int i=0;i<M;i++) cin >> BlueCards.at(i);
  
  string s;
  int ans,temp;
  ans=0;
  for(int i=0;i<N;i++){
    temp=0;
    s=RedCards.at(i);
    
    for(int j=0;j<N;j++){
      if(RedCards.at(j)==s) temp++;
    }
    
    for(int j=0;j<M;j++){
      if(BlueCards.at(j)==s) temp--;
    }
    ans=max(ans,temp);
  }
  cout << ans << endl;
}

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

int main() {
    int  N, R; cin >> N >> R;
    int ans;
    
    if (N >= 10) {
        ans = R;
    }
    else {
        ans = R + 100 * (10 - N);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include<set>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;///////////////////////////////////////////////////////////
int main(){
 ll k,n,s;
 sc(n);sc(k);sc(s);

 ll cnt=0;
 rep(i,0,n){
  if(cnt<k){
   cnt++;
   cout<<s<<" ";
  }
  else{
   ll b;
   if(s==llpow(10,9))b=1;
   else b=s+10;
   cout<<b<<" ";
  }
 }
 pnn;
return 0;}

Measured memory_bytes: 3584
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	LL n;
	cin >> n;
	LL ans = INF * INF;
	for (LL i = 1; i * i <= n; i++)
	{
		if (n % i) continue;
		ans = min(ans, i - 1 + n / i - 1);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
while True:
    H,W = map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        for k in range(W):
            if (i+k)%2 == 0:
                print("#",end = "")
            else:
                print(".",end = "")
        print()
        
    print()


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


int main() {
    int n;
long long int sum=0;
   cin>>n;
vector<long int> a(n);
for(int i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}


  long long int ans=0;
long long int mo=1000000007;
sum=sum;
for (int i = 0; i < n-1; i++)
{
sum-=a[i];
    ans+=(a[i]%mo)*(sum%mo);
ans=ans%mo;

}

cout<<ans<<endl;
}

Measured memory_bytes: 4796
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;


/*----------------------------------------------------------------*/
signed main(){

    int n;
    cin >> n;
    vll a(n);
    vll b(n);
    vll c(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    rep(i,n)c[i] = 1+i;
    int x,y;

    int cnt = 0;
    do{
        if(a == c)x = cnt;
        if(b == c)y = cnt;
        cnt++;
    }while(next_permutation(all(c)));

    cout << abs(x-y) << endl;
    
    
	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc145.contest.atcoder.jp/tasks/abc145_c

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;




int main()
{
	int AB, BC, CA;
	cin >> AB >> BC >> CA;
	cout << (AB*BC) / 2 << endl;
}

Measured memory_bytes: 256
judge :: Bool -> (String,String) -> String
judge f (ts,fs) = case f of
  True -> ts
  False -> fs

sumOfDigit :: Int -> Int -> Int
sumOfDigit total 0 = total
sumOfDigit total n = sumOfDigit (total + r) q
  where
    q = n `div` 10
    r = n `mod` 10

isHarshadNum :: Int -> Bool
isHarshadNum n = n `mod` (sumOfDigit 0 n) == 0

main = do
  line <- getLine
  let
    n = read line :: Int
    ret = isHarshadNum n
  putStrLn $ judge ret ("Yes","No")


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

#define ll long long
#define N 22
#define mod 1000000007

ll dp[2097155];
int c[N][N], n;


int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;

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

	ll s = 0;
	for (int i = 0; i < n; i++) {
		s += 1 << i;
	}

	dp[0] = 1; // if there are zero women left means all women are paired so this is one way

	for (ll j = 1; j <= s; j++) {
		int i = __builtin_popcountll(j);
		dp[j] = 0;
		ll tmp = j;
		i = n - i;

		for (int k = 0; k < n; k++) {
			int bit = tmp & 1;
			if (bit && c[i][k]) {
				dp[j] += dp[(j ^ (1 << k))];
				//cout << dp[j];
				dp[j] %= mod;
			}
			tmp = tmp >> 1;
		}
	}

	cout << dp[s];
}

Measured memory_bytes: 16640
class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n)) #親ノード
        self.size = [1]*n #グループの要素数
 
    def root(self, x): #root(x): xの根ノードを返す．
        while self.parent[x] != x:
            self.parent[x] = self.parent[self.parent[x]]
            x = self.parent[x]
        return x 
 
    def merge(self, x, y): #merge(x,y): xのいる組とyのいる組をまとめる
        x, y = self.root(x), self.root(y)
        if x == y: return False
        if self.size[x] < self.size[y]: x,y=y,x #xの要素数が大きいように
        self.size[x] += self.size[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True
 
    def issame(self, x, y): #same(x,y): xとyが同じ組ならTrue
        return self.root(x) == self.root(y)
        
    def getsize(self,x): #size(x): xのいるグループの要素数を返す
        return self.size[self.root(x)]
        


# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n,*a = [int(i) for i in read().split()]
#a = [int(i) for i in readline().split()]
#n = int(input())


n,m,k = [int(i) for i in readline().split()]
ab = [[int(i)-1 for i in readline().split()] for _ in range(m)]
cd = [[int(i)-1 for i in readline().split()] for _ in range(k)]

UF = UnionFind(n)
for a,b in ab:
    UF.merge(a,b)


ans = [UF.getsize(i)-1 for i in range(n)]

for a,b in ab:
    ans[a] -= 1
    ans[b] -= 1

for c,d in cd:
    if UF.issame(c,d):
        ans[c] -= 1
        ans[d] -= 1

print(*ans)









Measured memory_bytes: 91228
import collections as col
import numpy as np
import math as ma
import scipy.misc as spm #miscellaneous

MOD = 10**9 + 7
def inv(a): return pow(a, MOD-2, MOD)
def comb(n,r):
    ans = ma.factorial(n)%MOD * inv(ma.factorial(r)) * inv(ma.factorial(n-r))
    return ans%MOD

def prime(n):
    ans = []
    for i in range(2, int(n**0.5)+1):
        while not n%i: n //= i; ans.append(i)
    if n != 1: ans.append(n)
    return ans

n,m = map(int,input().split())
cnt = col.Counter(prime(m))

ans = 1
for key,val in cnt.items():
    #ans *= comb(val + n-1, n-1)
    ans *= spm.comb(val + n-1, n-1, exact=1)
    ans %= MOD
print(ans)


Measured memory_bytes: 13252
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    string s;
    cin >> s;
    vector<string> vs = {
        "SUN","MON","TUE","WED","THU","FRI","SAT" 
    };

    auto itr = std::find(vs.begin(), vs.end(), s);
    int index = std::distance(vs.begin(), itr);
    println((7 - index));
    return 0;
}

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

#define MOD 1000000007

int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  vector<int> sum(n);
  vector<int> alp_sum('z' - 'a' + 10, 0);
  sum[0] = 1;
  alp_sum[s.at(0) - 'a'] = 1;
  int i;
  for (i = 1; i < n; i++) {
    sum[i] = alp_sum[t.at(i) - 'a'] % MOD;
    sum[i] %= MOD;
    alp_sum[s.at(i) - 'a'] += sum[i] % MOD;
    alp_sum[s.at(i) - 'a'] %= MOD;
  }
  cout << sum[n - 1] % MOD << endl;
  return 0;
}



Measured memory_bytes: 3720
#include <stdio.h>

int main () {
    int ab = 0;
    int bc = 0;
    int ca = 0;
    int area = 0;
    
  
    scanf("%d %d %d", &ab, &bc, &ca);

    
    area = ((ab*bc)/2);
    
    printf("%d\n", area);
    
    return 0;
}


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

using namespace std;

int N,M;
long long   from[2100], to[2100];
long long   cost[2100];
long long   dist[1100];
long long   const INF = 1e18;
//bellmanford
bool bellmanford(){
  fill(dist,dist+1100,-INF);
  dist[0] = 0;
  for(int k = 0; k < 2*N ; k++){  //node nums
    for(int i = 0; i < M; i++){   // edge nums
      if(dist[to[i]] < min(dist[from[i]] + cost[i] , INF)){
        dist[to[i]] = min(INF,dist[from[i]] + cost[i]);
        if(k >= N && to[i] == N-1) return  true;
      }
    }
  }
  return false;
}
//main()-----------------------------
int main(){
  cin >> N >> M;
  for(int i = 0; i < M; i++){
    cin >> from[i] >> to[i] >> cost[i];
    from[i] --; to[i] --;
  }

  bool infFlag = bellmanford();

  if(infFlag) cout << "inf" << endl;
  else        cout << dist[N-1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pri 1000000000
using namespace std;
 
int main() {
	ll n;
	cin>>n;
	ll a[n][3],dp[n][3];
	for(ll i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		dp[i][0]=0;
		dp[i][1]=0;
		dp[i][2]=0;
	}
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(ll i=0;i<n-1;i++){
		for(ll j=0;j<3;j++){
			for(ll k=0;k<3;k++){
				 if(j==k)continue;
					dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i+1][k]);
				
			}
		}
		
	}
	ll maxi=-10000000000000;
	for(ll i=0;i<3;i++)maxi=max(maxi,dp[n-1][i]);
	cout<<maxi<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  co((n-2)*180)
}

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

using namespace std;

typedef long long ll;

int num(char n)
{
    return isdigit(n) ? n - '0' : n - 'A' + 10;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    char a, b;
    cin >> a >> b;
    if (num(a) < num(b))
        cout << '<' << endl;
    else if (num(a) > num(b))
        cout << '>' << endl;
    else
        cout << '=' << endl;
    return 0;
}

Measured memory_bytes: 256
# import numpy as np
# import scipy as sp
# print(a,b,c,sep="") # 半角スペースなしで出力(abc)
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
# import sys ; sys.exit() # プログラム終了
# from copy import deepcopy ; b=deepcopy(a)
# chr(ord('a') + 1)
# s.sort(key=lambda x: x[1], reverse=False) # 2番目の要素で昇順にソート（Trueなら降順）
#
from copy import deepcopy
from collections import deque

d = deque()
h, w = map(int, input().split())
s = [list(map(str, list(input()))) for i in range(h)]
used = [[True for j in range(w)] for i in range(h)]
# used = [[True]*w]*h
for i in range(h):
    for j in range(w):
        if (s[i][j] == "#"):
            d.append([i, j])
            used[i][j] = False


ans = -1
while (d):

    tmp = deque()
    while(d):
        i, j = d.popleft()

        if i+1 < h and used[i+1][j]:
            s[i+1][j] = "#"
            tmp.append([i+1, j])
            used[i+1][j] = False

        if i-1 >= 0 and used[i-1][j]:
            s[i-1][j] = "#"
            tmp.append([i-1, j])
            used[i-1][j] = False

        if j+1 < w and used[i][j+1]:
            s[i][j+1] = "#"
            tmp.append([i, j+1])
            used[i][j+1] = False

        if j-1 >= 0 and used[i][j-1]:
            s[i][j-1] = "#"
            tmp.append([i, j-1])
            used[i][j-1] = False

    d = tmp
    ans += 1

print(ans)


Measured memory_bytes: 174428
package main

import "fmt"

func main() {
	var N, M, p, acc, wac int
	var S string
	fmt.Scan(&N, &M)
	w := map[int][]string{}
	for i := 0; i < M; i++ {
		fmt.Scan(&p, &S)
		w[p] = append(w[p], S)
	}
	for _, v := range w {
		waCnt := 0
		for j := 0; j < len(v); j++ {
			if v[j] == "WA" {
				waCnt++
			} else {
				acc++
				wac += waCnt
				break
			}
		}
	}
	fmt.Printf("%d %d", acc, wac)

}


Measured memory_bytes: 29696
n = int(input())

def F(a: int, b: int) -> int:
    la, lb = len(str(a)), len(str(b))
    if la <= lb:
        return lb

    return la

ans = F(1, n)
for i in range(2, int(n**0.5)+1):
    if n%i == 0:
        ans = min(ans, F(i, n//i))

print(ans)


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;

namespace AtTest.ABC_105
{
    class D
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            input = Console.ReadLine().Split(' ');
            var array = new int[n];
            var sums = new int[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = int.Parse(input[i]);
                if (i == 0)
                {
                    sums[i] = array[i] % m;
                }
                else
                {
                    sums[i] = (sums[i - 1] + array[i]) % m;
                }
                sums[i].ToString();
            }

            var marginDict = new Dictionary<int, int>();
            marginDict.Add(0, 1);
            long cnt = 0;
            for(int i = 0; i < n; i++)
            {
                if (marginDict.ContainsKey(sums[i]))
                {
                    cnt += marginDict[sums[i]];
                    marginDict[sums[i]]++;
                }
                else
                {
                    marginDict.Add(sums[i], 1);
                }
            }

            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 27228
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            C();
        }

        static void C()
        {
            var S = ReadLong();
            long sum = 0;
            for (long i = 0; i < Math.Pow(2, S.ToString().Length-1); i++)
            {
                var sList = S.ToString().ToList();
                var k = 1;
                for (int j = 0; j < S.ToString().Length - 1; j++)
                {
                    if ((i >> j & 1) == 1)
                    {
                        sList.Insert(j+k, '+');
                        k++;
                    }
                }
                sum += Join(sList).Split('+').Select(long.Parse).Sum();
            }
            Println(sum);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}

Measured memory_bytes: 13396
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <set>
using namespace std;

const int kMaxn = 2e5 + 5;
const double eps = 1e-6;
int N, M, K;
int p[kMaxn];
bool check(double x);

int main() {
  //
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> p[i];
  double l = 0.45, r = 1e9;
  while (r - l > eps) {
    double mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  printf("%.0f\n", (l + 0.5));
  return 0;
}

bool check(double x) {
  int64_t cnt = 0;
  for (int i = 1; i <= N; i++)
    if (p[i] >= x) cnt += (int64_t)ceil(p[i] / x) - 1;
  return cnt <= K;
}

Measured memory_bytes: 4000
#include<stdio.h>
int main(void){
  int ant[5];
  int k,i,d;
  for(i=0;i<=4;i++){
  scanf("%d",&ant[i]);
  }
  scanf("%d",&k);
  d=1;
    if((ant[4]-ant[0])>k){
      d=0;
    }
  if(d==1){
    printf("Yay!");
  }
  if(d==0){
    printf(":(");
  }
  return 0;
}
    

Measured memory_bytes: 128
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int n;
	long[] m, a, b;

	void run(){
		for(;;){
			n=sc.nextInt();
			if(n==0){
				break;
			}
			m=new long[n];
			a=new long[n];
			b=new long[n];
			for(int i=0; i<n; i++){
				m[i]=sc.nextLong();
				a[i]=sc.nextLong();
				b[i]=sc.nextLong();
			}
			solve();
		}
	}

	void solve(){
		for(int j=0; j<n; j++){
			int sum1=0, sum2=0;
			for(int i=0; i<n; i++){
				if(a[i]<=a[j]&&a[j]<b[i]){
					sum1+=m[i];
				}
				if(a[i]<=b[j]-1&&b[j]-1<b[i]){
					sum2+=m[i];
				}
			}
			if(sum1>150||sum2>150){
				println("NG");
				return;
			}
		}
		println("OK");
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

vector<int> a;

int cost(int y)
{
  int cost = 0;
  int N = a.size();
  for (int i = 0; i < N; i++)
  {
    int x = a.at(i);
    cost += (x - y) * (x - y);
  }
  return cost;
}

int main()
{
  int N;
  cin >> N;
  int M = -inf, m = inf;
  for (int i = 0; i < N; i++)
  {
    int A;
    cin >> A;
    a.push_back(A);
    chmax(M, a.at(i));
    chmin(m, a.at(i));
  }
  
  int ans = inf;
  for (int y = m; y <= M; y++) chmin(ans, cost(y));
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define int ll
#define endl '\n'
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a<b)?a:b)
using namespace std;
 
int32_t main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int n, m, pos, num;
	cin >> n >> m;
	vector<int> arr(n,-1);
	for(int i=0;i<n;i++) arr[i]=-1;
	while(m--){
		cin >> pos >> num;
		if(arr[pos-1]!=-1 && arr[pos-1]!=num){
				cout << -1 << endl;
				return 0;
		}
		arr[pos-1] = num;
	}
	if(arr[0]==0 && n>1){
		cout << -1 << endl;
		return 0;
	}
	if(arr[0]==-1) arr[0]=(n>1)?1:0;
	for(int i:arr) cout << max(i,0);
	cout << endl;
	return 0;
}

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

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

    int N;

    cin >> N;

    int sum=0, max=0;
    int array[N];

    rep(i, N)
    {
        cin >> array[i];
        if (i>0 && array[i]<=array[i-1]) ++sum;
        else sum = 0;
        if(sum >= max) max = sum;
    }

    cout << max;

    return 0;
}

Measured memory_bytes: 640
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)
typedef long long ll;

vector<ll> a(100);
vector<ll> p(100);

ll burger(ll L, ll x) {
	//終了条件
	if (L == 0) {
		if (x <= 0) return 0;
		else return 1;
	}

	if (x == 1) return 0;
	
	else if (1 < x && x < 2 + a[L - 1]) return burger(L - 1, x - 1);

	else if (x == 2 + a[L - 1]) return p[L - 1] + 1;

	else if (2 + a[L - 1] < x && x < 3 + 2 * a[L - 1]) return p[L - 1] + 1 + burger(L - 1, x - (2 + a[L - 1]));

	else if (x == 3 + 2 * a[L - 1]) return 2 * p[L - 1] + 1;
}

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

	ll n, x;
	cin >> n >> x;

	//バーガー長さ
	a[0] = 1;
	FOR(i, 0, n - 1) a[i + 1] = 2 * a[i] + 3;
	
	//cout << "a:" << endl;
	//FOR(i, 0, n) cout << a[i] << endl;
	//cout << endl;

	//パティ数
	p[0] = 1;
	FOR(i, 0, n - 1) p[i + 1] = 2 * p[i] + 1;

	//cout << "p:" << endl;
	//FOR(i, 0, n) cout << p[i] << endl;
	//cout << endl;

	cout << burger(n, x) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define soja(i,a,n) for(ll i=a;i<=n;i++)
#define ulta(i,n,a) for(ll i=n;i>=a;i--)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ve vector<ll>
#define se set<ll>
#define ma map<ll,ll>
#define pll vector<pair<ll,ll>>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define in insert
ll n,m,k,t,sum=0,temp;
int main()
{
fast;

cin>>n>>m;
ll a[n];
soja(i,0,n-1)
cin>>a[i];
sort(a,a+n);
soja(i,0,m-1)
sum+=a[i];
cout<<sum<<endl;

return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define MOD 1000000007
#define int long long
using ll = long long;
using namespace std;
const int INF = 1LL << 50;
using P       = pair<int, int>;

template <class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else {
        return false;
    }
}
template <class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    } else {
        return false;
    }
}

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

signed main() {
    int as[3];
    rep(i, 0, 3) cin >> as[i];
    sort(as, as + 3);
    cout << (as[2] == as[0] + as[1] ? "Yes" : "No") << endl;
}


Measured memory_bytes: 632