akhauriyash/Code-Regression huggingface dataset:
// use std::cmp;
// use std::collections::HashMap;
// use std::collections::HashSet;
// use std::collections::VecDeque;
use std::collections::BTreeMap;


// const INF: i64 = 1_000_000_000;

const MOD: i64 = 1_000_000_009;


fn invmod(a: i64, p: i64) -> i64 {
    if a == 1 {
        return 1;
    } else {
        return (1 - p*invmod(p%a, a)) / a + p;
    }
}


fn eat(ch: char, tape: &mut Vec<i64>, pos: &mut Vec<i64>, X: &Vec<i64>, Xinv: &Vec<i64>) {
    match ch {
        '+' => {
            for i in 0..4 {
                tape[i] += pos[i];
                tape[i] %= MOD;
            }
        }
        '-' => {
            for i in 0..4 {
                tape[i] -= pos[i];
                tape[i] += MOD;
                tape[i] %= MOD;
            }
        }
        '>' => {
            for i in 0..4 {
                pos[i] *= X[i];
                pos[i] %= MOD;
            }
        }
        '<' => {
            for i in 0..4 {
                pos[i] *= Xinv[i];
                pos[i] %= MOD;
            }
        }
        _ => panic!()
    }
}



fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let X: Vec<i64> = vec![31, 41, 592, 653];
    let mut Xinv: Vec<i64> = vec![];
    for i in 0..4 {
        Xinv.push(invmod(X[i], MOD));
    }
    let Xinv = Xinv;
    //println!("{:?}, {:?}", X, Xinv);

    let n: usize = sc.read();
    let s: String = sc.read();
    let s = s.chars().collect::<Vec<_>>();
    //println!("{}, {:?}", n, s);
    let mut tape = vec![0, 0, 0, 0];
    let mut pos = vec![1, 1, 1, 1];
    for &ch in s.iter() {
        eat(ch, &mut tape, &mut pos, &X, &Xinv);
    }
    let target = tape;
    //println!("{:?}", target);
    let mut goals = BTreeMap::new();
    let mut tape = vec![0, 0, 0, 0];
    let mut pos = vec![1, 1, 1, 1];
    let mut ans: i64 = 0;
    for &ch in s.iter() {
        {
            let mut goal: Vec<i64> = vec![];
            for i in 0..4 {
                goal.push((tape[i] + pos[i] * target[i]) % MOD);
            }
            let cnt = goals.remove(&goal).unwrap_or(0);
            goals.insert(goal, cnt+1);
        }
        eat(ch, &mut tape, &mut pos, &X, &Xinv);
        ans += *(goals.get(&tape).unwrap_or(&0));
        //println!("{:?}", goals);
    }
    println!("{}", ans);
}

// thanks, ir5
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


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

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

int stepen(int a, int k)
{
    if(k == 0) return 1;
    int r = stepen(a, k / 2);
    r *= r;
    if(k % 2 == 1) r *= a;
    return r;
}

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

    int m, k;
    cin >> m >> k;
    int B = stepen(2, m) - 1;
    if(k > B || (k ==1 && m == 1))
    {
        cout << -1;
        return 0;
    }
    if(k == 0 && m == 1) {cout << "1 1 0 0"; return 0;}

    for(int i = 0; i <= B; i++)
    {
        if(i == k) continue;
        cout << i << " ";
    }
    cout << k << " ";
    for(int i = B; i >= 0; i--)
    {
        if(i == k) continue;
        cout << i << " ";
    }
    cout << k << " ";

    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String input = sc.nextLine();
		if ("A".equals(input)) {
			System.out.println("T");
		} else if ("G".equals(input)) {
			System.out.println("C");
		} else if ("T".equals(input)) {
			System.out.println("A");
		} else {
			System.out.println("G");
		}
	}
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------
int V, E ;
vector<vector<int>> graph ;
vector<int> seen ;

void dfs_graph(int x){
    seen[x] = 1 ;
    for(int i=0;i<graph[x].size();i++){
        if(seen[graph[x][i]]==0){
            dfs_graph(graph[x][i]) ;
        }
    }
    return ;
}
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> V >> E ;
    vector<pii> pai(E) ;


    vector<int> zero(V,0) ;
    seen = zero ;
    int cnt = 0 ;
    int ans = 0 ;

    for(int i=0;i<V;i++){
        graph.push_back(vector<int>()) ;
    }

    REP(i,E){
        int a, b ;
        cin >> a >> b ;
        pai[i] = MP(a-1,b-1) ;
    }

    REP(i,E){
        cnt = 0 ;
        for(int i=0;i<V;i++){
            graph.push_back(vector<int>()) ;
        }
        seen = zero ;
        REP(j,E){
            if(i!=j){
                graph[pai[j].FI].PB(pai[j].SE) ;
                graph[pai[j].SE].PB(pai[j].FI) ;
            }
        }
        for(int k=0;k<V;k++){
            if(seen[k]==0){
                dfs_graph(k) ;
                cnt++ ;
            }
        }
        if(cnt>=2){
            ans++ ;
        }
        graph.clear() ;
    }

    cout << ans <<endl ;


    

    return 0;
}


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

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

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

    int min = a[0], max = a[0];
    for(int i=1; i<n; i++){
        if(min>a[i]) min = a[i];
        if(max<a[i]) max = a[i];
    }

    cout << max-min << endl;

    return 0;


}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

double a,b,x,tate,yoko;
const double PI=3.14159265358979323846;

int main(){
    cin>>a>>b>>x;
    if(x>=(a*a*b/2)){
        double amari = a*a*b - x;
        tate = 2 * amari /(a*a);
        yoko = a;     
    }
    else{
        tate = b;
        yoko = 2 * x / (b*a);
    }
    printf("%.12f\n",atan(tate/yoko)*180.0/PI);
    

}


Measured memory_bytes: 256
n, m = map(int, input().split())
sc = [input().split() for _ in range(m)]
for i in range(10**(n - 1) if n > 1 else 0, 10**n):
    a = str(i)
    for s, c in sc:
        if a[int(s) - 1] != c:
            break
    else:
        print(i)
        break
else:
    print(-1)

Measured memory_bytes: 3060
N,M=[int(x) for x in input().split()]
result=list(range(1,M+1))
for i in range(N):
    I=input().split()
    K=int(I[0])
    As=[int(x) for x in I[1:]]
    result=list(set(As)&set(result))
print(len(result))


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n, k;
	scanf("%lld%lld", &n, &k);
	if (k % 2 == 1)
	{
		long long  tmp = n / k;
		long long res = tmp * tmp * tmp;
		cout << res << endl;
	}
	else
	{
		long long tmp, tmq;
		tmq=tmp = n / k;
		tmq = tmp + ((k / 2 <= n % k) ? 1 : 0);
		long long res = tmp * tmp * tmp + tmq * tmq * tmq;
		cout << res << endl;
	}
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}"<<endl;
  return o;
}

//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m; 
  if (u < 0) u += m;
  return u;
}
ll const mod = 1e9+7;

// combination
const int MAX = 510000;
const ll MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int N,a;
  cin >> N;
  int cnt=0;
  rep(i,N) {
    cin >> a;
    if (i%2==0&&a%2==1) cnt++;
  }
  cout << cnt  << endl;

}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
using namespace std;
typedef long long ll;

vector<pair<int, int>> to[100010];
bool visited[100010];
ll dist[100010];
int main() {
    int n,m,k;
    cin>>n>>m>>k;
    vector<ll>a(n);
    vector<ll>b(m);
    rep(i,0,n)cin>>a[i];
     ll t = 0;
    rep(i,0,m){
        cin>>b[i];
        t+=b[i];
    }
    int j = m;
    int ans = 0;
    rep(i,0,n+1){
        while( j>0 && t>k){
            j--;
            t-=b[j];
        }
        if(t>k)break;
        t+=a[i];
        ans = max(ans, i+j);
        if(i==n)break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8788
mod = 10 ** 9 + 7
H, W = map(int, input().split())
S = []
for i in range(H):
  S.append(input())
dp = [[0 for j in range(W)] for i in range(H)]
dp[0][0] = 1
for i in range(H):
  for j in range(W):
    if i == 0:
      if j == 0:
        continue
      else:
        if S[i][j] == ".":
          dp[i][j] = dp[i][j-1]
    else:
      if S[i][j] == ".":
        if j == 0:
          dp[i][j] = dp[i-1][j]
        else:
          dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod
print(dp[H-1][W-1])

Measured memory_bytes: 77716
import sys
input = lambda: sys.stdin.readline().rstrip() 
import bisect as bs

def resolve():
    n = int(input())
    ukv = [list(map(int, input().split())) for _ in range(n)]

    d = [-1]*n
    f = [-1]*n
    stk = []
    status = [0]*n

    t = 1
    for i in range(n):
        if status[i]==0:
            stk.append(i)
            while len(stk)>0:
                a = stk[-1]
                if status[a]==0:
                    d[a] = t
                    t += 1
                    status[a] = 1
                elif status[a]==1:
                    stk.pop()
                    f[a] = t
                    t += 1
                    status[a] = 2
                else:
                    stk.pop()
                for i in reversed(ukv[a][2:]):
                    if status[i-1]==0:
                        stk.append(i-1) 

    for i in range(n):
        print(i+1, d[i], f[i])

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 5680
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B;
  cin >> A >> B;
  
  
  int Ami;// = A / 0.08;
  if(A % 2 == 0){
    Ami = A * 25 / 2;
  }
  else{
    Ami = 1 + (A * 25 / 2);
  }
  int Ama = (A+1) / 0.08;
  
  int Bmi = B * 10;
  int Bma = (B+1) * 10;
/*  
  cout << Ami << " " << Ama << endl;
  cout << Bmi << " " << Bma << endl;
*/  
  if(Ami > Bmi){
    if(Ami < Bma){
      cout << Ami << endl;
    }
    else{
      cout << -1 << endl;
    }
  }
  else if(Ama > Bmi){
    cout << Bmi << endl;
  }
  else{
    cout << -1 << endl;
  }

}

Measured memory_bytes: 256
#define ONLINE_JUDGE
#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
#include <cmath>
#include <iterator>
#include <map>
#include <set>
#include <numeric>
#ifndef ONLINE_JUDGE
#include <prettyprint/prettyprint.hpp>
#endif

#define FOR(i, n) for(int i = 0; i < n; ++i)
#define TEST int T; std::cin >> T; while(T--)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vll = std::vector<ll>;
using vull = std::vector<ull>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

using namespace std;

const int mod = 1e9 + 7;

void add_self(int& a, int b) {
	a += b;
	if(a >= mod) a -= mod;
}

void mul_self(int& a, int b) {
	a = ((ll)a * b) % mod;
}

// Matrix multiplication.
struct M {
	int n;
	vector<int> mat;
	M(int _n) : n(_n) {
		mat.assign(n * n, 0);
	}
	void eye() {
		fill(mat.begin(), mat.end(), 0);
		for(int i = 0; i < n; ++i) get(i, i) = 1;
	}
	int get(int i, int j) const {
		return mat[i * n + j];
	}
	int& get(int i, int j) {
		return mat[i * n + j];
	}
	M operator* (const M& rhs) {
		M res(n);
		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < n; ++j) {
				for(int k = 0; k < n; ++k) {
					int a = get(i, k);
					mul_self(a, rhs.get(k, j));
					add_self(res.get(i, j), a);
				}
			}
		}
		return res;
	}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	ifstream fin("in.txt");
	ofstream fout("out.txt");
	auto cinbuf = cin.rdbuf(fin.rdbuf());    // save and redirect
	auto coutbuf = cout.rdbuf(fout.rdbuf()); // save and redirect
#endif	
	int n; ull k;
	cin >> n >> k;
	M adj(n);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			cin >> adj.get(i, j);
		}
	}
	// binexp!
	M ans(n);
	ans.eye();
	M cur = adj;
	while(k) {
		if(k % 2) {
			ans =  ans * cur;
		}
		cur = cur * cur;
		k /= 2;
	}

	int ways = 0;
	for(int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			add_self(ways, ans.get(i, j));
		}
	}
	cout << ways << endl;
#ifndef ONLINE_JUDGE
	cin.rdbuf(cinbuf);    // restore
	cout.rdbuf(coutbuf); // restore
#endif	
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
using namespace std;


int n, m;
const int maxn = 100000 + 10;
long long a[maxn], sum;

struct Node
{
    long long b, c;
}node[maxn];

bool operator < (Node a, Node b)
{
    return a.c > b.c;
}

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    sort(a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++)
    {
        cin >> node[i].b >> node[i].c;
    }
    sort(node + 1, node + m + 1);
    /* for (int i = 1; i <= m; i++)
    {
        for (int j = 1; j <= node[i].b; j++)
        {
            if ()
        }
    } */
    int p = 1;
    for (int i = 1; i <= n; i++)
    {
        if (node[p].c <= a[i] || p > m)
        {
            break;
        }
        if (node[p].b == 0)
        {
            ++p;
            --i;
            continue;
        }
        node[p].b--;
        sum += node[p].c - a[i];
    }
    cout << sum;
    getchar(); getchar();
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
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; }
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
const ll mod=1e9+7;
ll sisuu(ll x,ll y){
  ll ans=1;
  rep(i,y){
    ans=ans*x%mod;
  }
  return ans;
}

int main()
{
  ll N;
  cin >> N;
  ll ans=0;

  ans=sisuu(10,N)-(sisuu(9,N)*2)+sisuu(8,N);
  ans%=mod;
  ans=(ans+mod)%mod;
  cout <<ans<<endl;
}


Measured memory_bytes: 3484
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for C - Colorful Leaderboard
	var N int
	fmt.Scanf("%d", &N)

	color := make(map[int]int, 9)
	var a int
	var flag int = 0
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &a)

		flag = 0
		for j := 0; j < 8; j++ {
			if 400*j <= a && a < 400*(j+1) {
				color[j]++
				flag = 1
			}
		}

		if flag == 0 {
			color[8]++
		}
	}

	var count int
	for i := 0; i < 8; i++ {
		if color[i] > 0 {
			count++
		}
	}

	var min, max int
	min = int(math.Max(float64(count), 1))
	max = count + color[8]

	fmt.Println(min, max)
}


Measured memory_bytes: 1840
import itertools


n,d=map(int, input().split())
s = []
for i in range(n):
    s.append(list(map(int, input().split())))

result = []
tmp = 0

for i in itertools.combinations(s, 2):
    tmp = [(x - y)**2 for (x, y) in zip(i[0], i[1])]
    tmp = sum(tmp)
    result.append(tmp)

result2 = []
for i in result:
    tmp = int(i ** 0.5)
    if abs(tmp*tmp - i) < 1e-6:
        result2.append(tmp)

print(len(result2))




Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define int long long
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define fish        push_front
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Deque       std::deque
#define PQueue      std::priority_queue
#define Set         std::set
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B, class C> A power ( A x, B n, C mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A> A lcm ( A x, A y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A> inline boolean chmax ( A &a, const A &b ) { return b > a ? a = b, true : false; }
    template<class A> inline boolean chmin ( A &a, const A &b ) { return b < a ? a = b, true : false; }
    inline boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    Vi vi;
    llong ans = LINF;

    signed call_of_Cthulhu( signed datum ) {

        int n, k;
        read n >> k;
        for ( int i = 0; i < n; i++ ) {
            int a;
            read a;
            vi.bash(a);
        }
        bozo_sort(alles(vi));
        for ( int i = 0; i < n-k+1; i++ ) {
            chmin(ans, abs(vi[i]) + abs(vi[i]-vi[i+k-1]));
            chmin(ans, abs(vi[i+k-1]) + abs(vi[i]-vi[i+k-1]));
        }
        echo ans fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


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

using namespace std;

int k, x(0);

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> k;
    for (int i = 1; i <= 1000000; i++) {
        x = (x * 10 + 7) % k;
        if (x == 0) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i=0; i<(n);++i)
#define rep2(i,n,m) for(long long int i=n;i<=m;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
 ll x ;
 cin>> x ;
  int ans=0 ;
 rep2(a,1,200){
   if(ans==-1)
   break ;
    for(ll b=a-1;b>-200;b--){
        if((a*a*a*a*a-b*b*b*b*b)==x){
        
    
cout <<a<<" "<<b<<endl ; 
 ans=-1 ;
 break ;
 }
 
 }
 }
 
    return 0;
}

Measured memory_bytes: 3632
// ACLBC-D.cpp

#include <iostream>
#include <vector>
#include <atcoder/segtree> // セグメントツリーを使う
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;

const int MAX_A = 300005;

int f(int a,int b) {
    return max(a, b);
}
int e() {
    return 0;
}
int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n)cin >> a[i];

    segtree<int, f, e> dp(MAX_A);
    rep(i, n) {
        int x = a[i];
        int l = x - k;
        int r = x + k + 1;
        l = max(l, 0);
        r = min(r, MAX_A);
        int now = dp.prod(l,r)+1;
        dp.set(x,now);
    }
    int ans = dp.prod(0, MAX_A);
    cout << ans << endl;
}


Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
int main(){
	string x;
	int ac,wa,re,tel,n;
	ac=wa=re=tel=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		if(x=="AC") ac++;
		if(x=="RE") re++;
		if(x=="WA") wa++;
		if(x=="TLE") tel++;
		x="";
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tel<<endl;
	cout<<"RE x "<<re<<endl;
	return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n; cin>>n;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    sort(btoe(p));
    int res=p[0];
    rep(i,n-2){
        if(abs(p[i+1]*2-p[n-1])<abs(res*2-p[n-1])){
            res=p[i+1];
        }
    }
    cout<<p[n-1]<<" "<<res<<endl;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
int N;
  cin >>N;
  vector<int> vec(N);
  rep(i,N) {
    cin >>vec.at(i);
  }
   int count=0;
  
  repl(i,1,10000) {
    int ans=0;
    rep(i,N) {
      if(vec.at(i)%2==0) {
        ans++;
      }
    }
    if (ans==N) {
      count++;
      rep(i,N) {
vec.at(i)=vec.at(i)/2;
        
      }
    }
  }
  cout<<count<< endl;
}
      
 


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


def main():
    h, w = map(int, input().split())
    s = [list(map(str, input().split())) for _ in range(h)]
    alpha = [chr(ord('A') + i) for i in range(26)]

    for i in range(h):
        for j in range(w):
            if s[i][j] == 'snuke':
                print(alpha[j] + str(i + 1))
                exit()


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int n, m, k;
    cin >> n >> m >> k;
    rep(i, n+1) rep(j, m+1) {
        if(i*m + j*n - i*j*2 == k) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

double dp[330][330][330];
int n, A;
int cnt[4];

int main(){
  cin >> n;
  rep(i,n){
    cin >> A;
    cnt[A]++;
  }
  rep(i,n+1){
    rep(j,n+1){
      rep(k,n+1){
        int sum = i + j + k;
        if(sum == 0){
          dp[i][j][k] = 0;
          continue;
        }
        dp[i][j][k] += (double)n/sum;
        if(i-1>=0) dp[i][j][k] += dp[i-1][j+1][k]*i/sum;
        if(j-1>=0) dp[i][j][k] += dp[i][j-1][k+1]*j/sum;
        if(k-1>=0) dp[i][j][k] += dp[i][j][k-1]*k/sum;
      }
    }
  }
  printf("%.10lf\n", dp[cnt[3]][cnt[2]][cnt[1]]);
}

Measured memory_bytes: 258176
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
// a>=0, b>=0, x*a+y*b=gcd>=0, a>0,b>0=>abs(y)<=a,abs(x)<=b
LL gcdex(LL a,LL b,LL& x, LL& y){
	LL ax=1,ay=0;
	LL bx=0,by=1;
	while(b){
		LL r=a/b;
		LL t=a-r*b; a=b; b=t;
		LL tx=ax-r*bx; ax=bx; bx=tx;
		LL ty=ay-r*by; ay=by; by=ty;
	}
	x=ax;
	y=ay;
	return a;
}
LL modinv(LL a, LL mod){
	LL x,y;
	gcdex(a,mod,x,y);
	if(x<0){
		x+=mod;
	}
	return x;
}

const LL N=3e6;
const LL K=998244353;
template<int S>
struct Comb
{
	LL f[S+1];
	LL r[S+1];
	LL mod;
	Comb(int m)
	{
		mod=m;
		f[0]=1;
		r[0]=1;
		for(LL i=1;i<=S;i++){
			f[i]=i*f[i-1]%m;
			r[i]=modinv(i,m)*r[i-1]%m;
		}
	}
	LL c(int n,int i){
		if(i<0||n<i)
		{
			//assert(0);
			return 0;
		}
		return f[n]*r[i]%mod*r[n-i]%mod;
	}
};
Comb<N> comb(K);
LL C(int n,int i){
	return comb.c(n,i);
}

LL f(LL a,LL b)
{
	return C(a+b-1,a-1);
}


int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
	LL ret=f(N,3*M);
	for(LL i=2*M+1;i<=3*M;i++){
		ret+=K-N*f(N-1,3*M-i)%K;
		ret%=K;
	}
	for(LL i=M+1;i<=min(N,3*M);i++){
		if((3*M-i)%2){
			continue;
		}
		LL r=(3*M-i)/2;
		ret+=K-C(N,i)*f(N,r)%K;
		ret%=K;
	}
	assert(ret>=0&&ret<K);

	cout << ret << endl;

    return 0;
}


Measured memory_bytes: 47232
/*
....................../´¯/)
....................,/¯../
.................../..../
............./´¯/'...'/´¯¯`·¸
........../'/.../..../......./¨¯\
........('(...´...´.... ¯~/'...')
.........\.................'...../
..........''...\.......... _.·´
............\..............(
..............\.............\...
*/


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define ye cout<<"YES";
#define no cout<<"NO";
#define ln cout<<"\n";
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define pi 3.14159265358979323846
// cout<<"Case #"<<ts<<": “;
//priority_queue < pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;


using namespace std;

ll mod(ll x, ll m) {
	return (x % m + m) % m;
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll t = 1, r, n, a, d, c, b, x, y, sum, cnt, i, j, k, m, l, q, maxx, minn, temp, ans, flag, g, ts;
	ll mod = 1000000007;
	char ch, chh;
	double dans;
	string str, ttr;

	//cin >> t;


	for (ts = 1; ts <= t; ts++)
	{
		flag = 0; sum = 0; cnt = 0; ans = 0; k = 0; maxx = 0; minn = 0; a = 0; b = 0; temp = 0;

		cin >> n >> str;
		//ll arr[n]; for (i = 0; i < n; i++) {cin >> arr[i];}

		for (i = 0; i < n; i++)
		{
			if (str[i] == 'W')
				a++;
			else
				b++;
		}

		x = 0; y = 0;

		ans = 99999999999999;

		for (i = 0; i < n; i++)
		{
			minn = (b - y);
			maxx = (x);
			temp = max(minn, maxx);
			//cout << temp << endl;
			ans = min(temp, ans);


			if (str[i] == 'W')
			{
				x++;
			}
			else
				y++;

			minn = (b - y);
			maxx = (x);
			temp = max(minn, maxx);
			//cout << temp << endl;
			ans = min(temp, ans);
		}

		cout << ans;




		ln
	}
	return 0;
}


Measured memory_bytes: 3776
import java.util.Scanner;

/**
 * @author kawakami
 *
 */
 class  Main{

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner as = new Scanner(System.in);
		
		int a,b;
		String op;
		
		
		
		
		while(true){
			
			a=as.nextInt();
			op=as.next();
			b=as.nextInt();
			
			if(op.equals("?")){
				break;
			}
			else{
		
				switch(op){
		
				case"+":
					System.out.println(a+b);
					break;
				
				case"-":
					System.out.println(a-b);
					break;
					
				case"*":
					System.out.println(a*b);
					break;
					
				case"/":
					System.out.println((int)(Math.ceil(a/b)));
					break;
					
				default:
					System.out.println("Error!!");
					break;
			}
		}
		}
			
		
				
		
		

	}

}

Measured memory_bytes: 26192
#include <iostream>
#include <cstdlib>

using namespace std;

int main(){
    int n,t,e;
    cin >> n >> t >> e;

    int ans = -1;
    int tmp,rem;
    for(int i=0;i<n;i++){
        cin >> tmp;
        rem = t % tmp;
        if(rem <= e || tmp <= rem + e ){
            ans = i+1;
        }
    }
    cout << ans << endl;
}

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

int64_t func(int64_t v) {
    const int64_t num = v + 1;
    if (num % 2 == 0) {
        const int64_t d = num / 2;
        if (d % 2 == 0) {
            return 0;
        } else {
            return 1;
        }
    } else {
        const int64_t d = (num - 1) / 2;
        if (d % 2 == 0) {
            return v;
        } else {
            return (v ^ 1);
        }
    }
}

int main() {
    int64_t A, B;
    std::cin >> A >> B;

    std::cout << (func(A-1) ^ func(B)) << std::endl;

    return 0;
}


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

int main(){
  string s;
  cin>>s;
  bool n1=false,w1=false,s1=false,e1=false;
  for(int i=0;i<s.size();i++){
    if(s[i]=='N'){
      n1=true;
    }else if(s[i]=='W'){
      w1=true;
    }else if(s[i]=='S'){
      s1=true;
    }else{
      e1=true;
    }
  }
  if((n1!=s1) || (w1!=e1)){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (e);(i) --> (s);)
#define all(x) x.begin(),x.end()

int main() {
  i64 p, q, r;
  cin >> p >> q >> r;
  cout << p + q + r - max({ p, q, r }) << endl;
}


Measured memory_bytes: 256
// By Atul Rathore
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	int k;
	cin >> k;
	string s;
	cin >> s;
	int n = s.length();
	if (n <= k)cout << s;
	else
	{
		for (int i = 0; i < k; i++)
		{
			cout << s[i];
		}
		cout << "...";

	}

}


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

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;


using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

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

	cint(x);
	int cnt = 0;
	
	cnt = x / 500;
	x -= cnt * 500;
	cnt *= 1000;
	cnt += x - (x%5);
	cout << cnt << endl;


	return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int n;
  std::string s;
  std::cin >> n >> s;

  int x = 0, ma = 0;
  rep(i,n){
    if(s[i] == 'I')
      x++;
    else
      x--;

    if(ma < x)
      ma = x;
  }

  std::cout << ma << '\n';
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}
// end of Template
int n,h[200000],ans,c;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>h[i];
    for(int i=1;i<=n;i++){
        if(h[i]<=h[i-1]){c++;ans=max(ans,c);}
        else{c=1;}
    }
    ans--;ans=max(ans,0);
    cout<<ans<<newl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N;cin>>N;
    int a;
    bool flag=true;
    rep(i,N){
        cin>>a;
        if(a%2==0){
            if(a%3==0 || a%5==0){
                continue;
            }else{
                flag=false;
                break;
            }
        }
    }
    if(flag){
        cout<<"APPROVED"<<endl;
    }else{
        cout<<"DENIED"<<endl;
    }
}

Measured memory_bytes: 3624
import math
import itertools

N = int(input())
l = [tuple(map(int,input().split())) for _ in range(N)]

if N == 2:
  x1,y1 = l[0]
  x2,y2 = l[1]
  print( 0.5 * math.hypot(x1-x2,y1-y2))
  
else:
  ans = float("INF")
  l_ = itertools.combinations(l,3)
  for points in l_:
    a,b = points[0]
    c,d = points[1]
    e,f = points[2]
    
    if (e-a)*(b-d) == (c-a)*(b-f):
      continue
    else:
      aa = a * a
      bb = b * b
      cc = c * c
      dd = d * d
      ee = e * e
      ff = f * f

      py = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)) / (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f))

      px = (2 * (b - f) * py - aa - bb + ee + ff) / (2 * (e - a)) \
          if (c == a) else (2 * (b - d) * py - aa - bb + cc + dd) / (2 * (c - a))

      r = math.hypot(px - a, py - b) + 10**(-7)
    flag = 1
    for point in l:
      if flag:
        s,t = point
        if math.hypot(px - s, py - t) > r:
          flag = 0
    if flag:
      ans = min(r,ans)
      
  l_ = itertools.combinations(l,2)
  for points in l_:
    a,b = points[0]
    c,d = points[1]
    
    
    px,py = (a+c)/2,(b+d)/2

    r = math.hypot(px - a, py - b) + 10**(-7)
    flag = 1
    for point in l:
      if flag:
        s,t = point
        if math.hypot(px - s, py - t) > r:
          flag = 0
    if flag:
      ans = min(r,ans)
    
  print(ans)

Measured memory_bytes: 50416
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	int n, h;
	cin >> n >> h;
	int ans = 0;
	rep(i, n) {
		int x;
		cin >> x;
		if (x >= h)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

#define pb push_back
#define mk make_pair
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define sf(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define TEST int test; cin >> test;while(test--)
#define ii pair<int,int>
#define iil pair<ll,ll>
#define loop(i,a,b) for(int i = a ; i < b ; i++)
#define INF 2147483647


int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);


ll gcd(ll a, ll b)
{
    if(b==0) return a;
    a%=b;
    return gcd(b,a);
}


ll mod(ll a, ll b)
{
    ll c = a % b;
    if (c < 0)
        c += b;
    return c;
}
ll power(ll x, unsigned long long y)
{
    int res = 1;     // Initialize result

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x);

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}
int isPrime[5000000] ;
vector< vector<ll> > pf(1000000), pr(1000000);
void sieve(int n)
{
    for(int i = 2 ; i*i <= n ; i++)
    {
        if(!isPrime[i])
        {
            // v.pb(i);
            for(int j = i+i ; j <= n; j = j + i)
            {
                isPrime[j] = 1;
                pf[j].pb(i);
            }
        }
    }
    return;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
     ll a,b,c,k;
     cin >> a >>b >> c >>k;
     if(k <= (a+b))
     {
       cout << min(k,a);
     }
     else{
       cout << a - (k-b-a) << endl;
     }

    return 0;



}


Measured memory_bytes: 50092
N = int(input())
S = input()
ac = [0]

# 黒の累積和テーブルを作る
for i in range(N):
    if S[i] == "#":
        ac.append(ac[i] + 1)
    else:
        ac.append(ac[i])

#print(ac)

work_min = N
for j in range(0, N + 1):
    work_sum = ac[j] + (N - j - (ac[N] - ac[j]))
    if work_min > work_sum:
        work_min = work_sum

print(work_min)

Measured memory_bytes: 11136
while 1:
    a = input().split()
    if a[1] == '?':
        break
    elif a[1] == '+':
        print(int(a[0])+int(a[2]))
    elif a[1] == '-':
        print(int(a[0])-int(a[2]))
    elif a[1] == '*':
        print(int(a[0])*int(a[2]))
    elif a[1] == '/':
        print(int(a[0])//int(a[2]))


Measured memory_bytes: 5596
#include <stdio.h>
#include <stdlib.h>
int main (){
int n,dp[100001]={10000001},h[100001],i;
  scanf ("%d",&n);
  for (i=0;i<n+1;i++){
  scanf ("%d",&h[i]);
  }
  dp[0]=0;
  for (i=1;i<n;i++){
  dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
  if (i>1){
  if (dp[i-1]+abs(h[i]-h[i-1]) > dp[i-2]+abs(h[i]-h[i-2])){
  dp[i]=dp[i-2]+abs(h[i]-h[i-2]);}
   else{
   dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
   }
  }
  }
  printf ("%d",dp[n-1]);
return 0;
}

Measured memory_bytes: 896
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int num = 0;
        for (int i=1; i<=n; i++){
            num+=i;
        }
        System.out.println(num);
    }
}

Measured memory_bytes: 23124