akhauriyash/Code-Regression huggingface dataset:
N, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(N)]
ct = sorted(ct, key=lambda x:x[1])
mx = float('inf')

for c, t in ct:
    if t <= T:
        mx = min(mx, c)

if mx != float('inf'):
    print(mx)
    exit()
print('TLE')


Measured memory_bytes: 38384
#include"bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main(){

    fast
    int n,m;
    cin>>n>>m;
    vector<int>ar(n);
    for(int i=0; i<n; i++) cin>>ar[i];
    sort(ar.begin(), ar.end());
    int s = 0;
    for(int i=0; i<m; i++) s += ar[i];
    cout<<s<<endl;
}


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

#define ll long long
using namespace std;

const int N = 1e5 + 5;
int n, a[N][3];
ll dp[N][3];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 3; k++) {
                if(j == k) continue;
                dp[i][j] = max(dp[i][j], a[i][k] + dp[i - 1][k]);
            }
        }
    }
    cout << *max_element(dp[n], dp[n] + 3) << endl;
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define mp make_pair

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	ll x,y;
	cin>>x>>y;
	ll ans = x*y/2 + (x*y)%2;
	if(x==1 || y==1)
        ans=1;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  string s;
  int n,i,ans=0;
  cin >> n >> s;
  for(i=0;i<n-2;i++){
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3556
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (tails)

main :: IO ()
main = do
  let
    sub :: [a] -> [[a]]
    sub = snd . sub' . init . tails
      where
        -- sub' :: [[a]] -> ([a], [[a]])
        sub' = foldr step ([], [])
          where
            step xs (xs', xss') = (xs, xs' : map (head xs :) xss')
    permutations :: [a] -> [[a]]
    permutations [] = [[]]
    permutations xs = concatMap (map <$> (:) . fst <*> permutations . snd) . (zip <$> id <*> sub) $ xs
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  let
    perms = permutations [1..n]
  ps <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    a = length . takeWhile (/= ps) $ perms
  qs <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    b = length . takeWhile (/= qs) $ perms
  print . abs $ a - b

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 18900
from fractions import gcd
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))

if len(A[A < 0]) % 2 == 0:
    print(np.sum(np.abs(A)))
else:
    minabs_idx = np.argmin(np.abs(A))
    a = np.sum(np.abs(A)) - np.abs(A[minabs_idx])
    b = np.abs(A[minabs_idx])
    print(a - b)

Measured memory_bytes: 24260
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
using namespace std;
 
// #define int long long



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

	int tmp=n%500;

	if(tmp<=a){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

using namespace std;

int main() {
	long long n, a, b;
	cin >> n >> a >> b;
	cout << ((((b - a)*(n - 2) + 1) < 0) ? 0 : ((b - a)*(n - 2) + 1)) <<  endl;
//	cin >> a;
	return 0;
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
uvw = [LIST() for i in range(N-1)]
color = [0] * N

graph = defaultdict(list)

for u, v, w in uvw:
    graph[u-1].append((v-1, w))
    graph[v-1].append((u-1, w))

color[0] = 1
q = [0]

while q:
    a = q.pop()
    # if color[a]

    ## from here
    # if color[a] != 0:
        # not yet
    for node, w in graph[a]:
        if color[node] == 0:
            # next_nodeはまだ塗られていない
            if w % 2 == 0:
                color[node] = color[a]
            else:
                color[node] = color[a] * (-1)
            q.append(node)
for c in color:
    if c == -1:
        print(1)
    else:
        print(0) 
            # if color[a] != 0:
                # kuro
            #     if w % 2 == 0:
            #         color[node] = color[a]
            #     else:
            #         color[node] = color[a] * (-1)
            # else:
            #     if w % 2 == 1:
            #         color[node] = color[a] 
            #     else:
            #         color[node] = color[a] * (-1)
            #     q.append(node)
        







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

int main(){    
    int h, w;
    cin >> h >> w;
    vector <string> s(h);

    rep(i, h){
        cin >> s[i];
    }

    int di[8] = {-1, 0, 1, -1, 1, -1,  0,  1};
    int dj[8] = {-1,-1,-1,  0, 0,  1,  1,  1};
    rep(i, h){
        rep(j, w){
            if(s[i][j]=='.'){
                
                s[i][j] = '0';
                rep(n, 8){
                    int ii=i + di[n];
                    int jj=j + dj[n];
                    if(ii>=0 && ii<h && jj>=0 && jj<w){
                        if( s[ii][jj]=='#'){
                            ++s[i][j];
                        }
                    }

                    // if(i==2) cout << n;
                }
            }else{
                // cout << '#';
            }
        }
        // cout << endl;
    }

    rep(i, h){
        rep(j, w){
            cout << s[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>

#define INF 100000000

using namespace std;

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

    priority_queue<int> A;

    int N, M, i, num, sum = 0;

    cin >> N;
    cin >> M;

    for (i = 0; i < N; i++)
    {
        cin >> num;
        sum += num;
        A.push(num);
    }

    for (i = 0; i < M; i++)
    {
        num = A.top();
        if(4 * M * num < sum) break;
        A.pop();
    }

    if (i == M) cout << "Yes";
    else        cout << "No";

    return 0;
}


Measured memory_bytes: 256
for i in range(input()):
    xa,ya,ra,xb,yb,rb=map(float,raw_input().split())
    d=((xa-xb)**2+(ya-yb)**2)**0.5
    if ra>rb+d:print 2
    elif rb>ra+d:print -2
    elif d>ra+rb:print 0
    else: print 1

Measured memory_bytes: 4296
def f(n):
    l, r = 0, 1 << 10
    while r - l > 1:
        m = (l + r) // 2
        if m ** 5 <= n:
            l = m
        else:
            r = m
    return l if l ** 5 == n else 0

X = int(input())
for i in range(1 << 10):
    a = f(X + i ** 5)
    if a:
        print(a, i)
        break
    a = f(X - i ** 5)
    if a:
        print(a, -i)
        break

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  ll c = b - a - 1;
  if(c%2==0){
    print("Borys");
  }
  else{
    print("Alice");
  }
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <math.h>
int a[10],i,n,s;
int summing(int n,int s){
	int ans=0,i,max=0,min=0,m;
	if(n==1){if(s<10 && a[s]==1)return 1; else return 0;}
	else{
		//for(i=0,m=n;m>0 && i<10;i++){if(a[i]==1){min+=m*i;m--;}}
		//for(i=9,m=n;m>0 && i>=0;i--){if(a[i]==1){max+=m*i;m--;}}
		//if(s<min || max<s)return 0;
		//for(i=0;i<10;i++){printf("%d",a[i]);}
		for(i=0;i<10;i++){
			if(a[i]==1 && n*i<=s){
				if(n==2){
					m=s-i*2;
					if(m>=0 && m<10 && i!=m && a[m]==1)ans++;
				}
				else{
					a[i]=0;
					ans+=summing(n-1,s-n*i);
					a[i]=1;
				}
			}
		}
		//printf("%d,%d\n",n,ans);
		return ans;
	}
}
int main(void){
	for(i=0;i<10;i++)a[i]=1;
	while(scanf("%d %d",&n,&s)!=EOF){printf("%d\n",summing(n,s));}
	return 0;
}

Measured memory_bytes: 600
#include <math.h>
#include <stdio.h>

int main(void) {
  double x1, y1, x2, y2;

  scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
  printf("%f", sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)));

  return 0;
}

Measured memory_bytes: 652
//#typedef int ll
// include
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <tuple>
// namespace
using namespace std;
// typedef
typedef long long ll;
typedef long double ld;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pint;
// const
const int inf = 1e9;
const int mod = ((int)1e9 + 7);
// loop
#define rep(i, n) for(int i = 0, i##_mx = n; i < i##_mx; i++)
#define brep(i, b, e) for(int i = b; i < e; i++)
#define erep(i, b, e) for(int i = b; i <= e; i++)
#define rrep(i, b, e) for(int i = b; i >= e; i--)
// STL
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
// function
int gcd(int a, int b){return b ? gcd(b, a % b) : a;}
void prime(vint& v, int n){brep(i, 2, n){bool fg = false; for(auto e : v){if(i % e == 0){fg = true;}} if(fg){continue;} v.pb(i);}}
void in(vint& v){for(auto& i : v){cin >> i;}}
void in(vll& v){for(auto& i : v){cin >> i;}}

signed main(){
    ld w, h, x, y;
    cin >> w >> h >> x >> y;
    
    cout << w * h / 2 << " " << ((w / 2 == x && h / 2 == y) ? 1 : 0) << endl;
	
	return 0;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int64_t rs64() {
	int64_t n;
	scanf("%" SCNd64, &n);
	return n;
}
#define MOD 1000000007
template<int mod>
struct ModInt{
	int x;
	ModInt():x(0){}
	ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
	ModInt &operator+=(const ModInt &p){
		if((x+=p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p){
		if((x+=mod-p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p){
		x=(int)(1LL*x*p.x%mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p){
		*this*=p.inverse();
		return *this;
	}
	ModInt &operator^=(long long p){
		ModInt res = 1;
		for (; p; p >>= 1) {
			if (p & 1) res *= *this;
			*this *= *this;
		}
		return *this = res;
	}
	ModInt operator-()const{return ModInt(-x);}
	ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
	ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
	ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
	ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
	ModInt operator^(long long p)const{return ModInt(*this)^=p;}
	bool operator==(const ModInt &p)const{return x==p.x;}
	bool operator!=(const ModInt &p)const{return x!=p.x;}
	explicit operator int() const { return x; }						   // added by QCFium
	ModInt operator=(const int p) {x = p; return ModInt(*this);} // added by QCFium
	ModInt inverse()const{
		int a=x,b=mod,u=1,v=0,t;
		while(b>0){
			t=a/b;
			a-=t*b;
			std::swap(a,b);
			u-=t*v;
			std::swap(u,v);
		}
		return ModInt(u);
	}
	friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
		return os<<p.x;
	}
	friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
		long long x;
		is>>x;
		a=ModInt<mod>(x);
		return (is);
	}
};
typedef ModInt<MOD> mint;

struct MComb {
	std::vector<mint> fact;
	std::vector<mint> inversed;
	MComb(int n) { // O(n+log(mod))
		fact = std::vector<mint>(n+1,1);
		for (int i = 1; i <= n; i++) fact[i] = fact[i-1]*mint(i);
		inversed = std::vector<mint>(n+1);
		inversed[n] = fact[n] ^ (MOD-2);
		for (int i = n - 1; i >= 0; i--) inversed[i]=inversed[i+1]*mint(i+1);
	}
	mint ncr(int n, int r) {
		return (fact[n] * inversed[r] * inversed[n-r]);
	}
	mint npr(int n, int r) {
		return (fact[n] * inversed[n-r]);
	}
	mint nhr(int n, int r) {
		assert(n+r-1 < (int)fact.size());
		return ncr(n+r-1, r);
	}
};

mint ncr(int n, int r) {
	mint res = 1;
	for (int i = n - r + 1; i <= n; i++) res *= i;
	for (int i = 1; i <= r; i++) res /= i;
	return res;
}

int main() {
	int n = ri();
	int a = ri();
	int b = ri();
	mint res = (mint(2) ^ n) - 1 - ncr(n, a) - ncr(n, b);
	std::cout << res << std::endl;
	return 0;
}


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

using namespace std;

int main() {
  int n; cin >> n;
  vector <int> a(n);
  int mx = 0;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  int need = (mx + 1) / 2; int ans = 0;
  for(int i = 0; i < n; i++) {
    if(abs(need - a[i]) < abs(need - ans)) {
      ans = a[i];
    }
  }
  cout << mx << ' ' << ans << '\n';
}


Measured memory_bytes: 640
import java.util.*;
import java.io.*;
import static java.lang.System.*;

public class Main{
	public static void main(String[] args){
		int i,win = 0,lose = 0;
		String s = "";
		Scanner sc = new Scanner(System.in);
		s = sc.next();
		for (i = 0; i < s.length(); ++i) {
			if(s.charAt(i) == 'o')	++win;
			else ++lose;
		}
		if(win + (15 - i) >= 8)	out.println("YES");
		else out.println("NO");
		// out.println();
	}
}


Measured memory_bytes: 21716
class Dice
    @faces = nil
 
    def initialize arr
        @faces = arr
    end

    def rotate news
        f = @faces.dup
        case news
        when "N"
            @faces = [f[1], f[5], f[2], f[3], f[0], f[4]]
        when "E"
            @faces = [f[3], f[1], f[0], f[5], f[4], f[2]]
        when "W"
            @faces = [f[2], f[1], f[5], f[0], f[4], f[3]]
        when "S"
            @faces = [f[4], f[0], f[2], f[3], f[5], f[1]]
        end
    end
 
    def right top, front
        "SWSWS".each_char{|c|
            break if @faces[0] == front
            rotate c
        }
        rotate "S"
        "WWW".each_char{|c|
            break if @faces[0] == top
            rotate c
        }
        @faces[2]
    end
 
    def same? faces2
        return true if @faces == faces2
        "WWWWSWWWWSWWWWSWWWWSWSWWWWSSWWW".each_char{|c|
            rotate c
            return true if @faces == faces2
        }
        return false
    end
end
 
while true
    n = gets.to_i
    break if n == 0
    arr = [gets.chomp.split]
    (n-1).times{
        line = gets.chomp.split
        dice = Dice.new(line)
        same = false
        arr.each{|line2|
            if dice.same?(line2)
                same = true
                break
            end
        }
        arr << line unless same
    }
    puts n - arr.length
end


Measured memory_bytes: 6952
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:16777216")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>  
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <time.h>
#include <bitset>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(A,value) memset(A,value,sizeof(A))

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair
const double PI=acos(-1.0);

typedef long long Int;
typedef long long LL;
typedef unsigned long long UINT;
typedef vector <int> VI;
typedef pair <int, int> PII;
typedef pair <double, double> PDD;

const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 3007;
const int MAX1 = 2007;
const int MAX2 = 24000000;
const int LEN = 21;
const int BASE = 1000000000;

int n, m, k;
map<PII, int> M;
Int R[10];

bool OK(int x, int y)
{
  return x >= 0 && y >= 0 && x+2 < n && y+2 < m;
}

int main()
{
  cin >> n >> m >> k;

  set<PII> Q;
  FOR (i,0,k)
  {
    int x, y;
    scanf("%d %d", &x, &y);
    -- x;
    -- y;
    M[MP(x, y)] = 1;
    FOR (dx,-2,1)
      FOR (dy,-2,1)
      {
        PII p = MP(x+dx, y+dy);
        Q.insert(p);
      }
  }

  R[0] = (n-2) * 1LL * (m-2);

  for(set<PII>::iterator it = Q.begin(); it != Q.end(); ++it)
  {
    int x = it->first;
    int y = it->second;
    if (OK(x, y))
    {
      int c = 0;
      FOR (dx,0,3)
        FOR (dy,0,3)
          c += M[MP(x+dx, y+dy)];
      R[0] --;
      R[c] ++;
    }
  }

  FOR (i,0,10)
    cout << R[i] << endl;


  
  return 0;
}


Measured memory_bytes: 198656
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    int f=0;
    cin>>a>>b>>c;
    if(a==b&&a!=c)
    {
        f=1;
    }
    else if(b==c&&b!=a)
    {
        f=1;
    }
    else if(a==c&&a!=b)
    {
        f=1;
    }
      if(f)
            cout<<"Yes"<<endl;
      else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<string>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    list<char> S;
    string s;
    cin >> s;
    const char* cstr = s.c_str();
    while(*cstr != '\0'){
        S.push_back(*cstr);
        cstr++;
    }

    int q;
    cin >> q;
    int t[q], f[q];
    char c[q];
    bool start = true;
    rep(i, q){
        cin >> t[i];
        if(t[i] == 2){
            cin >> f[i] >> c[i];
            if(f[i] == 1){
                if(start) S.push_front(c[i]);
                else S.push_back(c[i]);
            }else{
                if(!start) S.push_front(c[i]);
                else S.push_back(c[i]);
            }
        }else{
            // cout << "reverse" << endl;
            start = !start;
        }
        // for(auto&& n: S){
        //     cout << n;
        // }cout << endl;
    }
    if(!start) S.reverse();

    for(auto&& n: S){
        cout << n;
    }






    // rep(i, q){
    //     cin >> t[i];
    //     if(t[i] == 2){
    //         cin >> f[i] >> c[i];
    //         if(f[i] == 1){
    //             S.push_front(c[i]);
    //         }else{
    //             S.push_back(c[i]);
    //         }
    //     }else{
    //         // cout << "reverse" << endl;
    //         S.reverse();
    //     }
    //     // for(auto&& n: S){
    //     //     cout << n;
    //     // }cout << endl;
    // }

    // for(auto&& n: S){
    //     cout << n;
    // }
}

Measured memory_bytes: 11740
<?php
class CitySavers {
    var $N, $A, $B, $ans;
    
    function __construct() {
        ini_set('error_reporting', E_ALL & ~E_NOTICE);
        
        list($this->N) = explode(" ", trim(fgets(STDIN)));
        $this->A = array_map("intval", explode(" ", trim(fgets(STDIN))));
        $this->B = array_map("intval", explode(" ", trim(fgets(STDIN))));
        $this->ans = 0;
    }
    
    function __invoke() {
        $posS = min($this->A[0], $this->B[0]);
        $this->A[0] -= $posS;
        $this->B[0] -= $posS;

        $posE = min($this->A[$this->N], $this->B[$this->N - 1]);
        $this->A[$this->N] -= $posE;
        $this->B[$this->N - 1] -= $posE;
        
        $this->ans += $posS + $posE;
        
        for ($i = 1; $i < $this->N; $i++) {
            $posL = min($this->A[$i], $this->B[$i - 1]);
            $this->A[$i] -= $posL;
            $this->B[$i - 1] -= $posL;

            $posR = min($this->A[$i], $this->B[$i]);
            $this->A[$i] -= $posR;
            $this->B[$i] -= $posR;
            
            $this->ans += $posL + $posR;
        }
        return $this->ans;
    }
}

$CitySavers = new CitySavers();
echo $CitySavers();

Measured memory_bytes: 20976
#include<bits/stdc++.h>
using namespace std;
long long p[100001];
int main(){
	long long n,k,q,t;
	cin>>n>>k>>q;
	int hhh=q;
	while(q--){
		int a;
		cin>>a;
		p[a]++;
	}
	for(int i=1;i<=n;i++){
		//cout<<k-p[i]-hhh<<endl;
		if(k+p[i]-hhh>0)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
 using namespace std;
#define FIO                     ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mod                     1000000007
#define eps                     1e-9
#define setbits                 __builtin_popcount
#define gcd                     __gcd
#define rep(i,a,b)              for(int i=a;i<=b;i++)
#define repr(i,b,a)             for(int i=b;i>=a;i--)
#define forn(i,n)               for(int i=0;i<n;i++)
#define all(a)                  a.begin(), a.end()
#define pb                      push_back
#define endl                    "\n"
#define ff                      first
#define ss                      second
#define asort(c)                sort(all(c)) 
#define lbpos(x,v)              (int)(lower_bound(all(v),x)-v.begin())//=v.size()==>No LB 
#define ubpos(x,v)              (int)(upper_bound(all(v),x)-v.begin())//=v.size()==>No UB
#define PI                      3.14159265358979323846
#define int                     long long
typedef  vector<int>                 vi;
typedef  pair<int, int>              ii;
typedef  vector<ii>                 vii;
typedef  long double                 ld;
#define debug(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
clock_t time_p=clock();
int check(int n)
{
  int cnt=0;
  while(n)
  {
    if(n%10==2)cnt++;
    n/=10;
  }
  return cnt;
}
void timer()
{
    time_p=clock()-time_p;
    cerr<<"Execution Time: "<<(double)(time_p)/CLOCKS_PER_SEC<<"\n";
}

int32_t main()
{
  FIO;
  
  
  int n;
  cin>>n;
  cout<<check(n);

  timer();
  return 0;
}  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;i++)
#define chmin(x,y) x = min(x,y)
typedef long long ll;

using namespace std;

int main(){
  ll n, x;
  cin >> n;
  x = 1e18;
  for(ll i=1;i*i <= n;i++){
    if(n % i == 0) chmin(x,i + n/i -2);
  }

  cout << x << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	unsigned int num, h, w = 0;
	unsigned int h_in, w_in = 0;
	int i = 0;
	int count = 0;

	scanf("%d %d %d", &num, &h, &w);
    for(i = 0; i < num; i++) {
    	scanf("%d %d", &h_in, &w_in);
    	if( (h <= h_in) && (w <= w_in)) {
    		count++;
    		//printf("h=%d\n",h);
    	}
    }
    printf("%d", count);


	return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        long ans = 0;
        for( int i = 1 ; i <= n ; i++ ){
            if( i % 3 == 0 || i % 5 == 0 ){
                continue;
            }
            ans += i;
        }
        System.out.println(ans);
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int bufferLength = 0;

        private boolean hasNextByte() {
            if (ptr < bufferLength) {
                return true;
            } else {
                ptr = 0;
                try {
                    bufferLength = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return bufferLength > 0;
            }
        }

        private int readByte() {
            if (hasNextByte()) {
                return buffer[ptr++];
            } else {
                return -1;
            }
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
            return hasNextByte();
        }

        String next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        long nextLong() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
                throw new NumberFormatException();
            }
            return (int) nl;
        }

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


Measured memory_bytes: 32552
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#define ll long long int
#define mp make_pair
#define pb push_back
#define vi vector<int>
using namespace std;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out<<x<<" ";
    }
    out<<"\n";
    return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out+x;
    }
    return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
    for(auto &x : vec){
        in>>x;
    }
    return in;
}
void solve(){
    int n;
    cin>>n;
    vector<string> val={"pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"}; 
    cout<<val[n%10]<<'\n';
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}

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

int main() {
        int h, w;
        scanf("%d%d", &h, &w);
        string blue(w, 'B');
        vector<string> color(h, blue);
        for (int i = 1; i < h; i ++) {
                if (i % 4 == 1 || i % 4 == 3) for (int j = 1; j < w - 1; j ++) color[i][j] = 'R';
                else if (i % 4 == 2) color[i][w - 2] = 'R';
                else color[i][1] = 'R';
        }
        vector<string> target(h);
        for (int i = 0; i < h; i ++) cin >> target[i];
        string white(w, '.');
        vector<string> blueans(h, white), redans(h, white);
        for (int i = 0; i < h; i ++) {
                for (int j = 0; j < w; j ++) {
                        if (color[i][j] == 'R') redans[i][j] = '#';
                        else blueans[i][j] = '#';
                        if (target[i][j] == '#') redans[i][j] = blueans[i][j] = '#';
                }
        }
        for (int i = 0; i < h; i ++) cout << redans[i] << endl;
        cout << endl;
        for (int i = 0; i < h; i ++) cout << blueans[i] << endl;
        return 0;
}


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

namespace ABC_C
{
    class C097
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int K = int.Parse(Console.ReadLine());

            //SortedSet<string> ss = new SortedSet<string>();
            HashSet<string> ss = new HashSet<string>();
            for(int i = 0; i < s.Length; i++)
            {
                for(int j = i + 1; j <= s.Length; j++)
                {
                    int len = j - i;
                    if (len > 5) continue;
                    string ps = s.Substring(i, len);
                    ss.Add(ps);                    
                }
            }
            var list = ss.ToList();
            list.Sort();
            string r = list.ElementAt(K-1);
            Console.WriteLine(r);
        }

    }
}


Measured memory_bytes: 14688
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

int main(){
	string s;
	cin>>s;
	ll k;
	cin>>k;
	int n = s.size();

	ll normal= 0;

	ll cur = 1;
	for(int i=1;i<n;i++){
		if(s[i] == s[i-1]){
			cur++;
		}
		else{
			normal += cur/2;
			cur = 1;
		}
	}		
	normal += cur/2;

	 // cout<< normal<<endl;
	if(s[0] != s[n-1]){
		cout<<normal*k<<endl;
		return 0;
	}

	cur = 1;
	for(int i=1;i<n;i++){
		if(s[i] == s[i-1]){
			cur++;
		}
		else{
			break;
		}
	}

	if(cur == n){
		cout<<(cur*k)/2<<endl;
		return 0;
	}

	ll l = cur;
	cur = 1;	
	for(int i=n-2;i>=0;i--){
		if(s[i] == s[i+1]){
			cur++;
		}
		else{
			break;
		}
	}

	// cout<<l<<" "<<cur<<endl;

	ll bad = normal - l/2 - cur/2 + (l+cur)/2;
	
	ll ans = normal + (k-1)*bad;
	cout<<ans<<endl;

}


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long double L, R;
    cin >> L >> R;
    if (R - L > 2018) cout << 0 << "\n";
    else {
        long long ans = 2018;
        for (long long i = L; i < R; ++i)
            for (long long j = i + 1; j <= R; ++j)
                ans = min(ans, (i * j) % 2019);
        cout << ans << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
 
Node root=NIL;
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
     
  while(x != NIL){
    y = x;
    if(z->key < x->key)x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if (y == NIL)root = z;
  else if(z->key < y->key)y->left = z;
  else y->right = z;
}
 
void inorder(Node u){
  if(u->left != NIL)
    inorder(u->left);
  printf(" %d",u->key);
  if(u->right != NIL)
    inorder(u->right);
}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left != NIL)
    preorder(u->left);
  if(u->right != NIL)
    preorder(u->right);
}

int main(){
  int m, i, x;
  char str[20];

  scanf("%d", &m);
 
  for(i = 0; i < m; i++){
    scanf("%s", str);
    if(str[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }else if(str[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
 
  return 0;
}

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

#define   ipr         	pair<int, int>
#define   pb            push_back
#define   ff            first
#define   ss            second
#define   fr(i, j, k)   for (int i = j; i < k; i++)
#define   rf(i, j, k)   for (int i = j; i >= k;i--)
#define   int           long long
#define   ll 			unsigned long long
#define   ld            long double
#define   all(x)        x.begin(), x.end()
#define   rall(x)       x.rbegin(),x.rend()
#define   mp            make_pair
#define   inf           INT_MAX
#define   read_file();	freopen("input.txt", "r", stdin);	freopen("output.txt", "w", stdout);
#define   IOS           std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int Maxn  =  10000;
const ld  pi   =  acos(-1);
const int mod =  1000000007;


template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template<class T> ostream& operator <<(ostream &out,set<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}


int32_t main(){IOS
int n,m;
cin>>n>>m;
int ans=0;
if(n!=0 && m!=0)ans=ans+(n*(n-1))/2 + (m*(m-1))/2;
else if(n==0)ans=ans + (m*(m-1))/2;
else if(m==0)ans=ans+(n*(n-1))/2 ;
cout<<ans<<endl;
}



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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int H, W;
string S[2020];
int num[4][2020][2020];//上下左右

signed main() {
    cin >> H >> W;
    rep(i, H) {
        cin >> S[i];
    }

    rep(i, H) {
        rep(j, W) {
            if (S[i][j] == '#')num[0][i][j] = -1;
            else if (i == 0) {
                num[0][i][j] = 0;
            } else {
                num[0][i][j] = num[0][i - 1][j] + 1;
            }

            if (S[i][j] == '#')num[2][i][j] = -1;
            else if (j == 0) {
                num[2][i][j] = 0;
            } else {
                num[2][i][j] = num[2][i][j - 1] + 1;
            }
        }
    }

    for (int i = H - 1; i >= 0; --i) {
        for (int j = W - 1; j >= 0; --j) {
            if (S[i][j] == '#')num[1][i][j] = -1;
            else if (i == H - 1)num[1][i][j] = 0;
            else {
                num[1][i][j] = num[1][i + 1][j] + 1;
            }

            if (S[i][j] == '#')num[3][i][j] = -1;
            else if (j == W - 1)num[3][i][j] = 0;
            else num[3][i][j] = num[3][i][j + 1] + 1;
        }
    }
    int ans = 0;
    rep(i, H) {
        rep(j, W) {
            if (S[i][j] == '#')continue;
            ans = max(ans, num[0][i][j] + num[1][i][j] + num[2][i][j] + num[3][i][j] + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 131584
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            String str = sc.next();
            if(str.equals("0")) break;
            int sum = 0;
            for(int i=0; i<str.length(); i++){
                sum += Integer.valueOf(str.charAt(i)-48);
            }
            System.out.println(sum);
        }
    }
}


Measured memory_bytes: 26272
a=[int(x) for x in input().split()]
b = (a[1]-(2*a[0])) / 2
c = (a[1]-(4*a[0])) / -2
if b >= 0 and c >= 0 and b.is_integer() and c.is_integer:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >>n;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=n-1;j>0;j--){
            if(a[j-1]>a[j]){
                int t=a[j];
                a[j]=a[j-1];
                a[j-1]=t;
                ++cnt;
            }
        }
    }
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i==n-1) cout << endl;
        else cout << " ";
    }
    cout << cnt << endl;
    return 0;
}


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	bool a_bc = a == b +c;
	bool b_ac = b == a+c;
	bool c_ba = c == b+a;
	
	if(a_bc || b_ac || c_ba) cout << "Yes";
	else cout << "No";
	
	cout << endl;
	
	return 0;
}

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

#define FIND(c, e) ((c).find(e) != (c).end())
#define NFIND(c, e) ((c).find(e) == (c).end())
#define ALL(t) (t).begin(), (t).end()
#define ALLR(t) (t).rbegin(), (t).rend()
#define MP make_pair

const int N = int( 2e5 ) + 10;
const int M = int( 1e6 ) + 1;
const int MOD = int( 1e9 ) + 7;
const double PI = acos(-1.0);
const double eps = 1e-6;
template<class T> T gcd(T a,T b){while(b){T r=a%b;a=b;b=r;}return a;}
template<class T> T lcm(T a,T b){return (a*b)/gcd(a,b);}
template<class T> T max(T a,T b,T c){return max(max(a,b),c);}
template<class T> T min(T a,T b,T c){return min(min(a,b),c);}
int n, a;
set<int> s;
void __answer()
{
    cin >> n;
    while(n--) {
        cin >> a;
        if(FIND(s, a)) {
            s.erase(a);
        } else s.insert(a);
    }
    cout << s.size() << endl;
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cout << setprecision(11) << fixed;
    #ifdef LOCAL
        freopen("TEST.txt", "r", stdin);
    #endif
    __answer();
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>
 
using namespace std;

int w,h;
int sx,sy;
int res;
int table[30][30];
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};

void dfs(int x,int y,int cnt){
	if(cnt>=res) return ;
	
	for(int dir=0;dir<4;dir++){
		int nx=x+dx[dir],ny=y+dy[dir];
		
		if(nx<0 || w<=nx || ny<0 || h<=ny) continue;	//?????????
		else if(table[ny][nx]==1) continue;				//???????§????????????????
		else if(table[ny][nx]==3){res=cnt; return;}		//??´??????
		
		while(true){
			nx+=dx[dir]; ny+=dy[dir];
			if(nx<0 || w<=nx || ny<0 || h<=ny) break;	//?????????
			else if(table[ny][nx]==1){
				table[ny][nx]=0;						//?????????????£????
				dfs(nx-dx[dir],ny-dy[dir],cnt+1);		//?¬?????????????
				table[ny][nx]=1;						//?????????????£???????????????????
				break;
			}else if(table[ny][nx]==3){
				res=cnt;								//??´??????
				return ;
			}
		}
		
	}
	
}


int main()
{
	
	while(cin>>w>>h,w){		
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin>>table[i][j];
				if(table[i][j]==2){sx=j;sy=i;}
			}
		}
		
		res=11;
		dfs(sx,sy,1);
		if(res>10) res=-1;
		cout<<res<<endl;
		
	}
	

	return 0;
}

Measured memory_bytes: 1164
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
k = ni()
a = 0
for i in range(10**6):
    a=(a+7*pow(10,i,k))%k
    if a== 0:
        print(i+1)
        break
else:
    print(-1)


Measured memory_bytes: 68220
#include <iostream>
#include<list>
using namespace std;
list<long long>L;
int main()
{
    auto it=L.begin();
    long long T,flag,x,d;
    cin>>T;
    while(T--)
    {
        cin>>flag;
        if(flag==0)
        {
            cin>>x;
            it=L.insert(it,x);
            //--it;
        }
        else if(flag==1)
        {
            cin>>d;
            if(d>0) for(int i=0;i<d;i++,it++);
            else for(int i=0;i<abs(d);i++,it--);
        }
        else
        {
            it=L.erase(it);
        }

    }
    for(it=L.begin();it!=L.end();it++)
        {
            cout<<*it<<endl;
        }
    return 0;
}



Measured memory_bytes: 18612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;

int main() {
    ll N, K; cin >> N >> K;
    vector<pair<ll,ll>> v(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> v[i].first >> v[i].second;
    }
    
    ll min_area = INF;
    for (ll i = 0; i < N; i++)
    {
        for (ll j = 0; j < N; j++)
        {
            if(v[i].first>v[j].first) continue;
            for (ll k = 0; k < N; k++)
            {
                for (ll l = 0; l < N; l++)
                {
                    if(v[k].second>v[l].second) continue;
                    ll area = (v[j].first-v[i].first) * (v[l].second-v[k].second); 
                    if(area > min_area) continue;
                    ll cnt = 0;
                    for (ll m = 0; m < N; m++)
                    {
                        if(v[i].first<=v[m].first && v[j].first>=v[m].first && v[k].second<=v[m].second && v[l].second>=v[m].second){
                          cnt++;  
                        }                        
                    }
                    if(cnt>=K) min_area = min(min_area, area);
                }
            }
        }
    }
    cout << min_area << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int ans = 1;
		int[] arr = new int[N];
		arr[0] = reader.nextInt();
		for (int i = 1; i < N; i++) {
			arr[i] = reader.nextInt();
			boolean flag = true;
			for (int j = 0; j < i;j++) {
				flag = flag && arr[j] <= arr[i];
			}
			if (flag) {
				ans++;
			}
		}


		System.out.println(ans);
		reader.close();

	}

}





Measured memory_bytes: 23764
n,l=map(int,input().split())
mcount=0
go=1000
a=[0]*n
for i in range(1,n+1):
  a[i-1]=l+i-1
  mcount+=a[i-1]
  
for i in range(n):
  if go>=abs(mcount-(mcount-a[i])):
    go=abs(mcount-(mcount-a[i]))
    c=mcount-a[i]
    
print(c)

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  Solver(LL n) : n(n){};

  void solve() {
  }
};
class Solver2 {
 public:
  int n, k;
  Solver2(LL n, LL k) : n(n), k(k){};

  void solve() {
    int ans = 0;
    while (n > 0) {
      n /= k;
      ans++;
    }
    cout << ans << endl;
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, k;
  std::cin >> n >> k;

  Problem::Solver2 sol(n, k);
  sol.solve();
  return 0;
}


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

int election(string str){
  if(str[1]>='0' && str[1]<='9'){
    return stoi(str.substr(1,str.size()-2))/2+1;
  }
  vector<int> vec;
  int s=1,e;
  while(str[s]!=']'){
    int depth=1;
    for(e=s+1; depth>0; e++){
      if(str[e]=='[') depth++;
      if(str[e]==']') depth--;
    }
    vec.push_back( election(str.substr(s,e-s)) );
    s=e;
  }
  sort(vec.begin(), vec.end());
  int ret=0;
  for(int i=0; i<(int)vec.size()/2+1; i++){
    ret += vec[i];
  }
  return ret;
}

int main(){
  int n;
  cin >> n;
  string str;
  for(int i=0; i<n; i++){
    cin >> str;
    cout << election(str) << endl;
  }   
  return 0;
}

Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
int main()
{

    int K, N;
    int sum=0;
    cin >> K >> N;
    vector<int> a(N+1);//配列の宣言
    vector<int> b(N+1);
    for(int i=0;i<N;i++){
        cin >> a.at(i);
    }
    for(int i=0;i<N-1;i++){
        b.at(i+1)=a.at(i+1)-a.at(i);
    }

    b.at(0)=a.at(0)+K-a.at(N-1);
    for(int i=0;i<N;i++){
        sum+=b.at(i);
    }

    int max=b.at(0);
    int maxindex=0;
    for(int i=0;i<N;i++){
        if(b.at(i+1)>max){
        max=b.at(i+1);
        maxindex=i+1;
        }
    }

    cout << sum-b.at(maxindex) << endl;
}


Measured memory_bytes: 4840
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <functional>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,f,t) for(int i=f;i<t;i++)
int main()
{
    int A, B; cin >> A >> B;
    if (A + B >= 10) cout << "error\n";
    else cout << A + B << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{

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

for(int i=0; i<10; i++){
mountains[i] = sc.nextInt();
}

Arrays.sort(mountains);
System.out.println(mountains[9]);
System.out.println(mountains[8]);
System.out.println(mountains[7]);
}


}

Measured memory_bytes: 26384