akhauriyash/Code-Regression huggingface dataset:
/**
 * Author : RDP
 * There are no two words in the English language more harmful than "good job".
 * 1729 ;)
**/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <numeric>
using namespace std;
using ll = long long;
#define endl '\n'
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) 
{
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define FAST_IO ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
#define bp(x) __builtin_popcount(x)
#define zf(x) __builtin_clz(x)
#define zl(x) __builtin_ctz(x)
#define par(x) __bultin_parity(x)
#define all(x) (x).begin(), (x).end()
/* **************************************************************************************** */
const ll MOD = 1e9 + 7;
void test_case()
{
    int n;
    cin >> n;
    vector <ll> a(n);
    for(ll &x : a) cin >> x;
    vector <ll> prefix(n + 1);
    prefix[0] = 0;
    for(int i = 1; i <= n; i ++)
    {
        prefix[i] = (prefix[i - 1] + a[i - 1]) % MOD;
    }

    ll ans = 0;
    for(int i = 1; i < n; i ++)
    {
        ll add = (prefix[n] - prefix[i] + MOD ) % MOD;
        add = (add * a[i - 1]) % MOD;
        ans = (ans + add ) % MOD;
    }

    cout << ans << endl;
}
int main()
{
	FAST_IO
    int t = 1;
    //cin >> t;
    while(t--)
        test_case();
	return 0;
}

Measured memory_bytes: 6348
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <random>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0)
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n;
lli a[100001];
int main() {
  cin >> n; read_n(a, n);
  sort(&a[0], &a[n]);
  lli size = 0, ans = 0;
  for (lli i=0; i<n; ++i) {
    if (size*2 >= a[i]) {
      ++ans;
    } else {
      ans = 1;
    }
    size += a[i];
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1024
import java.io.PrintWriter

fun main() {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val n = readInteger() % 10
    val ans = when (n) {
        2, 4, 5, 7, 9 -> "hon"
        0, 1, 6, 8 -> "pon"
        else -> "bon"
    }
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 34496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = 100005;
int n, m, k;
vector<int> fr[N], bl[N];
int cc[N], sz[N];
bool vis[N];

void dfs(int u, int c) {
	vis[u] = 1;
	cc[u] = c;
	sz[c]++;
	for(auto& v : fr[u]) {
		if(!vis[v])
			dfs(v, c);
	}
}

int main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cin >> n >> m >> k;
	for(int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		fr[a].push_back(b);
		fr[b].push_back(a);
	}
	for(int i = 0; i < k; i++) {
		int a, b; cin >> a >> b;
		bl[a].push_back(b);
		bl[b].push_back(a);
	}

	int idx = 0;
	memset(vis, 0, sizeof vis);
	memset(sz, 0, sizeof sz);
	for(int i = 1; i <= n; i++) {
		if(!vis[i])
			dfs(i, ++idx);
	}

	for(int i = 1; i <= n; i++) {
		int ans = sz[cc[i]] - fr[i].size() - 1;
		for(auto& v : bl[i]) {
			if(cc[v] == cc[i]) ans--;
		}
		cout << ans << " ";
	}
	cout << '\n';

	return 0;
}

Measured memory_bytes: 12672
#include <iostream>
#include <vector>


int main() {

	int N, M;
	std::cin >> N >> M;
	std::vector<int> poll;

	int total = 0;

	for (int i = 0; i < N; i++) {
		int buffer;
		std::cin >> buffer;
		poll.push_back(buffer);
		total += buffer;
	}

	int count = 0;

	for (int i : poll) {
		if (i * 4 * M >= total) {
			count++;
		}
		if (count == M) {
			std::cout << "Yes";
			return 0;
		}
	}

	std::cout << "No";

}


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

int a[1000];
int n;

void dfs(int step, int x) {
    if (step == n) {
        for (int i = 0; i < n; i++) {
            cout << char('a' + a[i]);
        }
        cout << endl;
        return;
    }
    for (int i = 0; i <= x + 1; i++) {
        a[step] = i;
        dfs(step + 1, max(x, i));
    }
}

int main(void) {
    cin >> n;
    
    dfs(1, 0);
    return 0;
}


Measured memory_bytes: 1536
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

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

long long int f(int n){
	int sum;

	if(n==0||n==1){
		return 1;
	}else{
			return n*f(n-1);
	}
}

int main(){
	ios::sync_with_stdio(false);

	int n;

	scanf("%d", &n);

	printf("%lld\n", f(n));
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll mod=1e9+7;
vector<vector<ll>> gr(1e5+2);
vector<vector<ll>> dp(1e5+2,vector<ll>(2,-1));
ll solve(int node,bool x,int p)
{
  if(dp[node][x]!=-1)
  return dp[node][x];
  ll ans=1,ans2=1;
  if(gr[node].size()==1&&p==gr[node][0])
  return dp[node][x]=(x==0?2:1);
  for(int z: gr[node])
  {
    if(z==p)
    continue;
    if(x)
    ans=(ans*solve(z,0,node))%mod;
    else
    {
      ans=(ans*solve(z,0,node))%mod;
      ans2=(ans2*solve(z,1,node))%mod;
    }
  }
  if(x)
  return dp[node][x]=(ans%mod);

  return dp[node][x]=((ans+ans2)%mod);
} 
int main()
{
  int n;
  cin>>n;
  for(int i=1;i<n;i++)
  {
     int x,y;
     cin>>x>>y;
     gr[x].push_back(y);
     gr[y].push_back(x);
  }
  ll ans=(solve(1,0,-1)%mod);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 22352
#include <bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
const int INF = 1000100100;

int main(){
    ll n,k,q,x,a[100005];
    cin>>n>>k>>q;
    rep(i,n){
        a[i]=k-q;
    }
    rep(i,q){
        cin>>x;
        a[x-1]++;
    }
    rep(i,n){
        if(a[i]>0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

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

signed main(){
	int n;
	int maxw;
	cin>>n>>maxw;
	vector<long long > dp(maxw+1,0);
	for(int i = 0 ; i < n ;i++){
		int w;
		int val;
		cin>>w>>val;
		for(int i = maxw ; i >=w ; i--){
			dp[i] = max( dp[i] , dp[i - w] + val);
		}
	}
	cout<<dp[maxw];
	return 0;
}

Measured memory_bytes: 1024
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    ans = {i: 0 for i in range(1, n + 1)}
    for a in a_list:
        ans[a] += 1
    for k in ans.values():
        print(k)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38788
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int N; cin >> N;
    Int maxA = LLONG_MIN;
    Int minA = LLONG_MAX;

    rep(i, 0, N) {
        Int A; cin >> A;
        maxA = max(maxA, A);
        minA = min(minA, A);
    }

    cout << abs(maxA-minA) << endl;
}


Measured memory_bytes: 256
/*
                    Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
            
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
        int result=1;
        while(n>0)
        {   if(n % 2 ==1)
            result=(result * x) % M;
            x=(x*x)% M;
            n=n/2;
        }
    return result % M;
    }     
signed main()
{   jaldi
    int x,n;
    cin>>x>>n;
    int a,i,sum=0;
    for(i=0;i<n;i++)
    {   cin>>a;
        sum+=a;
    }
    if(sum>=x)
    cout<<"Yes";
    else
    cout<<"No";    
}

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

int main(){
  int N;
  cin >> N;
  string s = "No";
  for(int i = 1; i < 10; i++)
    for(int j = 1; j < 10; j++)
      if(N == i*j) s = "Yes";
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
A, B, C, D = [int(i) for i in input().split()]

ans = ""
while True:
  C = C - B
  if C <= 0:
    ans = "Yes"
    break
  A = A - D
  if A <= 0:
    ans = "No"
    break

print(ans)
  

    
    
    
    

Measured memory_bytes: 9168
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        // 主処理
        int result = n / 3;

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 21844
#include<iostream>
using namespace std;
#define ll long long
int has[110];
int a[110];
int main()
{
	int n, k, t;
	cin >> n >> k;

	for (int i = 0; i < k; i++)
	{
		cin >> t;
		for (int j = 0; j < t; j++) {
			int tt;
			cin >> tt;
			has[tt]++;
		}
	}int ans = 0;
	for (int i = 1; i <= n; i++)
		if (has[i] == 0)ans++;
	cout << ans;
}

Measured memory_bytes: 3632
<?php

fscanf(STDIN, '%d %d', $A, $B);

$ans = 0;
if($A >= $B){
    $ans += $A;
    $A--;
}else{
    $ans += $B;
    $B--;
}

if($A >= $B){
    $ans += $A;
    $A--;
}else{
    $ans += $B;
    $B--;
}


echo  $ans. PHP_EOL;

Measured memory_bytes: 4728
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N, M, R;
	int ans = INF32;
	cin >> N >> M >> R;

	vector<int> target(R);
	vector<vector<int>> grid(N, vector<int>(N, INF32));

	for (int i = 0; i < R; i++)
	{
		cin >> target[i];
		target[i]--;
	}

	sort(all(target));

	for (int i = 0; i < M; i++)
	{
		int from, to, dis;
		cin >> from >> to >> dis;
		from--;
		to--;
		grid[from][to] = dis;
		grid[to][from] = dis;
	}

	for (int i = 0; i < N; i++)
	{
		grid[i][i] = 0;
	}

	for (int k = 0; k < N; k++)
	{
		for (int i = 0; i < N; i++)
		{
			for (int j = 0; j < N; j++)
			{
				grid[i][j] = min(grid[i][j], grid[i][k] + grid[k][j]);
			}
		}
	}

	do
	{
		int sum_dis = 0;

		for (int i = 0; i + 1 < R; i++)
		{
			sum_dis += grid[target[i]][target[i + 1]];
		}

		ans = min(ans, sum_dis);

	} while (next_permutation(all(target)));
	cout << ans << endl;
	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

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

using namespace std;

int main(void)
{
	int h, w;
	cin >> h >> w;
	string s;
	for (int i = 0; i < h; i++) {
		cin >> s;
		cout << s << endl;
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int N, M, K;
    cin>> N >> M >> K;
    vi A(N), B(M);
    REP(i, 0, N) cin >> A[i];
    REP(i, 0, M) cin >> B[i];
    vl cur_A(N+1), cur_B(M+1); 
    REP(i, 0, N) cur_A[i+1] = cur_A[i] + A[i];
    REP(i, 0, M) cur_B[i+1] = cur_B[i] + B[i];
    int ind_B = M;
    int ans = 0;
    REP(i, 0, N+1){
        if(cur_A[i] > K) break;
        while(cur_B[ind_B] + cur_A[i] > K){
            ind_B--;
        }
        ans = max(ans, ind_B + i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 8008
#include <cstdio>
#include <iostream>
#include <vector>

int main() {
  using namespace std;

  int n;
  cin >> n;

  vector<int> h(n+1, 0);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }

  int watering_times = 0;
  for (int i = 0; i < n; i++) {
    while(h[i]) {
      watering_times++;
      h[i]--;
      int j = i+1;
      while(h[j]) {
        h[j++]--;
      }
    }
  }

  cout << watering_times << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}




int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    map<int,int>m;
    int cnt=1;
    for(int i=s.length()-1;i>=0;i--){
        if(i==s.length()-1)m[i]=cnt;
        else{
            if(s[i]==s[i+1]){cnt++;m[i]=cnt;}
            else{m[i]=1;cnt=1;}
        }
    }
    int res=0;
    for(int i=0;i<s.length();i++){
        res+=(m[i]-1);
        i=i+m[i]-1;
    }
    if(k==0){cout<<res<<endl;return 0;}
    if(s[n-1]=='R'){
        int special=-1;
        vector<int>ans;
        for(int i=0;i<n;i++){
            if(s[i]!='R'){
                if(i==0){special=m[i];i=i+m[i]-1;continue;}
                ans.push_back(m[i]);
                i+=m[i];
                i--;
            }
        }
        sort(ans.rbegin(),ans.rend());
        int a=ans.size();
        for(int i=0;i<min(a,k);i++){
            res+=2;
        }
        if((k>ans.size())&&(special!=-1)){res+=1;}
        cout<<res<<endl;
    }
    else{
        vector<int>ans;
        int special=-1;
        for(int i=0;i<n;i++){
            if(s[i]!='L'){
                if(i==0){special=m[i];i=i+m[i]-1;continue;}
                ans.push_back(m[i]);
                i+=m[i];
                i--;
            }
        }
        sort(ans.rbegin(),ans.rend());
        int a=ans.size();
        for(int i=0;i<min(a,k);i++){
            res+=2;
        }
        if((k>ans.size())&&(special!=-1)){res+=1;}

        cout<<res<<endl;
    }
    return 0;
    }


Measured memory_bytes: 5456
n, x = (list)(map(int, input().split()))

patty = []
patty.append(1)

lay = []
lay.append(1)

for i in range(n):
    patty.append(patty[i]*2+1)
    lay.append(lay[i]*2+3)


# print(patty)
# print(lay)

c = 0

for i in reversed(range(n+1)):
 #   print("i,x,c=", i, x, c)
    if x == lay[i]:
      #      print("i")
        c += patty[i]
        break

    elif x == lay[i-1]+2:  # ちょうど半分の時
       #     print("elif1")
        c += patty[i-1]+1
        break
    elif x < lay[i-1]+2:  # 半分より小さい時
        #    print("elif2")
        x = x-1
    else:  # 半分より大きい時
     #   print("el")
        x = x-2-lay[i-1]
        c += patty[i-1]+1

print(c)


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()




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

	string n;
	cin >> n;

	int x = 0;
	for (char c: n) {
		x *= 10;
		x += c - '0';
		x %= 9;
	}
	cout << (x == 0 ? "Yes" : "No") << endl;


	return 0;
}


Measured memory_bytes: 3780
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cstring>
#define INF 1<<28
#define F first
#define S second
using namespace std;

int sx, sy, gx, gy;
typedef pair < int, int > P;
vector < P > p[5];
int memo[5][5][1111];

int dist(int k, P a, P b){
  if(!k) return abs(sx-p[b.F][b.S].F) + abs(sy-p[b.F][b.S].S);
  return abs(p[a.F][a.S].F-p[b.F][b.S].F) + abs(p[a.F][a.S].S-p[b.F][b.S].S);
}

int solve(int k, P q){

  if(k == 4) return abs(p[q.F][q.S].F-gx) + abs(p[q.F][q.S].S-gy);
  if(memo[k][q.F][q.S]) return memo[k][q.F][q.S];

  int ans = INF, d = (q.F+1)%5;
  for(int i=0;i<p[d].size();i++) ans = min(ans, solve(k+1, P(d,i)) + dist(k, P(q.F,q.S), P(d,i)));

  return memo[k][q.F][q.S] = ans;
}

int main(){

  int w,h;
  char c;

  while(true){
    cin >> w >> h;
    if(!w && !h) break;

    for(int i=0;i<5;i++) p[i].clear();
    
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin >> c;
	if(c == 'S') sx = j, sy = i;
	if(c == 'G') gx = j, gy = i;
	else if(c != '.') p[c-'1'].push_back(P(j,i));
      }
    }
    
    P q = P(0,INF);
    for(int i=0;i<5;i++){
      memset(memo, 0, sizeof(memo));
      if(q.S > solve(0,P(i,0))) q.F = i+1, q.S = solve(0,P(i,0));
    }

    if(q.S == INF) cout << "NA\n";
    else cout << q.F << " " << q.S << endl;

  }
}

Measured memory_bytes: 1372
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;
map<string,int> ma;
signed main(){
  int n;cin>>n;
  rep(i,n){
    string s;cin>>s;
    ma[s]++;
  }
  cout<<"AC x "<<ma["AC"]<<endl;
  cout<<"WA x "<<ma["WA"]<<endl;
  cout<<"TLE x "<<ma["TLE"]<<endl;
  cout<<"RE x "<<ma["RE"]<<endl;
  
  return 0;
}

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

A = list(map(int, input().split()))

Asum = 0
A_sum = []

for i in range(N):
    Asum += A[i]
    A_sum.append(Asum)

for i in range(N):
    A_sum[i] = 2*A_sum[i] - Asum
    if A_sum[i] < 0:
        A_sum[i] = -1 * A_sum[i]

print(min(A_sum))

Measured memory_bytes: 26764
#include <iostream>

using namespace std;

int main(){
    long long a, b, c;
    cin >> a >> b >> c;

    if ( (c - a - b) > 2){
        if (4*a*b < (c-a-b) * (c-a-b)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}



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

int main()
{

	int c1, c5, c10, c50, c100, c500;

	cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;

	if( c1 * 1 + c5 * 5 + c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500 >= 1000 ) cout << 1 << endl;
	else cout << 0 << endl;

	return 0;

}

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

int main()
{
    int n, i, a, o = 0;
    cin >> n;
    for(i = 0; i < n; i++)
    {
        cin >> a;
        if(a&1)
            o++;
    }

    cout << (o%2 == 0? "YES" : "NO");
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

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

  pair<int,int> ab[n];
  rep(i,n){
    int a,b;cin>>a>>b;
    ab[i] = make_pair(a,b);
  }

  pair<int,int> cd[m];
  rep(i,m){
    int c,d;cin>>c>>d;
    cd[i] = make_pair(c,d);
  }

  rep(i,n){
    int d = 1e9;
    int result = 1;
    rep(j,m){
      int td = abs(ab[i].first - cd[j].first) + abs(ab[i].second-cd[j].second);
      if(d>td){
        d=td;
        result = j+1;
      }
    }
    cout<<result<<endl;
  }
  return 0;
}

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

int N;
int X;
int mini = 1000;
int sum = 0;
int ans;

int main(){
  cin >> N >> X;
  int A[N];
  for (int i=0; i < N ; ++i) cin >> A[i];
  for (int i=0; i < N ; ++i) {
   sum += A[i];
	if ( A[i] <= mini ) mini = A[i];
  }
  ans = N + (X-sum)/mini;
  cout << ans <<endl;
}
  

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

using namespace std;

int main() {
  int n, k, s;
  cin >> n >> k >> s;

  for (int i = 0; i < n; ++i) {
    if (i < k) {
      cout << s;
    } else {
      cout << (s == (int)1e9 ? (int)(1e9 - 1): s + 1);
    }
    if (i < n - 1) cout << " ";
    else puts("");
  }
  return 0;
}



Measured memory_bytes: 1280
#include<stdio.h>
int main(){
int W,H,x,y,r;

scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0)
 printf("Yes\n");
else
 printf("No\n");

return 0;

}

Measured memory_bytes: 584
# ??????????????¢??¨????????????, ????????¢???
def plus(a, b):
    return a + b


def minus(a, b):
    return abs(a - b)


def distance(x1, y1, x2, y2):
    r2 = (x1 - x2)**2 + (y1 - y2)**2
    return pow(r2, 0.5)


def flag(l):
    rp = plus(l[2], l[5])
    rm = minus(l[2], l[5])
    d = distance(l[0], l[1], l[3], l[4])
    if rp < d:
        return 0
    elif d < rm:
        if l[5] < l[2]:
            return 2
        else:
            return -2
    else:
        return 1


N = int(input())
for i in range(N):
    a = list(map(float, input().split()))
    print(flag(a))

Measured memory_bytes: 7684
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll a,b;
  cin>>a>>b;
  vector<ll>va(a,0);
  vector<ll>vb(b,0);
  for(ll i=0;i<a;i++){
    cin>>va[i];
  }
  for(ll i=0;i<b;i++){
    cin>>vb[i];
  }
  ll ans=0;
  ll i,j;
  i=j=0;
  while(i<b&&j<b){
    ll t=0;
    for(ll k=0;k<a&&i+t<=j;k++){
      if(va[k]==vb[i+t])t++;
    }
    if(i+t-1==j){
      ans=max(ans,t);
      j++;
    }
    else if(i==j){
      i++;
      j++;
    }
    else i++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


vector< vector<int> >
bfs(vector<string> &st,int sy,int sx,char wall,int dir){
  int h=st.size(),w=st.front().size();
  vector<vector<int> > dp(h,vector<int>(w,-1));
  using P = pair<int, int>;
  queue<P> qu;

  dp[sy][sx]=0;
  qu.emplace(sy,sx);

  int dy[]={1,-1,0,0,1,1,-1,-1};
  int dx[]={0,0,1,-1,1,-1,1,-1};
  auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;};

  while(!qu.empty()){
    int y,x;
    tie(y,x)=qu.front();qu.pop();
    for(int k=0;k<dir;k++){
      int ny=y+dy[k],nx=x+dx[k];
      if(!in(ny,nx)||st[ny][nx]==wall) continue;
      if(~dp[ny][nx]) continue;
      dp[ny][nx]=dp[y][x]+1;
      qu.emplace(ny,nx);
    }
  }

  return dp;
}

//INSERT ABOVE HERE
signed main(){
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> st(h);
  for(int i=0;i<h;i++) cin>>st[i];
  int sy=-1,sx=-1;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(st[i][j]=='S') sy=i,sx=j;
  auto dp=bfs(st,sy,sx,'#',4);

  int ans=h*w;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(0<=dp[i][j]&&dp[i][j]<=k)
        chmin(ans,1+(min({i,h-(i+1),j,w-(j+1)})+k-1)/k);

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>

#include <iostream>

using namespace std;


int main(){
	int A,B,result=0;
	char op;
 cin >>A>>op>>B;
 
	switch (op){
		case '+' :
	result=A+B;
	break ;
	
	case '-':
	result=A-B;
	break ;
	default:
		printf("enter valid operator");
	}
	
	printf("%d", result);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int N = 1e6 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const long long LINF = 1e18 + 3141;
int n;
int dv[N + 1];
void solve(){
    cin >> n;
    ll ans = 0;
    for(int i = 1; i < n; ++i) {
        int cur = n - i;
        // cout << cur << " " << dv[cur] << '\n';
        ans += dv[cur];
    }
    cout << ans;
}
 
int main(){
    speed();
    int t = 1;
    for(int i = 1; i <= N; ++i) {
        for(int j = i; j <= N; j += i)
            ++dv[j];
    }
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 7552
# coding: utf-8
n = int(input())
members = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] #j = 0 S, j = 1 H, j = 2 C, j = 3 D
for i in range(n):
    line = input().rstrip().split()
    members[int(line[0])-1][int(line[1])-1][int(line[2])-1] += int(line[3])

for i in range(4):
    for j in range(3):
        for k in range(10):
            if k < 9:
                print(" " + str(members[i][j][k]), end="")
            else:
                print(" " + str(members[i][j][k]))
    if i < 3:
        print("####################")


Measured memory_bytes: 5624
#include<bits/stdc++.h>
#define ll long long
#define MAXN 200005
#define INF 0x3f3f3f3f
#define ld long double
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    #define int ll
    int n;
    cin>>n;
    int a=100;
    int ans=0;
    for(int i=1;i<4000;i++){
        int tp=a/100;
        a+=tp;
        if(a>=n){
            ans=i;break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }



int main() {
	int n;
	cin >> n;
	vector<int> z(n+1);
	FOR(i,2,n+1) {
		int a;
		cin >> a;
		z[a]++;
	}
	FOR(i, 1, n + 1) {
		cout << z[i] << endl;
	}
}




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

int main(){
    int N,M;
    cin >> N >> M;
    int A[M];
    int sum=0;

    for(int i=0;i<M;i++) {
        cin >> A[i];
        sum += A[i];
    }
    if(sum<=N) cout << N-sum << endl;
    else cout << -1 << endl;

}

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <ctime>
#include <queue>
#include <sstream>
#include <utility>
#include <bitset>

using namespace std;

#define MP make_pair 
#define PB push_back 
#define INF (1000000007) 
#define eps 1e-8
#define MOD (1000000007)

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

int n,k;
int a[100005],g,ma;

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

int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		ma=max(ma,a[i]);
		if(i==1) g=a[i];
		else g=gcd(g,a[i]);
	}
	if(k%g==0 && ma>=k) cout<<"POSSIBLE";
	else cout<<"IMPOSSIBLE";
	return 0;
}

Measured memory_bytes: 640
// Problem : D - Recording
// Contest : AtCoder - AtCoder Beginner Contest 080
// URL : https://atcoder.jp/contests/abc080/tasks/abc080_d
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
	int n,c;cin>>n>>c;
	map<int,int> mp;
	vector<pii> v[c+1];
	for(int i=0;i<n;i++)
	{
		int s,e,ch;
		cin>>s>>e>>ch;
		v[ch].pb({s,e});
	}
	for(int i=1;i<=c;i++)
	sort(all(v[i]));
	for(int i=1;i<=c;i++)
	{
		if(size(v[i]))
		{
			vp vt;
			int st=v[i][0].f,e=v[i][0].se;
			for(int j=1;j<size(v[i]);j++)
			{
				if(v[i][j].f==e)
				{
					e=v[i][j].se;
				}
				else
				{
					vt.pb({st,e});
					st=v[i][j].f;
					e=v[i][j].se;
				}
			}
			vt.pb({st,e});
			v[i]=vt;
		}
	}
	for(int i=1;i<=c;i++)
	{
		for(pii p:v[i])
		mp[p.f]++,mp[p.se+1]--;
	}
	int ans=0;
	int sum=0;
	for(pii p:mp)
	{
		//cout<<p.f<<" "<<p.se<<"\n";
		sum+=p.se;
		ans=max2(ans,sum);
	}
	cout<<ans;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 10988
#include<stdio.h>
#include<iostream>
using namespace std;
typedef long long ll;

void f(ll n)
{
    ll c,m;
    for(ll i=1;i<=3500;i++){
    	for(ll j=1;j<=3500;j++){
            c=n*i*j;
            m=4*i*j-n*i-n*j;
            if(m>0 && c%m==0){
            	printf("%lld %lld %lld",i,j,c/m);
            	return ;
			}
        }
	}
}

int main()
{
	ll n;
    cin>>n;
    if(n%2==0)printf("%lld %lld %lld",n,n,n/2);
	else if(n%3==0)printf("%lld %lld %lld",n,n/3*2,n/3*2);
    else if((n-3)%4==0)printf("%lld %lld %lld",(n+1)/4,(n+1)*(n+1)/4,(n+1)*(n+1)*n/4);
    else if((n-1)%4==0)f(n);
    return 0;
}

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

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <map>
#include <queue>
#define mp make_pair
#define pb push_back
#define p push
#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long
#define abs(x) (x<0 ? (-x) : x)
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d %d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld %lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define SIZE 1000000007

using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef vector<long long> vl;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long,long long>> vpl;
typedef vector<vector<pair<long long,long long>>> vvpl;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef pair <ll,ll> pll;
const  double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
/*ios_base::sync_with_stdio(false);cin.tie(0);*/

ll gcd(ll n,ll m){
    if (n==0)return m;
    return gcd(m%n,n) ;
}

long long fast_exp(long long n,long long k){
    if(k == 0)
        return 1;
    if(k==1)
        return n;

    long long temp = fast_exp(n,k>>1);

    if((k&1)==1)
        return (n*temp*temp)%SIZE;
    return (temp*temp)%SIZE;

}

int main() {
   ll n ;
   cin >>n;
   vl vec(n);
   vl vec2(n);
    for (ll i = 0; i <n-1 ; ++i) {
        cin>>vec2[i];
        //cout << vec2[i];
    }
    vec[0]= vec2[0];
    vec[n-1]=vec2[n-2];

    for (ll i = 1; i <n-1 ; ++i) {
        vec[i]=min(vec2[i-1],vec2[i]);
    }
    ll res =0;
    for (ll j = 0; j <n ; ++j) {
        res+=vec[j];
        //cout << vec[j]<<"\n";
    }
    cout << res;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

int main() {
 
  int x[5];
  for(int i=0; i<5; i++) std::cin >> x[i];
  
  for(int i=0; i<5; i++) {
    if(x[i] == 0) std::cout << i + 1 << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 3524
#include<stdio.h>

int main(){ 
	int a[10];
	int i,j,t=0;
	for(i=0;i<10;i++)
		scanf("%d",&a[i]);
	for(i=0;i<9;i++)
	{
		for(j=0;j<9-i;j++)
		{	
			if(a[j]<a[j+1])
				{	
					t=a[j];
					a[j]=a[j+1];
					a[j+1]=t;
				}
		}

	}

	for(i=0;i<3;i++)
	{
		printf("%d\n",a[i]);
	}
    return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loop2(num) for (lli j = 0 ; j < num ; j ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back ()
#define pof pop_front ()

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main ()
{
    fastio
    ll a []={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51} ;
    ll x ; cin >> x ;
    cout << a[x - 1] << endl ;
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 long long int n;
  cin>>n;
  long long int A[n];
  for(long long int i=0;i<n;i++)
    cin>>A[i];
  long long int ctr=0;
  long long int max=0;
  for(long long int i=0;i<n;i++)
  {
    if(A[i]>=A[i+1])
      ctr++;
    else
    {
      if(max<ctr)
        max=ctr;
      ctr=0;
    }
  }
  
  cout<<max;
  
}

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

int main() {
  int a, b, ans = 1;

  cin >> a >> b;

  if (b == 1) {
    cout << 0;
    return 0;
  }

  b -= a;
  a--;

  while (0 < b) {
    b -= a;
    ans++;
  }

  cout << ans;

  return 0;
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
X=int(input())/50
count=0
for i in range(A+1):
    for i2 in range(B+1):
        for i3 in range(C+1):
            if i*10+i2*2+i3==X:
                count+=1
print(count)


Measured memory_bytes: 3060
s = input()
a = [0 for _ in range(len(s))]
for i, x in enumerate(s):
  if x == 'R':
    a[i] = 1
d = [0 for _ in range(len(s))]
state_R = 1
left_R = 0
counter = 0

for i in range(len(s)):
  if state_R:
    if not a[i]:
      for j in range(left_R,i):
        d[j] -= counter
      counter = -1
      state_R = 0
  else:
    if a[i]:
      counter = 0
      state_R = 1
      left_R = i
  d[i] = counter
  counter -= 1


ans = [0 for i in range(len(s))]
for i, x in enumerate(d):
  if x % 2 == 0:
    ans[i+x] += 1
  else:
    if x > 0:
      ans[i+x-1] += 1
    else:
      ans[i+x+1] += 1

ans = list(map(str, ans))
print(" ".join(ans))

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

#define MOD (1000 * 1000 * 1000 + 7)
#define INF (1LL << 60)
#define pb push_back
#define po pop_back
#define fi first
#define se second

typedef long long ll;
typedef long double ld;

int main() {
    string str;
    cin >> str;

    int cnt = 0;
    for(int i = 0; i < str.size() - 1; ++i) {
        if(str[i + 1] != str[i]) {
            ++cnt;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 512
def main():
    A=[]
    for _ in range(3):
        a1,a2,a3=map(int,input().split())
        A.append(a1); A.append(a2); A.append(a3)
    Flag=[False]*9
    n=int(input())
    B=[int(input().strip()) for _ in range(n)]
    for b in B:
        for i,a in enumerate(A):
            if b==a:
                Flag[i]=True
    if Flag[0] and Flag[1] and Flag[2]:
        return 'Yes'
    if Flag[3] and Flag[4] and Flag[5]:
        return 'Yes'
    if Flag[6] and Flag[7] and Flag[8]:
        return 'Yes'
    if Flag[0] and Flag[3] and Flag[6]:
        return 'Yes'
    if Flag[1] and Flag[4] and Flag[7]:
        return 'Yes'
    if Flag[2] and Flag[5] and Flag[8]:
        return 'Yes'
    if Flag[0] and Flag[4] and Flag[8]:
        return 'Yes'
    if Flag[2] and Flag[4] and Flag[6]:
        return 'Yes'
    return 'No'

if __name__=='__main__':
    print(main())

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n;
	string s, t, a;
	cin >> n >> s >> t;
	for (int i = 0; i < n; i++) {
		a.push_back(s[i]);
		a.push_back(t[i]);
	}
	cout << a << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  unordered_map<string,int> mp;
  for(int i=0;i<n;i++){
    string s;cin>>s;
    mp[s]++;
  }
  cout<<"AC x "<<mp["AC"]<<endl;
  cout<<"WA x "<<mp["WA"]<<endl;
  cout<<"TLE x "<<mp["TLE"]<<endl;
  cout<<"RE x "<<mp["RE"]<<endl;
  return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n, k, q;
int a[100002], tmp[100002];

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

	rep(i, q)tmp[a[i]]++;

	REP(i, 1, n + 1) {
		if ((k - (q - tmp[i])) > 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    ll ans = 0;
    vector<int> a(n), b(n), c(n);
    rep (i, n) {
      cin >> a[i];
    }
    rep (i, n) {
      cin >> b[i];
    }
    rep (i, n) {
      cin >> c[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    rep (i, n) {
      ll top, bottom;
      ll tmp = 1;
      top = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
      bottom = c.end() - upper_bound(c.begin(), c.end(), b[i]);
      tmp = top * bottom;
      ans += tmp;
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>

typedef long long int64;
typedef unsigned long long uint64;

#define min(a,b) (((a) < (b)) ? (a) : (b))

int main()
{

	uint64 a, b, n;

	scanf("%llu %llu %llu", &a, &b, &n);

	printf("%llu", (uint64)floor(a * min(b - 1, n) / b));

	return 0;
}


Measured memory_bytes: 1680
#include <bits/stdc++.h>
#include <vector>
#include <string>
using namespace std;
int main(){
    int n; cin >> n;
    vector<string> s(n);
    for(int i=0; i<n; ++i){cin >> s[i];}
    sort(s.begin(), s.end());
    int k = n;
    for(int i=0; i<n-1; ++i){
        if(s[i]==s[i+1]){k--;}
    }
    cout << k << endl;
    return 0;
}

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

ll gcd(ll m, ll n) {//最大公約数
    if (n == 0)return m;
    return gcd(n, m % n);
}//gcd

int main(){
  int n,k;
  cin>>n>>k;
  int ma=0;
  int p=0;
  rep(i,n){
    int a; cin>>a;
    ma=max(ma,a);
    p=gcd(a,p);
  }
  if(k%p==0 && k<=ma) cout<<"POSSIBLE"<<endl;
  else cout<<"IMPOSSIBLE"<<endl;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
  ll n;
  cin >> n;
  vector <pair <char, ll>> a, b;
  rep(i, n) {
    char p;
    ll q;
    cin >> p >> q;
    a.push_back(make_pair(p, q));
    b.push_back(make_pair(p, q));
  }

  rep(i, n) {
    for (ll j = n-1; j >= i+1; j--) {
      if (a.at(j).second < a.at(j-1).second) {
        pair <char, ll> tmp = a.at(j);
        a.at(j) = a.at(j-1);
        a.at(j-1) = tmp;
      }
    }
  }
  rep(i, n) {
    ll minj = i;
    for (ll j = i; j < n; j++) {
      if (b.at(minj).second > b.at(j).second) {
        minj = j;
      }
    }
    pair <char, ll> tmp = b.at(i);
    b.at(i) = b.at(minj);
    b.at(minj) = tmp;
  }

  rep(i, n) {
    if (i < n-1) {
      cout << a.at(i).first << a.at(i).second << ' ';
    } else {
      cout << a.at(i).first << a.at(i).second << endl;
    }
  }
  cout << "Stable" << endl;

  rep(i, n) {
    if (i < n-1) {
      cout << b.at(i).first << b.at(i).second << ' ';
    } else {
      cout << b.at(i).first << b.at(i).second << endl;
    }
  }

  string ans = "Stable";
  rep(i, n) {
    if (a.at(i).first != b.at(i).first) {
      ans = "Not stable";
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3184
#include <iostream>
#include <math.h>

using namespace std;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };

int main(void)
{
    string str;
    cin >> str;

    if (str[2] == str[3] && str[4] == str[5])
        sayYes();
    else
        sayNo();

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100010];
bool f[100010];
int  ans;
void dfs(int i,int c){
  f[i]=true;
if(i==2)ans=c;	
  if(f[a[i]]){
      return;
  }else{
    dfs(a[i],c+1);
  }
}
int main(){
	int n;cin>>n;
  ans=1000000;	
  for(int i=1;i<=n;i++)cin>>a[i];
    dfs(1,0);
    if(ans<1000000){
      cout<<ans<<endl;
    }else{
		cout<<-1<<endl;
    }
}


Measured memory_bytes: 768