akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> link(110);
vector<pair<int, int>> edge;
int vis[110];

vector<int> branch;

int dfs(int u, int dep) {
	vis[u] = 1;
	int son = 0;
	int res = dep;
	for (int i = 0; i < link[u].size(); i++) {
		int v = link[u][i];
		if (!vis[v]) {
			son++;
			res = max(dfs(v, dep + 1), res);
		}
	}
	branch[dep] = max(branch[dep], son);
	return res;
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		link[x].push_back(y);
		link[y].push_back(x);
		edge.push_back(make_pair(x, y));
	}
	int col = n + 1;
	long long ans = -1;
	for (int i = 1; i <= n; i++) {
		memset(vis, 0, sizeof(vis));
		branch.resize(0);
		branch.resize(n + 1);
		int dep = dfs(i, 1);
		if (dep <= col) {
			long long tmp = max(branch[1], 2);
			for (int j = 2; j < dep; j++) {
				tmp *= branch[j];
			}
			ans = col == dep ? min(ans, tmp) : tmp;
			col = dep;
		}
	}
	for (int i = 0; i < edge.size(); i++) {
		int x = edge[i].first;
		int y = edge[i].second;
		memset(vis, 0, sizeof(vis));
		branch.resize(0);
		branch.resize(n + 1);
		vis[y] = 1;
		int dep = dfs(x, 1);
		dep = max(dep, dfs(y, 1));
		if (dep <= col) {
			long long tmp = 2;
			for (int j = 1; j < dep; j++) {
				tmp *= branch[j];
			}
			ans = col == dep ? min(ans, tmp) : tmp;
			col = dep;
		}
	}
	printf("%d %lld\n", col, ans);
	return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
mod=10**9+7
a = [int(input()) for i in range(m)]
block=[0,1]
x=[True for i in range(n)]
for j in a:
  x[j-1]=False

for i in range(1,n+1):
  if x[i-1]==False:
    block=block[1:]+[0]
  else:
    block=block[1:]+[sum(block)%mod]
print(block[-1])


Measured memory_bytes: 55512
#include <stdio.h>

int main()
{
  int no,A,B,C;
  int array[3];
  
  scanf("%d%d%d",&A,&B,&C);
  array[0] = (A < B) ? B : A;
  array[1] = (A > B) ? B : A;
  if (array[0] < C){
    array[2] = array[1];
    array[1] = array[0];
    array[0] = C;
  }else if (array[1] < C){
    array[2] = array[1];
    array[1] = C;
  }else{
    array[2] = C;
  }
  
  printf("%d\n",10*array[0] + array[1] + array[2]);

  return 0;
}  

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

using namespace std;

#define MAX_N 4

//int N;
char a[MAX_N];

int main(){
  for(int i=0;i<4;i++){
    cin>>a[i];
  }
  int b[4]={0};
  for(int j=0;j<4;j++){
    for(int i=0;i<4;i++){
      if(a[j]==a[i]){
	b[j]++;
      }
    }
  }

  if((b[0]==2)&&(b[1]==2)&&(b[2]==2)&&(b[3]==2)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt(); int m = sc.nextInt(); long k = sc.nextLong();
        long [] a = new long[n];
        long []b = new long[m];
        for (int i = 0; i < n; i++) a[i] = sc.nextLong();
        for (int i = 0; i < m; i++) b[i] = sc.nextLong();
        long ans = 0;
        long [] pref1 = new long[n + 1]; long [] pref2 = new long[m + 1];
        for (int i = 1; i <= n; i++) {
            pref1[i] = pref1[i - 1] + a[i - 1];
        }
        for (int i = 1; i <= m; i++) {
            pref2[i] = pref2[i - 1] + b[i - 1];
        }
        int j = m;
        for (int i = 0; i <= n; i++) {
            if (pref1[i] > k) break;
            while (pref1[i] + pref2[j] > k) {
                j--;
            }
            ans = Math.max(ans, i + j);
        }
        out.println(ans);
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}


Measured memory_bytes: 66436
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  long long M=0;
  long long AA=0;
  long long BB=0;
  long long SS=0;
  cin>>N;
  vector<string>vec(N);
  for(int X=0;X<N;X++){
    cin>>vec.at(X);
    string S=vec.at(X);
    for(int Y=0;Y<S.size()-1;Y++){
      if(S.at(Y)=='A'&&S.at(Y+1)=='B'){
        M++;
      }
    }
    if(S.at(S.size()-1)=='A'){
      AA++;
    }
    if(S.at(0)=='B'){
      BB++;
    }
    if(S.at(S.size()-1)=='A'&&S.at(0)=='B'){
      SS++;
    }
  }
  if(SS==AA&&SS==BB&&AA!=0&&BB!=0){
    M--;
    cout<<M+AA<<endl;
  }
  else{
    cout<<M+min(AA,BB)<<endl;
  }
}

Measured memory_bytes: 3704
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x:usize = read();
    let y:usize = read();
    let mut ans = 0;
    let mut outlet = 1;
    while outlet < y {
        outlet -= 1;
        outlet += x;
        ans += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

//long longのシフト演算には気をつけよう

int main(){
    int N, K; cin >> N >> K;
    vector<pair<ll, ll>> A(N);
    for(int i=0; i<N; i++){
        ll t; cin >> t;
        ll d; cin >> d;
        A[i] = {d, t};
    }

    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    ll dsum = 0;
    map<ll, ll> ma;

    for(int i=0; i<K; i++){
        dsum += A[i].first;
        ma[A[i].second]++;
    }

    ll ans = dsum + ma.size()*ma.size();
    int r = K-1;
    for(int i=K; i<N; i++){
        if(ma[A[i].second] != 0) continue;

        while(ma[A[r].second] == 1 && r >= 0) r--;
        if(r == -1) break;

        ma[A[r].second]--;
        ma[A[i].second]++;
        dsum = dsum + A[i].first - A[r].first;
        ll tmp = dsum + ma.size()*ma.size();
        ans = max(ans, tmp);
        r--; // <-これをしないとだめ。例えばma[A[r].second]=3とかだった時に次のループでまたrを抜くことになっちゃうけどもうそれは存在していないので
    }

    cout << ans << endl;
}

Measured memory_bytes: 5760
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    StringBuilder buf = new StringBuilder();
    buf.append(str[0].substring(0,1));
    buf.append(str[1].substring(0,1));
    buf.append(str[2].substring(0,1));
    System.out.println(buf.toString().toUpperCase());
  }
}

Measured memory_bytes: 32796
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int n;
    string s;
    cin >> n >> s;

    int arr[n][n];
    for (int i=0;i<=n-1;i++)
    {
        for (int j=0;j<=n-1;j++)
        {
            arr[i][j]=0;
        }
    }
   
    for (int i=n-2;i>=0;i--)
    {
        for (int j=n-1;j>=i+1;j--)
        {
            if ((s[i]==s[j])&&(i!=j))
            {
                if ((i>=n-1)||(j>=n-1))
                {
                    arr[i][j]=1;
                }
                else
                {
                    arr[i][j]=arr[i+1][j+1]+1;
                }
            }
        }
    }

    int max_val=INT_MIN;
    for (int i=0;i<=n-1;i++)
    {
        for (int j=0;j<=n-1;j++)
        {
            if (arr[i][j]>max_val)
            {
                int a=arr[i][j];
                if (i+a-1<j)
                {
                    max_val=arr[i][j];
                }
            }
        }
    }

    cout << max_val << endl;
    return 0;
}

Measured memory_bytes: 101324
# -*- coding: utf-8 -*-

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

minus = 0
for i in range(n):
    if a[i] < 0:
        minus += 1
        a[i] = -1 * a[i]

if minus % 2 == 0:
    print(sum(a))
else:
    print(sum(a)-min(a)*2)


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

using namespace std;

#define rep(i, n) for(int i = 0; i < static_cast<int>(n); ++i)
#define per(i, n) for(int i = static_cast<int>(n)-1; i >= 0; --i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl); 
#define cop(a) for(auto x:(a)){cout << x << endl;}

using ll = long long;

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

constexpr char sp = ' ';
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n, ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}

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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    s<<'[';for(size_t i=0;i<v.size();++i){s << v[i];if(i < v.size()-1) s << ", ";}s<<']';return s;
}
struct __{ __(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15); } };

vector<pair<ll, ll>> x;
int main(){

    int n;
    cin >> n;
    x.resize(n);
    rep(i, n){
        ll X, L;
        cin >> X >> L;
        x[i] = make_pair(X-L, X+L);
    }
    sort(x.begin(), x.end(), [](auto x, auto y){return x.second < y.second;});
    int cnt = 0;
    ll tail = -LINF;
    rep(i, n){
        if(tail <= x[i].first){
            ++cnt;
            tail = x[i].second;
        }
    }
    ppp(cnt);

    return 0;
}


Measured memory_bytes: 1792
n,k = map(int,input().split())
mp = [0]*(n+1)
for i in range(k):
  d = int(input())
  a = list(map(int,input().split()))
  for j in a:
    mp[j]+=1
res = 0
for i in range(1,n+1):
  if mp[i]==0:
    res+=1
print(res)

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
    cin >> a.at(i).at(j);
    }
  }
  
  int countH = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (a.at(i).at(j) == '#') {
        break;
      }
      if (j == W-1) {
        countH++;
      }
    }
  }

  vector<vector<char>> h(H-countH,vector<char>(W));
  int x=0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (a.at(i).at(j) == '#') {
        h.at(i-x) = a.at(i);
        break;
      }
      if (j == W-1) {
        x++;
      }
    }
  }
     
  
  int countW = 0;
  for (int j = 0; j < W; j++) {
    for (int i = 0; i < H; i++) {
      if (a.at(i).at(j) == '#') {
        break;
      }
      if (i == H-1) {
        countW++;
      }
    }
  }
   
  vector<vector<char>> ans(H-countH,vector<char>(W-countW,'.'));
  int c;
  x=0;
  for (int j = 0; j < W; j++) {
    c=0;
    for (int i = 0; i < H-countH; i++) {
      if (h.at(i).at(j) == '#') {
        ans.at(i).at(j-x) = '#';
        c++;
      }
      if (i==H-countH-1 && c==0 && h.at(i).at(j) == '.') {
        x++;
      }
    }
  }
  
  for (int i = 0; i < H-countH; i++) {
    for (int j = 0; j < W-countW; j++) {
      cout << ans.at(i).at(j);
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, Q = mapint()
Cs = list(mapint())
LR = []
for i in range(Q):
    l, r = mapint()
    LR.append((l, r, i))
LR.sort(key=lambda x:x[1])
A = [0]*N

def add(A,a,w):#リストに値を追加する関数
    x = a
    while x <= N:
        A[x-1] += w
        x += x&(-x)

def sums(A,a):#k番目までの和
    x = a
    S = 0
    while x != 0:
        S += A[x-1]
        x -= x&(-x)
    return S

ans = [0]*Q
i = 0
last_appeared = [-1]*(N+1)
for l, r, ans_idx in LR:
    while i<r:
        c = Cs[i]
        if last_appeared[c]==-1:
            last_appeared[c] = i+1
            add(A, i+1, 1)
        else:
            past = last_appeared[c]
            last_appeared[c] = i+1
            add(A, past, -1)
            add(A, i+1, 1)
        i += 1
    ans[ans_idx] = sums(A, r)-sums(A, l-1)
for a in ans:
    print(a)

Measured memory_bytes: 230988
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("POSSIBLE") if fl else print("IMPOSSIBLE")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
gcd = math.gcd
n,k = ma()
A = lma()
mx = max(A)
tmp = A[0]
for a in A:
    tmp = gcd(a,tmp)
f=True

if mx<k:
    f=False
    yn(f)
    exit()
if tmp == 1:
    pass
else:
    if k%tmp==0:
        pass
    else:
        f=False
yn(f)


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

int main() {
  int n,x;
  string s;
  cin >> s;
  n = s.size();
  x = 0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      if(s.at(i) == s.at(j)){
        x++;
        cout << "no" << endl;
        break;
      }
    }
    if(x>0){
      break;
    }
  }
  
  if(x==0){
    cout << "yes" << endl;
  }
}


Measured memory_bytes: 256
n, m = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
b = [int(input()) for j in range(m)]
ans = []

for a in A:
    multi_list = [x * y for (x, y) in zip(a, b)]  # 書き方:リストの要素同士の積
    arg = 0
    for k in multi_list:
        arg += k
    print(arg)


Measured memory_bytes: 6020
n = int(input())
x = list(map(int,input().split()))
m = map(int,input())
a = list(map(int,input().split()))


for f in a:
  #print(f,n)
  if x[f-1] < 2019:
    if f == n:
      #print(f,x[f-1])
      x[f-1] += 1
      
    elif x[f-1]+1 != x[f]:
      #print(f,x[f-1])
      x[f-1] += 1

for j in x:
  print(j)


Measured memory_bytes: 5608
#include<stdio.h>
#include<string.h>  

int main(void){
    register int i;
    char s[11],t[12];
    scanf("%s%s",s,t);
    for(i = 0;i < strlen(s);i++)if(s[i] != t[i]){
        puts("No");
        return 0;
    }
    puts("Yes");
}

Measured memory_bytes: 1656
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5; 
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}

ll raise(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}


string s; ll k=0;

void solve()
{
    cin >> s;
    for (char u : s) {
        k += (u-'0');
    }
    if (k%9==0) nout("Yes");
    else nout("No");
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

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

typedef struct {
	int id;
	int ac;
	int wa[ 11 ];
	int time;
} Data;

Data data[ 51 ];

int compare( const void *a, const void *b ) {
	Data d1 = *(Data *)a, d2 = *(Data *)b;
	if ( d1.ac > d2.ac )
		return -1;
	else if ( d1.ac < d2.ac )
		return 1;
	else
		if ( d1.time < d2.time )
			return -1;
		else if ( d1.time > d2.time )
			return 1;
		else
			return d2.id - d1.id;
}

int main( void ) {
	int i, T, R;

	while ( scanf( "%*d %d %*d %d", &T, &R ), T ) {
		memset( data + 1, 0, sizeof(Data) * 50 );
		for ( i = 1; i <= T; i++ )
			data[ i ].id = i;

		while ( R-- ) {
			int m, t, p, j;

			scanf( "%d %d %d %d", &m, &t, &p, &j );

			if ( j )
				data[ t ].wa[ p ]++;
			else {
				data[ t ].ac++;
				data[ t ].time += m + data[ t ].wa[ p ] * 20;
			}
		}

		qsort( data + 1, T, sizeof(Data), &compare );

		for ( i = 1; i <= T; i++ )
			printf( "%d%c", data[ i ].id, i == T ? '\n' : data[ i ].ac == data[ i + 1 ].ac && data[ i ].time == data[ i + 1 ].time ? '=' : ',' );
	}

	return 0;
}

Measured memory_bytes: 604
import sys
import math

dic = {}

N = int(sys.stdin.readline())

for _ in range(N):
  line = sys.stdin.readline()[0:10]
  key = ''.join(sorted(line))
  dic[key] = dic[key] + 1 if (key in dic) else 1
print(sum(map(lambda x: 0 if x==1 else math.factorial(x) // (math.factorial(x - 2) * 2), dic.values())))

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

int main()
{
	int a, b;
	string s;
	string test1, test2;
	cin >> a >> b;
	cin >> s;
	
	if(s.length() != a+b+1){
		cout << "No" << endl;
		return 0;
	}
	
	size_t index = s.find('-');
		if (index == string::npos){
			cout << "No" << endl;
			return 0;
	}
	
	if(index != a){
		cout << "No" << endl;
		return 0;
	}
	
	test1 = s.substr(0,index);
	test2 = s.substr(index+1,a+b+1);
	
	for(int i = 0;i < a; i++){
		if(test1[i] == '-'){
			cout << "No" << endl;
			return 0;
		}
	}
	
	for(int i = 0;i < b; i++){
		if(test2[i] == '-'){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	
	return 0;
	
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int n=Integer.parseInt(bu.readLine()),i,f=0;
        long a[]=new long[n];
        String s[]=bu.readLine().split(" ");
        for(i=0;i<n;i++)
        {
            a[i]=Long.parseLong(s[i]);
            if(a[i]==0) {f=1; break;}
        }
        if(f==1) {System.out.print(0); return;}
        long mul=a[0];
        for(i=1;i<n;i++)
        if(overflow(mul,a[i])) {f=1; break;}
        else mul*=a[i];
        if(f==1) System.out.print(-1);
        else System.out.print(mul);
    }

    static boolean overflow(long a, long b)
    {
        long res=a*b;
        if(a==res/b && res<=1000000000000000000l) return false;
        else return true;
    }
}


Measured memory_bytes: 50172
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define rep(i,a,b) for(int i=a;i<=b;i++) 
#define rep2(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
bool lun(ll x)
{
	ll lst=x%10;
	while(x)
	{
		ll p=x%10;
		x/=10;
		if(abs(p-lst)>1)
		{
			return false;
		}
		lst=p;
	}
	return true;
}
string nws(int v)
{
	string kk;
	kk+='1';
	rep(i,1,v-1)kk+='0';
	return kk;
}
int main(int argc, char** argv) {
	ll n;
	cin>>n;
	int ans=2;
	if(n==2){
		cout<<1;
		return 0;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			ll now=n;
			while(now%i==0)
			{
				now/=i;
			}
			if(now%i==1)
			{
			ans++;	
			}
			if(i!=n/i)
			{
				ll now=n;
					while(now%(n/i)==0)
					{
						now/=(n/i);
					}
					if(now%(n/i)==1)
					{
					ans++;	
					}
			}
		}
	}
	n=n-1;
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
		
			ans++;	
			
			if(i!=n/i)
			{
			
					
					ans++;	
			
			}
		}
	}
	cout<<ans;
	return 0;
}

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

const int INF = 1 << 30;

int N, x[100009][3];
int dp[100009][3];

int main() {
    cin >> N;
    for(int i = 1; i <= N; i++)
        for(int j = 0; j < 3; j++)
            cin >> x[i][j];

    for(int i = 0; i < 100009; i++)
        for(int j = 0; j < 3; j++)
            dp[i][j] = -INF;

    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    for(int i = 1; i <= N; i++)
        for(int j = 0; j < 3; j++)
            for(int k = 0; k < 3; k++)
                if(j != k) dp[i][j] = max(dp[i][j], dp[i - 1][k] + x[i][j]);

    cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;
}

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

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n; cin >> n;
	vector<LL> a(n);

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

	bool syuntu = false;
	LL ans = 0;
	for (int i = 0; i < n; i++) {
		
		if (syuntu == false) {
			if (a[i] % 2 == 0) {
				ans += a[i] / 2;
			}
			else {
				syuntu = true;

				ans += (a[i] - 1) / 2;
			}
		}
		else {
			if (a[i] % 2 == 0) {

				if (a[i] == 2) {
					ans++;
				}
				else if (a[i] == 0) {
					syuntu = false;
				}
				else {
					ans += (a[i] - 2) / 2;
					ans++;
				}
				
			}
			else {
				ans += (a[i] - 1) / 2;
				ans++;
				syuntu = false;
			}
		}

	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <ctime>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>

using namespace std;
int n;
string a,b,c;

int main()
{
	cin>>n>>a>>b>>c;int ans=0;
	for(int i=0;i<n;i++){
		if(a[i]==b[i]&&c[i]!=a[i])ans++;
		else if(a[i]==c[i]&&b[i]!=a[i])ans++;
		else if(b[i]==c[i]&&b[i]!=a[i])ans++;
		else if(a[i]==b[i]&&b[i]==a[i]);
		else ans+=2;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#B
N=int(input())
C=[input() for i in range(N)]
AC=C.count('AC')
WA=C.count('WA')
TLE=C.count('TLE')
RE=C.count('RE')
print('AC x {}\nWA x {}\nTLE x {}\nRE x {}'.format(AC, WA, TLE, RE))

Measured memory_bytes: 16268
//Bismillahir rahmanir rahim
#include<bits/stdc++.h>
using namespace std;
int n;
int arr[100005];
int dp[100005];
int solve(int pos)
{
    if(pos==n) return 0;
    int &ret=dp[pos];
    if(ret!=-1) return ret;
    ret=1e9;
    if(pos+1<=n){
        ret=min(ret,solve(pos+1)+abs(arr[pos+1]-arr[pos]));
    }
    if(pos+2<=n){
        ret=min(ret,solve(pos+2)+abs(arr[pos+2]-arr[pos]));
    }
    return ret;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&arr[i]);
    memset(dp,-1,sizeof(dp));
    int ans=solve(1);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 4096
#include<iostream>
using namespace std;
int a[105][105];

int main ()
{
	int n, u, k, temp;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> u >> k;
		u--;
		for(int j = 0; j < k; j++)
		{
			cin >> temp;
			temp--;
			a[u][temp] = 1;
		}
	}
	
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
		{
			if(j)  cout << " ";
			cout << a[i][j]; 
		}
		cout << endl;
	}
	return 0;
} 


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

using namespace std;

int main(void){
    int n;

    cin >> n;
    int ans = 0;
    vector<vector<int>> y(n,vector<int>(n,2));

    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        for(int j=0; j<a;j++){
            int x;
            cin >> x;
            cin >> y[i][x-1];
        }
    }

    int power = 1;
    for(int i=0; i<n; i++){
        power *= 2;
    }

    vector<int> doubt(n, 0);
    for(int a=0; a<power; a++){
        bool ok = true;
        int ok_ans = 0;
        int tmp = a;
        for(int i = 0; i<n; i++){
            if(tmp%2){
                doubt[i] = 1;
                ok_ans++;
            }else
                doubt[i] = 0;
            
            tmp/=2;
        }
        for(int i=0; i<n; i++){
            if(doubt[i]==0)
                continue;
            for(int j=0; j<n; j++){
                if(y[i][j] != 2 && y[i][j] != doubt[j]){
                    ok = false;
                    i=n;
                    break;
                }
            }
        }
        if(ok){
            ans = max(ans, ok_ans);
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		WriteLine(string.Concat(Range(0, GetLong()).Select(_ => "ACL")));
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 28076
import java.util.Scanner;

public class Main {
    public static void main(String[] args ){
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        String op = scanner.next();
        int b = scanner.nextInt();

        while(!op.equals("?")){
            if(op.equals("+"))
                System.out.println(a + b);
            else if(op.equals("-"))
                System.out.println(a - b);
            else if(op.equals("*"))
                System.out.println(a * b);
            else if(op.equals("/"))
                System.out.println(a / b);

            a = scanner.nextInt();
            op = scanner.next();
            b = scanner.nextInt();
        }
    }
}


Measured memory_bytes: 26264
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

void move_E(int sai[]){
	int temp;
	int i;

	temp = sai[1];
	sai[1] = sai[4];
	sai[4] = sai[6];
	sai[6] = sai[3];
	sai[3] = temp;
	
}


void move_S(int sai[]){
	int temp;
	int i;
	temp = sai[1];
	sai[1] = sai[5];
	sai[5] = sai[6];
	sai[6] = sai[2];
	sai[2] = temp;
}

void move_R(int sai[]){
	int temp;
	int i;
	temp = sai[2];
	sai[2] = sai[3];
	sai[3] = sai[5];
	sai[5] = sai[4];
	sai[4] = temp;
}

int sarch(int sai[], int d1, int d2){
	int re[7];
	int i, j;
	int flag = 0;
	int ori[7];
	for(i=0; i<7; i++)
		ori[i] = sai[i];

	//printf("top:1,2,6,5\n");
	/* top:1,2,6,5 */
	for(j=0; j< 4; j++){
		for(i=0; i< 4; i++){
			//printf("%d,%d	%d,%d\n", sai[1], sai[2], d1, d2);
			if((sai[1] == d1)&&(sai[2] == d2)){
				printf("%d\n", sai[3]);
				flag = 1;	
			}
			move_R(sai);
			if(flag == 1)
				;
		}
		if(flag == 1)
			;
		move_S(sai);
	}


	//printf("top:3\n");
	/* top:3 */
	for(i=0; i<7; i++)
		sai[i] = ori[i];
	move_E(sai);
	move_E(sai);
	move_E(sai);
	for(i=0; i< 4; i++){
		//printf("%d,%d	%d,%d\n", sai[1], sai[2], d1, d2);
		if((sai[1] == d1)&&(sai[2] == d2)){
			printf("%d\n", sai[3]);
			;	
		}
		move_R(sai);
	}

	/* top:4 */
	//printf("top:4\n");
	for(i=0; i<7; i++)
		sai[i] = ori[i];
	move_E(sai);
	for(i=0; i< 4; i++){
		//printf("%d,%d	%d,%d\n", sai[1], sai[2], d1, d2);
		if((sai[1] == d1)&&(sai[2] == d2)){
			printf("%d\n", sai[3]);
			;	
		}
		move_R(sai);
	}
	
	return 0;
	
}

int main(){
	int sai[7];
	int i;
	char com[256];
	int temp;
	int q;
	int d1, d2;

	for(i=0; i<6; i++){
		scanf("%d", &sai[i+1]);
	}
	
	scanf("%d", &q);

	for(i=0; i< q; i++){
		scanf("%d %d", &d1, &d2);
		sarch(sai, d1, d2);
	}


	return 0;

}


Measured memory_bytes: 2100
#1:初期化
N, K = map(int,input().split())
#h = list(map(int, input().split()))
h = [int(x) for x in input().split()] #こっちのほうが早い？
#inf = float("inf")
dp = [0]*(N)

#2:初期値
dp[0] = 0

#3:dp実行部(貰うDP)
for i in range(1,N):
    L = [dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-K),i)]
    dp[i] = min(L)
#    for k in range(1,min(N-i-1,K)+1):
#        dp[i+k] = min(dp[i+k], dp[i] + abs(h[i] - h[i+k]))
        #print(dp,i,k)

#4:出力
print(dp[N-1])

Measured memory_bytes: 52448
#include<iostream>
using namespace std;
int main(){
	while(1){
	  int n, x;
	  int count=0;
	  cin >> n >> x;
	  if(n==0 && x==0){
	     break;
	  }
	  for(int i=1; i<n+1; i++){
	    for(int j=1; j<n+1; j++){
		if(j==i){
		  continue;
		}
	      for(int q=1; q<n+1; q++){
		if(q==i || q==j){
		  continue;
		}
		if(i+j+q==x){
		  count++;
		}
	      }
	    }
	  }
	cout << count/6 << endl;
	}
}


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

int gen[1000000];
int used[1000001];
int main(){
	vector<int> p;
	for(int i = 0 ; i < 1000000 ; i++) gen[i] = 1;
	gen[0] = gen[1] = 0;
	for(int i = 0 ; i*i < 1000000 ; i++){
		if(gen[i]){
			for(int j = i*i ; j < 1000000 ; j+=i)
				gen[j] = 0;
		}
	}
	for(int i = 0 ; i < 1000000 ; i++) if(gen[i])p.push_back(i);
	
	long long A,B;
	cin >> A >> B;
	
	long long X = max(2ll,A-B) , Y = A+B;
	if(Y<2){ cout << 0 << endl; return 0; }
	
	for(int i = 0 ; i <= 1000000 ; i++) used[i] = 9999999;
	
	for(int i = 0 ; i < p.size() ; i++){
		for(long long j = X+(p[i]-X%p[i])%p[i] ; j <= Y ; j += p[i]){
			if(used[j-X]==-1) continue;
			long long n_ = j , ok = 0;
			while(n_%p[i]==0) ok++ , n_ /= p[i];
			if(ok){
				if(used[j-X] >= ok){
					used[j-X] = ok;
				}else{
					used[j-X] = -1;
				}
			}
			//cout << p[i] << " " << ok << " " << used[j-X] << endl;
		}
	}
	int ans = 0;
	for(int i = 0 ; i <= Y-X ; i++){
		if(used[i] != -1) ans++;
	}
	cout << ans << endl;

}

Measured memory_bytes: 9128
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(), v.end()

/* デカい配列はここで宣言 */

int main(int argc, char const *argv[])
{
    vector<ll> a;
    for (ll i = 0; i < 4; i++)
    {
        ll s;
        cin >> s;
        a.push_back(s);
    }
    sort(ALL(a));
    if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9)
    {
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll p[4][10000];

int main(){
  ll n,m;
  cin >> n >> m;
  ll x[n],y[n],z[n];
  rep(i,n)cin >> x[i] >> y[i] >> z[i];
  
  ll sig[8]={1,1,1,-1,-1,-1,-1,1};
  for(int i=0;i<4;i++){
    for(int j=0;j<n;j++){
      p[i][j]=x[j]+sig[2*i]*y[j]+sig[2*i+1]*z[j];
    }
  }
  rep(i,4)sort(p[i],p[i]+n);
  ll ans=0;
  rep(i,4){
    ll temp=0;
    rep(j,m){
      temp+=p[i][j];
    }
    ans=max(ans,abs(temp));
  }
  rep(i,4)reverse(p[i],p[i]+n);
    rep(i,4){
    ll temp=0;
    rep(j,m){
      temp+=p[i][j];
    }
    ans=max(ans,abs(temp));
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 384
#include <bits/stdc++.h>
     
    using namespace std;
    const long long INF = 1LL <<60;  
     
    long long gcn(long long x,long long y){
      if(x%y==0){
        return y;
      }
      else{
        return gcn(y,x%y);
      }
    }
     
    int main(void){
      long long tmp;
      long long n,k;
      long long i,j;
      string x;
      
      
      cin>>x;
      for(i=0;i<x.length();i++){
        cout<<"x";
      }
            
      cout<<endl;
      return 0;
    }

Measured memory_bytes: 3588
using System;

namespace RatedforMe
{
    class Program
    {
        private const ushort ABC = 1200;

        private const ushort ARC = 2800;

        static void Main(string[] args)
        {
            ushort r = ushort.Parse(Console.ReadLine());
            string result = string.Empty;

            if (r < ABC)
            {
                result = "ABC";
            }
            else if (r < ARC)
            {
                result = "ARC";
            }
            else
            {
                result = "AGC";
            }

            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
 
int main(){
    fast();
 
/* you get what you work for not what you wish for */
    
    inp(n);
    inpv(a, n);
    ll curr = 1;
    ll ans = 0;
    for(auto i:a){
        if(i==curr){
            ans++;
            curr++;
        }
    }
    if(ans==0){
        cout << -1 << endl;
        return 0;
    }
    cout << n - ans << endl;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s,t,u;
  cin >> s>>t>>u;
  int count=0;
  if(s=='1'){
    count++;
  }
  if(t=='1'){
    count++;
  }
  if(u=='1'){
    count++;
  }
  cout << count;
}

Measured memory_bytes: 256
(let ((target (read)))
  (cond ((string= target "SUN")
         (princ 7))
        ((string= target "SAT")
         (princ 1))
        ((string= target "MON")
         (princ 6))
        ((string= target "TUE")
         (princ 5))
        ((string= target "WED")
         (princ 4))
        ((string= target "THU")
         (princ 3))
        ((string= target "FRI")
         (princ 2))))

Measured memory_bytes: 9444
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000000
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define r1 rt<<1
#define r2 rt<<1|1
#define ri register int
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define rep2(i,a,b,c) for(ri i=(a);i<=(b);i+=(c))
#define REP(i,a,b) for(ri i=(a);i>=(b);--i)
#define REP2(i,a,b,c) for(ri i=(a);i>=(b);i-=(c))
using namespace std;

inline ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^'0'),c=getchar();
	return x*f;
}
inline void write(ll x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}

int a[100005];
int main()
{
	ri n=read(),x=0,ans=0;
	rep(i,1,n) a[i]=read();
	rep(i,2,n){
		if(a[i]>a[i-1]){
			x=0;continue;
		}
		++x;ans=max(ans,x);
	}
	cout<<ans;
	return 0; 
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
signed main(){
    int n;
    cin>>n;
    P a[114514];
    for(int i=0;i<n;i++){
        cin>>a[i].first;
        a[i].second=i+1;
    }
    sort(a,a+n);
    for(int i=0;i<n;i++)cout<<a[i].second<<" ";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long int
#define N 100
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.14159265
#define cot cout.tie(0)
using namespace std;
/**
        * @author :: Sawlani
        *
        */

ll w[N + 1], v[N + 1];

ll dp[N + 1][100001];
ll n, W;

ll rec(ll i, ll val)
{
    if (val == 0)
        return 0;

    if (i == (n + 1))
        return INT_MAX;

    if (dp[i][val] != -1)
        return dp[i][val];

    if (val - v[i] >= 0)
        return dp[i][val] = min(w[i] + rec(i + 1, val - v[i]), rec(i + 1, val));
    else
        return dp[i][val] = rec(i + 1, val);
}
int main()
{
   // freopen("input.txt", "r", stdin);
    memset(dp, -1, sizeof(dp));
    cin >> n >> W;

    ll sum = 0;
    f(i, 1, n)
    {
        cin >> w[i] >> v[i];
        sum += v[i];
    }

    rf(i, sum, 1)
    {
        if (rec(1, i) <= W)
        {
            cout << i << endl;
            return 0;
        }
    }
}

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

int main(void) {
    int K,ans;
    cin >> K;
    if(K%2) {
        ans = (K/2) * (K/2+1);
    } else {
        ans = (K/2) * (K/2);
    }

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


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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        HashMap<Integer, Tree> nodes = new HashMap<>();
        int rootID = 0;
        ArrayList<Integer> notRoots = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int id = in.nextInt();
            int leftID = in.nextInt();
            int rightID = in.nextInt();
            if (leftID != -1) notRoots.add(leftID);
            if (rightID != -1) notRoots.add(rightID);
            Tree node = new Tree(id, leftID, rightID);
            nodes.put(node.id, node);
        }
        notRoots.sort(Integer::compareTo);
        for (Integer i : notRoots) {
            if (rootID == i) {
                rootID++;
            }
        }
        Tree tree = Tree.constructTree(nodes.get(rootID), nodes);
        System.out.println("Preorder");
        System.out.println(tree.preorder());
        System.out.println("Inorder");
        System.out.println(tree.inorder());
        System.out.println("Postorder");
        System.out.println(tree.postorder());
    }
}

class Tree {
    Tree left;
    Tree right;
    int id;
    int leftID;
    int rightID;

    public Tree(int id, int leftID, int rightID) {
        this.id = id;
        this.leftID = leftID;
        this.rightID = rightID;
        left = null;
        right = null;
    }

    static Tree constructTree(Tree currentNode, HashMap<Integer, Tree> nodes) {
        if (currentNode.leftID != -1) {
            currentNode.left = Tree.constructTree(nodes.get(currentNode.leftID), nodes);
        }
        if (currentNode.rightID != -1) {
            currentNode.right = Tree.constructTree(nodes.get(currentNode.rightID), nodes);
        }
        return currentNode;
    }

    boolean isLeaf() {
        return leftID == -1 && rightID == -1;
    }

    String preorder() {
        if (isLeaf()) {
            return " " + id;
        } else if (leftID == -1) {
            return " " + id + right.preorder();
        } else if (rightID == -1) {
            return " " + id + left.preorder();
        } else {
            return " " + id + left.preorder() + right.preorder();
        }
    }

    String inorder() {
        if (isLeaf()) {
            return " " + id;
        } else if (leftID == -1) {
            return " " + id + right.inorder();
        } else if (rightID == -1) {
            return left.inorder() + " " + id;
        } else {
            return left.inorder() + " " + id + right.inorder();
        }
    }

    String postorder() {
        if (isLeaf()) {
            return " " + id;
        } else if (leftID == -1) {
            return right.postorder() + " " + id;
        } else if (rightID == -1) {
            return left.postorder() + " " + id;
        } else {
            return left.postorder() + right.postorder() + " " + id;
        }
    }
}


Measured memory_bytes: 32228
l = [int(input()) for _ in range(5)]

smallest_ones_place = 10
last_dish = 0
for i in range(5):
    if l[i]%10 != 0 and l[i]%10 < smallest_ones_place:
        smallest_ones_place = l[i]%10
        last_dish = i

total_time = l.pop(last_dish)
for j in l:
    if j%10 == 0:
        total_time += j
    else:
        total_time += (j+10-j%10)

print(total_time)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String txt = scn.next() + " ";
		int x = 0;
		for (int i = 0; i < txt.length(); i++) {
			switch (txt.charAt(i)) {
			case 'A':
			case 'C':
			case 'T':
			case 'G':
				for (int j = i; j < txt.length(); j++) {
					switch (txt.charAt(j)) {
					case 'A':
					case 'C':
					case 'T':
					case 'G':
						continue;
					default:
						if (x < j - i) {
							x = j - i;
						}
					}
					i = j;
					break;
				}
			}
		}
		System.out.println(x);
		scn.close();
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,d;
  int cnt=0;
  cin >> n >> d;
  vector<int> a(n);
  vector<int> b(n);
  vector<double> c(n);
  for (int i=0; i<n; i++){
    cin >> a[i] >> b[i];
    c[i] = hypot(a[i], b[i]);
    if (c[i] <= d){
      cnt++;
    }
  }
  cout << cnt;   
}

Measured memory_bytes: 6456
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0045
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();

            long A = long.Parse(S.Split(' ')[0]);
            long B = long.Parse(S.Split(' ')[1]);
            long C = long.Parse(S.Split(' ')[2]);

            if (C <= (A + B))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 27332