akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys


def solve(S: str):
    ans = 754
    for i in range(len(S)-2):
        t = int(S[i:i+3])
        ans = min(ans,abs(753-t))

    print(ans)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,M;
	scan(N>>M);
	prin(N*(N-1)/2+M*(M-1)/2);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int n,m;
map<PII,int>mp; 
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		mp[{u,v}]=1; 
	}
	for(int i=2;i<n;i++){
		if(mp[{1,i}]&&mp[{i,n}]) return puts("POSSIBLE"),0;	
	}
	puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 28448
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            long po = 1;
            for(var i = 1;i<=N;i++)
            {
                po = (po * i) % 1000000007;
            }
            Console.WriteLine(po);

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
int n,a[101],cnt,sum,ans=INF;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for (int i=1;i<=n;++i) cin>>a[i],sum+=a[i];
	for (int i=1;i<=n;++i)
	{
		cnt+=a[i];
		sum-=a[i];
		ans=min(ans,abs(cnt-sum));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define INF 2000000000

void merge(int *,int,int,int);
void mergesort(int *,int,int);

int A[100000000], L[1000000],R[1000000];
int count=0;

int main(){
  int i,n;

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

  mergesort(A,0,n);

  for(i=0;i<n;i++){
    if(i>0) printf(" %d",A[i]);
    else printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",count);

  return 0;
}

void merge(int *A,int left,int mid,int right){
  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;

  for(i=0;i<n1;i++) L[i]=A[left+i];


  for(i=0;i<n2;i++) R[i]=A[mid+i];

  L[n1] = INF;
  R[n2] = INF;

  i = 0;
  j = 0;

  for(k=left;k<right;k++){
    count++;
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }else{
      A[k]=R[j];
      j=j+1;
    }
  }
}

void mergesort(int *A,int left, int right){
  int mid;
  if(left+1<right){
    mid = (left+right)/2;
    mergesort(A,left,mid);
    mergesort(A,mid,right);
    merge(A,left,mid,right);
  }
}



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

int main(){
  int n,m,x;
  cin>>n>>m>>x;
  int vec[n][m];
  int cost[n];
  for(int i=0;i<n;i++){
    cin>>cost[i];
    for(int j=0;j<m;j++){
      cin>>vec[i][j];
    }
  }
  int vecc[n];
  int ans=1e7;
  int vecd[m];
  int p=0,q=0;
  for(int bit=0;bit<(1<<n);bit++){
    for(int i=0;i<n;i++){
      if(bit&(1<<i)){
        vecc[i]=1;
      }
      else{
        vecc[i]=0;
      }
    }
    p=0,q=0;
    for(int i=0;i<m;i++){
      vecd[i]=0;
    }
    for(int i=0;i<n;i++){
      if(vecc[i]==1){
        p+=cost[i];
        for(int j=0;j<m;j++){
          vecd[j]+=vec[i][j];
        }
      }
    }
    for(int i=0;i<m;i++){
      if(vecd[i]<x){
        q++;
      }
    }
    if(q==0){
      ans=min(ans,p);
    }
  }
  if(ans==10000000){
    cout<<-1<<endl;
    return 0;
  }
  cout<<ans<<endl;      
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);++i)
#define rep(i,n) REP(i, 0, n)
typedef long long int i64;
typedef pair<int, int> pint;

map<int, pint> usam, nekom;
int usum[2][501], nsum[2][501];
int m[100000];
int main() {
    int N, U, V, M;
    scanf("%d%d%d%d", &N, &U, &V, &M);
    int num;
    rep(i, N) rep(j, N) {
        scanf("%d", &num);
        usam[num] = pint(j, i);
    }
    rep(i, N) rep(j, N) {
        scanf("%d", &num);
        nekom[num] = pint(j, i);
    }
    rep(i, M) scanf("%d", m + i);
    rep(i, M) {
        if(usam.count(m[i])) {
            usum[0][usam[m[i]].first]++;
            usum[1][usam[m[i]].second]++;
            if(usam[m[i]].first == usam[m[i]].second) usum[0][N]++;
            if(usam[m[i]].first == N - 1 - usam[m[i]].second) usum[1][N]++;
        }
        if(nekom.count(m[i])) {
            nsum[0][nekom[m[i]].first]++;
            nsum[1][nekom[m[i]].second]++;
            if(nekom[m[i]].first == nekom[m[i]].second) nsum[0][N]++;
            if(nekom[m[i]].first == N - 1 - nekom[m[i]].second) nsum[1][N]++;
        }
        int un = 0, vn = 0;
        rep(i, 2) rep(j, N + 1) if(usum[i][j] == N) un++;
        rep(i, 2) rep(j, N + 1) if(nsum[i][j] == N) vn++;
        if(N == 1) un = min(un, 1), vn = min(vn, 1);
        if(un >= U && vn >= V) break;
        else if(un >= U) goto USA;
        else if(vn >= V) goto NEKO;
    }
    puts("DRAW");
    return 0;;
  USA: puts("USAGI");
    return 0;
  NEKO: puts("NEKO");
    return 0;
}

Measured memory_bytes: 19288
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] t = new long[n];
		long[] a = new long[n];

		for (int i = 0; i < n; i++) {
			t[i] = sc.nextInt();
			a[i] = sc.nextInt();

		}

		for (int i = 1; i < n; i++) {
			if (t[i] < t[i - 1] || a[i] < a[i - 1]) {
				long mul = Math.max(ceil(t[i - 1], t[i]),
						ceil(a[i - 1], a[i]));
				t[i] *= mul;
				a[i] *= mul;
			}

			//		System.out.print(t_hyou + ", ");
			//		System.out.print(a_hyou + ", ");
			//		System.out.println(t_hyou + a_hyou);

		}
		System.out.println(t[n - 1] + a[n - 1]);
		sc.close();
	}

	static long ceil(long a, long b) {
		if (a % b == 0) {
			return a / b;
		} else {
			return a / b + 1;
		}

	}
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        long step[] = new long[n+1];
        Arrays.fill(step, -1);
        step[0] = 1;
        step[1] = 1;

        for(int i=0; i < m; i++){
            int a = sc.nextInt();
            step[a] = 0;
        }

        for(int i=2; i <= n; i++){
            if(step[i] == -1) {
                step[i] = (step[i - 1] + step[i - 2]) % 1000000007;
            }
        }
        System.out.println(step[n]);
    }
}

Measured memory_bytes: 49040
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int yen = sc.nextInt();
		int fukuzawa = -1;
		int higuchi = -1;
		int noguchi = -1;

		for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		}
		System.out.println(fukuzawa + " "+ higuchi +" " + noguchi);
	}
}

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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
//#define ld long double
#define mod 998244353
#define inf 100000000000010
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mpp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define repr(x,n,j)for(ll x=n;x>j;x--)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;
typedef long double ld;
bool isprime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}




ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}

ll addmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
ll submod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    a-=b;
    if(a<0)a+=mod;
    return a%mod;
}
struct CustomCompare
{
    bool operator()(ll a,ll b)
    {
        return a>b;
    }
};
/*
const int mxn = 5*(1e6) +10;
vi spf(mxn);
void sieve()
{
    for(ll i =0;i<mxn;i++)spf[i]  = i;
    for(ll i=2;i<mxn;i+=2)spf[i] = 2;
    for(ll i = 3;i*i<mxn;i++)
    {
        if(spf[i]==i)
        {
            for(ll j = i*i;j<mxn;j+=i)
            {
                if(spf[j]==j)spf[j] = i;
            }
        }
    }
}
*/

const int mxn = 2e5 + 10;
ll tree[mxn];

void update(ll i,ll val)
{
    while(i<mxn)
    {
        tree[i]=addmod(tree[i],val);
        i+=i&-i;
    }
}
ll query(ll i)
{
    ll ans = 0;
    while(i>0)
    {
        ans = addmod(tree[i],ans);
        i-=i&-i;
    }
    return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);

ll n,x,m; cin>>n>>x>>m;
vi arr(m);
arr[x] = 1;

vi pref(m+1);
pref[1] = x;
ll pos ;
ll res = n-1,ans;
for(ll i=2;res;i++,res--)
{
    ll val = (x*x)%m;
    if(arr[val])
    {
        pos = arr[val],ans = i-1;
        break;
    }
    arr[val] = i;
    pref[i]=pref[i-1]+val;
    x = val;
    //cout<<x<<" ";
}
//cout<<pos<<endl;
if(res==0)cout<<pref[n]<<endl;
else
{
    ll sum = pref[ans] - pref[pos-1] ;
    ll len = ans-pos+1;
    //cout<<pos<<endl;
    n-=(pos-1);
    ll i = n/len , j = n%len;

    cout<<sum*i + pref[pos-1] + (pref[pos-1+j]-pref[pos-1]) <<endl;
}
return 0;
}
/*
4
1
1 2 1

*/


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

constexpr int dh[4] = {0, 1, 0, -1};
constexpr int dw[4] = {1, 0, -1, 0};
struct Pos {
    int h, w;
};


int main() {
    int H, W;
    cin >> H >> W;
    vector<string> s(H);
    for (int i = 0; i < H; ++i) cin >> s[i];

    int ans = 0;
    for (int h = 0; h < H; ++h) {
        for (int w = 0; w < W; ++w) {
            if (s[h][w] == '#') continue;
            // BFS //
            vector<vector<int>> dist(H, vector<int>(W, -1));
            queue<Pos> que; que.emplace(Pos({h, w}));
            dist[h][w] = 0;
            while(not que.empty()) {
                const Pos now = que.front(); que.pop();
                for (int i = 0; i < 4; ++i) {
                    const int nh = now.h + dh[i];
                    const int nw = now.w + dw[i];
                    if (nh < 0 or nh >= H) continue;
                    if (nw < 0 or nw >= W) continue;
                    if (s[nh][nw] == '#') continue;
                    if (dist[nh][nw] != -1) continue;
                    dist[nh][nw] = dist[now.h][now.w] + 1;
                    que.emplace(Pos({nh, nw}));
                }
            }
            for (int i = 0; i < H; ++i) {
                for (int j = 0; j < W; ++j) {
                    ans = max(ans, dist[i][j]);
                }
            }
        }
    }

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

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
int main()
{
    int a, b;
    cin >> a >> b;
    cout << ( a + b < 24 ? a + b : a + b - 24 ) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    ll N, X;
    cin >> N >> X;
    ll count = 1;
    ll previousD = 0;
    ll L;
    for (ll i = 0; i < N; i++)
    {
        cin >> L;
        if (previousD + L > X)
        {
            break;
        }
        else
        {
            previousD = previousD + L;
            count++;
        }
    }

    cout << count << endl;
}

int main()
{
    solve();
    return 0;
}


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

using namespace std;

int main(){
    int64_t x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    int64_t n = x / d;
    x -= min(n, k) * d;
    k -= n;
    if (k <= 0){
        cout << x << endl;
        return 0;
    }

    x -= d * (k % 2);
    cout << abs(x) << endl;
}

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

using namespace std;
using ll = long long;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


int main() {
    int N, M; cin >> N >> M;
    vector<vector<int>> edge(N+1);//1-indexed
    vector<int> in(N+1, 0);
    for(int i = 0; i < N+M-1; i++)
    {
        int s, t; cin>>s>>t;
        edge[s].push_back(t);
        in[t]++;
    }
    
    queue<int> q;
    for(int i = 1; i < N+1; i++)
    {
        if(in[i]==0)q.push(i);
    }
    vector<int>parent(N+1);
    while(!q.empty()){
        int node=q.front();
        q.pop();
        for(auto i : edge[node]){
            in[i]--;
            parent[i]=node;
            if(in[i]==0)q.push(i);
        }
    }

    for(int i = 1; i < N+1; i++)
    {
        cout<<parent[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 7040
package main

import (
	"fmt"
	"math"
)

func main() {
	var (
		N, M, X, a int
	)
	fmt.Scan(&N, &M, &X)
	cnt1, cnt2 := 0, 0
	for i := 0; i < M; i++ {
		fmt.Scan(&a)
		if a > X {
			cnt1++
			continue
		}
		cnt2++
	}
	fmt.Println(min(cnt1, cnt2))
}

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

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;

  cout << (n % k == 0 ? 0 : 1) << endl;
  return 0;
}


Measured memory_bytes: 256
public class Hello{
    public static void Main(){
        // Here your code !
        string[] lineArray = System.Console.ReadLine().Split(' ');
        int d = int.Parse(lineArray[0]);
        int a = int.Parse(lineArray[1]);
        int b = int.Parse(lineArray[2]);
        if (b <= a) {
            System.Console.WriteLine( "delicious" );
        } else if (b <= a + d) {
            System.Console.WriteLine( "safe" );
        } else if (b > a + d) {
            System.Console.WriteLine( "dangerous" );
        }
    }
}

Measured memory_bytes: 11092
# coding: utf-8
 
a, b, c = map(int, input().split())
 
x = a*10 + b
y = b*10 + c
z = c*10 + a
 
if x >= y and x >= z:
    print(x + c)
elif y >= x and y >= z:
    print(y + a)
else:
    print(z + b)

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

int N, M;
int ans;
vector<vector<int> > G;
vector<pair<int, int> > E;
pair<int, int> pro;
void visit(int pos, vector<int> &visited) {
	visited[pos] = 1;
	ans++;
	for (int i : G[pos]) {
		if (make_pair(pos, i) == pro || make_pair(i, pos) == pro) continue;
		if (! visited[i]) visit(i, visited);
	}
}
int main() {
	cin >> N >> M;
	G.resize(N);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
		E.push_back(make_pair(a, b));
	}
	int hoge = 0;
	for (int i = 0; i < M; i++) {
		pro = E[i];
		ans = 0;
		vector<int> visited(N);
		visit(0, visited);
		if (ans != N) hoge++;
	}
	cout << hoge << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>

#define FOR(i,k,n) for(int (i) = (k); (i) < (n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x,y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template<class T> using vv=vector<vector<T>>;
typedef deque<int> di;
typedef deque<deque<int>> ddi;

short d[101] = {}, v[101] = {};
bool  p[101][101] = {};
short t = 0;
int n;  

void dfs(int i) {
    if(d[i] != 0) return;
    d[i] = ++t;
    rep(j,n+1) {
        if(p[i][j] == 1 & d[j] == 0) {
            dfs(j);     
        }
    }
    v[i] = ++t;
}

int main() {
    cin >> n;
    rep(i,n) {
        short u,k;
        cin >> u >>k; 
        rep(j,k) {
            int tmp;
            cin >> tmp;
            p[u][tmp] = 1; 
        }
    }
    FOR(i,1,n+1) {
        dfs(i);
    }
    FOR(i,1,n+1) {
        cout << i << " " << d[i] << " " << v[i] << endl;
    }
	return 0;
}

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

int main() {
  int r;
  cin >> r;
  
  if(r < 1200)
    cout << "ABC" << endl;
  else if(r < 2800)
    cout << "ARC" << endl;
  else
    cout << "AGC" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<cstdlib>
#include<map>
#include<vector>
#include<ctime>
#include<stack>
#define mp make_pair
#define pa pair<int,int>
#define INF 0x3f3f3f3f
#define inf 0x3f
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ull unsigned long long

using namespace std;

inline ll read()
{
	long long f=1,sum=0;
	char c=getchar();
	while (c<'0' || c>'9')
	{
		if (c=='-')	f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9')
	{
		sum=sum*10+c-'0';
		c=getchar();
	}
	return sum*f;
}

int main()
{
	int n;
	scanf("%d",&n);
	cout<<n/3;
	return 0;
}


Measured memory_bytes: 256
// 2014/09/11 Tazoe

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;

struct dic{
	string ds;
	int di;
};

int main()
{
	while(true){
		string N;
		getline(cin, N);

		if(N=="0")
			break;

		istringstream isN(N);
		int n;
		isN >> n;

		vector<string> w;

		for(int i=0; i<n; i++){
			string S;
			getline(cin, S);

			istringstream isS(S);
			while(!isS.eof()){
				string s;
				isS >> s;

				w.push_back(s);
			}
		}

		sort(w.begin(), w.end());

		string K;
		getline(cin, K);

		istringstream isK(K);
		char k;
		isK >> k;

		vector<struct dic> D;
		string pre = "";

		for(int i=0; i<w.size(); i++){
			if(w[i][0]!=k)
				continue;

			if(w[i]==pre){
				D.back().di++;
			}
			else{
				struct dic tmp;
				tmp.ds = w[i];
				tmp.di = 1;
				D.push_back(tmp);
				pre = w[i];
			}
		}

//		for(int i=0; i<D.size(); i++){
//			cout << D[i].ds << ' ' << D[i].di << endl;
//		}

		if(D.size()==0){
			cout << "NA" << endl;
			continue;
		}

		for(int i=0; i<D.size()-1; i++){
			for(int j=i+1; j<D.size(); j++){
				if(D[i].di<D[j].di || (D[i].di==D[j].di && D[i].ds>D[j].ds)){
					swap(D[i], D[j]);
				}
			}
		}

		int m = D.size();
		if(m>5){
			m = 5;
		}

		for(int i=0; i<m; i++){
			cout << D[i].ds;

			if(i==m-1){
				cout << endl;
			}
			else{
				cout << ' ';
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1272
n=int(input())
L=[0]*3
f=True
for i in range(n):
  S=list(map(int,input().split()))
  if S[0]-L[0]<abs(S[1]-L[1])+abs(S[2]-L[2]):
    f=False
    break
  elif (S[0]-L[0]-(abs(S[1]-L[1])+abs(S[2]-L[2])))%2!=0:
    f=False
    break
  L=S
print('Yes' if f else 'No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll  long long
int main() 
{
	ll N;
	cin>>N;
	ll ans=0;
	for(ll i=sqrt(N);i>=1;i--)
	{
	    if(N%i==0)
	    {
	        ans=i-1+N/i-1;
	        break;
	    }
	}
	cout<<ans;
}

Measured memory_bytes: 256
a = list(map(int, input().split(" ")))
K=a[0]
X=a[1]

tmp=K
while tmp>1:
	print(X-tmp+1, end=" ")
	tmp -= 1
print(X, end=" ")
tmp=1
while tmp<K:
	print(X+tmp, end=" ")
	tmp += 1


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            System.out.println(B % A == 0 ? (A + B) : (B - A));
        }
    }
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
// 	cout<<"GfG!";
	ll h,n;
	cin>>h>>n;
	for(int i=0;i<n;i++)
	{
	    int x;
	    cin>>x;
	    h-=x;
	}
	if(h<=0)
	    cout<<"Yes";
	else
	    cout<<"No";
// 	sort(a,a+n);

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <map>
#include <set>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

const ll SIZE = 1e5 * 3 + 10;
vector <ll> vec;
ll q;

int main() {
	fastInp;

	ll n;
	cin >> n;
	bool flag = false;
	ll sum = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 5 != 0 && i % 3 != 0) sum += i;
	}

	cout << sum;
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(){
  int N,M;
  cin >> N >> M;
  vector <int> a(M);
  vector <int> b(M);
  
  rep(i,M)
    cin >> a.at(i) >> b.at(i);
  rep(i,N){
    int x=0;
    rep(j,M){
      if(a.at(j) == i+1 || b.at(j) == i+1)
        x++;
    }
    cout << x << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e15;

int main() {
  ll n;
  cin >> n;
  vec t(n+1),v(n+1,0);
  for(ll i=0;i<n;i++) cin >> t[i],t[i]*=2;
  for(ll i=0;i<n;i++) cin >> v[i],v[i]*=2;
  ll to=0;
  ll id=0;
  vec z(8e4+10,0);
  for(ll i=0;i<n;i++) {
    to+=t[i];
    z[id]=min(z[id],v[i]);
    for(id++;id<=to;id++) z[id]=min(z[id-1]+1,v[i]);
    id--;
  }
  ll mv=0;
  double ans=0;
  for(ll i=id-1;i;i--) {
    mv=min(z[i],mv+1);
    ans+=double(mv);
  }
  ans/=4.0;
  printf("%.9f", ans);
}

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



    int a,b,c,ob,oc;
    cin>>a>>b>>c;
    if(a>b){
        ob=b;
        b=a;
        a=ob;
    }
    if(b>c){
        oc=c;
        c=b;
        b=oc;
    }
    if(a>b){
        ob=b;
        b=a;
        a=ob;
    }
    cout<<a<<" "<<b<<" "<<c<<endl;

}



Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
/*
　　　　　 　 _... ..._
　　　　　 , ´⌒ ⌒ヽ
　　　 　 ﾉｨ（ノﾉ）ﾉ）ﾉ）
　　　 　 （（q|.ﾟ ヮﾟﾉ|ﾊ
　　　　　　△ﾑ,8ﾑﾌつ
　　　　　/(ﾝ_/＿ヽ＼
　　　　 ～～i_ﾌ_ﾌ～´
*/
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << (a - c) * (b - d) << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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() {
    ll n, x, cnt;
    cin >> n >> x;
    vector<ll> a(n, 0);
    rep1(i, n){
        cin >> cnt;
        a[i] = abs(x-cnt);
    }
    ll ans = a[0];
    rep1(i, n-1) ans = gcd(ans, a[i+1]);
    cout << ans << endl;
}

Measured memory_bytes: 3920
import numpy as np
H,W=map(int, input().split())
S=np.array([list(input()) for i in range(H)]) == '.'
us=np.zeros((H,W), dtype=int)   
ds=np.zeros((H,W), dtype=int)   
ls=np.zeros((H,W), dtype=int)    
rs=np.zeros((H,W), dtype=int)  

for h in range(1,H):
    us[h, :]=(us[h-1, :]+1) * S[h-1, :]
for h in range(H-2, -1, -1):
    ds[h, :]=(ds[h+1, :]+1) * S[h+1, :]
for w in range(1,W):
    ls[:, w]=(ls[:, w-1]+1) * S[:, w-1]
for w in range(W-2, -1, -1):
    rs[:, w]=(rs[:, w+1]+1) * S[:, w+1]

ans = ((us+ds+ls+rs)*S).max()+1
print(ans)


Measured memory_bytes: 219820
#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 <functional>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
vector<int> G[300000];
int Cost[300000];
void Calc(){
	int N = rei();
	int M = rei();
	for(int i=0;i<M;i++){
		int u = rei()-1;
		int v = rei()-1;
		G[3*u].push_back(3*v+1);
		G[3*u+1].push_back(3*v+2);
		G[3*u+2].push_back(3*v);
	}
	int S = rei()-1;
	int T = rei()-1;
	for(int i=0;i<3*N;i++){
		Cost[i] = 600000;
	}
	Cost[3*S] = 0;
	queue<int> que;
	que.push(3*S);
	while(!que.empty()){
		int v = que.front();
		que.pop();
		for(int t:G[v]){
			if(Cost[t] == 600000){
				Cost[t] = Cost[v]+1;
				que.push(t);
			}
		}
	}
	if(Cost[3*T] == 600000){
		cout << "-1" << endl;
	}
	else{
		cout << Cost[3*T]/3 << endl;
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 17792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b,ll c){if(a==b)out(c);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
int main(){
    ll a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
    string s,t,u;cin>>s>>t>>u;
    if(a*500>=b)out("Yes");
    else out("No");
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int arr[10] = {};
    REP(i, 0, 4) {
        int a;
        cin >> a;
        arr[a]++;
    }

    cout << (arr[1] * arr[9] * arr[7] * arr[4] == 1 ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int AC = 0, WA = 0, TLE = 0, RE = 0;
        ArrayList<String> sn = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            sn.add(scanner.next());
        }
        for (String s : sn) {
            switch (s) {
                case "AC":
                    AC = AC + 1;
                    break;
                case "WA":
                    WA = WA + 1;
                    break;
                case "TLE":
                    TLE = TLE + 1;
                    break;
                case "RE":
                    RE = RE + 1;
                    break;
            }
        }
        System.out.println("AC x " + AC);
        System.out.println("WA x " + WA);
        System.out.println("TLE x " + TLE);
        System.out.println("RE x " + RE);
    }
}

Measured memory_bytes: 65632
import sys
readline = sys.stdin.readline
def insertionSort(A, n, g, cnt):
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j -= g
            cnt += 1
        A[j + g] = v
    return cnt
def shellSort(A, n):
    cnt = 0
    h = 4
    G = [1]
    while h < n:
        G += [h]
        h = 3 * h + 1
    m = len(G)
    for i in range(m - 1, -1, -1):
        cnt = insertionSort(A, n, G[i], cnt)
    print(m)
    print(*G[::-1])
    print(cnt)
    print(*A, sep="\n")
n = int(input())
# A = [int(readline()) for _ in range(n)]
A = list(map(int, sys.stdin.readlines()))
shellSort(A, n)



Measured memory_bytes: 116448
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#define rep(a,b) for(int a=0;a<b;++a)
#define REP(a,b,c,d) for(int a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
	string S; cin >> S;
	int ans = 0;
	rep(i, 6) if (S[i] == '1')++ans;
	cout << ans << endl;
}

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

int main() {
  int n, q;
  cin >> n >> q;
  vector<vector<int>> g(n);
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  vector<ll> res(n, 0);
  while (q--) {
    int p, x;
    cin >> p >> x;
    p--;
    res[p] += x;
  }
  auto dfs = [&](auto& f, int p, int u) -> void{
    if (u != 0) res[u] += res[p];
    for (auto v : g[u]) {
      if (p == v) continue;
      f(f, u, v);
    }
  };
  dfs(dfs, -1, 0);
  for (auto e : res) cout << e << " ";
  cout << endl;
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    ll K;
    cin >> K;
    string c = "";
    ll n = min(K,(ll)s.length());
    for(ll i = 0; i < n; i++){
        if(s[i] != '1'){
            c = s[i];
            break;
        }
    }
    if(c.length() != 0){
        cout << c << endl;
    }else{
        puts("1");
    }
    return 0;
}

Measured memory_bytes: 256
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
n = int(input())
hp = list(map(int, input().split()))
while len(hp) != 1:
    minhp = min(hp)
    hp = [i % minhp if not i == minhp else i for i in hp]
    hp = [i for i in hp if not i == 0]
    if min(hp) == 1:
        minhp = min(hp)
        break
    elif hp == [minhp for i in hp]:
        break
print(minhp)


Measured memory_bytes: 14224
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;

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

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))
//#define int long long int //dont forget to change int to signed

int main() {
	int N;
	scanf("%d", &N);
	int a = 0, b = 0, c = 0;
	for (int i = 0 ; i < N; i++) {
		int ary;
		scanf("%d", &ary);
		if (ary % 4 == 0) a++;
		else if(ary % 2 == 0) b++;
		else c++;
	}
	if (b == 0) {
		if (a+1 >= c && a > 0) printf("Yes\n");
		else printf("No\n");
	} else { 
		if (a >= c) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

/*

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}

int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}

int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

vector<ll> prime_factor(int64_t n) {
	//map< ll, ll > ret;
	vector<ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			//ret[i]++;
			ret.push_back(i);
			n /= i;
		}
	}
	if (n != 1)ret.push_back(n);// ret[n] = 1;
	return ret;
}

const int MAX = 1000000;
const int MOD = 1000000007;
ll 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;
}

struct edge {
	ll to;
	ll cost;
};

*/

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


	int N;
	cin >> N;
	vector<ll> H(N);

	rep(i, N) cin >> H[i];

	vector<int> counter(N);
	ll tmp = H[0];
	int count = 0;

	counter[0] = 0;
	ll i = 1;
	for (auto it = H.begin() + 1; it != H.end(); it++) {
		if (*it <= tmp) {
			count++;
			tmp = *it;
		}
		else {
			count = 0;
			tmp = *it;
		}

		counter[i++] = count;
	}
	
	int max = counter[0];
	for (auto it = counter.begin() + 1; it != counter.end(); it++) {
		max = std::max(max, *it);
	}

	cout << max << endl;


ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 1656
from collections import Counter

mod = 10**9 + 7

def init(n):
    # 階乗とその逆元をグローバルに定義
    global factorial, inverse
    # 0-indexedでそれぞれ１で初期化
    factorial = [1]*(n+1)
    inverse = [1]*(n+1)

    fact = 1
    for p in range(1,n+1):
        fact *= p
        fact %= mod
        factorial[p] = fact

    inv = pow(fact, mod-2, mod)
    inverse[n] = inv
    for p in range(2,n+1)[::-1]:
        inv *= p
        inv %= mod
        inverse[p-1] = inv

def comb(n,r):
    if n < r:
        return 0
    return factorial[n] * inverse[n-r] * inverse[r] % mod

n = int(input())
a = list(map(int,input().split()))

b = Counter(a).most_common()[0][0]
pos = []
for i, ai in enumerate(a):
    if ai == b:
        pos.append(i)

l, r = pos
L, R = l, n-r

init(n+1)

for k in range(1, n+2):
    ans = (comb(n+1, k) - comb(L+R, k-1)) % mod
    print(ans)

Measured memory_bytes: 21980
import java.util.*;

/**
 * Main
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int A = sc.nextInt();
		int B = sc.nextInt();
		int T = sc.nextInt();
		int Bis = 0;
		int Time = 0;
		while (Time >= 0) {
			Time += A;
			if (Time > T + 0.5) {
				break;
			}
			Bis += B;
		}

		System.out.println(Bis);

		sc.close();
	}
};


Measured memory_bytes: 35836
#include<stdio.h>
int main(void)
{
  int d,r;
  double a,b,f;
  scanf("%lf %lf",&a,&b);
  d=(int)a/b;
  r=(int)a%(int)b;
  f=a/b;
  printf("%d %d %lf",d,r,f);
  
  return 0;
}

Measured memory_bytes: 648
from collections import deque

n = int(input())
a = list(map(int, input().split()))

b = deque([])

rev = 1
for i in a:
    if rev == 1:
        b.append(i)
        rev = -1
    elif rev == -1:
        b.appendleft(i)
        rev = 1

b = list(b)
print(*(b if rev == 1 else b[::-1]))


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

int main() {
    int a, b;
    cin >> a >> b;

    string bb = "";
    for (int i = 0; i < a; i++) {
        bb += to_string(b);
    }
    string aa = "";
    for (int i = 0; i < b; i++) {
        aa += to_string(a);
    }
    if (aa < bb) {
        cout << aa;
    } else {
        cout << bb;
    }
}


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

enum {
  MAXN = 200000 + 5
};

struct DSU {
  int fa[MAXN];
  DSU() {
    clear();
  }
  int find(int x) {
    return x == fa[x]? x : fa[x] = find(fa[x]);
  }
  bool link(int u, int v) {
    u = find(u);
    v = find(v);
    if (u == v)
      return false;
    else {
      fa[u] = v;
      return true;
    }
  }
  void clear() {
    int i;
    for (i=0; i<MAXN; ++i)
      fa[i] = i;
  }
} t1, t2;

int N, K, L;
std::map<std::pair<int, int>, int> map;

void clear() {
  t1.clear();
  t2.clear();
}

void exec() {
  int i, u, v;
  clear();
  scanf("%d%d%d", &N, &K, &L);
  for (i=0; i<K; ++i) {
    scanf("%d%d", &u, &v), -- u, -- v;
    t1.link(u, v);
  }
  for (i=0; i<L; ++i) {
    scanf("%d%d", &u, &v), -- u, -- v;
    t2.link(u, v);
  }

#define INFO(u) std::make_pair(t1.find(u), t2.find(u))

  for (u=0; u<N; ++u)
    ++ map[INFO(u)];
  for (u=0; u<N; ++u)
    printf("%d%c", map[INFO(u)], " \n"[u+1 == N]);

#undef INFO
}

int main() {
  if (fopen("D.in", "r") != NULL) {
    freopen("D.in", "r", stdin);
    freopen("D.out", "w", stdout);
  }
  exec();
  return 0;
}


Measured memory_bytes: 13696
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		long a[] = new long[n];
		for(int i=0;i<n;i++)	a[i]=sc.nextLong();
		
		ArrayList<Integer> s = new ArrayList<>();
		long sum = 0;
		for(int i=0;i<n;i+=2){
			if(a[i]>0){
				sum+= a[i];
				s.add(i);
			}
		}
		if(s.size()==0){
			int idx = 0;
			for(int i=0;i<n;i+=2){
				if(a[i]>a[idx])	idx = i;
			}
			s.add(idx);
			sum = a[idx];
		}
		
		StringBuilder op = new StringBuilder();
		int cnt = 0;
		for(int i=n-1;i>=s.get(s.size()-1)+1;i--){
			cnt++;
			op.append(i+1 +"\n");
		}
		for(int i = s.size()-2;i>=0;i--){
			for(int j=0;j<(s.get(i+1)-s.get(i))/2-1;j++){
				cnt++;
				op.append(s.get(i)+3+"\n");
			}
			cnt++;
			op.append(s.get(i)+2+"\n");
		}
		for(int i=0;i<s.get(0);i++){
			cnt++;
			op.append(1+"\n");
		}
		
		ArrayList<Integer> s2 = new ArrayList<>();
		long sum2 = 0;
		for(int i=1;i<n;i+=2){
			if(a[i]>0){
				sum2+= a[i];
				s2.add(i);
			}
		}
		if(s2.size()==0){
			int idx = 1;
			for(int i=1;i<n;i+=2){
				if(a[i]>a[idx])	idx = i;
			}
			s2.add(idx);
			sum2 = a[idx];
		}
		
		StringBuilder op2 = new StringBuilder();
		int cnt2 = 0;
		for(int i=n-1;i>=s2.get(s2.size()-1)+1;i--){
			cnt2++;
			op2.append(i+1 +"\n");
		}
		for(int i = s2.size()-2;i>=0;i--){
			for(int j=0;j<(s2.get(i+1)-s2.get(i))/2-1;j++){
				cnt2++;
				op2.append(s2.get(i)+3+"\n");
			}
			cnt2++;
			op2.append(s2.get(i)+2+"\n");
		}
		for(int i=0;i<s2.get(0);i++){
			cnt2++;
			op2.append(1+"\n");
		}
		
		if(sum2>sum){
			sum = sum2;
			cnt = cnt2;
			op = op2;
		}
		System.out.println(sum);
		System.out.println(cnt);
		System.out.print(op);
		
	}
}


Measured memory_bytes: 26196
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef double ld;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
const ll MOD = 4000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

std::vector<bool> IsPrime;

void sieve(size_t max){
    if(max+1 > IsPrime.size()){ 
        IsPrime.resize(max+1,true); 
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i)
        if(IsPrime[i])
            for(size_t j=2; i*j<=max; ++j) 
                IsPrime[i*j] = false;     
}

int main(){
	init();
	ll N;cin>>N;
	vector<ll>P(N);
	vector<ll>Q(N);
	for(int i=0;i<N;i++)cin>>P[i];
	for(int i=0;i<N;i++)cin>>Q[i];
	vector<ll>v;
	for(int i=0;i<N;i++){
		v.push_back(i+1);
	}
	ll p=-1;
	ll q=-1;
	sort(v.begin(),v.end());
	ll num=0;
	do{
		num++;
		bool isp=true;
		for(int i=0;i<N;i++){
			if(v[i]!=P[i])isp=false;
			//cout<<v[i]<<" "<<P[i];
		}
		//cout<<endl;
		if(isp)p=num;
		bool isq=true;
		for(int i=0;i<N;i++){
			if(v[i]!=Q[i])isq=false;
		}
		if(isq)q=num;
	}while(next_permutation(v.begin(),v.end()));
	cout<<abs(p-q)<<endl;
}


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

using namespace std;

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a + b == c + d) {
    cout << "Balanced\n";
  } else if (a + b < c + d) {
    cout << "Right\n";
  } else {
    cout << "Left\n";
  }
}


Measured memory_bytes: 256
# ABC 062: A – Grouping
groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
x, y = [int(s) for s in input().split()]
print('Yes' if (x in groups[0] and y in groups[0]) or (x in groups[1] and y in groups[1]) or (x in groups[2] and y in groups[2]) else 'No')

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

int main()
{
    string S, T;
    cin >> S >> T;
    int res = 0;
    if(S[0]==T[0]) res++;
    if(S[1]==T[1]) res++;
    if(S[2]==T[2]) res++;
    cout<<res<<endl;
    return 0;
}

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

#define nl '\n'
#define op ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
   op;
   int n,k,sum=0;
   cin>>n>>k;
   int a[n];
   for(int i=0;i<n;i++)
   {
      cin>>a[i];
   }
   sort(a,a+n,greater<int>());
   for(int i=0;i<k;i++)
   {
      sum+=a[i];
   }
   cout<<sum<<nl;
   return 0;
}


Measured memory_bytes: 3656