akhauriyash/Code-Regression huggingface dataset:
/*****And nothing else matters!******/

#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define setbits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define sp(x) fixed << setprecision(10) << x
#define nitro ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

int main()
{
    nitro;
    string s;
    cin >> s;
    if(s.back() == 's')
        cout << s << "es";
    else
        cout << s << 's';
}


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

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<int> AC(N,0);
  for (int i = 0; i < N-1; i++) {
    if (i > 0) AC[i] = AC[i-1];
    if (S[i] == 'A' && S[i+1] == 'C') AC[i]++;
  }
  for (int i = 0; i < Q; i++) {
    int l, r;
    cin >> l >> r;
    cout << AC[r-2] - AC[l-2] << endl;
  }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 1000000000000000
#define mod 1000000007
#define ld long double
#define pll pair<ll,ll>
using namespace std;

int main()
{ 
	

fast;

ll n;
cin>>n;

ll a[n],b[n];

for(ll i=0;i<n;i++)cin>>a[i]>>b[i];

	sort(a,a+n);
sort(b,b+n);

if(n&1)
{
cout<<b[n/2]-a[n/2]+1;
}

else
{
ld mini=((ld)a[n/2-1]+a[n/2])/2;
ld maxi=(((ld)b[n/2]+(ld)b[n/2-1])/2);
ll ans=(maxi-mini)*2+1;
cout<<ans<<endl;
}



}


Measured memory_bytes: 6768
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<bool> vb;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

class Graph{
	private:
	int GV;
	vvp List;
	int Diametarfunc(int s,int& d){
		int ansv;
		vb used(GV);
		used[s]=1;
		queue<P> que;
		que.push(P(s,0));
		while(!que.empty()){
			P v=que.front();
			que.pop();
			if(v.second>d){
				ansv=v.first;
				d=v.second;
			}
			for(int i=0;i<List[v.first].size();i++){
				P u=List[v.first][i];
				if(!used[u.first]){
					used[u.first]=1;
					que.push(P(u.first,v.second+u.second));
				}
			}
		}
		return ansv;
	}
	public:
	Graph(int v){
		GV=v;
		List=vvp(v);
	}
	void add_edge(int x,int y,int c){
		List[x].push_back(P(y,c));
		List[y].push_back(P(x,c));
	}
	int Diametar(){
		int d=0,ansl,ansr;
		ansl=Diametarfunc(0,d);
		d=0;
		ansr=Diametarfunc(ansl,d);
		return d;
	}
};

int V;

int main(){
	cin>>V;
	Graph gra(V);
	int s,t,c;
	while(cin>>s>>t>>c) gra.add_edge(s,t,c);
	cout<<gra.Diametar()<<endl;
}

Measured memory_bytes: 7688
#include <stdio.h>
#include <stdlib.h>

int main() {
    int n,s[100] = {};
    int i;
    double ans[100],denominator = 0,final;
    
    scanf("%d",&n);
    for(i = 0; i < n; i++) {
        scanf("%d",&s[i]);
        ans[i] = 1/(double)s[i];
        denominator += ans[i];
    }
    final = 1/denominator;
    printf("%lf",final);
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

// AtCoder
// #include <atcoder/all>
// using namespace atcoder;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll s; cin >> s;
    ll MOD = (ll)1e9 + 7;
    vector<ll> dp(max(10LL, s + 1), 0), sum(max(10LL, s + 1), 0);
    rep (i, 3, 6) {
        dp[i] = 1;
        sum[i] = i - 2;
    }
    rep (i, 6, max(6LL, s + 1)) {
        dp[i] = (1 + sum[i - 3]) % MOD;
        sum[i] = (dp[i] + sum[i - 1]) % MOD;
    }
    // if (s < 3) cout << 0 << "\n";
    // else if (s < 6) cout << s - 2 << "\n";
    // else 
    rep (i, s + 1) {
        eprintf("%lld %lld\n", dp[i], sum[i]);
    }
    cout << dp[s] << "\n";
    /***************************************************/
    /* Submit this code from the browser if using ACL! */
    /***************************************************/
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int N, i, ans;
    cin >> N;
    int num[N];
    for(i=0; i<N; i++){
        cin >> num[i];
    }
    sort(num, num + N);
    
    ans = num[N-1] - num[0];
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
//#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;
#define FIN freopen("in.txt", "r", stdin);

int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    double ret = 0;
    for (int i = 1; i <= a; i++)
    {
        double tmp = 1.0 / a;
        int now = i;
        while (now < b)
        {
            now *= 2;
            tmp /= 2;
        }
        ret += tmp;
    }
    printf("%.12f\n", ret);
}


Measured memory_bytes: 3212
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;
int n;
vector<int> a;

void dfs(int cnt,set<int>& s,vector<int>& ans,multiset<int>& ms){
    if(cnt==n){
        for(int i=0;i<n;i++) cout<<ans[i]+1<<" ";
        cout<<endl;
        exit(0);
    }
    auto dosome=[&](int v){
        if(!ans.empty() && a[ans.back()]==v) return;
        s.erase(v);
        ms.erase(ms.find(a[v]));
        ans.push_back(v);

        dfs(cnt+1,s,ans,ms);

        ans.pop_back();
        s.insert(v);
        ms.insert(a[v]);
    };
    if(ms.size()>3){
        if(*ms.begin()==*next(ms.rbegin())){
            if(s.count(*ms.begin())){
                dosome(*ms.begin());
                return;
            }
        }
        if(*ms.rbegin()==*next(ms.begin())){
            if(s.count(*ms.rbegin())){
                dosome(*ms.rbegin());
                return;
            }
        }
    }
    int iter=-1;
    while(true){
        auto it=s.upper_bound(iter);
        iter=*it;
        if(it==s.end()) break;
        dosome(*it);
    }
}
int main(){
    cin>>n;
    a.resize(n);
    for(int i=0;i<n;i++) cin>>a[i],a[i]--;

    if(n==2){
        cout<<-1<<endl;
        return 0;
    }
    set<int> s;
    for(int i=0;i<n;i++) s.insert(i);
    multiset<int> ms;
    for(int i=0;i<n;i++) ms.insert(a[i]);
    vector<int> ans;
    dfs(0,s,ans,ms);
    
    return 0;
}


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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

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

    int a, b, c; cin >> a >> b >> c;

    int k = max(a, max(b, c));

    cout << (10 * k + a + b + c - k) << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 892
#define P(b,c)(x[b]*x[1+c]-x[1+b]*x[c])
float s,t,x[];main(i){for(;~scanf("%f,",&s);i-9||memset(x,!puts((s=P(3,5))*(t=P(5,7))>0&&P(1,3)*s>0&t*P(7,1)>0?"YES":"NO",i=1),36))x[i]+=s,x[++i%8+1]-=s;}

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

    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n){
        cin >> p[i];
    }

    int cnt = 0;
    for(int i=1; i<n-1; ++i){
        int sum = p[i-1] + p[i] + p[i+1];
        sum -= max({p[i-1],p[i],p[i+1]}) + min({p[i-1],p[i],p[i+1]});
        if(sum == p[i]){
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i=0; i<n; i++) {
    cin >> v[i];
  }

  vector<int> dp(n);
  dp[0] = 0;
  dp[1] = abs(v[1] - v[0]);
  for (int i=2; i<n; i++) {
    int a1 = dp[i-1] + abs(v[i-1] - v[i]);
    int a2 = dp[i-2] + abs(v[i-2] - v[i]);
    dp[i] = min(a1, a2);
  }
  cout << dp[n-1] << endl;

  return 0;
}

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

int main(){
    int N;
    cin >> N;
    int A;
    int NA[N+1];
    for(int i=1; i<=N; i++){
        NA[i]=0;
    }
    for(int i=2; i<=N; i++){
        cin >> A;
        NA[A]++;
    }

    for(int i=1; i<=N; i++){
        cout << NA[i] << endl;
    }    

    return 0;
}

Measured memory_bytes: 4404
// #pragma GCC optimize("O3")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace ::std;
// clang-format off
template<typename T> T nxt() {T res; cin >> res; return res;}
#define tests() for (int _ = nxt<int>(); _ > 0; _--)
#define nxt1(t,n) t (n); cin >> n
#define nxt2(t,n,m) t (n),(m); cin >> n >> m
#define nxt3(t,n,m,k) t (n),(m),(k); cin >> n >> m >> k
#define rep(i, A) for (int i = 0 ; i < A ; i++)
#define ll long long
typedef pair<int,int> pii;typedef pair<ll, ll> pll;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<ll> vl;typedef vector<vl> vvl;
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl;
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){for(T ti : t)s<<ti<<" ";return s; }
#define all(x) (x).begin(), (x).end()
#define last(vec) vec[vec.size()-1]
#define has(c,x) ((c).find(x) != (c).end())
// clang-format on

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

    int N = nxt<int>();
    ll res = 0;
    for (int i = 1; i <= N; i++) {
        res += (N / i);
        if (N % i == 0)
            res--;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3648
import sys
lines = sys.stdin.readlines()
for line in lines:
    line = line.split(" ")
    inp = []
    for i in line:
        inp.append(int(i))
    a = inp[0]
    b = inp[1]
    c = inp[2]
    d = inp[3]
    e = inp[4]
    f = inp[5]
    delta = a*e - b*d
    x = (c*e-b*f)/delta
    if x==0.0:
        x = 0.0
    y = (-d*c+a*f)/delta
    if y==0.0:
        y = 0.0
    print("%.3f %.3f" % (x,y))

Measured memory_bytes: 7684
def main():
    A, B = input().split()
    A = int(A)
    B_big, B_small = B.split(".")
    B_big = int(B_big)
    B_small = int(B_small)
    print(A*B_big + A*B_small//100)
 
 
if __name__ == "__main__":
    main()


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;

long long cal(long long a, long long b) {
    if(abs(a) == abs(b)) {
        return a != b;
    }
    if(a >= 0 && a <= b || b <= 0 && a <= b) {
        return b-a;
    }
    if(a <= 0 && b >= 0 || a >= 0 && b <= 0) {
        return abs(a+b)+1;
    }
    return abs(a-b)+2;
}

int main() {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    printf("%lld\n", cal(a,b));
    return 0;
}


Measured memory_bytes: 256
program kadai
integer  ::  N,i
integer,allocatable  ::  A(:)


read(*,*) N
allocate(A(N))
read(*,*) A

call qsort(A)
do i=1,N-1
    if(A(i)==A(i+1)) then
        write(*,*) "NO"
        stop
    end if
end do
write(*,*) "YES"
stop

contains
!入れ替え!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine swap(a,b)
implicit none
integer,intent(inout)  ::  a,b
integer  ::  c
c=a
a=b
b=c
end subroutine swap

subroutine qsort(x)
implicit none
integer, intent(inout)  ::  x(:)
integer  ::  first,last
first=1
last=size(x)
call q2sort(x,first,last)
return
end subroutine qsort

recursive subroutine q2sort(x,first,last)
implicit none
integer, intent(inout)  ::  x(:)
integer, intent(inout) ::  first,last
integer  ::  fir, las
integer  ::  i,j
integer  ::  n
n=x((first+last)/2)
i=first
j=last
do
do while (x(i)<n)
i=i+1
end do
do while(x(j)>n)
j=j-1
end do
if (i>j .or. i==j) then
exit
end if
call swap(x(i),x(j))
i=i+1
j=j-1
end do
if (first<i-1) then
las=i-1
call q2sort(x,first,las)
end if
if (last>j+1) then
fir=j+1
call q2sort(x,fir,last)
end if
end subroutine q2sort
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


end program kadai


Measured memory_bytes: 1536
N, M, K = map(int, input().split())
out = 0
mod = 998244353

c = 1

for k in range(K+1):
  out += M * pow(M-1, N-k-1, mod) * c
  out %= mod
  c *= (N-k-1) * pow(k+1, mod-2, mod)
  c %= mod
print(out)

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

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

  int maxValue = 0;
  int x = 0;
  for (char c : S)
  {
    if (c == 'I')
    {
      ++x;
    }
    else
    {
      --x;
    }
    maxValue = max(maxValue, x);
  }

  cout << maxValue << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

template <typename T>
std::unordered_map<size_t, T> group_count(std::vector<T>& v) {
	std::unordered_map<size_t, T> c;
	for(T& e : v) {
		c[e]++;
	}
	return c;
}

int main() {
	int n;
	cin >> n;
	vector<ll> input(n);
	ll sum = 0;
	REP(i, n) {
		cin >> input[i];
		sum += input[i];
	}
	unordered_map<size_t, ll> a = group_count<ll>(input);
	int q;
	cin >> q;
	vector<ll> result;
	REP(i, q) {
		ll b, c;
		cin >> b >> c;
		sum = sum - (b * a[b]) + (c * a[b]);
		a[c] += a[b];
		a[b] = 0;
		result.push_back(sum);
	}

	EACH(e, result) { cout << e << endl; }

	return 0;
}


Measured memory_bytes: 8904
N, M = map(int, input().split())
graph = [[float('inf')]*N for i in range(N)]
graph2 = [[float('inf')]*N for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c
    graph2[a-1][b-1] = c
    graph2[b-1][a-1] = c

edge = set()

for k in range(N):
    for i in range(N):
        for j in range(N):
            if graph2[i][k] + graph2[k][j] < graph2[i][j]:
                graph2[i][j] = min(graph2[i][j], graph2[i][k] + graph2[k][j])

for k in range(N):
    for i in range(N):
        for j in range(N):
            if graph[i][j] == graph2[i][j]:
                edge.add(tuple([i, j]))


print(M - len(edge)//2)

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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll solve(int N, const vector<ll>& xs)
{
    return 0;
}

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

    int a, b;
    cin >> a >> b;

    string x(a, b + '0');
    string y(b, a + '0');

    cout << (x < y ? x : y) << '\n';

    return 0;
}


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

int main(void){
    int i,j,k;
    int N,A,B;
  
    scanf("%d %d %d",&N,&A,&B);
    
    if(A*N <= B){
        printf("%d\n",A*N);
    }else{
        printf("%d\n",B);
    }
    
    return 0;
}



Measured memory_bytes: 128
object Main extends App {
  import scala.io.StdIn._

  val Array(n, m) = readLine.trim.split(' ').map(_.toInt)
  val a = readLine.trim.split(' ').map(_.toLong).sum
  val b = readLine.trim.split(' ').map(_.toLong).sum
  println(a * b)
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def let[A](func: T ⇒ A): A = func(value)
  }
}


Measured memory_bytes: 83700
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main()
{
    fast();
    ll n;
    cin>>n;
    ll ans=0;
    for(ll j=1;j<=n;j++)
    {
        ll ma=n/j;
        ll sum=(ma)*(ma+1)/2;

        ans+=sum*j;
    }
    cout<<ans<<nl;
}


Measured memory_bytes: 3652
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long c,a,b;
    cin>>c>>a>>b;
    if(c>1&&b>=a||c==1&&a==b)
        cout<<(c-2)*(b-a)+1<<endl;
    else{
    	 cout<<0<<endl; 
	}
 } 


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

Measured memory_bytes: 3500
A,B,C=map(int,input().split())
sum = 0
if A == 5 or A ==7:
  sum += A
  if B ==5 or 7:
    sum += B
    if C ==5 or 7:
      sum += C
      if sum == 17:
        print("YES")
      else:
        print("NO")

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

int main(){
  int n, m, sum = 0;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
    sum += a.at(i);
  }
  cout << max(-1, n - sum) << endl;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const ll mod = 1e9 + 7;

int main() {
  int s, w;
  cin >> s >> w;
  if (w >= s) {
	  cout << "unsafe"  << endl;
	} else {
	  cout << "safe" << endl;
	}
  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
map<int,int> Map;
signed main(void){
	ios::sync_with_stdio(false);
	int x,maxn=0;
	while(cin>>x)
		Map[x]++;
	for(map<int,int>::iterator it=Map.begin();it!=Map.end();it++)
		maxn=max(maxn,it->second);
	for(map<int,int>::iterator it=Map.begin();it!=Map.end();it++)
		if(it->second==maxn)
			cout<<it->first<<endl;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
#define ERR 0.00000001
typedef long long ll;

int main(void)
{
	int M1, D1, M2, D2;
	cin >> M1 >> D1;
	cin >> M2 >> D2;
	if(M1==M2) cout << 0 << endl;
	else cout << 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  int tmp;
  cin >> A >> B >> C;
  tmp = A;
  A = B;
  B = tmp;
  
  tmp = A;
  A = C;
  C = tmp;
  cout << A << ' ' << B << ' ' << C << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split(" ")))
B = list(map(int, input().split(" ")))
ans = 0
for i in range(N):
    if A[i] >= B[i]:
        ans += B[i]
    else:
        if A[i] + A[i+1] > B[i]:
            A[i+1] = A[i] + A[i+1] - B[i]
            ans += B[i]
        else:
            ans += A[i] + A[i+1]
            A[i+1] = 0

print(ans)

Measured memory_bytes: 18624
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(ll i=(x);i<(y);i++)
#define RREP(i,x,y) for(ll i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

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

#define dump(x)  cout << #x << " = " << (x) << endl
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class DDiceInLine {
public:
    void solve(std::istream& in, std::ostream& out) {
        int N, K;
        in >> N >> K;
        vector<int> p(N);
        REP(i,0,N) in >> p[i];
        ll currentSum = 0;
        REP(i,0,K) {
            currentSum += p[i];
        }
        double answer = 0;
        REP(i,0,N-K+1) {
            answer = max(answer, (currentSum - K) / 2.0 + K);
            if (i < N-K) {
                currentSum -= p[i];
                currentSum += p[i+K];
            }
        }
        out << fixed << setprecision(10) << answer << "\n";
    }
};


signed main() {
    DDiceInLine solver;
    std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int n,x,t,s;
    scanf("%d%d%d",&n,&x,&t);
    s=n%x;
    if(s!=0)printf("%d\n",(n/x+1)*t);
    else
        printf("%d\n",(n/x)*t);
}


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

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.length(); i++){
        if (s[i] == '+') ans += 1;
        else ans -= 1;
    }
    cout << ans << endl;
}

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

string s;
int main (){
    cin >> s;
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]||s[3]==s[4]) {
        cout << "Bad" << endl;
    } else cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var count = 1;
            for (var i = 1; i < N; i++)
            {
                if (S[i] != S[i - 1]) count++;
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11232
#include<iostream>
#include<bits/stdc++.h>
#include<string>
#include<time.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first    
#define se second
void solve()
{
    ll n,i,j,k;
    cin>>n;
    vector<ll> a(n);
    for(i=0;i<n;i++)
        cin>>a[i];
    ll b[n];
    for(i=0;i<n;i++)
        b[i]=a[i];
    sort(a.begin(),a.end());
    int ct=0;
    for(i=0;i<n;i++)
        if(a[i]!=b[i])
            ct++;
    if(ct==0 || ct==2)
        cout<<"YES";
    else
        cout<<"NO";
}
int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif  
    clock_t tStart = clock();
    ll t,k;
    // cin>>t;
    // while(t--)
        solve();
    // printf("\nTime taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}       

Measured memory_bytes: 256
import math

n = int(input())
ans = [0]*n
root = n ** 0.5

for x in range(1, math.floor(root) + 1):
    for y in range(1, math.floor(root) + 1):
        for z in range(1, math.floor(root) + 1):
            result = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if result <= n:
                ans[result - 1] += 1

for num in ans:
    print(num)

Measured memory_bytes: 9364
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

static const double EPS = 1e-8;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

char stage[20][20];

class Data{
public:
	int cost;
	int x;
	int y;
	int visited;
	Data() : cost(0),x(0),visited(0){}
	Data(int _cost,int _x,int _y,int _visited){
		this->cost = _cost;
		this->x = _x;
		this->y = _y;
		this->visited = _visited;
	}

	bool operator>(const Data& d) const{
		return this->cost > d.cost;
	}
};

int cost[500][1<<10];

int main()
{
	int W,H;
	while(~scanf("%d %d",&W,&H)){
		if(W==H && H==0) break;
		int sx, sy;
		int idx = 0;
		map<P,int> id;
		for(int y=0;y<H;y++){
			char buf[32];
			scanf("%s",buf);
			
			for(int x=0;x<W;x++){
				stage[y][x] = buf[x];
				if(buf[x] == 'o'){
					sx = x;
					sy = y;
				}
				else if(buf[x] == '*'){
					id[P(x,y)]=idx++;
				}
			}
		}
		
		priority_queue<Data,vector<Data>,greater<Data> > que;
		que.push(Data(0,sx,sy,0));

		
		memset(cost,0x3f,sizeof(cost));

		cost[sy*W+sx][0] = 0;
		while(!que.empty()){
			Data d = que.top();
			que.pop();

			for(int i=0;i<4;i++){
				int dx = d.x + tx[i];
				int dy = d.y + ty[i];
				if(dx < 0 || dx >= W || dy < 0 || dy >= H) continue;
				if(stage[dy][dx] == 'x') continue;

				int next = d.visited;
				if(id.find(P(dx,dy)) != id.end()){
					next |= (1<<id[P(dx,dy)]);
				}

				if(cost[dy*W+dx][next] <= d.cost + 1) continue;
				cost[dy*W+dx][next] = d.cost + 1;
				que.push(Data(d.cost+1,dx,dy,next));
			}
		}

		int flag = 0;
		for(map<P,int>::iterator it = id.begin(); it != id.end(); it++){
			flag |= (1<<it->second);
		}

		int minv = 0x3f3f3f3f;
		for(int i=0;i<=W*H;i++){
			minv = min(cost[i][flag],minv);
		}

		printf("%d\n",minv == 0x3f3f3f3f ? -1 : minv);
	}
}

Measured memory_bytes: 3180
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define ld long double
#define FAST ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define ins insert
#define ph push
#define mmst(x,v) memset(x,v,sizeof(x))
#define all(x) (x).begin(), (x).end()
#define LLINF ((long long)1e18)
#define MAXN 300006
#define FOR(i,s,e) for(ll i=s;i<e;i++)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
ll n, A[MAXN];
ll bstar(ll x) {
	ll ans = 0;
	for(ll i=1;i<=n;i++) {
		ans += llabs(A[i] - (x+i));
	}
	return ans;
}
vector<ll>v;
int main()
{
	FAST
	cin>>n;
	for(ll i=1;i<=n;i++)cin>>A[i];
	for(ll i=1;i<=n;i++)v.pb(A[i]-i);
	sort(all(v));
	cout<<bstar(v[n/2])<<'\n'; return 0;
	// for(ll i=-10;i<=10;i++) {
		// cerr<<bstar(i)<<' ';
	// }
	// cerr<<'\n';
	ll st=-1e9-MAXN, en = 1e9 + 2, lmid = 0, umid = 0;
	while(en-st > 2) {
		lmid = st+(en-st)/3;
		umid = en-(en-st)/3;
		if(bstar(lmid)>bstar(umid))st=lmid;
		else en=umid;
	}
	cout<<bstar((st+en)>>1ll)<<'\n';
}



Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
#define sx 200007
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(s[i]=='Z')
                s[i]='A';
            else
                s[i]++;
        }
        cout<<s[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int a,b; cin >> a >> b;
    int ans = 0;
    rep(i,a){
        int num; cin >> num;
        ans += min(num*2,abs(b-num)*2);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int N;
int parent[100001];
char isLeaf[100001];

int calcDepth(int i) {
  if(parent[i] == -1) return 0;
  return calcDepth(parent[i]) + 1;
}

int main() {
  int i,j;
  scanf("%d", &N);
  for(i = 0; i < N; ++i) {
    parent[i] = -1;
    isLeaf[i] = 1;
  }
  for(i = 0; i < N; ++i) {
    int id, k;
    scanf("%d %d", &id, &k);
    while(k--) {
      int c;
      scanf("%d", &c);
      parent[c] = id;
      isLeaf[id] = 0;
    }
  }
  for(i = 0; i < N; ++i) {
    int depth = calcDepth(i);
    printf("node %d: parent = %d, depth = %d, ", i, parent[i], depth);
    if(isLeaf[i]) {
      printf("leaf\n");
    } else if(depth == 0) {
      printf("root\n");
    } else {
      printf("internal node\n");
    }
  }
  return 0;
}

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

public class Main{

	
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner();
		PrintWriter out=new PrintWriter(System.out);
		char []s=sc.next().toCharArray();
		int []c=new int [2];
		for(char x:s)
			c[x-'0']++;
		out.println(Math.min(c[0], c[1])<<1);
		out.close();

	}
	
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		Scanner(String fileName) throws FileNotFoundException{
			br=new BufferedReader(new FileReader(fileName));
		}
		String next() throws IOException {
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		String nextLine() throws IOException {
			return br.readLine();
		}
		int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		long nextLong()  throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
		
	}
}


Measured memory_bytes: 23124
#include <stdio.h>
#include <iostream>
#include <cstdlib>
using namespace std;

int main(){
    long long x, y;
    cin >> x >> y;
    if(abs(x-y) < 2){
        cout << "Brown" << endl;
    }else{
        cout << "Alice" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;

ll nCr(ll n, ll r) {
	if (r > n) { return 0; }
	if (r * 2 > n) r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
ll sumdigit(ll n) {
	ll dig = 0, sum = 0;
	while (n) {
		dig = n % 10;
		sum = sum + dig;
		n = n / 10;
	}
	return sum;
}



int main() {
	std::string a, b,anum,bnum;
	std::cin >> a >> b;
	if (a.length() < b.length()) {
		std::cout << "LESS" << std::endl;
		return 0;
	}
	else if (a.length() == b.length()) {
		rep(i, a.length()) {
			anum = a[i];
			bnum = b[i];
			if (std::stoi(anum) < std::stoi(bnum)) {
				std::cout << "LESS" << std::endl;
				return 0;
			}
			else if(std::stoi(anum) > std::stoi(bnum)) {
				std::cout << "GREATER" << std::endl;
				return 0;
			}
		}
		std::cout << "EQUAL" << std::endl;
		return 0;

	}
	else {
		std::cout << "GREATER" << std::endl;
		return 0;
	}


	return 0;
}

Measured memory_bytes: 256
/* 
 * File:   main.c
 * Author: s1252007
 *
 * Created on June 26, 2018, 11:39 AM
 */

#include <stdio.h>
#include <stdlib.h>
#define NIL -1

/*
 * 
 */

int BinarySearch(int *S, int n, int key);

int main(int argc, char** argv) {
    int n, q, checkSearch, counter = 0;
    int *S, *T;
    scanf("%d", &n);
    S = (int *)malloc(sizeof(int) * n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    T = (int *)malloc(sizeof(int) * q);
    for (int j = 0; j < q; j++)
    {
        scanf("%d", &T[j]);
    }
    
    for (int ix = 0; ix < q; ix++)
    {
        checkSearch = BinarySearch(S, n, T[ix]);
        if (checkSearch != NIL) counter++;
    }
    printf("%d\n", counter);
    return (EXIT_SUCCESS);
}

int BinarySearch(int *S, int n, int key)
{
    int left = 0, counter = 0, right = n;
    while (left < right)
    {
        int mid = (left + right)/2;
        if (key == S[mid]) return mid;
        if (key > S[mid]) left = mid + 1;
        else if (key < S[mid]) right = mid;
    }
    return NIL;
}






Measured memory_bytes: 2292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (size_t i = 0; i < (size_t)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;

    int a[1000], b[1000], c[1000], dist[100][100];
    rep(i, N)
    {
        rep(j, N)
        {
            dist[i][j] = INF;
        }
        dist[i][i] = 0;
    }
    rep(i, M)
    {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
        dist[a[i]][b[i]] = c[i];
        dist[b[i]][a[i]] = c[i];
    }

    rep(k, N)
    {
        rep(i, N)
        {
            rep(j, N)
            {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int res = 0;
    rep(i, M)
    {
        if (c[i] > dist[a[i]][b[i]]) {
            ++res;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
I=lambda:map(int,input().split())
divup=lambda x,y:(x+y-1)//y
D,G=I()
P={};C={};Score={}
for i in range(D):P[i],C[i]=I();Score[i]=-~i*100*P[i]+C[i]
r=1e9+7
for k in range(1<<D):
    str_branch=str(bin(k))[2:].rjust(D,'0')
    probs=0;score=0
    for i,b in enumerate(str_branch):
        if b=='1':probs+=P[i];score+=Score[i]
    if score>=G:r=min(r,probs);continue
    for i in range(D)[::-1]:
        pi=-~i*100
        if str_branch[i]=='0' and G-score<pi*P[i]:
            r=min(r,probs+divup(G-score,pi));break
print(r)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
	      Scanner scan = new Scanner(System.in);
		  
		  while(scan.hasNextLine()) {
		     int i = scan.nextInt();
			 int j = scan.nextInt();
			 if(i == 0 && j == 0) break;
			 
			 if(i > j) {
				 i = i + j;
				 j = i - j;
				 i = i - j;
			 }
			 
			 System.out.println(i + " " + j);
			 scan.nextLine();
		  }
	   }

}



Measured memory_bytes: 50980
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li		int32_t
#define lli		long long
#define ulli unsigned long long

#define pn			 printf("\n")
#define nl			 cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)	for(i=a;i<b;i++)
#define repr(i,a,b)	for(i=a;i>b;i--)
#define elif		else if
#define mset(a,b)	memset(a,b,sizeof(a))

#define pb		push_back
#define pob		pop_back
#define itr		iterator
#define sz()	size()
#define szof    sizeof
#define lb		lower_bound
#define ub		upper_bound
#define mp		make_pair
#define vlli    vector<lli>
#define plli	pair<lli,lli>
#define vplli	vector<plli >
#define F   	first
#define S		second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000LL
#define MX2     1000000LL
#define Inf     1000000000000000LL
#define mod		1000000007LL
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

int main()
{
    opt;

    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/

    lli R,G;
    cin>>R>>G;

    cout<<2*G-R;








 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ctype.h>
using namespace std;

int main() {
    int a,b,c,d,e; cin >> a >> b >> c >> d >> e;
    int k; cin >> k;
    string ans = "Yay!";
    if (e-a>k) ans = ":(";
    cout << ans << endl;


}

Measured memory_bytes: 256
N = int(input())
ans = 0
escape = 0
for i in range(N, 0, -1):
	if i == 1:
		print(1)
		break
	ans = i
	while(1):
		if i%2 != 0:
			break
		if i%2 == 0 and i/2 != 1:
			i = i/2
		if i%2 == 0 and i/2 == 1:
			print(ans)
			escape = 1
			break
	if escape == 1:
		break

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<vector<int> > Matrix;
Matrix d; 
const int INF = 100000000;


int main(){
  int n,q;
  std::cin >> n>>q;
  string s;
  std::cin >> s;
  std::vector<int> l(q),r(q);
  rep(i,q)std::cin >>l[i]>> r[i];
  std::vector<int> han(n,0),su(n,0);
  for (int i = 0; i < n; i++) {
    /* code */
    if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')han[i]=1;
  }
  
  for (int i = 1; i < n; i++) {
    /* code */
    if(s[i-1]=='A'&&s[i]=='C')su[i]=su[i-1]+1;
    else su[i]=su[i-1];
  }
  rep(i,q)std::cout << su[r[i]-1]-su[l[i]-1] << std::endl;
  
}

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

int main(void) {
    int H,W;
    cin>>H>>W;
    char C[H+1][W+1];
    for (int i = 0; i < H; i++) C[i][0] = 'H';
    for (int j = 0; j < W; j++) C[0][j] = 'W';
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            char c;
            cin>>c;
            C[i][j] = c;
        }
    }
    for (int i = 1; i <= 2 * H; i++) {
        double index = (i + 1) / 2.0;
        int index_i = index;
        for (int j = 1; j <= W; j++) {
            cout << C[index_i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();

	}
	static class Task{
		int M = (int) (1e9 + 7);
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			
				int w = in.nextInt(), h = in.nextInt(), x = in.nextInt(), y = in.nextInt();
				int f = ((x*2==w && y*2 == h)?1:0);
				out.print(String.format("%.9f %d",(double)w*h/2.0,f));
				
				
					
						
		
				
		}//Solve
		
	}//task
	
	
	static class InputReader{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		public String next() {
			while(tokenizer == null || ! tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for(int i = -1; ++i < n;) arr[i] = Integer.parseInt(next());
			return arr;
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public float nextFloat() {
			return Float.parseFloat(next());
		}
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll INF = 1LL << 58;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};
//x以下の要素への最小index
template <class T> int former(const vector<T> &v, T x) {
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
//x以上の要素への最小index
template <class T> int latter(const vector<T> &v, T x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
//vector書き出し
template <class T1>
void cout_vec(const int n, vector<T1> &vec1){
  rep(i, n){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}
//nCk
ll comb(ll n,ll k){
    ll ans=1;
    FOR(i,n-k+1,n+1){
        ans*=i;
    }
    FOR(i,1,k+1){
        ans/=i;
    }
    return ans;
}
//a,bの最大公約数
ll gcd(ll a,ll b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,k;
    vector<int> x;
    cin>>a>>b>>k;
    FOR(i,a,a+k){
        if(a<=i && i<=b){
            x.push_back(i);
            cout<<i<<endl;
        }
    }
    FOR(i,b-k+1,b+1){
        if(count(x.begin(),x.end(),i)==0 && a<=i && i<=b){
            cout<<i<<endl;
        }
    }
}

Measured memory_bytes: 256
import sys
import math

def main(inp):
    N=int(next(inp).split()[0])
    cap = [int(next(inp).split()[0]) for _ in range(5)]
    
    time=math.ceil(N/cap[0])
    
    for i in range(1,5):
        if(cap[i-1]<=cap[i]):
            cap[i]=cap[i-1]
            time+=1
#        elif(cap[i-1]>=N):
#            time+=math.ceil(N/cap[i])
        else: time+=math.ceil(N/cap[i])-math.ceil(N/cap[i-1])+1
            
    return time
  
print(main(sys.stdin))


Measured memory_bytes: 3060