akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cctype>
#include <utility>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int N = in(); N; N--) {
		int x = in(), y = in(), b = in(), p = in();
		auto f = [=](int b, int p, int r) {return (x * b + y * p) * r / 10;};
		outl(min(f(b, p, 10), f(max(5, b), max(2, p), 8)));
	}
}


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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(ll i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(ll j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

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

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


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

    int N;
    cin >> N;

    vector<int> L(N);
    REPinit(i, 0, N) cin >> L[i];

    sort(CONTAINER_ALL(L));

    int sumL = 0;
    REPinit(i, 0, N - 1) sumL += L[i];

    if (sumL > L.back()) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >>a >>b>>c;
    int ans=10000000;
    ans=min(ans,a+b);
    ans=min(ans,b+c);
    ans=min(ans,a+c);
    cout <<ans;
}

Measured memory_bytes: 256
N = int(input())
L = [[x for x in input().split()] for i in range(N)]

for i in range(0,N):
  L[i][1] = 100-int(L[i][1])
  L[i].append(i+1)
L.sort()

#print(L)

for j in range(0,N):
  print(L[j][2])

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

int main(){
  	int k,n;
  	int a[200001];
  	int i;
    int max;
	cin >> k >> n;
  	for(i=1;i<=n;i++){
		cin >> a[i];
    }
  	max=a[1]+(k-a[n]);
  	for(i=1;i<n;i++){
		if(max < a[i+1]-a[i])max=a[i+1]-a[i];
    }
  	cout << (k-max);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define oo 2000000000
const double PI = acos(-1);
const int N = 100010 , K = 201;


int main(){
	int x, y;
	cin >> x >> y;
	if(x % y == 0)
		cout << -1 << endl;
	else
		cout << x << endl;
 	return 0;
}

Measured memory_bytes: 256
import itertools
##print(ord("A"))
n = int(input())
s = list(input())
t =[]
u = []
for i in range(len(s)):

    t.append(ord(s[i])+n)
#print(t)
for j in range(len(t)):
    if t[j] > 90:
        t[j] = t[j]%90+64


for i in range(len(t)):
    print(chr(t[i]),end="")


Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll dp[100005][105][2],d,n;
char s[100005];
int main(void){
    scanf("%s%lld",s,&d);
    n=strlen(s);
    dp[0][0][1]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            for(int k=0;k<10;k++){
                dp[i+1][(j+k)%d][0]=(dp[i+1][(j+k)%d][0]+dp[i][j][0])%M;
                if(k<s[i]-'0')dp[i+1][(j+k)%d][0]=(dp[i+1][(j+k)%d][0]+dp[i][j][1])%M;
            }
            dp[i+1][(j+s[i]-'0')%d][1]=(dp[i+1][(j+s[i]-'0')%d][1]+dp[i][j][1])%M;
        }
    }
    printf("%lld\n",(dp[n][0][0]+dp[n][0][1]-1+M)%M);
}


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

using namespace std;
char grid[1010][1010];

const char *cube[8][7] = {
        {},
        {},
        {},
        { // 3, 1
                "aa.",
                "..a",
                "..a"

        },
        { // 4, 3
                "aabc",
                "ddbc",
                "bcaa",
                "bcdd"
        },
        { // 5, 3
                "aabba",
                "bcc.a",
                "b..cb",
                "a..cb",
                "abbaa"
        },
        { // 6, 3
                "aabc..",
                "ddbc..",
                "..aabc",
                "..ddbc",
                "bc..aa",
                "bc..dd"
        },
        { // 7, 3
                "aabbcc.",
                "dd.dd.a",
                "..d..da",
                "..d..db",
                "dd.dd.b",
                "..d..dc",
                "..d..dc"
        }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if (N < 3) {
        puts("-1");
        return 0;
    }
    int tmp = 0;
    auto f = [&](const int c) {
        for (int i = 0; i < c; ++i) {
            for (int j = 0; j < c; ++j) {
                if (cube[c][i][j] != '*') {
                    grid[tmp + i][tmp + j] = cube[c][i][j];
                }
            }
        }
        tmp += c;
    };
    if (N % 3 == 0) {
        while (tmp < N) {
            f(3);
        }
    } else {
        if (N % 4 != 0) {
            f(4 + N % 4);
        }
        while (tmp < N) {
            f(4);
        }
    }
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if (grid[i][j] == 0) {
                putchar('.');
            } else {
                putchar(grid[i][j]);
            }
        }
        putchar('\n');
    }
    return 0;
}


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

int main()
{
	int x[8] = { 1,1,1,0,0,-1,-1,-1 };
	int y[8] = { 1,0,-1,1,-1,1,0,-1 };

	int H, W;
	cin >> H >> W;

	char S[51][51];
	int A[51][51];

	for (int i = 0; i < H; i++) {
		cin >> S[i];
	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++)
		{
			if (S[i][j] == '.') {
				int count = 0;
				for (int k = 0; k < 8; k++) {
					if ((i + y[k] >= 0 || i + y[k] < H) && (j + x[k] >= 0 || j + x[k] < W))
					{
						if (S[i + y[k]][j + x[k]] == '#') {
							count++;
						}
					}
				}

				A[i][j] = count;
			}
			else {
				A[i][j] = '#';
			}
		}
	}

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (A[i][j] != 35) {
				cout << A[i][j];
			}
			else {
				cout << '#';
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef unsigned int UINT;
typedef unsigned long long ull;
typedef pair<int, int> pdi;
typedef pair<ll, int> pli;
map<string, int> mp;

int main(void) {
    FAST_IO;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    
    ll ans = 0;
    for (auto &x: mp) {
        ll m = x.second;
        if (m < 2) continue;
        ans += m * (m - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11264
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int A = sc.nextInt();
    int B = sc.nextInt();

    int ans = 0;
    int c = 1;
    while (c < B) {
        c--;
        c += A;
        ans++;
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define Lens 1000100
#define Nil -1

using namespace std;

struct point
{
	int x;
	int y;
	int add;
};

struct node
{
	int lc;
	int rc;
	int key;
};

int N, q, h;
point p[Lens];
node T[Lens];
vector<int> ans;
bool lessx(point a, point b) { return a.x < b.x; }
bool lessy(point a, point b) { return a.y < b.y; }

int maketree(int l, int r, int depth)
{
	if (l >= r)
		return Nil;
	int mid = (l + r) / 2;
	if (depth % 2 == 0)
		sort(p + l, p + r, lessx);
	else
		sort(p + l, p + r, lessy);
	int t = h++;
	T[t].key = mid;
	T[t].lc = maketree(l, mid, depth + 1);
	T[t].rc = maketree(mid + 1, r, depth + 1);
	return t;

}

void findtree(int root, int lx, int hx, int ly, int ry, int depth)
{
	int tr = root;
	int tx = p[T[tr].key].x;
	int ty = p[T[tr].key].y;
	if (lx <= tx&&tx <= hx&&ly <= ty&&ty <= ry)
		ans.push_back(p[T[tr].key].add);
	if (depth % 2 == 0)
	{
		if (T[tr].lc != Nil&&lx <= tx)
			findtree(T[tr].lc, lx, hx, ly, ry, depth + 1);
		if (T[tr].rc != Nil&&tx <= hx)
			findtree(T[tr].rc, lx, hx, ly, ry, depth + 1);
	}
	else
	{
		if (T[tr].lc != Nil&&ly <= ty)
			findtree(T[tr].lc, lx, hx, ly, ry, depth + 1);
		if (T[tr].rc != Nil&&ty <= ry)
			findtree(T[tr].rc, lx, hx, ly, ry, depth + 1);
	}

}

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d %d", &p[i].x ,&p[i].y);
		p[i].add = i;
		T[i].lc = T[i].rc = T[i].key = Nil;

	}
	int root = maketree(0, N, 0);
	scanf("%d", &q);
	for (int i = 0; i < q; i++)
	{
		ans.clear();
		int lx, hx, ly, ry;
		scanf("%d %d %d %d", &lx, &hx,&ly,&ry);

		findtree(root, lx, hx, ly, ry, 0);
		sort(ans.begin(), ans.end());
		for (int i = 0; i < ans.size(); i++)
			printf("%d\n", ans[i]); 
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 14528
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] dary = new int[n];
		for(int i=0; i<n; i++) {
			dary[i] = sc.nextInt();
		}
		Arrays.sort(dary);

		int ans = 1,temp=dary[0];
		for (int i : dary) {
			if(temp<i) {
				ans++;
				temp = i;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 25172
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d;
	e=a+b;
	f=c+d;
	if(e>f)printf("Left\n");
	else if(e<f)printf("Right\n");
	else printf("Balanced\n");
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	int N,A,B;
	cin >> N >> A >> B;
	cout << min(A,B) << " " << max(0,A+B-N) << endl;



	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;


int main(){
    int n; cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    int ans=0;
    rep(i, n-2){
        if(((p[i] < p[i+1]) && (p[i+1] < p[i+2])) || ((p[i] > p[i+1]) && (p[i+1] > p[i+2]))) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 256
from collections import defaultdict
from heapq import nsmallest
from itertools import product

n, c = map(int, input().split())
tbl = [list(map(int, input().split())) for _ in range(c)]

grid_count = [defaultdict(int) for _ in range(3)]
for i in range(n):
    for j, k in enumerate(map(int, input().split())):
        grid_count[(i + j) % 3][k - 1] += 1

preliminary = [nsmallest(3, ((sum(tbl[pc][color] * cnt for pc, cnt in grid_count[s].items()), color)
                             for color in range(c))) for s in range(3)]

ans = float('inf')
for (v0, c0), (v1, c1), (v2, c2) in product(*preliminary):
    if c0 == c1 or c1 == c2 or c2 == c0:
        continue
    ans = min(ans, v0 + v1 + v2)
print(ans)


Measured memory_bytes: 3436
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;


void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    if (A[$-1] != 2) {
        writeln(-1);
        return;
    }

    auto B = new Tuple!(long, long)[](N);
    B[$-1] = tuple(2L, 3L);

    for (int i = N-2; i >= 0; --i) {
        long l = B[i+1][0];
        long r = B[i+1][1];
        long nl = l % A[i] == 0 ? l : (l / A[i] + 1) * A[i];
        long nr = r % A[i] == 0 ? r : (r / A[i]) * A[i];
        nr += A[i]-1;

        if (nl > r || nr < l) {
            writeln(-1);
            return;
        }
        B[i] = tuple(nl, nr);
    }

    writeln(B[0][0], " ", B[0][1]);
}


Measured memory_bytes: 7400
#include<bits/stdc++.h>
#define reg register
#define mod 1000000007
using namespace std;
inline int  read() {
    reg int s = 0, t = 0; reg char ch = getchar();
    while(ch > '9' || ch < '0') t |= ch == '-', ch = getchar();
    while(ch >= '0' && ch <= '9') s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}
int ksm(int u, int v){
	int s = 1;
	for(int i = v; i; i >>= 1){
		if(i & 1) s = 1ll * s * u % mod;
		u = 1ll * u * u % mod;
	}
	return s;
}
int n, m, f[5001][5001], inv2, ans, a[5001], g[5001][5001];
int main()
{
	n = read(); m = read(); inv2 = 500000004;
	for(int i = 1; i <= n; i++) a[i] = read();
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++) f[i][j] = (a[i] > a[j]);
	
	for(int i = 1; i <= m; i++){
		int x = read(), y = read();
		for(int j = 1; j <= n; j++) {
			if(j == x || j == y) continue;
			g[x][j] = 1ll * (f[x][j] + f[y][j]) % mod * inv2 % mod;		
			g[j][x] = 1ll * (f[j][x] + f[j][y]) % mod * inv2 % mod;
			g[y][j] = 1ll * (f[x][j] + f[y][j]) % mod * inv2 % mod;
			g[j][y] = 1ll * (f[j][y] + f[j][x]) % mod * inv2 % mod;
		}
		for(int j = 1; j <= n; j++) {
			if(j == x || j == y) continue;
			f[x][j] = g[x][j]; f[j][x] = g[j][x];
			f[y][j] = g[y][j]; f[j][y] = g[j][y];
		}
		f[x][y] = 1ll * (f[x][y] + f[y][x]) % mod * inv2 % mod; f[y][x] = f[x][y];
	
	}
	for(int i = 1; i <= n; i++)
		for(int j = i + 1; j <= n; j++)
			ans = (ans + f[i][j]) % mod;
	ans = 1ll * ans * ksm(2, m) % mod; cout << ans << endl;
	return 0;
}


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

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

#define rep(i,n) for (ll i = 0; i < (n); i++)
#define ru(a,b) (((a)+((b)-1)) / (b))   //切り上げ(a/b)
#define dump(x)  cout << #x << " = " << (x) << endl;

int main()
{
	double L;
	cin >> L;

	printf("%lf", pow(L / (double)3.0, 3));
	return 0;
}

Measured memory_bytes: 256
input = gets
month = input.split(" ")[0].to_i
day = input.split(" ")[1].to_i

m = 0
d = 0

takahashi = 0

loop do 
  m += 1
  d += 1

  if (month * 100 + day >= m * 100 + d)
    takahashi += 1
  elsif (month * 100 + day >= m * 100 + d) && (day >= month)
    takahashi += 1
  else
    break
  end
end

puts takahashi

Measured memory_bytes: 1788
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    string a;
    cin >> a;
    if(a[5] == '1' || a[6] > '4'){
        cout << "TBD";
    }
    else
    {
        cout << "Heisei";
    }
    
    cout << endl;
}


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

using namespace std;

int main()
{
    int N;
    cin >> N;
    while (N--) {
        vector<int> a(10);
        for (int i = 0; i < 10; i++) {
            cin >> a[i];
        }
        bool pos = 1;
        stack<int> st[2];
        st[0].push(a[0]);
        for (int i = 1; i < 10; i++) {
            bool use = 0;
            for (int j = 0; j < 2; j++) {                
                if (st[j].empty() || st[j].top() < a[i]) {
                    st[j].push(a[i]);
                    use = 1;
                    break;
                }
            }
            if (!use) {
                pos = 0;
                break;
            }
        }
        cout << (pos ? "YES" : "NO") << endl;
    }
    return 0;
}

Measured memory_bytes: 3100
//----->|try=0; while(!success) try++;|<------
//----->|Belief Yourself,Respect Yourself|<----
//----->|Be Proud Of Yourself,You're Doing Your best|<-----
#include<bits/stdc++.h>
using namespace std;
#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Lower value search;
#define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
#define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
#define rep(i,intial,n) for(int i=intial; i<(n) ; i++)
#define REP(i,intial,n) for(int i=intial; i<=(n) ; i++)
#define PI acos(-1.0)//PI Calculation
#define LL long long
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a)|(b))
#define XOR(a,b) ((a) ^ (b))
#define MP make_pair
#define sqr(x) ((x)*(x))
#define sqrt(x) sqrt(1.0*(x))
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define MX 1000005
#define MOD 1000000007
template<typename T> T POW(T b,T p)          //Pow calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b);
        b=(b*b);
        p>>=1;
    }
    return r;
}

template<typename T> T BigMod(T b,T p,T m) //BigMod Calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return r;
}

//||--------------------------->||Main_Code_Start_From_Here||<---------------------------------||
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    int k,s;
    while(cin>>k>>s)
    {
        int cnt=0;
        rep(i,0,k+1)
        {
            rep(j,0,k+1)
            {
                int last=s-(i+j);
                if(last>=0 && last<=k) cnt++;
            }
        }
        cout<<cnt<<endl;
    }

}


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

int main() {
	long long COUNT[100] = {}, A;
	while (cin >> A) {
		A--, COUNT[A]++;
	}
	long long MAX = 0;
	for (int i = 0; i < 100; i++) MAX = max(MAX, COUNT[i]);
	for (int i = 0; i < 100; i++) {
		if (MAX == COUNT[i]) cout << i + 1 << endl;
	}
}


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

int main(){
	int A,B,C,X,icount=0,isum=0;
	int i=0,j=0,k=0;
	
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> X;
	
	for (i=0;i<A+1;i++)
	{
		for (j=0;j<B+1;j++)
		{
			for (k=0;k<C+1;k++)
			{
				isum = 500*i+100*j+50*k;
						if (isum==X) {
					icount = icount+1;
						}
			}
		}
	}
	
	cout << icount;
	
	return 0;
}



Measured memory_bytes: 256
import math

a=input()
a=int(a)
hyaku=a/100
hyaku=math.floor(hyaku)
ju=(a-hyaku*100)/10
ju=math.floor(ju)
ichi=(a-hyaku*100-ju*10)
if hyaku==7:
		print('Yes')
elif ju==7:
		print('Yes')
elif ichi==7:
		print('Yes')
else:
		print('No')

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n, k;
std::string s;
int main() {
	std::cin >> n >> k >> s;

	s[k - 1] = tolower(s[k - 1]);

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


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
count = 0
now = 0
ans = 0
for i in range(N):
  if a[i] == now:
    count += 1
  else:
    ans += count//2
    count = 1
    now = a[i]

ans += count//2
print(ans)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if (n == 0 && m == 0)
				break;
			int[][] dp = new int[n][256];
			boolean[][] dpb = new boolean[n][256];
			int[] sample = new int[n];
			int[] code = new int[m];
			for (int i = 0; i < m; i++)
				code[i] = sc.nextInt();
			for (int i = 0; i < n; i++) {
				sample[i] = sc.nextInt();
				for (int j = 0; j < 256; j++)
					dpb[i][j] = false;
			}
			for (int i = 0; i < m; i++) {
				int d = addComp(128, code[i]);
				dp[0][d] = (int) Math.pow(d - sample[0], 2);
				dpb[0][d] = true;
			}
			for (int i = 0; i < n - 1; i++) {
				for (int j = 0; j < 256; j++) {
					if (dpb[i][j]) {
						for (int k = 0; k < m; k++) {
							int d = addComp(j, code[k]);
							if (dpb[i + 1][d])
								dp[i + 1][d] = Math.min(dp[i + 1][d], dp[i][j]
										+ (int) Math.pow(d - sample[i + 1], 2));
							else
								dp[i + 1][d] = dp[i][j]
										+ (int) Math.pow(d - sample[i + 1], 2);
							dpb[i + 1][d] = true;
						}
					}
				}
			}
			int result = Integer.MAX_VALUE;
			for (int i = 0; i < 256; i++)
				if (dpb[n - 1][i])
					result = Math.min(result, dp[n - 1][i]);
			System.out.println(result);
		}
		sc.close();
	}

	static int addComp(int a, int b) {
		int r = a + b;
		r = Math.max(r, 0);
		r = Math.min(r, 255);
		return r;
	}
}

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

#define int long long
#define debug(x) cout<<#x<<" "<<x<<endl;

const int N=1e6+5;
const double eps=1e-9;
const int INF=1e18;

int a[N];

signed main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,m,s=0;
    cin>>n>>m;
    for(int i=1;i<=n;i++) cin>>a[i],s+=a[i];
    sort(a+1,a+1+n);
    int cnt=0;
    for(int i=n;i>=1;i--){
        if(a[i]*4*m>=s) cnt++;
    }
    if(cnt>=m) puts("Yes");
    else puts("No");
    return 0;
}

//Created Time  :2020/4/4 20:00:15


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, 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 rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
const constexpr ll INF = 1LL<<55;
string solve() {
	var(string, s);
	int len_s = len(s);
	if (s == "zyxwvutsrqponmlkjihgfedcba" || len(set<char>(all(s))) != len_s) {
		return "-1";
	}
	string ans = s;
	if (len_s == 26) {
		rrep(i, 24, -1) {
			rrep(j, 25, i) {
				if (s[i] < s[j])
					return s.substr(0, i) + s[j];
			}
		}
	}
	for(auto a: string("abcdefghijklmnopqrstuvwxyz")) {
		if (s.find(a) == string::npos) {
			ans += a;
			break;
		}
	}
	return ans;
}
int main() {
	print(solve());
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String s = scan.next();
        //System.out.println(s.substring(0,n/2));
        //System.out.println(s.substring(n/2 , n));
        if(s.substring(0,n/2).equals(s.substring(n/2 , n))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }        
    }
}

Measured memory_bytes: 35560
x,y,tx,ty = list(map(int, input().split()))

dx = tx-x
dy = ty-y

ans=''

for i in range(dx):
    ans+='R'
for i in range(dy):
    ans+='U'
for i in range(dx):
    ans+='L'
for i in range(dy):
    ans+='D'
ans+='D'
for i in range(dx+1):
    ans+='R'
for i in range(dy+1):
    ans+='U'
ans+='L'
ans+='U'
for i in range(dx+1):
    ans+='L'
for i in range(dy+1):
    ans+='D'
ans+='R'

print(ans)

Measured memory_bytes: 3064
const MOD: i64 = 1000000007;

fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let k: usize = s.next().unwrap().parse().unwrap();
	use num::integer::Roots;
	let sqrtn = n.sqrt();
	let mut small = vec![0; sqrtn + 1];
	let mut large = vec![0; sqrtn + 1];
	small[1] = 1;

	// for i in 1..=sqrtn {
	// 	let cnt = n / i - n / (i + 1);
	// 	large[i] = cnt as i64;
	// }

	for _ in 0..k {
		let mut nexts = vec![0; sqrtn + 1];
		let mut nextl = vec![0; sqrtn + 1];
		for i in 1..=sqrtn {
			nextl[i] = small[i];
			nexts[i] = large[i];
		}

		for i in 1..sqrtn {
			nextl[i + 1] = (nextl[i + 1] + nextl[i]) % MOD;
			nextl[i] = (nextl[i] * (n / i - n / (i + 1)) as i64) % MOD;
		}
		if sqrtn == n / sqrtn {
			nexts[sqrtn] = nextl[sqrtn];
		} else {
			nexts[sqrtn] = (nexts[sqrtn] + nextl[sqrtn]) % MOD;
		}
		nextl[sqrtn] = (nextl[sqrtn] * (n / sqrtn - n / (sqrtn + 1)) as i64) % MOD;

		for i in (1..sqrtn).rev() {
			nexts[i] = (nexts[i] + nexts[i + 1]) % MOD;
		}

		small = nexts;
		large = nextl;
	}

	let ans = small[sqrtn]
		+ if sqrtn == n / sqrtn { 0 } else { large[sqrtn] }
		+ (1..sqrtn).fold(0, |r, i| (r + small[i] + large[i])) % MOD;
	println!("{}", ans % MOD);
}


Measured memory_bytes: 3340
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

vector<pi> g[100005];

ll dist[200005]; //don't forget to initialize to inf, change to ll if necessary

void dijkstra(int t){
	//find the shortest paths to t
	rep(i, 100005) dist[i] = 1e18;
	dist[t] = 0;
	set<pi> q;
	q.insert(mp(dist[t], t));
	while(!q.empty()){
		int u = q.begin() -> se;
		q.erase(q.begin());
		for(pi x : g[u]){
			if((dist[u] + x.se) < dist[x.fi]){
				q.erase(mp(dist[x.fi], x.fi));
				dist[x.fi] = dist[u] + x.se;
				q.insert(mp(dist[x.fi], x.fi));
			}
		}
	}
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	rep(i, n - 1){
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		g[a].pb(mp(b, c));
		g[b].pb(mp(a, c));
	}
	int q, k;
	cin >> q >> k;
	k--;
	dijkstra(k);
	rep(i, q){
		int x, y;
		cin >> x >> y;
		x--, y--;
		cout << dist[x] + dist[y] << endl;
	}
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

const int MAX_N = 12;
const int MAX_M = 1000;
int N, M;
int c[MAX_M][MAX_N];
int a[MAX_M], b[MAX_M];

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

    for(int i=0; i<M; i++){
        cin >> a[i] >> b[i];
        for(int j=0; j<b[i]; j++){
            cin >> c[i][j];
            c[i][j]--;
        }
    }

    int num = pow(2, N);
    int dp[M+1][num];
    for(int i=0; i<=M; i++){
        for(int j=0; j<num; j++) dp[i][j] = 1000000005;
    }

    dp[0][0] = 0;

    for(int i=0; i<M; i++){
        // cout << "------ " << i << endl;
        for(int j=0; j<num; j++){
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);

            int t = 0;
            for(int k=0; k<b[i]; k++){
                t |= 1 << c[i][k];
            }
            // cout << "====" << endl;
            // cout << j << " " << t << endl;
            dp[i+1][j|t] = min(dp[i][j]+a[i], dp[i+1][j|t]);
            // cout << dp[i][j] << " " << dp[i+1][j|t] << endl;
        }
    }

    if(dp[M][num-1] == 1000000005) cout << -1 << endl;
    else cout << dp[M][num-1] << endl;

    return 0;
}


Measured memory_bytes: 16256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

//ただの辺
struct edge {
    using lint = long long int;
    int to;
    lint cost;
    edge(int t, lint c = 1) : to(t), cost(c) {
    }
    // edge(int t) : to(t), cost(1) {
    //}
};

// fromからもっとも遠い頂点(second)とその距離(first)を求める
// depend:edge
pair<long long int, int> tree_farest(vector<vector<edge>>& g, int from,
                                     int par) {
    using lint = long long int;
    pair<lint, int> res = {0, from};
    for (int i = 0; i < (int)g[from].size(); i++) {
        if (g[from][i].to == par) continue;
        pair<lint, int> sub = tree_farest(g, g[from][i].to, from);
        sub.first += g[from][i].cost;
        res = max(res, sub);
    }
    return res;
}

//木の直径
// depend:edge,tree_farest
long long int tree_diameter(vector<vector<edge>>& g) {
    pair<long long int, int> temp = tree_farest(g, 0, -1);
    return tree_farest(g, temp.second, -1).first;
}

int main() {
    int n;
    cin >> n;
    vector<vector<edge>> g(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        g[--a].push_back(edge(--b));
        g[b].push_back(edge(a));
    }
    lint d = tree_diameter(g);
    if (d % 3 == 1) {
        cout << "Second" << endl;
    } else {
        cout << "First" << endl;
    }
    return 0;
}

Measured memory_bytes: 33024
#include <stdio.h>
int main(){
    char s[6];
    int a,b;
    a=0,b=0;
    scanf("%s",s);
    if(s[2]==s[3]){
        a=1;
    }
    if(s[4]==s[5]){
        b=1;
    }
    if(a*b == 1){
        printf("Yes");
    }else{
        printf("No");
    }
    
    return 0;
}


Measured memory_bytes: 128
s = input()
abc = [0]*(3)
for i in range(len(s)):
    if s[i] == "a":
        abc[0] += 1
    elif s[i] =="b":
        abc[1] += 1
    else:
        abc[2] += 1
if max(abc)-min(abc) >= 2:
    print("NO")
else:
    print("YES") 

Measured memory_bytes: 39408
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int answer =0;
    if(N<2){
      answer =1;
    }else if(N<4){
      answer=2;
    }else if(N<8){
      answer=4;
    }else if(N<16){
      answer=8;
    }else if(N<32){
      answer =16;
    }else if(N<64){
      answer=32;
    }else{
      answer=64;
    }
    System.out.println(answer);
    

      
  }
  

  
}

Measured memory_bytes: 23380
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;

void main(){
    int n = readln.chomp.to!int;
    int[] a = readln().split().map!(to!int).array;
    int[] x = [0,0,0];
    foreach(i; 0..n-1){
        if(a[i] == a[i+1]){
            x ~= i+1;
        }
    }
    x ~= n;
    int ans = 0;
    foreach(i; 0..x.length-3){
        ans = max(ans, x[i+3] - x[i]);
    }
    writeln(ans);
}

Measured memory_bytes: 4828
import math
import heapq
import sys
from collections import Counter
import numpy as np
import datetime

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
#s = [input() for i in range(3)]

N=int(input())
H=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

cnt=1
high=H[0]
for i in range(1,len(H)):
    if H[i]>=high:
        high=H[i]
        cnt+=1
    
print(cnt)    


Measured memory_bytes: 13260
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N;
ll x[60], y[60];

void solve() {

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

	map<pair<int, int>, int> pqlist;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i == j) continue;
			pqlist[make_pair(x[j] - x[i], y[j] - y[i])] = 0;
		}
	}

	for (auto& pq : pqlist) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (i == j) continue;
				if (pq.fst.fst == x[j] - x[i] && pq.fst.scd == y[j] - y[i]) pq.scd++;
			}
		}
	}
	int num = 0;
	for (auto & pq : pqlist) {
		num = max(num, pq.scd);
	}

	cout << N - num << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 384
#include <stdio.h>
int main(int argc, const char * argv[])

{
   int h,m,s;
   scanf("%d",&s);
   m=s/60;
   s=s%60;
   h=m/60;
   m=m%60;

   printf("%d:%d:%d\n",h,m,s);
    return 0;

}

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

int main(){
    // input
    double a, b, x;
    cin >> a >> b >> x;

    // calc
    double c, ans;
    // less than half
    if( a * (a/2) * b <= x ){
        c = - x / a / a * 2 + 2*b;
        ans = atan( c/a ) / M_PI * 180.0;
    }else{
        c = x / a * 2 / b;
        ans = atan( b/c ) / M_PI * 180.0;
    }
    
    // output
    cout << setprecision(16) << ans << endl;
} 

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

int main()
{
    int n;
    cin >> n;
    long double ans = 0;
    rep(i, n) {
        long double x;
        string u;
        cin >> x >> u;
        if(u == "JPY") ans += x;
        else ans += x * 380000.0;
    }
    cout << setprecision(15) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
using namespace std;

int main(){
	string s; cin >> s;
	ll count1 = 0, count2 = 0;
	for (int i = 0; i < s.length(); ++i){
		if (i % 2 == 0){
			if (s[i] == '0') count1++;
			else count2++;
		}
		else{
			if (s[i] == '1') count1++;
			else count2++;
		}
	}cout << min(count1, count2) << endl;
	return 0;
}

Measured memory_bytes: 512
import itertools as it

N=int(input())
A=list(map(int,input().split()))
A.sort()
B=list(it.accumulate(A))
cB=[B[i]*2>=A[i+1] for i in range(len(A)-1)]

ans=1
i=N-2
while i>=0 and cB[i]:
    ans+=1
    i-=1

print(ans)

Measured memory_bytes: 14428
from collections import deque
n = int(input())

li = [3, 5, 7]

def dfs():
  stack = deque()
  for i in li:
    stack.append(i)
  while stack:
    q = stack.popleft()
    if all(str(l) in str(q) for l in li):
      ans.append(q)
    for k in li:
      if q * 10 + k <= n:
        stack.append(q * 10 + k)
          
ans = []
dfs()
print(len(ans))

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int N,M,Q;
vi v;
vector<tuple<int,int,int,int>> ps;

int calc(){
    int res = 0;
    for(auto t : ps){
        int a = get<0>(t);
        int b = get<1>(t);
        int c = get<2>(t);
        int d = get<3>(t);
        if(v[b] - v[a] == c){
            res += d;
        }
    }
    return res;
}

int rec(int n, int k=0){
    if(n == k){
        return calc();
    }
    int res = 0;
    REP(i,v[k],M+1){
        v.push_back(i);
        res = max(res, rec(n, k+1));
        v.pop_back();
    }
    return res;
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    v.push_back(1);
    cin >> N >> M >> Q;
    rep(i,Q){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        ps.emplace_back(a, b, c, d);
    }
    cout << rec(N) << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
int main()
{
    int N;
    std::cin >> N;

    std::vector<int> p(N);
    for (int i = 0; i < N; i++) {
        std::cin >> p[i];
    }

    int ans = 0;
    for (int i = 1; i < N-1; i++) {
        if (p[i-1] < p[i] && p[i] < p[i+1] ) ans++;
        else if (p[i+1] < p[i] && p[i] < p[i-1]) ans++;
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){

  int n,s1=1145141919,s2,result=-1145141919;

  cin>>n>>s2;
  for(int i=1;i<n;i++){
    s1=min(s1,s2);
    cin>>s2;
    result=max(result,s2-s1);
  }
   
  cout<<result<<endl;

  return 0; 

}



Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// printf("%d\n" ,points);
// const double PI=acos(-1);

int main(){
    int n,k,aux,l=1,r,m;
    cin >> n >> k;
    int numbers[n];
    cin >> numbers[0];
    r=numbers[0];
    for(int i=1;i<n;i++){
        cin >> numbers[i];
        if(r<numbers[i]) r=numbers[i];
    }
    while(l!=r){
        aux=k;
        bool ok=true;
        m=(r+l)/2;
        for(int i=0;i<n;i++){
            if(numbers[i]>m){
                aux-=ceil(1.0*numbers[i]/m)-1;
                if(aux<0) ok=false;
            }
        }
        if(ok) r=m;
        else l=m+1;
    }
    cout << l << endl;
    return 0;
}


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

//#include"stdc++.h"
using namespace std;
int main(int argc, const char * argv[])
{
    long long pNum, baseTime, tmp, total = 0, preTmp = -1;
    cin>>pNum>>baseTime;
    while(pNum > 0)
    {
        cin>>tmp;
        pNum --;
        if(preTmp == -1)
        {
            preTmp = tmp;
            continue;
        }
        if((preTmp + baseTime) <= tmp) total += baseTime;
        else total += (tmp - preTmp);
        preTmp = tmp;
    }
    total += baseTime;
    cout<< total<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
h = list(map(int, input().split()))+[0]
ans = 0

while True:
    if h==[0]*(N+1):
        print(ans)
        exit()
        
    for i in range(N):
        if h[i]>0 and h[i+1]==0:
            ans += 1
        
    for i in range(N):
        h[i] = max(h[i]-1, 0)

Measured memory_bytes: 39408
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int old = sc.nextInt();
        boolean used = false;
        for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        }
        System.out.println("Yes");
    }
}

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

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

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

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


//最大公約数を返す関数
int gcd(int n) {
	return 0;
}


//最小公倍数を返す関数
int mcd(int n) {
	return 0;
}


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


int main() {
	ll n, y;
	cin >> n >> y; y /= 1000;
	for (ll i = 0; i <= y / 10; i++) {
		for (ll j = 0; j <= y / 5; j++) {
			ll k = y - 10 * i - 5 * j;
			if (k < 0) continue;
			if (i + j + k == n) {
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	puts("-1 -1 -1");
	return 0;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        double m=0;
        double[] si = new double[1001];
        int i,n;
        double z=0;
        while(true){
            n = s.nextInt();
            if(n==0)break;
            for(i=0;i<n;i++){
                si[i]=s.nextInt();
                m+=si[i];
            }
            m/=(double)n;
            for(i=0;i<n;i++)z+=(si[i]-m)*(si[i]-m);
            z/=(double)n;
            System.out.println(Math.sqrt(z));
            m=0;
            z=0;
 
        }
         
    }
}



Measured memory_bytes: 31256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		int T = sc.nextInt();
		int S = sc.nextInt();
		if(S * T >= D){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	}
}


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

using namespace std;

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

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

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

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

  int H, W;
  while(cin>>H>>W,H){
	vector<string> lns(H);
	REP(i,H) cin>>lns[i];

	map<string, int> mpsi;
	REP(y,H) REP(x,W){
	  REP(i,8){
		int tx = x, ty = y;
		string s = "";
		vector< vector<bool> > used(H, vector<bool>(W, false));
		while(true){
		  if(used[ty][tx]) break;
		  used[ty][tx] = true;
		  s.append(1, lns[ty][tx]);
		  tx = (tx + dx[i] + W) % W;
		  ty = (ty + dy[i] + H) % H;
		  mpsi[s]++;
		}
	  }
	}
	int len = 0;
	string s = "";
	for(auto it=mpsi.begin();it!=mpsi.end();++it){
	  if(it->second < 2) continue;
	  if(len < SZ(it->first) || (len == SZ(it->first) && it->first < s))
		len = SZ(it->first), s = it->first;
	}

	if(len < 2) cout << 0 << endl;
	else cout << s << endl;
  }
  
  return 0;
}

Measured memory_bytes: 36040
#include <bits/stdc++.h>
using namespace std;
int s[3];

int main() {
    char ch=getchar();
    while (ch>='a' && ch<='c') {
        s[ch-'a']++;
        ch=getchar();
    }
    sort(s,s+3);
    s[1]-=s[0],s[2]-=s[0],s[0]=0;
    if (s[1]>1 || s[2]>1) puts("NO");
    else puts("YES");
    return 0;
}

Measured memory_bytes: 256