akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>

#define INF 1000000000
using namespace::std;



long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmin(long x, long y) {
	if (x < y)return x;
	return y;
}


int min(int x, int y) {
	if (x < y)return x;
	return y;
}

int abs(int x) {
	if (x < 0) {
		return -x;
	}
	return x;
}


int point,N;
int H,X,Y ,Z,T, R, G,A[2002],B[2000], M, K, W, t[101], v[101], ans, now;
string S,s;
long long a, b, c;
int main() {
	cin >> N;
	a = 2;
	b = 1;
	c = 0;
	if (N == 1) {
		cout << 1 << endl;
		return 0;
	}
	for (int i = 0; i < N-1; i++) {
		c = a + b;
		a = b;
		b = c;
	}

	cout << c<< endl;
	return 0;
}




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

int n, cnt = 0;
string s;

int main() {
  cin >> n >> s;
  for(int i = 0; i < n; ++i)
    if(s[i] == 'R') ++cnt;
  if(cnt > n - cnt)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

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

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

int main(){
  int N;
  long long K;
  
  cin >> N >> K;
  
  vector<int>vec(N);
  vector<int>data(N);
  
  rep(i,N) cin >> vec.at(i);

  int count = 1;
  rep(i,N){
    data.at(i) = vec.at(count - 1);
    count = vec.at(count - 1);
  }
  
  int s = 1;
  while(true){
    if(data.at(N-1) == data.at(N-1-s)) break;
    s ++;
  }
  
  if(N >= K) cout << data.at(K - 1) << endl;
  
  else cout << data.at(N - s + ((K-N)%s) - 1 ) << endl;
}
    




Measured memory_bytes: 4844
#include <stdio.h>

int main(void) {

	int A;
	int B;

	scanf("%d", &A);
	scanf("%d", &B);     
  
    if(A >= 13){
      printf("%d",B);
    }
    else if(A <= 5){
      puts("0");
    }
    else{
      printf("%d",B/2);
    }
      
  
	return 0;
}



Measured memory_bytes: 128
#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

const double PI = acos(-1);
constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class Task{
public:
    void solve(istream& in, ostream& out){
        const int MX = ten(5);
        int N;
        lint M;
        in>>N>>M;
        vc<int> A(N);
        vc<lint> B(2*MX+2, 0), C(2*MX+2, 0);
        for(auto& a : A){
            in>>a;
            B[a]++, C[a] += a;
        }
        for(int i=MX-1;0<=i;--i){
            B[i] += B[i+1];
            C[i] += C[i+1];
        }
        int left = 0, right = 2 * MX + 1;
        auto check = [&](int x){
            lint b = 0, g = 0;
            REP(i, N){
                int id = max(0, x-A[i]);
                b += B[id];
                g += B[id] * A[i] + C[id];
            }
            return make_pair(b, g);
        };
        while(1<right-left){
            int mid = (left+right) >> 1;
            if(check(mid).first>=M) left = mid;
            else right = mid;
        }
        auto p = check(left);
        out<<p.second-left*(p.first-M)<<'\n';
    }
};

int main(){
    istream& in(cin);
    ostream& out(cout);
    ios_base::sync_with_stdio(false);
    in.tie(nullptr), out.tie(nullptr);
    Task solver;
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 3840
# include <iostream>
using namespace std;
int main(){
	int a, b;
	long int sum=0;
	int n = 0;
	while (cin >> a >> b)
	{
		sum = a + b;
	
	
	while (sum>=1)
	{
		++n;
		sum /= 10;
		
	}
	cout << n << endl;
	n = 0;

	}
	return 0;
	
	/*Javad SHeybani*/
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int N=cin.nextInt();
        int count=N/100;
        int mod=N%100;
        if(count*5<mod)Console.WriteLine(0);
        else Console.WriteLine(1);
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define Rep(i,j,n) for(int i=j; i<n; i++)
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int n; cin >> n;
    int ans=0;
    rep(i,n){
        int a,b; cin >> a >> b;
        if(a==b) ans++;
        else ans=0;
        if(ans>=3){
            cout << "Yes" << endl;
            return 0;
        }
    }
    if(ans>=3){
            cout << "Yes" << endl;
            return 0;
        }
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3676
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int p;
    scanf("%d", &p);

    vector<int> a(p);
    int i;
    for(i=0; i<p; i++) {
        scanf("%d", &a[i]);
    }

    vector<int> b(p);
    for(i=0; i<p; i++) {
        if(a[i]) {
            if(i==0) {
                b[p-1]=1;
                b[0]=p-1;
            }
            else {
                int k;
                int curr=1;
                for(k=0; k<p-1; k++) {
                    if(k>0) {
                        curr=curr*i%p;
                    }
                    b[p-1-k]=(b[p-1-k]+curr)%p;
                }
            }
        }
    }

    for(i=0; i<p; i++) {
        printf("%d ", (p-b[i]+p)%p);
    }
    printf("\n");

    return 0;
}


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

using namespace std;

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

  int x;
  cin >> x;

  int ans = 1;
  for (int i = 2; i < 32; ++i) {
    int j = 2;
    int a = pow(i, j);
    while (a <= x) {
      ans = max(ans, a);
      ++j;
      a = pow(i, j);
    }
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 4116
//Shubham Vijayvargiya

#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 pb push_back
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
#define sz(a) (int)(a.size())
#define set(a,b) memset(a,b,sizeof(a))
#define let(x,a) __typeof(a) x(a)
#define rep(i, begin, end) for (ll i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) (v).begin(),(v).end()
#define sll(x) { scanf("%lld",&x); }
#define si(x) { scanf("%d",&x); }
#define slf(x) { scanf("%lf",&x); }
#define pll(x) { printf("%lld\n",x); }
#define pi(x) { printf("%d\n",x); }
#define tcases() long long testcases; cin>>testcases ; while(testcases--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " = " << arg1<<" | ";__f(comma+1, args...);
}

#else
#define trace(...)
#endif

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<long long,long long> pll;
typedef vector<long long> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;

const ll mod=1000000007;
//-----------------------------------------------------------------------------------------------------------------------------------------------//
#define N 100009
ll c[N];

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

	ll n,a,b;
	sll(n);sll(a);sll(b);
	rep(i,0,n){
		sll(c[i]);
	}
	ll ans=0;
	rep(i,1,n){
		ans+=min((c[i]-c[i-1])*a,b);
	}
	cout<<ans<<endl;
	return 0;
}



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

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(),(a).end()
#define pii pair<ll,ll>
#define rep(x,n) for(ll i=x;i<n;++i)
#define repd(x,n) for(ll i=x-1;i>=n;--i)
#define repn(x,n) for(ll j=x;j<n;++j)
#define repnd(x,n) for(ll j=x-1;j>=n;--j)
#define endl '\n'
#define M 1000000007
const ll INF = 1ll<<60;

using namespace std;

ll fact(ll n){ ll p=1; rep(1,n+1){ p*=i; } return p; }

bool isprime(ll a){
    if(a==2) {
        return 1;
    }
    if(!(a&1) ) {return 0;}
    for(ll i=3;i*i<=a;i+=2){
        if(a%i==0) {return 0;}
    }
    return 1;
}

ll fast_power(long long base, long long power)  //for(2^100)
{   long long result=1;
    while(power>0) {
        if(power&1) {
            result=(result*base)%M;
        }
        base=(base*base)%M;
        power>>=1;
    }
    return result;
}

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

    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    if(a>=k) cout<<min(a,k)<<endl;
    else if(a+b>=k) cout<<a<<endl;
    else if(a+b+c>=k){
        ll f=(k-a-b);
        cout<<a-f<<endl;
    }
//    cout<<ans<<endl;

	return 0;
}



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

using namespace std;

int xy[101][101],W,H,N;

int main(){
  scanf("%d %d %d",&W,&H,&N);

  int x,y,a;

  for(int i=0;i<N;i++){
    scanf("%d %d %d",&x,&y,&a);
    switch (a) {
      case 1:for(int j=0;j<x;j++){
        for(int k=0;k<H;k++){
          xy[j][k]=1;
        }
      }
      break;
      case 2:for(int j=x;j<W;j++){
        for(int k=0;k<H;k++){
          xy[j][k]=1;
        }
      }
      break;
      case 3:for(int j=0;j<y;j++){
        for(int k=0;k<W;k++){
          xy[k][j]=1;
        }
      }
      break;
      case 4:for(int j=y;j<H;j++){
        for(int k=0;k<W;k++){
          xy[k][j]=1;
        }
      }
      break;
      default: break;
    }
  }

  int maxW=0,maxH=0;

  for(int i=0;i<H;i++){
    int cnt=0;
    for(int j=0;j<W;j++){
      if(xy[j][i]==0) cnt++;
    }
    maxW=max(cnt,maxW);

  }

  for(int i=0;i<W;i++){
    int cnt=0;
    for(int j=0;j<H;j++){
      if(xy[i][j]==0) cnt++;
    }
    maxH=max(cnt,maxH);

  }

  int S=(maxH)*(maxW);

  //check_s
  //printf("%d %d\n",maxH,maxW);
  //check_e

  printf("%d",S);

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int[] d = new int[n];
      for(int i=0;i<n;i++){
        d[i]= scan.nextInt();
      }
      Arrays.sort(d);
      System.out.println(d[n/2]-d[n/2-1]);
	}
}

Measured memory_bytes: 49772
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <math.h>
#define PI 3.14159265359
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {

	// 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);

	int R;
	cin >> R;


	cout << PI * R * 2 << endl;

	return 0;
}


Measured memory_bytes: 3264
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from sys import *

lis = {"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000,"\n":0}

for s in stdin:
  num = 0
  for i in xrange(len(s)-1):
    if lis[s[i]] < lis[s[i+1]]: num -= lis[s[i]];
    else: num += lis[s[i]]
  print num

Measured memory_bytes: 4212
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

ll power(ll x,ll n)
{
    if(n==0){return 1;}
    if(n==1){return x;}
    if(n%2==0){
        return power((x*x)%M,n/2);
    }
    if(n%2==1){
        return (power((x*x)%M,n/2)*x)%M;
    }
}

ll fac[N];

ll ncr(ll n,ll r){
    ll num=fac[n];
    ll denum=(fac[r]*fac[n-r])%M;
    ll ans=(num*power(denum,M-2))%M;
    return ans;
}

ll npr(ll n,ll r){
    ll num=fac[n];
    ll denum=fac[n-r];
    ll ans=(num*power(denum,M-2))%M;
    return ans;
}

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

    fac[0]=1;
    for(ll i=1;i<N;++i){
        fac[i]=(i*fac[i-1])%M;
    }

    ll n,m;
    cin>>n>>m;
    ll a=npr(m,n);
    ll b=a;
    for(ll i=1;i<=n;++i){
        ll ch=(ncr(n,i)*npr(m-i,n-i))%M;
        if(i%2){
            a=(a-ch+M)%M;
        }
        else{
            a=(a+ch)%M;
        }
    }
    ll ans=(a*b)%M;
    cout<<ans;

    return (0);
}


Measured memory_bytes: 7520
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

int dp[7][100010];
int main() {
    int X; cin >> X;
    vector<int> v = {100, 101, 102, 103, 104, 105};

    const int MAXP = 100005;
    dp[0][0] = true;
    for(int i=0; i<6; i++) {
        for(int j=0; j<MAXP; j++) {
            dp[i+1][j] |= dp[i][j];
            int nj = j + v[i];
            if(nj < MAXP) dp[i+1][nj] |= dp[i+1][j];
        }
    }
    cout << dp[6][X] << endl;
    return 0;
}


Measured memory_bytes: 2560
fun main(args:Array<String>) {
    val (h,w) = readLine()!!.split(" ").map { it.toInt() }
    Pos.h = h
    Pos.w = w
    val map = (1..h).map { readLine()!! }
    val step = (1..h*w).map { (1..h*w).map { h*w+1 }.toMutableList() }
    val index = (0 until h*w).map { Pos(it/w, it%w) }
    for(i in (0 until  h*w)) {
        for(j in (0 until h*w)) {
            if(map[index[j].r][index[j].c] == '#') {
                continue
            }
            for(k in (0 until h*w)) {
                if(map[index[k].r][index[k].c] == '#') {
                    continue
                }
                if(j == k) {
                    step[j][k] = 0
                    continue
                }
                if(index[j].isNear(index[k])) {
                    step[j][k] = 1
                    continue
                }
                if(map[index[i].r][index[i].c] == '#') {
                    continue
                }
                if(step[j][k] > step[j][i] + step[i][k]) {
                    step[j][k] = step[j][i] + step[i][k]
                }
            }
        }
    }
    val ans =  step.map { it.filter { it != h*w+1 }.max()?:0 }.max() ?:0
    println(ans)
}

class Pos(val r:Int, val c:Int) {
    fun getIndex():Int {
        return r*w+c
    }
    fun isSame(target: Pos):Boolean {
        return r == target.r && c == target.c
    }
    fun isNear(target:Pos):Boolean {
        if(isSame(target)) {
            return false
        }
        if(r ==target.r && Math.abs(c-target.c) == 1) {
            return true
        }
        if(c == target.c && Math.abs(r-target.r) == 1) {
            return true
        }
        return false
    }
    companion object {
        var h:Int = -1
        var w:Int = -1
    }
}

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

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

    int n,x;
    cin >> n >> x;
    int l[n];
    rep(i,n) cin >> l[i];
    
    int d[n+1];
    d[0] = 0;
    
    for(int i=1; i<n+1; i++){
        d[i] = d[i-1] + l[i-1];
    }
    
    int ans = 0;
    rep(i,n+1){
        if(x>=d[i]) ans++;
    }
    
    cout << ans << endl;

    return 0;
}

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


int main(){
	int n;
	cin >> n;
	vector<long long int> arr;
	int temp;
	for(int temp1=0;temp1<n;temp1++){
		cin >> temp;
		arr.push_back(temp);
	}
	int i,j,k;
	int count=0;
	for(i=0;i<n-2;i++){
		for(j=i+1;j<n-1;j++){
			for(k=j+1;k<n;k++){
				if((arr[i] + arr[j] )>arr[k]){
					if((arr[i]!=arr[j]) && (arr[j]!=arr[k]) && (arr[k]!=arr[i]) && abs(arr[i] - arr[j]) <arr[k]){
						count++;
					}
				}
				else if((arr[i] + arr[k] )>arr[j]){
					if((arr[i]!=arr[j]) && (arr[j]!=arr[k]) && (arr[k]!=arr[i]) && abs(arr[i] - arr[k]) <arr[j]){
						count++;
					}
				}
				else if((arr[j] + arr[k] )>arr[i]){
					if((arr[i]!=arr[j]) && (arr[j]!=arr[k]) && (arr[k]!=arr[i]) && abs(arr[j] - arr[k])<arr[i]){
						count++;
					}
				}

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

Measured memory_bytes: 3632
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;

  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long, long long>;

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

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

  ll n,k;
  std::cin>>n>>k;

  std::vector<ll> a(n);
  rep(i,0,n)std::cin>>a[i];

  std::vector<ll> sum(n+1,0);
  rep(i,1,n+1)sum[i]=sum[i-1]+a[i-1];

  std::vector<ll> seg;

  rep(i,0,n){
    rep(j,i+1,n+1){
      seg.push_back(sum[j]-sum[i]);
    }
  }

  ll ans=0;

  for(ll i=41;i>=0;i--){
    ll cnt=0;
    for(ll num:seg){
      if(((ans+(1ll<<i))&num)==(ans+(1ll<<i)))cnt++;
    }
    if(cnt>=k)ans+=(1ll<<i);
  }

  std::cout<<ans<<"\n";

  return 0;
}

Measured memory_bytes: 6128
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false

signed main(void){
    string S;
    cin >> S;
    if(S[0]=='7' ||S[1]=='7' ||S[2]=='7'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3596
n=int(input())
alis=[0]+list(map(int,input().split()))+[0]
deflis=[]
for i in range(n+1):
	d=abs(alis[i+1]-alis[i])
	deflis.append(d)
defsum=sum(deflis)
for i in range(n):
	ans=defsum-sum(deflis[i:i+2])+abs(alis[i+2]-alis[i])
	print(ans)

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

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


SINT32 main() {
    SINT32 data[100] = {0};

    SINT8 s[200001] = {'0'};
    scanf("%s",s);


        if (s[0] == 'A') {
            data[0] = 1;

        } else if (s[0] == 'T') {
            data[0] = 1;

        } else if (s[0] == 'G') {
            data[0] = 1;

        } else if (s[0] == 'C') {
            data[0] = 1;

        } else {
            data[0] = 0;
        }


    for ( int i = 1; i < 20; i++ ) {
        if (s[i] == 'A') {
            data[i] = data[i-1] + 1;

        } else if (s[i] == 'T') {
            data[i] = data[i-1] + 1;

        } else if (s[i] == 'G') {
            data[i] = data[i-1] + 1;

        } else if (s[i] == 'C') {
            data[i] = data[i-1] + 1;

        } else {
            data[i] = 0;
        }
    }

    SINT32 ans = 0;
    for ( int i = 0; i < 20; i++ ) {
        if (data[i] > ans) {
            ans = data[i];
        }
    }




    
    printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int dp[n + 1];
    rep(i, 0, n + 1) dp[i] = INF;
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 1; i + j <= n; j *= 6) {
            dp[i + j] = min(dp[i + j], dp[i] + 1);
        }
        for (int j = 1; i + j <= n; j *= 9) {
            dp[i + j] = min(dp[i + j], dp[i] + 1);
        }
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 640
line = input().split(' ')
a, b, c, d = int(line[0]), int(line[1]), int(line[2]), int(line[3])

if abs(a-c) <= d:
	print('Yes')
else:
	if abs(a-b) <= d and abs(b-c) <= d:
		print('Yes')
	else:
		print('No')
	

Measured memory_bytes: 2940
unittest
{
	assert( [ "3 70", "7 60", "1 80", "4 50" ].parse.expand.solve == "4" );
	assert( [ "4 3", "1 1000", "2 4", "3 1000", "4 500" ].parse.expand.solve == "TLE" );
	assert( [ "5 9", "25 8", "5 9", "4 10", "1000 1000", "6 1" ].parse.expand.solve == "5" );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nt = input.front.split.to!( long[] );
	auto cts = new long[ 2 ][ nt[ 0 ] ];
	foreach( ref ct; cts )
	{
		input.popFront;
		ct = input.front.split.to!( long[] );
	}
	return tuple( nt[ 1 ], cts );
}

auto solve( long t, long[ 2 ][] cts )
{
	auto c = long.max;
	foreach( i, ct; cts )
	{
		if( ct[ 1 ] <= t && ct[ 0 ] < c ) c = ct[ 0 ];
	}
	if( c < long.max ) return c.to!string;
	else               return "TLE";
}


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

void Main() {
  string s, t;
  int a, b;
  string u;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;
  if (u == s) cout << a - 1 << " " << b << endl;
  else cout << a << " " << b - 1 << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;
int main(){ 
   string s;
   cin>>s;
   
   
   do{
      s.pop_back();
      s.pop_back();
      int flag=1;
      rep(i,s.size()/2){
         if(s[i]!=s[s.size()/2+i]) {
            flag=0;

            break;
         }

      }
      if(flag==1){
         cout<<s.size();
         break;
      }
   }while(1);

return 0;
}

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

k = abs(a- (t - h[0] * 0.006))
candidate = 0
for i in range(n):
    avg_tmp = t - h[i] * 0.006
  #  print(avg_tmp)
    if k >= abs(a - avg_tmp):
        candidate = i + 1
        k = abs(a - avg_tmp)

print(candidate)

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int H, W;
string A[105];
bool B[105], C[105];

int main()
{
    cin >> H >> W;
    REP(i, H)
    {
        cin >> A[i];
    }

    REP(i, H)
    {
        bool t = true;
        REP(j, W)
        {
            if (A[i][j] == '#')
            {
                t = false;
                break;
            }
        }
        B[i] = t;
    }
    REP(i, W)
    {
        bool t = true;
        REP(j, H)
        {
            if (A[j][i] == '#')
            {
                t = false;
                break;
            }
        }
        C[i] = t;
    }

    REP(h, H)
    {
        REP(w, W)
        {
            if (B[h] || C[w])
                continue;
            cout << A[h][w];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll ncr[2005][2005];
void init_ncr(){
    for(int i=0;i<2000;i++){
        ncr[i][0]=1;
        for(int j=1;j<i+1;j++){
            ncr[i][j]=ncr[i-1][j-1]+ncr[i-1][j];
            ncr[i][j]%=MOD;
        }
    }
}

int main(void){
    init_ncr();
    ll n,k;
    cin>>n>>k;
    ll blue=k;
    ll red=n-k;
    ll res=0;
    res=red+1;
    cout<<res<<endl;
    for(int i=2;i<=k;i++){
        if(red+1<i){
            cout<<0<<endl;
            continue;
        }
        res=ncr[blue-1][i-1]*ncr[red+1][i]%MOD;
        cout<<res<<endl;
    }
}

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

using namespace std;

set<int> s;
vector<int> v;
int n;
int main() {
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        if(s.count(x)) {
            s.erase(x);
            v.push_back(x);
        } else {
            s.insert(x);
        }
    }
    sort(v.rbegin(), v.rend());
    if(v.size() < 2) printf("0\n");
    else printf("%lld\n", 1LL * v[0] * v[1]);
    return 0;
}

Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_140
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            long[] bs = ReadLongs();
            long res = 0;
            for(int i = 0; i < n; i++)
            {
                if (i == 0)
                {
                    res += bs[0];
                }
                else if (i == n - 1)
                {
                    res += bs[n - 2];
                }
                else
                {
                    res += Min(bs[i - 1], bs[i]);
                }
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <algorithm>

using namespace std;

void addPatterns(set<string> &patterns, const char *input, int pivot, int length){
	char tmp[73];
	// »ÌÜÜ
	strcpy(tmp, input);
	patterns.insert(string(tmp));
	// O¼¾¯½]
	strcpy(tmp, input);
	reverse(tmp, tmp + pivot);
	patterns.insert(string(tmp));
	// ã¼¾¯½]
	strcpy(tmp, input);
	reverse(tmp + pivot, tmp + length);
	patterns.insert(string(tmp));
	// ¼ûÆà½]
	strcpy(tmp, input);
	reverse(tmp, tmp + pivot);
	reverse(tmp + pivot, tmp + length);
	patterns.insert(string(tmp));
}

int main(){
	int m;
	scanf("%d", &m);
	while(m--){
		char input[73];
		scanf("%s", input);
		set<string> patterns;
		int length = strlen(input);
		for(int i = 1; i < length; i++){
			addPatterns(patterns, input, i, length);
			// OãüêÖ¦
			char tmp[150];
			int j = length - i;
			strcpy(tmp, input + i);
			strcpy(tmp + j, input);
			tmp[length] = '\0';
			addPatterns(patterns, tmp, j, length);
		}
		printf("%d\n", patterns.size());
	}
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)

#include <algorithm>
using namespace std;
#include <cmath>
#include <string>
#include<vector>
#define elif else if
typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 200005
ll N;

int dfs(ll num){
    if(num>N) return 0;
    bool three_flag =false;
    bool five_flag =false;
    bool seven_flag =false;
    ll tmp = num; 
    while(tmp > 0){
        int digit = tmp %10;
        if(digit == 3){
            three_flag = true;            
        } 
        if(digit == 5){
            five_flag = true;
        }
        if(digit == 7){
            seven_flag = true;
        }
        if(three_flag && five_flag && seven_flag)break;
        tmp /= 10; 
        
    }
    
    ll ret = 0;
    if(three_flag &&five_flag&& seven_flag)
        ret = 1;

    int list[3] = {7,5,3};
    rep(i,3){
        ret += dfs(10*num + list[i]); 
    }
    return ret;    

}


int main(){
    cin>>N;
    ll ans = dfs(0);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
(setq n(read))(setq m(read))
(setq a(loop for i from 1 to n collect(read-line)))
(setq b(loop for i from 1 to m collect(read-line)))
(setq s 0)
(dotimes(i (1+(- n m)))
  (dotimes(j (1+(- n m)))
	(setq c 1)
	(dotimes(k m)
	  (dotimes(l m)
		(if(char/=(char(nth(+ i k)a)(+ j l))(char(nth k b)l))(setq c 0))))
	(setq s(+ s c))))
(princ(if(> s 0)"Yes""No"))

Measured memory_bytes: 16096
i = 0
W = H = x = y = r = ''


line = input()

while line[i] != ' ':
    W = W + line[i]
    i += 1

i += 1
while line[i] != ' ':
    H = H + line[i]
    i += 1

i += 1
while line[i] != ' ':
    x = x + line[i]
    i += 1

i += 1
while line[i] != ' ':
    y = y + line[i]
    i += 1
    
i += 1
while i < len(line):
    r = r + line[i]
    i += 1
    
W = int(W)
H = int(H)
x = int(x)
y = int(y)
r = int(r)


if x-r >= 0 and x+r <= W and y-r >= 0 and y+r <= H:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 7720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vector<char> v;
  for(int i=0;i<n;++i) {
    char tmp; cin >> tmp;
    if(tmp != '-') {
      v.push_back(tmp);
    }
  }
  n = (int)(v.size());
  vector<vvll> dp(n+1, vvll(n+1, vll(n+1, 0)));
  dp[0][0][0] = 1;
  for(int i=0;i<n;++i) {
    for(int j=0;j<n;++j) {
      for(int k=0;k<n;++k) {
        if(v[i] == 'D') {
          if(j && k) {
            dp[i+1][j-1][k-1] += dp[i][j][k] * j * k;
            dp[i+1][j-1][k-1] %= MOD;
          }
          dp[i+1][j][k] += dp[i][j][k] * j;
          dp[i+1][j][k] %= MOD;
        } else {
          dp[i+1][j][k] += dp[i][j][k] * k;
          dp[i+1][j][k] %= MOD;
          dp[i+1][j+1][k+1] += dp[i][j][k];
          dp[i+1][j+1][k+1] %= MOD;
        }
      }
    }
  }
  cout << dp[n][0][0] << endl;
}



Measured memory_bytes: 63380
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[100009];
ll sum1=0,sum2=0;
ll ans1=0,ans2=0;
int main()
{
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    if(a[1]>0)
    {
        sum1=a[1];
        ans2=a[1]+1;
        sum2=-1;
    }
    else if(a[1]==0)
    {
        sum1=1;
        ans1=1;
        ans2=1;
        sum2=-1;
    }
    else
    {
        sum1=1;
        ans1=abs(a[1])+1;
        sum2=a[1];
    }
    for(int i=2; i<=n; i++)
    {
        if(sum1>0)
        {
            if(sum1+a[i]>=0)
            {
                ans1+=sum1+a[i]+1;
                sum1=-1;
            }
            else
            {
                sum1+=a[i];
            }
        }
        else if(sum1<0)
        {
           if(sum1+a[i]<=0)
           {
               ans1+=abs(sum1+a[i])+1;
               sum1=1;
           }
           else
           {
               sum1+=a[i];
           }
        }
    }
    if(sum1==0)
    {
        ans1++;
    }


    for(int i=2; i<=n; i++)
    {
        if(sum2>0)
        {
            if(sum2+a[i]>=0)
            {
                ans2+=sum2+a[i]+1;
                sum2=-1;
            }
            else
            {
                sum2+=a[i];
            }
        }
        else if(sum2<0)
        {
           if(sum2+a[i]<=0)
           {
               ans2+=abs(sum2+a[i])+1;
               sum2=1;
           }
           else
           {
               sum2+=a[i];
           }
        }
    }
    if(sum2==0)
    {
        ans2++;
    }
    cout<<min(ans1,ans2)<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  string a;
  cin>>a;
  ll b=a.size();
  ll c=(b-1)/2;
  for(ll i=0;i<c/2+1;i++){
    if(a.at(i)!=a.at(c-i-1)){
      cout<<"No"<<endl;
      return 0;
    }
  }
  for(ll i=0;i<c+1;i++){
    if(a.at(i)!=a.at(c-i+c)){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
      
  
}


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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 61) - 1;

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

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

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

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

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

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

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

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

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

int main() {
  vector< int > V(3);
  cin >> V;
  if(V[0] == V[1] && V[1] == V[2]) puts("Yes");
  else puts("No");
}

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

using namespace std;

bool compare_size(int p1, int p2, int p3, int middle_num){
	int p_sort[3];
		p_sort[0] = p1;
		p_sort[1] = p2;
		p_sort[2] = p3;

	sort(p_sort,p_sort+3);
//	for(int i=0 ; i<3; i++){
//		cout<<p_sort[i]<<" ";
//	}
//	cout<<endl;
	if(middle_num == p_sort[1]){
		return true;
	}

	return false;
}
int main(){
	/*input*/
	int n;
    cin >> n;
	int p[n];
	for(int i=0; i<n;i++){
	  cin >> p[i];

	}

	/*calc*/
	int ans = 0;
	int middle_num;
	bool judge;
	for(int i = 0; i < n-2; i++){
		middle_num = p[i+1];
		judge = compare_size(p[i],p[i+1],p[i+2],middle_num);
		if(judge == true){
			ans++;
		}
	}

	/*output*/
   	cout<<ans<<endl;
    return 0;
}


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

int A,B; float C;

int main(){
ios_base::sync_with_stdio(false);

cin >> A >> B >> C;
int ans = 0;

for (int i = 1; A*i < C + 0.5; i++)
{
    ans += B;
}

cout << ans;
cin >> A;
}

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

using lli = long long int;

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

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

int main(void){
    unordered_map<string, int> a;
    a["SUN"] = 7;
    a["MON"] = 6;
    a["TUE"] = 5;
    a["WED"] = 4;
    a["THU"] = 3;
    a["FRI"] = 2;
    a["SAT"] = 1;
    string s;
    cin >> s;
    cout << a[s] << endl;
    return 0;
}


Measured memory_bytes: 256
n,q = map(int,input().split()) 
a = list(input())
dp = [0]*n
cou_AC = 0

for i in range(n-1):
     if (a[i] == "A") and (a[i+1] == "C"):
          cou_AC += 1
     dp[i+1] = cou_AC

for i in range(q):
     s,e = map(int,input().split())
     s,e = s-1,e-1
     ans = dp[e]-dp[s]
     print(ans)

Measured memory_bytes: 54576
use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
        xy: [(i64, i64); n],
    }

    if n == 1 {
        println!("1");
        return;
    }

    let mut map = HashMap::new();

    for (x0, y0) in xy.iter() {
        for (x1, y1) in xy.iter() {
            if x0 == x1 && y0 == y1{
                continue;
            }
            *map.entry((x1-x0, y1-y0)).or_insert(0) += 1;
        }
    }

    let mut ans = None;
    for (key, val) in map {
        if let Some((key_max, val_max)) = ans.as_mut() {
            if *val_max < val {
                *key_max = key;
                *val_max = val;
            }
        } else {
            ans = Some((key, val));
        }
    }

    let ans = n - ans.unwrap().1;

    println!("{}", ans);
}


Measured memory_bytes: 2256
n = int(input())
s = ""
for i in range(1,n+1):
    if(i % 3 == 0):
        s+= " "+str(i)
    else:
        x = i
        while x:
            if(x % 10 == 3):
                s+= " "+str(i)
                break
            x //= 10
print(s)

Measured memory_bytes: 7648
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <sstream>
using namespace std;

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

	string abcd;
	cin >> abcd;
	vector<int> a(4);
	for (int i = 0; i < 4; ++i) {
		char ctos[2] = {abcd[i]};
		a[i] = stoi(ctos);
	}
	const unsigned int RIGHT = 0x0001;
	const unsigned int MID = 0x0002;
	const unsigned int LEFT = 0x0004;
	vector <int> answers(8);
	for (unsigned int i = 0; i < 8; ++i) {
		vector<int> calcu(a);
		if (RIGHT & i) {
			calcu[3] = -calcu[3];
		}
		if (MID & i) {
			calcu[2] = -calcu[2];
		}
		if (LEFT & i) {
			calcu[1] = -calcu[1];
		}
		
		answers[i] = accumulate(calcu.begin(), calcu.end(), 0);
	}
	int answer_count = 99;
	for (int i = 0; i < 8; ++i) {
		if (answers[i] == 7) {
			answer_count = i;
			break;
		}
	}

	// ---
	char r = (RIGHT & answer_count ? '-' : '+');
	char m = (MID & answer_count ? '-' : '+');
	char l = (LEFT & answer_count ? '-' : '+');
	ostringstream ss;
	ss << a[0] << l << a[1] << m << a[2] << r << a[3] << "=7";
	cout << ss.str() << endl;
	return 0;
}

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

long long n;
int ans;

int main() {
    cin >> n;
    if(n == 1) {
        cout << 0;
        return 0;
    }
    long long x = sqrt(n);
    for(long long i = 2; i < x; i++) {
        int e = 0;
        long long pow = i;
        while(n%pow == 0) {
            e++;
            n /= pow;
            pow *= i;
        }
        while(n%i == 0) n /= i;
        ans += e;

        if(n == 1) {
            cout << ans;
            return 0;
        }
    }
    ans++;
    cout << ans;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    vector<int> v(4);
    rep(i, 3) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        v[a]++; v[b]++;
    }

    sort(v.rbegin(), v.rend());

    if (v[0] == 2 && v[1] == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <iostream>

long count(int d, int e, int f);
int k, a, b,  m = 0, sum = 0;
long kekka = 1;
int main()
{
	std::cin >> k >> a >> b;
	count(k, a, b);
}

long count(int d, int e, int f)
{
	//std::cout << d << " " << e << " " << f << std::endl;
	for(int i = 1; i <= d; i++)
	{
		if(f < e | f-e == 1)
		{
			kekka++;
		}else if(0 < m)
		{
			m = m - 1;
			kekka = kekka + f;
		}else if(e <= kekka & i !=d)
		{
			kekka = kekka - e;
			m += 1;
		}else
		{
			kekka++;
		}
	}
	std::cout << kekka;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b;
  cin>>n>>a>>b;
  int s=0;
  for(int i=1;i<=n;i++){
    int x=i;
    int si=0;
    while(x>0){
      si+=x%10;
      x/=10;
    }
    if(si>=a&&si<=b)
      s+=i;
  }
  cout<<s<<endl;
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  if (a[a.size() - 1] == b[0] &&b[b.size() - 1] == c[0]) cout << "YES\n";
  else cout << "NO\n";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(void) {
    const int N = []() {
      	int tmp; std::cin >> tmp;
      	return tmp;
    }();
  
    for(int n = N; n >= 0; n -= 7) {
        if(n % 4 == 0) {
            std::cout << "Yes\n";
            return 0;
        }
    }
  
    std::cout << "No\n";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int tmp;
        while (true){
            int referee = sc.nextInt();
            if (referee == 0) break;
            int sum = sc.nextInt(), max = sum, min = sum;
            for (int i = 1; i < referee; i++){
                tmp = sc.nextInt();
                sum += tmp;
                if(tmp >= max) max = tmp;
                else if(tmp <= min) min = tmp;
            }
            sum -= max + min;
            System.out.println(sum / (referee - 2));
        }
    }
}

Measured memory_bytes: 29144