akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef pair<ll, ll> P;
#define ALL(v) v.begin(),v.end()

const int MOD = 1000000007;
const int MAX = 5100000;
ll gcd(ll a, ll b) {
    return (b==0) ? a : gcd(b, a%b);
}

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 以下から
const int MAX_N = 100000;
struct Edge {
    int to;
    int id;
};

const int D = 80 * 160 + 10;
const int D2 = D*2;
typedef bitset<D2> bs;
int a[100][100];
bs dp[90][90];



const int N = 20;
int h;
int w;
vector<vector<char>> maze(N, vector<char>(N,'#'));

const int MAX_WH = 21;
int d[MAX_WH][MAX_WH];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
const int INF = 100000;
int bfs(int x, int y) {
    queue<P> que;
    rep(i,MAX_WH) {
       rep(j,MAX_WH) {
            d[j][i] = INF;
        }
    }
    que.push(P(x,y));
    d[x][y] = 0;

    while (que.size()) {
        P p = que.front(); que.pop();
        for (int i=0; i< 4; i++) {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];
            if (0 <= nx && nx < w && 0 <= ny && ny < h && maze[nx][ny] != '#' && d[nx][ny] == INF) {
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    int mx = 0;
    rep(i,h) rep(j,w) {
        if (d[j][i] == INF) continue;
        mx = max(mx, d[j][i]);
    }
    return mx;
}
int main(){
    h,w; cin >> h >> w;
    rep(i,h)rep(j,w) {
        char c; cin >> c;
        maze[j][i] = c;
    }
    int ans = 0;
    rep(i,h)rep(j,w) {
        if (maze[j][i] != '#') {
            ans = max(ans, bfs(j,i));
        }
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a = Long.parseLong(sc.next());
        double b = Double.parseDouble(sc.next());
        b*=500;
        long c = (long)b;
        System.out.println(a*c/500);
    }
}

Measured memory_bytes: 35912
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        // 入力
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] l = new int[n];
        for (int i=0;i<n;i++) {
            l[i] = sc.nextInt();
        }

        int result =  1;
        int sum = 0;
        for (int i=0;i<n;i++) {
            sum += l[i];
            if (sum > x) break;
            result++;
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

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

  char graph[N][N];
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      cin >> graph[i][j];
    }
  }
  
  int ans = -1;

  for (int i = 0; i < N; i++){
    vector <vector<int> > group(1);
    group[0].push_back(i);

    vector <int> group_num(N);
    for (int j = 0; j < N; j++){
      group_num[j] = -1;
    }
    group_num[i] = 0;

    bool flag = true;
    queue <int> now, next;
    now.push(i);
    int cnt = 1, num = 0;

    while (!now.empty()){
      int A = now.front(); now.pop();

      for (int j = 0; j < N; j++){
        if (graph[A][j] == '1'){
          if (group_num[j] == -1){
            next.push(j);
            group_num[j] = group_num[A] + 1;
            cnt++;
          }else{
            if (group_num[j] != group_num[A] - 1 && group_num[j] != group_num[A] + 1){
              flag = false;
            }
          }
        }
      }
      
      if (flag == false){
        break;
      }

      if (now.empty()){
        while (!next.empty()){
          int n = next.front(); next.pop();
          now.push(n);
        }
        num++;
      }
    }
    

    
    if (flag == true && cnt == N){
      if (ans < num){
        ans = num;
      }
    }
  }
  
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int main(void){
    int i, t, n;
    scanf("%d", &n);
    int input[n];
    
    for(i = 0; i < n; i++){
        scanf("%d", &t);
        input[i] = t;
    }
    for(i = 0; i < n; i++){
        printf("%d",input[n-1 - i]);
        if(i != (n-1))
            putchar(' ');
    }
    putchar('\n');
    return 0;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T1,typename T2> using M = map< T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;
using Mci = M<char, int>;

int main(){
    string s;
    cin>>s;
    Mci m;
    REP(i,s.size()){
        m[s[i]]++;
    }

    if(m.size() != 2){
        cout<<"No"<<endl;
        return 0;
    }

    for(auto c : m){
        if(c.se!=2){
            cout<<"No"<<endl;
            return 0;
        }
    }


    cout<<"Yes"<<endl;

    return 0;
}

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

int main(){
  int H, W; //縦、横
  string a; //文字
  int sum = 1;
  cin >> H >> W;
  
  vector<string> syp(W + 2, "#");
  vector<string> mozi(H * 3, "#");
  
  for(int k = 0;k < H * 3  ; k++){
   
    if(k == 3 * sum - 2){
      cin >> mozi.at(k);
      sum++;
    }
   
  }
  
  for(int j = 0;j < (W + 2); j++ ){
    cout <<syp.at(j);
  }
  
  cout << endl;
  
  for(int i = 0, sum = 1; i < H * 3; i++){
    cout << mozi.at(i);
    if(i == 3 * sum - 1 ){
      sum++;
    cout << endl; 
    }
   
  }
  
 for(int l = 0, sum = 0;l < (W + 2); l++ ){
    cout <<syp.at(l);
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second

using Graph = vector<vector<pair<ll, ll>>>;

void dfs(Graph &G, int v, vector<ll> &dist)
{
    if (dist[v] != -1)
    {
        for (auto next_v : G[v])
        {
            if (dist[next_v.fi] == -1)
            {
                dist[next_v.fi] = (dist[v] + next_v.se) % 2;
                dfs(G, next_v.fi, dist);
            }
        }
    }
}

int main()
{
    ll n;
    cin >> n;
    Graph G(n);
    for (int i = 0; i < n - 1; i++)
    {
        ll a, b, c;
        cin >> a >> b >> c;
        G[a - 1].push_back({b - 1, c});
        G[b - 1].push_back({a - 1, c});
    }
    vector<ll> dist(n, -1);
    dist[0] = 0;
    dfs(G, 0, dist);

    for (int i = 0; i < n; i++)
    {
        cout << dist[i] << endl;
    }

    return 0;
}

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

int main()
{
	int n, m, a[60];
	
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	sort(a, a + n);
	int s = 0;
	for (int i = n - m; i < n; i++) {
		s += a[i];
	}
	printf("%d\n", s);
}

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

#define N_MAX   (100000)

typedef long long ll;

int main()
{
    // 整数の入力
    ll X , Y, result, n;
    cin >> X >> Y ;
    n = X;
    while(true) {
        if (n > Y) {
            break;
        }
        result++;
        n = n * 2;
    }

    cout << result << endl;
    return 0;

}


Measured memory_bytes: 256
# E - League
import sys
from collections import deque
from typing import Deque, List

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N = int(readline())
    schedules: List[Deque[int]] = [deque()] + [
        deque(map(int, line.split())) for line in readlines()
    ]
    matched_games_cnt = 0
    next_opponents, last_games_days = [0] * (N + 1), [0] * (N + 1)
    queue = deque(range(1, N + 1))
    while queue:
        player = queue.popleft()
        if not schedules[player]:  # The player has finished all games.
            continue
        opponent = schedules[player].popleft()

        # The opponent will have another game before playing against x.
        if next_opponents[opponent] != player:
            next_opponents[player] = opponent
            continue

        # The opponent's next game is against the player and vice versa.
        matched_games_cnt += 1
        last_games_days[player] = last_games_days[opponent] = (
            max(last_games_days[player], last_games_days[opponent]) + 1
        )
        # No next game is currently planned.
        next_opponents[player] = next_opponents[opponent] = 0
        queue.append(player), queue.append(opponent)

    print(max(last_games_days) if matched_games_cnt == N * (N - 1) // 2 else -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 46252
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int N, W; cin >> N >> W;
    vector<P> vw(N);
    rep(i, N) {
        cin >> vw[i].first >> vw[i].second;
    } 

    // i+1品使って、j重みまでで最大の
    vector<vector<int>> dp(N+1, vector<int>(W+1));
    repr(i, 1, N+1) {
        repr(j, 1, W+1) {
            if (j-vw[i-1].second >= 0) {
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-vw[i-1].second] + vw[i-1].first);
            } else {
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    // rep(i, W+1) cout << dp[i] << " ";
    /*
    rep(i, N) {
        rep(j, W) {
            cout << dp[i+1][j+1] << " ";
        }
        cout << endl;
    }
    */
    // cout << endl;
    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 6768
def main(n):
    ans = 0

    for i in range(1, n + 1):
        if i % 2 == 0:
            continue

        l = 0
        for j in range(1, i + 1):

            if i % j == 0:
                l += 1

        if l == 8:
            ans += 1

    print(ans)


if __name__ == "__main__":
    n = int(input())

    main(n)


Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int main(void) {
    cout << std::fixed << std::setprecision(10);
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    std::vector<std::string> field;
    std::string fieldedge = "..........";
    field.push_back(fieldedge);
    for (int i = 0; i < h; i++) {
        std::string s;
        cin >> s;
        std::string pushed = "." + s + ".";
        field.push_back(pushed);
    }
    field.push_back(fieldedge);

    int x = 1, y = 1;
    while (x != w || y != h) {
        bool right = false, under = false, left = false, upper = false;
        int moveablecount = 0;
        if (field[y][x + 1] == '#') {
            right = true;
            moveablecount++;
        }
        if (field[y + 1][x] == '#') {
            under = true;
            moveablecount++;
        }
        if (field[y][x - 1] == '#') {
            left = true;
            moveablecount++;
        }
        if (field[y - 1][x] == '#') {
            upper = true;
            moveablecount++;
        }
        if ((right && under) || (!right && !under)) {
            cout << "Impossible" << endl;
            return 0;
        }
        if (moveablecount >= 3) {
            cout << "Impossible" << endl;
            return 0;
        }
        if (right) {
            x++;
        } else {
            y++;
        }
    }
    if (field[y - 1][x] == '#' && field[y][x - 1] == '#') {
        cout << "Impossible" << endl;
        return 0;
    }
    cout << "Possible" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <array>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
using namespace std;
template <typename T> istream & operator >> (istream & is, vector<T> & vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;
using VI = vector<int>;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

vector<ll> enum_div(ll n)
{
	vector<ll> ret;
	for (ll i = 1; i * i <= n; ++i)
	{
		if (n % i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i * i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}

int main() {
	ll n; CI n;
	ll ans = 0;

	vector<ll> d = enum_div(n);
	
	FOR(i,1, d.size()-1) {
		if (n / (d[i] - 1) == n % (d[i] - 1)) {
			ans += d[i];
			ans--;
		}
	}
	ans += n;
	ans--;
	if (n == 2)CO 0 EN;
	else CO ans EN;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>

using namespace std;

int main(){
  long n, m, a,b, c;
  char A,B,C;
  cin >>m>>n ;
  a=1;
  int i;
  for(i= 0; i <m; i++){
    a *= 100;
  }
  if(n !=100)
  cout << a*n << endl;
  else cout << a*(n+1) <<endl;
}


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

int main(){
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vector<int> x(N), y(M);
	for(int i=0;i<N;i++){
		cin >> x[i];
	}
	for(int i=0;i<M;i++){
		cin >> y[i];
	}
	int maxx = -101;
	int miny = 101;
	for(int i=0;i<N;i++){
		maxx = max(x[i],maxx);
	}
	for(int i=0;i<M;i++){
		miny = min(y[i],miny);
	}
	if(maxx < miny && miny > X && maxx < Y) cout << "No War" << endl;
	else cout << "War" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    ll ans = 0;
    repf(i,1,n+1){
        if (i<10)
            ans++;
        if (100<=i && i<1000)
            ans++;
        if (10000<=i && i<100000)
            ans++;
    }
    cout << ans << endl;
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  string S;
  cin >> S;
  set<char> c_list;
  for (const char &c : S) {
    c_list.insert(c);
  }

  if (c_list.size() == 1) {
    cout << 0 << endl;
    return 0;
  }

  int ans = 1 << 29;

  for (const char &c : c_list) {
    int t_ans = 0;
    string t = S;
    string t_;
    while (true) {
      t_ = "";
      // cout << t << endl;
      ++t_ans;
      REP(i, t.length() - 1) {
        if (t.at(i) == c || t.at(i + 1) == c) {
          t_ += c;
        } else {
          t_ += t.at(i);
        }
      }

      if (all_of(t_.begin(), t_.end(), [c](char _c) { return _c == c; })) {
        break;
      }
      t = t_;
    }
    ans = min(ans, t_ans);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll h, w;
  cin >> h >> w;
  if (h == 1 || w == 1)
    cout << 1 << endl;
  else
    cout << (h*w+1)/2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <set>
#include <cmath>
using namespace std;
int main() {
    int N, T;
    int c, t;
    int m_p = 1001;
    cin >> N >> T;
    for(int i = 0; i < N; i ++){
        cin >> c >> t;
        if(t <= T && c <= m_p){
            m_p = c;
        }
    }
    if(m_p == 1001)
        cout << "TLE";
    else
        cout <<   m_p;
    return 0;
}

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

using namespace std;

int main(void)
{
	int n,m,X,Y;
	cin >> n >> m >> X >> Y;

	int x[105],y[105];

	for(int i=1;i<=n;i++)
		cin >> x[i-1];
	for(int i=1;i<=m;i++)
		cin >> y[i-1];

	int xmax=X;
	int ymin=Y;

	for(int i=1;i<=n;i++)
		xmax=max(xmax,x[i-1]);
	for(int i=1;i<=m;i++)
		ymin=min(ymin,y[i-1]);
	
	cout << (xmax<ymin ? "No War" : "War") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  A =0;
  cin>>N;
  B = N;
  for(int i=0;i<9; i++){
    A += N% 10;
    if(N>=10){
      N /= 10;
    }
    else if(N<10){
      break;
    }
  }
if( B%A==0){
  cout<<"Yes"<<endl;
}
  else if (N%A !=0){
    cout <<"No"<<endl;
  }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
signed main()
{
    int a[3];
    for(int i=0;i<3;i++)
        cin>>a[i];
    sort(a,a+3);
    if(a[0]==5 && a[1]==5 && a[2]==7)
    cout<<"YES";
    else
    cout<<"NO";
}

Measured memory_bytes: 256
// AOJ 1517: Matrix Operations
// 2017.9.27 bal4u@uu

#include <stdio.h>
#include <string.h>

int n;
char map[17][17];
char mk[17][17];
int mv[4][2] = {{-1,0},{1,0},{0,1},{0,-1}};

void rotate(int r, int c, int h, int a)
{
	int i, j, k;
	char tmp[17][17];

	if (a == 360 || n == 1 || h == 1) return;
	k = a / 90; while (k-- > 0) {
		memcpy(tmp, map, sizeof(tmp));
		for (i = 0; i < h; i++) for (j = 0; j < h; j++) {
			map[r+j][c+h-1-i] = tmp[r+i][c+j];
		}
	}
}

void reverse(int r, int c, int h)
{
	int i, j;
	for (i = 0; i < h; i++) for (j = 0; j < h; j++) map[r+i][c+j] = !map[r+i][c+j];
}

void shift(int r, int lr)
{
	int c, t;

	if (n == 1) return;
	if (lr) {
		t = map[r][0];
		for (c = 1; c < n; c++) map[r][c-1] = map[r][c];
		map[r][n-1] = t;
	} else {
		t = map[r][n-1];
		for (c = n-2; c >= 0; c--) map[r][c+1] = map[r][c];
		map[r][0] = t;
	}
}

int q[300][2], top;
void islandRev(int r, int c)
{
	int a, i, r2, c2;

	memset(mk, 0, sizeof(mk));
	a = map[r][c]; map[r][c] = !a; mk[r][c] = 1;
	q[0][0] = r, q[0][1] = c, top = 1;
	while (top > 0) {
		r = q[--top][0], c = q[top][1];
		for (i = 0; i < 4; i++) {
			r2 = r + mv[i][0], c2 = c + mv[i][1];
			if (r2 < 0 || r2 >= n || c2 < 0 || c2 >= n || map[r2][c2] != a) continue;
			if (mk[r2][c2]) continue;
			mk[r2][c2] = 1;
			map[r2][c2] = !a;
			q[top][0] = r2, q[top++][1] = c2;
		}
	}
}

int main()
{
	int m, o, r, c, h, a;

	scanf("%d%d", &n, &m);
	for (r = 0; r < n; r++) for (c = 0; c < n; c++) scanf("%d", &a), map[r][c] = a;
	while (m-- > 0) {
		scanf("%d", &o);
		if (o == 0) {  // rotate
			scanf("%d%d%d%d", &r, &c, &h, &a);
			rotate(r-1, c-1, h, a);
		} else if (o == 1) {
			scanf("%d%d%d", &r, &c, &h);
			reverse(r-1, c-1, h);
		} else if (o == 2) {
			scanf("%d", &r);
			shift(r-1, 1);
		} else if (o == 3) {
			scanf("%d", &r);
			shift(r-1, 0);
		} else {
			scanf("%d%d", &r, &c);
			islandRev(r-1, c-1);
		}
	}
	for (r = 0; r < n; r++) {
		printf("%d", map[r][0]);
		for (c = 1; c < n; c++) printf(" %d", map[r][c]);
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 1860
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef pair<int, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}


const int N = 1e6 + 100;

int main() {
    int n;
    cin >> n;
    printf("0\n");
    fflush(stdout);
    string s;
    cin >> s;
    char st = s[0];
    if(s[0] == 'V') return 0;
    int cur = 0;
    for(int i = 19; i >= 0; i --) {
        if(cur + (1 << i) >= n) continue;
        cout << cur + (1 << i) << endl;
        fflush(stdout);
        cin >> s;
        if(s[0] == 'V') return 0;
        if(((cur + (1 << i)) % 2 == 0 && s[0] == st) || 
                ((cur + (1 << i)) % 2 && s[0] != st)) cur |= (1 << i);
    }

    cout << cur << endl;
    fflush(stdout);
}


Measured memory_bytes: 852
#include <cstdio>
#include <cstring>

int main(void)
{
  int n,m,j;
  scanf("%d", &n);
  int cards[4][13]={0};
  char i;
  char s[]="S",h[]="H",c[]="C",d[]="D";

  for(m=0;m<n;m++){
    scanf("%s %d", &i, &j);
    if(i=='S'){
      cards[0][j-1]=1;
    } else if(i=='H'){
      cards[1][j-1]=1;
    } else if(i=='C'){
      cards[2][j-1]=1;
    } else if(i=='D'){
      cards[3][j-1]=1;
    }
  }

  int p, q;
  char r[128];

  for(p=0;p<4;p++){
    for(q=0;q<13;q++){
      if(cards[p][q]==1) continue;
      if(p==0){
	strcpy(r,s);
      } else if(p==1){
	strcpy(r,h);
      } else if(p==2){
	strcpy(r,c);
      } else {
	strcpy(r,d);
      }
      printf("%s %d\n", r, q+1);
    }
  }

    return 0;
}


Measured memory_bytes: 1036
//デバッグ用オプション：-fsanitize=undefined,address

//コンパイラ最適化
#pragma GCC optimize("Ofast")

//インクルードなど
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
//FORAは範囲for文(使いにくかったら消す)
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;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--)
#define FORA(i,I) for(const auto& i:I)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

signed main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
  int n;
  ll L[101];
  cin >> n;
  if(n<3){
    cout << 0;
    return 0;
  }
  REP(i,n) cin >> L[i];
  
  int res=0;
  
  REP(i,n-2){
   FOR(j,i+1,n-1){
     FOR(k,j+1,n){
       if(L[i]==L[j] || L[i]==L[k] || L[j]==L[k]){
         continue;
       }
       if(L[i]+L[j]>L[k] && L[j]+L[k]>L[i] && L[k]+L[i]>L[j]){
         res++;
       }
     }
   }
  }
  
  cout << res;
}

Measured memory_bytes: 3632
function seiri(arr = []) {
  var length = arr.length;
  if (!(length > 0)) return false;
  var newarr = arr[0];
  for (var i = 1; i < length; i++) {
    for (var j = 0; j < newarr.length; j++) {
      newarr[j] += arr[i][j];
    }
  }
  return newarr;
}
function Main(input) {
  input = input.trim().split("\n");
  const NMX = input[0].split(" ");
  const N = parseInt(NMX[0], 10);
  const M = parseInt(NMX[1], 10);
  const X = parseInt(NMX[2], 10);
  var arrCA = [];
  for (var i = 1; i <= N; i++) {
    arrCA.push(input[i].split(" ").map((n) => parseInt(n, 10)));
  }

  var now = 9999999;

  function Check(arr, X) {
    var arr = arr;
    return arr.every((n) => n >= X);
  }

  for (var bit = 0; bit < 1 << N; bit++) {
    var sum = 0;
    var arr = [];

    for (var i = 0; i < N; i++) {
      if (bit & (1 << i)) {
        //フラグが立っていたら
        arr.push(arrCA[i]);
      }
    }
    arr = seiri(arr);

    if (arr) {
      sum = arr[0];
      var checkarr = arr.slice(1, N + 1);
      if (Check(checkarr, X) && now > sum) {
        now = sum;
      }
    }
    arrCA = [];
    for (var i = 1; i <= N; i++) {
      arrCA.push(input[i].split(" ").map((n) => parseInt(n, 10)));
    }
  }

  if (now == 9999999) {
    console.log("-1");
  } else {
    console.log(now);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 36388
#include<bits/stdc++.h>
int main()
{
	int n,sum=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int t=0,k=i;
		while(k!=0)
		{
			t=t+1;
			k=k/10;
		}
		if(t%2==1)sum++;
	}
	printf("%d\n",sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,a[N],x;
map<int,int> mp;
int main()
{
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i],mp[a[i]]++;
	int res=0;
	for(int i=0;i<n;i++)
	{
		if(mp[a[i]]!=a[i])
		{
			if(mp[a[i]]<a[i])
				res+=mp[a[i]],mp[a[i]]=0;
			else
				res+=mp[a[i]]-a[i],mp[a[i]]=a[i];
		}
	}
	cout<<res<<endl;
	
	return 0;
}

Measured memory_bytes: 5120
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
def LILI(n): return [LI() for _ in range(n)]
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N = II()
    ans = 1
    for i in range(3):
        ans *= N

    print(ans)

main()

Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
bool isprime[50000];
int main(){
 for(int i=0;i<50000;i++){
  isprime[i]=true;   
 }
 for(int i=2;i*i<50000;i++){
  for(int j=2;j<50000;j++){
      if(j%i==0&&i!=j){
       isprime[j]=false;   
      }
  }
 }
 int n;
 while(true){
 cin>>n;
 if(n==0)
 break;
 int count=0;
 for(int i=2;i<=n/2;i++){
  if(isprime[i]==true&&isprime[n-i]==true)
  count++;
 }
 cout<<count<<endl;
 }
 return 0;   
}

Measured memory_bytes: 1208
A = [[0]*3]*3
for i in range(3):
    A[i] = list(map(int,input().split()))
N = int(input())
for _ in range(N):
    a = int(input())
    for i in range(3):
        if a in A[i]:
            A[i][A[i].index(a)] = 0
for i in range(3):
    if A[i].count(0) == 3:
        print("Yes")
        exit()
for i in range(3):
    if A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0:
        print("Yes")
        exit()
for i in range(3):
    if A[i][i] != 0:
        break
    if i == 2:
        print("Yes")
        exit()
if A[2][0] == 0 and A[1][1] == 0 and A[0][2] == 0:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 3064
from collections import defaultdict
N = int(input())
D = defaultdict(int)
for i in range(N):
    D[input()] += 1

MAX = max(D.values())
ans = []
for k, v in D.items():
    if v == MAX:
        ans.append(k)

ans.sort()
print(*ans, sep='\n')


Measured memory_bytes: 34268
#include <iostream>
using namespace std;
int main(void){
    
    int ans = 0;
    string S;
    cin >> S;
    
    if(S.size()%2){
        for(int i = 1; i <= S.size()/2; i++){
            //cout << S[i-1] << "!=" << S.size()-i << endl;
            if(S[i-1] != S[S.size()-i]) ans++;
        }
    }
    else{
        for(int i = 1; i <= S.size()/2; i++){
            //cout << S[i-1] << "!=" << S.size()-i << endl;
            if(S[i-1] != S[S.size()-i]) ans++;
        }
    }
    
    cout << ans << endl;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  for(int i = a; i <= a * b; i+=a){
    if(i % b == c){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 3620
#define aaaa 1
#ifdef aaaa
    #include <bits/stdc++.h>
    #ifdef LOCAL
        #include "cxx-prettyprint-master/prettyprint.hpp"
        #define print(x) cout << x << endl
    #else
        #define print(...) 42
    #endif
    using namespace std;
    using ll = long long;
    #define INF 1'010'000'000'000'000'017LL
    #define mod 1000000007LL
    #define eps 0.0001
    #define all(x) (x).begin(), (x).end()
    #define FOR(i,a,b) for(ll i=(a);i<(b);++i)
    #define rep(i,n)  FOR(i,0,n)
    #define reverse(x) (x).rbegin(), (x).rend()
    #define SZ(x) ((ll)(x).size())
    #define sum(x) accumulate(ALL(x), 0LL)//?
    #define pb(x) push_back(x)
    template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
    template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
    class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
    public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};
#endif
int main() { 
    ll N, M;
    cin >> N >> M;
    ll ans = (1900*M+100*(N-M))*pow(2, M);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
count=0
a=[]
for i in range(n):
    a.append(2)
for i in range(m):
    a.append(1)
#print(a)

for i in range(n+m-1):
    for j in range(i+1,n+m):
        #print(a[i],a[j])
        if (a[i]+a[j])%2==0:
            count+=1
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  ll INF = Mod*1000;
  int N,M;
  cin >> N >> M;
  int a[M];
  int key[M];
  for (int i = 0; i < M; i++) {
    key[i] = 0;
  }
  for (int i = 0; i < M; i++) {
    int c;
    cin >> a[i] >> c;
    for (int j = 0; j < c; j++) {
      int d;
      cin >> d;
      d--;
      key[i] += (1 << d);
    }
  }
  ll DP[M+1][(1 << N)];
  for (int i = 0; i <= M; i++) {
    for (int j = 0; j < (1 << N); j++) {
      DP[i][j] = INF;
    }
  }
  for (int i = 0; i <= M; i++) {
    DP[i][0] = 0;
  }
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < (1 << N); j++) {
      DP[i+1][j] = DP[i][j];
    }
    for (int j = 0; j < (1 << N); j++) {
      if (DP[i+1][j | key[i]] > DP[i][j] + a[i]) {
        DP[i+1][j | key[i]] = DP[i][j] + a[i];
      }
    }
  }
  if (DP[M][(1 << N) - 1] == INF) {
    cout << -1 << endl;
  } else {
    cout << DP[M][(1 << N) - 1] << endl;
  }
  return 0;
}

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

void main()
{
  auto rd1 = readln.split, w = rd1[0].to!int, h = rd1[1].to!int, n = rd1[2].to!size_t;

  auto x1 = 0, x2 = w, y1 = 0, y2 = h;
  foreach (_; 0..n) {
    auto rd2 = readln.split.to!(int[]), x = rd2[0], y = rd2[1], a = rd2[2];
    switch (a) {
    case 1: x1 = max(x1, x); break;
    case 2: x2 = min(x2, x); break;
    case 3: y1 = max(y1, y); break;
    case 4: y2 = min(y2, y); break;
    default: assert(0);
    }
  }

  writeln(x1 >= x2 || y1 >= y2 ? 0 : (x2-x1) * (y2-y1));
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  int N,K;
  str S;
  cin >> N >> K;
  cin >> S;
  if(S[K-1]=='A') S[K-1]='a';
  if(S[K-1]=='B') S[K-1]='b';
  if(S[K-1]=='C') S[K-1]='c';

  print(S);


 return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

        final long n = sc.nextLong();

        List<Long> divisors = new ArrayList<>();

        int ans = Integer.MAX_VALUE;

        for (long i = 1; i * i <= n; i++) {
            if (n % i == 0) {
               final int f = Math.max(String.valueOf(i).length(), String.valueOf(n/i).length());
               ans = Math.min(ans, f);
            }
        }

        System.out.println(ans);
    }
}


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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main() {
  int h,w;
  cin >> h >> w;
  vector<string>a(w);
  vector<int>b(w);
  a.resize(h);
  rep(i, 0, h)cin >> a[i];
  int c =0;
  rep(i, 0, h){
      rep(j, 0, w){
          if(a[i][j]=='#')c++;
      }
  }
  if(c == h+w-1)cout<< "Possible"<<endl;
  else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;


signed main(){
    cin >> n;
    n--;
    vec(a,n);
    input(a,n);
    int tot = 0;
    REP(i,n-1){
        tot += min(a[i],a[i+1]);
    }
    tot += a[0] + a[n-1];
    print(tot);
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    string t;
    cin >> s >> t;
    int n,m;
    n = s.length();
    m = t.length();
    string ans = "UNRESTORABLE";
    bool chk = false;
    for(int i=n-1;i>=m-1;i--){
        if(s[i] == t[m-1] || s[i] == '?'){
            chk = true;
            for(int j=0;j<m;j++){
                if(s[i-j] != t[m-1-j] && s[i-j] != '?'){
                    chk=false;
                    break;
                }
            }
            if(chk){
                for(int j=0;j<m;j++){
                    s[i-j] = t[m-1-j];
                }
                break;
            }
        }
    }
    if(chk){
        for(int i=0;i<n;i++){
            if(s[i]=='?')s[i] = 'a';
        }
        ans = s;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()



n, m = na()

upper = [-1] * n
def root(x):
    if upper[x] < 0:
        return x
    else:
        upper[x] = root(upper[x])
        return upper[x]

def equiv(x, y):
    return root(x) == root(y)

def unite(x, y):
    x, y = root(x), root(y)
    if x != y:
        if upper[y] < upper[x]:
            x, y = y, x
        upper[x] += upper[y]
        upper[y] = x
    return x == y

for i in range(m):
    a, b = na()
    unite(a-1, b-1)

print(-min(upper))


Measured memory_bytes: 79016
/* 実行時間1s制限の場合10^6 1,000,000 : 余裕をもって間に合う10^7
  10,000,000 : おそらく間に合う10^8 100,000,000 : 非常にシンプルな処理
  でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

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

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    //std::ifstream in(string(argv[0]) + ".txt");
    std::ifstream in("in.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    string c1, c2;
    cin >> c1 >> c2;

    if (c1[0] == c2[2] &&
        c1[1] == c2[1] &&
        c1[2] == c2[0]) {
        cout << "YES";
        return 0;
    }
    cout << "NO";


    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



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

flag = [False] * n
for i in range(n-1):
	if h[i] < h[i+1]:
		flag[i] = True

cnt, ans = 0, 0
for i in range(n-1):
	if flag[i]:
		ans = max(cnt, ans)
		cnt = 0
	else: 
		cnt += 1

print(max(cnt, ans))
		



Measured memory_bytes: 14252
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToLong();
		
		var s = new Stack<int>();
		while(true)
		{
			if(n <= 26)
			{
				s.Push((int)n);
			
				break;
				
			}
			s.Push((int)(n % 26));
			n--;
			n /= 26;
		}
		
		int cnt = 0;
		while(s.Count > 0)
		{
			var t = s.Pop();
			//Console.WriteLine(t);

			if(cnt == 0)
			{
			Console.Write("{0}", (char)(t + 'a' - 1));
			}
			else
			{
				if( t == 0)
					Console.Write("z");
				else
					Console.Write("{0}", (char)(t + 'a' - 1));
			}
			cnt++;
		}
		Console.WriteLine();

	}

	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 27808
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,m,mod=1000000007;
  cin>>n>>m;
  int ans=1;
  for(int i=1;i<=min(n,m);i++){
    ans*=i;
    ans%=mod;
  }
  ans*=ans;
  ans%=mod;
  if(n==m)cout<<(ans*2)%mod<<endl;
  else if(abs(n-m)==1)cout<<(ans*max(n,m))%mod<<endl;
  else cout<<0<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Aksenov239 on 23.10.2016.
 */
public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    public String nextToken() throws  IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws IOException{
        return Integer.parseInt(nextToken());
    }

    public void solveA() throws IOException {
        String s = nextToken();
        String f = "CF";
        int p = 0;
        for (int i = 0; i < s.length() && p < f.length(); i++) {
            if (s.charAt(i) == f.charAt(p)) {
                p++;
            }
        }
        if (p == 2) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);

            solveA();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 8276
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n;
char s[maxn];
typedef long long ll;
const ll mod = 1e9 + 7;
ll fac(int x) { ll ret = 1; for(int i = 1; i <= x; ++i) ret = ret * i % mod; return ret;}
ll f(int i, int j)
{
	if(i == 0) return j == 0;
	if(s[i] == 'B')
	{
		if(j & 1)
			return f(i - 1, j - 1);
		else
			return f(i - 1, j + 1) * (j + 1) % mod;
	}
	else
	{
		if(j & 1)
			return f(i - 1, j + 1) * (j + 1) % mod;
		else if(j > 0)
			return f(i - 1, j - 1);
		else
			return 0;
	}
}
int main()
{
	scanf("%d", &n);
	scanf("%s", s + 1);
	cout << f(2 * n, 0) * fac(n) % mod << endl;
	return 0;
}

Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public class Condition
        {
            public int S { get; set; }
            public int C { get; set; }
        }

        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var N = items[0];
            var M = items[1];

            var table = new List<Condition>();
            foreach (var i in Enumerable.Range(0, M))
            {
                var items2 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
                var s = items2[0];
                var c = items2[1];
                table.Add(new Condition { S = s, C = c });
            }

            var answer = -1;
            int min;
            int max;
            switch (N)
            {
                case 1:
                    min = 0;
                    max = 9;
                    break;
                case 2:
                    min = 10;
                    max = 99;
                    break;
                case 3:
                    min = 100;
                    max = 999;
                    break;
                default:
                    throw new Exception("エラー");
            }

            foreach (var num in Enumerable.Range(min, max - min + 1))
            {
                var checkText = num.ToString($"D{N}");
                if (table.Any(pair => checkText[pair.S - 1].ToString() != pair.C.ToString()))
                {
                    continue;
                }
                else
                {
                    answer = num;
                    break;
                }
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13396