akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
// #define int ll
// #define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
const int N=2e6+6;
vector<int> g[N],w[N];
int c[N];
int32_t main(){
    int n;
    cin>>n;
    memset(c,-1,sizeof c);
    forn(i,n-1){
        int x,y;
        cin>>x>>y;
        g[x].pb(y);
        g[y].pb(x);
    }
    int q;cin>>q;
    while(q--){
        int v,j;
        cin>>v>>j;
        c[v]=j;
        w[j].pb(v);
    }
    forn(j,N){
        for(int v:w[j]){
            for(int to:g[v]){
                if(c[to]==-1){
                    c[to]=j+1;
                    w[j+1].pb(to);
                }else if(abs(c[to]-c[v])!=1){
                    cout<<"No\n";
                    return 0;
                }
            }
        }
    }
    cout<<"Yes\n";
    for(int i=1;i<=n;++i)cout<<c[i]<<'\n';
    return 0;
}

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

using namespace std;
int main()
{
    int i,j,c=0,mx=0;
    string s;
    cin>>s;
    for(i=0; i<s.size(); i++)
    {
        if(s[i]=='R')
            c++;
        else
        {
            mx=max(mx,c);
            c=0;
        }
    }
    if(c>0)
          mx=max(mx,c);
cout<<mx;
}


Measured memory_bytes: 3628
N,W = map(int,input().split())
L = list(list(map(int,input().split())) for i in range(N))

dp = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range(N) :
    w_i,v_i = L[i]
    for weight in range(W+1) :
        if weight - w_i >= 0 :
            dp[i+1][weight] = max(dp[i][weight], dp[i][weight - w_i] + v_i)
        else :
            dp[i+1][weight] = dp[i][weight]

ans = dp[-1][-1]

print(ans)


Measured memory_bytes: 171656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, n4, n3, n2, n1;
  cin >> N;
  n1 = N % 10;
  n2 = (N - n1) / 10 % 10;
  n3 = (N - n1 - n2 * 10) /100 % 10;
  n4 = (N - n1 - n2 * 10 - n3 * 100) / 1000 % 10;

  if (n1 == n2 && n2 == n3) {
      cout << "Yes" << endl;
  }
  else if (n2 == n3 && n3 == n4) {
      cout << "Yes" << endl;
  }
  else {
      cout << "No" << endl;
  }
}

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

int main(void){
    char ch;
    while(1){
        scanf("%c",&ch);
        if(isalpha(ch)){
        if(islower(ch)) printf("%c",toupper(ch));
        else printf("%c",tolower(ch));
        }else printf("%c",ch);
        
        if(ch == '\n') break;
    }
}



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

int main() {
  int h,w;
  cin>>h>>w;
  int i,j;
  char vec[55][55];
  int ans[h+2][w+2]={};
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin>>vec[i][j];
    }
  }

  for (i=0; i<h; i++){
    for (j=0; j<w;j++){
      if (vec[i][j]=='#') {
        for (int y = 0; y < 3; y++) {
          for (int x = 0; x < 3; x++) {
            ans[i+y][j+x]++;
          }
        }
      }
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (vec[i][j]=='#') cout<<'#';
      else cout<<ans[i+1][j+1];
    }
    cout<<endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        vector<string> neri{"", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};
        string s;
        cin >> s;
        for (int i = 0; i < neri.size(); ++i) {
            if (neri[i] == s) {
                cout << i << endl;
                return;
            }
        }
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
#define fi first
#define se second
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    ll n,m;
    cin>>n>>m;
    vec p(m);
    vec y(m);
    
    rep(i,m){
        cin>>p[i]>>y[i];
    }

    vector<vector<int>> v(n+1);
    rep(i,m){
        v[p[i]].push_back(y[i]);
    }
    rep1(i,n){
        sort(all(v[i]));
    }

    rep(i,m){
        printf("%06d",p[i]);
        printf("%06d\n", lower_bound(all(v[p[i]]) ,y[i]) - v[p[i]].begin() + 1);
    }
}

Measured memory_bytes: 9384
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
int BinarySearch(int key,int n,int S[]){
  int l=0,r=n;
  while(r-l>1){
    int mid=(l+r)/2;
    if(S[mid]>key)r=mid;
    else l=mid;
  }
  return S[l]==(key?1:0);
}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

ll row[107],col[107];

int main() {
    char S[15];
    ll C=0,D=0;
    cin >> S;
    rep(i,strlen(S)){
      if(i==0  &&  S[0]!='A'){
        C++;
      }
      else if(i>=2 && i<=strlen(S)-2 && S[i]=='C'){
        D++;
      }
      else if(i>0 &&(S[i]<'a' || S[i]>'z')){
        C++;
      }
    }
    cout <<  ((C==0 && D==1) ? "AC" :  "WA") <<endl;
}

Measured memory_bytes: 504
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <vector>
#include <queue>

using namespace std;
const long long INF = 1e18;
typedef pair<long long, int> P;
int N;
struct edge {
    int to;
    long long cost;
};
vector<edge> G[100000 + 10];
long long d[100000 + 10];

void add_edge(int u, int v, long long cost) {
    G[u].push_back(edge{v, cost});
    G[v].push_back(edge{u, cost});
}

void dij(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + N + 1, INF);
    d[s] = 0;
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    while (~scanf("%d", &N)) {
        for (int i = 1; i <= N + 1; i++)
            G[i].clear();
        int a, b;
        long long c;
        for (int i = 0; i < N - 1; i++) {
            scanf("%d %d %lld", &a, &b, &c);
            add_edge(a, b, c);
        }
        int q, k;
        scanf("%d %d", &q, &k);
        dij(k);
        int x, y;
        for (int i = 0; i < q; i++) {
            scanf("%d %d", &x, &y);
            printf("%lld\n", d[x] + d[y]);
        }
    }
    return 0;
}

Measured memory_bytes: 11120
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l[] = new int[n];
        int r[] = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
            sum += r[i] - l[i] + 1;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 25832
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,t;
    cin>>s>>t;
    int ans=1e5;
    for(int i=0;i<s.size();i++)
    {
        int cnt=0;
        int k=i;
        for(int j=0;j<t.size();j++)
        {
            if(k<s.size())
            {
                if(s[k]!=t[j])
                {
                    cnt++;
                }
            }
            else cnt=1e5;
            k++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b; 
	cin>>a>>b;
	int c=b/a;
	if(b%a==0){
		cout<<c<<endl;
	}
	else{
		cout<<c+1<<endl;
	}
	return 0;
}


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

const ll N_MAX = 200010;
vector<ll> P(N_MAX, 0);
vector<ll> ans(N_MAX, 0);
vector<bool> gone(N_MAX, false);
vector<vector<ll>> tree(N_MAX, vector<ll>(0));

void dfs(ll x) {
  gone[x] = true;
  if (x == 0) {
    ans[x] = P[x];
  }
  for (auto t : tree[x]) {
    if (gone[t] == true) continue;
    ans[t] = ans[x] + P[t];
    dfs(t);
  }
  return;
}

int main() {
  ll N, Q;
  cin >> N >> Q;
  for (ll i = 0; i < N-1; i++) {
    ll a, b;
    cin >> a >> b;
    --a; --b;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  for (ll i = 0; i < Q; i++) {
    ll p, x;
    cin >> p >> x;
    --p;
    P[p] += x;
  }
  dfs(0);
  for (ll i = 0; i < N-1; i++) {
    cout << ans[i] << " ";
  }
  cout << ans[N-1] << endl;
}


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

candy = [list(map(int,input().split())) for i in range(2)]

ans = 0

for i in range(N):
  ans = max(candy[0][i] + candy[1][i]  + sum(candy[0][:i]) + sum(candy[1][i+1:]),ans)
  
print(ans)

Measured memory_bytes: 3060
# pragma GCC optimize("Ofast")
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s, ans;
    cin >> s;
    int a = s.length();
    rep(i,a){
        ans += 'x';
    }
    cout << ans;
    return 0;
}

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

int main()
{
    int N;
    scanf("%d", &N);
    std::vector<int> b(N);
    for(int i=0; i<N; i++) scanf(" %d", &b[i]);

    std::vector<int> ans;
    for(int i=0; i<N; i++){
        for(int j=N-i-1; j>=0; j--){
            if(b[j] == j+1){
                ans.push_back(j+1);
                b.erase(b.begin() + j); break;
            }
            if(j == 0){
                std::cout << -1 << std::endl; return 0;
            }
        }
        // for(auto &&itr = b.begin(); itr != b.end(); itr++) printf("%d ", *itr);
        // printf("\n");
    }
    for(int i=0; i<N; i++) printf("%d\n", ans[N-i-1]);
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll K,A,B;
	cin>>K>>A>>B;
	ll k = K;
	k -= A-1;
	// cout<<k<<endl;
	ll ans = k/2 * (B-A) + A;
	if(k%2) ++ans;
	cout<<max(ans,K+1)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int fibonacci(int n){
    int F[n+1];
    F[0] = 1;
    F[1] = 1;
    for(int i = 2; i <= n; i++) F[i] = F[i-2] + F[i-1];
    return F[n];
}

int main(){
    int n;
    cin >> n;
    cout << fibonacci(n) << endl;
    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n;string s;cin>>n>>s;
	int cnt=0;
	for(int i=1;i<n-1;i++){
		map<char,int> mpx,mpy;
		int sum=0;
		for(int j=0;j<i;j++){
			mpx[s[j]]++;
		}
		for(int j=i;j<n;j++){
			mpy[s[j]]++;
		}
		for(auto i:mpx){
			for(auto j:mpy){
				if(i.first==j.first) sum++;
			}
		}
		cnt=max(cnt,sum);
	}
	cout<<cnt<<"\n";
}

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

const int maxn = 2005;
const int mod = 924844033;
int fac[maxn];
int f[maxn*2][maxn];
int a[maxn*2];

int n, k;

int main(){
	fac[0]=1;
	for(int i = 1; i < maxn; ++i)
		fac[i] = 1ll * fac[i-1] * i % mod;
	while(~scanf("%d%d", &n, &k)) {
		memset(f, 0, sizeof(f));
		int cur = 0;
		for(int j = 1; j <= k; ++j) {
			int sz = (n - j) / k + 1;
			for(int i = 0; i < sz; ++i) a[++cur] = j << 1;
			for(int i = 0; i < sz; ++i) a[++cur] = j << 1 | 1;
		}
		f[0][0] = 1;
		for(int i = 1; i <= n * 2; ++i) {
			for(int j = 0; j <= n; ++j) f[i][j] = f[i-1][j];
			if(a[i] == a[i-1])
				for(int j = 1; j <= n; ++j) (f[i][j] += f[i-2][j-1]) %= mod;
		}
		int ans = 0;
		for(int i = 0; i <= n; ++i) 
			ans = (ans + ((i & 1) ? -1ll : 1ll) * f[n<<1][i] * fac[n-i]) % mod;
		if(ans < 0) ans += mod;
		printf("%d\n", ans);
	}
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main() {
    int D, T, S;
    cin >> D >> T >> S;
    if (D <= T*S) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3544
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


const int MAX = 1048576;
bool HammingTable[MAX];

void init()
{
	for(int two = 1; two < MAX; two *= 2)
		for(int three = 1; two * three < MAX; three *= 3)
			for(int five = 1; two * three * five < MAX; five *= 5)
				HammingTable[two * three * five] = true;
}

int main()
{
	init();
    for(int m, n; cin >> m && m && cin >> n; cout << count(HammingTable + m, HammingTable + n + 1, true) << endl);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(8);
  int n,counter1=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int b;
    cin>>b;
    if(b>=3200){
      counter1++;
    }
    else{
      a.at(b/400)++;
    }
  }
  int counter2=0;
  for(int i=0;i<8;i++){
    if(a.at(i)){
      counter2++;
    }
  }
  if(counter2){
  cout<<counter2<<' '<<counter1+counter2<<endl;
  }
  else{
    cout<<1<<' '<<counter1<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

template<class T>T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T>T lcm(T a, T b){return a/gcd(a,b)*b;}

int A,B,C;

int main(){
    cin>>A>>B>>C;

    string ans="YES";
    int g=gcd(A,B);
    if(C%g!=0) ans="NO";

    cout<<ans<<endl;
}

Measured memory_bytes: 3608
# coding: utf-8
# Your code here!
import numpy as np

N=int(input())

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

count=0
mi=10**9
all=0

for i in range(N)[::-1]:
    mi=min(mi,abs(l[i]))
    if l[i]<0:
        count+=1
    elif l[i]==0:
        break

if count%2==1:
    print(sum(np.absolute(l))-2*mi)
else:
    print(sum(np.absolute(l)))


Measured memory_bytes: 23328
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
// #include <queue>
// #include <cmath>
// #include <string>
// #include <set>
// #include <map>
// #include <iomanip>

// #define MOD 1000000007
// #define INF 1000000001

using namespace std;
// typedef unsigned long long ull;
typedef long long ll;

void p_() {
    cout << "\n";
}
template<class Head, class... Body>
void p_(Head head, Body... body) {
    cout << head << ",";
    p_(body...);
}

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "[";
    for (const auto& i : v) {
        os << i << " ";
    }
    os << "]";
    return os;
}

using P = pair<ll, int>;

int main(int argc, char const *argv[]) {
    int N;
    cin >> N;
    vector<P> B;
    for (int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        B.push_back(make_pair(A, i));
    }

    sort(B.begin(), B.end(), greater<P>());

    vector<vector<ll>> dp(N+1, vector<ll>(N+1, 0));
    for (int i = 0; i < N; ++i) {
        for (int x = 0; x <= i; ++x) {
            int y = i - x;
            P p = B[x+y];
            dp[x+1][y] = max(dp[x+1][y], dp[x][y] + p.first * (p.second - x));
            dp[x][y+1] = max(dp[x][y+1], dp[x][y] + p.first * (N - 1 - y - p.second));
        }
    }

    // for (int i = 0; i < dp.size(); ++i) {
    //     cout << dp[i] << endl;
    // }

    ll ans = 0;
    for (int x = 0; x < N+1; ++x) {
        ans = max(ans, dp[x][N-x]);
    }
    cout << ans << endl;

    return 0;
}


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

 
int main()
{
 int n,d;
 cin>>n>>d;int ans=0;
 for(int i=0;i<n;i++)
 {
      int a,b;
      cin>>a>>b;
      long long int k=1LL*a*a;
      k+=(1LL*b*b);
      if(sqrt(k)<=d){ans++;}
 }cout<<ans;
 return 0;
}

Measured memory_bytes: 3676
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],1);
  var S = myconv(input[1],2)[0];
  var T = myconv(input[1],2)[1];
  var output = "";
  for(var i = 0; i < N; i++){
    output += S[i] + T[i];
  }
  myout(output);
}
Main(myin());

Measured memory_bytes: 22080
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        if (a>=13)System.out.println(sc.nextInt());
        else if (a>=6)System.out.println(sc.nextInt()/2);
        else System.out.println(0);
    }
}


Measured memory_bytes: 35692
#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define loop(i,a,n) for(ll i=a;i<n;++i)
#define revloop(i,a,b) for(ll i=a;i>=b;--i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 999999999999999
#define MOD 1000000007

void func()
{
    ll n,m,x,sum=0;
    cin>>n>>m>>x;
    vector<vector<ll> > v(n);
    for(ll i=0;i<n;++i){
        ll t;
        cin>>t;
        v[i].pb(t);
        for(ll j=0;j<m;++j){
            cin>>t;
            v[i].pb(t);
        }
    } 
    loop(j,1,m+1){
        sum=0;
        loop(i,0,n){
            sum+=v[i][j];
        }
        if(sum<x){
            cout<<-1<<"\n";
            return;
        }
    }
    ll cnt=0,ans=INF;
    loop(b,1,(1<<n)){
        vector<int> s;
        loop(i,0,n){
            if(b&(1<<i))
                s.pb(i);
        }
        loop(j,1,m+1){
            sum=0;
            loop(i,0,s.size()){
                sum+=v[s[i]][j];
            }
            if(sum>=x)
                ++cnt;
        }
        if(cnt==m){
            // loop(i,0,s.size()){
            //     cout<<s[i]<<" ";
            // }
            // cout<<"\n";
            sum=0;
            loop(i,0,s.size()){
                sum+=v[s[i]][0];
                //cout<<sum<<"\n";
            }
            ans=min(ans,sum);
        }
        cnt=0;
        s.clear();
    }
    cout<<ans<<"\n";
}

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

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w" , stdout);
    #endif

    ll t=1;
    //cin>>t;
    while(t--)
    {
        func();
    }
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string.h>
#include <climits>
#include <algorithm>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;

int A, B, C;

signed main()
{
    cin >> A >> B >> C;
    
    if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
        cout << 0 << endl;
        return 0;
    }
    
    cout << min(A * B, min(B * C, C * A)) << endl;
}


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

vector<int> pre[26];
int N,K;
char c;
int h;

int gcd(int m,int n){
  if ((0 == m)||(0 == n)) return 0;
  while(m!=n) {
    if(m > n) m = m-n;
    else n = n - m;
  }
  return m;
}

int lcm( int m, int n ){
  if((0 == m)||(0== n))return 0;
  return ((m / gcd(m,n)) * n);
}

vector<int> change(vector<int> a,vector<int> b){
  vector<int> tmp(N);
  for(int i=0;i<N;i++){
    tmp[i] = a[b[i]];
  }
  return tmp;
}

int cycle(vector<int> p){
  int ret = 1;
  for(int i=0;i<N;i++){
    int now = p[i],len = 1;
    while(now != i){
      now = p[now];
      len++;
    }
    ret = lcm(ret,len);
  }
  return ret;
}

vector<int> term(int& p,string str){
  vector<int> ret(N);
  for(int i=0;i<N;i++) ret[i] = i;
  while(p<str.size()){
    if(isalpha(str[p])){
      ret = change(ret,pre[str[p]-'A']);
      p++;
    } else {
      int num = 0;
      while(isdigit(str[p])){
	num *= 10;
	num += str[p]-'0';
	p++;
      }
      vector<int> tmp;
      if(isalpha(str[p])) tmp = pre[str[p++]-'A'];
      else {
	p++;
	tmp = term(p,str);
      }
      int cnt = cycle(tmp);
      num %= cnt;
      for(int i=0;i<num;i++){
	ret = change(ret,tmp);
      }
    }
    if(p==str.size() || str[p++] == ')') return ret;
  }
  return ret;
}

int main(){
  cin >> N >> K;
  for(int i=0;i<K;i++){
    vector<int> tmp(N);
    for(int j=0;j<N;j++){
      tmp[j] = j;
    }
    cin >> c >> h;
    for(int j=0;j<h-1;j++){
      for(int k=0;k<N-1;k++){
	int a; cin >> a;
	if(a == 1) swap(tmp[k],tmp[k+1]);
      }
    }
    pre[c-'A'] = tmp;
  }
  int E; cin >> E;
  for(int i=0;i<E;i++){
    string str; cin >> str;
    int p = 0;
    vector<int> ans = term(p,str);
    for(int i=0;i<N;i++){
      if(i != 0) cout << " ";
      cout << ans[i]+1;
    }
    cout << endl;
  }
}

Measured memory_bytes: 3328
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[10][11];
int main(){
	int a;
	scanf("%d",&a);
	int gomi;
	for(int i=0;i<a;i++)scanf("%s",str[i]);
	int at=-1;
	for(int i=0;i<a;i++){
		bool ok=true;
		for(int j=0;j<a;j++)if(str[i][j]=='x')ok=false;
		if(ok)at=i;
	}
	if(~at){
		for(int i=0;i<1000;i++){
			printf("%d\n",at+1);
			fflush(stdout);
			scanf("%d",&gomi);
		}
	}else{
		for(int i=0;i<1000;i++){
			printf("%d\n",rand()%a+1);
			fflush(stdout);
			scanf("%d",&gomi);
		}
	}
}

Measured memory_bytes: 1328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,R;
    cin >> N >> R;
    int ans;
    if(N>=10) ans=R;
    else{
        ans=R+100*(10-N);
    }
    cout << ans << endl;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
const ll infll = (1ll<<60);
using namespace std;

const int bound = 2019;
int n;
vector<ll> a;
ll mini[bound][bound];

void init(){
	for( int i = 0; i < n; ++i ){
		mini[i][i] = inf;
		for( int j = i; j < n; ++j ){
			mini[i][j+1] = min(mini[i][j], a[j]);
		}
	}
}

ll query( int a, int b ){
	if( a < 0 ){
		return min(mini[n+a][n], mini[0][b]);
	} else
		return mini[a][b];
}

int main(){
	ll x; cin >> n >> x;
	for( int i = 0; i < n; ++i ){
		ll tmp; cin >> tmp;
		a.push_back(tmp);
	}
	init();
	ll ans = infll;
	for( int k = 0; k < n; ++k ){
		ll res = 0;
		for( int i = 0; i < n; ++i ){
			res += query(i-k, i+1);
		}
		ans = min(ans, res+k*x);
	}
	cout << ans << endl;
}

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>

using namespace std;

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

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

    cout << max(0, a - 2*b) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define F first
#define S second
#define int long long
#define mod 1000000007
#define mmod 998244353
#define all(v) v.begin(), v.end()
#define INF LLONG_MAX/3
#define PI 3.14159265359
using namespace std;
int mypow(int fa, int fb, int fc) {
	if (fb == 0)return 1;
	if (fb % 2)return mypow(fa, fb - 1, fc)*fa%fc;
	int z = mypow(fa, fb / 2, fc);
	return z * z%fc;
}
int k(int fa) {
	int x = 0;
	while (fa) {
		x++;
		fa /= 10;
	}
	return x;
}
int gcd(int fa, int fb) {
	if (fb == 0)return fa;
	return gcd(fb, fa%fb);
}
signed main() {
	double a;
	cin >> a;
	printf("%.100lf", a*2*PI);
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {

	int R,G,B,N;
	cin >> R >> G >> B >> N;
	int ans = 0;
	for(int i=0; i<=N/R; i++) {
		for(int j=0; j<=N/G; j++) {
			int temp = N - (i * R + j * G);
			if (temp >= 0 && temp % B == 0) ans++;
		}
	}
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = input()

def dfs(i,f):
    if i == 3:
         a = eval(f)
         if a == 7:
             print(f+"=7")
             exit()
    else:
        dfs(i+1, f+"+"+N[i+1])
        dfs(i+1, f+"-"+N[i+1])


dfs(0,N[0])


Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

char w1[22][110];
char w2[44][110];
int w1_cnt, w2_cnt;
int cw[28];
int aw[28];
bool ok[44][22];
int ok_cnt[44];
bool vis[44];
int ans;

bool cal_ok(int i, int j) {
    if (strlen(w2[i]) != strlen(w1[j])) return false;
    int tw[28];
    memcpy(tw, cw, sizeof(tw));
    for (int k = 0; w2[i][k]; k++) {
        int c = w2[i][k] - 'A';
        int d = w1[j][k] - 'A';
        if (tw[c] != -1 && tw[c] != w1[j][k]) return false;
        if (tw[d] != -1 && tw[d] != w2[i][k]) return false;
        tw[c] = w1[j][k];
        tw[d] = w2[i][k];
    }
    return true;
}
void get_ok() {
    memset(ok, 0, sizeof(ok));
    for (int i = 0; i < w2_cnt; i++)
        for (int j = 0; j < w1_cnt; j++) {
            ok[i][j] = cal_ok(i, j);
            if (ok[i][j]) ok_cnt[i]++;
        }
}
void print_ok() {
	for (int i = 0; i < w2_cnt; i++) {
		for (int j = 0; j < w1_cnt; j++) {
			printf("%d ", ok[i][j]);
		}
		puts("");
	}
}

int find() {
    int p = -1;
    for (int i = 0; i < w2_cnt; i++) if (!vis[i])
        if (p == -1 || ok_cnt[i] < ok_cnt[p]) p = i;
    return p;
}

void dfs(int u) {
    if (ans > 1) return;
    if (u == -1) {
        ans++;
        memcpy(aw, cw, sizeof(aw));
        return;
    }
//    bool tmp[44][22];
//    int tmp_cnt[44];
    int tw[28];
//    memcpy(tmp, ok, sizeof(tmp));
//    memcpy(tmp_cnt, ok_cnt, sizeof(ok_cnt));
    memcpy(tw, cw, sizeof(tw));
    get_ok();
    for (int i = 0; i < w1_cnt; i++) if (ok[u][i]) {
        vis[u] = true;
        for (int j = 0; w2[u][j]; j++) {
            int c = w2[u][j] - 'A';
            int d = w1[i][j] - 'A';
            cw[c] = w1[i][j];
            cw[d] = w2[u][j];
        }
        dfs(find());
        memcpy(cw, tw, sizeof(tw));
        vis[u] = false;
        get_ok();
//        memcpy(ok_cnt, tmp_cnt, sizeof(tmp_cnt));
//        memcpy(ok, tmp, sizeof(tmp));
    }
}

void work() {
    for (int i = 0; i < w1_cnt; i++)
        scanf("%s", w1[i]);
    w2_cnt = 0;
    while (true) {
        char str[100];
        scanf("%s", str);
        int len = strlen(str);
        if (str[len - 1] == '.') {
            str[--len] = 0;
            strcpy(w2[w2_cnt], str);
            w2_cnt++;
            break;
        } else {
            strcpy(w2[w2_cnt], str);
            w2_cnt++;
        }
    }
//for (int i = 0; i < w2_cnt; i++) printf("%s ", w2[i]); puts(".....");
    memset(cw, -1, sizeof(cw));
    get_ok();
//print_ok();
    memset(vis, 0, sizeof(vis));
    int p = find();
//printf("%d\n", p);
    ans = 0;
    dfs(p);
    if (ans > 1) {
        puts("-.");
        return;
    }
//for (int i = 0; i < 26; i++) printf("%d ", aw[i]); puts("?");
    for (int i = 0; i < w2_cnt; i++) {
        for (int j = 0; w2[i][j]; j++) {
            int d = w2[i][j] - 'A';
            printf("%c", aw[d]);
        }
        if (i < w2_cnt - 1) printf(" ");
    }
    puts(".");
}

int main() {
    while (scanf("%d", &w1_cnt), w1_cnt) {
        work();
    }
    return 0;
}

Measured memory_bytes: 1044
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
inline int gcd(int a,int b)
{
	if(a==0)return b;
	else return gcd(b%a,a);
}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
   	int n=read(),ans=0;
   	for(int i=1;i<=n;i++)
   	{
   		for(int j=1;j<=n;j++)
   		{
   			int ul=gcd(i,j);
   			for(int k=1;k<=n;k++)ans+=gcd(ul,k);
   		}
   	}pr2(ans);
    return 0;
}

Measured memory_bytes: 1532
class unionFind():
	def __init__(self,n):
		self.tree=[-1]*n
	def find(self,x):
		if self.tree[x]<0:
			return x
		else:
			self.tree[x]=self.find(self.tree[x])
			return self.tree[x]
	def union(self,x,y):
		xr=self.find(x)
		yr=self.find(y)
		if xr!=yr:

			if self.tree[xr]==self.tree[yr]:
				self.tree[xr]-=1
				self.tree[yr]=xr
			elif self.tree[xr]>self.tree[yr]:
				self.tree[xr]=yr
			else:
				self.tree[yr]=xr
			return True
		
		return False
def main():
	ans=0
	n,m=map(int,input().split())
	a=unionFind(n)
	li=[x-1 for x in list(map(int,input().split()))]
	for _ in range(m):
		x,y=map(int,input().split())
		a.union(x-1,y-1)
	for x in range(n):
		ans += a.find(x)==a.find(li[x])
	return ans
print(main())




Measured memory_bytes: 15220
#include<cstdio>
int main()
{
	int sx,sy,tx,ty;
	while(scanf("%d%d%d%d",&sx,&sy,&tx,&ty)!=EOF)
	{
		for(int i=1;i<=ty-sy;i++)
			printf("U");
		for(int i=1;i<=tx-sx;i++)
			printf("R");
		for(int i=1;i<=ty-sy;i++)
			printf("D");
		for(int i=1;i<=tx-sx;i++)
			printf("L");
			printf("L");
		for(int i=1;i<=ty-sy+1;i++)
			printf("U");
		for(int i=1;i<=tx-sx+1;i++)
			printf("R");
			printf("DR");
		for(int i=1;i<=ty-sy+1;i++)
			printf("D");
		for(int i=1;i<=tx-sx+1;i++)
			printf("L");
		printf("U\n");
	}	
	return 0;
} 

Measured memory_bytes: 128
a, b, c, x, y = gets.split.map(&:to_i)
d = a * x + b * y
all = c * [x,y].max * 2
mi = ma = k = 0

if x < y
  mi = x
  ma = y
  k = c * mi * 2 + (ma - mi) * b
else
  mi = y
  ma = x
  k = c * mi * 2 + (ma - mi) * a
end

p [d, all, k].min

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

using namespace std;
int main(){
    string s;
    cin>>s;
    int flag=1;
    for(int i=0;i<3;i++){
        if((s[i]=='A' && s[i+1]=='B')||(s[i]=='B'&&s[i+1]=='A')){
            cout<<"Yes"<<endl;
            flag=0;
            break;
        }
    }
    if(flag==1){
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } else return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } else return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;

int N;
ll A[212345];

int main() {
	cin >> N;
	REP(i, N) scanf("%lld", A + i);
	
	int poscnt = N, ngcnt = 0;
	ll sum = 0, ans;
	REP(i, N) {
		A[i] += INF - i;
		sum += A[i];
	}
	ans = sum;
	
	sort(A, A + N);
	
	ll difsum = 0;
	REP(i, N) {
		A[i] -= difsum;
		
		sum -= A[i] * poscnt;
		sum += A[i] * ngcnt;
		
		difsum += A[i];
		
		poscnt--;
		ngcnt++;
		chmin(ans, sum);
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s;
    cin >> s;
    int month = stoi(string({s.at(5)}) + string({s.at(6)}));
    if(month<=4) cout << "Heisei" << endl;
    if(month> 4) cout << "TBD" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

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

    map<char, int> count;
    for (char c: w) {
        count[c]++;
    }

    for (auto p: count) {
        if (p.second % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

int main(void) {
    int64_t N,D;
    int64_t next;
    int64_t cnt = 0;
    cin >> N >> D;
    
    vector<vector<int>> X(N,vector<int>(D));
    for(int i=0;i<N;i++){
        for(int j=0;j<D;j++) {
            cin >> X[i][j];
        }
    }

//組み合わせの列挙
    for(int i=0;i<N-1;i++) {
        for(int next=i+1;next<N;next++) {
        int64_t sum = 0;
        for(int j=0;j<D;j++) {
            sum += (X[i][j] - X[next][j]) * (X[i][j] - X[next][j]);
        }

        int64_t ichk;
        ichk = sqrt((double)sum);
        if((ichk*ichk) == sum) {
            cnt++;
        }
        }
    }

    cout << cnt << "\n";
    return 0;
}


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

using namespace std;

int main(){
    int X, max = 1, num = 0;
    cin >> X;
    for(int i = 2; i <= X; ++i){
        num = i;
        for(int j = 0; num <= X; ++j){
            num *= i;
            if(num <= X && num > max) max = num;
        }
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll n,m,sum=0;
    cin>>n>>m;
    sum=(1900*m)+(n-m)*100;
    sum*=(1<<m);
    cout<<sum<<endl;

    return 0;
}


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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

const int D=365,A=26,K=30;

int d;
int c[A],s[D][A],last[A];

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

    cin>>d;
    for(int j=0;j<A;j++)
        cin>>c[j],
        last[j]=-1;
    for(int i=0;i<d;i++)
        for(int j=0;j<A;j++)
            cin>>s[i][j];
    for(int i=0;i<d;i++)
    {
        int best=0;
        for(int j=0;j<A;j++)
            if(s[i][j]+c[j]*(i-last[j])*min(K,d-i)>
               s[i][best]+c[best]*(i-last[best])*min(K,d-i))
                best=j;
        last[best]=i;
        cout<<best+1<<"\n";
    }
}


Measured memory_bytes: 3732
def main():
    MOD = int(1e9 + 7)
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]

    dp = [[0] * w for _ in range(h)]

    for i in range(h):
        for j in range(w):
            if grid[i][j] != '#':
                if i == 0 and j == 0:
                    dp[i][j] = 1
                
                if i > 0:
                    dp[i][j] += dp[i-1][j]

                if j > 0:
                    dp[i][j] += dp[i][j-1]

                if dp[i][j] > MOD:
                    dp[i][j] -= MOD

    ans = dp[h-1][w-1]
    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 51824
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    string s;
    cin >> s;
    int ans = s.size();

    FOR(i, 1, s.size()) {
        if (s[i] != s[i - 1]) {
            int a = max(i, (int)s.size() - i);
            ans   = min(ans, a);
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

#define N 100000

int a[N + 2];
int l[N + 2];
int r[N + 2];

int main(){
	int ans, n, i;

	scanf("%d", &n);

	for (i = 1; i <= n; i++){
		scanf("%d", a + i);
	}

	for (i = 1; i <= n; i++){
		l[i] = __gcd(l[i - 1], a[i]);
	}

	for (i = n; i >= 1; i--){
		r[i] = __gcd(r[i + 1], a[i]);
	}

	ans = 1;

	for (i = 1; i <= n; i++){
		ans = max(ans, __gcd(l[i - 1], r[i + 1]));
	}

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

	return 0;
}

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

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

namespace _DSU {
	constexpr int BUF = 212345 * 2;
	int ptr = 0;
	int mem[BUF];
	int* get(int size) {
		ptr += size;
		return mem + ptr - size;
	}
	void reset() {
		ptr = 0;
	}
}
class UF {
private:
	int *par, *rank;
public:
	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	UF(int n) :par(_DSU::get(n + 10)), rank(_DSU::get(n + 10)) {
		for (int i = 0; i<n; i++) {
			par[i] = i, rank[i] = 0;
		}
	}
	bool unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return false;
		if (rank[x] < rank[y])swap(x, y);
		par[y] = x;
		if (rank[x] == rank[y])rank[x]++;
		return true;
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

int main() {
	int N, M;
	while (cin >> N >> M) {
		_DSU::reset();
		vector<int> p(N);
		cin >> p;
		UF uf(N);
		for (int i : range(M)) {
			int x, y;
			cin >> x >> y;
			uf.unite(x - 1, y - 1);
		}
		int ret = 0;
		for (int i : range(N)) {
			if (uf.same(p[i] - 1, i))ret++;
		}
		cout << ret << endl;
	}
	return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<vector>
#define LL long long
#define PP std::pair<int,int>
int main() {
	int A, B, C, D;
	std::cin >> A >> B >> C >> D;
	std::cout << std::min({ A + C,A + D,B + C,B + D }) << std::endl;
	return 0;
}

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

s = []
all_10_flg = True

for x in range(N) :
    n = int(input())
    s.append(n)
    
    if n % 10 != 0 :
        all_10_flg = False
    

sum_all = sum(s)

if sum_all % 10 != 0 :
    print(sum_all)
elif all_10_flg == True :
    print("0")
else :
    max_sum = 0
    
    for i in s :
        if (sum_all - i) % 10 != 0:
            max_sum = max(max_sum, sum_all - i)
        
    print(max_sum)
    
    

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


#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

ll mod = 1e9 + 7ll;
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; }
const ll inf = 1ll << 60;

int main(){
    ll a, b;
    scanf("%lld%lld", &a, &b);
    a--;
    ll counta = 0ll;
    ll countb = 0ll;
    if(a%2 == 0) counta = a - a%2;
    if(b%2 == 0) countb = b - b%2;
    if(a%4 == 1 or a%4 == 2) counta += 1;
    if(b%4 == 1 or b%4 == 2) countb += 1;
    ll match = counta^countb;
    printf("%lld", match);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
 
int main()
{
	using namespace std;
	int a=0,b=0,c=0,count=0,ans=0;
	bool okada = true;
	std::cin >> a;
	long long int x[10000],y[100],z[100];
	for (int i = 1; i <= a; i++) {
		std::cin >> x[i];
	}
	
		for (int j = 1; j <= 1000; j++) {
			
			for (int i = 1; i <= a; i++) {

				if (x[i] % 2 == 0) {
					x[i] = x[i] / 2;
						ans++;
				}
			}
		}
	std::cout <<ans << std::endl;
}


Measured memory_bytes: 384