akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * 【問題概要】 11 以上 N 以下の整数のうち、10 進法で各桁の和が A 以上 B 以下であるものについて、総和を求めてください。
 *
 * @author tsuch
 *
 */

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		Main instance = new Main();
		instance.solve();
	}

	private void solve() {
		try {
			int n = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			int sum = IntStream.rangeClosed(1, n).filter(c -> test(a, b, c)).sum();
			System.out.println(sum);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private boolean test(int a, int b, int target) {
		int[] tmp = Stream.of(String.valueOf(target).split("")).mapToInt(Integer::parseInt).toArray();
		int d = Arrays.stream(tmp).sum();
		return a <= d && d <= b;
	}
}

Measured memory_bytes: 41704
import numpy as np
import math

S = int(input())
A = np.zeros(6)

if S == 10**18:
    A[2] = 10**9
    A[5] = 10**9
    
else:
    A[2] = int(math.sqrt(S) + 1)
    A[5] = int(math.sqrt(S) + 1)

    A[3] = int(math.sqrt(S) + 1)*int(math.sqrt(S) + 1) - S
    A[4] = 1
    
print(*A.astype(np.int32))

Measured memory_bytes: 21524
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <cstdio>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 200010;
long fac[MAX], inv[MAX], finv[MAX];
void init(){
  fac[0] = inv[0] = finv[0] = 1;
  fac[1] = inv[1] = finv[1] = 1;
  for(int i=2; i<MAX; ++i){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}

long Comb(int n,int k){
  if(n < 0 || k < 0 || n < k) return 0;
  return (fac[n] * finv[n-k] % MOD) * finv[k] % MOD;
}

ll comb(ll n, ll k) {
  ll res = 1;
  for(int i = 1; i <= k; ++i) {
    res = res * ((n - (i - 1)) * inv[i] % MOD) % MOD;
  }
  return res;
}

ll n, k;

int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> k;
  init();
  if (n - 1 <= k) 
    cout << comb(n * 2 - 1, n);
  else {
    ll ans = 0;
    for(int i = 0; i <= k; ++i) {
      ans = (ans + Comb(n, i) * Comb(n - 1, (n - i) - 1) % MOD) % MOD;
    }
    cout << ans;
  }
  return 0;
}



Measured memory_bytes: 4992
#include "iostream"
#include "cmath"
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a <= 8 && b <= 8)
	{
		cout << "Yay!";
	}
	else
	{
		cout << ":(";
	}
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<n;i++){
        int h;
        cin>>h;
        if(h>=k)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

int main(){
  #ifdef HOME
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
  #endif
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  for (int i = 1; i <= b; i++) {
    if ((i * a) % b == c) {
      return 0 * printf("YES");
    } 
  }
  printf("NO");

  #ifdef HOME
    fprintf(stderr, "Time:- %.3f\n", (double) clock() / CLOCKS_PER_SEC);
    fflush(stderr);
  #endif
  return 0;
}

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct edge{
    int to;
    lint cost;
};

lint x[100010];
vector< vector<edge> > g;
vector<bool> done;

bool dfs(int i, lint c){
    bool res = true;
    done[i] = true;
    rep(j, g[i].size()){
        edge e = g[i][j];
        if(x[e.to] < LLINF && x[e.to] != c + e.cost){
            return false;
        }else if(!done[e.to]){
            x[e.to] = c + e.cost;
            res = res && dfs(e.to, c + e.cost);
        }
    }
    return res;
}

bool solve(void){
    int n, m;
    cin >> n >> m;
    g.resize(n);
    rep(i, m){
        int l, r;
        lint d;
        cin >> l >> r >> d;
        l--;
        r--;
        g[l].push_back({r, d});
        g[r].push_back({l, -d});
    }
    fill(x, x+n, LLINF);
    rep(i, n){
        if(x[i] == LLINF){
            x[i] = 0;
            done.resize(0);
            done.resize(n);
            if(!dfs(i, 0)){
                return false;
            }
        }
    }
    return true;
}

int main(){
    if(solve()){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 16512
#include <bits/stdc++.h>
#define ll long long
#define L long
#define endl "\n"
#define set0(x) memset(x, 0, sizeof(x))
#define setT(x) memset(x, true, sizeof(x))
#define setF(x) memset(x, false, sizeof(x))
#define For(i, init, n) for (ll int i = init; i < n; i++)
#define ___ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

const double PI = acos(-1), E = exp(1.0), EPS = DBL_EPSILON;
const ll int MOD = (ll int)1e9 + 7, N = (int)1e5;

int main()
{   
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ___
    
    ll int x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll int q = x / d, r = x % d;
    ll int ans;
    if (k <= q)
    {
        ans = x - (k * d);
    }
    else
    {
        ans = r;
        k -= q;
        if (abs(ans - d) < ans)
        {
            ans = abs(ans - d);
            k--;
        }
        if (k % 2 == 1)
        {
            ans = min(abs(ans + d), abs(ans - d));
        }
    }
    cout<< ans;
    
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()

 
int main() {
 ll N,M;
  cin>>N;
  map<string,ll> B;
  map<string,ll> A;
  for(ll i=0;i<N;i++) {
string s;
    cin>>s;
    B[s]++;
  }
  cin>>M;
  for(ll i=0;i<M;i++) {
string t;
    cin>>t;
    A[t]++;
  }
   ll ans=0;
  for(auto x:B) {
    ll k=x.second-A[x.first];
    ans=max(ans,k);
  }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 3644
#include <stdio.h>

int main(void){
  int n,m, vac;
  int sum =0;
  scanf("%d", &n);
  scanf("%d", &m);
  int a[n];
  for(int i=0;i<m;i++){
  scanf("%d", &a[i]);
  sum+=a[i];
  }
  vac=n-sum;
  if(vac<0)
    printf("-1\n");
  else
    printf("%d\n", vac);
  return 0;
}

Measured memory_bytes: 1768
fun main(args: Array<String>) {
    val k = readLine()!!.toInt()
    var sum = 0L
    for (i in 1..k) {
        for (j in 1..k) {
            for (h in 1..k) {
                sum += euc(euc(i,j), h)
            }
        }
    }
    println(sum)
}

fun euc(a: Int, b: Int) : Int {
    var tmp1 = Math.max(a,b)
    var tmp2 = Math.min(a,b)
    while (tmp1 % tmp2 != 0) {
        val tmp3 = tmp2
        tmp2 = tmp1 % tmp3
        tmp1 = tmp3
    }
    return tmp2
}



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

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

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

  return 0;
}


Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=998244353;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=500002;

int fact[N];

void solve(){
	int n;
	cin>>n;
	fact[0]=1;
	for(int i=1;i<=n;i++){
		fact[i]=mul(fact[i-1],i);
	}
	vi a(n);
	cin>>a;
	if(a[0]){
		cout<<0;
		return;
	}
	sort(all(a));
	if(n!=1&&a[1]==0){
		cout<<0;
		return;
	}
	int ans=1;
	map<int,int>cnt;
	int mx=a[n-1];
	for(int i=1;i<n;i++){
		cnt[a[i]]++;
	}	
	int prev=1;
	int cn=0;
	for(auto i:cnt){
		debug(i);
		if(i.F!=1)
		ans=mul(ans,powz(prev,i.S));
		prev=i.S;
		if(i.F!=cn+1){
			cout<<0;
			return;
		}
		cn++;
	}
	cout<<ans;
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
int N,M;
vector<int> g[200001];
bool vis[200001];
int dfs(int v){
    vis[v]=true;
    int s=1;
    for(int d:g[v])if(!vis[d]){
        s+=dfs(d);
    }
    return s;
}
main()
{
    cin>>N>>M;
    for(int i=0;i<M;++i)
    {
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans=0;
    for(int i=1;i<=N;++i)ans=max(ans,dfs(i));
    cout<<ans<<endl;
}

Measured memory_bytes: 24052
""" AtCoder """

N, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

ans = 0

for i in range(N):
    if i < N - 1:
        if x >= a[i]:
            ans += 1
            x -= a[i]
    else:
        if a[i] == x:
            ans += 1

print(ans)


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

int main() {
  string s,t;
  cin >> s >> t;
  for(int i=0;i<s.size();i++){
    if(s.at(i)!=t.at(i)){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  char t;
  std::cin>>t;

  if('A'<=t&&t<='Z')std::cout<<"A\n";
  else std::cout<<"a\n";

  return 0;
}

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


int main() {
    string s1,s2,s3;cin >> s1 >> s2 >> s3;
    char a,b,c;
    a = s1[0];
    b = s2[0];
    c = s3[0];
    char A,B,C;
    A = a-32;
    B = b-32;
    C = c-32;
    cout << A << B << C << endl;



}       

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

int ans[100005];
vector<pair<long long,long long>> tree[100005];
void dfs(int f,int now, long long cost) {
	ans[now] = cost % 2;
	for (int i = 0; i < tree[now].size(); i++) {
		if (tree[now][i].first== f) continue;
		dfs(now, tree[now][i].first, cost + tree[now][i].second);
	}
}
int main() {
	int n; cin >> n;
	for (int i = 0; i < n - 1; i++) {
		long long u, v, w; cin >> u >> v >> w;
		u--; v--;
		tree[u].push_back({ v,w });
		tree[v].push_back({ u,w });
	}
	dfs(-1, 0, 0);
	for (int i = 0; i < n; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 10624
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
using namespace std;

int main(void){
        int i,j;
        string s,t,u;
        int a,b;

        cin >> s >> t;
        cin >> a >> b;
        cin >> u;

        if(s == u){
                cout << a-1 << " " << b << endl;
        } else {
                cout << a << " " << b-1 << endl;
        }

        return 0;
}



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

#define F first
#define S second
#define int long long
#define ull  unsigned long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 300000;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt",  "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= m; j++){
            int x = (n - i) * (m - j) + i * j;
            if (n * m - x == k){
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
	
	int n, ans;

	while(true){
		cin >> n;
		if(cin.eof()){
			break;
		}
		ans = (n - 1) % 39 + 1;
		if(ans >= 10){
			printf("3C%d\n", ans);
		}else{
			printf("3C0%d\n", ans);
		}
	}
	
	return 0;
}

Measured memory_bytes: 1144
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

class Dice {
public:
	int surface[6];
	int top;
	void setTop() {
		top = surface[0];
	}
	void turnE(){
		int a[4] = { surface[0],surface[2],surface[5],surface[3] };
		surface[0] = a[3], surface[2] = a[0], surface[5] = a[1], surface[3] = a[2];
	}
	void turnW(){
		int a[4] = { surface[0],surface[2],surface[5],surface[3] };
		surface[0] = a[1], surface[2] = a[2], surface[5] = a[3], surface[3] = a[0];
	}
	void turnN() {
		int a[4] = { surface[0],surface[4],surface[5],surface[1] };
		surface[0] = a[3], surface[4] = a[0], surface[5] = a[1], surface[1] = a[2];
	}
	void turnS() {
		int a[4] = { surface[0],surface[4],surface[5],surface[1] };
		surface[0] = a[1], surface[4] = a[2], surface[5] = a[3], surface[1] = a[0];
	}
};


int main() {
	char cm;
	Dice a;
	int i;
	for (i = 0;i < 6;i++) {
		cin >> a.surface[i];
	}
	a.setTop();
	while (cin >> cm) {
		if (cm == 'E')a.turnE();
		else if (cm == 'W')a.turnW();
		else if (cm == 'N')a.turnN();
		else if (cm == 'S')a.turnS();
	}
	cout << a.surface[0] << endl;
	return 0;
}


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

using namespace std;
using ll = long long;

int main (void){
  int n;
  cin >> n;
  cin.ignore();
  int s[n];
  ll sum = 0;
  priority_queue<int, vector<int>, greater<int>> q;
  for(int i = 0; i < n; i++){
    cin >> s[i];
    cin.ignore();
    sum += s[i];
    q.push(s[i]);
  }

  while(!q.empty()){
    if(sum % 10 != 0){
      cout << sum << endl;
      return 0;
    }
    if(q.top() % 10 != 0) sum -= q.top();
    q.pop();
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
ll a[100005] = {};
int main() {
	ll n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	ll sum1 = 0; ll sum2 = 0;
	ll ans1 = 0; ll ans2 = 0;
	for (int i = 1; i <= n; ++i) {
		sum1 += a[i];//i=1でsum1が正の時
		if (i % 2 == 0 && sum1 >= 0) {
			ans1 += sum1 + 1;
			sum1 = -1;
		}
		else if (i % 2 != 0 && sum1 <= 0) {
			ans1 += abs(sum1) + 1;
			sum1 = 1;
		}
	}
	for (int i = 1; i <= n; ++i) {
		sum2 += a[i];//i=1でsum2が負の時
		if (i % 2 == 0 && sum2 <= 0) {
			ans2 += abs(sum2) + 1;
			sum2 = 1;
		}
		else if (i % 2 != 0 && sum2 >= 0) {
			ans2 += abs(sum2) + 1;
			sum2 = -1;
		}
	}
	cout << min(ans1, ans2) << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
#define int long long

int min(int a,int b)
{
        if(a<b)
                return a;
        return b;
}
int main()
{ // dp array mein store kar ki n tak pahuchne mein ek pt se kitte paise lagenge
        int n;
        scanf("%lld",&n);

        int l=n+1;
        int h[l];
        int dp[l];
	int k;
	scanf("%lld",&k);
        for(int i=1;i<=n;i++)
        {scanf("%lld",&h[i]);}
        dp[1]=0;
        dp[2]=fabs(h[2]-h[1]);
	int mini=1e9+7;
	int minim=1e9+7;
	int minix=1e9+7;
	if (k>n)
	{
		for(int i=3;i<=n;i++)
		{
			  for(int j=1;j<i;j++)
                {
                 minix=min((fabs(h[i]-h[j])+dp[j]),minix);
                }
                dp[i]=minix;
                minix=1e9+7;

		}
		printf("%lld",dp[n]);
		return 0;

	}
	else
	{
	for(int i=3;i<=k;i++)
        {
		for(int j=1;j<i;j++)
		{
                 mini=min((fabs(h[i]-h[j])+dp[j]),mini);
		}
		dp[i]=mini;
		mini=1e9+7;
        }
	for(int i=k+1;i<=n;i++)
	{ 
		for(int j=i-k;j<i;j++)
		{
			minim=min((fabs(h[i]-h[j])+dp[j]),minim);
		}
		dp[i]=minim;
		minim=1e9+7;
	}
        printf("%lld",dp[n]);
	}
        return 0;
}




                                                                                                        
                                                                                                        
                                                                                                        
                                                                                                        
                                                                                                        
                                                                                                        
                                                                                                        
                                                                                                        
                                                                                                        
                                                                                                        
                                   


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <cmath>

using namespace std;

int main() {
    int n;
    int R[200000];
    int range = -1e18;
    int minValue;

    cin >> n;

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

    minValue = R[0];

    // for(int i = 0; i < n-1; i++) {
    //     if(minValue > R[i]) {
    //         minValue = R[i];
    //     }

    //     if(range < R[i+1] - minValue) {
    //         range = R[i+1] - minValue;
    //     }
    
    // }

    for(int i = 1; i < n; i++) {

        if(range < R[i] - minValue) {
            range = R[i] - minValue;
        }

        if(minValue > R[i]) {
            minValue = R[i];
        }
    
    }

    

    cout << range << endl;

    return 0;
}


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

void printArr(int array[], int array_size){
    for(int i=0; i<array_size; i++){
        cout << array[i];
        if(i == array_size - 1){
            cout << endl;
        } else {
            cout << " ";
        }
    }
}

int main(void)
{
    int loop = 0;
    int A[1001] = {};
    
    // gets times
    cin >> loop;
    
    // gets num
    for(int i=0; i<loop; i++){
        cin >> A[i];
    }
    
    // insert section
    printArr(A, loop);
    for(int i=1, j=0, v=0; i<loop; i++){
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        printArr(A, loop);
    }
    
    return 0;
}



Measured memory_bytes: 3080
length = int(input())
goal = 0
while 2**goal <= length:
    goal += 1
edge = []
for i in range(1,goal):
    edge.append((i, i+1, 0))
    edge.append((i, i+1, 2**(i-1)))
remain = length - 2**(goal - 1)
def addedge(r, s):
    if r == 1:
        edge.append((1, goal, s))
        return
    if r == 2:
        edge.append((1, goal, s))
        edge.append((1, goal, s+1))
        return
    else:
        k = 0
        while 2**k <= r:
            k += 1
        remain = r - 2**(k-1)
        edge.append((k, goal, s))
        if remain:
            addedge(remain, s + 2**(k-1))
if remain:
    shift = 2**(goal-1)
    addedge(remain, shift)
print(goal, len(edge))
for v1, v2, w in edge:
    print(v1, v2, w)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};


int n;
vector<int> s;
vector<int> a;

int dfs(int k){
    if(k==n){
        int ret = 24;
        auto t = s;
        sort(ALL(t));
        for (int i = 0; i < n; i++) {
            int r = abs(t[(i+1)%n] - t[i]);
            ret = min(ret, min(24 - r, r));
        }
        return ret;
    }
    int ret = 0;
    if(a[k]==0||a[k]==12){
        s[k] = a[k];
        ret = max(ret, dfs(k+1));
    }
    else{
        s[k] = a[k];
        ret = max(ret, dfs(k+1));
        s[k] = 24 - a[k];
        ret = max(ret, dfs(k+1));
    }
    return ret;
}

 

int main(){
    cin >> n;
    a.resize(n+1);
    s.resize(n+1);
    a[0] = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i+1];
    }
    n++;
    if(n>24){
        puts("0");
        return 0;
    }
    cout << dfs(0) << endl;
    return 0;
}


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

#define rep(i, N) for (int i = 0; i < N; i++)

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main()
{
    int N;
    cin >> N;
    vector<int> P(N);
    rep(i, N) cin >> P[i];

    unordered_map<int, int> p2i;
    rep(i, N) p2i[P[i]] = i;

    multiset<int> ms;
    ms.insert(-1);
    ms.insert(-1);
    ms.insert(N);
    ms.insert(N);

    ll sum = 0;
    for (int p = N; p >= 1; p--)
    {
        int i = p2i[p];
        auto it = ms.insert(i);

        auto it_r = it;
        int i_r1 = *++it_r;
        int i_r2 = *++it_r;

        auto it_l = it;
        int i_l1 = *--it_l;
        int i_l2 = *--it_l;

        ll dl2, dl1, dr1, dr2;
        dl2 = i_l1 - i_l2;
        dl1 = i - i_l1;
        dr1 = i_r1 - i;
        dr2 = i_r2 - i_r1;
        sum += p * (dl2 * dr1 + dl1 * dr2);
    }
    cout << sum << endl;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(x) __builtin_ctz(x)

// #define DEBUG

#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif

using namespace std;
using ll=long long;

const int nmax=200010;

ll x[nmax],y[nmax];
ll sx[nmax],sy[nmax];

int main(void){
	int w,h,n;
	cin >> w >> h >> n;
	rep(i,n) cin >> x[i] >> y[i];
	rep(i,n) x[n+i]=x[i],y[n+i]=y[i];
	rep(i,2*n) sx[i]=x[i],sy[i]=y[i];
	sort(sx,sx+2*n),sort(sy,sy+2*n);
	
	ll ax[2]={sx[n-1],sx[n]};
	ll ay[2]={sy[n-1],sy[n]};
	ll all[2][2];

	rep(xi,2)rep(yi,2){
		all[xi][yi]=0LL;
		rep(i,n){
			ll cur=abs(x[i]-ax[xi])+abs(y[i]-ay[yi]);
			all[xi][yi]+=2LL*cur;
		}
	}
	
	ll cmax[2][2]={{0,0},{0,0}};
	rep(i,n){
		int xi=lower_bound(sx,sx+2*n,x[i])-sx;
		int yi=lower_bound(sy,sy+2*n,y[i])-sy;
		xi=(xi<n),yi=(yi<n);		
		ll cur=abs(x[i]-ax[xi])+abs(y[i]-ay[yi]);
		cmax[xi][yi]=max(cmax[xi][yi],cur);
	}

	ll ans=all[0][0]-cmax[0][0];
	rep(i,2)rep(j,2) ans=min(ans,all[i][j]-cmax[i][j]); 
	cout << ans << endl;

	rep(i,2)rep(j,2){
		if(all[i][j]-cmax[i][j]==ans){
			cout << ax[i] << " " << ay[j] << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 9400
# coding: utf-8
H,N=map(int,input().split())
AB=[[0,0]]
for i in range(N):
    AB.append(list(map(int,input().split())))
 
INF=10**9

dp=[INF for i in range(H+1)]
dp[0]=0

for i in range(1,N+1):
    damage ,mp = AB[i]
    
    for j in range(1,H+1):
        dp[j]=min(dp[j],dp[max(0 , j - damage)] + mp)

print(dp[H])

Measured memory_bytes: 42988
A, B, K = input().split()
A = int(A)
B = int(B)
K = int(K)
for i in range(1, K+1):
	if i % 2 == 1:
		if A % 2 == 1:
			A -= 1
		B += int(A/2)
		A = int(A/2)
	else:
		if B % 2 == 1:
			B -= 1
		A += int(B/2)
		B = int(B/2)
print(str((A))+' '+str(B))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

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

  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589;

int main(){
  int H, W;
  cin >> H >> W;
  int a[500][500];
  rep(i, H){
    rep(j, W){
      cin >> a[i][j];
    }
  }
  vector<tuple<int, int, int, int>> move;
  rep(i, H-1){
    rep(j, W){
      if(a[i][j] % 2 == 1){
        tuple<int, int, int, int> tmp = make_tuple(i+1, j+1, i+2, j+1);
        move.push_back(tmp);
        a[i+1][j]++;
      }
    }
  }
  rep(i, W-1){
    if(a[H-1][i] % 2 == 1){
      tuple<int, int, int, int> tmp = make_tuple(H, i+1, H, i+2);
      move.push_back(tmp);
      a[H-1][i+1]++;
    }
  }
  cout << move.size() <<endl;
  for(tuple<int, int, int, int> x:move){
    printf("%d %d %d %d\n", get<0>(x), get<1>(x), get<2>(x), get<3>(x));
  }
}

Measured memory_bytes: 5104
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

int main(){
    int n; cin >> n;
    vector<pair<int, int>> bis(n-1);
    for(int i=0; i<n-1; ++i){
        int b; cin >> b;
        bis[i]={b, i};
    }
    sort(bis.begin(), bis.end());
    vector<int> as(n, -1);
    for(int i=0; i<n-1; ++i){
        int j=bis[i].second;
        if(as[j]==-1) as[j]=bis[i].first;
        if(as[j+1]==-1) as[j+1]=bis[i].first;
    }
    int ans=0;
    for(int i=0; i<n; ++i){
        ans+=as[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    if (s[0] == t[2] && s[1] == t[1] && s[2] == t[0])
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<ll>a(n), b(n);
	for (int i = 0;i < n;i++) {
		cin >> a[i] >> b[i];
	}

	ll sum = 0;
	for (int i = n - 1;i >= 0;i--) {
		if ((sum + a[i]) % b[i] != 0) {
			ll diff = b[i] - (sum + a[i]) % b[i];
			sum += diff;
		}
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define fst first
#define snd second
using ll = long long;
using I = pair<int, int>;
const int D = 16;

// clang-format off
template <class T, size_t D> struct _Vec { using type = vector<typename _Vec<T, D - 1>::type>; };
template <class T> struct _Vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using Vec = typename _Vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
// clang-format on

vector<int> split(ll n) {
  vector<int> dig(D);
  for (int i = D - 1; i >= 0; i--) {
    dig[i] = n % 10;
    n /= 10;
  }
  return dig;
}

Vec<bool, 3> solveDP(const vector<int>& dig) {
  Vec<bool, 3> dp = make_v(D + 1, 2, D * 9 + 1, false);
  dp[D][0][0] = dp[D][1][0] = true;
  for (int i = D - 1; i >= 0; i--) {
    for (int big = 0; big < 2; big++) {
      for (int dsum = 0; dsum <= D * 9; dsum++) {
        for (int d = big ? 0 : dig[i]; d <= 9; d++) {
          if (dsum - d < 0) break;
          dp[i][big][dsum] =
              dp[i][big][dsum] | dp[i + 1][big | (d > dig[i])][dsum - d];
        }
      }
    }
  }
  return dp;
}

ll solveGreedy(const vector<int>& dig, const Vec<bool, 3>& dp, int dsum) {
  if (!dp[0][0][dsum]) {
    return -1;
  }
  ll m = 0;
  bool big = false;
  for (int i = 0; i < D; i++) {
    for (int d = big ? 0 : dig[i]; d <= 9; d++) {
      if (dp[i + 1][big | (d > dig[i])][dsum - d]) {
        m = m * 10 + d;
        big |= d > dig[i];
        dsum -= d;
        break;
      }
    }
  }
  return m;
}

ll f(ll n) {
  auto dig = split(n);
  auto dp = solveDP(dig);
  ll p = 1, q = 0;
  for (int k = 1; k <= D * 9; k++) {
    ll m = solveGreedy(dig, dp, k);
    if (m < 0) continue;
    if (p * k > m * q || (p * k == m * q && p > m)) {
      p = m;
      q = k;
    }
  }
  return p;
}

int main() {
  int K;
  while (cin >> K) {
    vector<ll> res;
    res.push_back(1);
    while (res.size() < K) {
      ll n = res.back();
      res.push_back(f(n + 1));
    }
    for (ll x : res) cout << x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

const M : usize = 1000000007;

fn factorial(n: usize) -> usize {
    let mut result = 1;
    for i in 1..(n + 1) {
        result = (result * i) % M;
    }
    return result;
}

fn inv(a: usize) -> usize {
    let m = M as i64;
    let mut a = a as i64;
    let mut b = m as i64;
    let mut u = 1;
    let mut v = 0;
    let mut tmp;
    while b != 0 {
        let t = a / b;
        a -= t * b;
        tmp = a;
        a = b;
        b = tmp;
        u -= t * v;
        tmp = u;
        u = v;
        v = tmp;
    }
    u %= m;
    if u < 0 {
        u += m;
    }
    return u as usize;
}

fn main() {
    input! {
        x: usize,
        y: usize,
    }
    if (x + y) % 3 != 0 {
        println!("0");
        return;
    }
    let z = (x + y) / 3;
    if x < z || y < z {
        println!("0");
        return;
    }
    let w = x - z;
    let h = (x + y) / 3 - w;
    // println!("{} {}", w, h);
    // println!("{}", factorial(w + h));
    // println!("{}", factorial(w));
    // println!("{}", factorial(h));
    let result =  factorial(w + h) * inv(factorial(w) * factorial(h) % M) % M;
    println!("{}", result);
}


Measured memory_bytes: 4352
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

def WF(E,n):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                E[i][j]=min(E[i][j],E[i][k]+E[k][j])
    return E

N,M = II()
a,b,c = Line(M,3)

E = [[10**30]*N for _ in range(N)]
for i in range(N):
    E[i][i] = 0         #自分との距離は0にしておく
for i in range(M):
    E[a[i]-1][b[i]-1] = c[i]
    E[b[i]-1][a[i]-1] = c[i]     #無向枝の場合両方格納

E2 = WF(E,N)

ans = 0
for i in range(M):
    if E2[a[i]-1][b[i]-1]<c[i]:
        ans += 1

print(ans)

Measured memory_bytes: 43756
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define tpop(p) p.top();p.pop()
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------
int n;
string s;
signed main() {
	cin >> s;
	n = s.size();
	for (int i = 0; i < n;) {
		if (!(s[i] == 'R' && s[i + 1] == 'L')) {
			cout << 0 << ssp(i, n);
			i++;
			continue;
		}
		int j = i, x = i + 1;
		while (j >= 0 && s[j] == 'R') j--;
		while (x < n && s[x] == 'L') x++;
		cout << ceil((i - j) / 2.) + (x - i - 1) / 2 << ssp(i, n);
		cout << ceil((i - j) / 2) + ceil((x - i - 1) / 2.) << ssp(i + 1, n);
		i += 2;
	}
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,l,r,ans=0;
	scanf("%d",&n);
	while(n--){
		scanf("%d%d",&l,&r);
		ans+=r-l+1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
bool card[11]; //カードが使えるか記憶

int main(void) {
    int mine1, mine2, enemy1;
    while(cin >> mine1 >> mine2 >> enemy1) {
        memset(card, true, sizeof(card));
        card[mine1] = card[mine2] = card[enemy1] = false;
        int target = 20 - (mine1 + mine2), count = 0;
        for(int r = 1; r < 11; r++) {
            if(card[r] && r <= target) count++;
        }
        double prob = count / 7.0;
        if(prob >= 0.5) cout << "YES" << endl;
        else            cout << "NO"  << endl;
    }
    return(0);
}

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

int main() {
  string s; cin >> s;
  if(s.length() % 2 == 0 ^ s[0] == s[s.size()-1]) {
    cout << "Second" << endl;
  } else {
    cout << "First" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
using ll = long long;

int main() {
	ll N;
	cin >> N;
    vector<int> B(N-1);
    for (int i=0; i<B.size(); ++i) {
        cin >> B[i];
    }
    vector<int> A(N);
    A[0] = B[0];
    // cout << A[0] << ", ";
    for (int i=1; i<B.size(); ++i) {
        A[i] = std::min(B[i-1], B[i]);
    }
    A[N-1] = B[N-2];
    // // debug
    // for (int i=0; i<A.size(); ++i) {
    //     cout << A[i] << ", ";
    // }
    // cout << endl;

    int ans = accumulate(A.begin(), A.end(), 0);
    cout << ans << endl;
	return 0;
}



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

int main(){
    vector<int> v(5);
    int m=10,s=-10;
    for(int i=0;i<5;i++){
        cin>>v[i];
        if(v[i]%10!=0) m=min(m,v[i]%10);
        s+=(v[i]+9)/10*10;
    }
    cout<<s+m<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

struct unionfindtree {
    vector<int> par,rank;
    unionfindtree(int n):par(n,-1),rank(n,0) {}
    int root(int n) {
        if(par[n] < 0) return n;
        else return par[n] = root(par[n]);
    }
    bool same(int i,int j) {
        return root(i) == root(j);
    }
    void unite(int i,int j) {
        int ri = root(i);
        int rj = root(j);
        if(ri == rj) return;

        if(rank[ri] < rank[rj]) {
            par[rj] += par[ri];
            par[ri] = rj;
        } else {
            par[ri] += par[rj];
            par[rj] = ri;
            if(rank[ri] == rank[rj]) rank[ri]++;
        }
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vector<P> v(m);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        v[i] = {a,b};
    };
    int ans = 0;
    rep(i,m) {
        unionfindtree u(n);
        rep(j,m) {
            if(i == j) continue;
            u.unite(v[j].first,v[j].second);
        }
        bool uni = true;
        rep(j,n-1) if(!u.same(j,j+1)) uni = false;
        if(!uni) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll a, b, c;cin >> a >> b >> c;
	cout << c << " " << a << " " << b << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int x=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)!=t.at(i)){
      x+=1;}
  }
  cout<<x<<endl;}
      

Measured memory_bytes: 3904
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back


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

	ll P = 100; //pricipal

	ll T = 0;

	while(P < X)
	{
		P = P + P/100;
		T++;
	}

	cout<<T<<endl;

	return 0;
}

Measured memory_bytes: 3652
/// Great & Inimitable Vonatlus
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type,
less<T>, rb_tree_tag, 
tree_order_statistics_node_update>;

using ll = long long;
using pii = pair<int, int>;                                   

const int N = 2e2;
const int W = 2e5;
const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

ll dp[N][W], p[N][W];

ll add(ll a, ll b) {
    return a = (a % MOD + b % MOD) % MOD;
}

ll sub(int a, int b) {
    return (a - b + MOD) % MOD;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr)    ;
    int n, k;
    cin >> n >> k;
    vector<ll> a(n + 1);
    for (int i = 1; i <= n; ++i)
        cin >> a[i];                                                                            
    dp[0][0] = 1;
    for (int w = 0; w <= k; ++w)
        p[0][w] = 1;
    for (int w = 0; w <= k; ++w)          
        for (int i = 1; i <= n; ++i) {
            dp[i][w] = add(dp[i][w], sub(p[i - 1][w], (w < a[i] + 1 ? 0ll : p[i - 1][w - a[i] - 1]))); 
            p[i][w] = add(p[i][w], add((w ? p[i][w - 1] : 0), dp[i][w]));
        }
    cout << dp[n][k] % MOD;
    return 0;    
}

Measured memory_bytes: 316928
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// ;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
constexpr long long DINF = 1000000000000;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>g;
vector<edge>ed;
vector<Pll>pv;
map<string, LL>ma;
set<LL>st;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n, m, k, p, q, w, h, ans, cnt, sum, a[210000], b[210000], c[210000];
string str;
bool f[210000];
//char c[1100][1100];
int  par[210000];
int find(int x) { if (par[x] == x)return x; par[x] = find(par[x]); return par[x]; }
void unite(int x, int y) { x = find(x); y = find(y); if (x == y)return; par[x] = y; }
bool same(int x, int y) { return find(x) == find(y); }
int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++)par[i] = i;  // このように初期化
	rep(i, m) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--, b[i]--;
		unite(a[i], b[i]);
	}
	rep(i, n) {
		if (f[find(i)]==0) {
			f[find(i)] = 1;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


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

namespace ConsoleApp15
{
    class Class402
    {
        static void Main()
        {
            var ABC = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = ABC[0], B = ABC[1], C = ABC[2];
            for(int i = 1; i <= 10000; i++)
            {
                int num = A * i;
                if (num % B == C)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 28252