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

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif


#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vii vector<pii>
#define vl vector<ll>
#define vll vector<pll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1)
#define ld long double
#define prime (1000000000 + 7)

using namespace std;

#define INF 1000000000

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

    ll n, m;
	cin >> n >> m;

	map<ll, ll> mapa;

	vl vet{0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
	vll vet2;
	for(int i = 1; i <= m; ++i){
		ll  a;
		cin >> a;
		vet2.push_back({a, vet[a]});
	}
	ll o = vet2.size();
	
	vector<pair<pll, ll>> mat(n+1);
	for(int i = 0; i < o; ++i){
		mat[vet2[i].ss] = max(mat[vet2[i].ss], {{1, vet2[i].ff}, 0});
	}

	for(int i = 1; i <= n; ++i){
		for(int j = 0; j < o; ++j){
			if(i - vet2[j].ss >= 0 && mat[i - vet2[j].ss].ff.ff != 0){
				mat[i] = max(mat[i], {{mat[i - vet2[j].ss].ff.ff+1, vet2[j].ff}, i - vet2[j].ss});
			}
		}
	}

	string s;
	pair<pll, ll> u{mat.back()};
	while (u.ff.ff != 0){
		W(u.ff.ff, " | ");
		s.push_back(u.ff.ss + '0');
		u = mat[u.ss];
	}
	cerr << endl;
	W(u.ff.ss, endl);
	W(s.size(), endl);
	
	
	cout << s << endl;
	



	return 0;
}

Measured memory_bytes: 512
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

int main()
{
  ll n;
  cin >> n;
  string s = "";
  while(n > 0) {
    n--;
    s += char('a' + n % 26);
    n /= 26;
  }
  reverse(all(s));
  cout << s << endl;
  return 0;
}


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


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

  double winprob = 0;

  for(double n=1;n<N+1;n++){
    if(n == K){
      //cout << (1/(N)) * (N-n) << endl;
      winprob += (1/(N)) * (N-n+1);
      break;
    }
    double score = n;
    double num = 1;
    for(int i=0;score<K;i++){
      score = score * 2;
      num *= 2;
    }

    winprob += 1/(num*N);
  }
  cout << setprecision(10);
  cout << winprob << endl;
}


Measured memory_bytes: 256
n, x = [int(v) for v in input().split()]
a = [int(v) for v in input().split()]

ans = 0
if sum(a) == x:
    ans = len(a)
elif sum(a) < x:
    ans = len(a) - 1
else:
    a.sort()
    for v in a:
        if v <= x:
            x -= v
            ans += 1
        else:
            break

print(ans)

Measured memory_bytes: 3060
n=int(input())
a=sorted([int(input()) for _ in range(n)])
f=0
ans=0
while a:
  f^=1
  if len(a)==3 and n%2==1:
    ans+=max(3*max(a)-sum(a),sum(a)-3*min(a))
    break
  ans+=([-1,1][f])*(2 if len(a)>2 else 1)*a.pop(-f)
print(ans)

Measured memory_bytes: 14032
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func bico(n, r int) int {
	if n < r {
		return 0
	}
	if r > 0 && n/r < 2 {
		r = n - r
	}
	denom, numer := 1, 1
	for i := 1; i <= r; i++ {
		denom *= n - i + 1
		numer *= i
		div := gcd(denom, numer)
		denom /= div
		numer /= div
	}
	return denom / numer
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, p := nextInt(), nextInt()

	cnt0, cnt1 := 0, 0
	for i := 0; i < n; i++ {
		a := nextInt()
		switch {
		case a%2 == 0:
			cnt0++
		default:
			cnt1++
		}
	}

	ans0 := 0
	ans1 := 0
	for j := 0; j <= cnt0; j++ {
		ans0 += bico(cnt0, j)
	}
	for k := p; k <= cnt1; k += 2 {
		ans1 += bico(cnt1, k)
	}

	fmt.Println(ans0 * ans1)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;


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

  string s; cin >> s;
  int res = 700;
  if(s[0] == 'o')res+=100;
  if(s[1] == 'o')res+=100;
  if(s[2] == 'o')res+=100;
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int loo = 0;
		while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		}
	}

}


Measured memory_bytes: 35744
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Q = sc.nextInt();
		String S = sc.next();
		int[] arr = new int[N];
		int[] psa = new int[N];
		psa[0] = 0;
		for (int i=1; i<N; i++){
			if (S.charAt(i)=='C' && S.charAt(i-1)=='A'){
				arr[i] = 1;	
			}
			psa[i]+=arr[i]+psa[i-1];
		}
		for (int i=0; i<Q; i++){
			int l = sc.nextInt(), r = sc.nextInt();
			System.out.println(psa[r-1]-psa[l-1]);
		}
		
	}

}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N, K;
    cin >> N >> K;
    vector<int> v(K);
    for(int i = 0; i < K; ++i) {
        cin >> v[i];
    }

    for(int i = N; i <= 100000; ++i) {
        int t = i;
        bool f = true;
        while(t > 0 && f) {
            int dig = t % 10;
            t /= 10;
            for(int j = 0; j < v.size(); ++j) {
                if(dig == v[j]) {
                    f = false;
                    break;
                }
            }
        }
        if(f) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 256
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//
//
//

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__

ll ncombi(ll a){
  if(a<2){return 0;}
  return a*(a-1)/2;
}


void solve(void){
  
  int N;
  
  cin >> N;
  
  vector<ll> A(N+1,0);
  vector<ll> M(N+1,0);
  vector<ll> X(N+1,0);
  vector<ll> B(N+1,0);

  REP2(i,1,N+1){
    cin >> A[i];
    M[A[i]]++;
  }
  
  ll sumX=0;
  // calc ncombi
  REP2(i,1,N+1){
    X[i]=ncombi(M[i]);
    sumX += X[i];
    B[i]=ncombi(M[i]-1);
  }
  
  REP2(k,1,N+1){
    ll ans=sumX-X[A[k]]+B[A[k]];
    cout << ans << endl;
  }
  
  return;
   
}


int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    solve();
 
    return 0;
}


Measured memory_bytes: 8832
n = int(input())
W = []
for i in range(n):
    a, b = map(int, input().split())
    W.append((a, b))
W.sort(key=lambda x: x[1])
x = 0
for i in range(n):
    a, b = W[i]
    x += a
    if x > b:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 31860
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n,k;
  long long ans=0 ;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  cin>>a[i];
  sort(a,a+n);
  for(int i=n-1;i>=n-k;i--)
  ans+=a[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)

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

N, M = map(int, input().split())
H = [-1] + list(map(int, input().split()))

GOOD = [True] * (N + 1)
GOOD[0] = False
for _ in range(M):
    A, B = map(int, input().split())

    HA = H[A]
    HB = H[B]

    if HA == HB:
        GOOD[A] = False
        GOOD[B] = False
    elif HA < HB:
        GOOD[A] = False
    elif HB < HA:
        GOOD[B] = False

cnt = 0
for i in range(N + 1):
    if GOOD[i]:
        cnt += 1

print(cnt)


Measured memory_bytes: 20140
n,a,b=map(int,input().split())

nums=[]
for i in range(1,n+1):
    nums.append(i)
#print(nums)

ans=[]

for j in nums:
    n=list(map(int,str(j)))
    #print(n)
    if a<=sum(n)<=b:
        ans.append(j)


print(sum(ans))


Measured memory_bytes: 3572
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main() {
    double P1x,P1y,P2x,P2y;
    cin >> P1x >> P1y >> P2x >> P2y;
    printf("%.8lf\n", sqrt((P1x-P2x)*(P1x-P2x)+(P1y-P2y)*(P1y-P2y)));
    return 0;
}

Measured memory_bytes: 3284
#include<cstdio>
#include<algorithm>

using namespace std;

bool field[550][550];
int N;

int wcnt[550];
int num_all_b_col;

void init(){
	for(int i = 0; i < N; ++i){
		wcnt[i] = 0;
	}
	for(int i = 0; i < N; ++i){
		for(int j = 0; j < N; ++j){
			if(!field[i][j]) wcnt[i]++;
		}
	}
	num_all_b_col = 0;
	for(int j = 0; j < N; ++j){
		bool flg = true;
		for(int i = 0; i < N; ++i){
			if(!field[i][j]) flg = false;
		}
		if(flg) num_all_b_col++;
	}
}

const int inf = 1e9;

int calc(int i){
	// row i
	if(wcnt[i] == 0){
		return N - num_all_b_col;
	}
	bool ok = false;
	for(int j = 0; j < N; ++j){
		if(field[j][i]) ok = true;
	}
	if(ok){
		int a = wcnt[i];
		return a + (N - num_all_b_col);
	}
	int best = inf;
	for(int j = 0; j < N; ++j){
		if(wcnt[j] == N) continue;
		int n_wcnt = wcnt[i];
		if(field[i][i]) n_wcnt++;
		if(field[j][i]) n_wcnt--;
		int cur = 1 + n_wcnt + (N - num_all_b_col);
		best = min(best, cur);
	}
	return best;
}	

int solve(){
	init();
	int ans = inf;
	for(int i = 0; i < N; ++i){
		int a = calc(i);
		ans = min(ans, a);
	}
	if(ans == inf) return -1;
	return ans;
}

char ch[550];

void input(){
	scanf("%d", &N);
	for(int i = 0; i < N; ++i){
		scanf("%s", ch);
		for(int j = 0; j < N; ++j){
			field[i][j] = (ch[j] == '#');
		}
	}
}

int main(){
	input();
	int ans = solve();
	printf("%d\n", ans);
	return 0;
}


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

int main(){

    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int maxabc=max({a,b,c});
    while(k>0){
        maxabc*=2;
        k--;
    }
    cout<<a+b+c-max({a,b,c})+maxabc<<endl;

    return 0;
}

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

public class Main{
  static int judge(int a, int b, int c){
    if(a>b && b>c){
      return 1;
    }else if(a<b && b<c){
      return 1;
    }else{
      return 0;
    }
  }



  public  static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    int[] array = new int[n];

    for(int i=0; i<n; i++){
      array[i] = sc.nextInt();
    }
    for(int j=1; j<n-1; j++){
      count += judge(array[j-1],array[j],array[j+1]);
    }

    System.out.println(count);
  }
}

Measured memory_bytes: 23124
n = int(input())
nums = list(map(int, input().split()))


def solve(nums):
    cnt = 0
    num = 1
    if 1 not in nums:
        return -1

    for i in range(n):
        if nums[i] == num:
            num += 1
        else:
            cnt += 1
    return cnt if cnt > 0 else 0


print(solve(nums))


Measured memory_bytes: 24744
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    vector<int> ans(300, 0);
    char temp;
    while (cin >> temp) ++ans[temp];
    for (char i = 'a'; i <= 'z'; i++) cout << i << " : " << ans[i] + ans[i - 32] << endl;
}



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

//テストケースはあんまり見ないほうが良い。デバッグする能力が必要.
int main()
{
    int n;
    cin >> n;
    int odd = (n + 1) / 2;
    double ans = (double)odd / n;
    // printfは.桁fによって、出力できる。/nは必須.
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def cum_2d(field:list):
    row = len(field)
    col = len(field[0])
    
    # 横方向に累積和
    for r in range(row):
        for c in range(col-1):
            field[r][c+1] += field[r][c]
    
    # 縦方向に累積和
    for c in range(col):
        for r in range(row-1):
            field[r+1][c] += field[r][c]
            
    return field

n,m,q = li()
grid = [[0 for _ in range(n+1)] for _ in range(n+1)]

for _ in range(m):
    l,r = li()
    grid[l][r] += 1
    
grid = cum_2d(grid)

for _ in range(q):
    p,q = li()
    print(grid[q][q] + grid[p-1][p-1] - grid[q][p-1] - grid[p-1][q])
    
    

Measured memory_bytes: 13756
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

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

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) a[i];
    ll ans = 0LL;
    map<int, int> mp;
    rep(i, n) {
        ans += mp[-(a[i]-i)];
        mp[a[i]+i]++;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 21028
import java.util.Scanner;

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

        int r = sc.nextInt();
        int c = sc.nextInt();

        int[][] A = new int[r][c];
        int[][] n = new int[r + 1][c + 1];

        for(int i = 0; i < r; i++)
            n[i][c] = 0;

        for(int i = 0; i < c; i++)
            n[r][i] = 0;

        for(int i = 0; i < r; i++){
            for(int j = 0; j < c; j++)
                A[i][j] = sc.nextInt();
        }

        for(int i = 0; i < r; i++){
            for(int j = 0; j < c; j++)
                n[i][j] = A[i][j];
        }

        for(int i = 0; i < r; i++){
            for(int j = 0; j < c; j++)
                n[i][c] += A[i][j];
        }

        for(int i = 0; i < c; i++){
            for(int j = 0; j < r; j++)
                n[r][i] += A[j][i];
        }

        n[r][c] = 0;
        for(int i = 0; i< r; i++){
            for(int j = 0; j < c; j++)
                n[r][c] += A[i][j];
        }

        for(int i = 0; i <= r; i++){
            System.out.print(n[i][0]);
            for(int j = 1; j <= c; j++)
                System.out.print(" " + n[i][j]);
            System.out.println("");
        }

        sc.close();
    }
}


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

struct damage
{
private:
	long slash;
	long dart;
public:
	damage(long a, long b) : slash(a), dart(b) {};
	long getSlash()
	{
		return slash;
	}
	long getDart()
	{
		return dart;
	}
};

bool Greater(damage &lhs, damage &rhs)
{
	return (lhs.getDart() > rhs.getDart());
}

int main()
{
	int swords;
	long HP;
	cin >> swords >> HP;
	long a, b;
	long preferred = 0;
	long maxdart = 0;
	vector<damage> sword;

	for (int i = 0; i < swords; ++i)
	{
		cin >> a >> b;
		if (a > preferred)
		{
			preferred = a;
		}
		sword.push_back(damage(a, b));
	}
	
	sort(sword.begin(), sword.end(), Greater);

	int goodswords = 0;
	for (auto element = sword.begin(); element != sword.end(); ++element)
	{
		if (element->getDart() >= preferred)
		{
			maxdart += element->getDart();
			goodswords += 1;
		}
	}
	
	int count = 0;
	long rest = HP - maxdart;
	if (rest <= 0)
	{
		for (auto element = sword.begin(); element != sword.end(); ++element)
		{
			HP -= element->getDart();
			count += 1;
			if (HP <= 0) break;
		}
	}
	else
	{
		count += (rest / preferred);
		if (rest % preferred != 0) count += 1;
		
		count += goodswords;
	}
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 2420
fun main() = Thread(null, ::msolutions2020d, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun msolutions2020d() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map { it.toInt() }

    var currMoney = 1000L
    var left = 0

    while (left in aList.indices) {
        var right = left
        while (right + 1 in aList.indices && aList[right] < aList[right + 1]) right++
        val buy = currMoney / aList[left]
        currMoney += buy * (aList[right] - aList[left])
        left = right + 1
    }

    val answer = currMoney

    println(answer)
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<tuple<int,int,int>>a(m,tuple<int,int,int>(0,0,0));
  for(int i=0;i<m;i++){
    cin >> get<0>(a.at(i)) >> get<1>(a.at(i));
    get<2>(a.at(i))=i;
  }
  vector<tuple<int,int,int>>b=a;
  sort(b.begin(),b.end());
  int c=1;
  for(int i=0;i<m;i++){
    if(i>0&&get<0>(b.at(i))!=get<0>(b.at(i-1))) c=1;
    get<2>(a.at(get<2>(b.at(i))))=c;
    c++;
  }
  for(int i=0;i<m;i++){
    string s,t;
    s=to_string(get<0>(a.at(i)));
    while(s.size()!=6) s='0'+s;
    t=to_string(get<2>(a.at(i)));
    while(t.size()!=6) t='0'+t;
    cout << s << t << '\n';
  }
  return 0;
}

Measured memory_bytes: 5572
use std::io::*;
use std::str::FromStr;
 
fn main(){
    println!("{}", 48-read_line::<i32>())
}
fn read_line<T: FromStr>() -> T{
    let mut buf = String::new();
    stdin().read_line(&mut buf);
    buf.trim().parse().ok().expect("Error")
}

Measured memory_bytes: 4476
#include"bits/stdc++.h"
using namespace std;

int main(){

	int answer[5];
	bool got[30];
	for(int i = 0; i < 30; i++){
		got[i] = false;
	}

	/*
	int datanum = 0;
	for(int dataset = 0; dataset < 1; dataset++){
		if(input == 0) break;


		answer[dataset] = sum;

		datanum++;
	}

	for(int dataset = 0; dataset < datanum; dataset++){
		cout << answer[dataset] << endl;
	}
	*/

	
	
	int input;

	for(int i = 0; i < 28; i++){
		cin >> input;
		got[input -1] = true;
	}
	for(int i = 1; i <= 30; i++){
		if(got[i -1] == false){
			cout << i << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
int const MOD = 1000000007;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
   
    int n,k; cin>>n>>k; int a[n]; for (int i = 0; i < n; i++)cin>>a[i];
    int dp[n]; fill(dp,dp+n,MOD); dp[0]=0;
    for (int i = 0; i < n; i++){
        for (int j = 1; (j <= k)&&(i+j < n); j++){
            dp[i+j]=min(dp[i+j],dp[i]+abs(a[i+j]-a[i]));
        }
    }
    cout<<dp[n-1]<<'\n';
}

Measured memory_bytes: 1024
def main():
    A, B, K = map(int, input().split())

    c = [A, B]
    for i in range(K):
        src = i % 2
        to = (i + 1) % 2

        if c[src] % 2 == 1:
            c[src] -= 1

        src_half = c[src] // 2
        c[src] -= src_half
        c[to] += src_half

    print(c[0], c[1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#pragma GCC target("avx")
#pragma GCC optimize ("Ofast")
#include <iostream>
#include <cmath>

char in[1<<21];
char const*o;

inline void init_in() { 
  o = in; 
  in[fread(in,1,sizeof(in)-4,stdin)] = 0;
}

int readInt(){ 
  unsigned u = 0, s = 0;
  while(*o && *o <= 32){
    ++o; 
  }
  if (*o == '-'){
    s = ~s, ++o;
  } else if (*o == '+'){
    ++o;
  }
   
  while(*o>='0' && *o<='9'){
    u = (u<<3) + (u << 1) + (*o++ - '0');
  }

  return static_cast<int>((u^s) + !!s) ;
}

template<typename T> void fastout(T &n) {
  T N = n, rev, count = 0;
  rev = N;
  if (N == 0) { 
    putchar_unlocked('0');
    putchar_unlocked('\n');
    return;
  }
  while ((rev % 10) == 0) { 
    ++count; rev /= 10;
  }
  rev = 0;
  while (N != 0) { 
    rev = (rev << 3) + (rev << 1) + N % 10;
    N /= 10;
  }
  while (rev != 0) { 
    putchar_unlocked(rev % 10 + '0');
    rev /= 10;
  }
  while (count--) putchar_unlocked('0');
  putchar_unlocked('\n');
}
 
int main(){ 
    init_in();
    int N = readInt();
    int v[N];
    for (int i = 0; i < N; ++i) v[i] = readInt();
    int sum = 0;
 
    for (int i = 1; i < N; ++i) sum += abs(v[i - 1] - v[i]);
    sum += abs(0 - v[0]) + abs(v[N - 1]);
    int diff[N]; 
    diff[0] = abs(0 - v[0]) + abs(v[0] - v[1]) - abs(0 - v[1]);
    for (int i = 1; i < N - 1; ++i){
        diff[i] = abs(v[i - 1] - v[i]) + abs(v[i] - v[i + 1]) - abs(v[i - 1] - v[i + 1]);
    }
    diff[N - 1] = abs(v[N - 2] - v[N - 1]) + abs(v[N - 1]) - abs(v[N - 2]);
 
    for (int i = 0; i < N; ++i){
        int ans = sum - diff[i];
        fastout(ans);
    }
    return 0;
}


Measured memory_bytes: 2560
package main

import (
        "bufio"
        "fmt"
        "os"
        "strconv"
)

var si = bufio.NewScanner(os.Stdin)

func readInt() int {
        si.Scan()
        r, _ := strconv.Atoi(si.Text())
        return r
}

func main() {
        si.Split(bufio.ScanWords)
        si.Buffer(make([]byte, 0), 10000000)
        H, W := readInt(), readInt()
        C := [10][10]int{}
        for i := 0; i < 10; i++ {
                for j := 0; j < 10; j++ {
                        C[i][j] = readInt()
                }
        }
        P := [10]int{}
        for i := 0; i < H*W; i++ {
                t := readInt()
                if t != -1 {
                        P[t] += 1
                }
        }

        for k := 0; k < 10; k++ {
                for i := 0; i < 10; i++ {
                        for j := 0; j < 10; j++ {
                                if C[i][j] > C[i][k]+C[k][j] {
                                        C[i][j] = C[i][k] + C[k][j]
                                }
                        }
                }
        }
        ret := 0
        for i := 0; i < 10; i++ {
                ret = ret + P[i]*C[i][1]
        }
        fmt.Println(ret)
}

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

public class Main {
    int n;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        solve();
    }

    void solve() {
        int ans = 1;
        while (ans <= n) {
            ans *= 2;
        }
        ans /= 2;
        System.out.println(ans);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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: 23124
<?php
  fscanf(STDIN, "%d", $n);
  fscanf(STDIN, "%s", $s);
  $chars = str_split($s);

  $base = ord('A');
  foreach ($chars as $c) {
    $index = ord($c) - $base;
    echo  chr($base + ($index + $n) % 26);
  }
  echo "\n";
?>

Measured memory_bytes: 4604
N = int(input())
S_dict = {}
for i in range(N):
    S = input()
    if S not in S_dict:
        S_dict[S] = 1
    else:
        S_dict[S] += 1

mx = max(S_dict.values()); ans = []
for st in S_dict.keys():
    if S_dict[st] == mx:
        ans.append(st)

for a in sorted(ans):
    print(a)

Measured memory_bytes: 32988
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define cei(a,b)(a%b?a/b+1:a/b)
using namespace std;

int main() {
	int r, w, C, R;
	while (cin >> r >> w >> C >> R, r) {
		if (r / w < C)cout << cei((C*w - r), R) << endl;
		else puts("0");
	}
}

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

int main(){
  string s;
  cin >> s;
  string T[] = {"Sunny", "Cloudy", "Rainy"};
  map<string,int>  M;
  for(int i = 0; i < 3; ++i) M[T[i]] = i;
  cout << T[(M[s]+1)%3] << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>

using namespace std;

void Solution()
{
    int n, m;
    
    while (cin>>n>>m)
    {
        if(n == 0 && m == 0)
        {
            break;
        }
        else
        {
            if(n > m)
            {
                int temp;
        
                temp = n;
                n = m;
                m = temp;
            }
        }
        
        cout<<n<<" "<<m<<endl;
    }
}



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

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

using namespace std;

int main(){
    long long q, h, s, d, res=0;
    long long n;
    cin >> q >> h >> s >> d >> n;
    if(q*2<h) h=q*2;
    if(h*2<s) s=h*2;
    if(s*2<d) d=s*2;
    res+=n/2*d;
    n=n%2;
    res+=n*s;
    cout <<res;
    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int a[100000+5];
int main(){
	int n;
	cin>>n;
	while(n--){
		int num;
		cin>>num;
		num+=1;
		a[num]++;
		a[num+1]++;
		a[num-1]++;
	}
	int max=0;
	for(int i=0;i<100000+5;i++){
		if(a[i]>max){
			max=a[i];
		}
	}
	cout<<max<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(void){
    long long int n;
    cin>>n;
    for(long long int i=(long long int)sqrt(n);i>=1;i--){
        if(n%i==0){
            cout<<i+n/i-2<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    int h[100005];
    for(int i=0;i<n;i++)cin>>h[i];
    int ans = 0;
    for(int i=0;i<n;){
        int res = 0;
        
        for(int j=i+1;j<n;j++){
            if(h[j]>h[j-1]){
                i=j;
                break;
            }
            res++;
            if(j==n-1){
                i=j;
                break;
            }
        }
        ans = max(ans,res);
        if(i>=n-1)break;
    }
    cout<<ans<<endl;
}



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


int main()
{
    int n;
    while(cin >> n)
    {
        bool valid = 0;
        for(int i = 0; i <= n / 7; i++)
        {
            if((n - 7 * i) % 4 == 0)
            {
                valid = 1;
            }
        }

        if(valid)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}


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

#define ALL(x) x.begin(), x.end()
#define SZ(x) (int) x.size()

const int N = 1e5;
int n, m;
int tab[N + 7];
int ile[N + 7];
int cc[N + 7];

int Find(int x) {
  if (tab[x] == x) return x;
  int fa = Find(tab[x]);
  tab[x] = fa;
  return fa;
}

void Union(int a, int b) {
  int fa = Find(a);
  int fb = Find(b);
  if (fa == fb) return;
  if (ile[fa] < ile[fb]) swap(fa, fb);
  tab[fb] = fa;
  ile[fa] += ile[fb];
}

vector <int> koszty[N + 7];

int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> cc[i];
  
  for (int i = 1; i <= n; ++i) {
    tab[i] = i;
    ile[i] = 1;
  } 
  
  for (int i = 1; i <= m; ++i) {
    int a, b;
    cin >> a >> b;
    Union(a + 1, b + 1);
  }
  
  int ile = 0;
  for (int i = 1; i <= n; ++i) {
    koszty[Find(i)].push_back(cc[i]);
    if (i == Find(i)) ile++;
  }
  
  if (ile == 1) {
    cout << 0 << endl;
    return 0;
  }
  
  int kr = 2 * (ile - 1);
  long long wynik = 0;
  
  vector <int> reszta;
  
  for (int i = 1; i <= n; ++i) {
    if (koszty[i].empty()) continue;
    auto it = min_element(ALL(koszty[i]));
    wynik += *it;
    kr--;
    koszty[i].erase(it);
    for (auto u : koszty[i]) reszta.push_back(u);
  }
  
  sort(ALL(reszta));
  
  if (SZ(reszta) < kr) {
    cout << "Impossible" << endl;
    return 0;
  }
  
  for (int i = 0; i < kr; ++i) wynik += reszta[i];
  cout << wynik << endl;
  return 0;
}

Measured memory_bytes: 6912
import numpy as np
import sys
from functools import lru_cache

def main():
    (m,d) = map(int, input().split(' '))
    ret = 0
    mlist = [i+1 for i in range(m)]
    for i in range(22,d+1):
        d10,d1 = divmod(i,10)
        if d10 == 1 or d1 == 1:
            continue
        if d10*d1 in mlist:
            ret += 1


    
    print(ret)
        





if __name__ == '__main__':
    main()

Measured memory_bytes: 21768
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn get_primes() -> Vec<bool> {
    let n = 100000;
    let mut is_prime = vec![true; n];
    let mut primes = Vec::new();
    is_prime[0] = false;
    is_prime[1] = false;

    for i in 2..n {
        if is_prime[i] {
            primes.push(i);
            let mut j = 2 * i;
            while j < n {
                is_prime[j] = false;
                j += i;
            }
        }
    }
    is_prime
}

fn main() {
    let n: usize = read();
    let is_prime = get_primes();
    let mut accum_ans = vec![0; 100000];
    for i in 1..100000 {
        let mut temp = 0;
        if is_prime[i] && is_prime[(i + 1) / 2] {
            temp += 1;
        }
        accum_ans[i] = accum_ans[i - 1] + temp;
    }
    for _ in 0..n {
        let v: Vec<usize> = read_vec();
        let (l, r) = (v[0], v[1]);
        println!("{:?}", accum_ans[r] - accum_ans[l - 1]);
    }
}


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

int main() {
    int n;
    while (cin >> n) {
        int count = 0;
        for (int i = 0; i <= 9; i++)
        for (int j = 0; j <= 9; j++)
        for (int k = 0; k <= 9; k++)
        for (int l = 0; l <= 9; l++) {
            if (i + j + k + l == n) count++;
        }
        cout << count << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n-1);
  vector<int> ans(n);
  for(int i=0;i<n-1;i++){
    cin>>a.at(i);
    a.at(i)--;
    ans.at(a.at(i))++;
  }
  for(int i=0;i<n;i++)cout<<ans.at(i)<<endl;
  return 0;
}

Measured memory_bytes: 4792
#include <stdio.h>

int main() {
  int x, a, b;
  scanf("%d %d %d", &x, &a, &b);

  int k = a - x;
  int o = b - x;

  if(k < 0) {
    k *= -1;
  }

  if(o < 0) {
    o *= -1;
  }

  if(k < o) {
    puts("A");
  }
  else {
    puts("B");
  }
  return 0;
}

Measured memory_bytes: 1604
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
long long a[200010],b[200010];
int main()
{
    int n,m,i,j,k1,k2;
    long long sum,s1,s2,s;
    scanf("%d",&n);
    b[0]=0;
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        b[i]=b[i-1]+a[i];
    }
    s=100000000000000000;
    for(i=1;i<n;i++)
    {
        s1=b[i];
        s2=b[n]-b[i];
        sum=fabs(s1-s2);
        s=min(s,sum);
    }
    printf("%lld\n",s);
    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int n;
	long int ans = 0;
	char strs[100];
	char strt[100];
	
	scanf("%ld%s%s", &n, strs, strt);
	
	
	for(i = 0; i < n; i++) {
		printf("%c", strs[i]);
		printf("%c", strt[i]);
	}
	
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

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

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

ll gcd(ll n, ll m){
	if (n > m){
		ll l = n;
		n = m;
		m = l;
	}
	while (1){
		ll l = n;
		n = m%n;
		m = l;
		if (n == 0){
			break;
		}
	}
	return m;
}

int main(){
	ll N;
	vll T;
	cin >> N;
	ll i, j;
	for (i = 0; i < N; i++){
		ll t;
		cin >> t;
		T.push_back(t);
	}
	ll ans = 1;
	for (i = 0; i < N; i++){
		ll gcd_i = gcd(ans, T[i]);
		ll tmp_i = ans / gcd_i;
		ans = tmp_i * T[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define M 1046527
#define NIL (-1)
#define L 14

char h[M][L];

int getChar(char ch){
  if(ch=='A')return 1;
  else if(ch=='C')return 2;
 else if(ch=='G')return 3;
 else if(ch=='T')return 4;
 else return 0;
}

long long getkey(char str[]){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){
  return key%M;
}

int h2(int key){
  return 1+(key%(M-1));
}

int find(char str[]){
  long long key,i,j;
  key=getkey(str);
  for(i=0;;i++){
    j=(h1(key)+i*h2(key))%M;
    if(strcmp(h[j],str)==0)return 1;
    else if(strlen(h[j])==0)return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key,i,j;
  key=getkey(str);
  for(i=0; ;i++){
    j=(h1(key)+i*h2(key))%M;
    if(strcmp(h[j],str)==0)return 1;
    else if(strlen(h[j])==0){
      strcpy(h[j],str);
      return 0;
    }
    
  }
  return 0;
}

int main(){
  int i,n;
  char str[L],com[9];
  for(i=0;i<M;i++)h[i][0]='\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%s",com,str);

    if(com[0]=='i')insert(str);
    else {
      if(find(str))printf("yes\n");
      else printf("no\n");
      
    }
  }
  return 0;
}



Measured memory_bytes: 16048
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = nextInt();

        for (int i = 1; i < 10; i++) {
        	for (int j = i; j < 10; j++) {
            	if (i * j == n) {
            		println("Yes");
            		return;
            	}
            }
        }

        println("No");
    }

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

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }
}

Measured memory_bytes: 22604
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, M;
  cin >> N >> M;
  vector<long> data(N);
  for(int i = 0; i < N; i++)cin >> data.at(i);
  sort(data.begin(), data.end());
  reverse(data.begin(), data.end());
  long a = pow(2, 30);
  while(a != 0 && M != 0 && data.at(N - 1) != 0){
    for(long i = 0; i < N; i++){
      if(M == 0)break;
      if(a == 1 && data.at(i) != 0){
        M--;
        data.at(i) /= 2;
        continue;
      } else if(a == 1)break;
      if(data.at(i) < a){
        a /= 2;
        break;
      } else {
        data.at(i) /= 2;
        M--;
      }
    }
    sort(data.begin(), data.end());
    reverse(data.begin(), data.end());
  }
  long sum = 0;
  for(int i = 0; i < N; i++)sum += data.at(i);
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <tuple>

typedef long long ll;

using namespace std;
int main() {
    ll n;
    vector<ll> v(5);
    cin >> n >> v[0] >> v[1] >> v[2] >> v[3] >> v[4];
    auto minit = min_element(v.begin(), v.end());
    auto ret = (n-1)/(*minit) + 5;
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
inline int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int k=1,kk=0;if (c=='-')c=getchar(),k=-1;
	while (c>='0'&&c<='9')kk=kk*10+c-'0',c=getchar();return kk*k;
}using namespace std;
int n,t,x,y,tt,xx,yy;
signed main(){
	n=read();for (int i=1;i<=n;i++){
		tt=read();xx=read();yy=read();
		if (abs(xx-x)+abs(yy-y)>tt-t||((abs(xx-x)+abs(yy-y))&1)!=((tt-t)&1)){
			puts("No");return 0;
		}t=tt;x=xx;y=yy;
	} puts("Yes");
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 

int main() {
  string s;
  cin >> s;
  int now = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '-') now--; else now++;
  }
  cout << now << endl;
  return 0;
}

Measured memory_bytes: 256
# 中間となるやつを印つけてく
# 同じクエリがきたらアウトなんで、to/fromをもたせなきゃいけないんだけど
# もうめんどくさいのでuniqするわ

N, M = gets.chomp.split.map(&:to_i)
chukan = N.times.map{false}
flag = false
query = M.times.map{gets.chomp.split.map(&:to_i)}.uniq
query.each do |q|
  to, from = q
  if to==1 || from == N
      target = to==1 ? from : to
      if chukan[target-1] == true
        flag = true
        break
      else
        chukan[target-1] = true
      end
  end
end
puts flag ? "POSSIBLE" : "IMPOSSIBLE"

Measured memory_bytes: 32380
(let ((n (read))
      (s (read-line))
      (r 0)
      (w 0)
      (lw 0))
  ;
  (loop :for c :across s
        :if (char= c #\W)
        :do (incf w))
  (setf r (- n w))
  ;
  (loop :for i :from 0 :to (1- r)
        :for c := (char s i)
        :if (char= c #\W)
        :do (incf lw))
  (format t "~A~%" lw))


Measured memory_bytes: 27240
#include <iostream>
using namespace std;
int main(void){
    int n, ans = 0, c = 0, b;
    cin >> n >> b;
    for(int i=1;i<n;i++){
        int h;
        cin >> h;
        if(b >= h){
            ans = max(ans, ++c);
        }else{
            c = 0;
        }
        b = h;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>

long long dp[2][55][2505];

int main(){
    int n, a;
    int arr[55];
    scanf("%d%d",&n,&a);
    for(int i=1;i<=n;i++)
        scanf("%d",&arr[i]);
    dp[0][0][0] = dp[1][0][0] = 1;
    for(int i=1;i<=n;i++){
        for(int k=1;k<=i;k++){
            for(int j=0;j<=2500;j++){
                dp[i&1][k][j] = dp[(i&1)^1][k][j];
                if(j>=arr[i])
                    dp[i&1][k][j] += dp[(i&1)^1][k-1][j-arr[i]];
            }
        }
    }
    long long ans = 0;
    for(int i=1;i<=n;i++)
        ans += dp[n&1][i][i*a];
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
vector<int> dp(1000000,-1);

int doWork(vector<int> *grp,int node){
	if(dp[node]!=-1)
		return dp[node];

	int ans = 0;
	for(int i=0;i<grp[node].size();i++){
		ans = max(ans , doWork(grp,grp[node][i]));
	}
	dp[node]=ans+1;

	return dp[node];
}


int main(){

	int n , m;
	cin >> n >> m;

	vector<int> grp[n+10];

	int a,b;
	for(int i=0;i<m;i++){
		cin >> a >> b;
		grp[a].push_back(b);
	}

	for(int i=1;i<=n;i++){
		// // cout << i << "\n";
		// // for(int i=0;i<n;i++){
		// // 	cout << dp[i] << " ";
		// // }
		// cout << "\n";
		if(dp[i]==-1){
			doWork(grp,i);
		}
		// for(int i=0;i<n;i++){
		// 	cout << dp[i] << " ";
		// }
		// cout << "\n\n";
	}

	int ans = 0;
	// for(int i=1;i<=n;i++){
	// 	cout << i << " " << dp[i] << "\n";
	// }

	for(int i=1;i<=n;i++){
		ans = max(ans , dp[i]);
	}
	cout << ans-1 << "\n";
	return 0;
}

Measured memory_bytes: 11648
#include <map>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <iostream>
#include <queue>
#include <set>
#define ll long long
#define sf(a) scanf("%lld",&a)
#define pf(b) printf("%lld",b)
#define sp printf(" ")
#define nw printf("\n")
#define mp make_pair
#define pi pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define fast ios_base::sync_with_stdio(false)
using namespace std;

int main()
{
  ll ans,n,x,t;
  cin>>n>>x>>t;
  ans=0;
  ll v=0;
  while(1)
  {
  	ans+=t;
  	v+=x;
  	if(v>=n) break;
  }
  cout<<ans;
}


Measured memory_bytes: 3192
#include <stdio.h>

int main(int argc, char const *argv[])
{
	char s[4];
	scanf("%s",s);
	int i;
	for(i=0;i<4;i++) {
		if (s[i+1]=='\0') {
			break;
		}
	}
	if (s[i]=='2' || s[i]=='4' ||s[i]=='5' ||s[i]=='7' ||s[i]=='9') {
		printf("hon\n");
	}else if(s[i]=='0' ||s[i]=='1' ||s[i]=='6' ||s[i]=='8') {
		printf("pon\n");
	}else{
		printf("bon\n");
	}

	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if ((a + b) % 2 == 0) {
    cout << (a + b) / 2 << endl;
  } else {
  int x = a + (b + 1);
  cout << x / 2 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include <cstdio>
#include <cstring>
#define ll long long int
#define ii int
#define jmp cout<<"\n"
#define vl vector<ll>
#define pb push_back
#define printv(v) for(auto x:v) cout<<x<<" "; jmp;
#define endll "\n"
#define SORT(v) sort(v.begin(),v.end())
#define REV(x)  reverse(x.begin(),x.end())
#define ff first
#define ss second
#define iin insert
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
using namespace std;
const ll N = 1e5 + 5;
const ll inf = 0x3f3f3f3f;


void solve(string s1, string s2)
{
    int m,n;
    m=s1.length();
    n=s2.length();
    int dp[m+1][n+1];
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(s1[i-1]==s2[j-1])
            {
               dp[i][j]=dp[i-1][j-1]+1;
               continue;
            }
              dp[i][j]=max(dp[i-1][j],dp[i][j-1]);       
        }
    }
    int index=dp[m][n];
    char arr[index+1];
    arr[index]='\0';
    int i=m;
    int j=n;
    while (i > 0 && j >0) 
    {
            if(s1[i-1]==s2[j-1])
            {
               arr[index-1]=s1[i-1];
               i--;
               j--;
               index--;
            }
            else if(dp[i-1][j]>dp[i][j-1])
                i--;
            else  
                j--;    
    }
    string s=string(arr);
    cout<<s<<endl;
//    cout<<arr.substr(0,index)<<endl;
}


int32_t main() {
    fast;
    string s1,s2;
    cin>>s1>>s2;
    solve(s1,s2);
    return 0;
}


Measured memory_bytes: 35584
N = int(input())
inside_str = 0
tail_a = 0
head_b = 0
 
doubleAB = 0
 
for i in range(N):
  str = input()
  inside_str = inside_str + str.count('AB')
  
  if(str[-1] == 'A' and str[0] == 'B'):
  	doubleAB = doubleAB + 1
  elif (str[-1] == 'A'):
    tail_a = tail_a + 1
  elif (str[0] == 'B'):
    head_b = head_b + 1
 
if(tail_a == 0 and head_b == 0):
  if(doubleAB == 0):
    total_cand = inside_str
  else:
    total_cand = inside_str + doubleAB - 1
else:
  total_cand = inside_str + doubleAB + min(tail_a, head_b)

print(total_cand)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import math
def main():
    N = int(input())
    if N % 1.08 == 0:
        print(N/1.08)
    else:
        x = math.ceil(N/1.08)
        if x < (N+1)/1.08:
            print(x)
        else:
            print(':(')
    return
if __name__ == '__main__':
    main()

Measured memory_bytes: 62136
import java.io.*;
import java.util.*;
 
public class Main{
	int N;
	int[] W;
	
	void solve() {
		N = nextInt();
		W = new int[N];
		for(int i = 0; i < N; i++) {
			W[i] = nextInt();
		}
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < N; i++) {
			int sum1 = 0;
			int sum2 = 0;
			for(int j = 0; j < N; j++) {
				if(i <= j) {
					sum1 += W[j];
					
				}
				else {
					sum2 += W[j];
				}
			}
			min = Math.min(min, Math.abs(sum1 - sum2));
		}
		out.println(min);
	}
	
	
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Measured memory_bytes: 23252