akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
 
public class Main {
    static Scanner sc;
    static List<List<Integer>> t;
    static boolean[] visited;
    static boolean[] grey;
    static int[] prev;
    static List<Integer> shortestCycle;
    public static void main(String[] args) {
        sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        t = new ArrayList<List<Integer>>(N);
        for(int i = 0; i <= N; i++) {
            t.add(new ArrayList<Integer>());
        }
 
        for(int i = 0; i < M; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            t.get(a).add(b);
        }
        visited = new boolean[N+1];
        grey = new boolean[N+1];
        prev = new int[N+1];
 
        for(int i = 1; i <= N; i++) {
            dfs(i);
 
            visited = new boolean[N+1];
            grey = new boolean[N+1];
            prev = new int[N+1];
        }
        if(shortestCycle != null) {
            System.out.println(shortestCycle.size());
            for(int l: shortestCycle) {
                System.out.println(l);
            }
        } else {
            System.out.println("-1");
        }
    }
 
    static void dfs(int s) {
        grey[s] = true;
        for(int i : t.get(s)) {
            if(!visited[i]) {
                if(grey[i]) {
                    List<Integer> lst = new ArrayList<>();
                    int tmp = s;
                    while(tmp != i) {
                        lst.add(tmp);
                        tmp = prev[tmp];
                    }
                    lst.add(i);
                    if(shortestCycle == null || lst.size() < shortestCycle.size()) {
                        shortestCycle = lst;
                    }
                } else {
                    prev[i] = s;
                    dfs(i);
                }
            }
        }
        visited[s] = true;
    }
}

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

int main(){
    char str[100000];

    int al[26]= {0};
    char out;

    cin >> str;

    for(int i=0;str[i]!='\0';i++)
        al[str[i]-'a']=1;
    
    for(int i=0;i<26;i++){
        if(al[i]==0){
            out = i +'a';
            cout << out;
            return 0;
        }
    }

    cout << "None";
    return 0;
}

Measured memory_bytes: 384
H, W, K = map(int, input().split())
S = [list(input()) for _ in range(H)]
ans_table = [[0] * W for _ in range(H)]
cnt = 1
for i in range(H):
    loc = 0
    flag = False
    for k in range(W):
        if S[i][k] == "#":
            for a in range(loc, k+1):
                ans_table[i][a] = cnt
            loc = k+1
            cnt += 1
            flag = True
        if flag:
            if k == W - 1 and S[i][k] == ".":
                for a in range(loc, W):
                    ans_table[i][a] = cnt - 1
        else:
            pass
if sum(ans_table[0]) != 0:
    for i in range(1, H):
        if sum(ans_table[i]) == 0:
            ans_table[i] = ans_table[i-1]    
if sum(ans_table[0]) == 0:
    for i in range(1, H):
        if sum(ans_table[i]) != 0:
            chech = i
            break
    for i in range(0, chech):
        ans_table[i] = ans_table[chech]
    for i in range(chech, H):
        if sum(ans_table[i]) == 0:
            ans_table[i] = ans_table[i-1]

for a in ans_table:
    print(*a)

Measured memory_bytes: 8228
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

int a,b,c,x,y,z,t;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> a >> b >> c;
    x=min(a,min(b,c));
    z=max(a,max(b,c));
    y=a+b+c-x-z;
    t+=z-y; x+=z-y; y=z;
    t+=(z-x)/2;
    if(x%2!=z%2) t+=2;
    cout << t;
}


Measured memory_bytes: 256
#include<stdio.h>

main(){

  int i,j,n,q,left,right,S[100001],T[50001],U[50001],mid;
  int sumcount = 0;
   
  scanf("%d",&n);
   
  for(i = 0; i < n; i++){
    scanf("%d",&S[i]);
  }
   
  scanf("%d",&q);
   
  for(j = 0; j < q; j++){
    scanf("%d",&T[j]);
  }

  
  for(j = 0; j < q; j++){
    
    left = 0;
    right = n;    
    
    while(left != mid || right != mid){
      
    mid = (left + right) / 2;

      if(S[mid] < T[j]) {
	left =  mid + 1;
      } else if(S[mid] > T[j]) {
	right =  mid;
      } else if(S[mid] == T[j]) {
	sumcount++;
	break;
      }

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

}

Measured memory_bytes: 868
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define RevRange(container) container.rbegin(), container.rend()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

constexpr int M = 32;

struct Point{ ll x, y; };
istream& operator>>(istream &is, Point &p){
    return is >> p.x >> p.y;
}
Point operator+(const Point &p1, const Point &p2){
    return {p1.x + p2.x, p1.y + p2.y};
}
Point operator-(const Point &p1, const Point &p2){
    return {p1.x - p2.x, p1.y - p2.y};
}
ll calcDist(const Point &p1, const Point &p2){
    return abs(p1.x - p2.x) + abs(p1.y - p2.y);
}

int main(void){
    Cin(int, n);
    Cins(Point, n, p);
    
    bool isOdd = abs(p[0].x + p[0].y) % 2;
    For(i, n){
        if(abs(p[i].x + p[i].y) % 2 != isOdd){
            Cout(-1);
            return 0;
        }
    }
    
    Cout(isOdd ? M : M+1);
    if(!isOdd){
        printf("1 ");
        For(i, n) p[i].x --;
    }
    vector<ll> d(M);
    For(i, M){
        d[i] = 1ll << (M-1-i);
        printf("%lld ", d[i]);
    }
    printf("\n");

    For(i, n){
        if(!isOdd) printf("R");
        
        Point here {0, 0};
        For(j, M){
            Point dir = p[i] - here;
            if(abs(dir.x) > abs(dir.y)){
                if(dir.x > 0){
                    printf("R");
                    here.x += d[j];
                }
                else{
                    printf("L");
                    here.x -= d[j];
                }
            }
            else{
                if(dir.y > 0){
                    printf("U");
                    here.y += d[j];
                }
                else{
                    printf("D");
                    here.y -= d[j];
                }
            }
        }
        printf("\n");
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;

int main() {
    ll h,w,d; cin >> h >> w >> d;
    ll n = h * w;

    vector<pll> idx(n+1);
    for (ll i = 1; i < h + 1; i ++) {
        for (ll j = 1; j < w + 1; j ++) {
            ll a; cin >> a;
            idx[a] = {i + 1, j + 1};
        }
    }
    idx[0] = idx[d];

    vector<ll> D(n + 1,0);

    for (ll i = 0; i < d; i ++) {
        for (ll j = i; j <= n - d; j += d) {
            D[j + d] = D[j] + abs(idx[j].first - idx[j + d].first) + abs(idx[j].second - idx[j + d].second);
        }
      
    }

    ll q; cin >> q;
    for (ll i = 0; i <q ; i ++ ) {
        ll l,r; cin >> l >> r;
        cout << D[r] - D[l] << endl;
    } 
}

Measured memory_bytes: 3200
N, K = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]

town = []
dic = {}

i = 0
j = 0

while i not in dic and j < K:
    dic[i] = j
    town.append(i)
    i = X[i] - 1
    j += 1
    
if j == K:
    output = i + 1
    
else : 
    num = dic[i]
    loop = j - num
    output = town[((K-num) % loop) +num] + 1
    
print(output)

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

using namespace std;

#define ll long long 
#define Fastest ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"

int main()
{
    int a,b,c;
    
    cin >> a >> b >> c;
    
    
    if(a*c <= b) cout << c << endl;
    else cout << b/a << endl;
    
    return 0;	
}


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

int main() {
	int A, B;
	cin >> A >> B;
	if (A <= 5) cout << 0 << endl;
	else if (A >= 6 && A <= 12)cout << B / 2 << endl;
	else if (A >= 13)cout << B << endl;

	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;}
template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;}

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

// Problem Specific Parameter:
ll power(ll a, ll n, ll m) {
	ll b = 1LL;
	while (n) {
		if (n & 1) b = b * a % m;
		a = a * a % m;
		n >>= 1;
	}
	return b;
}

inline ll extgcd(ll a, ll b, ll& x, ll& y) {
	x = 1, y = 0;
	ll g = a;
	if (b != 0) {
		g = extgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	return g;
}

ll phi(ll n) {
	ll cur = n, ret = n;
	for (ll i = 2; i * i <= n; ++i) {
		if (cur % i) continue;
		while (cur % i == 0) cur /= i;
		ret = ret / i * (i - 1);
	}

	if (cur != 1) ret = ret / cur * (cur - 1);
	return ret;
}


ll solve(ll a, ll m) {
	if (m == 1) return 100LL;
	const ll pm = phi(m);
	const ll gm = __gcd(m, pm);

	// y mod gm -> y mod pm
	ll y =  solve(a, gm);
	ll ay = power(a, y, m);

	// x = m k + ay
	// x = pm l + y
	// m k - pm l = y - ay

	ll minv, dummy;
	extgcd(m, pm, minv, dummy);
	ll k = minv * ((y - ay) / gm)  % pm;
	if (k < 0) k += pm;
	ll x = m * (k + pm) + ay;
	return x;
}


int main(void) {
	int q;
	cin >> q;

	rep(loop, q) {
		ll a, m;
		cin >> a >> m;
		ll k = solve(a % m, m);
		cout << k << endl;
		//cerr << k % m << endl;
		//cerr << power(a, k, m) << endl;
	}

	return 0;
}

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

char str[100000];
char ans[100000];

void sort();
int main(){
  int n;
  while (1){
    scanf("%d", &n);
    if (n == 0){ break; }
    scanf("%s", str);
    while( n>0 ){
      sort();
      memcpy(str, ans, sizeof(ans));
      n--;
    }
    printf("%s\n", ans);
  }
  return 0;
}
void sort(){

  int	i, j, len;
  char	countbuf[10], valuebuf[10];
  int	count;

  len = strlen(str);
  memset(ans, '\0', sizeof(ans));
  for (i = 0; i < len; i++){
    if (str[i-1] != str[i]){
      count = 0;
      for (j = i; j < len; j++){
	if (str[i] == str[j]){
	  count++;
	}
	else{ break; }
      }
      memset(valuebuf, '\0', sizeof(valuebuf));
      sprintf(countbuf, "%d", count);
      valuebuf[0] = str[i];
      strcat(ans, countbuf);
      strcat(ans, valuebuf);
      memset(countbuf, '\0', sizeof(countbuf));
    }
  }
}

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

using namespace std;

int main()
{
	string s;
	cin >> s;
	int num = 753;
	int ans = INT_MAX;
	int x = 0;

	for (int i = 0; i < s.size() - 2; i++)
	{
		int tmp = (s.at(i) - '0') * 100 + (s.at(i + 1) - '0') * 10 + (s.at(i + 2) - '0');
		int tmp_delta = abs(num - tmp);
		if (tmp_delta < ans)
		{
			ans = tmp_delta;
			//x = tmp;
		}
	}
	cout << ans << endl;
	//cout << x << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define endl "\n"
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
ll power(ll x, ll y, ll p) { 
    ll res = 1;    x = x % p;  
    while(y > 0) {
        if(y & 1) res = (res*x) % p; 
        y = y>>1;    x = (x*x) % p; 
    } return res; 
}
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        
        ll n;
        cin>>n;
        //a*b +c;
        ll ans=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                if(i*j<n)
                {
                    ans++;
                }
                else
                break;
            }
        }cout<<ans;
        
    }
    return 0;
}


Measured memory_bytes: 3652
room = [0 for i in range(120)]
c = int(input())
for i in range(c):
    b, f, r, v = [int(s) for s in input().split()]
    index = (30 * (b - 1)) + (10 * (f - 1)) + (r - 1)
    room[index] += v

for i in range(12):
    if (i != 0) and (i % 3 == 0):
        print('#' * 20)
    print(' ' + ' '.join([str(v) for v in room[i*10:i*10+10]]))

Measured memory_bytes: 7776
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long  n,p,ans=1;
	cin>>n>>p;
	if(n==1){
		cout<<p<<endl;
		return(0);
	}
	for(int i=1000000;i>1;i--){
		int c=0,b=1;
		while(p%i==0 && p!=0){
			p/=i;
			c++;
		}
		if(c==n){
			ans*=i;
		}
		else if(c>n){
			ans*=i;
			p*=pow(i,c-n);
		}
		else if(c!=0){
			p*=pow(i,c);
		}
	}
	cout<<ans<<endl;
  return(0);
}

Measured memory_bytes: 256
x, y = gets.chomp.split.map(&:to_i)
g1 = [1, 3,5,7,8,10,12]
g2 = [4,6,9,11]
g3 =[2]
if g1.include?(x) and g1.include?(y) then
  puts 'Yes'
elsif g2.include?(x) and g2.include?(y) then
  puts 'Yes'
elsif g3.include?(x) and g3.include?(y)
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replaces(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  string s;cin>>s;
  replaces(s,',',' ');
  cout(s);
  
  return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, k;
  cin >> n >> k;
  priority_queue<int> pq;
  for (int i = 0; i < n; i++) {
    int l;
    cin >> l;
    pq.push(l);
  }
  
  int ans = 0;
  for (int i = 0; i < k; i++) {
    ans += pq.top();
    pq.pop();
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    static String a;
    static String b;
    static String c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        a = sc.next();
        b = sc.next();
        c = sc.next();
        char ac = a.charAt(0);
        int ans = 0;
        if (ac == 'a') {
            ans = DisCard(1);
        } else if (ac == 'b') {
            ans = DisCard(2);
        } else {
            ans = DisCard(3);
        }
        String answ = "";
        if (ans == 1) {
            answ = "A";
        } else if (ans == 2) {
            answ = "B";
        } else {
            answ = "C";
        }
        System.out.println(answ);
        sc.close();
    }

    public static int DisCard(int player) {
        if (player == 1) {
            if (a.length() == 0) {
                return 1;
            } else {
                char c = a.charAt(0);
                a = a.substring(1);
                if (c == 'a') {
                    return DisCard(1);
                } else if (c == 'b') {
                    return DisCard(2);
                } else {
                    return DisCard(3);
                }
            }
        } else if (player == 2) {
            if (b.length() == 0) {
                return 2;
            } else {
                char c = b.charAt(0);
                b = b.substring(1);
                if (c == 'a') {
                    return DisCard(1);
                } else if (c == 'b') {
                    return DisCard(2);
                } else {
                    return DisCard(3);
                }
            }
        } else {
            if (c.length() == 0) {
                return 3;
            } else {
                char cha = c.charAt(0);
                c = c.substring(1);
                if (cha == 'a') {
                    return DisCard(1);
                } else if (cha == 'b') {
                    return DisCard(2);
                } else {
                    return DisCard(3);
                }
            }
        }
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){if(checkyear%4==0){if(checkyear%100!=0||checkyear%400==0)return true;}return false;}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
bool pairCompare(const pairint& firstElof, const pairint& secondElof)
{
  if(firstElof.second!= secondElof.second)    return firstElof.second> secondElof.second;
  else return firstElof.first< secondElof.first;
}
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
string a,b;
std::cin >> x;
std::vector<int> v(x);
rep(i,x){
  std::cin >>v[i];
}
rep(i,x){
  Repo(j,i,x){
    if(j==v.size()-1)break;
    if(v[j]>=v[j+1])w++;
    else break;
  }
  if(w>n)n=w;
  w=0;
  if(x-i<=n)break;
  if(x/2<=n)break;
}
std::cout << n << '\n';
}

Measured memory_bytes: 1024
using System;
using System.Linq;

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

        int total = int.Parse(input.Split(' ')[0]);  // 支払い金額
        int numCnt = int.Parse(input.Split(' ')[1]); // 嫌いな数カウント

        input = Console.ReadLine();

        // 嫌いな数リスト
        var hatelist = input.Replace(" ", "").ToCharArray();

        int i = total;

        while(true)
        {
            if (i.ToString().ToArray().All(x =>!hatelist.Contains(x)))
            {
                Console.WriteLine(i.ToString());
                break;
            }

            i++;
        }

        Console.ReadLine();
    }
}


Measured memory_bytes: 15408
import math as ma
def minCharge810(a, b):
    A0 = 0
    A1 = 0
    B0 = 0
    B1 = 0

    A0 = ma.ceil(a / 0.08)
    A1 = ma.floor((a+1) / 0.08)
    B0 = ma.ceil(b / 0.1)
    B1 = ma.floor((b+1) / 0.1)

    ans1 = [i for i in range(int(A0), int(A1))]
    ans2 = [i for i in range(int(B0), int(B1))]
    ans = set(ans1) &  set(ans2)
    if ans == set():
        return '-1'
    else:
        return min(ans)
a, b = map(int, input().split())
print(minCharge810(a, b))


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

typedef pair<int, int> P;

vector<P> p[10001];
int c[10001][2];
int N, M, R, Q;

int main()
{
 loop:
  for(int i = 0; i < 10001; i++)
  {
    c[i][0] = -1;
    c[i][1] = 0;
    p[i].clear();
  }
  cin >> N >> M;
  if(!N)
    return 0;
  cin >> R;
  for(int i = 0; i < R; i++)
  {
    int t, n, m, s;
    cin >> t >> n >> m >> s;
    if(s)
    {
      if(c[m][0] == -1)
        c[m][0] = t;
      c[m][1]++;
    }
    else
    {
      if(!(--c[m][1]))
      {
        p[m].push_back(make_pair(c[m][0], t));
        c[m][0] = -1;
      }
    }
  }
  cin >> Q;
  for(int i = 0; i < Q; i++)
  {
    int ts, te, m, a = 0;
    cin >> ts >> te >> m;
    for(auto e: p[m])
    {
      if(e.second < ts || te < e.first)
        continue;
      if(ts <= e.first && e.second <= te)
        a += e.second - e.first;
      else if(ts <= e.first)
        a += te - e.first;
      else if(e.second <= te)
        a += e.second - ts;
      else
        a += te - ts;
    }
    cout << a << endl;
  }
  goto loop;
}

Measured memory_bytes: 1544
///
// File:  b.go
// Author: ymiyamoto
//
// Created on Thu Dec 27 17:46:15 2018
//
package main

import (
	"fmt"
)

func main() {
	var N, X int
	fmt.Scan(&N, &X)

	min := 1 << 60
	total := 0
	for i := 0; i < N; i++ {
		var m int
		fmt.Scan(&m)
		total += m
		if m < min {
			min = m
		}
	}

	fmt.Println(N + (X-total)/min)
}


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

using namespace std;

typedef long long int64;

int main()
{
  int64 N, A, B;
  cin >> N >> A >> B;

  if(N == 1) {
    if(A == B) cout << 1 << endl;
    else cout << 0 << endl;
  } else {
    cout << max(0LL, (N * B - B + A) - (N * A - A + B) + 1) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,ll>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

int main()
{
	int n, W, w[N], v[N];
	vector <ll> dp(N), tmp;
	cin >> n >> W;
	for (int i = 1; i <= n; ++i)
	{
		cin >> w[i] >> v[i];
	}
	for (int item = 1; item <= n; ++item)
	{
		tmp = dp;
		for (int wt = 1; wt <= W; ++wt)
		{
			if(w[item] <= wt)
				dp[wt] = max(tmp[wt], tmp[wt - w[item]] + v[item]);
		}
	}
	cout << *max_element(all(dp));
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
    int a,b,c,d;
    scanf("%d %d",&a,&b);
    if (b%a==0){
    c=a+b;
    printf("%d\n",c);
    }   
    else{
    d=b-a;
    printf("%d\n",d);
    }   
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i< (n); ++i)
using namespace std;
typedef long long ll;
const int MAX = 100010;
const int MOD = 1000000007;
long long fac[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}

int main() {
  COMinit();
  int n;
  string s;
  cin >> n;
  cin >> s;
  vector<int> a(2*n,0);
  rep(i,2*n){
    if (s[i]=='B') a[i] = 1;
  }
  rep(i,n){
    a[2*i] = (a[2*i]+1)%2;
  }
  int check = 0;
  rep(i,2*n){
    check += a[i];
  }

  ll ans = 1;
  bool flag = false;
  int cur = 0;
  rep(i,2*n){
    if (a[i] == 0){
      cur++;
    }
    else{
      ans = ans*cur%MOD;
      cur--;
      if(cur<0) {flag = true; break;}
    }
  }
  ans = ans*fac[n]%MOD;
  if ((a[0]==1)||(a[2*n-1]==0)) flag = true;
  if (check != n) flag = true;
  if (flag) ans = 0;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2180
import sys


def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    C, S, F = [[0]*(N-1) for _ in range(3)]
    for i in range(N-1):
        C[i], S[i], F[i] = map(int, input().split())

    ans = [0] * N
    for start in range(N-1):
        sec = 0
        for i in range(start, N-1):
            if sec < S[i]:
                sec += S[i] - sec
            else:
                sec += (F[i] - (sec % F[i])) % F[i]
            sec += C[i]
        ans[start] = sec

    print(*ans, sep=" ")


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 2*1000000
int main(void){
    char str[N];
    char before[N], after[N];
    fgets(str, sizeof(str), stdin);
    sscanf(str, "%s", before);
    fgets(str, sizeof(str), stdin);
    sscanf(str, "%s", after);
    
    int i = 0, counter = 0;
    while(before[i] != '\0'){
        if(strncmp(&before[i], &after[i], 1) != 0){
            counter++;
        }
        i++;
    }
    i = 0;
    
    printf("%d\n", counter);
    
    return 0;
}


Measured memory_bytes: 2328
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll m=0,a=0,r=0,c=0,h=0;
    ll i;
    string s;
    for(i=0;i<N;i++){
        cin >> s;
        if(s[0]=='M')m++;
        if(s[0]=='A')a++;
        if(s[0]=='R')r++;
        if(s[0]=='C')c++;
        if(s[0]=='H')h++;
    }
    cout << m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h<<endl;
    return 0;
}


Measured memory_bytes: 3152
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int i,o,line[2][1001]={0};
    char line1[1033];
    for(i=0;i!=2;){
        if(fgets(line1,1033,stdin) == NULL ||line1[0]=='\n'){
            i++;
            continue;
        }
        for(o=0;;o++)
            if(line1[o] == '.'){
                line1[o]=0;
                break;
            }
        line[i][atoi(line1)]++;
    }
    for(i=1;i<=1000;i++){
        if(line[0][i]>0 && line[1][i]>0)
            printf("%d %d\n",i,line[0][i]+line[1][i]);
    }
    return 0;
}

Measured memory_bytes: 536
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
        string s = ReadLine();
        int n = int.Parse(s);

        int sn = 0;
        for (int i = 0; i < s.Length; i++)
        {
            string t = "" + s[i];
            sn += int.Parse(t);
        }

        WriteLine((n%sn) == 0 ? "Yes" : "No");
    }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){

  string S;
  IN(S);
  map<char, ll> mp;
  for(int i=0; i<S.size(); ++i) mp[S[i]]++;

  for(auto itr : mp){
    if(itr.second!=2){
      OUT("No");
      return 0;
    }
  }

  OUT("Yes");

  return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<string>
#include<vector>
#include<math.h>
#include<time.h>
#include<utility>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<stdio.h>
#include<iomanip>
#include<iostream>
#include<algorithm>
//#include<conio.h>
//ios::sync_with_stdio(false);
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I') cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll n;
  cin >> n;

  bool can = true;

  REP(i, n) {
    ll a;
    cin >> a;

    if (a % 2 == 0 && !(a % 3 == 0 || a % 5 == 0)) {
      can = false;
      break;
    }
  }

  cout << (can ? "APPROVED" : "DENIED") << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int next(int n){
  if(n%2==0){
    return n/2;
  }
  if(n%2==1){
    return 3*n+1;
  }
  return 0;
}
int main() {
  cout << fixed << setprecision(10);
  map<int,int> mp;
  int s;
  cin >> s;
  mp[s]++;
  int i = 1;
  while(true){
    s = next(s);
    mp[s]++;
    i++;
    if(mp[s]==2){
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int gcd(int a,int b){
    int c;
    if(a<b){c=a;a=b;b=c;}
    while(b!=0){
        c=a%b;
        a=b;b=c;
    }
    return a;
}

int lcm(int a,int b){
    int c;
    c=gcd(a,b);
    return a*b/c;
}

int main(void){
    int n,a,b,i;
    scanf("%d %d %d",&n,&a,&b);
    a=lcm(a,b);
    for(i=2;i<n;i++){
        scanf("%d",&b);
        a=lcm(a,b);
    }
    printf("%d\n",a);
    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {

  ll n,a,b;
  cin>>n>>a>>b;
  
  ll s=a+b;
  ll ans=0;
  ll z=0;
  if(n<s){ans=min(a,n);}
  else {ans=(n/s)*a+min(n%s,a);}
  
  cout<<ans<<endl;

  
}


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

int main()
{
	int a[100] = {0}, n, nmax = 0;
	while(cin >> n){
		a[n - 1]++;
	}
	for (int i = 0; i < 100; ++i)
	{
		nmax = max(nmax, a[i]);
	}
	for (int i = 0; i < 100; ++i)
	{
		if(a[i] == nmax){
			cout << i + 1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
N,M=map(int,input().split())
a=[int(input()) for i in range(M)]
a=set(a)
dp=[0]*(N+1)
dp[0]=1
anlist=[]
inf=10**9+7
if 1 not in a:
  dp[1]=1
else:
  dp[1]=0
for i in range(2,N+1):
  if i in a:
    continue
  else:
    dp[i]=dp[i-1]+dp[i-2]
ans=dp[N]%inf
print(ans)

  

Measured memory_bytes: 460020
n,m=map(int,input().split())
A = [input() for _ in range(n)]
B = [input() for _ in range(m)]



for i in range(len(A)-len(B)+1):
    for j in range(len(A)-len(B)+1):
        cond = 1
        for p in range(len(B)):
            for q in range(len(B)):
                if A[i+p][j+q] != B[p][q]:
                    cond = 0
        if cond == 1:
            print("Yes")
            exit()
print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include<bitset>
#include<stdio.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF = 100000000;

bool isOK(int a[],int index,int key){
    if(a[index] >= key){
        return true;
    }else{
        return false;
    }
}

int binary_search(int a[],int n,int key){
    int left = -1;
    int right = n;

    while(right-left>1){
        int mid = left + (right - left)/2;
        if(isOK(a,mid,key)){
            right = mid;
        }else{
            left = mid;
        }
    }
    return right;
}

int factrial(int n){
    if(n==0){
        return 1;
    }else{
        return n*factrial(n-1);
    }
}

int main(void){
    int a,b;
    cin >>a >> b;
    int diff = b-a;
    int alen = 0;
    for(int i=1;i<diff;++i){
        alen += i;
    }
    cout << alen-a << endl;
    return 0;
}



Measured memory_bytes: 256
length = int(input())
suretsu=[int(input()) for i in range(length)]
result = []
sorted_suretsu = sorted(suretsu,reverse=True)
zantei_max = sorted_suretsu[0]

for i in range(length):
    if (zantei_max == suretsu[i]):
        result.append(str(sorted_suretsu[1]))
    else:
        result.append(str(zantei_max))
print('\n'.join(result))

Measured memory_bytes: 30492
#include <bits/stdc++.h>
using namespace std;
int n, m;
int dp[100002];
int main()
{
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int l, r;
        cin >> l >> r;
        dp[l] += 1;
        dp[r + 1] -= 1;
    }
    int cnt = 0;
    int t = 0;
    for (int i = 0; i < 100002; i++)
    {
        t += dp[i];
        if (t == m)
        {
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,a[100100][10],dp[100100][10];
ll rec(ll i,ll j)
{
    if(i==n-1)
        return a[i][j];
    if(dp[i][j]!=-1)
        return dp[i][j];
    if(j==0)
        return dp[i][j]=max(rec(i+1,j+1),rec(i+1,j+2))+a[i][j];
    if(j==1)
        return dp[i][j]=max(rec(i+1,j-1),rec(i+1,j+1))+a[i][j];
    if(j==2)
        return dp[i][j]=max(rec(i+1,j-1),rec(i+1,j-2))+a[i][j];
}
int main()
{
    cin>>n;
    for(ll i=0 ;  i<n ; i++)
        for(ll j=0 ; j<3 ; j++)
            cin>>a[i][j];
    memset(dp,-1,sizeof dp);
    cout<<max(rec(0,0),max(rec(0,1),rec(0,2)));
    return 0;
}


Measured memory_bytes: 18944
import java.util.ArrayList;
import java.util.Scanner;

public class Main 
{
	public static void main(String[] args)
	{
		class Area
		{
			double x, y;
		}
		ArrayList<Area> area = new ArrayList<>();
		Scanner scanner = new Scanner(System.in);
		
		double total_angle = 0;
		for(int i=0; i<1000; i++)
		{
			Area a = new Area();
			double v = 1;
			if(i > 0)
			{
				v = Math.sqrt(i + 1);
				total_angle += Math.asin(1/v);				
			}	
			a.x = v * Math.cos(total_angle);
			a.y = v * Math.sin(total_angle);		
			area.add(a);
		}
		
		for(; ;)
		{
			int n = scanner.nextInt();
			if(n == -1)
			{
				break;
			}
			
			System.out.printf("%1$.2f\n", area.get(n-1).x);
			System.out.printf("%1$.2f\n", area.get(n-1).y);
		}
	}
}

Measured memory_bytes: 26304
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

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

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP

void	Main()
{
	ll d, n;
	cin >> d >> n;
	int ans;
	if (n == 100)
	{
		if (d == 0)
			ans = 101;
		else if (d == 1)
			ans = 10100;
		else
			ans = 1010000;
		cout << ans << endl;
		return ;
	}
	else
		cout << (ll)pow(100, d) * n << endl;
}
// END

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define vi vector<ll>
#define ii pair<ll,ll>
#define vii vector<ii>
#define si set<ll>
#define mp map<ll,ll>
#define mpi map<ii,ll>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#include <unordered_map> 
#define ump unordered_map<ll,ll>
int main()
{ 
	fast 
	ll n;
	cin>>n;
	double prob[n+5];
	ll i;
	for(i=0;i<n;i++)
	{
		cin>>prob[i+1];
	}
	double dp[n+5][n+5];
	dp[0][0]=1;
	ll j;
	for(i=1;i<=n;i++)
	{
		dp[0][i]=(1-prob[i])*dp[0][i-1];
		for(j=1;j<=i;j++)
		{
			dp[j][i]=prob[i]*dp[j-1][i-1]+(1-prob[i])*dp[j][i-1];
		}
	}
	double ans=0;
	for(i=(n/2)+1;i<=n;i++)
	{
		ans=ans+dp[i][n];
	}
	cout<<setprecision(9)<<ans<<endl;
}


Measured memory_bytes: 70144
#include <bits/stdc++.h>
#define io_optimized ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

int main () {
#define int int_fast32_t
	io_optimized
	int n,a;
	while(cin>>n)
	{
		set<int> se;
		bool f=1;
		for(int i=0;i<n;i++)
		{
			cin>>a;
			if(se.count(a)>0)
			{
				f=0;
			}
			else
			{
				se.insert(a);
			}
		}
		cout<<(f?"YES\n":"NO\n");
	}

	return 0;
}


Measured memory_bytes: 9600
n = int(input())
_a = input().split()

a = []

x = []

for i in range(n):
  a.append(2*int(_a[i]))
  x.append(0)
  
for i in range(1, n):
  a[i] -= a[i-1]

x[n-1] = a[n-1] // 2

for i in range(n-2, -1, -1):
  if i%2==0:
    x[i] = a[i] - x[n-1]
  else:
    x[i] = a[i] + x[n-1]
    
ans = str(x[n-1]) + ' '
for i in range(n-1):
  ans += str(x[i]) + ' '
  

print(ans[:-1])


Measured memory_bytes: 22968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    int n, m;
    sc(n) sc(m)
    vector<int> a(n);
    for (int i = 0; i < n; i++) sc(a[i])
    int cnt = 0, sum = 0;
    for (int i = 0; i < n; i++) sum += a[i];
    int th;
    th = sum / (4*m);
    if (sum % (4*m) != 0) th += 1;
    for (int i = 0; i < n; i++){
        if (a[i] >= th) cnt++;
    }
    if (cnt >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    vector<ll> dp(n,INT_MAX);
    dp[0]=0;
    for(int i=0;i<n-1;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(i+j<n)
            {
                dp[i+j]=min(dp[i+j],dp[i]+abs(a[i]-a[i+j]));
            }
        }
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1792
import math
N,M = list(map(int,input().split(" ")))
MOD = 10 ** 9 + 7
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = 1
fac = factorize(M)
for temp in fac:
    num = temp[1]
    ans *= combinations_count(num + N - 1,N-1)
    ans %= MOD
print(ans)


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

const ll mod = 2019;

int main() {
  ll l, r; cin >> l >> r;
  ll ans = 2e9;
  for (int i = l; i < min(r, l + mod); i++)
    for (int j = l+1; j <= min(r, l + mod); j++)
      ans = min(ans, (i % mod * j % mod) % mod);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
while True:
    n=int(input())
    if n==0:
        break
    else:
        lst=[]
        for i in range(n):
            c=int(input())
            lst.append(c)
        x=0
        for j in range(10):
            date=lst.count(x)
            if date==0:
                print("-")
            else:
                print("*"*date)
            x+=1


Measured memory_bytes: 5708
//============================================================================
// Name        : ATcoder.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int N,M;
char A[51][51];
char B[51][51];

int main() {

	cin>>N>>M;
	for(int i=1;i<N+1;++i){
		for(int j=1;j<N+1;++j){
			cin>>A[i][j];
		}
	}
	for(int i=1;i<M+1;++i){
		for(int j=1;j<M+1;++j){
			cin>>B[i][j];
		}
	}
	int flg=0;
	int ans=0;
	for(int i1=0;i1<N-M+1;++i1){
		for(int j1=0;j1<N-M+1;++j1){
			flg=1;
			for(int i2=1;i2<M+1;++i2){
				for(int j2=1;j2<M+1;++j2){
					if(A[i1+i2][j1+j2]!=B[i2][j2])flg=0;
				}
			}
			if(flg==1)ans=1;
		}
	}
	if(ans==1)cout<<"Yes"<<endl;
	if(ans==0)cout<<"No"<<endl;


	return 0;
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	int ret=1;
	while(n>1)
		n>>=1, ret<<=1;
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
 int a,b;
 char op;
 scanf("%d %c %d", &a, &op, &b);
 while(!(op=='?')){if (op=='+'){
  printf("%d\n",a+b);}
   else if ( op =='-' ){
   printf("%d\n",a-b);}
 else if (op=='*'){
printf("%d\n",a*b);}
 else if ( op=='/' ){
 printf("%d\n",a/b);} 
  else {}
  scanf("%d %c %d", &a, &op, &b);}
  return 0;}

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

int main(){
	int n,k;
	cin>>n>>k;
	vector<int> v;
	rep(i,77){
	    if(i*9%11==k and i%7>=2) v.push_back(i);
	}
	long long ans=0;
	for(auto i:v){
	    ans+=floor(((n-1)*7.0-i)/77.0)-(i<7?1:0)+1;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

ll modpow(ll a, ll b, ll p = 1e9+7){
    if(b == 0)  return 1;

    if(b % 2 == 0){
        ll d = modpow(a, b/2, p);
        return (d*d) % p;
    }else{
        return (a%p * modpow(a, b-1, p)) % p;
    }
}

struct ModComb{
    vector<ll> po, inv;
    ll N;

    ModComb(ll n) : N(n), po(n), inv(n) {
        po[0] = 1;
        for(int i = 1; i < N; i++)  po[i] = (po[i-1] * i) % mod;
        inv[N-1] = modpow(po[N-1], mod-2, mod);
        for(int i = N-2; i >= 0; i--)   inv[i] = (inv[i+1] * (i+1)) % mod;
    }
    
    ll nCk(ll n, ll k){
        if(k == 0)  return 1;
        if(n < k)   return 0;
        return (((po[n]*inv[n-k])%mod)*inv[k])%mod;
    }

    ll nPk(ll n, ll k){
        if(k == 0)  return 1;
        if(n < k)   return 0;
        return (po[n]*inv[n-k])%mod;
    }

    ll nHk(ll n, ll k){
        if(n == 0 && k == 0)    return 1;
        return nCk(n+k-1, k-1);
    }
};

int n, k;
vector<int> v[100000];
vector<ll> fact(100001, 1);
vector<bool> b(100000, 0);
ModComb mc(101010);
ll ans = 1;

void dfs(int pos){
    int child = 0, nc = 0;
    for(int next : v[pos]){
        if(b[next]){
            nc++;
        }else {
            child++;
        }
    }
    // cout << pos << endl;
    // cout << mc.nCk(k-1-nc, child) << endl;
    // cout << fact[child] << endl;
    ans = ans * mc.nCk(k-1-nc, child) % mod * fact[child] % mod;
    for(int next : v[pos]){
        if(!b[next]){
            b[next] = true;
            dfs(next);
        }
    }
}

int main(){
    for(int i = 1; i < 100001; i++){
        fact[i] = fact[i-1] * i % mod;
    }

    cin >> n >> k;
    for(int i = 0; i < n-1; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    b[0] = true;
    ans = k;
    dfs(0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  int n = s.size();
  string ans = "";
  rep(i, n) {
    if(s[i]=='B') {
      if(ans.size() > 0) ans.pop_back();
    } else {
     ans.push_back(s[i]);
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3664
#include<iostream>
#include<string.h>
#include<queue>
#include<map>
#include<vector>
#include <cstdlib>
#include<algorithm>
#include <cstdio>
#include <cctype>
using namespace std;
const long long INF=10000000000000LL;
typedef long long ll;
typedef pair<ll,ll> P;
ll N,Ma,Mb,K=0,C[45];
ll A,B[100005]={};
ll T,a,b,c,d;
ll ans=0;
bool h,o;
//bool D[100005];
string str,str2[55][55];
map<string,int> m;
vector<int> v[10];
ll dp[45][405][405];
int main(){
	cin>>N>>str;
	for(int i=0;i<N;++i){
		if(str[i]=='I')++K;
		if(str[i]=='D')--K;
		ans=max(K,ans);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256