akhauriyash/Code-Regression huggingface dataset:
/*Lucky_Glass*/
#include<bits/stdc++.h>
using namespace std;

const int N=2e5;

int n;
long long k;
int A[N+3],F[N+3];

bool Check(long long scr){
    long long req=0;
    // printf("# %lld\n",scr);
    for(int i=1;i<=n;i++){
        // printf(" - %lld\n",F[i]-scr/A[i]);
        req+=max(0ll,F[i]-scr/A[i]);
    }
    // printf("- %lld %lld\n",scr,req);
    return req<=k;
}
bool cmpBIG(int a,int b){return a>b;}
int main(){
    scanf("%d%lld",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&F[i]);
    for(int i=1;i<=n;i++) scanf("%d",&A[i]);
    sort(A+1,A+1+n);
    sort(F+1,F+1+n,cmpBIG);
    long long ansl=0,ansr=0;
    for(int i=1;i<=n;i++) ansr=max(ansr,1ll*A[i]*F[i]);
    while(ansl+1<ansr){
        long long ansm=(ansl+ansr)>>1;
        if(Check(ansm)) ansr=ansm;
        else ansl=ansm;
    }
    if(Check(ansl)) printf("%lld\n",ansl);
    else printf("%lld\n",ansr);
    return 0;
}
/*
1 1 2 3 3 4 5 5 5 6 9
9 9 8 8 7 6 4 3 3 2 2
9 9 7 7 6 3 2 2 2 2 1

9 9 16 24 21 24 20 15 15 12 18

1 2 4
3 2 1
3 4 4

*/


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define LL long long
#define P pair<int,int>
#define P2 pair<LL,int>
#define ls(i) seg[i].lc
#define rs(i) seg[i].rc
using namespace std;
const int N = 18;
const int mod = 1e9 + 7;

int main()
{

    int a , b , c;
    cin>>a>>b>>c;
    int ans = a * 100 + b* 10 +c;
    if(ans % 4 == 0) puts("YES");
    else puts("NO");
    return 0;
}



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

int main(int argc, char *argv[])
{
	int i;
    int N;
	int dup = 0;
	int count = 0;
	cin >> N;

	int a[N];

	for (i = 0; i < N; i++) {
		cin >> a[i];
	}

	for (i = 0; i < N - 1; i++) {
		if (a[i] == a[i + 1]) {
			count++;
			i++;
		}
	}

	cout << count << "\n";
	
	return 0;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s,t;cin >> s >> t;
	int n=s.size(),m=t.size();
	vector<vector<int>> dp(n+1,vector<int>(m+1));
	vector<vector<int>> memo(n+1,vector<int>(m+1));
	rep(i,n){
		rep(j,m){
			if(s[i]==t[j]){
				dp[i+1][j+1]=dp[i][j]+1;
				memo[i+1][j+1]=1;
			}
			else{
				if(dp[i+1][j]>dp[i][j+1]){
					dp[i+1][j+1]=dp[i+1][j];
					memo[i+1][j+1]=2;
				}
				else{
					dp[i+1][j+1]=dp[i][j+1];
					memo[i+1][j+1]=3;
				}
			}
		}
	}
	string ans="";
	int i=n,j=m;
	while(i>=1 && j>=1){
		if(memo[i][j]==1){
			ans+=s[i-1];
			i--;
			j--;
		}
		else if(memo[i][j]==2) j--;
		else i--;
	}
	reverse(ans.begin(),ans.end());
	cout << ans << endl;
}

Measured memory_bytes: 70912
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 
using namespace std;
int main()
{
    int p,q,r;
    while (~scanf("%d %d %d", &p, &q, &r)) {
        printf("%d\n", p+q+r-max(p,max(q,r)));
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

int main(void){
  int k,x;
  cin>>k>>x;

  if(k*500>=x)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
  return 0;
}

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

int main(void) {
	int A, B, C;
	scanf("%d%d%d", &A, &B, &C);
	if (A <= C && C <= B) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}


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

namespace p1
{
    class Program
    {

        static void Main(string[] args)
        {
            long a, b, c, d;
            var input = Console.ReadLine();
            var l = input.Split(" ").Select(s => long.Parse(s)).ToList();
            a = l[0];
            b = l[1];
            c = l[2];
            d = l[3];

            Console.WriteLine(F(b, c, d) - F(a-1, c, d));
        }

        static long Gcd(long x, long y){
            if(y > x) return Gcd(y, x);
            while(y != 0){
                var tmp = x % y;
                x = y;
                y = tmp;
            }
            return x;
        }
        static long Dev(long x, long y){
            return x / y;
        }

        public static long Lcm(long a, long b) {
            return a * b / Gcd(a, b);
        }

        static long F(long x, long y, long z){
            return x - (Dev(x, y) + Dev(x, z) - Dev(x, Lcm(y, z)));
        }
    }
}

Measured memory_bytes: 28236
object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val p = readLine().split(" ").map(_.toInt)
  var nn = p(0)
  var ans = 0
  for(i <- p){
    if(nn >= i){
      ans += 1
      nn = i
    }
  }
  println(ans)
}

Measured memory_bytes: 75020
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "Yes" : "No";
}

int abs(int x){
    return x >= 0 ? x : -x;
}

class Dice{
    private:
    int surfaceNumber;
    int rightNumber;
    int frontNumber;
    int n[6];

    public:
    Dice(){
        rep(i,6) cin >> n[i];
        surfaceNumber = 1;
        frontNumber = 2;
        rightNumber = 3;
    }

    void printNumber(){
        cout << n[surfaceNumber-1] << endl;
    }

    void rotate(char s){
        int newNumber;

        switch(s){
            case 'S':
                newNumber = 7-frontNumber;
                frontNumber = surfaceNumber;
                surfaceNumber = newNumber;
                break;
            
            case 'N':
                newNumber = 7-surfaceNumber;
                surfaceNumber = frontNumber;
                frontNumber = newNumber;
                break;
            
            case 'E':
                newNumber = 7 - rightNumber;
                rightNumber = surfaceNumber;
                surfaceNumber = newNumber;
                break;

            case 'W':
                newNumber = 7 - surfaceNumber;
                surfaceNumber = rightNumber;
                rightNumber = newNumber;
                break;

            default:
                break;
        }

        //cout << surfaceNumber << " " << frontNumber << " " << rightNumber << endl;
    }

};

int main(){

    Dice dice;
    string s;

    cin >> s;

    rep(i,s.length()){
        dice.rotate(s[i]);
    }

    dice.printNumber();

    

}



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

using namespace std;

char s[1000];
int n;
int main()
{
	scanf("%s",s+1); n=strlen(s+1);
	if(s[1]!='A'){puts("WA"); return 0;}
	int fg=0; for(int i=3;i<n;i++)
		if(s[i]=='C') fg++;
	if(fg!=1){puts("WA"); return 0;}
	fg=0; for(int i=2;i<=n;i++)
		if(s[i]>='A'&&s[i]<='Z')
		{
			if(s[i]!='C'){puts("WA"); return 0;}
			else if(fg){puts("WA"); return 0;}
			else fg++;
		}
	puts("AC");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{

  int money,friend,price;

  scanf("%d %d %d",&money,&friend,&price);
 

  if(money-price >= 0) printf("0\n");
  if( (money-price) < 0 && friend >= -1*(money-price)) printf("%d\n",-1*(money-price));
  if(money-price < 0 && friend < -1*(money-price)) printf("NA\n");
						       
  return 0;

}

Measured memory_bytes: 1852
#include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF 2000000000
#define MAX 100001
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<int, int>
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d)<<endl;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(a)-1;i>=(b);--i)
#define ALL(a) (a).begin(),(a).end()

signed main(){ INIT
    VAR(int, k, t);
    VEC(int, a, t);
    
    int M = 0;
    REP(i, t) M = max(M, a[i]);
    OUTL(max(M - 1 - (k-M), 0));
RET;}

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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

ll x(ll a) {
    if (a % 4 == 0) return a;
    if (a % 4 == 1) return 1;
    if (a % 4 == 2) return a + 1;
    return 0;
}

signed main() {
    ll a, b;
    cin >> a >> b;
    cout << (x(b) ^ x(a - 1)) << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    if (N == 1) {
      System.out.println(1);
      return;
    }
    long Lpp = 2;
    long Lp = 1;
    long L = 0;
    int n = 2;
    while (n <= N) {
      L = Lpp + Lp;
      
      Lpp = Lp;
      Lp = L;
      n++;
    }
    System.out.println(L);
  }
}

Measured memory_bytes: 21716
/* ****devACE**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        int lo=0,hi=100000,mid=(lo+hi)/2,n,m;
        cin>>n>>m;
        if(m==1){
            cout<<0; return 0;
        }

        while(hi-lo>1){
            //cout<<"mid = "<<mid<<"\n";
            if((1+mid*n -mid)>=m)hi=mid;
            else lo=mid;
            mid=(lo+hi)/2;
        }

        cout<<hi;
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int maxn = 24;
int mark[maxn];
int mk[maxn];
int main(){
    int n;
    cin >> n;
    while(n--){
        int x; cin >> x;
        mark[x]++;
    }
    mark[0]++;
    // for(int e = 0; e < 13; e++) mark[e] = min(mark[e], 2);
    vector<int> val, good;
    for(int e = 0; e < 13; e++){
        if(mark[e] == 2) {
            if(e == 0){
                return ! printf("0\n");
            }
            good.push_back(e);
            good.push_back(24 - e);
        } else if(mark[e] == 1) val.push_back(e);
        else if(mark[e] > 2){
            return ! printf("0\n");
        }
    }
    int ans = 0;
    // for(int e : val) cerr << e << " "; cerr << endl;
    for(int e = 0; e < 1<<val.size(); e++){
        memset(mk, 0, sizeof(mk));
        // if(~e)
            for(int f = 0; f < val.size(); f++){
                if(e&(1<<f) &&  val[f] > 0) mk[24 - val[f]]++;
                else mk[val[f]]++;
            }
        for(int v : good) mk[v]++;
        int lst = -1, val = 25;
        for(int f = 0; f < maxn; f++){
            if(mk[f]){
                if(lst != -1){
                    int mt = f - lst;
                    val = min(val, min(mt, 24 - mt));
                }
                lst = f;
            }
        }
        for(int f = 0; f < maxn; f++) if(mk[f] > 1) val = 0;
        int fst = -1, bst = -1;
        for(int f = 0; f < maxn && fst == -1; f++) if(mk[f]) fst = f;
        for(int f = 0; f < maxn; f++) if(mk[f]) bst = f;
        for(int f = 0; f < maxn; f++){
            if(mk[f]){
                int fi = f - fst;
                int se = bst - f;
                fi = min(fi, 24 - fi);
                se = min(se, 24 - se);
                if(f != fst) val = min(val, fi);
                if(f != bst) val = min(val, se);
            }
        }
        if(val == 25) val = 0;
        ans = max(ans, val);
        //cerr << val << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
ans = 0
min_chk = 10**10
minus_chk = 0
for i in input().split():
    i = int(i)
    if i < 0 :
        minus_chk += 1
    num = abs(i)
    min_chk = min(num,min_chk)
    ans += num
if min_chk != 0:
    if minus_chk%2 == 1:
        print(ans-2*min_chk)
    else:
        print(ans)
else:
    print(ans)

Measured memory_bytes: 11516
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char s[11] = {0};
    scanf("%s", s);
    int len = 0, min = 753;
    while (s[len])
    {
        len++;
    }
    int i;
    for (i = 0; i < len - 2; i++)
    {

        if (abs(753 - (100 * (s[i] - '0') + 10 * (s[i + 1] - '0') + (s[i + 2] - '0'))) < min)
        {
            min = abs(753 - (100 * (s[i] - '0') + 10 * (s[i + 1] - '0') + (s[i + 2] - '0')));
        }
    }
    printf("%d\n", min);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define y1 aaaaaaaaaaaa
#pragma GCC optimize("O3")
#define gcd(a, b) ((!a || !b) ? (a || b) : __gcd(a, b))

using namespace std;

typedef long long ll;

mt19937 rnd(1);

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

void solve()
{
  int n, m;
  cin >> n >> m;
  vector <vector <int> > d(n, vector <int> (m, - 1));
  vector <pair <int, int> > e;
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < m; j++)
    {
      char c;
      cin >> c;
      if (c == '#')
        e.push_back({i, j});
    }
  }
  for (auto c : e) d[c.first][c.second] = 0;
  int ans = 0;
  for (int i = 0; i < (int) e.size(); i++)
  {
    int x = e[i].first, y = e[i].second;
    ans = max(ans, d[x][y]);
    for (int t = 0; t < 4; t++)
    {
      int gx = x + dx[t], gy = y + dy[t];
      if (0 <= gx && gx < n && 0 <= gy && gy < m && d[gx][gy] == -1)
      {
        d[gx][gy] = d[x][y] + 1;
        e.push_back({gx, gy});
      }
    }
  }
  cout << ans << endl;
}

int main()
{
#ifdef ONPC
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  solve();
}


Measured memory_bytes: 14188
from collections import deque
H,W = [int(hoge) for hoge in input().split()]
curh,curw = [int(hoge)-1 for hoge in input().split()]
gh,gw = [int(hoge)-1 for hoge in input().split()]
S = [input() for _ in range(H)]
#01BFS典型
Dist = [[999999 for w in range(W)] for h in range(H)]
Dist[curh][curw] = 0
BFS = deque()#取り出しは左からpopleft
BFS.append((curh,curw))
while BFS:
    curh,curw = BFS.popleft()
    for dx,dy in ((-1,0),(1,0),(0,-1),(0,1)):
        if 0<=curh+dx<H and 0<=curw+dy<W and S[curh+dx][curw+dy]==".":
            if Dist[curh+dx][curw+dy] > Dist[curh][curw]:
                Dist[curh+dx][curw+dy] = Dist[curh][curw]
                BFS.appendleft((curh+dx,curw+dy))

  

    for dx in range(-2,3):
        for dy in range(-2,3):
            if 0<=curh+dx<H and 0<=curw+dy<W and  S[curh+dx][curw+dy]==".":
                if Dist[curh+dx][curw+dy] > Dist[curh][curw] + 1:
                    Dist[curh+dx][curw+dy] = Dist[curh][curw]+1
                    BFS.append((curh+dx,curw+dy))
ans = Dist[gh][gw]
if ans == 999999:
    ans = -1
print(ans)

Measured memory_bytes: 92128
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;

int main()
{   
  int K;
  cin >> K;
  if (K % 2 == 0 || K % 5 == 0) {
    cout << -1 << endl;
    return 0;
  }
  int64 amari = 0;
  for (int i = 1; i <= K; i++) {
    amari = amari * 10 + 7;
    amari %= K;
    if (amari == 0) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}



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

int main(){
    int x;
    int ma=0;
    cin>>x;
    if(x<=3){
        cout << 1 << endl;
        return 0;
    }
    for(int i=2;i*i<=x;i++){
        int p=1;
        while(1){
            int num=pow(i,p);
            if(num>x) break;
            ma=max(ma,num);
            p++;
        }
    }
    cout << ma << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); ++i)
#define rep2(i, n) for(ll i = 1; i <= ll(n); ++i)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); ++i)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); ++i)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll h, cnt=1;
  cin >> h;
  
  while(h/=2) cnt++; 
  cout << (1LL<<cnt)-1 << newl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long ll;

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

int main() {

    ll N,L;
    cin >> N >> L;
    ll M = 300;
    ll min = 0;
    ll out = 0;
    rep(i,N) out += L+i;
    rep(i,N){
        if(abs(L+i)<M){
            M = abs(L+i);
            min = L+i;
        }
    }
    cout << out-min << endl;
    return 0;
}


Measured memory_bytes: 256
#def area###############################
def pr(s,a,b):
	print s[int(a):int(b)+1]

def rv(s,a,b):
	tmp=s[::-1]
	news=s[:int(a)]+tmp[len(tmp)-int(b)-1:len(tmp)-int(a)]+s[int(b)+1:]
	return news
def rp(s,a,b,p):
	news=s[:int(a)]+p+s[int(b)+1:]
	return news
########################################


I=raw_input()
n=int(input())
for i in range(n):
	k=raw_input().split(" ")
	if k[0]=="replace":
		I=rp(I,k[1],k[2],k[3])
	elif k[0]=="reverse":
		I=rv(I,k[1],k[2])
	elif k[0]=="print":
		pr(I,k[1],k[2])

Measured memory_bytes: 6472
N =int(input())
#S = list(map(str, input().split()))
H = list(map(int, input().split()))
ans='Yes'
if N==1:
    print('Yes')
elif N<2:
    if H[0]>H[1]+1:
        print('No')
    else:
        print('Yes')
else:
    count=0
    for i in range(len(H)-1):
        if H[i]>H[i+1]:
            count+=H[i]-H[i+1]
            if count>=2:
                ans='No'
                break
        elif H[i]<H[i+1]:
            count=0
        else:
            continue
    print(ans)

Measured memory_bytes: 14224
#include <stdio.h>

int main(void) {

	int i;
	int a,b,c;
	char op;
	int ans =0;

	while(1){
		scanf("%d %c %d",&a,&op,&b);
		switch(op){
			case '+':
				printf("%d\n",a+b);
				break;
			case '-':
				printf("%d\n",a-b);
				break;
			case '*':
				printf("%d\n",a*b);
				break;
			case '/':
				printf("%d\n",a/b);
				break;
			default:
				break;
		}
		if(op == '?'){
			break;
		}
		
	}
	return 0;
}



Measured memory_bytes: 2104
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
// #define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,m;
const int MAXN = 1010,C=11;
int a[C][MAXN],k;

int get(vpi v){
  // cerr << l << " " << r << endl;
  for(int x = 0;x<v.size();x++){
  int l = v[x].fs , r = v[x].sc;
  for(int j=1;j<=m;j++){
    int cur = 0;
    for(int i=l;i<=r;i++){
      if(a[i][j]==1)cur++;
    }
    if(cur>k)return mod;
  }
  }
  int ans = 0;
  int cur[n+10]={0};
  for(int j=1;j<=m;j++){
  bool f = false;
  for(int idx = 0;idx<v.size();idx++){
    int c = 0;
    int l = v[idx].fs;
    int r = v[idx].sc;
    for(int i=l;i<=r;i++){
      if(a[i][j]==1)c++;
    }
    if(c+cur[idx]>k){
      cur[idx] = c;
      f = true;
    }
    else {
      cur[idx]+=c;
    }
  }
  if(f){
  ans++;
  for(int idx = 0;idx<v.size();idx++){
    int c = 0;
    int l = v[idx].fs;
    int r = v[idx].sc;
    for(int i=l;i<=r;i++){
      if(a[i][j]==1)c++;
    }
    cur[idx] = c;
  }    
  }
  }
  return ans;
}

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n >> m >> k;
  for(int i=1;i<=n;i++){
    string s;
    cin >> s;
    for(int j=0;j<m;j++){
      if(s[j]=='1'){
        a[i][j+1] = 1;
      }
      else {
        a[i][j+1] = 0;
      }
    }
  }
  int msk = n-1;
  ll ans = mod;
  for(int i=0;i<(1<<msk);i++){
    ll cur = __builtin_popcount(i);
    int pre = 1;
    vpi v;
    for(int j=0;j<msk;j++){
      if(i&(1<<j)){
        // cur+= get(pre,j+1);
        v.pb({pre,j+1});
        pre = j+2;
      }
    }
    // cur+=get(pre,n);
    if(pre<=n){
      v.pb({pre,n});
    }
    cur+= get(v);
    ans = min(ans,cur);
    cerr << cur << " -- " << i << endl;
  }
  cout << ans << endl;


return 0;
}
///....


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, d;
  cin >> n >> d;
  ll x, y, ans=0;
  rep(_, n) {
    cin >> x >> y;
    if(x*x + y*y <= d*d) ans++;
  }
  cout << ans << newl;
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

int n,m,k[100],a[100][100],c[100];

int main(void)
{
    cin >> n >> m;
    rep(i,n)
    {
        int kk;
        cin >> kk;
        rep(j,kk)
        {
            int aa;
            //cin >> a[i][j];
            cin >> aa;
            c[aa]++;
        }
    }

    int res = 0;
    rep(i,m)
    {
        if(c[i+1]==n)
            res++;
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 384
n=int(input())
s=[input() for i in range(n)]
d={}
for i in range(n):
  if (s[i][0]=='M' or s[i][0]=='A' or s[i][0]=='C' or s[i][0]=='R' or s[i][0]=='H') and s[i][0] not in d:
    d[s[i][0]]=1
  elif s[i][0] in d:
    d[s[i][0]]+=1
nd=list(d.values())
if len(nd)<3:
  print(0)
else:
  ans=0
  for i in range(len(nd)-2):
    for j in range(i+1,len(nd)-1):
      for k in range(j+1,len(nd)):
        ans+=nd[i]*nd[j]*nd[k]
  print(ans)

Measured memory_bytes: 9772
#include<iostream>
using namespace std;
int main() {
	int i;
	char s[21];
	cin >> s;
	for (i = 0; i < 5; i++) {
		cout << s[i];
	}
	cout << " ";
	for (i = 0; i < 7; i++) {
		cout << s[i+6];
	}
	cout << " ";
	for (i = 0; i < 5; i++) {
		cout << s[i+14];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll h = inl(), w = inl();
        char a[h][w];

        vector<P> black;
        vector<P> black2;
        rep(i, h) {
            rep(j, w) {
                cin >> a[i][j];
                if (a[i][j] == '#') black.eb(P(i, j));
            }
        }

        ll ans = 0;

        while (!black.empty()) {
            bool b = false;
            for (auto t: black) {
                ll i = t.F, j = t.S;
                rep(k, 4) {
                    ll nx = i + dx[k], ny = j + dy[k];

                    if (nx >= 0 && nx <= h - 1 && ny >= 0 && ny <= w - 1 && a[nx][ny] == '.') {
                        a[nx][ny] = '#';
                        black2.eb(P(nx, ny));
                        if (!b) {
                            ans++;
                            b = true;
                        }
                    }
                }
            }
            black = black2;
            black2.clear();
        }
        cout << ans << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main() {
string S;
int K;
cin>>K;
cin>>S;
if(S.length()>100||S.length()<=0||K>100||K<=0){return 0;}
if(S.length()<=K){cout<<S<<endl;}
else{
	for(int i=0;i<K;i++){cout<<S[i];}
	cout<<"..."<<endl;
}

	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp {
	char name[100];
	int t;
}P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

P dequeue() {
	P x = Q[head];
	head = (head + 1) % LEN;
	return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main() {
	int elaps = 0, c;
	int i, q;
	P u;
	scanf("%d %d", &n, &q);

	for (i = 1; i <= n; i++) {
		scanf("%s", Q[i].name);
		scanf("%d", &Q[i].t);
	}
	head = 1; tail = n + 1;

	while (head != tail) {
		u = dequeue();
		c = min(q, u.t);
		u.t -= c;
		elaps += c;
		if (u.t > 0)enqueue(u);
		else {
			printf("%s %d\n", u.name, elaps);
		}
	}
	return 0;
}

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

const int MOD = 1000000007;
string S;

void add(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}
                      
int main() {
    while (cin >> S) {
        int N = S.size();
        vector<vector<long long> > dp(N+1, vector<long long>(13, 0));
        dp[0][0] = 1;
        for (int i = 0; i < S.size(); ++i) {
            for (int j = 0; j < 13; ++j) {
                if (S[i] == '?') {
                    for (int v = 0; v <= 9; ++v) {
                        add(dp[i+1][(j*10+v)%13], dp[i][j]);
                    }
                }
                else {
                    int v = (int)(S[i] - '0');
                    add(dp[i+1][(j*10+v)%13], dp[i][j]);
                }
            }                
        }
        cout << dp[N][5] << endl;
    }
}


Measured memory_bytes: 13696
import java.io.IOException;
 
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();
            char[] c = s.toCharArray();
 
            System.out.println((char)(c[0]+1));
        }
    }
}

Measured memory_bytes: 20564
def resolve():
    N = int(input())
    conds = [list(map(int, input().split(" "))) for i in range(N)]
    
    first = sorted(conds, reverse=True, key=lambda x:x[2])[0]
    for cx in range(101):
        for cy in range(101):
            H = abs(first[0]-cx)+abs(first[1]-cy)+first[2]
            for n in range(N):
                cond = conds[n]
                if cond[2] == 0:
                    if abs(cond[0]-cx)+abs(cond[1]-cy) < H: 
                        break
                elif abs(cond[0]-cx)+abs(cond[1]-cy)+cond[2] != H:
                    break
            else:
                print("{} {} {}".format(cx, cy, H))
                exit()


if '__main__' == __name__:
    resolve()

Measured memory_bytes: 3064
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

c = []
a = I()
b = I()
c.append(a)
c.append(b)
if 1 in c and 2 in c:
    print(3)
    exit()
if 1 in c and 3 in c:
    print(2)
else:
    print(1)

Measured memory_bytes: 38452
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int n;
  cin>>n;
  rep(j,n){
    bool ok=true;
    int a,b=0,c=0;
    rep(i,10){
      cin>>a;
      if(a>b)b=a;
      else if(a>c)c=a;
      else ok=false;
    }
    if(ok)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}



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

int main()
{
	int n, sum = 0, Mx = 0;
	cin >> n;
	for(int i = 1, x; i <= n; i++)
	{
		cin >> x;
		sum += x, Mx = max(Mx, x);
	}
	puts(Mx < sum - Mx ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 384
import java.util.*;

/*
問題文
左右一列に N 枚のタイルが並んでおり、各タイルの初めの色は長さ 
N の文字列 S で表されます。

左から i 番目のタイルは、S の i 番目の文字が 0 のとき黒色で、1 のとき白色で塗られています。

あなたは、いくつかのタイルを黒色または白色に塗り替えることで、どの隣り合う 
2 枚のタイルも異なる色で塗られているようにしたいです。

最小で何枚のタイルを塗り替えることで条件を満たすようにできるでしょうか。

制約
1≤|S|≤10^5
Si は 0 または 1 である。
*/

public class Main {
    public static void main(String[] args){

        Scanner s = new Scanner(System.in);
        String a = s.next();
        String b[] = new String[a.length()];

        HashMap<String, String> map = new HashMap<>();
        map.put("0", "1");
        map.put("1", "0");

        for (int i = 0; i < a.length(); i++) {
          b[i] = String.valueOf(a.charAt(i));
        }

        int count = 0;
        for (int i = 0; i < a.length()-1; i++) {
          if (b[i].equals(b[i+1])) {
            count++;
            b[i+1] = map.get(b[i]);
          }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 31176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

// 全探索
int main() {
  int x;
  cin >> x;
  int up = 0;
  int down = 0;
  bool ans = false;
  for(int i = 0; i < 1000000; ++i) {
    up += 105;
    down += 100;
    if(down <= x && x <= up) ans = true;
  }
  if(ans) cout << 1 << endl;
  else cout << 0 << endl;

}


// O(1)
// int main(){
//   int x;
//   cin >> x;
//   int up = x / 100;
//   int down = x % 100;
//   down = (down + 4) / 5;
//   if(up >= down) cout << 1 << endl;
//   else cout << 0 << endl;
// }

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

public class Hello
{
    public static void Main()
    {
        var a = new List<string>();
        var s = Console.ReadLine().Trim();
        for (int i = 0; i < s.Length; i++)
            a.Add(s.Substring(i, 1));
        for (int i = 0; i < s.Length -1; i++)
            a.Add(s.Substring(i, 2));
        for (int i = 0; i < s.Length -2; i++)
            a.Add(s.Substring(i, 3));
        for (int i = 0; i < s.Length - 3; i++)
            a.Add(s.Substring(i, 4));
        for (int i = 0; i < s.Length - 4; i++)
            a.Add(s.Substring(i, 5));
        var b = a.Distinct().ToList();
        b.Sort();
        var n = int.Parse(Console.ReadLine().Trim());
        Console.WriteLine(b[n -1]);
    }
}


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



int main(){
  string s;
  bool ans=true;
  cin>>s;
  for (int i=0;i<3;i++){
    if(s[i]==s[i+1])
      ans=false;
  }
  if (ans)
    cout<<"Good"<<endl;
  else
    cout<<"Bad"<<endl;
}
      
  
      

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll mod = 1e9+7;

const int N = 222222;
ll fact[N];

inline ll mod_pow(ll x, ll n)
{
    ll r=1;
    while(n)
    {
        if(n&1) (r*=x)%=mod;
        (x*=x)%=mod;
        n>>=1;
    }
    return r;
}

inline ll mod_inv(ll x)
{
    return mod_pow(x,mod-2);
}

inline ll C(int n, int r)
{
    if(n-r<0) return 0;

    ll ret = fact[n];
    (ret*=mod_inv(fact[r]))%=mod;
    (ret*=mod_inv(fact[n-r]))%=mod;
    return ret;
}

int main()
{
    fact[0]=1;
    for(int i=1; i<N; ++i) fact[i]=(fact[i-1]*i)%mod;

    int n;
    cin >>n;
    vector<int> a(n+1);
    rep(i,n+1) cin >>a[i];

    vector<int> ct(n+1);
    rep(i,n+1) ++ct[a[i]];

    int x = -1;
    for(int i=1; i<=n; ++i)if(ct[i]==2) x=i;

    int f = -1, s = -1;
    rep(i,n+1)
    {
        if(a[i] == x)
        {
            if(f==-1) f=i;
            else s=i;
        }
    }

    printf("%d\n", n);
    for(int i=2; i<=n; ++i)
    {
        ll ans = 0;

        (ans+=C(n+1-2,i))%=mod;
        (ans+=C(n+1-2,i-1)*2)%=mod;

        int rem = f+(n-s);
        if(rem>=i-1)
        {
            // printf(" !!! %d , rem %d\n", i, rem);
            ans = (ans+mod-C(rem,i-1))%mod;
        }
        (ans+=C(n+1-2,i-2))%=mod;

        // printf("-------- i %d, naswer     is---\n", i);
        printf("%lld\n", ans);
    }
    printf("1\n");
    return 0;
}


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

int main(){
	string s, t;
	cin >> s >> t;
	ll n = s.length(), val = 0;
	for(ll i = 0; i < n; i++){
		if(s[i] != t[i]){
			val++;
		}
	}
	cout << val << "\n";
	return 0;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

vector<int> G[MAX_N];
ll f[MAX_N];
int x[MAX_N];

int main() {
    int n, m;
    cin >> n >> m;
    ll w[n];
    rep(i,n)cin >> w[i];
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int s; s = 1;
    s--;
    rep(i,n){
        x[i] = G[i].size();
        f[i] = -1;
    }


    rep(i,n){
        if(i == s)continue;
        if(x[i] == 1){
            f[i] = w[i];
            int t = i;
            x[i]--;
            while(true){
                int y;
                rep(j, G[t].size()){
                    if(f[G[t][j]] == -1){
                        y = G[t][j];
                        break;
                    }
                }

                if(y == s)break;

                if(x[y] == 2){
                    if(G[y].size() == 2){
                        x[y]--;
                        f[y] = f[t] + w[y];
                        t = y;
                        x[y]--;
                    }else{
                        x[y]--;
                        rep(j, G[y].size()){
                            f[y] = max(f[y], f[G[y][j]]);
                        }
                        f[y] = f[y] + w[y];
                        t = y;
                        x[y]--;
                    }
                }else if(x[y] > 2){
                    x[y]--;
                    break;
                }
            }
        }
    }




    ll ans = 0;

    rep(i,n){
        if(f[i] == -1){
            ans += w[i];
        }
    }

    ll tmp = 0;

    rep(i,n){
        tmp = max(f[i], tmp);
    }
    ans += tmp;

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



Measured memory_bytes: 13060
#include<stdio.h>
int h[300];
int w[300];
int main(){

int i=0;
for(i;;i++){
    scanf("%d %d",&h[i],&w[i]);

if(h[i] == 0 && w[i] == 0){
    break;
}
}
for(int j=0;j<i;j++){
    for(int k=0;k<h[j];k++){
        for(int l=0;l<w[j];l++){
          if(k%2==0 && l%2==0 || k%2!=0 && l%2!=0){
         printf("#");
        }
        else {printf(".");}
        }
printf("\n");
    }
printf("\n");

}
return 0;
}



Measured memory_bytes: 2060
#include<stdio.h>
int main()
{
    int i, n, min, j, temp,c=0;
    int a[100];
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

     for( i = 0; i < n ; i++ ){
 
    min = i;
 
    for(j = i ; j < n; j++ ){
 
      if(a[j] < a[min]){
        min = j;
      }
    }
     temp = a[i];
     a[i] = a[min];
     a[min] = temp;
     if(i != min) c++;
  }


    for (i = 0; i < n; i++) {
        if (i == n - 1) {
            printf("%d\n", a[i]);
            break;
        }
        printf("%d ", a[i]);
    }
    printf("%d\n", c);
}

Measured memory_bytes: 2732
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define pp pop_back
#define pi pair<ll,ll>
#define pii pair<int,int>
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n,i,j,k,l,m,b,t,sum,sum1,flag,max1,min1;
    string s;
    cin>>s;
    sum=0;
    max1=0;
    for(i=0;i<s.size();i++){
        if(s[i]=='R'){
            for(j=i;j<s.size();j++){
                if(s[j]=='R'){
                    sum++;
                }else{
                    break;
                }
            }
            max1=max(sum,max1);
            sum=0;
        }
    }
    cout<<max1<<endl;

}


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

bool is_prime(int k)
{
	for(int j=2;j*j<=k;j++){
		if(k%j==0) {
			return false;
		}
	}
    return true;
}

int main()
{
    stringstream ss;
    // 入力
    string S,T;
    cin>>S>>T;
    int len=S.length();
    char charS[len],charT[len];
    S.copy(charS,len);
    T.copy(charT,len);

    for(int i=0;i<len;i++){
        for(int j=0;j<len;j++){
            if(charS[j]!=charT[(j+i)%len]){
                j=len;
            }
            if(j==len-1){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }

    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;


int main(void) {
	string s; cin >> s;
	set<char> se;
	string d = "abcdefghijklmnopqrstuvwxyz";
	for(auto dd : d) se.insert(dd);
	for(auto u : s) se.erase(u);
	if(se.size() == 0) printf("None\n");
	else {
		for(auto k : se) {
			cout << k << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
  public static void main(String[] args) throws IOException {
  	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int k = Integer.parseInt(br.readLine());
    
    long sum = 0L;
    for (int i = 1; i <= k; i++)
      for (int j = 1; j <= k; j++)
        for (int s = 1; s <= k; s++)
          sum += gcd(gcd(i, j), s);
    
    System.out.print(sum);
  }
  
  private static int gcd(int i, int j) {
  	return j > 0 ? gcd(j, i % j) : i;
  }
}


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

int main(){
    int N, K; cin >> N >> K;
    int A[N];
    for(int i = 0; i < N; i++) cin >> A[i];
    
    int ans = (N - 1) / (K - 1);
    if((N - 1) % (K - 1)) ans++;

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

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>
#include <cstdio>

int main() {
	std::string s;

	std::cin >> s;

	for (size_t i = 0; i < s.size(); i++)
	{
		s[i] = 'x';
	}

	std::cout << s << std::endl;

	return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 100010;

using pll = pair<ll, ll>;

int N;
ll a[MN];
bool pr[100010];
vi prm;
map<pll, int> mcnt;
int ret;
int cb;

set<ll> sq;
map<ll, int> rt;

void calc(ll x)
{
	ll s[2] = {1, 1};

	for (ll t : prm) {
		if (t * t * t > x) {
			break;
		}

		if (x % t == 0) {
			int c = 0;
			while (x % t == 0) {
				x /= t;
				++c;
			}
			c %= 3;

			if (c != 0) {
				s[c-1] *= t;
			}
		}
	}

	if (x != 1) {
		if (sq.count(x)) {
			s[1] *= rt[x];
		} else {
			s[0] *= x;
		}
	}

	if (s[0] == 1LL && s[1] == 1LL) {
		++cb;
	} else {
		mcnt[mp(s[0], s[1])]++;
	}
}

int main() {
	for (int i = 2; i < 100010; ++i) {
		if (pr[i]) continue;
		prm.pb(i);
		for (int j = i * 2; j < 100010; j += i) {
			pr[j] = 1;
		}
	}

	for (ll i : prm) {
		sq.insert(i * i);
		rt[i * i] = i;
	}

	cin >> N;

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

	set<pll> us;
	for (auto t : mcnt) {
		pll p = t.fi;		
		if (us.count(p)) continue;
		us.insert(p);

		int maxi = t.se;
		pll tt = mp(p.se, p.fi);
		if (mcnt.count(tt)) {
			maxi = max(maxi, mcnt[tt]);
			us.insert(tt);
		}
		ret += maxi;
	}

	cout << ret + (!!cb) << endl;

	return 0;
}

Measured memory_bytes: 14720
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: u64,
        a: u64,
        b: u64,
        c: u64,
        d: u64,
        e: u64,
    }

    let min = a.min(b.min(c.min(d.min(e))));
    // println!("{}", (n as f64 / a.min(b.min(c.min(d.min(e)))) as f64).ceil() as u64 + 4);
    println!("{}", (n  + min - 1) / min as u64 + 4);
}


Measured memory_bytes: 2152