akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
int main(){
  ll k; cin >> k;
  ll ans=0;
  rep(a,k){
    rep(b,k){
      rep(c,k){
        ans+=__gcd(__gcd(a,b),c);
      }
    }
  }
  cout << ans;
  return 0;
}


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

#define rep(i, j, k) for(int i = (int) j; i < (int) k; ++i)
#define sz(x) ((int) (x).size())
#define ll long long
#define mp make_pair
#define pii pair<int, int >
#define fi first
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define zero(x) memset((x), (0), sizeof (x))
#define zerox(x, y) memset((x), (y), sizeof (x))

using namespace std;
const int N = 2e5+7;

int a[N], b[N];
int n;

int main()
{
#ifdef PIT
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
#endif //PIT

	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	rep(i, 1, 1+n) cin >> a[i];

	int i, t = 1;
	for(i = n; i > 0; i -= 2) b[t++] = a[i];
	i = (n&1) ? i+3 : i+1;
	for( ; i <= n; i += 2) b[t++] = a[i];
	cout << b[1];
	for(int i = 2; i <= n; ++i) cout << " " << b[i] ;
	cout << endl;
	
#ifdef PIT
flush(cout);
cerr << endl << "Time: " << (clock() / double(CLOCKS_PER_SEC)) << endl;
#endif //PIT
	return 0;
}


Measured memory_bytes: 3712
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
int N,M,A,B,p[1<<17];
vector<int>G[1<<17];
queue<int>q;
inline void solve(void){
  in(N,M);
  rep(i,M){
    in(A,B);
    G[A].pb(B);
    G[B].pb(A);
  }
  p[1]=1;
  q.push(1);
  while(!q.empty()){
    int u=q.front();q.pop();
    for(auto e:G[u]){
      if(!p[e]){
        q.push(e);
        p[e]=u;
      }
    }
  }
  out("Yes");
  up(i,2,N)out(p[i]);
}
int main(void){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 11200
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e18) + 1;
const int mod = 479001599;
const int maxn = 5e5 + 111;
        
using namespace std;          

int a, b, c, d;

void solve(){
	cin >> a >> b >> c >> d;

   	while (true){
   		c -= b;
   		if (c <= 0){
   			cout << "Yes";
   			return;
   		}
   		a -= d;
   		if (a <= 0){
   			cout << "No";
   			return;
   		}
   	}
}   
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;

    //cin >> q;

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

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

int main(int argc, const char * argv[]) {
    int S, W;
    cin >> S;
    cin >> W;
    
    if (S <= W) {
        std::cout << "unsafe\n";
    }else {
        std::cout << "safe\n";
    }
    return 0;
}


Measured memory_bytes: 3636
import itertools
import bisect

N = int(input())
P = list(input().split())
Q = list(input().split())
p = ""
q = ""
for i in P:
    p += str(i)
for i in Q:
    q += str(i)
p = int(p)
q = int(q)

nums = [i for i in range(1, N+1)]
nums = list(itertools.permutations(nums))
lis = []
for num in nums:
    tmp = ""
    for i in num:
        tmp += str(i)
    lis.append(int(tmp))

#print(p, q)
print(abs(bisect.bisect_left(lis, p) - bisect.bisect_left(lis, q)))
#print(bisect.bisect_left(lis, q))

Measured memory_bytes: 9556
s = input()

bw = []
for i in range(len(s)):
    if i % 2 == 0:
        bw.append('1')
    else:
        bw.append('0')

p1 = 0
t = ''.join(bw)
for i in range(len(s)):
    if s[i] != t[i]:
        p1 += 1

bw = []
for i in range(len(s)):
    if i % 2 == 0:
        bw.append('0')
    else:
        bw.append('1')

p2 = 0
t = ''.join(bw)
for i in range(len(s)):
    if s[i] != t[i]:
        p2 += 1
ans = min(p1, p2)
print(ans)


Measured memory_bytes: 48180
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/
#include <bits/stdc++.h>
#define newline ("\n")
#define deb(x) cerr << (#x) << " = " << (x) << '\n'
#define FOR(x, n) for (int x = 0; x < n; x++)
#define PI (3.141592653589)

#define MOD 1000000007
using namespace std;

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

    // Pikachu, I choose you
    string s, t;
    cin >> s >> t;
    int a = s.size();
    int b = t.size();
    int dp[a + 1][b + 1];
    for (int i = 0; i <= a; i++)
    {
        for (int j = 0; j <= b; j++)
        {
            if (i == 0 || j == 0)
            {
                dp[i][j] = 0;
            }
            else
            {
                if (s[i - 1] == t[j - 1])
                {
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                }
                else
                {
                    dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
                }
            }
        }
    }
    if (dp[a][b] == 0)
    {
        cout << "";
        return 0;
    }
    int i = a, j = b;
    string sol;
    while (i != 0 && j != 0)
    {
        if (s[i - 1] == t[j - 1])
        {
            sol += s[i - 1];
            i--;
            j--;
        }
        else if (dp[i][j - 1] == dp[i][j])
        {
            j--;
        }
        else
        {
            i--;
        }
    }
    reverse(sol.begin(), sol.end());
    cout << sol;
    return 0;
}


Measured memory_bytes: 35456
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
 
int main(){
    int H,A;
    cin >> H >> A;
    int ans = H/A;
    if(H%A==0) cout << ans << endl;
    else cout << ans+1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <cstring>

using namespace std;

int main() {
    int n;
    cin >> n;
    
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        s[i] += s[i];
    }
    
    vector<string> tmp = s;
    
    s.insert(s.end(), tmp.begin(), tmp.end());
        
    vector<string> t(s.size(), string(2 * n, 0));
    
    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            t[i][j] = s[j][i];       
        }
    }
  
    int ans = 0;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            bool ok = true;
            
            for (int k = 0; k < n; k++) {
                if (memcmp(s[i + k].c_str() + j, t[j + k].c_str() + i, n) != 0) {
                    ok = false;
                    break;
                }
            }
            
            if (ok) {
                ans++;
            }
        }
    }
    
    cout << ans << endl;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

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

    string st;
    cin >> st;

    rep(i, st.size()-8) {
        cout << st[i];
    }
    cout << endl;


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int year,cost;
    cin>>year>>cost;
    if(year>=13){cout<< cost;}


    else if (year>=6 && year <=12){
    cout<< (cost/2);
}
    else if (year>=0 && year<=5){
    cout<< cost - cost;}


    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

bool check(const vector<int>& p) {
  int n = p.size();
  for (int i = 0; i < n; ++i) {
    if (p[i] != i) return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    --p[i];
  }
  bool found = false;
  if (check(p)) found = true;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      swap(p[i], p[j]);
      if (check(p)) found = true;
      swap(p[i], p[j]);
    }
  }
  cout << (found ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]

ac = S.count('AC')
wa = S.count('WA')
tle = S.count('TLE')
re = S.count('RE')

print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)

Measured memory_bytes: 16288
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int H,W;
int s[55][55];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

signed main(void) {
    cin>>H>>W;
    int black=0;
    rep(i,H){
        rep(j,W){
            char tmp; cin>>tmp;
            if(tmp=='#') {
                s[i][j]=1;
                black++;
            }
            else s[i][j]=0;
        }
    }
    int moves[55][55];
    rep(i,H) {
        rep(j, W) {
            if(i==0&&j==0) moves[i][j]=0;
            else moves[i][j]=INF;
        }
    }
    queue<pi> Q;
    Q.push(mp(0,0));
    bool flag=false;
    int res=INF;
    while(Q.size()) {
        pi top=Q.front(); Q.pop();
        rep(i,4) {
            int nx=top.fi+dx[i];
            int ny=top.se+dy[i];
            if(0<=nx&&nx<H&&0<=ny&&ny<W&&s[nx][ny]==0&&moves[nx][ny]==INF) {
                moves[nx][ny]=moves[top.fi][top.se]+1;
                if(nx==H-1&&ny==W-1) { //ゴール
                    flag=true;
                    res=moves[nx][ny];
                    break;
                }
                Q.push(mp(nx, ny));
            }
        }
        if(flag) break;
    }
    if (!flag) cout<<-1<<endl; 
    else cout<<H*W-black-(res+1)<<endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;

    double ans = 0;
    for (int i = 1; i <= N; i++) {
        if (i < K) {
            ans += 1.0 / (N*pow(2, ceil(log2((double)K / i))));
        }
        else ans += 1.0 / N;
    }

    printf("%.12f\n", ans);
}

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

int main(){
    vector<bool> is_prime(2000001, true);
    is_prime[0] = is_prime[1] = false;
    for(int i=2;i<2000001;i++){
        if(!is_prime[i]) continue;
        for(int j=2*i;j<2000001;j+=i){
            is_prime[j] = false;
        }
    }

    ll N, P;
    cin >> N >> P;

    map<ll, ll> cnt;
    for(int i=2;i<2000001;i++){
        if(!is_prime[i]) continue;
        while(P % i == 0){
            cnt[i]++;
            P /= i;
        }
    }
    if(P > 1){
        cnt[P]++;
    }

    ll ans = 1;
    for(auto& p : cnt){
        while(p.second >= N){
            ans *= p.first;
            p.second -= N;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
program main
    use iso_fortran_env
    implicit none

    integer(int64) :: n, m
    character(:),allocatable :: txt
    character(26) :: alp

    alp = "abcdefghijklmnopqrstuvwxyz"

    read(*,*) n
    txt = ""

    do
        if (n <= 0) exit
        m = mod(n-1, 26)
        n = (n-1)/26
        txt = alp(m+1:m+1)//txt
    enddo

    print'(a)', trim(txt)

end program main

Measured memory_bytes: 2932
#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() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int			n;
	int			mid;
	cin >> n;
	vector<int>	A(n);

	rep(i, n)
		cin >> A.at(i);
	sort(A.begin(), A.end());
	mid = A.size() / 2;
	cout << A.at(mid) - A.at(mid - 1) << endl;
}


Measured memory_bytes: 640
// B - Tax Rate
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	int n;
	cin >> n;
	double x = ((double) n / 1.08);
	int ans = -1;
	for (int x = max(0, int((double) n / 1.08) - 10); ; x++) {
		double t = (double) x * 1.08;
		if (int(t) == n) ans = x;
		if (int(t) >= n) break;
	}

	if (ans < 0) cout << ":(" << endl;
	else cout << ans << endl;

	return 0;
}


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

template <typename T> class DisjointSet {
private:
    T n;
    vector<T> rank, p;

    void link(T x, T y) {
        if (x != y) {
            --n;
            if (rank[x] > rank[y]) {
                p[y] = x;
            } else {
                p[x] = y;
                if (rank[x] == rank[y]) { rank[y]++; }
            }
        }
    }

public:
    DisjointSet() {}
    DisjointSet(const DisjointSet& tree) : n(tree.n), rank(tree.rank), p(tree.p) {}
    DisjointSet(T n) : n(n), rank(n, 0), p(n, 0) {
        rep(i, 0, n) { make_set(i); }
    }

    // Initialize the set of x.
    void make_set(T x) {
        p[x] = x;
        rank[x] = 0;
    }

    // Check if x and y are in the same set.
    bool same(T x, T y) { return find_set(x) == find_set(y); }

    // Unite x and y.
    void unite(T x, T y) { link(find_set(x), find_set(y)); }

    // Find the root node of x.
    T find_set(T x) {
        if (x != p[x]) {
            p[x] = find_set(p[x]);
            rank[x] = 1;
        }
        return p[x];
    }

    T size() { return n; }
};

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

    int n, m;
    cin >> n >> m;

    DisjointSet<int> tree(n);

    rep(i, 0, m) {
        int x, y, z;
        cin >> x >> y >> z;
        tree.unite(x - 1, y - 1);
    }

    cout << tree.size() << endl;
    return 0;
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	auto cnt = vector<int>(m + 1);
	int ans = 0;
	for(auto i = 0; i < n; ++i){
		int k;
		cin >> k;
		for(auto j = 0; j < k; ++j){
			int a;
			cin >> a;
			if(++cnt[a] == n) ++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d%d", $n, $k);
define("MOD", 10**9+7);
 
nCmBuild($n);
for($i=1; $i <= $k; $i++) { 
	echo nCm($n-$k+1, $i) * nCm($k-1, $i-1) % MOD, "\n";
}

function nCmBuild($n){
  global $pascal;
  $pascal[0][0] = 1;
  for($j = 1; $j <= $n; $j++){
    for($i = 0; $i <= $j; $i++){
      $pascal[$j][$i] = (($pascal[$j-1][$i-1] ?? 0) + ($pascal[$j-1][$i] ?? 0)) % MOD;
    }
  }
}
function nCm($n, $m){
  global $pascal;
  return $pascal[$n][$m];
}


Measured memory_bytes: 96760
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func sum(n []int) int {
	a := 0
	for _, v := range n {
		a += v
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	n := getInt()
	a := make([]int, n)

	var ans float64
	for i := range a {
		a[i] = getInt()
		ans += (1 / float64(a[i]))
	}

	fmt.Println(1 / ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define int long long
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 1e9+7;
const int MAXN = 1e5+5;


int32_t main() {
	int n, m;
	cin >> n >> m;
	vector<int> v(n), pai(n);
	for(int i = 0; i < n; i++) {
		cin >> v[i];
		pai[i] = i;
	}
	
	while(m--) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		if(v[b] >= v[a]) 
			pai[a] = b;

		
		if(v[a] >= v[b]) pai[b] = a;
	}
	
	
	int ans = 0;
	for(int i = 0; i < n; i++) {
		if(pai[i] == i) ans++;
	}
	cout << ans << endl;
	
}


Measured memory_bytes: 4844
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 100000
#define X 1000000007
#define I2 500000004
#define C(x,y) (1LL*Fac[x]*IFac[y]%X*IFac[(x)-(y)]%X)
using namespace std;
int n,a[N+5],Fac,Inv[N+5],s[N+5];
I int QP(RI x,RI y) {RI t=1;W(y) y&1&&(t=1LL*t*x%X),x=1LL*x*x%X,y>>=1;return t;}
I int f(CI x) {return 1LL*Fac*Inv[x+1]%X;}
int main()
{
	RI i;for(scanf("%d",&n),i=1;i<=n;++i) scanf("%d",a+i);
	for(Fac=i=1;i<=n;++i) Inv[i]=QP(i,X-2),Fac=1LL*Fac*i%X;
	RI t=0,ans=0;for(i=2;i<=n;++i) t=(t+f(i-1))%X;
	for(i=1;i<=n;++i) t=(t+f(i-1))%X,ans=(1LL*t*a[i]+ans)%X,t=(t-f(n-i)+X)%X;
	return printf("%d\n",ans),0;
}

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

int main() {
	int n, k , i , j , l;
	cin >> n;
	int t,a;
	cin >> t >> a;
	double d[n];
	for(i=0;i<n;++i) {
	    cin >> j;
	    d[i] = a - (t - j*0.006);
	}
	int ans = 0 ;
	double mini=INT_MAX;
// 	for(auto x:d) cout << x << ' ';cout << endl;
	for(i=0;i<n;++i) {
	    if(abs(d[i]) < mini) {
	        mini = abs(d[i]);
	        ans = i+1;
	    }
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func min(a int, b int) int {
  if a < b {
    return a
  } else {
    return b
  }
}

func main() {
  var n int
  fmt.Scan(&n)

  var b, prev_b int
  fmt.Scan(&prev_b)
  sum_a := prev_b
  for i:=1; i<n-1; i++ {
    fmt.Scan(&b)
    sum_a += min(prev_b, b)
    prev_b = b
  }

  sum_a += prev_b

  fmt.Println(sum_a)
}


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

using namespace std;

#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define mod 998244353
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()

typedef vector<lld> vi;
typedef vector<vector<lld>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<lld, lld>> vpi;
typedef long long LL;

int main() {
    fast;
    cin.tie(0);
/*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w" , stdout);
#endif*/
    string s;
    cin>>s;
    if(s[1]=='R') cout<<"ABC"<<endl;
    else cout<<"ARC"<<endl;

}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>

using namespace std;
#define EPS 1e-9
#define MAX 505
#define pb push_back
#define mp make_pair
#define ins insert
#define fi first
#define se second
#define pi acos(-1.0)
#define mod 100000007
#define inf 2147483647
#define ll long long int
#define sss stringstream
#define oss ostringstream
#define iss istringstream
#define llu long long unsigned

#define _sq(a) (a)*(a)
#define sz(a) ((int)a.size())
#define gcd(a,b)    __gcd(a,b)
#define lcm(a,b) ((a)*((b)/gcd(a,b)))
#define _max3(a,b,c) max(a, max(b,c))
#define _min3(a,b,c) min(a, min(b,c))
#define FOR(i, n) for(i=0; i<(int)n; i++)
#define FOR1(i, n) for(i=1; i<=(int)n; i++)
#define mem(a) memset(a, 0, sizeof(a))
#define _set(a) memset(a,-1,sizeof(a))
#define FORI(i, a, b) for(i=a; i>=(int)b; i--)
#define FORab(i, a, b) for(i=a; i<=(int)b; i++)
#define popcount(n) __builtin_popcount(n)
#define popcountl(n) __builtin_popcountll(n)
#define sort_rev(a) sort(a.rbegin(), a.rend())
#define sort_all(a) sort(a.begin(), a.end())
#define dis_twopoints(x1,y1,x2,y2) sqrt(_sq(x1-x2) + _sq(y1-y2))
#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)

//If Long Long (mask & (1LL << k))
#define check(mask, k) (mask & (1 << k))
#define set1(mask, k) (mask | (1 << k))
#define set0(mask ,k) (mask & (~(1<<k)))

#define SD(a) scanf("%d",&a)
#define SLF(a) scanf("%lf",&a)
#define SC(a) scanf("%c",&a)
#define SS(a) scanf("%s",a)
#define SLLD(a) scanf("%lld", &a)
#define Si64(a) scanf("%I64d", &a)

#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
int num[10];
int main()
{
    int ta,i,j,k;
    cin>>ta;
    while(ta--)
    {
        for(i=0; i<3; i++)
        {
            cin>>num[i];
        }
        sort(num,num+3);
        if(_sq(num[2])==(_sq(num[0])+_sq(num[1])))
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	int nCase = 1;
	for (int W; cin >> W, W != 0; ) {
		int n; cin >> n;
		int p[1000], w[1000];
		rep(i, n) {
			char c; cin >> p[i] >> c >> w[i];
		}
		int dp[10001];
		memset(dp, 0, sizeof(dp));
		int answ = W + 1, ansp = 0;
		rep(i, n) for(int j = W; j >= w[i]; j--) {
			dp[j] = max(dp[j], dp[j - w[i]] + p[i]);
			if (ansp == dp[j]) answ = min(answ, j);
			else if(ansp < dp[j]) {
				ansp = dp[j];
				answ = j;
			}
		}
		cout << "Case " << nCase << ":" << endl;
		cout << ansp << endl << answ << endl;
		nCase++;
	}
	
	return 0;
}

Measured memory_bytes: 0
def main():
    a, b, c, d = map(int, input().split())
    answer = a*c
    if answer < a*d:
        answer = a*d
    if answer < b*c:
        answer = b*c
    if answer < b*d:
        answer = b*d
    return answer


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


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

int main(){
    const long long Mod=1000000007;
    int n,m;
    cin >> n >> m;
    int a[2005];
    int b[2005];
    long long dp[2005][2005];
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=0; i<m; i++) cin >> b[i];
    

    for(int i=0; i<=n; i++) dp[i][0]=1;
    for(int j=0; j<=m; j++) dp[0][j]=1;
    //dp[0][0]=1;

    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            if(a[i] == b[j]){
                dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1])%Mod;
            } else {
                dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1]-dp[i][j]+Mod)%Mod;
            }
        }
    }
    cout << dp[n][m] << endl;
 

}

Measured memory_bytes: 31616
module Main where

import Data.Functor
import Data.List

main :: IO ()
main = do
  { [ss] <- getInts
  ; let (mm,s) = divMod ss 60
  ; let (h,m) = divMod mm 60
  ; putStrLn (intercalate ":" (map show [h, m, s]))
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

Measured memory_bytes: 3656
#include <stdio.h>
#include <math.h>

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

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bits/stdc++.h>
#include <iomanip>
#include <numeric>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    cin >> N;
    vector<long long> vec(N + 1);
    for (long long i = 0; i < N + 1; ++i)
        cin >> vec[i];
    //可能か否かの判定
    vector<pair<long long, long long>> kanou(N + 1);
    kanou[N].first = vec[N];
    kanou[N].second = vec[N];
    for (long long i = N - 1; i >= 0; --i)
    {
        kanou[i].first = kanou[i + 1].first / 2 + kanou[i + 1].first % 2 + vec[i];
        kanou[i].second = kanou[i + 1].second + vec[i];
    }
    // for (auto i : kanou)
    //     cout << i.first << " " << i.second << "\n";
    //グラフが作成できない場合
    if (kanou[0].first > 1)
    {
        cout << "-1\n";
        return 0;
    }

    vector<long long> MAX(N + 1);
    MAX[0] = 1;
    long long result = MAX[0];
    for (long long i = 1; i < N + 1; ++i)
    {
        MAX[i] = min(kanou[i].second, 2 * (MAX[i - 1] - vec[i - 1]));
        result += MAX[i];
    }
    cout << result << "\n";
}


Measured memory_bytes: 6340
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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() {
string t;
cin >> t;

rep(i,t.size()){
  if(t[i]=='?'){t[i]='D';}
}
cout<<t<<endl;


}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 3752
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#define x first
#define y second

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

const int N=250010,MOD=1000000007,g0=500002,g1=500003;

pii operator * (pii A,pii B){return pii((ll)A.x*B.x%MOD,(ll)A.y*B.y%MOD);}
pii operator + (pii A,pii B){return pii(((A.x+B.x)%MOD+MOD)%MOD,((A.y+B.y)%MOD+MOD)%MOD);}
pii operator - (pii B){return pii(-B.x,-B.y);}

ll inv(int x){return (x==1 || x==-1)?x:(-(MOD/x)*inv(MOD%x)%MOD);}

pii t0[N*2],*pow;

void initialize()
{
	pow=t0+N;

	pii tmp=pii(g0,g1);

	pow[0]=pii(1,1);
	for(int i=1;i<N;i++)
		pow[i]=pow[i-1]*tmp;

	tmp=pii((inv(g0)+MOD)%MOD,(inv(g1)+MOD)%MOD);
	for(int i=0;i<N;i++)
		pow[-i-1]=pow[-i]*tmp;
}

char s[N];
int ind[N];
pii val[N],sum[N];
int n;

ll ans;

void prework()
{
	int p=0;
	for(int i=1;i<=n;i++)
	{
		ind[i]=p,val[i]=pii(0,0);

		if(s[i]=='<')p--;
		else if(s[i]=='>')p++;
		else if(s[i]=='+')val[i]=pow[p];
		else val[i]=-pow[p];
	}

	for(int i=1;i<=n;i++)
		sum[i]=sum[i-1]+val[i];
}

std::map<pii,int> G;

void solve()
{
	ans=0;

	pii x,y;

	for(int i=n;i;i--)
	{
		G[sum[i]]++;

		x=sum[n]*pow[ind[i]];
		y=sum[i-1]+x;

		ans+=G[y];
	}
}

int main()
{
	initialize();

	scanf("%d",&n);
	scanf("%s",s+1);

	prework();
	solve();

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 40576
import itertools

n = int(input())
lst = list(map(int, input().split()))

accum_xor = []
s = 0
for i in lst:
    s = s ^ i
    accum_xor.append(s)

accum_lst = list(itertools.accumulate(lst))


s = 0
e = 0
count = 0
while s <= n-1:
    flg = False
    if s == 0:
        if accum_xor[e] == accum_lst[e]:
            e += 1
            if e >= n:
                break
        else:
            flg = True
    else:
        if accum_xor[e] ^ accum_xor[s-1] == accum_lst[e] - accum_lst[s-1]:
            e += 1
            if e >= n:
                break
        else:
            flg = True
    if flg:
        count += (e-1) - s + 1
        s += 1
        
if e == n:
    for i in range(s, n):
        count += (n-1)-i+1

print(count)

Measured memory_bytes: 87844
#include <bits/stdc++.h>
#define INF 100000000

int n, h[100001], memo[100001];

int FROG1(int i)
{
	if(i == n)
	return 0;
	if(memo[i] != -1)
	return memo[i];	
	int ans = INF;
	if(i < n-1)
	ans = std::min(abs(h[i] - h[i+1]) + FROG1(i+1), abs(h[i] - h[i+2]) + FROG1(i+2));
	else ans = abs(h[i] - h[i+1]) + FROG1(i+1);
	memo[i] = ans;
	return ans;	
}

int main(void)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	memset(memo, -1, sizeof(memo));
	std::cin>>n;
	for(int i=1;i<=n;i++)
	std::cin>>h[i];
	int ans = FROG1(1);
	std::cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
  int A, B;
  cin >> A >> B;

  if (A >= 13) {
    cout << B << endl;
  } else if (A <= 5) {
    cout << 0 << endl;
  } else {
    cout << B / 2 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline


a, b, c = map(int, readline().split())

"""
2sqrt(ab) < c - a - b
4ab < (c - a - b) ** 2
"""
if c - a - b < 0:
    print('No')
    exit(0)

if 4 * a * b < (c - a - b) ** 2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
ll t,m,k=0;
//cin>>t;
//while(t--){
//ll j,k=-1;
ll n;
cin>>n;
m=n/2;
ll a[n];
for(ll i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
cout<<a[m]-a[m-1]<<endl;

}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <limits.h>
#include <math.h>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(void){
    string s, t[5];
    int k;
    cin >> s;
    cin >> k;
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5000; j++) t[i] += "z";
    }
    
    string u;
    for (int i = 1; i <= 10 && i <= s.size(); i++) {
        for (int j = 0; j < s.size() - i + 1; j++) {
            u = s.substr(j, i);
            for (int l = 0; l < 5; l++) {
                if (u < t[l]) {
                    for (int m = 4; m > l; m--) t[m] = t[m - 1];
                    t[l] = u;
                    break;
                }
                else if (u == t[l]) break;
            }
        }
    }
    
    cout << t[k - 1] << endl;
    
}


Measured memory_bytes: 256
from numba import jit
import numpy as np

@jit
def main():
    R, C, K = map(int, input().split())
    scores = np.zeros((R,C), np.int64)
    for _ in range(K):
        r, c, v = map(int, input().split())
        scores[r-1][c-1] = v
    dp=np.zeros((R+1,C+1,4), np.int64)

    for i in range(1, R+1):
        for j in range(1, C+1):
            for k in range(4):
                dp[i][j][k] = max(dp[i][j-1][k],
                                dp[i-1][j][3])
            for k in range(3, 0, -1):
                dp[i][j][k] = max(dp[i][j][k],
                                  dp[i][j][k-1] + scores[i-1][j-1])

    
    return dp[R][C][3]

print(main())

Measured memory_bytes: 474988
def main():
    S = int(input())
    A = [0] * (S+1)

    A[0] = 1
    A[1] = 0

    if S >= 2:
        A[2] = 0

    for i in range(3, S+1):
        A[i] = (A[i-1] + A[i-3]) % (10**9 + 7)

    print(A[-1] % (10**9 + 7))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9132
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<pair<int,int> >T;
vector<pair<int,pair<int,int> > >G[1<<17];
int N,Q;
int L[1<<17],R[1<<17];
int parent[20][1<<17];
int depth[1<<17];
void tourdfs(int u,int p,int d)
{
	parent[0][u]=p;
	depth[u]=d;
	L[u]=T.size();
	for(int i=0;i<G[u].size();i++)
	{
		int v=G[u][i].first;
		if(v==p)continue;
		T.push_back(G[u][i].second);
		tourdfs(v,u,d+1);
		T.push_back(make_pair(-G[u][i].second.first,G[u][i].second.second));
	}
	R[u]=T.size();
}
long cumsum[1<<20];
const int W=400;
int cnt[500][1<<17];
long sum[1000][1<<17];
pair<int,long>get(int l,int r,int c)
{
	pair<int,long>ret=make_pair(0,0);
	while(l<T.size()&&l%W!=0&&l<r)
	{
		int nc=T[l].first,nd=T[l].second;
		if(nc>0&&nc==c)
		{
			ret.first++;
			ret.second+=nd;
		}
		else if(-nc==c)
		{
			ret.first--;
			ret.second-=nd;
		}
		l++;
	}
	while(l+W<=r&&l+W<=T.size())
	{
		int nc=cnt[l/W][c];
		long nd=sum[l/W][c];
		ret.first+=nc;
		ret.second+=nd;
		l+=W;
	}
	while(l<r)
	{
		int nc=T[l].first,nd=T[l].second;
		if(nc>0&&nc==c)
		{
			ret.first++;
			ret.second+=nd;
		}
		else if(-nc==c)
		{
			ret.first--;
			ret.second-=nd;
		}
		l++;
	}
	return ret;
}
long calc(int u,int v,int c,int y)
{
	bool flag=false;
	if(L[u]>L[v])
	{
		swap(u,v);
		flag=true;
	}
	long ret=cumsum[L[v]]-cumsum[L[u]];
	pair<int,long>p=get(L[u],L[v],c);
	ret-=p.second;
	ret+=p.first*y;
	return flag?-ret:ret;
}
int lca(int u,int v)
{
	if(depth[u]>depth[v])swap(u,v);
	for(int k=0;k<20;k++)
	{
		if(depth[v]-depth[u]>>k&1)v=parent[k][v];
	}
	if(u==v)return u;
	for(int k=19;k>=0;k--)
	{
		if(parent[k][u]!=parent[k][v])
		{
			u=parent[k][u];
			v=parent[k][v];
		}
	}
	return parent[0][u];
}
main()
{
	cin>>N>>Q;
	for(int i=1;i<N;i++)
	{
		int a,b,c,d;cin>>a>>b>>c>>d;
		a--,b--;
		G[a].push_back(make_pair(b,make_pair(c,d)));
		G[b].push_back(make_pair(a,make_pair(c,d)));
	}
	tourdfs(0,-1,0);
	for(int i=0;i<T.size();i++)
	{
		cumsum[i+1]=cumsum[i]+(T[i].first<0?-1:1)*T[i].second;
	}
	for(int k=1;k<20;k++)
	{
		for(int i=0;i<N;i++)
		{
			if(parent[k-1][i]>=0)parent[k][i]=parent[k-1][parent[k-1][i]];
			else parent[k][i]=-1;
		}
	}
	for(int i=0;i+W<=T.size();i+=W)
	{
		for(int j=0;j<W;j++)
		{
			int nc=T[i+j].first,nd=T[i+j].second;
			if(nc>0)
			{
				cnt[i/W][nc]++;
				sum[i/W][nc]+=nd;
			}
			else
			{
				cnt[i/W][-nc]--;
				sum[i/W][-nc]-=nd;
			}
		}
	}
	for(;Q--;)
	{
		int x,y,u,v;
		cin>>x>>y>>u>>v;
		u--,v--;
		int pa=lca(u,v);
		cout<<calc(pa,u,x,y)+calc(pa,v,x,y)<<endl;
	}
}



Measured memory_bytes: 797296
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int N=gi();
	    int C=gi();
	    double[] S=new double[N];
	    int[] T=new int[N];
	    int[] c=new int[N];
	    boolean[][] A=new boolean[C][200001];

	    for (int i=0; i<N;i++) {
	    	S[i]=gd()-0.5;
	    	T[i]=gi();
	    	c[i]=gi()-1;
	    	for(double j=S[i]*2; j<T[i]*2;j++) {
	    		A[c[i]][(int)j]=true;
	    	}
	    }

	    int ans=0;
	    for (int i=1; i<200001;i++) {
	    	int n=0;
	    	for(int j=0; j<C;j++) {
	    		if(A[j][i]) n++;
	    	}
            ans=Math.max(ans, n);
	    }

        System.out.println(ans);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 68940
from decimal import *

d = Decimal(0)
y = 0

N = int(input())
for _ in range(N):
    xi, ui = input().split()
    if ui == "JPY":
        y += int(xi)
    else:
        d += Decimal(xi)

print(d * Decimal('380000.0') + Decimal(y))


Measured memory_bytes: 5204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;

  if ( (a % 2 == 0) || (b % 2 == 0) ) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll MRINF = 5000000000000000;

int main() {

  ll N;
  cin >> N;
  vector<ll> b;

  for (ll i = 0; N > 0; i++) {
    N -= 1;
    ll amari = N % 26;
    b.push_back(amari);
    N = N / 26;
  }
  for(ll i = b.size()-1; i >= 0; i--){
    // if(b[i] == 0)b[i]=26;
    cout << char(b[i]+'a');
    
  }
  cout << endl;

  // REP(i, b.size()){
  //   cout << b[i] << " ";
  // }
    
  
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3612
N = int(input())
b = list(int(x) for x in input().split())

result = []
while b:
    remove_flag = False
    for i in range(len(b)-1, -1, -1):
        if b[i] == i+1:
            result.insert(0, b.pop(i))
            remove_flag = True
            break
    if not remove_flag:
        print(-1)
        exit()

        remove_flag = False

for i in result:
    print(i)


Measured memory_bytes: 9096
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,x,y=1;
    unordered_set<int>s;
    cin>>n;
    while(n--){
        scanf("%d",&x);
        while(s.count(y))y++;
        if(s.count(0)||x<y-1||(x==y-1&&s.size()>y-1)){
            cout<<"No"<<endl;
            continue;
        }
        cout<<"Yes"<<endl;
        while(s.count(x)) s.erase(x--);
        s.insert(x);
    }
}


Measured memory_bytes: 12648
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
  string s, t;
  cin >> s >> t;
  const int n = s.size(), m = t.size();
  string res = "{";
  REP(i,n-m+1) {
    try {
      string x = s;
      REP(j,m) {
        if (x[i+j] == t[j]) continue;
        if (x[i+j] == '?') x[i+j] = t[j];
        else throw 0;
      }
      for (char &c: x) if (c == '?') c = 'a';
      chmin(res, x);
    }
    catch (int) {}
  }
  if (res == "{") cout << "UNRESTORABLE" << endl;
  else cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
int a[22][22],dp[1<<21],pre[1<<21],n,mod=1e9+7;
void solve()
{
    cin>>n;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin>>a[i][j];
    dp[0]=1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<(1<<n);j++)
        {
            pre[j]=dp[j];
            dp[j]=0;
        }
        for(int j=0;j<n;j++)
            if(a[i][j])
                for(int mask=0;mask<(1<<n);mask++)
                {
                    if((mask&(1<<j))==0)
                    {
                        dp[mask|(1<<j)]+=pre[mask];
                        if(dp[mask|(1<<j)]>mod)dp[mask|(1<<j)]-=mod;
                    }
                }
    }
    cout<<dp[(1<<n)-1];
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("XORQUERY.inp","r",stdin);
    //freopen("XORQUERY.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 33024
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val lx = readLine()!!.split(" ").map { it.toInt() }

    if (lx.max()!! < (lx.sum() - lx.max()!!)) {
        println("Yes")
    } else {
        println("No")
    }
}

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

int main()
{
	for (int a = 0; a < 4; a++)
	{
		int c, d;
		cin >> c >> d;
		switch (c)
		{
		case 1:cout<< d * 6000<<endl; break;
		case 2:cout << d * 4000 << endl; break;
		case 3:cout << d * 3000 << endl; break;
		default:cout << d * 2000 << endl;
		}
	}
}

Measured memory_bytes: 3104
//#pragma GCC optimize(2)
//南京市第三区OI委提醒您：
//代码千万条，-O2第一条。
//-O2不规范，超时两行泪。
// Happy TLE and WA every day!
// by: zxb
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
#define read            ZXBs_fast_input
#define write           ZXBs_fast_output
//#define usingFiles
using namespace std;

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

inline bool read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool write(int x){
	if(x >= 10) write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	ll W, H, x, y;
	cin >> W >> H >> x >> y;
	cout << fixed << setprecision(1) << (double)(W*H) / 2.00 << " ";
	if(x*2 == W && y*2 == H) cout << "1\n";
	else cout << "0\n";
	return 0;
}

Measured memory_bytes: 256