akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define MAX 30
#define INFTY 901

std::map<char,int> create_map() {
    std::map<char, int> m;
    m.insert({'L', 0});
    m.insert({'U', 1});
    m.insert({'R', 2});
    m.insert({'D', 3});
    return m;
};
static std::map<char, int> m = create_map();

class square {
public:
    bool walls[4];
    square() {
        std::memset(walls, false, sizeof(walls));
    }
    void setWall(char d) {
        walls[m[d]] = true;
    }
    void reset() {
        std::memset(walls, false, sizeof(walls));
    }
};
int W, H, sx, sy, gx, gy;
square map[MAX][MAX];
int d[MAX][MAX];
static int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
static char dirs[4] = {'D', 'R', 'U', 'L'};

int bfs() {
    std::queue< std::pair<int, int> > Q;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) d[i][j] = INFTY;
    }

    Q.push({sx, sy});

    d[sx][sy] = 1;
    int nx, ny, dir;
    while (Q.size()) {
        std::pair<int, int> p = Q.front(); Q.pop();

        if (p.first == gx && p.second == gy) break;

        for (int i = 0; i < 4; i++) {
            dir = m[dirs[i]];
            nx = p.first + dx[i], ny = p.second + dy[i];
            if (0 <= nx && nx < H && 0 <= ny && ny < W && d[nx][ny] == INFTY && !map[p.first][p.second].walls[dir]) {
                Q.push({nx, ny});
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[gx][gy];
}


int main()
{

    int tmp;

    while (1) {

        std::scanf("%d %d", &W, &H);
        if (W == 0 && H == 0) break;

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) map[i][j].reset();
        }

        for (int i = 0; i < H; i++) {
            //vertical set
            for (int j = 0; j < W-1; j++) {
                std::scanf("%d", &tmp);
                if (tmp == 1) {
                    map[i][j+1].setWall('L');
                    map[i][j].setWall('R');
                }
            }
            if (i == H-1) break;
            //horizontal set
            for (int j = 0; j < W; j++) {
                std::scanf("%d", &tmp);
                if (tmp == 1) {
                    map[i][j].setWall('D');
                    map[i+1][j].setWall('U');
                }
            }
        }

        sx = sy = 0;
        gx = H-1, gy = W-1;

        int res = bfs();

        (res == INFTY) ? std::printf("%d\n", 0) : std::printf("%d\n", res);

    }

    return 0;
}



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

const int N = 1e5 + 5;

int n;
int a[N];
map<int, int> C;

int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    C[a[i]]++;
  }
  int ans = 0;
  for (auto it = C.begin(); it != C.end(); it++) {
    if (it->first > it->second) ans += it->second;
    else if (it->first < it->second) ans += it->second - it->first;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5120
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, a, b = map(int, input().split())

    mod = n % (a + b)

    print(n // (a + b) * a + min(mod, a))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int MAX_N=100000;

int main(){
    ios::sync_with_stdio(false);
    int n;
    int x[MAX_N],l[MAX_N];
    cin >> n;
    rep(i,n){
        cin >> x[i] >> l[i];
    }
    P time[MAX_N];
    rep(i,n){
        time[i].first=x[i]+l[i];
        time[i].second=x[i]-l[i];
    }
    sort(time,time+n);
    int ans=0,t=-1000000000;
    rep(i,n){
        if(t<=time[i].second){
            t=time[i].first;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define buf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double dob;
#define MAX 50010
#define M5 500009
#define M6 2000009
#define M 1000000007
#define inf LLONG_MAX
using namespace std;
typedef vector<ll> V;
typedef queue<ll > Q;
typedef stack<ll> S;
typedef pair<ll,ll> P;
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
ll fac[M6],not_prime[M6];
ll power(ll x,ll n){
    if(n==0) return 1;
    /*while(n){
        if(n%2) x=(((x*x)%M)*x)%M; 
        else x=(x*x)%M;
        n/=2;
    }*/
    if(n%2 == 0) return power((x*x)%M,n/2);
    else return (x*power((x*x)%M,(n-1)/2))%M;
}
void fact(){
    fac[0]=1;
    for(ll i=1;i<M6;i++) fac[i]=(i*fac[i-1])%M;
}
void sieve(){
    not_prime[1]=1; not_prime[0]=1;
    for(ll p=2;p*p<M6;p++){
        if(!not_prime[p]){
            for(ll i=p*2;i<=M6;i+=p) not_prime[i]=1;
        }
    }
}
ll modi(ll a, ll m){
    ll m0 = m, t, q; ll x0 = 0, x1 = 1;
    if (m == 1) return 0;
    while (a > 1){  q = a / m; t = m; m = a % m, a = t;t = x0;x0 = x1 - q * x0; x1 = t;}
    if (x1 < 0) x1 += m0;return x1;
}
ll n,m,q,ar[M5],br[M5],cr[M5];
int main(){
    buf; 
    //sieve(); 
    //fact();
    ll i,j,k,test,flag,ans,t,a,b,c,d; string s;
    //cin>>test;
    test=1;
    while(test--){
        cin>>n;
        for(i=1;i<=n;i++) cin>>ar[i];
        for(i=1;i<=n;i++) cin>>br[i];
        for(i=1;i<=n;i++) cin>>cr[i];
        sort(ar+1,ar+n+1); sort(br+1,br+n+1); sort(cr+1,cr+n+1);
        ans=0;
        for(i=1;i<=n;i++){
            a=upper_bound(cr+1,cr+n+1,br[i])-cr;
            b=lower_bound(ar+1,ar+n+1,br[i])-ar;
            //cout<<n-a+1<<" "<<b<<"\n";
            ans+=(n-a+1)*(b-1);
        }
        cout<<ans;
    }
    return 0;
} 

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

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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 T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int M, N;
  cin >> M >> N;
  int ret = 0;
  auto A = make_v< int >(N, 4);
  for(int i = 0; i < N; i++) {
    cin >> A[i][0];
    for(int j = 1; j < 4; j++) {
      A[i][j] = min(j, M);
    }
  }
  vector< int > dp{0, 1, 1, 1};
  for(int i = 1; i < N; i++) {
    auto dp2 = make_v< int >(4);
    fill_v(dp2, inf);
    for(int j = 0; j < 4; j++) {
      for(int k = 0; k < 4; k++) {
        if(A[i - 1][j] == A[i][k]) continue;
        chmin(dp2[k], dp[j] + (k != 0));
      }
    }
    dp.swap(dp2);
  }
  cout << *min_element(begin(dp), end(dp)) << endl;
}



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

int main()
{
  ll n; cin >> n;
  string s; cin >> s;
  rep(k, 4) {
    vector<int> a(n, 0);
    rep(i, 2) a[i] = (k>>i)&1;

    for (int i=1; i<n; i++) {
      int l = (i-1+n)%n;
      int r = (i+1)%n;
      int t = s[i]=='o' ? 0 : 1;
      a[r] = a[l]^a[i]^t;
    }
    if ((a[n-1]^a[1]^(s[0]=='o'?0:1)) == a[0]
        && (a[0]^a[2]^(s[1]=='o'?0:1)) == a[1]) {
      rep(j, n) {
        if (a[j]) cout << "W";
        else cout << "S";
      }
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 1016
#import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common

#N = int(input())
#N,K= map(int,input().split())
A = list(map(int,input().split()))
#S= str(input())

a=A.index(0)
print(a+1)


Measured memory_bytes: 9084
#include<bits/stdc++.h>
using namespace std;
#define int long long
bool isPalin(string s)
{
	string t = s;
	reverse(s.begin(),s.end());
	return s==t;
		

}

int32_t main()
{
	string s;
	cin>> s;
	int n = s.length();
	if(isPalin(s) && isPalin(s.substr(0,(n-1)/2)) && isPalin(s.substr((n+3)/2-1)))
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	

	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Pb push_back
using namespace std;
typedef long long ll;
const int MAXN = ( 1 << 18 ) + 7;
inline int R()
{
    int rt = 0; char ch = getchar(); bool isn = false;
    for ( ; ch < '0' || ch > '9'; ch = getchar() ) isn = ch == '-' ? true : isn;
    for ( ; ch >= '0' && ch <= '9'; ch = getchar() ) rt = rt * 10 + ch - '0';
    return isn ? -rt : rt;
}

int n;
int a[MAXN];
int dp[MAXN][2];
int tp[7];
bool Cmp ( int t1, int t2 ) { return t1 > t2; }

int main()
{
	n = R();
	int lm = ( 1 << n );
	for ( int i = 0; i < lm; ++i )
		a[i] = R();
	int ans = 0;
	for ( int i = 1; i < lm; ++i )
	{
		for ( int j = i; j; j = ( j - 1 ) & i )
		{
			if ( a[j] >= dp[i][0] )
				dp[i][1] = dp[i][0], dp[i][0] = a[j];
			else
				dp[i][1] = max ( dp[i][1], a[j] );
		}
		if ( a[0] >= dp[i][0] )
			dp[i][1] = dp[i][0], dp[i][0] = a[0];
		else
			dp[i][1] = max ( dp[i][1], a[0] );
		ans = max ( ans, dp[i][0] + dp[i][1] );
		printf ( "%d\n", ans );
	}
	return 0;
}

Measured memory_bytes: 6144
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using Um = unordered_map<char,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

//0-indexedに注意！！
class UnionFind {
public:
    vector < ll > par; // 各元の親を表す配列
    vector < ll > siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor,[0,sz_-1)で定義
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll K;
    cin >> K;
    ll T;
    cin >> T;
    vector<ll> a(T,0);
    for(ll i=0;i<T;++i)cin>>a[i];
    sort(a.rbegin(), a.rend());
    ll Max=a[0];
    if(K%2==1){
        if(Max<=K/2+1)prt(0);
        else {
            prt(2*(Max-K/2-1));
        }
    }
    else {
        if(Max<=K/2)prt(0);
        else prt(-1+2*(Max-K/2));
    }
    
fl
    return 0;
}



Measured memory_bytes: 3556
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;




int main(){
    IOS
    //freopen("output.txt","w",stdout);
    int n,k;
    cin>>n>>k;

    ll dp[n];
    for(int i=0;i<n;i++)dp[i]=INF;
    ll arr[n];
    for(int i=0;i<n;i++)cin>>arr[i];
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<=i+k && j<n;j++){
            dp[j]=min(dp[j],dp[i]+abs(arr[i]-arr[j]));
        }
    }
    cout<<dp[n-1]<<"\n";
}


Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
#define REP(i,n) for (int i=0;i<=(n);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int INF = 10000000;

int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main(){
    int a, b;
    cin >> a >> b;
    for(int i = 0; i <= 1009; ++i){
        double x = i * 0.08;
        double y = i * 0.1;
        int ix = floor(x);
        int iy = floor(y);
        if(ix == a && iy == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define gI gi

using namespace std;

typedef long long ll;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline ll gl()
{
	ll f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

ll n, m, f[5];
string s, t, q;

int gcd(int a, int b)
{
	if (!b) return a;
	return gcd(b, a % b);
}

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	n = gl(), m = gl();
	ll j = gcd(n, m);
	cout << n / j * m << endl;
	return 0;
}



Measured memory_bytes: 256
use std::cmp;
use std::cmp::max;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let lr: Vec<(i64, i64)> = (0..n).map(|_| (sc.read(), sc.read())).collect();
    let mut left = vec![];
    let mut right = vec![];
    for (l, r) in lr.into_iter() {
        left.push(l);
        right.push(-r);
    }
    left.sort();
    right.sort();
    left.reverse();
    right.reverse();

    let mut left_sum = vec![0; n + 1];
    let mut right_sum = vec![0; n + 1];
    for i in 0..n {
        left_sum[i + 1] = left_sum[i] + left[i];
        right_sum[i + 1] = right_sum[i] + right[i];
    }

    let mut max = 0;
    for i in 0..n {
        if i > 0 {
            max = cmp::max(max, left_sum[i] + right_sum[i - 1]);
        }
        max = cmp::max(max, left_sum[i] + right_sum[i]);
        max = cmp::max(max, left_sum[i] + right_sum[i + 1]);
    }

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

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

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


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

struct UnionFindSize {
    vector<int> par;
    
    UnionFindSize(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

ll N, M;

int solve(int x, vector<pll> &E){
	UnionFindSize uf(N);
	REP(i, M){
		if(i != x) {
			uf.merge(E[i].first, E[i].second);
		}
	}

	set<ll> st;
	REP(i, N){
		st.insert(uf.root(i));
	}
	//cout << (int)st.size() << endl;
	return ((int)st.size() == 2 ? 1 : 0);
}

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

    cin >> N >> M;
    vector<pll> Es(M);
    REP(i, M){
    	cin >> Es[i].first >> Es[i].second;
    	Es[i].first--;
    	Es[i].second--;
    }

    ll res = 0;
    REP(i, M) res += solve(i, Es);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
/* Selection Sort */
#include <stdio.h>

int main()
{
    int A[100], N, i, j, minj, cnt=0, temp;

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

    for(i=0; i<N-1; i++){
        minj = i;
        for(j=i; j<N; j++){
            if(A[j] < A[minj]){ minj = j; }
        }
        temp = A[i];
        A[i] = A[minj];
        A[minj] = temp;
        if(i != minj){ cnt++; }
    }

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


Measured memory_bytes: 2100
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll LINF = 1001002003004005006LL;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n, k; cin >> n >> k;
    map<int,int> mp;
    rep(i,k) {
        int d; cin >> d;
        vector<int> a(d);
        rep(i,d) {
            cin >> a[i];
            --a[i];
            mp[a[i]]++;
        }
    }
    int ans = 0;
    rep(i,n) {
        if (mp[i]==0) ++ans;
    }
    cout << ans << endl;
    return 0;
}



















Measured memory_bytes: 3632
#include<stdio.h>

int main(void){

int a;

int b;

scanf("%d",&a);

scanf("%d",&b);

if(a<b){

printf("a < b\n");}

if(a>b){

printf("a > b\n");}

if(a==b){

printf("a == b\n");}

return 0;

}

Measured memory_bytes: 580
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
using namespace std;
 

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pb push_back
#define forn(i, n) for (int i = 0; i < n; ++i)
#define int long long

 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
 
 
const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = INT64_MAX;


mt19937 rnd(time(0));


signed main() {
	FAST_IO;
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	forn(i, n) {
		cin >> a[i];
		a[i]--;
	}
	vector<bool> used(n);
	vector<int> cycle;
	int now = 0;
	while (!used[now]) {
		used[now] = 1;
		cycle.pb(now);
		now = a[now];
	}
	int j = 0;
	while (cycle[j] != now) {
		j++;
	}
	if (k < cycle.size()) {
		cout << cycle[k] + 1 << "\n";
		return 0;
	}
	k -= j;
	int cc = cycle.size() - j;
	int rem = k % cc;
	cout << cycle[j + rem] + 1 << "\n";
 	return 0;
}
// 1 6

Measured memory_bytes: 6892
#include <bits/stdc++.h>
using namespace std;
int main ()
{
	int a, b, c, x, ans=0;
	cin>>a>>b>>c>>x;
	for (int i=0;i<=a;i++)
		for(int j=0;j<=b;j++)
			if((x-i*500-j*100>=0)&&(x-i*500-j*100<=c*50)) ans++;
			
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, p, c = 0, q[200005] = {1};
    ll a[10004] = {1}, z = 0;
    string s;
    cin >> n >> p >> s;
    if (p == 2 || p == 5) {
        for (int i = 1; i <= n; i++) if ((s[i - 1] - '0') % p == 0) z += i;
        cout << z;
        return 0;
    }
    for (int i = 1; i <= n; i++) q[i] = q[i - 1] * 10 % p;
    for (int i = 1; i <= n; i++) c = (c * 10 + s[i - 1] - '0') % p, a[(c * q[n - i]) % p]++;
    for (int i = 0; i < p; i++) z += a[i] * (a[i] - 1) / 2;
    cout << z;
}


Measured memory_bytes: 4632
#include <iostream>
#include <string>
#include <vector>
 
using namespace std;
int main(void) {
  
  int N;
  cin >> N;
  int a = N%10;
  if (a == 3) {
  	cout << "bon" << endl;
  } else if (a == 0 || a == 6 || a == 1 || a == 8) {
  	cout << "pon" << endl;
  } else {
  	cout << "hon" << endl;
  }
  return 0;
}

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

using namespace std;

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

  int n, m, a, b;
  cin >> n >> m;
  vector<vector<int>> adj(n);
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    a--; b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 0; i < n; ++i) {
    cout << adj[i].size() << endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >>s;
    char moji='a';
    for(int j=0;j<26;j++){
        int count=0;
        for(int i=0;i<s.size();i++){
            if(s.at(i)==moji)count++;
            
        }
        if(count %2==1){
            cout<< "No" <<endl;
            return 0;
        }
        moji++;
    }
    cout <<"Yes"<<endl;
}

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;

typedef long long int ll;
typedef long double ld;

#define llset tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define en '\n'
#define S second
#define F first
#define pll pair<ll,ll>
#define PB push_back

const ll N = 1e6+7;
ll mod = 1e9+7;
#define calncr for(int i=1  ;i<=1e6;i++) fac[i] = (fac[i-1]*i)%mod;
ll fac[N] = {0};

ll gen_base(const ll before, const ll after) {
    auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
    std::mt19937 mt_rand(seed);
    int base = std::uniform_int_distribution<ll>(before+1, after)(mt_rand);
    return base % 2 == 0 ? base-1 : base;
}

ll pow(ll a,ll b)
{
    if(!b)
        return 1;
    ll p = pow(a,b/2);
    if(b%2)
        return (a*((p*p)%mod))%mod;
    else
        return (p*p)%mod;
}

ll modInv(ll a)
{
    //cout<<a<<" "<<mod<<en;
    return pow(a%mod,mod-2);
}

ll nCr(ll n,ll r)
{
    return (fac[n]*modInv((fac[r]*fac[n-r])%mod))%mod;
}

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    fac[0] = 1;
    calncr;
    ll n;
    cin>>n;
    if(n>=30)
        cout<<"Yes"<<en;
    else
        cout<<"No"<<en;
}


Measured memory_bytes: 11432
#pragma warning (disable :4996)
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const double PI = cos(-1.0);
const double eps = 1e-12;
#define For(i,n,m) for(int i=n;i<=m;++i)
#define clr(a,b) memset(a,b,sizeof(a))


string s;
ll tdp[2019];
ll ans, dp[2019];
int main() {
	ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
	cin >> s;
	clr(dp, 0);
	dp[s[0] - '0'] = 1;
	For(i, 1, s.size() - 1) {
		int d = s[i] - '0';
		clr(tdp, 0);
		tdp[d] = 1;
		For(j, 0, 2019 - 1) {
			if (dp[j] > 0) {
				ll rem = ((j << 3) + (j << 1) + d) % 2019;
				if (rem == 0) ans += dp[j];
				tdp[rem] += dp[j];
			}
		}
		For(i, 0, 2019 - 1) dp[i] = tdp[i];
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3780
#![allow(unused_imports)]
 
use proconio::{input, fastout};
use proconio::marker::*;
use std::collections::HashMap;

#[fastout]
fn main() {
  input! {
    n: usize,
    m: usize,
  }
  
  if m % n == 0 {
    println!("{}", m / n);
    return
  }
  
  let mut map: HashMap<usize, bool> = HashMap::new();
  let mut i = 2;
  let mut v = m;
  while i * i <= m && 0 < v {
    if v % i == 0 {
      map.insert(i, true);
      v /= i;
    } else {
      i += 1;
    }
  }

  if map.keys().len() == 0 {
    println!("1");
    return
  }

  let mut v = m / n;
  while m % v != 0 || (m / v) < n {
    v -= 1;
  }
  println!("{}", v);
}

Measured memory_bytes: 2196
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		int n = int.Parse(input[0]);
		int m = int.Parse(input[1]);
    long c = long.Parse(input[2]);
    long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    int[,] matrix = new int[n,m];
    int answer = 0;
      
    for(int i = 0; i < n; i++)
    {
    	long[] numsa = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);

      long memo = c;
      for(int j = 0; j < m; j++)
      {
        memo += nums[j]*numsa[j];
      }

      if(memo > 0) answer++;
    }
		
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 13140
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

signed main()
{
    ll A, B, C; cin >> A >> B >> C;

    cout << min(A*B*(C%2),min(B*C*(A%2),A*C*(B%2))) << endl;
}


Measured memory_bytes: 256
/*
[dp] G - Longest Path
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 1e5;

int N, M;
vector<int> g[MAX_N];
int dep[MAX_N];
bool visited[MAX_N];

int dfs(int u) {
    if (visited[u]) {
        return dep[u];
    }
    visited[u] = true;

    dep[u] = 0;
    for (int v : g[u]) {
        dep[u] = max(dep[u], dfs(v) + 1);
    }

    return dep[u];
}

ll solve() {
    for (int i = 0; i < N; i++) {
        dfs(i);
    }

    return *max_element(dep, dep + N);
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        g[x - 1].push_back(y - 1);
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 7552
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main() {
    int n = 0;
    scanf("%d", &n);
    int ans = 180 * (n - 2);

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
left=a[0]
kyokushou=[]
kyokudai=[]
if min(a)==max(a):
  print(1000)
else:
  for i in range(n):
    if left<a[i]:
      f=0
      saki=0
      kyokushou.append(0)
      break
    elif left>a[i]:
      f=1
      saki=1
      break

  for i in range(n-1):
    if f==0 and a[i]>a[i+1]:
      kyokudai.append(i)
      f=1
    elif f==1 and a[i]<a[i+1]:
      kyokushou.append(i)
      f=0
      if i==n-2:
        kyokudai.append(n-1)
  if saki==0 and len(kyokudai)==0:
    kabu=1000//min(a)
    shoji=1000-kabu*min(a)
    shoji+=kabu*max(a)
    print(shoji)
  elif saki==1 and len(kyokudai)==0:
    print(1000)
  else:
    kabu=0
    shoji=1000
    for i in range(len(kyokudai)):
      kabu=shoji//a[kyokushou[i]]
      shoji-=kabu*a[kyokushou[i]]
      shoji+=kabu*a[kyokudai[i]]
      kabu=0
    print(shoji)

Measured memory_bytes: 9292
import java.util.Scanner;

public class Main {

	static char[] s;
	static int idx;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int N = cin.nextInt();
		while(N--!=0){
			String str = cin.next();
			idx=0;
			char[] a = str.toCharArray();
			s = new char[150];
			for(int i = 0; i < a.length;i++){
				s[i]=a[i];
			}

			System.out.println(expression());
		}

	}
	static int expression(){
		int res =term();
		while(s[idx]=='+'||s[idx]=='-'){
			if(s[idx]=='+'){
				idx++;
				res+=term();
			}
			else if(s[idx]=='-'){
				idx++;
				res-=term();
			}
		}
		return res;
	}
	static int term(){
		int res = fact();
		while(s[idx]=='*'||s[idx]=='/'){
			if(s[idx]=='*'){
				idx++;
				res*=fact();
			}
			else{
				idx++;
				res/=fact();
			}
		}
		return res;
	}
	static int fact(){
		int res=0;
		if(s[idx]=='('){
			idx++;
			res = expression();
			idx++;
		}
		else{
			while(true){
				res += s[idx]-'0';
				idx++;
				if(!Character.isDigit(s[idx])){
					break;
				}
				res*=10;
			}

		}
		return res;
	}
}

Measured memory_bytes: 12000
# include<bits/stdc++.h>
using namespace std;
const int MAX=4e5+5;
struct p{
	int x,y;
}c[MAX<<1];
int n,m,num;
int h[MAX],vis[MAX];
char s[MAX];
bool use[MAX];
void add(int x=0,int y=0)
{
	scanf("%d%d",&x,&y);
	if(s[x]==s[y]) c[++num]=(p){h[x],y+n},h[x]=num,c[++num]=(p){h[y],x+n},h[y]=num;
	else c[++num]=(p){h[x+n],y},h[x+n]=num,c[++num]=(p){h[y+n],x},h[y+n]=num;
}
void dfs(int x)
{
	vis[x]=1,use[x]=1;
	for(int i=h[x];i;i=c[i].x)
	  if(!vis[c[i].y]) dfs(c[i].y);
	  else if(use[c[i].y]) printf("Yes"),exit(0);
	use[x]=0;
}
int main()
{
	scanf("%d%d%s",&n,&m,s+1);
	for(int i=1;i<=m;add(),++i);
	for(int i=1;i<=n;++i)
	  if(!vis[i]) dfs(i);
	return printf("No"),0;
}

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

class Main {
  public static void main(String[] args) throws Exception{
    try (Scanner sc = new Scanner(System.in)){
      int N = sc.nextInt();
      int M = sc.nextInt();
      int X = sc.nextInt();
      int Y = sc.nextInt();
      int[] Xs = new int[N];
      int[] Ys = new int[M];
      boolean flag = false;
      for (int i = 0; i < N; i++) {
        Xs[i] = sc.nextInt();
      }
      for (int i = 0; i < M; i++) {
        Ys[i] = sc.nextInt();
      }
      out : for (int i = X+1; i <= Y; i++) {
        for (int j = 0; j < N; j++) {
          if (Xs[j] >= i) {
            continue out;
          }
        }
        for (int j = 0; j < M; j++) {
          if (Ys[j] < i) {
            continue out;
          }
        }
        flag = true;
      }
      if (flag) {
        System.out.println("No War");
      } else {
        System.out.println("War");
      }
    }
  }
}


Measured memory_bytes: 23380
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int dp[1000002][2];

int solve(){
  string S="0";
  string T;cin>>T;
  int n = sz(T);
  S += T;
  dump(S);
  
  dp[0][0] = 1;
  rep(i, 1, n+1){  //桁数
    if (S[i]=='0'){
      // dp[i-1][0]
      dp[i][0] += dp[i-1][0];
      dp[i][1] += 3*dp[i-1][1];

      dp[i][0] %= MOD;
      dp[i][1] %= MOD;
    }

    if (S[i]=='1'){
      dp[i][0] += 2*dp[i-1][0];
      dp[i][1] +=   dp[i-1][0];

      dp[i][1] += 3*dp[i-1][1];

      dp[i][0] %= MOD;
      dp[i][1] %= MOD;
    }
    // dump(i, dp[i][0], dp[i][1]);
  }
  cout << (dp[n][0]+dp[n][1])%MOD << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 2000
import java.util.*;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = Integer.parseInt(sc.next());
    	Integer a[] = new Integer[N];

    	for (int i=0; i<N; i++){
    		a[i] = Integer.parseInt(sc.next());
    	}

    	List<Integer> list = new ArrayList<>();

    	for (int num: a){
    		if (!list.contains(num)){
    			list.add(num);
    		}
    	}

    	System.out.println(list.size());

    }
}

Measured memory_bytes: 22612
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int n, p;
	static boolean[] prime;
	static ArrayList<Integer> list = new ArrayList<Integer>();
	public static void main(String[] args) {
		makePrime();
		while(read()){
			solve();
		}
	}
	
	static boolean read(){
		n = sc.nextInt();
		p = sc.nextInt();
		if( n == -1 && p == -1 )return false;
		return true;
	}
	
	static void solve(){
		int pn = n+1;
		int count = 0;
		while(true){
			if(count >= 100)break;
			if(prime[pn])count++;
			pn++;
		}
		for(int i = n+1; i < pn; i++){
			if(prime[i]){
				for(int j = i; j < pn; j++){
					if(prime[j])list.add(i+j);
				}
			}
		}
		Collections.sort(list);
		System.out.println(list.get(p-1));
		list.clear();
	}
	
	static void makePrime(){
		prime = new boolean[200001];
		Arrays.fill(prime, true);
		prime[0] = false;
		prime[1] = false;
		for(int i = 2; i < prime.length; i++){
			if(prime[i]){
				for(int j = i*2; j < prime.length; j += i){
					prime[j] = false;
				}
			}
		}
	}

}

Measured memory_bytes: 15000
#include <stdio.h>

int main(void)
{
	int m[10];
	int temp;
	int i,j,n;

	n=10;
	for(i=0; i<n; i++){
	scanf("%d",&m[i]);
	if(0>m[i]||m[i]>10000)
	  {
	    printf("error\n");
	      return 1;
	  }
	}

	for(i=0; i<n-1; i++)
	{
		 for(j=i+1; j<n; j++)
		 {
			if(m[j] > m[i])
			{
				temp=m[j];
				m[j]=m[i];
				m[i]=temp;
			}
		}
	}

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

Measured memory_bytes: 1028
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    double l;
    cin >> l;
    print(pow(l / 3, 3));

    return 0;
}



Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18


vector<pair<int, int>> edges[100000];
int ans[100000];

void dfs(int i, int par, int pc) {
	int c = 1;
	for (auto p : edges[i]) {
		int j = p.first, idx = p.second;
		if (j == par)continue;
		if (c == pc)c++;
		ans[idx] = c;
		dfs(j, i, c);
		c++;
	}
}

int main() {
	int n; cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int a, b; cin >> a >> b; a--; b--;
		edges[a].emplace_back(b, i);
		edges[b].emplace_back(a, i);
	}

	dfs(0, -1, -1);
	cout << *max_element(ans,ans+n-1)<<endl;
	for (int i = 0; i < n-1; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 9344
//Keep Working Hard
  // I__Like__Food
  #include<bits/stdc++.h>
  #include <ext/pb_ds/assoc_container.hpp> 
  #include <ext/pb_ds/tree_policy.hpp>
  #pragma comment(linker, "/stack:200000000")
  #define rep(i,a,b) for(int i = a; i <=b; i++)
  #define rep2(i,a,b) for(int i = a; i>=b; i--)
  #pragma GCC optimize("O3")
  #pragma GCC optimize("Ofast") 
  #pragma GCC optimize("unroll-loops")
  using namespace std;
  using namespace __gnu_pbds;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 998244353
  #define N 305
  #define INF 1e16
  const double PI = acos(-1);

int dp[N][N];
int32_t main()
{




    int h,w;
    cin  >> h >> w;
    
    char arr[h+1][w+1];



    for(int i = 1; i <= h; i++)
    {
      for(int j = 1; j <= w; j++)
      {
        cin >> arr[i][j];
      }
    }

    for(int i = 0; i <= h; i++)
    {
      for(int j =0; j <= w; j++)
      {
        dp[i][j] = INF;
      }
    }
    dp[0][1] = dp[1][0] = 0;


    for(int i =1; i <= h; i++)
    {
      for(int j =1; j <= w; j++)
      {
        int ans = min(dp[i-1][j],dp[i][j-1]) + 1;

        if(arr[i][j] == '.')dp[i][j] = min(dp[i-1][j],dp[i][j-1]);
        else
        {
        if(arr[i-1][j] == '#')ans = min(ans,dp[i-1][j]);
        if(arr[i][j-1] == '#')ans = min(ans,dp[i][j-1]);
        dp[i][j] = ans;
      } 
      
   
      }
    }








    cout << dp[h][w];
    

  return 0;
} 

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <functional>
#include <cmath>
#include <cstdint>
#include <mutex>
#include <thread>
#include <bitset>

using namespace std;


int main(void)
{
	int n, k,d;

	bool nusuke[100];

	cin >> n >> k;

	for (int i = 0; i < n; i++)
		nusuke[i] = false;

	for (int i = 0; i < k; i++)
	{
		cin >> d;
		for (int j = 0; j < d; j++)
		{
			int hoge;
			cin >> hoge;
			nusuke[hoge - 1] = true;
		}
	}
	int cnt = 0;
	for (int i = 0; i < n; i++)
		if (nusuke[i] == false)
			cnt++;
	cout << cnt;
	return 0;
}

Measured memory_bytes: 3620