akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int n;
  std::cin >> n;
  std::vector<int> v;
  for(int i=0; i<n; i++){
    int m;
    std::cin >> m;
    v.push_back(m);
  }

  int ans=0;
  for(int i=0; i<n-1; i++){
    int k=i,cnt=1;
    while(v[k]==v[k+1]){
      cnt++;
      v[k+1]=-1;
    }
    ans+=cnt/2;
  }

  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fill fill_n
#define pf push_front
#define pb push_back
#define FOR(i,l,r) for(int i=l;i<r;i++)
#define ROF(i,r,l) for(int i=r;i>=l;i--)
#define comp(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define infile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
typedef vector<int> vi;
typedef vector<ll> vli;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvli;
const int M = 1e9+7;
const int N = 2e5;
ll po(int,int);


void solve(){
    int n,k;
    cin>>n>>k;
    int a[n];
    int ans[k+1]={0};
    FOR(i,0,n){ 
     cin>>a[i];
     ans[a[i]]=1;
    }
   // FOR(i,0,k+1) cout<<ans[i]<<" ";
    FOR(i,1,k+1){
        //cout<<i<<" ";
        if(ans[i]==0){
        ans[i]=2;
        FOR(j,0,n){
            //if(a[j]<i && i==4) cout<<ans[i-a[j]]<<" ";
            if(a[j]<=i && ans[i-a[j]]==2){
                ans[i]=1;
                break;
            }
        }
        }
    }
     //FOR(i,0,k+1) cout<<ans[i]<<" ";
    if(ans[k]==1) cout<<"First\n";
    else cout<<"Second\n";
    
    
}





int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    
	return 0;
	
	
}


ll po(int a,int b){
    if(b==0) return 1;
    ll ans=1;
    if(b%2==0){
        ans = po(a,b/2)%M;
        ans=(ans%M * ans%M)%M;
    }
    else{
        ans = po(a,(b-1)/2)%M;
        ans = (ans%M * ans%M * a)%M;
    }
    return ans%M;
}


Measured memory_bytes: 4004
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

struct Score {
    int id;
    int solve;
    int time;

    Score () : id(0), solve(0), time(0) {}
    ~Score () {}

    Score(int a, int b, int c) : id(a), solve(b), time(c) {}

    bool operator < (const Score& o) const {
        if(solve != o.solve) return solve > o.solve;
        if(time != o.time) return time < o.time;
        return id > o.id;
    }

    bool operator == (const Score& o) const {
        return solve == o.solve && time == o.time;
    }
};

int main () {
    int M, T, P, R;

    while (true) {
        cin >> M >> T >> P >> R;
        if (M == 0) return 0;

        vector<vector<char>> solved(T, vector<char>(P, 0));
        vector<vector<int> > time(T, vector<int>(P, 0));
        vector<vector<int> > miss(T, vector<int>(P, 0));

        for (int i = 0; i < R; ++i) {
            int m, t, p, j;
            cin >> m >> t >> p >> j;
            --t; --p;

            if (j == 0) {
                solved[t][p] = 1;
                time[t][p] = m;
            } else {
                ++ miss[t][p];
            }
        }

        vector<Score> scores;

        for (int i = 0; i < T; ++i) {
            int s = 0, t = 0;
            for(int j = 0; j < P; ++j) {
                if(solved[i][j]) {
                    ++s;
                    t += time[i][j] + miss[i][j] * 20;
                }
            }

            scores.push_back(Score(i + 1, s, t));
        }

        sort(begin(scores), end(scores));

        cout << scores[0].id;
        for(int i = 1; i < scores.size(); ++i) {
            cout << ((scores[i - 1] == scores[i]) ? "=" : ",");
            cout << scores[i].id;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1236
#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
	long long int A, B, C, tmp;

	scanf("%lld%lld%lld", &A, &B, &C);

	if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) { printf("0"); }
	else {
		tmp = min(A*B, A*C);
		printf("%lld", min(tmp, B*C));
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://beta.atcoder.jp/contests/abc097/tasks/abc097_b

int main() {
    int X; cin >> X;
    vector<bool> expo(X+5);

    expo[1] = true;
    for (int b = 2; b <= X; b++) {
        int v = b*b;
        while(v <= X) {
            expo[v] = true;
            v *= b;
        }
    }

    for (int i = X; i >= 1; i--) if (expo[i]){
            cout << i << "\n";
            return 0;
    }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
         int k,n,i,mx=0;
         cin>>k>>n;
         int a[n+1];
         for(i=0;i<n;i++)cin>>a[i];
         a[n]=k+a[0];
         for(i=0;i<n;i++)
         {
                  mx=max(mx,a[i+1]-a[i]);
         }
         cout<<k-mx<<endl;
         return 0;
}


Measured memory_bytes: 1024
import itertools

first = {"M":0, "A":0, "R":0, "C":0, "H":0}
n = int(input())
s = [input() for i in range(n)]
for j in s:
    if j[0] in first:
        first[j[0]] += 1
    else:
        first[j[0]] = 1
ll = [[1,1,1,0,0],[1,1,0,1,0],[1,1,0,0,1],[1,0,1,1,0],[1,0,1,0,1],[1,0,0,1,1],[0,1,1,1,0],\
    [0,1,0,1,1],[0,1,1,0,1],[0,0,1,1,1]]

ans =0
for k in range(10):
    num = []
    if ll[k][0] == 1:
        num.append(first["M"])
    if ll[k][1] == 1:
        num.append(first["A"])
    if ll[k][2] == 1:
        num.append(first["R"])
    if ll[k][3] == 1:
        num.append(first["C"])
    if ll[k][4] == 1:
        num.append(first["H"])
    st = 1
    for m in num:
        st *= m
    ans += st
print(ans)

Measured memory_bytes: 9792
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int ans = 0;
        for (int i = m / n;; i--) {
            if (m % i == 0) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;

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

int main()
{

  const ll V = 100000;

  ll N, W;
  cin >> N >> W;

  ll *dp = new ll[V + 1];
  ll *dp_old = new ll[V + 1];
  FOR(i, 0, V)
  {
    dp_old[i] = dp[i] = INF;
  }
  dp_old[0] = 0;

  REP(i, N)
  {
    ll w, v;
    cin >> w >> v;

    FOR(sum_v, 0, V)
    {
      if (sum_v - v < 0)
        chMin(dp[sum_v], dp_old[sum_v]);
      else
        chMin(dp[sum_v], dp_old[sum_v - v] + w);
    }

    FOR(i, 0, V)
    {
      dp_old[i] = dp[i];
    }
  }

  FORD(v, V, 0)
  {
    if (dp[v] <= W)
    {
      cout << v << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  int countermax=1001010;
  int n;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    int a,counter;
    counter=0;
    std::cin >> a;
    while(a%2==0){
      a/=2;
      counter++;
    }
    if(countermax>counter)countermax=counter;
    
  }
  std::cout << countermax << std::endl;
  
}

Measured memory_bytes: 256
for _ in [None] * 50:
    m, f, r = map(int, input().split())
    result = " "
    if m == f == r == -1:
        break
    if m == -1 or f == -1 or m + f < 30:
        result = "F"
    elif m + f >= 80:
        result = "A"
    elif 80 > m + f >= 65:
        result = "B"
    elif 65 > m + f >= 50:
        result = "C"
    else:
        result = "C" if r >= 50 else "D"
    print(result)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;
ll dp[3001][3001];
#define mod 998244353
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
         // Base Case 
         if (a == 0) 
         { 
             *x = 0, *y = 1; 
             return b; 
         } 
   
         ll x1, y1; // To store results of recursive call 
         ll gcd = gcdExtended(b%a, a, &x1, &y1); 
   
   
         *x = y1 - (b/a) * x1; 
         *y = x1; 
   
         return gcd; 
} 
 ll modInverse(ll a, ll m) 
{ 
         ll x, y; 
         ll g = gcdExtended(a, m, &x, &y); 
   
        ll res = (x%m + m) % m; 
         return res; 
} 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll i, j, k, l, n, m;
    cin >> n >> m;
    ll data[n + 1];
    for (i = 1; i <= n;i++){
        cin >> data[i];
    }
    ll precalc[n + 1];
    precalc[0] = 1;
    for (i = 1; i <= n;i++){
        precalc[i] = (precalc[i - 1] * 2) % mod;
    }
    dp[0][0] = precalc[n];
    for (i = 1; i <= n;i++){
        for (j = 0; j <= m;j++){
            dp[i][j] = dp[i - 1][j];
            if(j>=data[i]){
                (dp[i][j] += (dp[i - 1][j - data[i]] * modInverse(2, mod)) % mod) %= mod;
            }
        }
    }
    cout << dp[n][m];
    return 0;
}

Measured memory_bytes: 73968
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    string s, t;
    cin >> s >> t;
    cout << t+s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  typedef long long Int;
  Int n;
  while(cin>>n,n) {
//    cout << n << endl;
    stringstream ss;
    ss << abs(n);
    string s = ss.str();
    int minus=(n<0)?-1:1;
    vector<int> ans;
    int k = 0;
    for (int i=s.size()-1; i>=0 || k!=0; --i) {
      int now = (i>=0) ? minus*(s[i]-'0') : 0;
      now += k;
      bool mi = (s.size()-1-i)%2;

      k=0;
      if (mi) {
        if (now<=0) {
          if (now == -10) {
            ans.push_back(0);
            k = -1;
          } else {
            ans.push_back(-now);
          }
        } else {
          ans.push_back(10-now);
          k = 1;
        }
      } else {
        if (now<0) {
          ans.push_back(10+now);
          k = -1;
        } else {
          if (now == 10) {
            ans.push_back(0);
            k = 1;
          } else {
            ans.push_back(now);
          }
        }
      }
    }
    reverse(ALL(ans));
    FOR(it,ans)
      cout << *it;
    cout << endl;
  }
}

Measured memory_bytes: 0
using System;
using System.IO;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        private Scanner sc;

        public void Solve()
        {
            sc = new Scanner();
            int N = sc.NextInt();
            int[] H = sc.IntArray();
            for (int i = N - 1; i >= 1; i--)
            {
                if (H[i] < H[i - 1])
                {
            
                    if (H[i] != H[i - 1] - 1)
                    {
                        Console.WriteLine("No");
                        return;
                    }

                    H[i - 1]--;
                }
            }
            Console.WriteLine("Yes");
        }

        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private readonly char _separator;
    private readonly StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 24668
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	while(true){
		int n,m,p,all=0,y=-1;
		scanf("%d%d%d",&n,&m,&p);
		if(n==0) break;
		rep(i,n){
			int x;
			scanf("%d",&x);
			if(i+1==m) y=x;
			all+=x*100;
		}
		if(y==0){
			printf("0\n");
			continue;
		}
		printf("%d\n",all*(100-p)/100/y);
	}
	return 0;
}

Measured memory_bytes: 1016
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
	fast;
	lli n;
	cin>>n;
	lli a[n],i,count=0;
	fr(i,n)
	{
		cin>>a[i];
	}
	fr(i,n)
	{
		if(i%2==0&&a[i]%2==1)
			count++;
	}
	cout<<count;
	
	return 0;
}

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

    char s[12], t[12];
    scanf("%s", s);
    scanf("%s", t);


    int nagasa = strlen(s), i;

    for (i=0; i<nagasa; ++i){
        if(s[i]!=t[i]){
            printf("No");
            return 0;
        }
    }

    if(nagasa+1==strlen(t)){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;
}

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

int main(){
	int n;
	cin>>n;
	vector<int> array;
	for (int i = 0; i<n; i++){
		int temp;
		cin>>temp;
		array.push_back(temp);
	}
	//---------array bulid---------
	for (int i = 0; i<n; i++){
		if(i!=0) cout<<" ";
		cout<<array[i];
		if(i == n-1) cout<<endl;
	}
	//----------original array----------
	for (int i = 1; i<n; i++){
		int insert = array[i];
		int j = i-1;
		while(j>=0 && array[j]>insert){
			array[j+1] = array[j];
			j--;
		}
		array[j+1] = insert;
	//-----------sort----------------	
		for(int k = 0; k<n; k++)
		{
		if(k!=0) cout<<" ";
		cout<<array[k];
		if(k == n-1) cout<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <bitset>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int) (v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

ll ans = 10000000000000;
ll a[20];
int n, k;

int main(void) {
  cin >> n >> k;
  rep(i, 0, n) scanf("%lld", &a[i]);
  for (int i=0; i<(1<<n); i++) {
    if (__builtin_popcount(i)!=k) continue;
    ll s = 0, sum = 0;
    for (int j=0; j<n; j++) {
      if ((i>>j)&1){
        if (a[j]>s) { 
          s = a[j]; 
        } else {
          s++;
          sum += s - a[j];
        }
      } else {
        s = max(s, a[j]);
      }
    }
    ans = min(ans, sum);
  }
 
  cout << ans << "\n";

  return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 200010

enum Direction { Up = 0, Down, Left, Right };

ll H, W, N;
ll Sr, Sc;
string S, T;

pair<ll, ll> dp_w[2][MAX_N];
pair<ll, ll> dp_h[2][MAX_N];

// S か T が st で、 S[i]/T[i] をチェックしているときの、
// はみ出ることがない範囲
pair<ll, ll> dfs_w(ll st = 0, ll i = 0) {
    if(i >= N) {
        return make_pair(0, W-1);
    }

    pair<ll, ll>& ret = dp_w[st][i];
    if(ret.first != LLINF && ret.second != LLINF) { return ret; }


    ll next_st = (st == 0) ? 1 : 0;
    ll next_i = (st == 0) ? i : (i + 1);
    ret = dfs_w(next_st, next_i);

    if(st == 0) {   // S を見る
        if(S[i] == 'R') {
            // 右側の OK 範囲が -1
            ret.second--;
        }
        else if(S[i] == 'L') {
            // 左側の OK 範囲が +1
            ret.first++;
        }
    }
    else {  // T を見る
        if(T[i] == 'R') {
            // 左側の OK 範囲が -1
            if(ret.first > 0) { ret.first--; }
        }
        else if(T[i] == 'L') {
            // 右側の OK 範囲が +1
            if(ret.second < W-1) { ret.second++; }
        }
    }

    return ret;
}
pair<ll, ll> dfs_h(ll st = 0, ll i = 0) {
    if(i >= N) { return make_pair(0, H-1); }

    pair<ll, ll>& ret = dp_h[st][i];
    if(ret.first != LLINF && ret.second != LLINF) { return ret; }

    ll next_st = (st == 0) ? 1 : 0;
    ll next_i = (st == 0) ? i : (i + 1);
    ret = dfs_h(next_st, next_i);

    if(st == 0) {
        if(S[i] == 'D') { ret.second--; }
        else if(S[i] == 'U') { ret.first++; }
    }
    else {
        if(T[i] == 'D') { if(ret.first > 0) { ret.first--; } }
        else if(T[i] == 'U') { if(ret.second < H-1) { ret.second++; } }
    }
    return ret;
}

signed main()
{
    cin >> H >> W >> N >> Sr >> Sc >> S >> T;
    Sr--; Sc--;

    REP(i, 2) {
        REP(j, N) {
            dp_w[i][j] = make_pair(LLINF, LLINF);
            dp_h[i][j] = make_pair(LLINF, LLINF);
        }
    }

    dfs_w();
    dfs_h();

    // dfs の結果範囲がなくなっている or i = 0時点での範囲が Sr/Sc の外なら、
    // 高橋君の勝ち
    if( !(dp_w[0][0].first <= Sc && Sc <= dp_w[0][0].second &&
          dp_h[0][0].first <= Sr && Sr <= dp_h[0][0].second) )
    {
        printf("NO\n");
        return 0;
    }
    REP(i, 2) {
        REP(j, N) {
            if(dp_w[i][j].first > dp_w[i][j].second || dp_h[i][j].first > dp_h[i][j].second)
            {
                printf("NO\n");
                return 0;
            }
        }
    }

    printf("YES\n");
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

const int N = 100000;
vector<int> graph[N*2];
map<int, bool> visited;

pll dfs(int v) {
  ll nx = 0;
  ll ny = 0;
  if (v > N) ++ny;
  else ++nx;
  visited[v] = true;
  for (int v_to : graph[v]) {
    if (visited[v_to]) continue;
    pll tmp = dfs(v_to);
    nx += tmp.first;
    ny += tmp.second;
  }
  return make_pair(nx, ny);
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    graph[x].push_back(y+N);
    graph[y+N].push_back(x);
    visited[x] = false;
    visited[y+N] = false;
  }
  ll ans = 0;
  for (auto kv : visited) {
    if (kv.second) continue;
    int v = kv.first;
    pll ret = dfs(v);
    ans += ret.first * ret.second;
  }
  ans -= n;
  cout << ans << endl;

}


Measured memory_bytes: 18560
using System;

public class Hello
{
    public static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        var p = 1L;
        var w = 0L;
        var count = 0;
        while (w < n)
        {
            p *= 26;
            w += p;
            count++;
        }
        var t = n - (w - p);
        getAns(t, count);
    }
    static void getAns(long t, int count)
    {
        var a = "abcdefghijklmnopqrstuvwxyz";
        t--;
        var res = new char[count];
        for (int i = 0; i < count; i++)
        {
            var rt = (int)(t % 26);
            res[count - i - 1] = a[rt];
            t /= 26;
        }
        Console.WriteLine(new string(res));
    }
}


Measured memory_bytes: 27548
# C - Exception Handling
N = int(input())
A = [int(input()) for i in range(N)]

#print(A)
max1 = sorted(A, reverse=True)
max2 = max1[0]

for i in range(N):
    if A[i] == max2:
        print(max1[1])

    else:
        print(max2)

Measured memory_bytes: 14112
#include<iostream>
#include<algorithm>
using namespace std;
int gcd(int a,int b){
  if(b>a){swap(a,b);}
	while(b!=0){
      a=a%b;
      swap(a,b);
    } 
  return a;
}
int main(){
  int ans=0;
int n;cin>>n;
  for(int i=1;i<=n;i++){
  	for(int j=1;j<=n;j++){
      int k=gcd(i,j);
      for(int h=1;h<=n;h++){
      	ans+=gcd(h,k);
      }
      }
  }
    cout<<ans<<endl;
    return 0;
}

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

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i,n)cin >> a.at(i);
    b = a;
    sort(b.begin(),b.end());

    int max = b.at(n-1);
    rep(i,n){
        if(a.at(i) != max)cout << max << endl;
        else cout << b.at(n-2) << endl;
    }
}


Measured memory_bytes: 3200
h, w = map(int, input().split())
s = [input().strip() for _ in range(h)]


def can_paint():
    for i in range(h):
        for j in range(w):
            if s[i][j] == '.':
                continue

            ns = []
            if i != 0:
                ns.append(s[i-1][j])
            if i != h-1:
                ns.append(s[i+1][j])
            if j != 0:
                ns.append(s[i][j-1])
            if j != w-1:
                ns.append(s[i][j+1])

            if ns.count('#') == 0:
                return False

    return True


print('Yes') if can_paint() else print('No')

Measured memory_bytes: 3064
(def connection-profile-samples
  [{:time-to-first-delivery       3
    :first-delivery-size          4
    :continuous-delivery-size     6
    :count-of-continuous-delivery 12
    :last-delivery-size           3}])
(defn count-total-size [profile]
  (let [{Ccd :count-of-continuous-delivery
         ir  :continuous-delivery-size
         fd  :first-delivery-size
         ld  :last-delivery-size} profile]
    (+ fd ld (* Ccd ir))))
(defn next-connection-profile [prev outlet-rate]
  (let [{Ccd :count-of-continuous-delivery
         ir  :continuous-delivery-size
         fd  :first-delivery-size
         ld  :last-delivery-size} prev
        or outlet-rate
        m {:time-to-first-delivery (inc (:time-to-first-delivery prev))}]
    (cond (<= ir or)
          (merge m
            (select-keys prev
              [:first-delivery-size :last-delivery-size
               :continuous-delivery-size
               :count-of-continuous-delivery]))

          (> ir or)
          (let [amortizing (cond
                             (<= fd or) (+ ld (* ir Ccd))
                             (>  fd or) (+ ld (* ir Ccd) (- fd or)))]
            (assoc m
             :first-delivery-size (cond (<= fd or) fd
                                        (>  fd or) or)
             :continuous-delivery-size or
             :count-of-continuous-delivery (quot amortizing or)
             :last-delivery-size (rem amortizing or))))))
(defn total-delivery-time [profile]
  (let [{Tfd :time-to-first-delivery
         Ccd :count-of-continuous-delivery
         ld  :last-delivery-size} profile
        except-last-delivery (+ Tfd 1 Ccd)]
    (cond (> ld 0) (inc except-last-delivery)
          :else except-last-delivery)))
(defn abc123-C [[r0 & outlet-rates] N]
  (let [amortizing0 (- N r0)
        profile0
        {:time-to-first-delivery 0
         :first-delivery-size r0
         :continuous-delivery-size r0
         :count-of-continuous-delivery (quot amortizing0 r0)
         :last-delivery-size (rem amortizing0 r0)}
        profiles (->> outlet-rates
                   (reductions
                     next-connection-profile
                     profile0))]
    #_(doseq [[prof rate] (zipmap profiles (concat outlet-rates [-1]))]
      (pprint prof) (println rate))
    (total-delivery-time (last profiles))))
(defn main-abc123-C []
  (let [N (read)
        rates (doall (for [_ (range 5)] (read)))]
    (println (abc123-C rates N))))
(main-abc123-C)


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

int main() {
    int k, x;
    cin >> k >> x;
    for (int i = x-k+1; i <= x+k-1; i++) cout << i << endl;
    return 0;
}

Measured memory_bytes: 3596
line = gets.split(' ').map(&:to_i)
 
takhp = line[0]
takatt = line[1]
aokhp = line[2]
aokatt = line[3]
 
for i in 1..1000000
  aokhp = aokhp - takatt
  takhp = takhp - aokatt
  if aokhp <= 0 then
    answer = "Yes"
    break
  end
    if takhp <= 0 then
      answer = "No"
      break
    end
end
 
print answer

Measured memory_bytes: 14360
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string s;
	cin >> s;
	int cnt=0, l=s.length();
	for(int i=0; i<l; i++){
		if(s[i]=='o') cnt++;
	}
	if(cnt+7-l>=0) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n),b(n),c(n-1);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  for(int i=0;i<n;i++){
    cin >> b.at(i);
  }
  for(int i=0;i<n-1;i++){
    cin >> c.at(i);
  }
  
  int ans = 0;
  for(int i=0;i<n-1;i++){
    ans += b.at(a.at(i)-1);
    if(a.at(i) +1 == a.at(i+1)){
      ans += c.at(a.at(i)-1);
    }
  }
  ans += b.at(a.at(n-1)-1);
  cout << ans << endl;
  return 0;
}

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

int main(){
  int a, b;

  cin >> a >> b;

  if( a < b ){
    cout << "a < b" << endl;
  }else if( a > b ){
    cout  << "a > b" << endl;
  }else{
    cout  << "a == b" << endl;
  }
    
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main(){
int ans=0;
int sum=0;
int highest;
int N;
  cin>>N;
vector<int> nedan(N);
for(int i=0;i<N;i++){
  cin>>nedan.at(i);
}
  highest=*max_element(nedan.begin(),nedan.end());
  for(int i=0;i<N;i++){
  sum+=nedan.at(i);
  }
  ans=sum-highest+highest/2;
  cout<<ans;
}

Measured memory_bytes: 256
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(k,s):
    if len(s) <= k : return s
    return s[:k]+"..."

def resolve():
    k = ii()
    s = input()
    print(main(k,s))

if __name__ == "__main__":
    resolve()

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

int main() {
  int K,S;
  cin >> K >> S;
  int count = 0;
  //0 < x,y,z < 2を満たす
  for(int i = 0; i <= K; i++){
    for(int j = 0; j <= K; j++){
      int d = S - i - j;//dの値
      if(d >= 0 && d <= K){
        count++;
      }
    }
  }
  cout << count << endl;


}

Measured memory_bytes: 3604
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

int a, b, n;
int syou, amari;

int main()
{
	while (cin >> a >> b >> n)
	{
		int s = 0;

		amari = a % b;
		REP(n)
		{
			s += amari * 10 / b;
			amari = (amari * 10) % b; 
		}

		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#define N 100

void bubbleSort(int *,int);

int main(){
  int n,i;
  int A[N];
  
  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }
  bubbleSort(A,n);
  return 0;
}

void bubbleSort(int *A,int n){
  int i,j;
  int flag,swap,count = 0;
  flag = 1;
    i = 0;
    while(flag){
       flag = 0;
       for(j = n - 1; j >= i + 1; j--){
           if(A[j] < A[j - 1]){
	   swap = A[j];
	   A[j] = A[j - 1];
	   A[j - 1] = swap;
	   count++;
	   flag = 1;
       }
    }
    i++;
  }
    for(i = 0; i < n; i++){
      if(i == n - 1) printf("%d",A[i]);
      else printf("%d ",A[i]);
    }
    
  printf("\n%d\n",count);

}



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

int main()
{
	int position;
	string a;
	cin>>a;
position = a.find("AC");
 if (position != a.npos) {
  cout <<"Yes"<<endl;
 }
 else
 {
  cout <<"No"<<endl;
 } 

	return 0;
}

Measured memory_bytes: 256
const int N = 400005;
const int LG = 21;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, a; cin >> n;
    vector<int> cnt(N);
    forn(i, n) cin >> a, cnt[a]++, cnt[a + 1]++, cnt[a + 2]++;
    cout << *max_element(all(cnt));
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n;
    cin >> n;
    n %= 10;
    string ans = "hon";
    if (n == 3) ans = "bon";
    else if (n == 0 || n == 1 || n == 6 || n == 8) ans = "pon";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

struct Combination {
	vector<int64_t> _fact, _rfact, _inv;
	int64_t MOD;

	Combination(size_t sz, int64_t mod) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1), MOD(mod) {
		_fact[0] = _rfact[sz] = _inv[0] = 1;
		for (int i = 1; i <= sz; ++i) {
			_fact[i] = _fact[i - 1] * i % MOD;
		}
		_rfact[sz] = inverse(_fact[sz]);
		for (int i = sz - 1; i >= 0; --i) {
			_rfact[i] = _rfact[i + 1] * (i + 1) % MOD;
		}
		for (int i = 1; i <= sz; ++i) {
			_inv[i] = _rfact[i] * _fact[i - 1] % MOD;
		}
	}

	inline int64_t fact(int k) const { return _fact[k]; }
	inline int64_t rfact(int k) const { return _rfact[k]; }
	inline int64_t inv(int k) const { return _inv[k]; }

	int64_t inverse(int64_t x) const { return pow(x, MOD - 2); }
	int64_t pow(int64_t x, int64_t n) const {
		int64_t ret = 1;
		while (n > 0) {
			if (n & 1) { (ret *= x) %= MOD; }
			(x *= x) %= MOD;
			n >>= 1;
		}
		return ret;
	}

	int64_t P(int n, int r) const {
		if (r < 0 || n < r) { return 0; }
		return fact(n) * rfact(n - r) % MOD;
	}
	int64_t C(int n, int r) const {
		if (r < 0 || n < r) { return 0; }
		return fact(n) * rfact(r) % MOD * rfact(n - r) % MOD;
	}
	int64_t H(int n, int r) const {
		if (n < 0 || r < 0) { return 0; }
		return r == 0 ? 1 : C(n + r - 1, r);
	}
};

int main() {
	constexpr Int MOD = 998244353;
	Int N, A, B, K;
	cin >> N >> A >> B >> K;

	Combination cb(N, MOD);
	Int ans = 0;
	for (Int x = 0; x <= N; ++x) {
		if ((K - A * x) % B != 0) { continue; }
		(ans += (cb.C(N, x) * cb.C(N, (K - A * x) / B)) % MOD) %= MOD;
	}
	cout << ans % MOD << endl;

	return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;


int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, k;
  cin >> n >> k;
  vector<pair<int, int>> ps;
  for (int i = 1; i < n; i++) ps.emplace_back(0, i);
  ll now = (n - 1) * (n - 2) / 2;
  vector<pair<int, int>> qs;
  for (int i = 1; i < n; i++) for (int j = i + 1; j < n; j++) qs.emplace_back(i, j);
  if (now - k < 0) {
    cout << -1 << endl;
    return 0;
  }
  if (now - k > qs.size()) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < now - k; i++) {
    ps.push_back(qs[i]);
  }
  cout << ps.size() << endl;
  for (auto &v : ps) cout << v.first + 1 << " " << v.second + 1 << endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <vector>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll r;
    cin >> r;
    cout << r*r << endl;
    return 0;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int H = l[0], W = l[1];

            var map = new char[H][];
            for (var i = 0; i < H; i++)
            {
                map[i] = Console.ReadLine().ToCharArray();
            }

            var directY = new int[] { -1, 0, 1, 0 };
            var directX = new int[] { 0, 1, 0, -1 };
            var max = 0;

            for (var sy = 0; sy < H; sy++)
            {
                for (var sx = 0; sx < W; sx++)
                {
                    if (map[sy][sx] == '#') continue;
                    var ans = new int[H, W];
                    ans[sy, sx] = 1;
                    var queue = new Queue<Tuple<int, int>>();
                    queue.Enqueue(new Tuple<int, int>(sy, sx));
                    while (queue.Count > 0)
                    {
                        var d = queue.Dequeue();
                        int y = d.Item1, x = d.Item2;
                        for (var i = 0; i < 4; i++)
                        {
                            var indY = y + directY[i];
                            var indX = x + directX[i];
                            if (indY < 0 || indY >= H || indX < 0 || indX >= W) continue;
                            if (ans[indY, indX] == 0 && map[indY][indX] == '.')
                            {
                                queue.Enqueue(new Tuple<int, int>(indY, indX));
                                ans[indY, indX] = Math.Max(ans[y, x] + 1, ans[indY, indX]);
                            }
                        }
                    }
                    for (var gy = 0; gy < H; gy++)
                    {
                        for (var gx = 0; gx < W; gx++)
                        {
                            if (map[gy][gx] == '#') continue;
                            max = Math.Max(max, ans[gy, gx]);
                        }
                    }
                }
            }

            Console.WriteLine(max-1);
        }
    }
}

Measured memory_bytes: 15568
#include <stdio.h>
int main(void){
    int i, n, m, min, max,l[100001], r[100001];
    
    scanf("%d %d", &n, &m);
    
    for( i = 0; i < m; i++ ){
        scanf("%d %d", &l[i], &r[i]);
    }
    
    min = l[0];
    max = r[0];
    
    for( i = 0; i < m; i++ ){
        if( min < l[i] ){
            min = l[i];
        }
        if( max > r[i] ){
            max = r[i];
        }
    }
        
    if( max-min+1 > 0 ){
        printf("%d\n", max-min+1);
    } else {
        printf("0\n");
    }
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define debug(...) { printf("#  "); printf(__VA_ARGS__); puts(""); }
#define fi first
#define se second
#define endl "\n" 
using ll = long long;
using pII = pair <int, int>;
using pLL = pair <ll, ll>;
using VI = vector <int>;
using VL = vector <ll>;
constexpr int mod = 1e9 + 7;
template <class T1, class T2> inline void chadd(T1 &x, T2 y) { x += y; if (x >= mod) x -= mod; else if (x < 0) x += mod; } 
template <class T1, class T2> inline void chmax(T1 &x, T2 y) { if (x < y) x = y; }
template <class T1, class T2> inline void chmin(T1 &x, T2 y) { if (x > y) x = y; }
inline int rd() { int x; cin >> x; return x; }
template <class T> inline void rd(T &x) { cin >> x; }
template <class T> inline void rd(vector <T> &vec) { for (auto &it : vec) cin >> it; }
template <class T> inline void out(T s) { cout << s << "\n"; }
template <class T> inline void out(vector <T> &vec) { for (auto &it : vec) cout << it << " "; cout << endl; } 
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll qpow(ll base, ll n) { ll res = 1; while (n) { if (n & 1) res = res * base % mod; base = base * base % mod; n >>= 1; } return res; }
constexpr int N = 1e5 + 10;
int n, h[N], f[N]; 
void run() {
	for (int i = 1; i <= n; ++i) cin >> h[i];
	memset(f, 0, sizeof f);
	h[n + 1] = mod;
	for (int i = n; i >= 1; --i) {
		if (h[i] < h[i + 1]) f[i] = 1;
		else f[i] = f[i + 1] + 1;
	}
	cout << *max_element(f + 1, f + 1 + n) - 1 << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	cout << fixed << setprecision(20);
	while (cin >> n) run();
	return 0;
}


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

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

    int sum = 10000*n;
    for (auto i = 0; i <= n; i++) {
        for (auto j = 0; j <= n; j++) {
            if(i+j > n) continue;
            if(sum - i*5000 - j*9000 == y) {
                cout << n-i-j << " " << i << " " << j << endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  
  char s[3];
  scanf("%s",&s);
  
  int i,o = 0,ans = 700; //o;oの数
  for(i = 0; i < 3; i++){
    if(s[i] == 'o') o++;
  }
  
  ans += 100 * o;
  printf("%d",ans);
  
  return 0;
}
  

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

int main() {
  int N;
  cin>>N;
  std::vector<int> L(N,0);
  for (int i = 0; i < N;i++) cin>>L[i];

  std::sort(L.begin(),L.end());
  int a,b,c0,c1;
  int M = 0;

  for (int i = 0; i < N-2;i++) {
    for (int j = i+1;j<N-1;j++) {
      a = L[i];
      b = L[j];
      int k0 = std::upper_bound(L.begin()+j+1,L.end(),b-a) - L.begin();
      int k1 = std::lower_bound(L.begin()+j+1,L.end(),a+b) - L.begin()-1;
      c0 = L[k0];
      c1 = L[k1];
      // cout<<a<<" "<<b<<" "<<c0<<" "<<c1<<endl;
      // cout<<i<<" "<<j<<" "<<k0<<" "<<k1<<endl;
      // cout<<k1-k0+1<<endl;
      M += k1-k0+1;
    }
  }
  cout<<M<<endl;

  return 0;
}

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

#define st first
#define nd second
#define pb push_back
#define mp make_pair
typedef pair< int ,int > pii;
typedef vector< pii > vii;
typedef long long ll;
typedef map<int,int> mii;
typedef set<pii> sii;
typedef set<int> si;
typedef vector< int > vi;

const ll MOD = 119 << 23 | 1;

ll gcd(ll x, ll y){
    if(!y)
        return x;
    return gcd(y,x%y);
}

ll power(ll x, ll y)
{
    ll res = 1ll;     // Initialize result
    x%=MOD;
    if(x==0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % MOD;

        // y must be even now
        y = y>>1ll; // y = y/2
        x = (x*x) % MOD;
    }
    return res;
}

ll inv(ll x) {
    ll r = 1ll, t = x, k = MOD - 2ll;
    while (k) {
        if (k & 1ll) r = (long long) r * t % MOD;
        t = (long long) t * t % MOD;
        k >>= 1;
    }
    return r;
}

const int nax = 2e5+13;

void read(){
    ll n,k;
    cin >> n >> k;
    cout <<min(n%k,-((n%k)-k))<<endl;
}

void solve(){

}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    int T=1;
    //cin >> T;
    for(int i=1; i<=T; i++){

        read();
        //cout << "Case #"<<i<<": ";
        solve();
    }

    return 0;
}


Measured memory_bytes: 256
n = int(input())
dp = [0]*(n+1)
for i in range(2,n+1):
    j = 2
    while 1:
        if i*j <= n:
            dp[i*j] += 1
        else:
            break
        j += 1
ans = 0
for i in range(2,n+1):
    ans += i*dp[i]
print(ans+n*(n+1)-1)

Measured memory_bytes: 145696
#include<bits/stdc++.h>
#define ll long long
#define F(type, i, a, b) for(type i = a; i <= b; i ++)
#define RF(type, i, a, b) for(type i = a; i >= b;i --)
#define sz(a) sizeof(a)
#define deb(a) cout<<#a<<' '<<a<<'\n'
using namespace std;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<char,int> pci;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef map<char,int> mci;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef unordered_map<char,int> umci;
typedef vector<ll>  vll;
typedef vector<vector<ll> > vvll;

void solve()
{
    int n;
    cin>>n;
    vector<long double> ProbHead(n);
    F(int,i, 0, n - 1)
        cin>>ProbHead[i];
    vector<long double> dp(n + 1, 0);
    dp[0] = 1;
    F(int, i, 0, n - 1){
        int j = 0;
        long double prev = 0;
        while(j <= n){
            long double prev1 = dp[j];
            dp[j] = prev1 * ((long double)(1) - ProbHead[i]);
            dp[j] += prev; 
            prev = prev1 * ProbHead[i];
            if(prev1 == (long double)(0))
                break;
            j ++;
        }
    }
    long double Tot = 0;
    F(int, i, n / 2 + 1, n){
        //deb(dp[i]);
        Tot += dp[i];
    }
    cout.setf(ios::fixed);
    cout<<setprecision(10)<<Tot<<'\n';
    //deb(Tot);
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#else
    //#endif
    solve();
}


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

#define pb push_back
#define mp make_pair
#define fi first
#define se second



int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	string a;
	cin>>a;
	
	if(a=="Sunny")cout<<"Cloudy"<<endl;
	else if(a=="Cloudy")cout<<"Rainy"<<endl;
	else cout<<"Sunny"<<endl;
}

Measured memory_bytes: 764