akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int N, K; cin >> N >> K;
  vector<int> V(N);
  REP(i, N) cin >> V[i];
  int R = min(N, K);
  int M = 0;
  for(int A = 0; A <= R; A++) {
    for(int B = 0; B <= R; B++) {
      if (A + B <= R) {
        vector<int> my_jewl;
        // cout << A << ' ' << B << endl;
        REP(i, A) my_jewl.push_back(V[i]);
        REP(i, B) my_jewl.push_back(V[N - 1 - i]);
        sort(ALL(my_jewl));
        // REP(i, my_jewl.size()) cout << my_jewl[i] << ' ';
        // cout << endl;

        int ans = 0;
        REP(i, my_jewl.size()) ans += my_jewl[i];
        // cout << ans << endl;
        REP(i, min((int)my_jewl.size(), K-A-B)) {
          if (my_jewl[i] < 0) ans += abs(my_jewl[i]);
        }
        M = max(M, ans);
      }
    }
  }
  cout << M << endl;
  return 0;
}

Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

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

    int n; cin >> n;
    vector<pair<int ,int>> xy(n);
    rep(i, n) cin >> xy[i].first >> xy[i].second;

    int cnt = 0;
    double ans, distSum = 0;
    vector<int> order(n);
    for(int i = 0; i < n; i++) order[i] = i;

    do {
        for(int i = 0; i < n - 1; i++) {
            int distX = pow((xy[order[i]].first) - (xy[order[i + 1]].first), 2);
            int distY = pow((xy[order[i]].second) - (xy[order[i + 1]].second), 2);
            distSum += sqrt(distX + distY);
        }
        cnt++;
    } while(next_permutation(order.begin(), order.end()));

    ans = distSum / cnt;
    printf("%.10f", ans);
}


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

#define FOR(i,a,b)    for (int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)   for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)      for (int i=0    ;i<(n) ;i++)
#define RREP(i,n)     for (int i=(n)-1;i>=0  ;i--)
#define EACH(i,a,b)   for (int i=(a)  ;i<=(b);i++)
#define REACH(i,a,b)  for (int i=(b)  ;i>=(a);i--)
#define ALL(a)        (a).begin(),  (a).end()
#define RALL(a)       (a).rbegin(), (a).rend()

const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const double EPS = 1e-10;

using ll = long long;
using P = pair<int,int>;

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

  ll H,W;
  cin >> H >> W;

  ll ans = (H / 2) * W + (H % 2) * (W + 1) / 2;
  if (H == 1 || W == 1) ans = 1;
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e14 : 2e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	while(cin>>n,n){
		vi in(n+2);
		in[0]=inf+1;
		rep(i,n){
			string s;
			cin>>s;
			if(s=="x")in[i+1]=inf;
			else in[i+1]=stoi(s);
		}
		in[n+1]=(n%2?inf+1:-inf-1);
		ll mi=-inf,ma=inf;
		rep(i,n)if(in[i+1]==inf){
			if(i%2){
				cmax(mi,max(in[i],in[i+2]));
			}else{
				cmin(ma,min(in[i],in[i+2]));
			}
		}
		bool h=true;
		rep(i,n+1){
			if(in[i]==inf&&in[i+1]==inf)h=false;
			if(in[i]!=inf&&in[i+1]!=inf){
				if(i%2&&in[i]>=in[i+1]||i%2==0&&in[i]<=in[i+1]){
					h=false;
				}
			}
		}
		if(ma==-inf)ma=inf;
		if(mi==inf)mi=-inf;
		if(!h)cout<<"none"<<endl;
//		else if(ma==-inf&&mi==inf)cout<<"ambiguous"<<endl;
		else if(ma-mi==2)cout<<ma-1<<endl;
		else if(ma-mi>2)cout<<"ambiguous"<<endl;
		else cout<<"none"<<endl;
	}
}

Measured memory_bytes: 3148
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?9e18:1e9;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};
class BRI{
	public:
	int N;
	vi used;
	vvi G;
	vp bridge;
	void add_edge(int s,int t){
		G[s].pb(t);
		G[t].pb(s);
	}
	BRI(int size){
		N=size;
		G=vvi(N);
	}
	int dfs(int i,int prev,int &n){
		if(used[i])return used[i];
		int m=n;
		used[i]=n++;
		rep(j,G[i].size()){
			if(prev==G[i][j])continue;
			if(used[i]<used[G[i][j]])continue;
			int res=dfs(G[i][j],i,n);
			m=min(m,res);
			if(used[i]<res)bridge.pb(pii(min(i,G[i][j]),max(i,G[i][j])));
		}
		return m;
	}
	void bri(){
		used=vi(N);
		bridge=vp(0);
		int n=1;
		dfs(0,-1,n);
		cout<<bridge.size()<<endl;
//		sort(all(bridge));
//		rep(i,bridge.size())cout<<bridge[i].first<<" "<<bridge[i].second<<endl;
	}
};
int main(){
	int n,m;
	cin>>n>>m;
	BRI bri(n);
	while(m--){
		int a,b;
		cin>>a>>b;
		a--;b--;
		bri.add_edge(a,b);
	}
	bri.bri();
}









Measured memory_bytes: 256
using System;
using System.Linq;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();

            if (x[0] < x[1])
                Console.WriteLine("a < b");
            else if (x[0] > x[1])
                Console.WriteLine("a > b");
            else
                Console.WriteLine("a == b");
        }
    }
}



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

using namespace std;

int main(){

	int n,ans=0;
	cin>>n;
	vector<int>a(n),b(n),c(n-1);
	for(int i=0;i<n;++i) cin>>a[i];
	for(int i=0;i<n;++i) cin>>b[i];
	for(int i=0;i<n-1;++i) cin>>c[i];
	for(int i=0;i<n;++i){
		ans+=b[a[i]-1];
		if(i){
			if(a[i]-a[i-1]==1)
				ans+=c[a[i-1]-1];

		}

	}
	cout<<ans<<endl;
	return 0;
}	



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

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define int long long
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)


int32_t main()
{
	fastio;
	int a, b , c;
	cin >> a >> b >> c;
	int sum = a+b+c;
	if(sum>=22)
		cout << "bust" << endl;
	else
		cout << "win" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <limits>

using namespace std;

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

    int ans = numeric_limits<int>::max();
    for (int bit = 0; bit < 1 << 3; ++bit) {
        int cnt = 0, tx = x, ty = y;
        if (bit & (1 << 1)) {
            tx *= -1;
            ++cnt;
        }
        if (bit & (1)) {
            ty *= -1;
            ++cnt;
        }
        cnt += ty - tx;
        if (cnt < 0)continue;
        ans = min(ans, cnt);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
while True:
     H,W=map(int,input().split())
     3<=H<=300
     3<=W<=300
     if H==0&W==0:
          break
     print("#"*W)
     for i in range(1,H-1):
          print("#",end="")
          print("."*(W-2),end="")
          print("#")
     print("#"*W)
     print()


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

int main() {
    int x1;
    int nIndex;
    for(int i=1; i<=5; i++) {
        scanf("%d", &x1);
        if(x1 == 0) {
            nIndex = i;
        }
    }
    printf("%d\n", nIndex);
    return 0;
}

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

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define forn(i,n) for(ll i=0;i<n;i++)
#define fore(i,a,b) for(ll i=a;i<=b;i++)
#define ford(i,n) for(ll i=n-1;i>=0;i--)
#define fi first
#define se second
#define endl "\n"
#define all(a) a.begin(),a.end()
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PI 3.14159265

/*************************************************************************************/
void file(){
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
}
/*************************************************************************************/

const ll nax=2e5+1,mod=1e9+7;



int main(){

    sync
   // file();
    ll a,b;
    cin>>a>>b;
    if((b-a)%2){
        cout<<"IMPOSSIBLE";
    }
    else{
        cout<<(a+b)/2;
    }

  return 0;
}

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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	if (c <= b) {
		cout << b+c;
		return 0;
	}
	int ans = b+b;
	ans += min(c-b, a) + bool(c-b>a);
	cout << ans;
	return 0;
}

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

using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(int a, int b) {
  long x;
  if (b == 100)
    x = 1000 * a + b;
  else if (b / 10 > 0)
    x = 100 * a + b;
  else
    x = 10 * a + b;

  int y = sqrt(x);

  cout << ((y * y == x) ? YES : NO) << endl;
}

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

  int a, b;
  cin >> a >> b;
  solve(a, b);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    int x[N], y[N], h[N];
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> h[i];
    }

    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            int H = 0;
            for (int i = 0; i < N; i++) {
                if (h[i] == 0) continue;
                ll t = abs(x[i] - cx) + abs(y[i] - cy);
                if (H == 0) {
                    H = t + h[i];
                } else if(H != t + h[i]){
                    H = 0;
                    break;
                }
            }
            if (H == 0) continue;
            bool flag = true;
            for (int i = 0; i < N; i++) {
                if (h[i] != max(H - abs(x[i] - cx) - abs(y[i] - cy), 0)) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                cout << cx << " " << cy << " " << H << "\n";
                return 0;
            }
            
        }
    }

    return 0;
}

Measured memory_bytes: 3584
#include<stdio.h>
typedef struct{
  double x[2];
  double d;
  int xy:2; //x:0 y:1
}line;

int overlap(line l1,line l2){
  if(l1.xy==l2.xy){
    if(l1.x[(l1.xy+1)%2]!=l2.x[(l1.xy+1)%2])
      return 0;
    if(l1.x[l1.xy]<=l2.x[l1.xy]&&(l1.x[l1.xy]+l1.d)>=l2.x[l1.xy]
       ||l2.x[l2.xy]<=l1.x[l1.xy]&&(l2.x[l1.xy]+l2.d)>=l1.x[l1.xy])
      return 1;
    return 0;
  }else{
    if(l2.x[l2.xy]<=l1.x[l2.xy]&&(l2.x[l2.xy]+l2.d)>=l1.x[l2.xy]
       &&l1.x[l1.xy]<=l2.x[l1.xy]&&(l1.x[l1.xy]+l1.d)>=l2.x[l1.xy])
      return 1;
    else
      return 0;
  }
}
int main(){
  int i,j;
  double xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2,dy,dx;
  //0:xsita 1:yhidari 2:ymigi 3:xue
  line rec1[4],rec2[4];
  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
	      &xa1,&ya1,&xa2,&ya2,&xb1,&yb1,&xb2,&yb2)!=EOF){
    dx=xa2-xa1;
    dy=ya2-ya1;
    rec1[0].x[0]=xa1;
    rec1[0].x[1]=ya1;
    rec1[0].d=dy;
    rec1[0].xy=0;

    rec1[1].x[0]=xa1;
    rec1[1].x[1]=ya1;
    rec1[1].d=dy;
    rec1[1].xy=1;

    rec1[2].x[0]=xa2;
    rec1[2].x[1]=ya1;
    rec1[2].d=dy;
    rec1[2].xy=1;

    rec1[3].x[0]=xa1;
    rec1[3].x[1]=ya2;
    rec1[3].d=dx;
    rec1[3].xy=0;
    //a
    dx=xb2-xb1;
    dy=yb2-yb1;
    rec2[0].x[0]=xb1;
    rec2[0].x[1]=yb1;
    rec2[0].d=dx;
    rec2[0].xy=0;

    rec2[1].x[0]=xb1;
    rec2[1].x[1]=yb1;
    rec2[1].d=dy;
    rec2[1].xy=1;

    rec2[2].x[0]=xb2;
    rec2[2].x[1]=yb1;
    rec2[2].d=dy;
    rec2[2].xy=1;

    rec2[3].x[0]=xb1;
    rec2[3].x[1]=yb2;
    rec2[3].d=dx;
    rec2[3].xy=0;
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(overlap(rec1[i],rec2[j])){
	  printf("YES\n");
	  goto find;
	}
      }
    }
    if((xa1<xb1&&xa2>xb2&&ya1<yb1&&ya2>yb2)||
       (xb1<xa1&&xb2>xa2&&yb1<ya1&&yb2>ya2)){
      printf("YES\n");
      goto find;
    }
    printf("NO\n");
  find:;
  }
  return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <algorithm>

int main()
{
  long long n, a, b;
  scanf("%lld%lld%lld", &n, &a, &b);
  long long ans1 = (b - a) & 1 ? 4000000000000000000 : (b - a) / 2;
  long long ans2 = (a - 1) + 1 + (b - a) / 2;
  long long ans3 = (n - b) + 1 + (b - a) / 2;
  printf("%lld\n", std::min(std::min(std::min(ans1, ans2), ans3), std::min(b - 1, n - a)));
  return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

void dfs(int r, int c, vector<string>& b, vector<vector<int>>& seen)
{
  char ch = b[r][c];
  int n = b.size();
  seen[r][c] = 1;
  for (int dr = -1; dr <= 1; ++dr) {
    for (int dc = -1; dc <= 1; ++dc) {
      if (abs(dr) + abs(dc) != 1) { continue; }
      int nr = r + dr, nc = c + dc;
      if (0 <= nr and nr < n and 0 <= nc and nc < n and
          (not seen[nr][nc]) and b[nr][nc] == ch) {
        dfs(nr, nc, b, seen);
      }
    }
  }
  return;
}

void check(vector<string> b)
{
  int n = b.size();
  int black = 0, white = 0;
  vector<vector<int>> seen(n, vector<int>(n, 0));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (not seen[i][j]) {
        if (b[i][j] == '.') { ++white; }
        else { ++black; }
        dfs(i, j, b, seen);
      }
    }
  }
  // fprintf(stderr, "DEBUG: white=%d, black=%d\n", white, black);
}

int main()
{
  int A, B; scanf("%d %d", &A, &B);
  int N = 100;
  vector<string> ans(N, string(N, '#'));
  for (int i = 0; i < N / 2; ++i) {
    ans[i] = string(N, '.');
  }

  int cnt = 1;
  for (int i = 0; cnt < B and i < N / 2; i += 2) {
    for (int j = 0; cnt < B and j < N; j += 2) {
      ans[i][j] = '#';
      if (++cnt == B) { break; }
    }
    if (cnt == B) { break; }
  }
  cnt = 1;
  for (int i = N / 2 + 1; i < N and cnt < A; i += 2) {
    for (int j = 0; j < N and cnt < A; j += 2) {
      ans[i][j] = '.';
      if (++cnt == A) { break; }
    }
    if (cnt == A) { break; }
  }

  // check(ans);
  printf("%d %d\n", N, N);
  for (int i = 0; i < N; ++i) {
    printf("%s\n", ans[i].c_str());
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define moot 1000000007
 
using namespace std;
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
    int K;
    string S;
    cin>>K;
  	cin>>S;
  	if(S.size() <= K)
    {
      for(int i=0;i<S.size();i++)
        cout<<S[i];
    }
  	else
    {
      for(int i=0;i<K;i++)
      {
        cout<<S[i];
      }
      cout<<"...";
    }
    
  return 0;  
}

Measured memory_bytes: 3652
import java.util.*;


class Main{
    public static int biFind(int[] target , String con , int cri){
        //return the first index if found, -1 if not found, -2 if error
        int k = target.length -1;
        int nope = 0;
        int mid = k + (k-nope)/2+1;
        if(con.equals("<")){
            if(target[k]>=cri){
                return -1;
            }else if(target[0]<cri){
                return 0;
            }
            while(nope<k-1){
                mid = nope + (k-nope)/2;
                if(target[mid]<cri){
                    k = mid;
                }else{
                    nope = mid;
                }
            }
            return k;
        }else if(con.equals("<=")){
            if(target[k]>cri){
                return -1;
            }else if(target[0]<=cri){
                return 0;
            }
            while(nope>k){
                mid = k + (k-nope)/2+1;
                if(target[mid]<=cri){
                    k = mid;
                }else{
                    nope = mid;
                }
            }
            return k;
        }else{
            return -2;
        }
    }


    //ans
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
      int i = sc.nextInt();
      System.out.println(1-i);
    }
}

Measured memory_bytes: 27076
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int n = sc.nextInt();
		int r = sc.nextInt();
		int c = sc.nextInt();
		char[] sArr = sc.next().toCharArray();
		char[] tArr = sc.next().toCharArray();
		int left = 1;
		int right = w;
		int up = 1;
		int down = h;
		boolean alive = true;
		for (int i = n - 1; i >= 0; i--) {
			switch (tArr[i]) {
				case 'L':
				right = Math.min(w, right + 1);
				break;
				case 'R':
				left = Math.max(1, left - 1);
				break;
				case 'U':
				down = Math.min(h, down + 1);
				break;
				case 'D':
				up = Math.max(1, up - 1);
				break;
			}
			switch (sArr[i]) {
				case 'L':
				left++;
				break;
				case 'R':
				right--;
				break;
				case 'U':
				up++;
				break;
				case 'D':
				down--;
				break;
			}
			if (left > right || up > down) {
				alive = false;
				break;
			}
		}
		if (alive && r >= up && r <= down && c >= left && c <= right) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 28896
//Dragon_warrior7(IITK)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define deb(x) cout << #x << " " << x << "\n"
#define pll pair<ll, ll> 
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}

void print(vector<ll> v)
{
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
}
ll n,m,a,b,temp,x,y;
string str;
set<ll> s;
ll rec(ll n)
{
    if(n==1)
    return 1;
    if(n==2)
    return 3;
    if(n==0)
    return 0;
    return 2*rec(n/2)+1;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	cout<<rec(n);
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <math.h>

int calc_dis(int k, int n, int points[]);
int main(void);

int calc_dis(int k, int n, int points[]){
    int i, max_cost, dis;
    max_cost, dis = 0;
    int costs[n];
    for(i=0; i<n-1; i++){
      costs[i] = points[i+1] - points[i];
    }
    costs[n-1] = points[0] + (k-points[n-1]);
    for(i=0; i<n; i++){
       dis += costs[i];
       if(costs[i]>max_cost)
          max_cost = costs[i];
    }
    dis -= max_cost;
    return dis;
}

int main(void){
   int k, n, i, dis;
   scanf("%d %d", &k, &n);
   int points[n];
   for(i=0; i<n; i++){
      scanf("%d", &points[i]);
   }
   dis = calc_dis(k, n, points);
   printf("%d", dis);
   return 0;
}


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

char c, cp;
bool f;

int main(){
    f = true;
    for (int i = 0; i < 3; ++i){
        cin >> c;
        if (i > 0){
            f &= (c == cp);
        }
        cp = c;
    }
    cout << (f ? "No" : "Yes");
}

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

int main() {
   int N;
   cin >> N;
   string S = "";
   if( N == 0 ) S = "0";
   while (N != 0) {
     if(N > 0){
       if(N%2 == 1){
          S = "1" + S;
          N = 0 - N / 2;
       }
       else{
          S = "0" + S;
          N = 0 - N / 2;
       } 
     }
     else if(N < 0){
       N = 0 - N;
       if(N%2 == 1){
          S = "1" + S;
          N = N / 2 + 1;
       }
       else{
          S = "0" + S;
          N = N / 2;
       } 
     }
   }
   cout << S << endl;

}


Measured memory_bytes: 3592
N,A,B,C,D = map(lambda x:int(x)-1,input().split())
S = input()

possible = True
if '##' in S[A:C] or '##' in S[B:D]:
    possible = False
if D < C:
    if '...' not in S[B-1:D+2]:
        possible = False

if possible:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 41072
L,R = [int(x) for x in input().split()]
tmp1 = int(L/2019)
tmp2 = int(R/2019)
diff = tmp2 - tmp1
if diff >= 1:
    print(0)
else:
    tmp3 = 0
    Min = 2018
    for i in range(L%2019,R%2019):
        for j in range(i,R%2019):
            tmp3 = (i*(j+1))%2019
            if Min > tmp3:
                Min = tmp3
    print(Min)

Measured memory_bytes: 3064
N, K = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)

ans = 10 ** 20
for i in 0..(xs.size - K) do
  ans = [ans, xs[i].abs + (xs[i] - xs[i+K-1]).abs, xs[i+K-1].abs + (xs[i] - xs[i+K-1]).abs].min
end

puts ans

Measured memory_bytes: 11012
S = input()
 
MOD = 10 ** 9 + 7
N = 13
 
DP = [0] * N
 
# 初期値
DP[0] = 1
digit = 1
 
# 0 -> 5 -> ?5 -> ??5 -> ...に対する余りがどこになるかを更新していく
for i in range(len(S) - 1, -1, -1):
    nextDP = [0] * N
 
    if S[i] == "?":
        for k in range(10):
            for j in range(N):
                nextDP[(k * digit + j) % N] += DP[j]
                nextDP[(k * digit + j) % N] %= MOD
    else:
        k = int(S[i])
        for j in range(N):
            nextDP[(k * digit + j) % N] += DP[j]
            nextDP[(k * digit + j) % N] %= MOD
 
    digit *= 10
    digit %= N
    DP = nextDP[:]
 
print(DP[5])
 
"""
??2??5

"""

Measured memory_bytes: 43500
Program ABC118B

integer n,m,i,j,l,count,x,y
integer k(30),a(30,30)

read(*,*) n,m

do i=1,n
read(*,*) k(i),(a(i,j),j=1,k(i))
end do

count=0

do l=1,k(1)
x=2
do i=2,n
 y=1
 do j=1,k(i)
  if (a(1,l)==a(x,y)) then
   x=x+1
   go to 10
  else
   y=y+1
  end if
 end do
 go to 100
10 end do
count=count+1
100 end do

write(*,*) count

stop
end

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll x;

signed main() {
    cin >> x;
    ll ans = (x / 11) * 2;
    if(x % 11 > 6)
        ans += 2;
    else if(x % 11)
        ans++;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define sp fixed<<setprecision
#define sz sizeof
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod2=998244353;
ll fpow(ll x,ll y,ll p=MOD){x=x%p;ll sum=1;while(y){if(y&1)sum=sum*x;sum%=p;y=y>>1;x=x*x;x%=p;}return sum;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
ll spf[10005];
void sieve()
{
  for(int i=1;i<10005;i++)
  spf[i]=i;
  for(int i=2;i*i<=10005;i++)
  if(spf[i]==i)
  for(int j=2*i;j<10005;j+=i)
  spf[j]=min(spf[j],(ll)(i));
}

int main(){
   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   ll n,k;
   cin>>n>>k;
   vector<ll>v(n);
   for(int i=0;i<n;i++)
    cin>>v[i];
   ll lo=1;
   ll hi=*max_element(all(v)),res=hi,mid;
   while(lo<=hi){
     mid=(lo+hi)/2LL;
     ll sum=0;
     for(int i=0;i<n;i++){
       if(v[i]%mid==0)
        sum+=(floor(v[i]/mid)-1);
      else
        sum+=floor(v[i]/mid);
     }
     if(sum<=k){
      res=min(res,mid);
      hi=mid-1;}
    else
      lo=mid+1;
   }
   cout<<res;
}


Measured memory_bytes: 4712
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;

	while (cin >> n, n != -1)
	{
		string ans;
		int keta;

		while (true)
		{
			keta = n % 4;
			n /= 4;

			ans = (char)(keta + '0') + ans;

			if (n == 0)
			{
				cout << ans << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 1196
#include <stdio.h>
#define MAX 10000

int parent(int i){
  return i/2;
}
int left(int i){
  return i*2;
}
int right(int i){
  return i*2+1;
}

int main(){
  int A[MAX+1];
  int H,k;
  scanf("%d",&H);
  for(k=1;k<=H;k++){
    scanf("%d",&A[k]);
  }
  for(k=1;k<=H;k++){
    printf("node %d: key = %d, ",k,A[k]);
    if(parent(k)>=1)printf("parent key = %d, ",A[parent(k)]);
    if(left(k)<=H)printf("left key = %d, ",A[left(k)]);
    if(right(k)<=H)printf("right key = %d, ",A[right(k)]);
    printf("\n");
           }
      return 0;
  }



Measured memory_bytes: 2044
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
    int A, B;
    cin >> A >> B;

    if (A > 9 || B > 9) {
        cout << -1 << endl;

        return 0;
    }

    cout << A * B << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
     int n, num, digit, rev = 0;
    scanf("%d",&num);
     n = num;
     do
     {
         digit = num % 10;
         rev = (rev * 10) + digit;
         num = num / 10;
     } while (num != 0);
    
     if (n == rev)
         printf("Yes");
     else
       printf(" No");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
long long int mod=1e9+7;
int main(){
	int z,a;
	cin>>z>>a;
	if(z<a){
		for(int i=0;i<a;i++)
		cout<<z;
		}
	else{
		for(int i=0;i<z;i++)
		cout<<a;
		}
	
}
		


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;

const int N=30;
int a[N],b[N],c[N];

int main()
{
	int n;
	cin>>n;
	
	long long sum=0;
	for(int i=0; i<n; i++) cin>>a[i];
	for(int i=0; i<n; i++)
	{
		cin>>b[i];
		sum+=b[i];
	}
	
//	cout<<sum<<endl;
	for(int i=0; i<n-1; i++) cin>>c[i];
	
	int k=0;
	for(int i=0; i<n-1; i++)
		if(a[i+1]-a[i]==1)
		{
			sum+=c[a[i]-1];
//			cout<<c[k-1];
		}
			
	
	cout<<sum<<endl;
	
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  int c = 0;
  if(s[0] == 'o') c++;
  if(s[1] == 'o') c++;
  if(s[2] == 'o') c++;
  cout << 700 + 100 *c;
 
  return 0;
}
  


Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
#include <set>
#include <vector>

using namespace std;

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

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

int main() {
  int64_t N, M;
  cin >> N >> M;

  set<int64_t> s;
  for (int64_t n = 0; n < N; ++n) {
    int64_t num;
    cin >> num; num /= 2;
    s.insert(num);
  }
  vector<int64_t> nums(s.begin(), s.end());
  {
    int64_t div2 = 0;
    for (int64_t n = 0, size = nums.size(); n < size; ++n) {
      int64_t num = nums[n];
      int64_t cnt = 0;
      while (num % 2 == 0) {
        ++cnt; num /= 2;
      }
      if (n != 0) {
        if (cnt != div2) {
          cout << 0 << endl; return 0;
        }
      } else {
        div2 = cnt;
      }
    }
  }
  int64_t lcm = 1;
  for (int64_t num : nums) {
    lcm = LCM(num, lcm);
  }
  int64_t res = M / lcm;
  if (res % 2) ++res;
  cout << res / 2 << endl;

  return 0;
}


Measured memory_bytes: 3624
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(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 debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

const string MINUSINF = "-";
const int cost[10] = { 2, 5, 5, 4, 5, 6, 3, 7, 6 };
void chmax(string &a, string b) {
    if (a == MINUSINF) a = b;
    else if (a.size() < b.size()) a = b;
    else if (a.size() == b.size()) {
        if (a < b) a = b;
    }
}


int main() {
    int n, m; cin >> n >> m;
    vector<int> a(m);
    rep(i, m) {
        cin >> a[i];
    }
    vector<string> dp(11000, MINUSINF);
    dp[0] = "";

    rep(i, n + 1) {
        if (dp[i] == MINUSINF) continue;

        for (auto x : a) {
            chmax(dp[i + cost[x - 1]], dp[i] + (char)('0' + x));

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


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

int main() {
    unordered_set<string> s;
    int n;
    string str;
    cin >> n;
    for(int i=0;i<n;i++) {
        cin >> str;
        s.insert(str);
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 17728
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <stdio.h>
#include <bitset>
#include<math.h>
#include<list>
#include<map>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
#define PI 3.14159265358979323846  
typedef pair<int, int> P;



int main() {
	ll n;
	string ans;
	cin >> n;
	
	while (n > 0) {
		n--;
		ans += 'a' + n % 26;
		n /= 26;
	}
	//for (int i = 0; i < 99; i++) {
	//	if (n <= pow(26, i)) {
	//		//n -= 1;
	//		for (int j = 0; j < i; j++) {
	//			ans += 'a' + n % 26;
	//			n /= 26;
	//		}
	//		break;
	//	}
	//	else {
	//		n -= pow(26, i);
	//	}
	//}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;

}


Measured memory_bytes: 3632
a, b, c = map(int, input().split())
if a == b == c:
    if a % 2:
        print(0)
    else:
        print(-1)
else:
    ans = 0
    while a % 2 == b % 2 == c % 2 == 0:
        ans += 1
        a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2
    print(ans)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;
constexpr auto INF = INT_MAX >> 1;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {
	
	int n, d;
	cin >> n >> d;
	int k = 0, ans = 0;
	while (n > k) {
		k++;
		ans++;
		k += 2 * d;
	}
	
	cout << ans << endl;

}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)

int main(){
	//input
	ll A,B; cin>>A>>B;

	//solve
	char f[101][101];
	rep1(i,50){
		rep1(j,100) f[i][j]='#';
	}
	FOR(i,51,101){
		rep1(j,100) f[i][j]='.';
	}

	ll r=(A-1)/50,c=(A-1)%50;
	rep(i,r)rep(j,50) f[i*2+1][j*2+1]='.';
	rep(i,c) f[r*2+1][i*2+1]='.';
	
	r=(B-1)/50,c=(B-1)%50;
	rep(i,r)rep(j,50) f[52+i*2][j*2+1]='#';
	rep(i,c) f[52+r*2][i*2+1]='#';

	//output
	cout<<100<<" "<<100<<endl;
	rep1(i,100){
		rep1(j,100) cout<<f[i][j];
		cout<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M 100005
struct D{
	int t,c,d;
};
struct W{
	int id,c,d,p;
};
vector<D>edge[M];
vector<W>Q[M];
int n,F[M][20],q,dep[M],ans[M],cn[M],cd[M],dis[M];
void dfs(int x,int f,int d){
	F[x][0]=f,dep[x]=dep[f]+1,dis[x]=d;
	for(int i=0;i<edge[x].size();i++){
		int y=edge[x][i].t;
		if(y==f)continue;
		dfs(y,x,d+edge[x][i].d);
	}
}
void up(int &x,int step){
	for(int i=0;i<20;i++)
		if(step&(1<<i))x=F[x][i];
}
int lca(int a,int b){
	if(dep[a]>dep[b])swap(a,b);
	up(b,dep[b]-dep[a]);
	if(a==b)return a;
	for(int i=19;i>=0;i--)
		if(F[a][i]!=F[b][i])a=F[a][i],b=F[b][i];
	return F[a][0];
}
void DFS(int x,int f){
	for(int i=0;i<Q[x].size();i++)ans[Q[x][i].id]+=Q[x][i].p*(dis[x]-cd[Q[x][i].c]+cn[Q[x][i].c]*Q[x][i].d);
	for(int i=0;i<edge[x].size();i++){
		int y=edge[x][i].t;
		if(y==f)continue;
		cn[edge[x][i].c]++;
		cd[edge[x][i].c]+=edge[x][i].d;
		DFS(y,x);
		cn[edge[x][i].c]--;
		cd[edge[x][i].c]-=edge[x][i].d;
	}
}
int main(){
	scanf("%d%d",&n,&q);
	for(int i=1,a,b,c,d;i<n;i++){
		scanf("%d%d%d%d",&a,&b,&c,&d);
		edge[a].push_back((D){b,c,d});
		edge[b].push_back((D){a,c,d});
	}
	dfs(1,0,0);
	for(int i=1;i<=19;i++)
		for(int j=1;j<=n;j++)F[j][i]=F[F[j][i-1]][i-1];
	for(int i=1;i<=q;i++){
		int u,v,c,d;
		scanf("%d%d%d%d",&c,&d,&u,&v);
		Q[lca(u,v)].push_back((W){i,c,d,-2});
		Q[u].push_back((W){i,c,d,1});
		Q[v].push_back((W){i,c,d,1});
	}
	DFS(1,0);
	for(int i=1;i<=q;i++)printf("%d\n",ans[i]);
	return 0;
}

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

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

void print(){ std::cout << std::endl; }
template <typename H> void print(H head) { std::cout << head << std::endl; }
template <typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N, M;
  M = 5;
  std::cin >> N;
  std::vector< ll > va(M, 0LL);
  for (ll i = 0; i < M; i++) {
    std::cin >> va[i];
  }

  ll min_val = *std::min_element(va.begin(), va.end());
  ll ans = M - 1 + (N + min_val - 1) / min_val;

  print(ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        String s = sc.next();

        if (n >= 3200) {
            System.out.println(s);
        } else {
            System.out.println("red");
        }
    }
}

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

int main(){
    int h, n;
    int a[100000];
    int cnt = 0;
    cin >> h >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        cnt += a[i];
    }
    if(cnt >= h) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 640
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	int n,x=0,m=0;
	cin>>n;
	string s;
	cin>>s;
	for0(i,n){
		if(s[i]=='I') x++;
		else x--;
		m = max(m,x);
		}
	cout<<m<<nw;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N), B(N-1);
  for (int i=0; i<N-1; i++) {
    cin >> B.at(i);
  }
  for (int i=0; i<N; i++) {
    if (i == 0) {
      A.at(i) = B.at(i);
    }
    else if (i == N-1) {
      A.at(i) = B.at(i-1);
    }
    else {
      A.at(i) = min(B.at(i-1), B.at(i));
    }
  }
  int answer = 0;
  for (int i=0; i<N; i++) {
    answer += A.at(i);
  }
  cout << answer << endl;
}

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

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define PB push_back

const ll LLINF = (1LL << 60);
const int INF = (1LL << 30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> T ceil(T a, T b) { return a / b + !!(a%b); }
template<class S, class T>
ostream &operator <<(ostream& out, const pair<S, T>& a) {
	out << '(' << a.first << ',' << a.second << ')';
	return out;
}
template<class T>
ostream &operator <<(ostream& out, const vector<T>& a) {
	out << '[';
	REP(i, a.size()) { out << a[i]; if (i != a.size() - 1)out << ','; }
	out << ']';
	return out;
}

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

signed main(void) {
	int n;
	cin >> n;

	// #define DEBUG
	VI ans = { 1, 2, 1, 2, 1, 0, 2, 1, 2 };
	auto query = [&](int mid) -> int {
		#ifdef DEBUG
				cout << mid << "," << ans[mid] << endl;
				if (ans[mid] == 0) exit(0);
				return ans[mid];
		#else
				cout << mid << endl;
				string res;
				cin >> res;
				if (res == "Vacant") {
					cerr << "end" << endl;
					exit(0);
				}
				else if (res == "Male") return 1;
				else if (res == "Female") return 2;
				else exit(-1);
		#endif
	};
	
	VI d(n);
	// [lb, ub) 
	int lb = 1, ub = n;
	auto check = [&](int mid) -> bool {
		d[mid] = query(mid);
		int len1 = mid - lb, len2 = ub - mid - 1;
		if (len1 % 2) {
			if (d[lb-1] == d[mid]) return true;
			return false;
		}
		else {
			if (d[lb-1] == d[mid]) return false;
			return true;
		}
	};

	// 席0についてクエリ
	d[0] = query(0);

	while (ub - lb > 1) {
		int mid = (ub + lb) / 2;
		// cout << lb << "," << mid << "," << ub << endl;
		if (check(mid)) {
			lb = mid + 1;
		}
		else {
			ub = mid;
		}
	}

	query(lb);
	
	return 0;
}

Measured memory_bytes: 1620
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////

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

	vector<pair<ll, ll>> p(N + 1);
	repn(i, N) cin >> p[i].first >> p[i].second;
	sort(++p.begin(), p.end());

	vector<ll> L(N + 1), R(N + 1);
	repn(i, N) {
		L[i] = p[i].first;
		R[i] = p[i].second;
	}

	ll rn = 1;
	repn(i, N) {
		if (R[rn] >= R[i]) { rn = i; }
	}

	vector<ll> Rn(N + 1);
	Rn[N] = R[N];
	for (ll i = N - 1; i >= 1; i--)Rn[i] = min(Rn[i + 1], R[i]);

	ll ans = 0;
	for (ll i = rn; i < N; i++) {
		ll one = max(0, R[rn] - L[i] + 1);
		ll two = max(0, Rn[i + 1] - L[N] + 1);
		ans = max(one + two, ans);
	}

	ll longest = 0;
	repn(i, N - 1) {
		if (i == rn) { continue; }
		longest = max(longest, R[i] - L[i] + 1);
	}

	ll one = max(0, R[rn] - L[N] + 1);
	ans = max(ans, longest + one);

	cout << ans << endl;
	
	system("PAUSE");

}

Measured memory_bytes: 4352
{-# LANGUAGE OverloadedStrings #-}

import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    c <- sum . map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    if c >= 10 then B.putStrLn "error" else print c


Measured memory_bytes: 380