akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }

    #[allow(dead_code)]
    pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
    where
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }

    #[allow(dead_code)]
    pub fn get3<S: FromStr, T: FromStr, U: FromStr>() -> (S, T, U)
    where
        <S as FromStr>::Err: Debug,
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }
}


#[allow(unused_macros)]
macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn main() {
    let (n, k): (usize, usize) = util::get2();
    let xy: Vec<(i64, i64)> = (0..n).map(|_| util::get2()).collect();

    let mut ans = u64::max_value();
    let mut buf: HashSet<(i64, i64, i64, i64, usize)> = HashSet::new();

    for i in 0..n {
        let mut next = HashSet::new();
        let (x, y) = xy[i];
        if (n - i) >= k {
            next.insert((x, x, y, y, 1));
        }

        for &(xmin, xmax, ymin, ymax, m) in &buf {
            let xmin2 = min(xmin, x);
            let xmax2 = max(xmax, x);
            let ymin2 = min(ymin, y);
            let ymax2 = max(ymax, y);
            if m + 1 == k {
                let dx = xmax2 - xmin2;
                let dy = ymax2 - ymin2;
                ans = min(ans, dx as u64 * dy as u64);
            } else {
                next.insert((xmin2, xmax2, ymin2, ymax2, m + 1));
            }
            if (n - i) > (k - m) {
                next.insert((xmin, xmax, ymin, ymax, m));
            }
        }
        buf = next;
    }

    println!("{}", ans);
}


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

int main(void) {
    map<char, int> mp;
    char s;
    while (cin >> s) {
        if (s >= 'a' && s <= 'z') {
            if (mp.find(s) != mp.end()) {
                mp[s] += 1;
            } else mp[s] = 1;
        } else if (s >= 'A' && s <= 'Z') {
            char tmp = s + 'a' - 'A';
            if (mp.find(tmp) != mp.end()) {
                mp[tmp] += 1;
            } else mp[tmp] = 1;
        }
    }
    for (char i = 'a'; i <= 'z'; i++) {
        if (mp.find(i) != mp.end()) printf("%c : %d\n", i, mp[i]);
        else printf("%c : 0\n", i);
    }
    return 0;
}


Measured memory_bytes: 3152
#include<stdio.h>

void selectionsort(int s[],int n){
  int min=0,a;
  for(int i=0;i<n;i++){
    min=i;
    for(int j=i;j<n;j++){
      if(s[j]<s[min])min=j;
    }
    a=s[i];
    s[i]=s[min];
    s[min]=a;
  }
}

int main(void){
  int n,q,cnt=0,mid,key;
  scanf("%d",&n);
  int s[n];
  for(int i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  scanf("%d",&q);
  int t[q];
  for(int i=0;i<q;i++){
    scanf("%d",&t[i]);
  }
  selectionsort(s,n);
  mid=n/2;
  for(int i=0;i<q;i++){
    key=t[i];
    if(s[mid]<=key){
      for(int j=mid;j<n;j++){
        if(key==s[j]){
          cnt++;
          break;
        }
      }
    }
    else if(s[mid]>key){
      for(int j=0;j<mid;j++){
        if(key==s[j]){
          cnt++;
          break;
        }
      }
    }
  }
    
  printf("%d\n",cnt);

  return 0;
}



Measured memory_bytes: 2072
#include <iostream>
using namespace std;
#include <string>     // std::string, std::to_string


int main(){

    int list[5];
    int num =0;
    for(int i=0;i<=4;i++){
        cin>>list[i];
    }
    if(list[0]==0){
        num =0;
    }
    if(list[1]==0){
        num =1;
    }
    if(list[2]==0){
        num =2;
    }
    if(list[3]==0){
        num =3;
    }
    if(list[4]==0){
        num =4;
    }

   cout<< num+1;
}


Measured memory_bytes: 3108
const MODULO: u64 = 1_000_000_007;

#[derive(Clone, Copy, Debug)]
struct F(u64);

impl std::ops::Neg for F {
    type Output = Self;
    fn neg(self) -> Self {
        F((MODULO - self.0) % MODULO)
    }
}

impl std::ops::Add for F {
    type Output = Self;
    fn add(self, rhs: Self) -> Self {
        F((self.0 + rhs.0) % MODULO)
    }
}

impl std::ops::Sub for F {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self {
        F((self.0 + MODULO - rhs.0) % MODULO)
    }
}

impl std::ops::Mul for F {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self {
        F((self.0 * rhs.0) % MODULO)
    }
}

impl std::ops::Div for F {
    type Output = Self;
    fn div(self, rhs: Self) -> Self {
        let mut out = self;
        let mut base = rhs;
        let mut exponent = MODULO - 2;
        while exponent != 0 {
            if exponent & 1 != 0 {
                out = out * base;
            }
            base = base * base;
            exponent >>= 1;
        }
        out
    }
}

fn read_stdin() -> String {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    buf
}

struct Scanner<'a> {
    iter: std::str::SplitWhitespace<'a>,
}

impl<'a> Scanner<'a> {
    fn new(text: &'a str) -> Self {
        Scanner {
            iter: text.split_whitespace(),
        }
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.iter.next().unwrap().parse().ok().unwrap()
    }
}

// ABC154 F - Many Many Paths
pub fn main() {
    let stdin = read_stdin();
    let mut sc = Scanner::new(&stdin);
    let r1: u64 = sc.read();
    let c1: u64 = sc.read();
    let r2: u64 = sc.read();
    let c2: u64 = sc.read();
    fn binom(m: u64, n: u64) -> F {
        let (m, n) = if m < n { (m, n) } else { (n, m) };
        let mut numer = F(1);
        let mut denom = F(1);
        for i in 0..m {
            numer = numer * F(n + m - i);
            denom = denom * F(m - i);
        }
        numer / denom
    }
    let ans = binom(r2 + 1, c2 + 1) - binom(r2 + 1, c1) - binom(r1, c2 + 1) + binom(r1, c1);
    println!("{}", ans.0);
}

Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7;

int main(){
  int p;
  cin >> p;
  ll a[p];
  rep(i,p)cin >> a[i];
  ll b[p]={};
  for(int i=0;i<p;i++){
    if(i==0){
      b[p-1]=1;
      b[0]=p-1;
      b[p-1]*=(p-1)*a[0];
      b[p-1]%=p;
      b[0]*=(p-1)*a[0];
      b[0]%=p;
    }else{
      if(a[i]==0)continue;
      ll temp=1;
      ll add[p]={};
      for(int j=0;j<p-1;j++){
        add[p-1-j]=temp*a[i];
        add[p-1-j]%=p;
        add[p-1-j]*=(p-1);
        add[p-1-j]%=p;
        b[p-1-j]+=add[p-1-j];
        b[p-1-j]%=p;
        temp*=i;
        temp%=p;
      }
    }
  }
  for(int i=0;i<p;i++){
    if(b[i]%p<0){
      while(1){
        cout << 'u' << endl;
      }
    }
  }
  for(int i=0;i<p;i++)cout << b[i]%p << ' ';
  cout << endl;
return 0;}

Measured memory_bytes: 384
from collections import Counter
from functools import reduce
# import statistics
import bisect
import copy
import fractions
import math
import random
import string
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))

def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]

n = II()
a = LI()
left = [0] * (n+1)
right = [0] * (n+1)

for i in range(1, n+1):
    left[i] = fractions.gcd(left[i-1], a[i-1])
for i in range(n-1, -1, -1):
    right[i] = fractions.gcd(right[i+1],a[i])
maxi = -INF
for i in range(n):
    maxi = max(maxi, fractions.gcd(left[i], right[i+1]))
print(maxi)



Measured memory_bytes: 86888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
using namespace std;
typedef long long ll;
const int maxn = 100005;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  int mx = -1, sum=0;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    mx=max(mx,x);
    sum+=x;
  }
  if(mx<sum-mx)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <limits.h>
#include <assert.h>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long int
#define db double
#define ldb long double
#define MOD 1000000007
#define Fi first
#define Se second
#define INF INT_MAX
#define NINF INT_MIN
#define L_INF LLONG_MAX
#define L_NINF LLONG_MIN
#define gc getchar
#define sz(x) (int)(x).size()
#define pii pair<int,int>
#define pll pair<ll,ll>

void fsscan(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

void scani(int &x)
{
    register int c = gc();x = 0;int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}

int main()
{
    fsscan();
    string s;
    cin>>s;
    int l=sz(s);
    for(int i=0;i<l;i++)
    {
        if(s[i]=='1')
        s[i]=57;
        else
        if(s[i]=='9')
        s[i]=49;
    }
    cout<<s;
    return 0;
}


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

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> p(N);
    for (int i=0; i<N; i++) {
        cin >> p.at(i);
    }
    sort(p.begin(),p.end());

    int yen = 0;
    for(int i=0; i<K; i++) {
        yen += p.at(i);
    }
    cout << yen << endl;
}

Measured memory_bytes: 3640
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

double n,m,d;
double p;

main(){
	cin>>n>>m>>d;
	if(d==0)p=1/n;
	else p=2.0*(n-d)/n/n;
	printf("%.10f",(m-1)*p);
	//dump((m-1)*p);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

ll po2(ll x){
  ll ret = 1;
  while(ret<=x){
    ret *= 2;
  }
  return ret;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  map<ll, ll> s;
  rep(i,n){
    ll x;cin >> x;
    s[x]++;
  }
  ll ans = 0;
  while(s.size()){
    auto it = --s.end();
    ll x = it->first;
    ll y = po2(x) - x;
    if(x==y){
      ans += (it->second)/2;
      s.erase(it);
    }else{
      if(y>x)break;
      auto itt = s.find(y);
      if(itt!=s.end()){
        ll nu = it->second;
        ll num = itt->second;;
        ll mn = min(nu,num);
        ans += mn;
        itt->second -= mn;
      }
      s.erase(it);
    }
    cerr << x << " " << ans << endl;
  }
  cout << ans << endl;
}



Measured memory_bytes: 12800
#include <iostream>

using namespace std;

int main(void)
{
  int num[4];
  int input;
  int op[8][3]={{1,1,1},{1,1,-1},{1,-1,1},{1,-1,-1},
		{-1,1,1},{-1,1,-1},{-1,-1,1},{-1,-1,-1}};
  int index=0;
  
  cin >> input;
  for(int i=0;i<4;i++){
    num[3-i]=input%10;
    input/=10;
  }
    
  for(int i=0;i<8;i++){
    int ans=num[0]+num[1]*op[i][0]+num[2]*op[i][1]+num[3]*op[i][2];
    if(ans==7)
      index=i;
  }

  cout << num[0] << ((op[index][0]==1) ? '+' : '-');
  cout << num[1] << ((op[index][1]==1) ? '+' : '-');
  cout << num[2] << ((op[index][2]==1) ? '+' : '-');
  cout << num[3] << "=7" << endl;

  return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
  [n, m, p] <- f
  solve n p <$> replicateM m readLn >>= print
  where
    f = map read <$> words <$> getLine

solve :: Int -> Int -> [Int] -> Int
solve n p ds = (* 100) $ loop (2 * n) sds
  where
    sds = sort (p : ds)
    cost l r = let cl = if l <= p then p - l else n - l + p
                   cr = if r >= p then r - p else n - p + r
               in if cl < cr then 2 * cl + cr else 2 * cr + cl
    loop mc (r:l:ls) = loop (min mc (cost l r)) (l:ls)
    loop mc [r] = min mc (cost (head sds) r)



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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

typedef struct {
    bool L, R;
} p_t;

class SegmentTree {
private:
    Int n;
    vector<Int> node;
    Int ident = 0;
    Int f(Int x, Int y) {
        return x | y;
    }
public:
    SegmentTree(vector<Int> v) {
        Int v_size = v.size();
        n = 1;
        while (n < v_size) {
            n *= 2;
        }
        node.resize(2 * n, ident);
        for (Int i = 0; i < v_size; i++) {
            node[n + i] = v[i];
        }
        for (Int i = n - 1; i >= 1; i--) {
            node[i] = f(node[i * 2], node[i * 2 + 1]);
        }
    }
    void update(Int x, Int val) {
        x += n;
        node[x] = val;
        while (x > 1) {
            x /= 2;
            node[x] = f(node[x * 2], node[x * 2 + 1]);
        }
    }
    // [a, b) での答え
    Int query(Int a, Int b, Int k = 1, Int l = 0, Int r = -1) {
        //cout << l << " " << r << endl;
        if (r < 0) {
            r = n;
        }
        if (r <= a or b <= l) {
            return ident;
        }
        if (a <= l and r <= b) {
            return node[k];
        }
        Int vl = query(a, b, 2 * k, l, (l + r) / 2);
        Int vr = query(a, b, 2 * k + 1, (l + r) / 2, r);
        return f(vl, vr);
    }
};

int main() {
    Int n, q;
    string s;
    cin >> n >> s >> q;
    vector<Int> v(n);
    for (Int i = 0; i < (Int)s.size(); i++) {
        v[i] = 1<<(s[i] - 'a');
    }
    SegmentTree seg(v);
    for (Int i = 0; i < q; i++) {
        Int com;
        cin >> com;
        if (com == 1) {
            Int index;
            char c;
            cin >> index >> c;
            index--;
            if (s[index] == c) continue;
            seg.update(index, 1<<(c - 'a'));
            s[index] = c;
        }
        else {
            Int bgn, end;
            cin >> bgn >> end;
            bgn--;
            end--;
            Int bit = seg.query(bgn, end + 1);
            Int res = 0;
            for (Int i = 0; i < 26; i++) {
                if (bit & (1<<i)) {
                    res++;
                }
            }
            dump(res);
        }
    }
    return 0;
}


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

using namespace std;

inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}

const int maxn = 100 + 50;

int H , W , N , a[maxn * maxn] , ans[maxn][maxn];

int main( int argc , char * argv[] ){
	scanf( "%d%d%d" , & H , & W , & N );
	for(int i = 1 ; i <= N ; ++ i) scanf( "%d" , a + i );
	for(int i = 1 , x = 1 , y = 1 , sgn = 0 ; i <= N ; ){
		if( y == 0 )
			++ x , y = 1 , sgn ^= 1;
		else if( y == W + 1 )
			++ x , y = W , sgn ^= 1;
		ans[x][y] = i;
		if( -- a[i] == 0 ) ++ i;
		if( sgn == 0 ) ++ y;
		else -- y;
	}
	for(int i = 1 ; i <= H ; ++ i){
		for(int j = 1 ; j <= W ; ++ j){
			if( j > 1 ) putchar( 32 );
			printf( "%d" , ans[i][j] );
		}
		puts( "" );
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
  int x,E;
  while(cin >> E && E > 0){
    int xyz = 1000000;
    for(int z=100;z>=0;z--){
      for(int y=1000;y>=0;y--){
        x = E - y*y - z*z*z;
        if((x>=0) && (x+y+z < xyz)){
          xyz = x+y+z;
        }//
      }//fory
    }//forz
    cout << xyz << endl;
  }//whileE>0
}

Measured memory_bytes: 1160
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N, T, A;
	cin >> N >> T >> A;
	double sa = 1e7, H;
	int num = 1;
	rep(i, N) {
		cin >> H;
		if (sa > abs(A - (T - H * 0.006))) {
			num = i + 1;
			sa = abs(A - (T - H * 0.006));
		}
	}
	cout << num;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
typedef long long ll;

int INF = 1000000005;
using namespace std;

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    cout <<  (x - z) / (y + z) << endl;

    

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
typedef long long LL;
const int maxn=1e5+10;
const int mod=1e9+7;
LL H,W,a,b;
LL s[2*maxn+10],inv[2*maxn+10];

inline LL qpow(LL a,LL b) {
    LL res=1;
    while (b) {
        if (b&1) res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res%mod;
}

void _init() {
    s[0]=s[1]=1;
    for (int i=2;i<=2*maxn;i++)
        s[i]=s[i-1]*i%mod;

    inv[0]=1; inv[2*maxn]=qpow(s[2*maxn],mod-2);
    for (int i=2*maxn-1;i>=1;i--) inv[i]=inv[i+1]*(i+1)%mod;
}

LL C(LL m,LL n) {
    return s[m]*inv[n]%mod*inv[m-n]%mod;
}

int main() {
    _init();
    scanf("%lld%lld%lld%lld",&H,&W,&a,&b);
    LL ans=0;
    for (int i=b+1;i<=W;i++)
        ans=(ans+C(H-a+i-2,H-a-1)*C(W+a-i-1,a-1)%mod)%mod;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3328
from itertools import product

N,M = map(int,input().split())

ks = []
for i in range(M):
    ks.append(list(map(int, input().split())))
    
p = list(map(int, input().split()))
    
ans = 0
for comp in product(range(2), repeat=N):
    onoff = [0]*M
    for li in range(M):
        s_on = 0
        for si in range(ks[li][0]):
            s_on += comp[ks[li][si+1]-1]
        
        if s_on%2 == p[li]:
            onoff[li] = 1
    if sum(onoff) == M:
        ans += 1
        
print(ans)

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int result = -A+B+C; // 計算上容器2に残る水の量
  if (result >= 0) {
    cout << result << endl;
  }
  else {
    cout << 0 << endl;
  }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a0, L;
    while (cin >> a0 >> L, a0 || L) {
        map<ll, ll> m;
        ll a = a0, times = 0;
        while (m.count(a) == 0) {
            m[a] = times;
            string stra = to_string(a);
            while (stra.size() < L) stra = "0" + stra;
            string ma = stra, Ma = stra;
            sort(all(ma));
            sort(all(Ma), greater<char>());
            a = stoll(Ma) - stoll(ma);
            ++times;
        }
        cout << m[a] << " " << a << " " << times-m[a] << endl;
    }
}

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

using namespace std;


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

	double ans = 0.0;

	for (int i = 0; i < N; i++)
	{
		double x = 0;
		string u;

		cin >> x >> u;
		if(u == "JPY"){
			ans += x;
		}
		if(u == "BTC"){
			ans += x * 380000.0;
		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    bool check = true;
    loop(i, n) if (s[i] != t[i]) check = false;
    if (check)
        putout("Yes");
    else
        putout("No");
    return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <map>
#include <vector>
#include <string>

//#define _USE_MATH_DEFINES
//#include<math.h>

using namespace std;

constexpr int M = 1e4;
int main()
{
	
	int n, m;
	int a[M];
	cin >> n >> m;

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

	if (day < 0)
		day = -1;

	cout << day << endl;

	return 0;
}

Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000000007

int main() {
	int N;
	cin >> N;
	vector<ll> A(N), B(N), C(N);
	for (ll i = 0;i < N;i++) {
		cin >> A[i];
		B[i] = A[i] + i;
		C[i] = A[i] - i;
	}
	sort(all(C));

	ll cnt, ans = 0, nb = B[0], nc = C[0];
	for (int i = 0;i < N;i++) {
		auto it1 = lower_bound(all(C), -B[i]);
		auto it2 = upper_bound(all(C), -B[i]);
		cnt = it2 - it1;
		ans += cnt;
	}
	cout << ans << endl;
}

Measured memory_bytes: 8012
#include <stdio.h>
const int MAX_V = 1000000;
int prime[1000001];
int main() {
	int i, k, n;
	for(i = 2; i <= MAX_V; i++) {
		prime[i] = 1;
	}
	for(i = 2; i*i <= MAX_V; i++) {
		if(prime[i]) {
			for(k = 2 * i; k <= MAX_V; k += i) {
				prime[k] = 0;
			}
		}
	}
	for(i = 3; i <= MAX_V; i++){
		prime[i] = prime[i] + prime[i-1];
	}
	while(scanf("%d", &n) != EOF) {
		printf("%d\n", prime[n]);
	}
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int ans = 0;
	int s = 0;
	for(int i=0;i<n;i++) {
		int x;
		cin >> x;
		ans += x*s;
		s += x;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseFloat(x) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    res=trunc(Int,ceil(n/1.08))
    if trunc(Int,floor(res*1.08))==n
        println(res)
    else
        println(":(")
    end
end
main()

Measured memory_bytes: 111480
#include<stdio.h>

int main(){
    int mountain[10];
    int i,j,k,l;
    for(i = 0; i < 10; i++){
        scanf("%d",&mountain[i]);
    }
    for(k = 0; k < 3; k++){
        for(j = i; j >= k; j--){
            if(mountain[j+1] > mountain[j]){
                l = mountain[j];
                mountain[j] = mountain[j+1];
                mountain[j+1] = l;
            }
        }
    }
    for(k = 0; k < 3; k++){
        printf("%d\n",mountain[k]);
    }
    return 0;
}

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


class Program
{
    static void Main(string[] args)
    {
        string S = Console.ReadLine();
        string answer = "yes";
        for (int i = 0; i < S.Length; i++)
        {
            for (int g = 0; g < S.Length; g++)
            {
                if (i == g) break;
                if (S[i] == S[g]) { answer = "no"; }
            }
        }
        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 2147483647//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n,m;
    cin >> n >> m;
    vector<P> data(m,P(m,0));
    rep(i,m)cin >> data.at(i).first >> data.at(i).second;
    int ans = -1;
    while(ans < 1000){
        ans ++;
        string s = to_string(ans);
        if(n != s.length())continue;
        else{
            bool can=true;
            rep(i,m){
                if(data.at(i).second != s.at(data.at(i).first -1)-'0'){
                    can = false;
                    break;
                }
            }
            if(can){
                cout << ans << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll ans,maxn;
int main()
{
    long long x;
    ll div;
    cin>>x;
    maxn=sqrt(x);
    for(ll i=1;i<=maxn;i++)
    {
        if((x-i)%i==0){div=(x-i)/i;
        if(div>i)ans+=div;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ul N,i;
vector<ul> A,B;
const ul MOD=(ul)1e9+7;

ul fact(ul N){
  ul res=1;
  REP(i,N/2){
    res*=2;
    res%=MOD;
  }
  return res;
}

inline void solve(){
  IN(N);
  A.resize(N);
  INS(i,N,A);
  if(N&1){
    B.pb(0);
    for(i=2;i<N;i+=2){
      B.pb(i);
      B.pb(i);
    }
  }else{
    for(i=1;i<N;i+=2){
      B.pb(i);
      B.pb(i);
    }
  }
  sort(ALL(A));
  sort(ALL(B));
  if(A!=B){
    OUT(0);
  }else{
    // OUT((1<<(N/2))%MOD);
    OUT(fact(N));
  }

}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

using namespace std;

int main()
{
	int n,a,b;
	int ans = 0;
	int count;
	cin >> n >> a >> b;
	for (int i = 0; i <= n; i++)
	{
		count = 0;
		for(int j = i; j > 0; j /= 10)
		{
			count += j % 10;
		}
		if(a <= count && count <= b)
		{
			ans += i;
		}		
	}

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

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n+1];
    int count = 0;
    for(int i=1;i<n+1;i++){
        cin >> a[i];
        if(a[i]==i) continue;
        else count += 1;
    }
    if(count<=2) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include"iostream"
#include"algorithm"
using namespace std;
 
long long gcd(long a,long b)
{
	long long tmp,r;
	if (a < b)
	{
		tmp = a;
		a = b;
		b = tmp;
	}
	r = a % b;
	while (r != 0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
 
int main()
{
	long long n, x;
	cin >> n >> x;
	long long a[100100], b[100100];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		a[i] = abs(a[i] - x);
	}
	b[0] = a[0];
	for (int i = 1; i < n; i++)b[i] = gcd(b[i - 1], a[i]);
	cout << b[n - 1] << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip> 
#include <string> 
#include <math.h>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a < b)
		cout << "a < b\n";
	else
		if (a > b)
			cout << "a > b\n";
		else
			cout << "a == b\n";
}

Measured memory_bytes: 1124
/*  -*- coding: utf-8 -*-
 *
 * 2845.cc: Star in Parentheses
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;

/* typedef */

/* global variables */

char s[MAX_N + 4];

/* subroutines */

/* main */

int main() {
  scanf("%s", s);

  int cnt = 0;
  for (char *cpt = s; *cpt != '*'; cpt++) {
    if (*cpt == '(') cnt++;
    else cnt--;
  }

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



Measured memory_bytes: 3212
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
in n;
VVI egs;
VI vis;
void sch(in u, VI& e){
  vis[u]=1;
  e.PB(u);
  forv(i,egs[u]){
    if(vis[egs[u][i]])
      continue;
    sch(egs[u][i],e);
    return;
  }
}
VI e1,e2;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin>>n;
  egs.resize(n+1);
  in ta,tb;
  in m;
  cin>>m;
  forn(z,m){
    cin>>ta>>tb;
    egs[ta].PB(tb);
    egs[tb].PB(ta);
  }
  vis.resize(n+1);
  vis[ta]=vis[tb]=1;
  sch(ta,e1);
  sch(tb,e2);
  reverse(all(e1));
  cout<<sz(e1)+sz(e2)<<"\n";
  forv(i,e1)
    cout<<e1[i]<<" ";
  forv(i,e2)
    cout<<e2[i]<<" ";
  cout<<"\n";
  return 0;
}


Measured memory_bytes: 10484
<?php
  list($n, $m) = explode(" ", trim(fgets(STDIN)));

  $x = [];
  for ($i=0; $i<$m; $i++) {
    list($a, $b) = explode(" ", trim(fgets(STDIN)));
    if(!isset($x[$a])) $x[$a] = [];
    if(!isset($x[$b])) $x[$b] = [];
    $x[$a][$b] = true;
    $x[$b][$a] = true;
  }

  echo dfs($x, [], 1, $n);

  function dfs($x, $root, $now, $n){
    if(isset($root[$now])){
      return 0;
    }
    if(count($root) == $n-1){
      return 1;
    }else{
      $root[$now] = true; 
    }
    $p = $x[$now];
    $ret = 0;
    foreach($p as $q => $v){
      $ret += dfs($x, $root, $q, $n);
    }
    return $ret;
  }

Measured memory_bytes: 16012
import java.util.Scanner;

class Main{
	public static void main(String[] aegs) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
			double xa=sc.nextDouble();
			double ya=sc.nextDouble();
			double xb=sc.nextDouble();
			double yb=sc.nextDouble();
			double xc=sc.nextDouble();
			double yc=sc.nextDouble();
			double xd=sc.nextDouble();
			double yd=sc.nextDouble();

			double x1=xb-xa;
			double y1=yb-ya;
			double x2=xd-xc;
			double y2=yd-yc;

			double a=x1*x2;
			double b=y1*y2;

			if((float)a+(float)b==0) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}
		}
	}
}


Measured memory_bytes: 30204
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

#define VECIN(t,c,num) vector<t> c(num);REP(i,num){c[i]=in<t>();}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	vector<pair<int,int>> R(N),B(N);
	REP(i,N){
		R[i].first=in();
		R[i].second=in();
	}
	REP(i,N){
		B[i].first=in();
		B[i].second=in();
	}

	sort(ALL(R),PAIRCOMP(first,<));
	sort(ALL(B),PAIRCOMP(first,<));

	int matchX = 0;
	for(auto iB=B.begin();iB!=B.end();){
		bool find = false;
		int maxY=-1;
		auto fR = R.end();
		for(auto iR=R.begin();iR!=R.end();iR++){
			if(iR->first<iB->first && iR->second<iB->second && iR->second>maxY){
				maxY = iR->second;
				fR = iR;
				find = true;
			}
		}
		if(find){
			R.erase(fR);
			iB = B.erase(iB);
			matchX++;
		}
		else iB++;
	}

	
	out(matchX);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
int num;
char s[4];
  scanf("%s",s);
  num=strlen(s);
  if(num==2){printf("%s",s);}
  else {printf("%c",s[2]);
       printf("%c",s[1]);
       printf("%c",s[0]);
       }
return 0;

}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define int long long

signed main() {
	int n;
	cin >> n;
	vector<int> h(n);
	for (size_t i = 0; i < n; i++)
	{
		cin >> h[i];
	}
	int ans = 0;
	int mx = 0;
	for (size_t i = 0; i < n; i++)
	{
		if (mx <= h[i]) {
			mx = h[i];
			ans++;
		}
	}

	cout << ans << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <functional>
using namespace std;

int main() {


	string S;
	cin >> S;

	int sum = 0;

	for (int i = 0; i < 4; i++){
		//cout << S.substr(i, 1) << endl;
		if (S.substr(i, 1) == "+"){
			sum++;
		}
		else{
			sum--;
		}
	}
	cout << sum << endl;



	return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]

fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn read_vec() -> Vec<i32> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().unwrap())
        .collect()
}

fn main() {
    let N: usize = read_line().parse().unwrap();
    let mut A = read_vec();
    let mut B = read_vec();
    let mut ans: i64 = 0;
    for i in 0..N {
        if A[i] <= B[i] {
            ans += A[i] as i64;
            B[i] -= A[i];
            A[i] = 0;
        } else {
            ans += B[i] as i64;
            A[i] -= B[i];
            B[i] = 0;
        }
        if A[i+1] <= B[i] {
            ans += A[i+1] as i64;
            B[i] -= A[i+1];
            A[i+1] = 0;
        } else {
            ans += B[i] as i64;
            A[i+1] -= B[i];
            B[i] = 0;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 8444
s = input()
t = input()

n = len(s)
m = len(t)
ans = 1e9+7
if n == m:
    ans = 0
    for j in range(n):
        if s[j] != t[j]:
            ans += 1
else:
    for i in range(n-m):
        cnt = 0
        for j in range(i,i+m):
            if s[j] != t[j-i]:
                cnt += 1
        ans = min(ans,cnt)
print(ans)

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

int main() {
	string s;
	int q;
	cin >> q;
	for(int i = 0; i < q + 1; ++i){
		getline(cin, s);
		string t = s;
		for(int x = 1; x <= 26; ++x){
			for(int y = 1; y <= 26; ++y){
				if(t.find("that") != string::npos || t.find("this") != string::npos){
					cout << t << endl;
					goto end;
				}
				else{
					for(int j = 0; j < s.size(); ++j){
						if('a' <= s[j] && s[j] <= 'z')
							t[j] = ((((s[j] - 'a') * x + y)) % 26) + 'a';
					}
				}
			}
		}
		end:;
	}
	return 0;
}

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

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  int ma = 0;
  rep(i,n) {
    if (i != n-1) {
      ma = max(ma, abs(a[i] - a[i+1]));
    } else {
      ma = max(ma, abs(k-a[i] + a[0]));
    }
  }

  int total_d = 0;
  rep(i,n) {
    if (i != n-1) {
      total_d += a[i+1] - a[i];
    } else {
      total_d += k-a[i] + a[0];
    }
  }
  cout << total_d-ma << endl;

  return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    string a, b; cin>>a>>b;

    int an = stoi(a), bn = stoi(b);

    string ansb = "", ansa = "";
    for(int i=0; i<an; i++) ansb += b;
    for(int i=0; i<bn; i++) ansa += a;

    cout << (ansa < ansb ? ansa : ansb) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
using ll = long long;

map<int, int> prime_factor(int n)
{
	map<int, int> res;
	for (int i = 2; i * i <= n; i++)
	{
		while (n % i == 0)
		{
			res[i]++;
			n /= i;
		}
	}
	if (n != 1)
		res[n]++; //nは素数
	return res;
}

int main()
{
	int n;
	cin >> n;
	map<int, int> mp;
	for (int i = 1; i <= n; i++)
	{
		map<int, int> p = prime_factor(i);
		for (int j = 1; j <= i; j++)
		{
			mp[j] += p[j];
		}
	}
	int ans = 0;
	//p^74
	for (int i = 1; i <= n; i++)
	{
		if (mp[i] >= 74)
			ans++;
	}
	//p^24*q^2
	int a24 = 0, a2 = 0;
	for (int i = 1; i <= n; i++)
	{
		if (mp[i] >= 24)
			a24++;
		if (mp[i] >= 2)
			a2++;
	}
	ans += a24 * (a2 - 1);
	//p^14*q^4
	int b14 = 0, b4 = 0;
	for (int i = 1; i <= n; i++)
	{
		if (mp[i] >= 14)
			b14++;
		if (mp[i] >= 4)
			b4++;
	}
	ans += b14 * (b4 - 1);
	//p^4*q^4*r^2
	int c4 = 0, c2 = 0;
	for (int i = 1; i <= n; i++)
	{
		if (mp[i] >= 4)
			c4++;
		if (mp[i] >= 2)
			c2++;
	}
	ans += c4 * (c4 - 1) * (c2 - 2) / 2;
	cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())

total = 0
for i in range(1, N+1):
    if i % 3 == 0 and i % 5 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        total += i

print(str(total))

Measured memory_bytes: 9116
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int MOD = 1e9 + 7;
int dp[301][301][301];

void add(int &a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
}

int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m; cin>>n>>m;
	dp[0][1][0]=1;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<=n;j++)
		{
			for(int k=0;j+k<=n;k++)
			{
				int v=dp[i][j][k];
				if(v!=0)
				{
					add(dp[i+1][j+k][0],mult(j,v));
					add(dp[i+1][j][k],mult(k,v));
					if(n-j-k>0) add(dp[i+1][j][k+1],mult(n-j-k,v));
				}
			}
		}
	}
	cout<<dp[m][n][0]<<'\n';
}


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

char maze[50][51];
int N, M; 
int sx, sy;
int gx, gy;
int d[50][51];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int bfs(){
    queue<P> que;
    rep(i, N) rep(j, M) d[i][j] = INF;
    que.push(P(sx, sy)); 
    d[sx][sy] = 0;
    while(que.size()){
        P p = que.front(); que.pop();
        if(p.first == gx && p.second == gy) break;
        rep(i, 4){
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if (0 <= nx && nx < N && 0 <= ny && ny < M && maze[nx][ny] != '#' && d[nx][ny] == INF){
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[gx][gy];
}

int main() {
    cin>>N>>M;
    int black=0;
    rep(i,N) rep(j,M){
        cin>>maze[i][j];
        if(maze[i][j]=='#') black++;
        } 
         sx = 0, sy = 0;
         gx = N-1, gy = M-1;
    
    int res = bfs();
    if(res==INF) cout<<-1<<endl;
    else cout<<N*M-black-res-1<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define re register
using namespace std;
string a,b;
int main() 
{
	getline(cin,a);
	b=a;
	reverse(a.begin(),a.end());
	for ( re int i=0;i<a.length();i++ ) 
	{
		if(a[i]=='b') a[i]='d';
		else if(a[i]=='d') a[i]='b';
		else if(a[i]=='p') a[i]='q';
		else if(a[i]=='q') a[i]='p';
	}
	if(a==b) return printf("Yes\n"),0;
	else printf("No\n"),0;
	return 0;
}
		

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

int H, W;
string s;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> H >> W;
    string sh(W+2, '#');
    cout << sh << endl;
    for(int i=0; i<H; i++){
        cin >> s;
        cout << '#' + s + '#' << endl;
    }
    cout << sh << endl;
}


Measured memory_bytes: 256