akhauriyash/Code-Regression huggingface dataset:
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <assert.h>
#include <bitset>
#include <string>
#include <cstdio>
#include <math.h>
#include <complex>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
using namespace std;

#define int64 long long
#define mp make_pair
#ifdef _DEBUG
const int N = 500;
#else
const int N = 100000;
#endif

const int64 INF = 1e18;

int64 n, a, b, c, d, f[N];


int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cin >> a >> b >> c >> d;
	cin >> n;
	n *= 4;
	for (int i = 0; i <= 8; i++) f[i] = INF;
	f[0] = 0;
	f[1] = a;
	f[2] = b;
	f[4] = c;
	f[8] = d;
	for (int i = 1; i <= 8; i++)
	{
		for (int j = 0; j <= i; j++) f[i] = min(f[i], f[j] + f[i - j]);
	}
	int64 ans = (n / 8) * f[8] + f[n % 8];
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> taste(N);
    for (int i = 0; i < taste.size(); i++) {
      cin >> taste.at(i);
    }
    int sum = 0;

    //sumとして体力回復値を足し合わせていく
    for (int i = 0; i < taste.size(); i++) {
      for (int j = 0; j < taste.size(); j++) {
        if (i != j) sum += taste.at(i) * taste.at(j);
      }
    }

    cout << sum/2 << endl;
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
# mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


def main():
    N, A, B, C, D = read_values()

    K = (A - B + (N - 1) * D) // (C + D)
    M = A + (N - K - 1) * D - K * C
    m = A + (N - K - 1) * C - K * D
    print("YES" if 0 <= K and m <= B <= M else "NO")


if __name__ == "__main__":
    main()



Measured memory_bytes: 4172
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);
// int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
// int a[12][12];



void solve() {
  int n; cin >> n;
  int ans = n%10;
  if (ans == 2 ||ans == 4||ans == 5|| ans == 7 || ans == 9 ) cout << "hon" << endl;
  else if (ans == 0 ||ans == 1 ||ans == 6 ||ans == 8) cout << "pon" << endl;
  else cout << "bon" << endl;
}


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

Measured memory_bytes: 3636
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int min=10007,count;
    string s,t;
    cin>>s;
    cin>>t;
    for(int i=0;i<=s.length()-t.length();i++){
        count=0;
        for(int j=0;j<t.length();j++){
            if(s[i+j]!=t[j]){
                count++;
            }
        }
        if(count<min){
            min=count;
        }
    }
    cout<<min;
}


Measured memory_bytes: 3604
#include<iostream>

int main(){
        int n,debt = 100000;
        std::cin >> n;
        for(int i=0;i<n;i++){
                debt = debt * 1.05;
                int mod = debt % 1000;
                if(mod != 0) debt = debt - mod + 1000;
        }
        std::cout << debt << std::endl;
        return 0;
}

Measured memory_bytes: 3000
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int n;
string s;
vector<int> G[500010];
int a[500010];
bool visited[500010];

void dfs(int s){
    if(visited[s]) return;
    visited[s]=true;
    for(int t:G[s]){
        dfs(t);
        a[s]=max(a[s],a[t]+1);
    }
}


void solve(){
    cin >> s;
    n=s.length();
    rep(i,n){
        if(s[i]=='<') G[i+1].push_back(i);
        else G[i].push_back(i+1);
    }
    rep(i,n+1){
        if(visited[i]) continue;
        dfs(i);
    }
    ll ans=0;
    rep(i,n+1){
        ans+=a[i];
    }
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 53916
//***The night is the darkest just before the dawn***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll N;
ll c=0;
void dfs(vector<ll> &v,ll f,ll n){
    //c++;
    //cout<<f<<" "<<n<<endl;
    //if(c==4) exit(0);
    if(n==0){
        forn(i,N) cout<<char(v[i]+'a');
        cout<<endl;
        return ;
    }
    forn(i,f){
        //cout<<"a";
        v.pb(i);
        dfs(v,f,n-1);
        v.pop_back();
    }
    v.pb(f);
    dfs(v,f+1,n-1);
    v.pop_back();
}

int main(){
    ll n;
    cin>>n;
    N=n;
    vector<ll> v;
    v.pb(0);
    dfs(v,1,n-1);
}

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

struct TPond
{
	int DownPoint;
	int Surface;
};

void ConstructPond(stack<TPond> &PondRow, stack<int> &DownPointRow, int InputCount)
{
	TPond Pond;
	Pond.DownPoint = DownPointRow.top();
	Pond.Surface = InputCount - DownPointRow.top();
	//???????±????????????´?????????????±??????????
	//???????±????????????´????????´?????????
//	cout << Pond.DownPoint << ' ' << Pond.Surface << endl;
	if(PondRow.empty()){
		PondRow.push(Pond);
		DownPointRow.pop();
	}else{
		//????????´???????±????????????§???????±????????????????????????°?±?list???????????????
		//????????´???????±????????????§???????±????????????????????????°????????´???????±???????????????????
		if(Pond.DownPoint > PondRow.top().DownPoint){
			PondRow.push(Pond);
			DownPointRow.pop();
		}else{
			while(!PondRow.empty() && Pond.DownPoint < PondRow.top().DownPoint){
				Pond.Surface += PondRow.top().Surface;
				PondRow.pop();
			}
			PondRow.push(Pond);
			DownPointRow.pop();
		}
	}
	return;
}

void Output(stack<TPond> PondRow)
{
	stack<TPond> DummyPondRow;
	int Count = 0;
	//?????¢???????±???????
	int SumOfSurface = 0;
	while(!PondRow.empty()){
		SumOfSurface += PondRow.top().Surface;
		DummyPondRow.push(PondRow.top());
		PondRow.pop();
		Count += 1;
	}
	
	//?????¢?????¨??°???????????????
	cout << SumOfSurface << endl << Count << ' ';
	//?????????????????¢??????????????????
	for(int i = 0; i < Count-1; i++){
		cout << DummyPondRow.top().Surface << ' ';
		DummyPondRow.pop();
	}
	cout << DummyPondRow.top().Surface << endl;
	return;
}

int main()
{
	//?±?(????????????????????°??¨??¢???????????±?????????)????????????list???????????????
	stack<TPond> PondRow;
	//????????????????????°????????????stack???????????????
	stack<int>   DownPointRow;
	//????????????????????°???????????????????????????????????°???????????????
	int InputCount = 0;
	while(true){
		//??????????????????????????\???????????\?????????
		char Input;
		cin >> Input;
		if(cin.good() == false){
			break;
		}
		InputCount += 1;
		//???????????\???????????????DownPointRow???????????????
		if(Input == '\\'){
			DownPointRow.push(InputCount);
		}//???????????\????????????????????´?????????????????????????±?????§??????????
		if(Input == '/' && !DownPointRow.empty()){
			ConstructPond(PondRow, DownPointRow, InputCount);
		}
//		cout << PondRow.empty() << endl;
//		cout << DownPointRow.empty() << endl;
	}
	//????????????????????¨
//	cout << InputCount;
//	cout << DownPointRow.empty();
//	cout << PondRow.empty();
//	cout << PondRow.top().DownPoint << ' ' << PondRow.top().Surface << endl;
	
	//?±?list????????¨???????±?????????¢?????¨?±??????°??¨???????????????????????¢??????????????????
	if(PondRow.empty()){
		cout << 0 << endl << 0 << endl;
	}else{
		Output(PondRow);
	}
	return 0;
}

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

int fc[100002], inv[100002], infc[100002], md = 1e9 + 7, n, vis[100001];

int ch(int a, int b) { return b > a ? 0 : (ll)fc[a] * infc[b] % md * infc[a - b] % md; }

int main(){
	scanf("%d", &n);
	fc[0] = 1;
	f(i, 1, n + 2)fc[i] = (ll)fc[i - 1] * i % md;
	inv[1] = 1;
	f(i, 2, n + 2)inv[i] = md - (ll)md / i * inv[md % i] % md;
	infc[0] = 1;
	f(i, 1, n + 2)infc[i] = (ll)infc[i - 1] * inv[i] % md;
	int d = 0;
	f(i, 1, n + 2){
		int t;
		scanf("%d", &t);
		if (vis[t]) { d = i - vis[t] - 1; break; }
		else vis[t] = i;
	}
	d = n + 1 - d - 2;
	f(i, 1, n + 2){
		int an = ch(n + 1, i) - ch(d, i - 1);
		if (an < 0)an += md;
		printf("%d\n", an);
	}
}

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

using namespace std;

using ll = long long;

const ll MOD = 1E9+7;

int n;

int main() {
	cin >> n;
	ll cnt = 0;
	ll ans = 1;
	for (int i = 0; i < n; ++i) {
		int x;
		scanf("%d", &x);
		++cnt;
		if (cnt > (x + 1) / 2)
			ans = ans * cnt-- % MOD;
	}
	
	while (cnt)
		ans = ans * cnt-- % MOD;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define ll long long int
int compare_longlong(const void *a, const void *b) {long long *A = (long long *)a;long long *B = (long long *)b;if (*A > *B) return 1;if (*A < *B) return -1;return 0;}
int main(void){
	int n;
	scanf("%d",&n);
	ll x[n],y[n];
	for(int i=0;i<n;i++){
		scanf("%lld",&x[i]);
		y[i] = x[i];
	}
	qsort(x,n,sizeof(ll),compare_longlong);
	for(int i=0;i<n;i++){
		if(y[i]<=x[n/2-1])printf("%lld\n",x[n/2]);
		else printf("%lld\n",x[n/2-1]);
	}
	return 0;
}

Measured memory_bytes: 5216
#include <iostream>

using namespace std;

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

    long long a;
    int ans = 0;

    for (int i = 0; i < n; i++) {
    	cin >> a;
    	while (a%2 == 0) {
    		ans++;
    		a /= 2;
    	}
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
# Solved by QBnewb
# Discretization
# off-line

q = int(input())
s = []
rs = [] # for discretization

# download the input
for i in range(q):
    s.append(input().split())
    if s[i][0] == '3':
        rs.append(s[i][1])
        rs.append(s[i][2])
    else:
        rs.append(s[i][1])

rs = sorted(list(set(rs)))
index = {rs[i]:i for i in range(len(rs))} # discretization
d = [[] for i in range(len(rs))] # discrete dictionary
for i in range(q):
    op, key = int(s[i][0]), s[i][1]
    idx = index[key]
    if op == 0:
        d[idx].append(s[i][2])
    elif op == 1:
        for item in d[idx]:
            print(item)
    elif op == 2:
        d[idx].clear()
    else:
        l = idx
        r = index[s[i][2]]
        for j in range(l, r+1):
            for item in d[j]:
                print(rs[j], item)


Measured memory_bytes: 89520
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {_a: usize, _b:usize}
    if _a * _b % 2 == 0 {
        println!("Even");
    } else {
        println!("Odd");
    }
}


Measured memory_bytes: 4352
s = '_'+input()
l = len(s)
dist_lst = [0]*26
idx_lst = [0]*26
for i in range(1,l):
    c = ord(s[i])%26
    dist_lst[c] = max(dist_lst[c],i-idx_lst[c])
    idx_lst[c] = i
for c in range(26):
    dist_lst[c] = max(dist_lst[c],l-idx_lst[c])

print(min(dist_lst)-1)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    a, b, c = [int(x) for x in input().split()]
    d = c - a - b
    if d > 0 and d * d > 4 * a * b:
        print("Yes")
    else:
        print("No")
    

        
    
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

7
3 1
4 1
5 9
2 6
5 3
5 8
9 7 5

"""


Measured memory_bytes: 9484
//Nihal Mittal - nihal_47
//Shine Like a Sun , Burn like a Sun 

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
using namespace std;
signed main()
{
    fast;
    
    int n,i;
    cin>>n;
    bool ok =false;
    for(i=1;i<=9;i++)
    {
    	if((n/i)>=1 && (n/i)<=9 and i*(n/i)==n)
    	{
    		ok = true;
    		break;
    	}
    }
    if(ok) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    int sum=0;
    for (int i=0; i<n; i++){
        cin >> a[i];
        sum+=a[i];
    }
    sort(a,a+n);
    if (sum%10!=0){
        cout << sum << endl;
    }
    else {
        for (int i=0; i<n; i++){
            if (a[i]%10!=0){
                cout << sum-a[i];
                exit(0);
            }
        }
        cout << 0 << endl;
    }

}

Measured memory_bytes: 380
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String line = reader.readLine();
		if (line.equals("Sunny")) {
			System.out.println("Cloudy");
		}
		else if (line.equals("Cloudy")) {
			System.out.println("Rainy");
		}
		else if (line.equals("Rainy")) {
			System.out.println("Sunny");
		}
	}
}


Measured memory_bytes: 19028
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll t=0,b=0,c=0,d=0,n,m,k,ans=0,x,y;
    string s,s2;
    cin >> n;
    VS a(n);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        for(int j=i+1;j<n;j++){
            if(a[i]==a[j]){
                cout << "No" <<endl;
                return 0;
            }
        }
    }
    rep(i,n-1){
        if(a[i].back() != a[i+1].front()){
            cout << "No" <<endl;
            return 0;
        }
    }
    cout << "Yes" <<endl;
    return 0;
}


Measured memory_bytes: 256
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
x = ip()
i = 0
ct = 1000
while i < n-1: 
	while i < (n - 1) and x[i + 1] <= x[i]: 
		i += 1
	if i == n - 1: 
		break
	buy = i 
	i += 1
	while i < n and x[i] >= x[i - 1]: 
		i += 1
	sell = i - 1
	
	no = ct//x[buy]
	profit = no*(x[sell]-x[buy])
	ct += profit
print(ct)
	


Measured memory_bytes: 61872
N = int(input())
S = input()

ans=S.count("R")*S.count("G")*S.count("B")
minus=0

for i in range(0,N):
	j = 0
	while j + 2*i < N:
		if S[j] != S[j+i] and S[j+i] != S[j+2*i] and S[j] != S[j+2*i]: minus+=1
		j+=1
print(ans-minus)


Measured memory_bytes: 67584
/*********************************************JMD**********************************************/
//                                  |\  |     | |   |   /\                                   //
    //                              | \ |     | |---|  /--\                              //
        //                          |  \| |___| |   | /    \1999                     //
/*******************************************************************************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=1e9 + 7;

/*******************************************************************************************/

void solve()
{
    ll n,k;
    cin>>n>>k;

    string s;
    cin>>s;

    if(s[k-1]< 'a') s[k-1]+=32;

    cout<<s;

    return;
}

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

    ll t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNextInt()){
			int n=sc.nextInt();
			int cnt=0;
			for(int i=0;i<10;i++){
				for(int j=0;j<10;j++){
					for(int k=0;k<10;k++){
						for(int l=0;l<10;l++){
							if(i+j+k+l==n)cnt++;
						}
					}
				}
			}
			System.out.println(cnt);
		}
		sc.close();
	}
}

Measured memory_bytes: 26836
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int count[26];

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


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    string S;
    cin >> S;
    int month = (S[5] - '0') * 10 + (S[6]-'0');
    if(month <= 4) cout << "Heisei" << endl;
    else cout << "TBD" << endl;

}


Measured memory_bytes: 256
n, m = map(int, input().split())
H = list(map(int, input().split()))
MaxHeight = [0]*n
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    MaxHeight[a] = max(MaxHeight[a], H[b])
    MaxHeight[b] = max(MaxHeight[b], H[a])
ans = 0
for h, mh in zip(H, MaxHeight):
    ans = ans + 1 if h > mh else ans
print(ans)

Measured memory_bytes: 85060
H,W = map(int, input().split())
fields = [list(input()) for i in range(H)]

mvs = [(0,1),(1,0)]

from collections import deque
q = deque()
q.append((0,0))

cnt = 0
for f in fields:
    cnt += f.count("#")
if cnt != H + W - 1: 
    print("Impossible")
    exit()
# ゴールまで連結しているか
while len(q) > 0:
    h,w = q.popleft()
    if h == H-1 and w == W-1:
        print("Possible")
        exit()
    for dh, dw in mvs:
        h_nx = h + dh
        w_nx = w + dw
        if h_nx >= H or w_nx >= W:continue
        if fields[h_nx][w_nx] == ".":continue
        q.append((h_nx,w_nx))
print("Impossible")

Measured memory_bytes: 3316
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<iomanip>
#include<sstream>
#include<bitset>

using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SORTVG(v) sort(v.begin(),v.end(),greater<>())
#define SORTV(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}


int atcoder(){
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n),b(n);
    REPL(i,0,n) cin>>a[i]>>b[i];
    
    stringstream ss;
    ss << bitset<30>(k);
    string s = ss.str();
    
    vector<ll> check;
    check.push_back(k);
    REP(i,0,s.length()){
        if(s[i]=='1'){
            string t=s;
            t[i]='0';
            REP(j,i+1,s.length()) t[j]='1';
            ll tmp=stoll(t,0,2);
            check.push_back(tmp);
        }
    }
    
    ll ans=0;
    REP(i,0,check.size()){
        ll tmp=0;
        REP(j,0,n) if((check[i] | a[j]) == check[i]) tmp+=b[j];
        chmax(ans,tmp);
    }
    cout<<ans<<ENT;
    return 0;
}


signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


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

Measured memory_bytes: 256
n=gets.chomp!.to_i
a = gets.split(" ").map(&:to_i)
b = gets.split(" ").map(&:to_i)
c = gets.split(" ").map(&:to_i)

cc = 0
for i in 0..n-1 do
  if a[i].to_i == a[i+1].to_i - 1
    cc += c[a[i]-1]
    #p a[i]
    #p cc
  end
end

cb = b.inject(:+)
#p cb

p cb + cc

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 h, n;
  cin >> h >> n;
  vector<i64> a(n), b(n);
  for (i64 i = 0; i < n; i++)
    cin >> a[i] >> b[i];
  vector<i64> dp(h + 1, 1e9);
  dp[0] = 0;
  for (i64 i = 0; i < n; i++)
    for (i64 j = 0; j < h; j++)
      dp[min(h, j + a[i])] = min(dp[min(h, j + a[i])], dp[j] + b[i]);
  cout << dp[h] << endl;
  return 0;
}


Measured memory_bytes: 384
using System;
using System.Linq;

namespace _1159
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Max() == 0) break;
                int[] people = new int[x[0]]; int stone = x[1]; int ret = 0;
                for (int i = 0; true; i++)
                {
                    int n = i % x[0];
                    if (stone > 0) { people[n]++; stone--; }
                    else { stone += people[n]; people[n] -= people[n]; };
                    if (people[n] == x[1]) { ret = n; break; }
                }
                Console.WriteLine(ret);
            }
        }
    }
}


Measured memory_bytes: 9652
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, d, cnt=0;
	cin >> n >> d;
	int a[n+1][d+1];
	for (int i=1; i<=n; i++)
		for (int j=1; j<=d; j++) cin >> a[i][j];
	for (int i=1; i<n; i++)
		for (int j=i+1; j<=n; j++)
		{
			int t=0;
			for (int x=1; x<=d; x++)
			{
				int s=fabs(a[i][x]-a[j][x]);
				t+=s*s;
			}
			if (int(sqrt(t))==sqrt(t)) cnt++;
		}
	cout << cnt << endl;
	return 0;
} 

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

//#define int int64_t

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

#define breakif(cond) if(cond) break; else

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

signed main() {
	int n;
	while (cin >> n && n) {
		using tup = tuple<int, int, int>;
		map<int, map<int, int>> mp;
		vector<tup> v(n);
		rep(i, n) {
			int x, y, w; cin >> x >> y >> w;
			v[i] = tup(x, y, w);
			mp[x][y] = w;
		}
		int ans = 0;
		for (tup t : v) {
			int x = get<0>(t), y = get<1>(t);
			int sum = 0;
			maxup(sum, mp[x][y] + mp[x + 1][y] + mp[x][y + 1] + mp[x + 1][y + 1]);
			maxup(sum, mp[x][y] + mp[x - 1][y] + mp[x][y + 1] + mp[x - 1][y + 1]);
			maxup(sum, mp[x][y] + mp[x + 1][y] + mp[x][y - 1] + mp[x + 1][y - 1]);
			maxup(sum, mp[x][y] + mp[x - 1][y] + mp[x][y - 1] + mp[x - 1][y - 1]);
			maxup(ans, sum);
		}
		cout << ans << " / " << 1 << endl;
	}
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X;
    cin >> X;
    if (X == 0)
        cout << 1 << endl;
    else
        cout << 0 << endl;


    return 0;
}

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();

    //char 'a' -> int 97

    boolean result = true;
    for(int i = 'a' ;i <= 'z' ; i ++  ){
      if( S.indexOf( i ) != S.lastIndexOf( i ) ){
        result = false;
        break;
      }
    }
    System.out.println( result ? "yes" : "no" );

  }
}


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

int main() {
    int N;
    cin >> N;
    long long t, a;
    t = 1LL;
    a = 1LL;
    for (int i = 0; i != N; ++i){
        long long T, A, ft, fa, f;
        cin >> T >> A;
        ft = (t / T) + (t % T ? 1 : 0);
        fa = (a / A) + (a % A ? 1 : 0);
        f = max(ft, fa);
        t = T * f;
        a = A * f;
    }
    cout << t + a << endl;
    return 0;
}


Measured memory_bytes: 256
def mmult(A, B):
    global mod
    n, m, l = len(A), len(B), len(B[0])
    ret = [[0]*l for _ in range(n)]
    for i in range(n):
        for j in range(m):
            for k in range(l):
                ret[i][k] = (ret[i][k]+A[i][j]*B[j][k])%mod
    return ret
def mpow(A, n):
    if n == 0: return [[1 if i == j else 0 for j in range(len(A))] for i in range(len(A))]
    if n % 2: return mmult(mpow(A, n-1), A)
    return mpow(mmult(A, A), n//2)

L, A, B, mod = map(int, input().split())
Y = [max((10**i-A+B-1)//B,0) for i in range(20)]
s = 0
for i in range(19):
    a, b, n = A+B*Y[i], B, max(min(L, Y[i+1])-Y[i], 0)
    M = [[10**(i+1), 0, 0], [1, 1, 0], [0, 1, 1]]
    s = mmult([[s,a,b]], mpow(M,n))[0][0]

print(s)

Measured memory_bytes: 3064
#include<stdio.h>

int selectionSort(int A[], int N) {
  int i, j, t, sw = 0, minj;
  for ( i = 0; i < N - 1; i++ ) {
    minj = i;
    for ( j = i; j < N; j++ ) {
      if ( A[j] < A[minj] ) minj = j;
    }
    t = A[i]; A[i] = A[minj]; A[minj] = t;
    if ( i != minj ) sw++;
  }
  return sw;
}

int main() {
  int A[100], N, i, sw;

  scanf("%d", &N);
  for ( i = 0; i < N; i++ ) scanf("%d", &A[i]);

  sw = selectionSort(A, N);

  for ( i = 0; i < N; i++ ) {
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", sw);

  return 0;
}


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

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

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

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

namespace MaxFlow{
	using CapType=int;
	const CapType inf=1145141919;
	struct Edge{
		int to,rev;
		CapType cap;
	};
	vector<vector<Edge>> g;
	vi itr,level;
	void Init(int n){
		g.assign(n,vector<Edge>());
		itr.assign(n,0);
		level.assign(n,0);
	}
	void AddEdge(int from,int to,CapType cap){
		g[from].PB({to,(int)g[to].size(),cap});
		g[to].PB({from,(int)g[from].size()-1,0});
	}
	void bfs(int s){
		fill(level.begin(),level.end(),-1);
		level[s]=0;
		queue<int> q;
		q.push(s);
		while(!q.empty()){
			int v=q.front();q.pop();
			for(auto e:g[v])if(e.cap>0&&level[e.to]==-1){
				level[e.to]=level[v]+1;
				q.push(e.to);
			}
		}
	}
	CapType dfs(int v,int t,CapType f){
		if(v==t)
			return f;
		for(int&i=itr[v];i<(int)g[v].size();i++){
			Edge& e=g[v][i];
			if(e.cap>0&&level[e.to]==level[v]+1){
				CapType d=dfs(e.to,t,min(f,e.cap));
				if(d>0){
					e.cap-=d;
					g[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	CapType Calc(int s,int t){
		CapType flow=0;
		while(1){
			bfs(s);
			if(level[t]==-1)
				return flow;
			fill(itr.begin(),itr.end(),0);
			CapType f;
			while((f=dfs(s,t,inf))>0)
				flow+=f;
		}
	}
}

signed main(){
	int h=read(),w=read();
	MaxFlow::Init(1+h+w+1);
	REP(i,h){
		string a=readString();
		REP(j,w){
			if(a[j]=='o')
				MaxFlow::AddEdge(1+i,1+h+j,1),
				MaxFlow::AddEdge(1+h+j,1+i,1);
			else if(a[j]=='S')
				MaxFlow::AddEdge(0,1+i,MaxFlow::inf),
				MaxFlow::AddEdge(0,1+h+j,MaxFlow::inf);
			else if(a[j]=='T')
				MaxFlow::AddEdge(1+i,1+h+w,MaxFlow::inf),
				MaxFlow::AddEdge(1+h+j,1+h+w,MaxFlow::inf);
		}
	}
	int k=MaxFlow::Calc(0,1+h+w);
	if(k>h*w)k=-1;
	cout<<k<<endl;
}

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

int main() {
  int sum = 0, mx = 0;
  for (int i; cin >> i;) sum += ((i - 1) / 10 + 1) * 10, mx = max(mx, (10 - i % 10) % 10);
  cout << sum - mx << "\n";
}

Measured memory_bytes: 256
W,H,N = map(int, input().split())
xya = []
for i in range(N):
  xya.append(list(map(int, input().split())))

xy = [[0,W],[0,H]]
for i in range(N):
  x,y,a = xya[i]
  if a == 1:
    xy[0][0] = max(xy[0][0],x)
  elif a == 2:
    xy[0][1] = min(xy[0][1],x)
  elif a == 3:
    xy[1][0] = max(xy[1][0],y)
  else:
    xy[1][1] = min(xy[1][1],y)

if xy[0][0]<xy[0][1] and xy[1][0]<xy[1][1]:
  print((xy[0][1]-xy[0][0])*(xy[1][1]-xy[1][0]))
else:
  print(0)



Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
	int A=0,i,b=0,x=0;
	char S[101];
	scanf("%d%s",&A,S);
	for(i=1;i<=A;i++){
		if(S[i-1] == 'I'){
			b += 1;
		}
		else if(S[i-1]=='D'){
			b = b-1;
		}
		else{
		}
		if(x<=b){
			x=b;
		}
		else{
		}

	}
	printf("%d",x);
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void) {
	int x, y, z,i;
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
	int W, H,r;
	scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
	if (x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H) {
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PA pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e16+7;
const ll MOD=1e9+7;


//無向グラフ
// http://kagamiz.hatenablog.com/entry/2013/10/05/005213
struct Articulation_point_and_Bridge{
int V,E=0;
vector< vector<int> > G;
vector<int> ord,low;
vector<bool> vis;
vector< pair<int, int> > bridge;
vector<int> articulation;
Articulation_point_and_Bridge(int V_){
	V=V_;
	G.resize(V);
	ord.resize(V,0);
	low.resize(V,0);
	vis.resize(V,false);
}
void dfs(int v, int p, int &k){
	vis[v] = true;
	ord[v] = k++;
	low[v] = ord[v];
	bool isArticulation = false;
	int ct = 0;
	for (int i = 0; i < G[v].size(); i++){
		if (!vis[G[v][i]]){
			ct++;
			dfs(G[v][i], v, k);
			low[v] = min(low[v], low[G[v][i]]);
			if (~p && ord[v] <= low[G[v][i]]) isArticulation = true;
			if (ord[v] < low[G[v][i]]) bridge.push_back(make_pair(min(v, G[v][i]), max(v, G[v][i])));
		}
		else if (G[v][i] != p){
			low[v] = min(low[v], ord[G[v][i]]);
		}
	}
	
	if (p == -1 && ct > 1) isArticulation = true;
	if (isArticulation) articulation.push_back(v);
}
void add_edge(int v1,int v2){
	G[v1].push_back(v2);
	G[v2].push_back(v1);
	E++;
}
void calc(){
	int k=0;
	for(int i=0;i<V;i++){
		if(!vis[i])dfs(i,-1,k);
	}
	sort(bridge.begin(), bridge.end());
	sort(articulation.begin(), articulation.end());
}

};

int main(){
	int n,m;
	cin >> n >> m;
	Articulation_point_and_Bridge apb(n);
	FOR(i,0,m){
		int a,b;
		cin >> a >> b;
		apb.add_edge(a,b);
	}
	apb.calc();
	for(auto x:apb.articulation){
		cout << x << endl;
	}
}


Measured memory_bytes: 4576
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=998244353;
const llint moe=992186091;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int W,H;char c;cin>>W>>H>>c;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			bool t=(i==0||i+1==H);
			bool y=(j==0||j+1==W);
			cout<<(t?(y?'+':'-'):(y?'|':(((H-1)/2==i&&(W-1)/2==j)?c:'.')));
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3228
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
  int x, y;
  cin >> x >> y;
  if (2 * x <= y && 4 * x >= y && y % 2 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main()
{
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if((a+b) == (c+d))
		cout << "Balanced\n";
	else{
		cout << ((a+b) > (c+d) ? "Left\n" : "Right\n");
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int a,b;
    cin>>a>>b;
    set<int> s;
    s.insert(1);
    s.insert(2);
    s.insert(3);
    s.erase(a);
    s.erase(b);
    cout<<*s.begin();    
}

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

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()


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

  int n;
  cin >> n;
  int ret = -1;
  for(int i = 1;i <= n;i++){
    double x = 1.08 * i;
    if(n <= x && x < n+1) ret = i;
  }
  if(ret == -1){
    cout << ":(" << endl;
  }else{
    cout << ret << endl;
  }
}


Measured memory_bytes: 256
/**************** 最強のインクルード ****************/
#include <bits/stdc++.h>

/**************** 名前空間・型省略 ****************/
using namespace std;
typedef long long LL;

/**************** 省略記法 ****************/
#define INF 1e9
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i##_len=(n), i=(i##_len-1); i>=0; ++i)
#define FOR(i,m,n) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define sizei(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define printvector(x) rep(i,sizei(x)){cout << x[i] << endl;}
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; }

/**************** mod付き四則演算 ****************/
// mod関数のオーバーヘッドが重いかも
// TODO: 二項係数、離散対数、平方剰余の実装
#define MOD 1000000007
inline LL mod(LL const &a) { return (a % MOD + MOD) % MOD; }
inline LL madd(LL const &a, LL const &b) { return mod(mod(a) + mod(b)); }
inline LL msub(LL const &a, LL const &b) { return mod(mod(a) - mod(b)); }
inline LL mmul(LL const &a, LL const &b) { return mod(mod(a) * mod(b)); }
inline LL mpow(LL a, LL b) {
  LL r = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) (r *= a) %= MOD;
    (a *= a) %= MOD;
  }
  return r;
}
inline LL minv(LL const &a) { return mpow(a, MOD-2); }
inline LL mdiv(LL const &a, LL const &b) { return mod(mod(a) * minv(b)); }

/**************** デバッグ用 ****************/
#ifdef LOCAL
    #define eprint(...) fprintf(stderr, __VA_ARGS__)
    #define eprintvector(x) printvector(x)
#else
    #define eprint(...) 42
    #define eprintvector(x) 42
#endif

/**************** 便利な関数 ****************/
// 文字列の分割
vector<string> split_impl(string &&s, regex &&r) { return { sregex_token_iterator{s.begin(), s.end(), r, -1}, sregex_token_iterator{} }; }
auto split(string s, string pattern) { return split_impl(move(s), regex{pattern}); }


/**************** main ****************/
#define white '.'
#define black '#'

int main(void)
{
    LL N;
    string S;

    cin >> N >> S;

    int wc = 0, bc = 0;
    rep(i, N) {
        if (S[i] == white) {
            wc ++;
        }
    }
    
    int res = wc + bc;

    rep(i, N) {
        if (S[i] == black) {
            bc ++;
        }
        else {
            wc --;
        }
        chmin(res, wc + bc);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 640
import sys
input = sys.stdin.readline
n,a,b = map(int,input().split())
h = [int(input()) for i in range(n)]
t = a-b
r = (max(h)+b-1)//b
l = 0
while r-l > 1:
    m = (r+l)//2
    mi = m*b
    count = 0
    for i in h:
        if i > mi:
            count += (i-mi+t-1)//t
    if count <= m:
        r = m
    else:
        l = m
print(r)

Measured memory_bytes: 44124
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	bool fw=true;
	string S; cin>>S;
	int Q; cin>>Q;
	deque<char> dq;
	for (auto ch : S)
		dq.push_back(ch);
	int T;
	while(Q--) {
		int T; cin>>T;
		if(T==1) {
			if(fw) fw=false;
			else fw=true;
		} else {
			int F; cin>>F;
			char C; cin>>C;
			if(F==1) {
				if(fw) dq.push_front(C);
				else dq.push_back(C);
			} else {
				if(fw) dq.push_back(C);
				else dq.push_front(C);
			}
		}
	}
	if(fw) {
		while(!dq.empty())
			cout<<dq.front(), dq.pop_front();
	} else {
		while(!dq.empty())
			cout<<dq.back(), dq.pop_back();
	}
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 976
n,m=map(int,input().split())
x=[0]+list(map(int,input().split()))
y=[0]+list(map(int,input().split()))
mod=10**9+7
a1,a2=0,0
for k in range(1,n+1):
  a1+=(k*2-n-1)*x[k]
for k in range(1,m+1):
  a2+=(k*2-m-1)*y[k]
print((a1*a2)%mod)

Measured memory_bytes: 83812
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b, c, k, t=0;
	cin >> a >> b >> c;
	while (a>=b) b*=2, t++;
	while (b>=c) c*=2, t++;
	cin >> k;
	if (k>=t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0; 
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>

using namespace std;

int main(){
	int i,m,h;
	string str;
	while(1){
		cin >> str;
		if(str=="-") break;
		cin >> m;
		for(i=0;i<m;i++){
			cin >> h;
			string right = str.substr(0,h);
			string left = str.substr(h);
			str = left + right;
		}
		cout << str << endl;
	}
	return 0;
}

Measured memory_bytes: 3164
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  string S;
  cin >> S;
  if (S.size() == 2) {
    cout << S << endl;
  } else {
    cout << S[2] << S[1] << S[0] << endl;
  }
  return 0;
}


Measured memory_bytes: 256