akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const ll INF = (1LL<<59);

int n,m,s,t;
vector<pair<int, ll>> adjS[100005], adjT[100005];
vector<ll> distS(100005, INF), distT(100005, INF);
vector<bool> visited(100005, false);

void dijkstraS(){
    priority_queue<pair<ll, int>> q;
    for(int i=1; i<=n; i++) visited[i] = false;

    distS[s] = 0;
    q.push({0, s});

    while(!q.empty()){
        pair<ll, int> f = q.top(); q.pop();
        int u = f.second;

        visited[u] = true;

        if(distS[u] < f.first*(-1)) continue;

        for(int i=0; i<adjS[u].size(); i++){
            int v = adjS[u][i].first;
            if(visited[v] == true) continue;
            if(distS[v] > distS[u]+adjS[u][i].second){
                distS[v] = distS[u]+adjS[u][i].second;
                q.push({-distS[v], v});
            }
        }
    }
}

void dijkstraT(){
    priority_queue<pair<ll, int>> q;
    for(int i=1; i<=n; i++) visited[i] = false;

    distT[t] = 0;
    q.push({0, t});

    while(!q.empty()){
        pair<ll, int> f = q.top(); q.pop();
        int u = f.second;

        visited[u] = true;

        if(distT[u] < f.first) continue;

        for(int i=0; i<adjT[u].size(); i++){
            int v = adjT[u][i].first;
            if(visited[v] == true) continue;

            if(distT[v] > distT[u]+adjT[u][i].second){
                distT[v] = distT[u]+adjT[u][i].second;
                q.push({distT[v]*(-1), v});
            }
        }
    }
}

int main(){
    cin >> n >> m >> s >> t;
    for(int i=0; i<m; i++){
        int u, v;
        ll a, b; 
        cin >> u >> v >> a >> b;
        adjS[u].push_back({v, a});
        adjS[v].push_back({u, a});
        adjT[u].push_back({v, b});
        adjT[v].push_back({u, b});
    }

    dijkstraS();
    dijkstraT();

    vector<ll> ans(n);

    ll money = 1e15;
    ll MAX = 0LL;
    for(int i=n; i>0; i--){
        ll cost = distS[i]+distT[i];
        ll res = money - cost;

        MAX = max(MAX, res);
        ans[i-1] = MAX;
    }

    for(int i=0; i<n; i++) cout << ans[i] << endl; 
}

Measured memory_bytes: 19140
import java.util.*;

public class Main {
public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a=sc.nextInt();
		String s=sc.next();

		if(a>=3200){
			System.out.println(s);
		}else{
			System.out.println("red");
		}

	}
}


Measured memory_bytes: 21588
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

/*
    A nice paper on Binomial Coefficients: http://www.cs.columbia.edu/~cs4205/files/CM4.pdf
    Number of ways to go form (0, 0) to (r, c): ncr(r, c) = Choose(r + c, r)
    If column is constant: We have to calculate ncr(r1, c) + ncr(r1 + 1, c) + ncr(r1 + 2, c) + ... + ncr(r2, c)
    Hockey Stick Identity : Σ ncr(i, r) ∀ i ∈ [r, n] = ncr(n + 1, r + 1)
    answer for a constant column = ncr(r2 + c + 1, c + 1) - ncr(r1 + c, c + 1)
    Can apply Hockey Stick Identity once more to simplify it to O(1) formula 
    (Better visualisation using Inclusion Exclusion Principle).
*/

const int MOD = 1e9 + 7;
const int N = 2e6 + 5;

int fac[N], inv[N];

int power(int x, int y) {
    int res = 1;
    while(y) {
        if(y & 1) 
            res = res * x % MOD;
        x = x * x % MOD;
        y >>= 1;
    }
    return res;
}

void pre() {
    fac[0] = 1;
    for (int i = 1; i < N; i++)
        fac[i] = i * fac[i - 1] % MOD;

    inv[N - 1] = power(fac[N - 1], MOD - 2);
    for (int i = N - 2; i >= 0; i--)
        inv[i] = (i + 1) * inv[i + 1] % MOD; 
}

int choose(int n, int r) {
    if (r < 0 || r > n)
        return 0;
    return fac[n] * inv[r] % MOD * inv[n - r] % MOD;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    pre();

    int T = 1; 
    // cin >> T; 
    while (T--) {
        int r1, c1, r2, c2;
        cin >> r1 >> c1 >> r2 >> c2;

        int ans = 0;
        for (int c = c1; c <= c2; c++) {
            int temp = (choose(r2 + c + 1, c + 1) - choose(r1 + c, c + 1) + MOD) % MOD;
            ans = (ans + temp) % MOD;
        }
        cout << ans << '\n';
    }
    
    return 0;
}



Measured memory_bytes: 34876
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N, M = map(int, input().split())
    ng = [0] * 100100
    for _ in range(M):
        a = int(input())
        ng[a] = 1

    MOD = 1000000007

    dp = [0] * 100100
    dp[0] = 1
    for i in range(N):
        if not ng[i + 1]:
            dp[i + 1] += dp[i]
            dp[i + 1] %= MOD
        if not ng[i + 2]:
            dp[i + 2] += dp[i]
            dp[i + 2] %= MOD

    print(dp[N])


if __name__ == '__main__':
    main()


Measured memory_bytes: 8556
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(10000000)

for line in sys.stdin:
    op, S1, S2 = line.split()
    id1 = id2 = 0
    ans = ''
    
    def rem(S, ind):
        rem = '('
        cnt = 1
        while cnt > 0:
            if S[ind] == '(':
                cnt += 1
            elif S[ind] == ')':
                cnt -= 1
            rem += S[ind]
            ind += 1
        return rem, ind

    while id1 < len(S1):
        if S1[id1] == S2[id2]:
            ans += S1[id1]
            id1 += 1
            id2 += 1
        elif S1[id1] == '(':
            S, id1 = rem(S1, id1 + 1)
            if op == 'u':
                ans += S
        elif S2[id2] == '(':
            S, id2 = rem(S2, id2 + 1)
            if op == 'u':
                ans += S
    
    print ans


Measured memory_bytes: 5016
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const long long N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
long long weight,n,weights[100],prices[100],dp[100][100000];
long long solve(long long i,long long sum){
    if(sum==weight){
        return 0;
    }
    if(sum>weight){
        return -OO;
    }
    if(i>=n){
        return 0;
    }
    if(dp[i][sum]!=-1){
        return dp[i][sum];
    }
    return dp[i][sum]=max(prices[i]+solve(i+1,sum+weights[i]),solve(i+1,sum));
}
int main()
{
memset(dp,-1,sizeof(dp));
scanf("%lld %lld",&n,&weight);
for(long long i=0;i<n;++i){
    scanf("%lld %lld",&weights[i],&prices[i]);
}
cout<<solve(0,0);


    return 0;
}


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

int main() {
	int N;
	long L, a[100010]; cin >> N >> L;
	for(int i=0; i<N; ++i) cin >> a[i];
	for(int i=1; i<N; ++i){
	    if(a[i-1]+a[i]>=L){
	        cout << "Possible" << endl;
	        for(int j=1; j<i; ++j) cout << j << endl;
	        for(int j=N-1; j>=i; --j) cout << j << endl;
	        return 0;
	    }
	}
	cout << "Impossible" << endl;
	return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
ll mod=pow(10,9)+7;

ll matpow(ll a,int k){
    ll dp=1,mt=a;
    while(k>0){
        if(k & 1)dp=(dp*mt)%mod;
        mt=(mt*mt)%mod;
        k/=2;
    }
    return dp;
}

int main(){
    int N;cin>>N;
    ll ans=0;
    vec A(10010),r(10010);
    map<ll,ll> lcm,mp[N];
    for(int i=0;i<N;i++){
        cin>>A[i];
        ans=(ans+matpow(A[i],mod-2))%mod;
        r[i]=sqrt(A[i])/1;
        for(int j=2;j<=r[i];j++){
            while(A[i]%j==0){
                A[i]/=j;
                mp[i][j]++;
            }
        }
        if(A[i]!=1)mp[i][A[i]]++;

        for(auto itr=mp[i].begin();itr!=mp[i].end();itr++){
            if(itr->second>lcm[itr->first]){
                lcm[itr->first]=itr->second;
            }
        }
    }
    //最小公倍数
    ll L=1;
    for(auto itr=lcm.begin();itr!=lcm.end();itr++){
        L=(L*(ll)pow(itr->first,itr->second))%mod;
    }
    
    cout<<(ans*L)%mod<<endl;
    return 0;
}

Measured memory_bytes: 3968
x,n = map(int,input().split())
p = list(map(int,input().split()))
if not len(p):
    print(x)
    exit()
p = set(p)


for i in range(101):
    if i == 0:
        if x not in p:
            print(x)
            exit()
        continue
    if (x - i) not in p:
        print(x-i)
        exit()
    elif (x + i) not in p:
        print(x+i)
        exit() 


Measured memory_bytes: 9128
#include<iostream>
#include<vector>
using namespace std;
using lli = long long int;
using pii = pair<lli, lli>;

lli getPar(vector<vector<lli> > &G, vector<lli> &parent, lli v){
  if(parent[v] == v)return v;
  return parent[v] = getPar(G, parent, parent[v]);
}

int main(){
  lli n, m, x, y;
  std::cin >> n >> m;
  vector<vector<lli> > G(n);
  vector<pii> edge;
  for (int i = 0; i < m; i++) {
    std::cin >> x >> y;
    edge.push_back(pii(--x, --y));
  }
  vector<lli> ans, size(n, 1), parent(n), rank(n, 0);
  lli val = n*(n - 1)/2;
  for (int i = 0; i < n; i++) parent[i] = i;
  for (int i = edge.size() - 1; i >= 0; i--) {
    ans.push_back(val);
    int pf = getPar(G, parent, edge[i].first);
    int ps = getPar(G, parent, edge[i].second);
    if(ps != pf){
      val -= size[pf]*size[ps];
      size[pf] += size[ps];
      size[ps] = size[pf];
      parent[ps] = parent[pf];
      // if(rank[ps] > rank[pf]){
      //   size[pf] += size[ps];
      //   size[ps] = size[pf];
      //   parent[ps] = parent[pf];
      // }else{
      //   if(rank[ps] == rank[pf])rank[pf]++;
      //   size[ps] += size[pf];
      //   size[pf] = size[ps];
      //   parent[pf] = parent[ps];
      // }
    }
    // for (int j = 0; j < n; j++) {
    //   std::cout << size[j] << " ";
    // }
    // std::cout << std::endl;
    // std::cout << std::endl;
  }
  for (int i = ans.size() - 1; i >= 0; i--) {
    std::cout << ans[i] << std::endl;
  }
  return 0;
}


Measured memory_bytes: 9328
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,K,ans=0,t=0;
  cin >> N >> K;
  while(t<N){
    ans++;
    t=(K-1)*ans+1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
d = dict()
for c in s:
  if d.__contains__(c):
    d[c] += 1
  else:
    d[c] = 1
l = list(d.items())
if len(l)!=2:
  print("No")
  exit(0)
if l[0][1] == 2 and l[1][1] == 2:
  print("Yes")
  exit(0)
else:
  print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


	int arr[5];
	for (ll i = 0; i < 5; i++)
	{
		cin >> arr[i];
	}
	for (ll i = 0; i < 5; i++)
	{
		if (arr[i] == 0)
		{
			cout << i + 1;
		}
	}

}


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


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


int main(){
    int K;
    cin >> K;
    long int total = 0;
    for (int a=1; a<=K; ++a) {
        for (int b=1; b<=K; ++b) {
            for (int c=1; c<=K; ++c) {
                total += gcd(gcd(a, b), gcd(b, c));
            }
        }
    }
    cout << total << endl;
}



Measured memory_bytes: 3632
use std::io::*;
use std::str::FromStr;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

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

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}

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

    let w: i32 = sc.read();
    let h: i32 = sc.read();
    let x: i32 = sc.read();
    let y: i32 = sc.read();
    let r: i32 = sc.read();

    let ans = if r <= x && x <= w - r && r <= y && y <= h - r {
        "Yes"
    } else {
        "No"
    };
    println!("{}", ans);
}



Measured memory_bytes: 5028
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L

int mxN = 50000000;
vector<int> cnt(mxN + 1);

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    k--;
    s[k] = tolower(s[k]);
    cout << s;

    return 0;
}

Measured memory_bytes: 198404
#include<bits/stdc++.h>
    
    using namespace std;
    
    #define gc getchar_unlocked
    #define foi(i,n) for(int i=0;i<n;i++)
    #define Foi(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
    #define fol(i,n) for(ll i=0;i<n;i++)
    #define Fol(i,k,n) for(ll i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
    #define ll long long
    #define si(x)   scanf("%d",&x)
    #define sl(x)   scanf("%lld",&x)
    #define ss(s)   scanf("%s",s)
    #define pi(x)   printf("%d\n",x)
    #define pl(x)   printf("%lld\n",x)
    #define ps(s)   printf("%s\n",s)
    #define deb(x) cout << #x << "=" << x << endl
    #define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    #define all(x) x.begin(), x.end()
    #define clr(x) memset(x, 0, sizeof(x))
    #define sortall(x) sort(all(x))
    #define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
    #define PI 3.1415926535897932384626
    typedef pair<int, int>  pii;
    typedef pair<ll, ll>    pl;
    typedef vector<int>     vi;
    typedef vector<ll>      vl;
    typedef vector<pii>     vpii;
    typedef vector<pl>      vpl;
    typedef vector<vi>      vvi;
    typedef vector<vl>      vvl;
    int mpow(int base, int exp); 
    void ipgraph(int m);
    void dfs(int u, int par);
    const int mod = 1000000007;
    const int N = 3e5, M = N;
    //=======================
    
    vi g[N];
    int a[N];
    
    int mpow(int base, int exp) {
        base %= mod;
        int result = 1;
        while (exp > 0) {
        if (exp & 1) result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
        }
        return result;
    }
    
    void ipgraph(int n, int m){
        int i, u, v;
        while(m--){
            cin>>u>>v;
            g[u-1].pb(v-1);
            g[v-1].pb(u-1);
        }
    }
    
    void dfs(int u, int par){
        for(int v:g[u]){
            if (v == par) continue;
            dfs(v, u);
        }
    }
    
    
    int main() {
        int a;
        cin>>a;
        cout<<a+pow(a,2)+pow(a,3);   
        return 0;
    }

Measured memory_bytes: 11172
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

    int putFirst = 0, putLast = 0, cnt = 0;
    rep(i, n) {
        if(s[i] == '(') {
            cnt++;
        }
        else if(s[i] == ')') {
            cnt--;
            if(cnt == -1) {
                cnt = 0;
                putFirst++;
            }
        }
    }
    putLast = cnt;

    rep(i, putFirst) {
        cout << "(";
    }
    cout << s;
    rep(i, putLast) {
        cout << ")";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <set>
#include <cstdio>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <tuple>
#include <algorithm>
#include <limits>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int main() {
    int n;
    cin >> n;
    int u = 0;
    bool f = true;
    for (int i = 0; i < n; i++) {
        char c; int x;
        cin >> c >> x;
        bool p = (c == ')');
        if (p == 0) {
            u += x;
        } else {
            u -= x;
            if (u < 0) f = false;
        }
    }
    if (u != 0) f = false;
    if (f) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 1108
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;

    print(N / 3);


}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
int main() {
	
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int Y, M,D;

	scanf("%04d/%02d/%02d", &Y, &M,&D);
	//20190430까진 Heisei, 그이상부터 TBD
	if (Y < 2018) {
		printf("Heisei");
	}
	else if (Y == 2019 && M <= 4 && D <= 30) {
		printf("Heisei");
	}
	else {
		printf("TBD");
	}
	
}

Measured memory_bytes: 128
#include<iostream>
#include<array>
#include<sstream>
#include<cmath>

using namespace std;

class Solution {
public:
    int count = 0;
    int res = 0;
    string target;
    size_t n;
    array<bool, 8> arr{};
    Solution(int n) {
        this->n = n;
    }
    void Search(string s) {
        count = 0;
        target = s;
        DFSearch("");
    }
    void DFSearch(string s) {
        if (s.size() == n) {
            //cout << s << endl;
            if (s == target) res = count;
            ++count;
            return;
        }
        for(size_t i = 0; i < n; ++i) {
            if(arr[i]) continue;
            arr[i] = true;
            DFSearch(s + to_string(i+1));
            arr[i] = false;
        }
    }
};

int main() {
    int n;
    cin >> n;
    string input1;
    stringstream ss;
    for (int i=0; i<n; ++i) {
        int temp;
        cin >> temp;
        ss << temp;
    }
    ss >> input1;
    ss.str("");
    ss.clear();
    for (int i=0; i<n; ++i) {
        int temp;
        cin >> temp;
        ss << temp;
    }
    string input2;
    ss >> input2;
    Solution sol(n);
    sol.Search(input1);
    int res1 = sol.res;
    sol.Search(input2);
    int res2 = sol.res;
    cout << abs(res1 - res2) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  
  int a, b, c;
  scanf("%d%d%d" ,&a,&b,&c);
  if ( a < b && b < c   ) {
    printf("Yes\n");  
 
  } else {
    printf("No\n");
}
  return 0;
} 



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

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

    for(int i=1;i<=N;i++){
        int yaku=0;
        if(i%2==0)continue;
        for(int j=1;j<=N;j++){
            if(i%j==0){
                yaku++;
            }
        }
        if(yaku==8)ans++;
    }

    cout<<ans<<endl;

    return 0;
}

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

int main () {
    char c;
    cin >> c;

    if (c=='a' ||c== 'e' || c=='i' ||c== 'o' ||c== 'u') {
        cout << "vowel" << endl;
    }
    else {
        cout << "consonant" << endl;
    }
}
 


Measured memory_bytes: 3592
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define ort (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 3000005; 
const lo mod = 1000000007; 

lo n,m,cev,b,a[li],k,PS[li],PS1[li];
string s;
vector<lo> v;

inline lo solve(){
	fio();
	cin>>n>>s;
	for(lo i=0;i<(lo)s.size();i++){
		if(i!=0) PS[i]=PS[i-1];
		if(i!=0) PS1[i]=PS1[i-1];
		if(s[i]=='.') PS[i]++;
		if(s[i]=='#') PS1[i]++;
	}
	lo mx=inf;
	cev+=PS[n-1];
	mx=min(mx,cev);
	for(lo i=0;i<n;i++){
		cev=0;
		cev+=PS[n-1]-PS[i];
		cev+=PS1[i];
		mx=min(mx,cev);
	}
	cout<<mx<<endl;
	return 0;
}

int main(void){
	solve();
	
	return 0;
}


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

int main() {
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    int c = 0;
    int d = 0;
    rep(i,n){
        char e = s[i];
        if(e == 'a' && c+d < a+b){
            cout << "Yes" << endl;
            c++;
        }
        else if(e == 'b' && c+d < a+b && d < b){
            cout << "Yes" << endl;
            d++;
        }
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 896
use std::cmp;
use std::collections::VecDeque;

const D: [(i64, i64); 4] = [(1, 0), (-1, 0), (0, 1), (0, -1)];
const INF: usize = 1 << 50;
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let h: usize = sc.read();
    let w: usize = sc.read();
    let s: Vec<Vec<char>> = (0..h).map(|_| sc.chars()).collect();

    let mut max = 0;
    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '.' {
                max = cmp::max(max, bfs((i, j), &s));
            }
        }
    }

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

fn bfs(from: (usize, usize), board: &Vec<Vec<char>>) -> usize {
    let mut q = VecDeque::new();
    let h = board.len();
    let w = board[0].len();
    let mut dist = vec![vec![INF; w]; h];
    dist[from.0][from.1] = 0;
    q.push_back(from);
    while let Some((i, j)) = q.pop_front() {
        for &(di, dj) in D.iter() {
            let ni = (i as i64) + di;
            let nj = (j as i64) + dj;
            if ni < 0 || nj < 0 {
                continue;
            }
            let ni = ni as usize;
            let nj = nj as usize;
            if ni >= h || nj >= w {
                continue;
            }
            if dist[ni][nj] > dist[i][j] + 1 && board[ni][nj] == '.' {
                dist[ni][nj] = dist[i][j] + 1;
                q.push_back((ni, nj));
            }
        }
    }

    let mut max = 0;
    for i in 0..h {
        for j in 0..w {
            if dist[i][j] < INF {
                max = cmp::max(max, dist[i][j]);
            }
        }
    }
    max
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
using namespace std;

int main(){
  int a;
  cin >> a;
  while(a){
   if (a%10==9){
     cout << "Yes" << endl;
     return 0;
   }
   a/=10;
  }
  cout << "No" << endl;
  return 0;
}


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

int main(void)
{
  int n,a,b,M,m;
  cin >> n;
  cin >> a;
  cin >> b;
  M = min(a,b);
  m = a + b - n;
  if(m < 0) m = 0;
  cout << M << " " << m << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+5;
const int mod=1e9+7;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll sum=0;
    if(k>=a)
    {
        k-=a;
        sum+=a;
        if(k>=b)
        {
            k-=b;
            sum-=k;
            cout<<sum<<'\n';
        }
        else
        {
            cout<<sum<<'\n';
        }
    }
    else
    {
        cout<<k<<'\n';
    }


}


Measured memory_bytes: 3648
import java.util.*;

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

        String s = sc.next();
        int l = s.length();
        String a = "AZ";
        int x = 0;
        int y = 0;

        for(int i=0; i<l; i++){
            if(s.charAt(i)==a.charAt(0)){
                x = i;
                break;
            }
        }
        for(int i=l-1; i>=0; i--){
            if(s.charAt(i)==a.charAt(1)){
                y = i;
                break;
            }
        }
        System.out.println(y - x + 1);
    }
}

Measured memory_bytes: 25748
import math
A,B = map(int,input().split())

ans = ""
for i in range(1,1251):
  a = math.floor(i * 0.08)
  b = math.floor(i * 0.1)
  if a == A and b == B:
    ans = i
    break
    
print(ans if ans != "" else -1)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
typedef long long int ll;
int get_hash(int x,int y){
	return x*1000+y;
}
const int N=2e6;
set<int> adj[N];
set<int> nodes;
bool vis[N];
int deg[N];
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		vector<int> v;
		for(int j=1; j<=n-1; j++) {
			int y;
			cin>>y;
			int x=i;
			if(x>y) {
				swap(x,y);
			}
			int m=get_hash(x,y);
			v.push_back(m);
			nodes.insert(m);
		}
		for(int j=1; j<(int)v.size(); j++) {
			adj[v[j-1]].insert(v[j]);
			deg[v[j]]++;
		}
	}
	int ans=0;
	queue<pair<int,int> >  ready;
	for(int i:nodes) {
		if(deg[i]==0) ready.push({i,1});
	}


	int cnt=0;
	while(!ready.empty()) {
		auto o=ready.front();
		ready.pop();
		int node=o.first;
		int dep=o.second;
		ans=max(ans,dep);
		vis[node]=1;
		for(int z:adj[node]) {
			deg[z]--;
			if(deg[z]==0) ready.push({z,dep+1});
		}
	}
	for(int i:nodes) {
		if(!vis[i]) {
			cout<< -1<<endl;
			return 0;
		}
	}

	cout<<ans<<endl;

	return 0;
}


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

using namespace std;

string s;

long long number(int i, int j) {
    int n=j-i;
    long long ans=0;
    long long m = pow(10, n);
    while(i<=j) {
        ans += m*(s[i]-48);
        m /= 10;
        i++;
    }
    return ans;

}

int main() {
    cin>>s;
    long long ans=0;
    int n = s.size();
    int p = pow(2, n-1);

    for(int i=0;i < p;i++) {
        int x=i;
        int p=0,e=n-1;
        for(int j=1;j<=(n-1);j++) {
            if(x ^ ((x>>1)<<1)) {
                ans += number(p, j-1);
                //cout<<number(p,j-1)<<endl;
                p = j;
            } x = x>>1;
        }
        ans += number(p, e);
        //cout<<number(p,e)<<endl;
    }


    cout<<ans;

}


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





int main()
{
  int L;
  int R;
  int d;

  cin >> L >> R >> d;

  int ans = 0;
  for (int i=L; i<R+1; i++)
  {
    if (i%d == 0)
    {
      ans++;
    }
  }

  cout << ans << endl;
  return 0;

}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  if(n%2==1){
    cout << "No" << endl;
  }
  else if(s.substr(0,n/2)==s.substr(n/2,n/2)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
ll ans=0;
void solve(int n,int use,ll crnt){
    if(crnt>n){
        return ;
    }
    if(use==0b111){
        //cout<<'y'<<endl;
        ans++;
    }
    solve(n,use|0b100,crnt*10+7);
    solve(n,use|0b010,crnt*10+5);
    solve(n,use|0b001,crnt*10+3);
}
int main(void){
    int n;
    cin>>n;
    solve(n,0b000,0);
    cout<<ans<<endl;
 return 0;   
}

Measured memory_bytes: 256
n=int(input())
s=input()
ans=0
import collections
c = collections.Counter(s)
ans=c["."]
t=ans
for i in s:
    if(i=="."):
        t-=1
        ans=min(t,ans)
    if(i=="#"):
        t+=1
        ans=min(t,ans)
print(ans)

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

int main(){
  long N, M;
  cin >> N >> M;
  dsu d(N);
  rep(i, M){
    long a, b;
    cin >> a >> b;
    d.merge(a - 1, b - 1);
  }
  cout << d.groups().size() - 1 << endl;
  return 0;
}

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

int main() {
  int a , b , c , d , e , f ;
  cin >> a >> b >> c >> d ;
  
  e=a*b;
  f=c*d;
  
  if(e>=f){
    cout << e << endl ;
  }
    
  else{
    cout << f << endl ;
  }
}
    
  



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

int main(void)
{
	int player, turn;
	int player_a[1001];
	int i, j;
	char str[20];
	int player_all;
	int count;
	int flag;

	while (1){
		scanf("%d %d", &player_all, &turn);
		if (player_all == 0 && turn == 0){
			break;
		}

		player = 1;
		for (i = 0; i < 1001; i++){
			player_a[i] = 1;
		}
		count = 0;

		for (i = 1; i <= turn; i++){
			scanf("%s", str);

			if (count == 1){
				continue;
			}
			
			count = 0;
			flag = 0;

			if (i % 15 == 0){
				if (strcmp(str, "FizzBuzz") != 0){
					player_a[player] = 0;
				}
			}
			else if (i % 3 == 0){
				if (strcmp(str, "Fizz") != 0){
					player_a[player] = 0;
				}
			}
			else if (i % 5 == 0){
				if (strcmp(str, "Buzz") != 0){
					player_a[player] = 0;
				}
			}
			else {
				if (atoi(str) != i){
					player_a[player] = 0;
				}
			}

			for (player = player + 1; player <= player_all; player++){
				if (player_a[player] == 1){
					break;
				}
			}

			if (player > player_all){
				for (player = 1; player <= player_all; player++){
					if (player_a[player] == 1){
						break;
					}
				}
			}

			for (j = 1; j <= player_all; j++){
				if (player_a[j] == 1){
					count++;
				}
			}
		}

		flag = 0;

		for (i = 1; i <= player_all; i++){
			if (player_a[i] == 1){
				if (flag == 1){
					printf(" ");
				}

				printf("%d", i);

				flag = 1;
			}
		}

		printf("\n");
	}

	return (0);
}

Measured memory_bytes: 612
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/4;
    public static final int inf = Integer.MAX_VALUE/4;

    static void solve(InputReader in, PrintWriter out){
        int a = in.ni(), b = in.ni();
        out.println(((a-1)*(b-1)));
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
#define rp(i,j) for(long long i=0;i<j;i++)
#define rep(i,j,k) for(long long i=j;i<k;i++)
#define mod 1000000007
#define NIL -1
#define MAX 100
static const int INFTY=(1<<21);
typedef long long ll;
int n,u;
int color[MAX];
int m[MAX][MAX];
int d[MAX],p[MAX];
int prim(){
    rp(i,n){
        color[i]=0;d[i]=INFTY;p[i]=NIL;
    }
    d[0]=0;
    while(1){
        int mincost=INFTY;int u=-1;
        rp(i,n){
            if(color[i]!=2&&d[i]<mincost){
                mincost=d[i];
                u=i;
            }
        }
        if(u==-1)break;
        color[u]=2;
        rp(v,n){
            if(color[v]!=2&&m[u][v]!=INFTY){
                if(m[u][v]<d[v]){
                    d[v]=m[u][v];
                    p[v]=u;
                    color[v]=1;
                }
            }
        }
    }
    int sum=0;
    rp(i,n)if(p[i]!=NIL)sum+=m[i][p[i]];
    return sum;
}
int main(){
    int a;
    cin>>n;
    rp(i,n){
        rp(j,n){
            cin>>a;
            if(a!=-1)m[i][j]=a;
            else m[i][j]=INFTY;
        }
    }
    cout<<prim()<<endl;
}


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))

Int gcd(Int x, Int y){
  if(x == 0)return y;
  return gcd(y%x, x);
}

Int lcm(vector<Int> vec){
  Int res = 1;
  for(auto n:vec){
    Int g = gcd(res, n);
    res *= n / g;
  }
  return res;
}

int main(){
  Int n;
  cin >> n;
  vector<Int> nums(n);
  for(int i = 0;i < n;i++)cin >> nums[i];
  cout << lcm(nums) << endl;
  return 0;
}


Measured memory_bytes: 3148
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    x=int(input())
    if x<1200:
        print('ABC')
    else:
        print('ARC')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;

void solve(){
	ll n;
	cin >> n;
	int x = n/500;
	ll ans = 1000*x;
	x = (n%500)/5;
	ans += x*5;
	cout << ans << endl;
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}	


Measured memory_bytes: 256
S=input().strip()
T=input().strip()
s=[]
t=[]
for i in range(len(S)):
  s.append(str(S[i]))
for i in range(len(T)):
  t.append(str(T[i]))

s.sort()
t.sort(reverse=True)

if s<t:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define xrep(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define vl vector<long long>
#define vs vector<string>

int main() {
    ll N; cin >> N;
    string S; cin >> S;

    string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    rep(i,S.size()){
        rep(j,ALPHA.size()){
            if(S[i] == ALPHA[j]){
                S[i] = ALPHA[j + N];
                break;
            }
        }
    }
    cout << S << endl;
}

Measured memory_bytes: 3660
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

ll N, X;

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

  vector<int> costs;
  int a;
  ll ans = 0;

  for (int i = 0; i < N; ++i) {
    cin >> a;
    ans += a;

    costs.push_back(a);
  }

  for (int i = 1; i <= N - 1; ++i) {
    ll cost = 0;
    vector<int> cands;
    cands = costs;

    for (int j = 0; j < N; ++j) {
      int u = (j + 1) % N;

      if (costs[u] > costs[j]) {
        cands[u] = costs[j];
      }

      cost += cands[u];
    }

    ll v = cost + i * X;
    ans = min(ans, v);

    costs = cands;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007
using namespace std;

int main(void){
	int n,d;
	cin>>n>>d;
	int x[n][d],cnt=0;
	rep(i,n)rep(j,d)cin>>x[i][j];
	rep(i,n-1){
		rep(j,n-i-1){
			double tmp=0.0;
			rep(k,d){
				tmp+=(x[i][k]-x[j+i+1][k])*(x[i][k]-x[j+i+1][k]);
			}
			tmp=sqrt(tmp);
			int tmp1 = tmp;
			if(tmp1 == tmp)cnt++;
		}
	}

	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  char s[100000];
  char al_cnt[26] =
        {0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0,
         0, 0};

  scanf("%s", s);
  int i;
  int ic;
  for (i = 0; i < 100000; i++) {
        if ('z' < s[i] || s[i] < 'a') {
          break;
        }
        ic = s[i];
        al_cnt[ic - 'a']++;
  }

  char cc;
  for (i = 0; i < 26; i++) {
        if (al_cnt[i] == 0) {
          cc = 'a' + i;
          printf("%c\n", cc);
          break;
        }
  }
  if (i == 26) {
        printf("None\n");
  }

  return 0;
}


Measured memory_bytes: 256
package main 

import (
        "fmt"
)


func main () {
        var n, a, ma, mi int
        ko := []int{}
        fmt.Scan(&n)
        for i := 0 ; i < n ; i++ {
                fmt.Scan(&a)
                ko = append (ko, a)
        } 
        for i := 0 ; i < n ; i++ {
                if ma==0 {
                        ma =ko[i]
            }  else if ma < ko[i]{
                        ma = ko[i]
                }
        }
        for i :=0 ; i < n ; i++ {
                if mi == 0 {
                        mi = ko[i]
                } else if mi > ko[i] {
                        mi = ko[i]
                }


        }


        an := ma -mi
        fmt.Println(an)
}
          

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      (int)1e9+7
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;

int main(){
	int n,q;
	cin>>n>>q;
	
	vvi tree(n);
	REP(i,n-1){
		int a,b;
		cin>>a>>b;
		tree[a-1].push_back(b-1);
		tree[b-1].push_back(a-1);
	}
	
	vi v(n,0);
	REP(i,q){
		int p,x;
		cin>>p>>x;
		v[p-1]+=x;
	}
	
	vi jud(n,false);
	queue<int> que;
	que.push(0);
	jud[0]=true;
	while(!que.empty()){
		int num=que.front();
		que.pop();
		//printf("do %d!\n",num);//!!!
		REP(i,tree[num].size()){
			if(!jud[tree[num][i]]){
				v[tree[num][i]]+=v[num];
				que.push(tree[num][i]);
				jud[tree[num][i]]=true;
			}
		}
	}
	
	REP(i,n) cout<<v[i]<<endl;
	return 0;
}

Measured memory_bytes: 16372
import math
from collections import deque
from collections import defaultdict

import bisect


#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

n = readInt()
s = readChar()

ans = 0
x = 0

for i in range(n):
	if s[i]=="I":
		x+=1
	else:
		x-=1
	ans = max(ans,x)

print(ans)

Measured memory_bytes: 3444
public class Main {

  /*
   * <Expr> ::= <Term> | <Expr> + <Term> 
   * <Term> ::= <Fact> | <Term> * <Fact> 
   * <Fact> ::= 0-9
   */

  String line;
  char sy;
  int pos = 1;

  char getToken() {
    if( this.pos == line.length() ) { 
      this.pos++;
      return '\0';
    }
    return this.sy = line.charAt( this.pos++ );
  }

  int expression() {
//    System.out.println( "EXP" + " SY" + this.sy + " POS" + this.pos );
    int n = this.term();
    if( this.sy == '+' ) {
      this.getToken();
//      System.out.println( "DBG" + this.sy + " " + this.pos );
      int m = this.expression();
//      System.out.println( ">EXP1" + " SY"+ this.sy + " POS" + this.pos + " " + n + " " + m );
      return n + m;
    }

//    System.out.println( ">EXP2" + " SY"+ this.sy + " POS" + this.pos );
    return n;
  }

  int term() {
//    System.out.println( "TRM" + " SY"+ this.sy + " POS" + this.pos );
    int n = this.factor();
    if( this.sy == '*' ) {
      this.getToken();
      int m = this.term();
//      System.out.println( ">TRM1" + " SY"+ this.sy + " POS" + this.pos );
      return n * m;
    }

//    System.out.println( ">TRM2" + " SY"+ this.sy + " POS" + this.pos );
    return n;
  }

  int factor() {
//    System.out.println( "FCT" + " SY"+ this.sy + " POS" + this.pos );
    if( this.sy < '0' || '9' < this.sy ) {
      System.err.println( "ERROR" );
      System.exit( -1 ); // Error
    }

    int n =  this.sy - '0';
    this.getToken();

//    System.out.println( ">FCT" + " SY"+ this.sy + " POS" + this.pos );
    return n;
  }

  int mfunc() {
    int len = this.line.length();
    int x = this.line.charAt( 0 ) - '0';
    for( int i = 1; i < len - 1; i += 2 ) {
      char c = this.line.charAt( i );
      int opr = this.line.charAt( i + 1 ) - '0';
      if( c == '+' ) {
        x += opr;
      } else if( c == '*' ) {
        x *= opr;
      } 
    }
    return x;
  }

  void run(
      java.io.InputStream in,
      java.io.PrintStream out
      ) {

      java.util.Scanner sc = new java.util.Scanner( in );
      this.line = sc.next();
      int n = Integer.parseInt( sc.next() );
      this.sy = this.line.charAt(0);
      int ans1 = this.expression();
      int ans2 = this.mfunc();

      if( n == ans1 ) {
        if( n == ans2 ) {
          out.println( "U" );
        } else {
          out.println( "M" );
        }
      } else {
        if( n == ans2 ) {
          out.println( "L" );
        } else {
          out.println( "I" );
        }

      }
  }

  public static void main( String[] main ) {
    new Main().run( System.in, System.out );
  }
}

Measured memory_bytes: 17288
#include <bits/stdc++.h>
using namespace std;
int main () {
    map<int, int> mp;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        mp[min(8, a/400)]++;
    }
    int M = 0, m = 0;
    for (auto x: mp) {
        if (x.first < 8) {
            m++, M++;
        }
        else {
            M += x.second;
            if (m == 0) m++;
        }
    }
    cout << m << " " << M << endl;
}

Measured memory_bytes: 256