akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int H,W,x,y;
    cin>>W>>H>>x>>y;
    cout<<(double) W*H/2.0 <<" ";
    if(2*x==W && 2*y==H) cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}

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

int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

int main(){
    int N;
    unsigned long long pow=1;

    scanf("%d",&N);
    for(unsigned i=0;i<N;i++){
        pow *= i+1;
        pow %= 1000000007ull;
    }
    printf("%lld\n",pow);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007;
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main() {
    int n,a,b,c,d,e;
    cin>>n>>a>>b>>c>>d>>e;
    int r=min({a,b,c,d,e});
    if(n%r==0){
        cout<<n/r+4<<endl;
    }
    else{
        cout<<n/r+5<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}

int main(int argc, char *argv[]){
    int a, b, c; cin >> a >> b >> c;
    string res = "No";
    if(c >= a && b >= c) res = "Yes";
    cout << res << endl;
    return 0;
}

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

int main(){
  int n,a,cnt2=0,cnt4=0;
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>a;
    if(a%4==0)cnt4++;
    else if(a%2==0)cnt2++;
  }
  int cnt1=n-cnt2-cnt4;
  if(cnt2==0){
    cout << (cnt1<=cnt4+1?"Yes":"No") << endl;
    return 0;
  }
  if(cnt1<=cnt4)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define esort(s) sort((s).begin(),(s).end())

typedef long long ll;
typedef pair<int,int> ipair;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

int a,b,x;

void solve(){
    cin>>a>>b>>x;
    if(x>=a*a*b/2){
        x=a*a*b-x;
        double tan=2.0*x/a/a/a;
        // cout<<"tan1: "<<tan<<endl;
        printf("%.9lf\n",atan(tan)*180/PI);
    } else {
        double tan=1.0*a*b*b/x/2;
        // cout<<"tan2: "<<tan<<endl;
        printf("%.9lf\n",atan(tan)*180/PI);
    }
    return;
}

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

    solve();
    return 0;
}

Measured memory_bytes: 384
import bisect
s = input()
t = input()
u = s
while len(s) <= len(t):
    s += u
p = [[] for k in range(26)]
for k in range(len(s)):
    p[ord(s[k])-97].append(k)
for e in p:
    e.append(10**6)
ans = 0
now = -1
for e in t:
#    print(p[ord(e)-97][bisect.bisect_left(p[ord(e)-97],now)])
    if len(p[ord(e)-97]) == 1:
        print(-1)
        exit(0)
    q = p[ord(e)-97][bisect.bisect_right(p[ord(e)-97],now)]
    if q == 10**6:
        ans += len(s)-now+p[ord(e)-97][0]
        now = p[ord(e)-97][0]
    else:
        ans += q-now
        now = q
print(ans)


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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int x, y, a, b, c; cin >> x >> y >> a >> b >> c;
	vector<ll> p(a), q(b), r(c);
	REP(i, a) cin >> p[i]; sort(p.rbegin(), p.rend());
	REP(i, b) cin >> q[i]; sort(q.rbegin(), q.rend());
	REP(i, c) cin >> r[i];
	REP(i, x) r.push_back(p[i]);
	REP(i, y) r.push_back(q[i]);
	sort(r.rbegin(), r.rend());
	ll res = 0;
	REP(i, x + y) res += r[i];
	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 7768
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
gatedict = {i : 0 for i in range(n + 1)}
for i in range(m) :
    gatedict[a[i]] = 1
before = 0
for p in range(x) :
    before += gatedict[p]
after = 0
for q in range(x+1,n+1) :
    after += gatedict[q]
print(min(before, after))

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0;i < N;++i) {
		cin >> a[i];
	}
	int count = 1, spot = 1;
	for (int i = 0;i < N;++i) {
		if (a[spot - 1] == 2) {
			cout << count << endl;
			return 0;
		}
		count += 1;
		spot = a[spot - 1];
	}
	puts("-1");
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;
int C[51];
int V[51];
int main()
{
    int n=0;cin>>n;
    int win=0;
    for(int i=0;i<n;i++)
    {
        cin>>V[i];
    }
    for(int i=0;i<n;i++)
    {
        cin>>C[i];
    }
    for(int i=0;i<n;i++)
    {
        if(V[i]>C[i])
        {
            win+=(V[i]-C[i]);
        }
    }

    cout<<win;
          return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

ans=float('inf')
s=0
cnt=0

for i in range(n):
    s+=a[i]
    if i%2==0:
        if s>=0:
            cnt+=1+s
            s=-1
    else:
        if s<=0:
            cnt+=1-s
            s=1
ans=min(ans,cnt)
s=0
cnt=0
for i in range(n):
    s+=a[i]
    if i%2==1:
        if s>=0:
            cnt+=1+s
            s=-1
    else:
        if s<=0:
            cnt+=1-s
            s=1
ans=min(ans,cnt)

print(ans)

Measured memory_bytes: 63344
n = gets.chomp.to_i
ans = false
res = 0
n.times do
    d_1, d_2 = gets.chomp.split.map(&:to_i)
    if d_1 == d_2 then
        res += 1
        ans = true if res >= 3
    else
        res = 0
    end
end
puts ans ? "Yes" : "No"

Measured memory_bytes: 14312
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;
int dp[100000]={};//0は何も入っていない。1はまだマジックを使っていないボールが入っている。2はマジックを使ったボールが入っていることを示している。 添え字は 0 ~ (N-1)

int main(){
    int N,Q;
    cin>>N>>Q;
    dp[0]=1;
    for(int q=1;q<=Q;q++){
        int a,b;
        cin>>a>>b;
        a--; b--;
        if(a-1>=0 && dp[a-1]==1){
            dp[a]=2;
        }
        if(dp[a]==1){
            if(a-1>=0) dp[a-1]=2;
            if(a+1<N) dp[a+1]=2;
        }
        if(a+1<N && dp[a+1]==1){
            dp[a]=2;
        }
        if(b-1>=0 && dp[b-1]==1){
            dp[b]=2;
        }
        if(dp[b]==1){
            if(b-1>=0) dp[b-1]=2;
            if(b+1<N) dp[b+1]=2;
        }
        if(b+1<N && dp[b+1]==1){
            dp[b]=2;
        }
        int c = dp[a];
        dp[a]=dp[b];
        dp[b]=c;
    }
    for(int i=0;i<N;i++){
        if(dp[i]==1){
            if(i-1>=0) dp[i-1]=2;
            if(i+1<N) dp[i+1]=2;
        }
    }
    int res=0;
    for(int i=0;i<N;i++){
        if(dp[i]!=0){
            res++;
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 640
K=gets.to_i
table=Array.new
table << ['0','1','2','3','4','5','6','7','8','9']


10.times do |i|
  a=Array.new
  10.times do |j|
  table[-1].each do |e|
    if (e[0].to_i-j).abs <= 1
      a << "#{j.to_s}" + "#{e}"
    end
  end
end
  table << a
end

result=[]

table.each do |ar|
  ar.each do |e|
    if e[0] == '0'
      next
    else
      result << e.to_i
    end
  end
end

puts result[K-1]

Measured memory_bytes: 54268
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1e10;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 200010
ll wm[N];
bool u[N];

ll inv[N], fact[N], ifact[N];
 
void init_fact(ll n = N){
    inv[1] = 1;
    for(int i = 2; i < n; i++) inv[i] = inv[mod%i] * (mod - mod/i) % mod;
	fact[0] = ifact[0] = 1;
	for(int i = 1; i < n; i++){
		fact[i] = (fact[i-1]*i)%mod;
		ifact[i]=(ifact[i-1]*inv[i])%mod;
	}
}

int main(){
	ll n, x, y;
	cin>>n>>x>>y;
	init_fact();
	vector<P> v(n);
	rep(i, n){
		ll w, c;
		cin>>c>>w;
		v[i] = P(w, c);
	}
	sort(all(v));
	fill(wm, wm+N, INF);
	rep(i, n) chmin(wm[v[i].snd], v[i].fst);
	ll c0 = v[0].snd, w0 = v[0].fst;
	ll c1 = -1, w1 = INF;
	rep(i, n){
		if(v[i].snd!=c0){
			c1 = v[i].snd;
			w1 = v[i].fst;
			break;
		}
	}
	u[0] = 1;
	rep(i, n){
		ll c = v[i].snd, w = v[i].fst;
		if(c==c0){
			if(w+w1<=y || (w0+w1<=y && w+w0<=x)) u[i] = 1;
		} else {
			if(w+w0<=y || (w0+wm[c]<=y && w+wm[c]<=x)) u[i] = 1;
		}
	}
	map<ll, ll> m;
	rep(i, n) if(u[i]) m[v[i].snd]++;
	ll s = 0, res = 1;
	for(auto x: m){
		ll t = x.snd;
		(res*=ifact[t])%=mod;
		s += t;
	}
	(res*=fact[s])%=mod;
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 17536
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int R,W,c,r;
  while(1){
    cin>>R>>W>>c>>r;
    if(R==0&&W==0&&c==0&&r==0)break;
    int ans=0;
    while( (R+ans*r) < c*W )ans++;
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    vl v(n);
    rep(i, n) cin >> v[i];
    ll ans = 0LL;
    rep(i, n-1) {
        ans += min(b, (v[i+1]-v[i])*a);
    }
    cout << ans <<endl;
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> data(N);//N桁収納用
  //条件を表にする
  vector<vector<int>> ruru(M, vector<int>(2));
  for (int i = 0; i < M; i++) {
      cin >> ruru[i][0] >> ruru[i][1];
  }
  //条件の内、桁数がかぶってるかつ数字がかぶってたら－1を表示して終了
  //↑がなかったらdataに収納する
  for(int i=0; i < M; i++){
    if(N!=1 && ruru[i][0]==1 && ruru[i][1]==0){
       cout << -1 << endl;
         return 0;
    }
    for(int k = i+1; k < M; k++){
       if(ruru[i][0] == ruru[k][0] && ruru[i][1]!=ruru[k][1]){
         cout << -1 << endl;
         return 0;
       }   
    } 
    data[(ruru[i][0]-1)] = (ruru[i][1]);
  }
  int ans;
  //Nが1のときそのまま表示
  //Nが2以上の時一番上の桁を1にして、100とか10とかかけて足す
  //けっかを表示
   if(N==1){
     ans=data[0];
   }
   if(N==2){
      if (data[0] == 0) {
        data[0] = 1;
      }
     ans= 10*data[0] + data[1];
   } 
   if(N==3){
      if (data[0] == 0) {
        data[0] = 1;
      }
   ans = 100*data[0] + 10*data[1] + data[2];
   }
    
   cout << ans << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=l;i<r;i++)

char s1[300],s2[300];
int main(){
	while(scanf(" %s %s",s1,s2),*s1!='.'){
		int s1cnt=1,s2cnt=1;
		char*p=s1;
		while(p=strchr(p,'\"')){
			*p=0;
			s1cnt++;
			p++;
		}
		char*q=s2;
		while(q=strchr(q,'\"')){
			*q=0;
			s2cnt++;
			q++;
		}
		if(s1cnt!=s2cnt){
			puts("DIFFERENT");
		}else{
			int cnt=0;
			p=s1;
			q=s2;
			rep(i,0,s1cnt){
				if(strcmp(p,q))cnt+=i%2?1:2;
				p+=strlen(p)+1;
				q+=strlen(q)+1;
			}
			puts(cnt>=2?"DIFFERENT":cnt==1?"CLOSE":"IDENTICAL");
		}
	}
}


Measured memory_bytes: 2044
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main()
{
    double a,b;
    cin>>a>>b;
    int flag=0;
    for(double i=a*12;i<=(b+1)*10;i++)
    {
        //cout<<i<<endl;
        if(int(i*0.08)==a&&int(i*0.1)==b)
        {
            cout<<i;
            flag=1;
            break;
        }
    }
    if(flag==0)
        cout<<-1;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
ll a[85];
int main() {
  IOS;
  int n;
  cin >> n;
  ll cur = 1000;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 1; i < n; i++) {
    if (a[i - 1] < a[i]) {
      ll u = cur / a[i - 1];
      cur %= a[i - 1];
      cur += u * a[i];
    }
  }
  cout << cur << endl;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,M,C;
	int B[200],A[200][200];
	scan(N);scan(M);scan(C);
	rep(i,M){
		scan(B[i]);
	}
	int count=0;
	rep(i,N){
		int ans=C;
		rep(j,M){
			scan(A[i][j]);
			ans+=B[j]*A[i][j];
		}
		if(ans>0) count++;
	}
	prin(count);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	ll X; cin >> X;
	cout << (X / 500) * 1000 + ((X % 500) / 5)*5;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
vector<int>ans;
vector<int>G[1001];
int N,M;
vector<int>vis;
bool used[1001];
void dfs(int u)
{
	vis.push_back(u);
	used[u]=true;
	for(int v:G[u])
	{
		if(vis[0]==v)
		{
			if(ans.empty()||ans.size()>vis.size())ans=vis;
		}
		else if(!used[v])dfs(v);
	}
	vis.pop_back();
}
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int u,v;cin>>u>>v;
		G[u].push_back(v);
	}
	for(int i=0;i++<N;)
	{
		for(int j=0;j++<N;)used[j]=false;
		dfs(i);
	}
	cout<<(ans.empty()?-1:0)<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

struct segtree {
    vector<int> lazy, dat;
    int n;

    segtree(int n_, int init){
        n = 1;
        while(n < n_) n *= 2;
        dat.assign(n*2, init);
        lazy.assign(n*2, -1);
    }


    void set(int l, int r, int x){
        static queue<tuple<int,int,int>> q;
        q.emplace(0, n, 1);
        while(q.size()){
            int segl, segr, n;
            tie(segl, segr, n) = q.front();
            q.pop();
            push(segl, segr, n);
            // if(segr <= l || r <= segl);
            if(l <= segl && segr <= r) lazy[n] = x;
            else {
                int segm = (segl + segr) / 2;
                if(l < segm && segl < r) q.emplace(segl, segm, n*2);
                if(l < segr && segm < r) q.emplace(segm, segr, n*2+1);
            }
        }
    }

    int get(int k){
        return get(k, 0, n, 1);
    }

    int get(int k, int segl, int segr, int n){
        push(segl, segr, n);
        if(segl + 1 == segr) return dat[n];
        int segm = (segl + segr) / 2;
        if(k < segm) return get(k, segl, segm, n*2);
        else return get(k, segm, segr, n*2+1);
    }

    void push(int segl, int segr, int node){
        if(lazy[node] != -1){
            dat[node] = lazy[node];
            if(segl + 1 != segr){
                lazy[node*2] = lazy[node];
                lazy[node*2+1] = lazy[node];
            }
            lazy[node] = -1;
        }
    }
};

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

    int n, q;
    cin >> n >> q;
    segtree st(n, 2147483647);
    for(int iq = 0; iq < q; ++iq){
        int t;
        cin >> t;
        // dump(t);
        if(t == 0){
            int s, t, x;
            cin >> s >> t >> x;
            ++t;
            st.set(s, t, x);
        } else {
            int i;
            cin >> i;
            cout << st.get(i) << '\n';
        }
    }
}

Measured memory_bytes: 4928
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	int N;
	cin >> N;
	
	string x;
	string u;
	float ans;
	
	for (int i = 0; i < N; i++) {
		cin >> x >> u;
		if(u == "JPY") {
			ans += (float)atoi(x.c_str());
		} else if ( u == "BTC") {
			ans += std::stof(x) * 380000.0;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
inline int read(){
	int v=0,f=1;
	char c=getchar();
	while (c<'0' || c>'9'){
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9'){
		v=v*10+c-'0';
		c=getchar();
	}
	return v*f;
}
map<LL,LL> dp;
LL A,B,C,D,N;
const LL INF=9e18;
LL Go(LL x){
	if (x==0){
		return 0;
	}
	if (dp.count(x)) return dp[x];
	LL ans=INF;
	if (x<=INF/D){
		ans=x*D;
	}
	for (int dlt=-4;dlt<=4;dlt++){
		LL v=x+dlt;
		if (v%2==0){
			if (v/2<x){
				ans=min(ans,Go(v/2)+A+D*abs(dlt));
			}
		}
		if (v%3==0){
			if (v/3<x){
				ans=min(ans,Go(v/3)+B+D*abs(dlt));
			}
		}
		if (v%5==0){
			if (v/5<x){
				ans=min(ans,Go(v/5)+C+D*abs(dlt));
			}
		}
	}
	return dp[x]=ans;
}
void mian(){
	dp.clear();
	cin>>N>>A>>B>>C>>D;
	cout<<Go(N)<<endl;
	return;
}
int main(){
	int T;
	cin>>T;
	while (T--){
		mian();
	}
}

Measured memory_bytes: 6472
#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() {
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    double area;
    area = (double)w*h/2;
    printf("%.6f ", area);
    int flag = 0;
    if (w%2 == 0 && h%2 == 0) {
        if (x == w/2 && y == h/2) flag = 1;
    }
    cout << flag << endl;
    return 0;
}


Measured memory_bytes: 256
list = [1,4,8,9,16,25,27,32,36,49,64,81,100,121,125,128,144,169,196,216,225,243,256,289,324,343,361,400,441,484,512,529,576,625,676,729,784,841,900,961,1000]
x = int(input())

for i in sorted(list,reverse = True):
  if x >= i:
    print(i)
    break


Measured memory_bytes: 3060
a,b,c = map(int,input().split())
import math
k = int(input())
if b <= a:
  while True:
    k -= 1
    b *= 2
    if b > a:
      break
  
if c <= b:
  while True:
    k -= 1
    c *= 2
    if c > b:
      break
      
if k < 0:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;

int main() {
    int N; cin >> N;
    if(N==0){
        cout << 0 << endl;
        return 0;
    }
    vector<int> ans;
    while(N!=0){
        int b = N%2;
        if(b==-1){
            b = 1;
            N-=2;
        }
        ans.push_back(b);
        N/=-2;
    }

    for(int i=ans.size()-1; i>=0; i--){
        cout << ans[i];
    }
    cout << endl;
    return 0;
}





Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(); // 高橋体力
        int b = sc.nextInt(); // 高橋攻撃
        int c = sc.nextInt(); // 青木体力
        int d = sc.nextInt(); // 青木攻撃
     
        while (true) {
            c -= b;
            if(c <= 0) {
                System.out.println("Yes");
                break;
            }
            a -= d;
            if(a <= 0) {
                System.out.println("No");
                break;
            }
        }
	}
}

Measured memory_bytes: 35736
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#define pll              pair<long,long>
#define pii              pair<int,int>
#define scn(a)           scanf("%d", &a)
#define scn2(a, b)       scanf("%d%d", &a, &b)
#define scn3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pairl            pair<ll , ll >
#define scnl(a)          scanf("%lld", &a)
#define scnl2(a, b)      scanf("%lld%lld", &a, &b)
#define scnl3(a, b, c)   scanf("%lld%lld%lld", &a, &b, &c)
#define scns(s)          scanf("%s",s)
#define prts(s)          printf("%s\n",s)
#define prt(a)           printf("%d\n", a)
#define prtl(a)          printf("%lld\n", a)
#define prs(a)           printf("%d ", a)
#define prt2(a, b)       printf("%d %d\n", a, b)
#define prt3(a, b, c)    printf("%d %d %d\n", a, b, c)
#define prsl(a)          printf("%lld ", a)
#define prtl2(a, b)      printf("%lld %lld\n", a, b)
#define prtl3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define ptcs(a)          printf("Case %d: ", a)
#define pf               printf
#define sc               scanf
#define vi               vector<int >
#define vil              vector<ll >
#define pb               push_back
#define mem(a, b)        memset((a), (b), sizeof(a))
#define lg2(n)           (31-__builtin_clz(n))
#define N                2000010
#define inf              9999999
#define ll               long long
#define ull              unsigned long long
#define MIN              INT_MIN
#define MAX              INT_MAX
#define fast             ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<pair<ll, ll> , null_type, less<pair<ll, ll> >, rb_tree_tag, tree_order_statistics_node_update> odrst;
ll gcd(ll a, ll b){if(b==0) {return a;}return gcd(b, a % b);}
ll BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
//___________________________________________________________________________________________________________________
ll dp[N],dp1[N];
map<ll,ll>mp,mp1;
vector<ll>v[27],v1[27];
//char c[100001];
int main()
{
    fast;
    odrst os;
    //freopen("fff.txt","w",stdout);
    bool ok=false,ok1;
    //os.insert({-100000000000,0});
    //v.pb(-100000000000);
    ll t,n,q,m,x,x1,y,ans=0,yy,mm,z,mx=0,my=0,z1=0,h,cn=0,p1=1,p2=0;
    cin>>n>>m>>x;
    if(x==n && x==m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

double d_minkowski_k(int *d, int n, double k);
double d_chebyshev(int *d, int n);

int main(void)
{
  int i,n, x[100],y[100],d[100];
  scanf("%d", &n);
  for(i=0;i<n;i++) {
    scanf("%d", &x[i]);
  }
  for(i=0;i<n;i++) {
    scanf("%d", &y[i]);
    d[i]= fabs(x[i]-y[i]);
  }
  printf("%lf\n", d_minkowski_k(d,n,1));
  printf("%lf\n", d_minkowski_k(d,n,2));
  printf("%lf\n", d_minkowski_k(d,n,3));
  printf("%lf\n", d_chebyshev(d, n));
  return 0;
}

double d_minkowski_k(int *d, int n, double k)
{
  double distance=0;
  int i;
  for(i=0;i<n;i++) {
    distance += pow(d[i], k);
  }
  return pow(distance, 1/k);
}

double d_chebyshev(int *d, int n)
{
  double max=0;
  int i;
  for(i=0;i<n;i++) {
    if(max<d[i])
      max=d[i];
  }
  return max;
}

Measured memory_bytes: 2812
// CODE FESTIVAL 2017 qual B-C
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る

int n_max=100010;
vector<int> color(n_max,-1);
vector<int> jisu(n_max,0);
vector<vector<int>> rinsetu(n_max);
int c_0=0;
bool dfs(int x,int c){
    color[x]=c;
    if(c==0) c_0++;
    for(int i=0;i<jisu[x];i++){
        int next=rinsetu[x][i];
        if(color[next]==-1 && !(dfs(next,1-color[x]))){
            return false;
        }else{
            if(color[x]==color[next]){
                return false;
            }
        }
    }
    return true;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    ll n,m;
    cin>>n>>m;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        jisu[a]++,jisu[b]++;
        rinsetu[a].e_b(b),rinsetu[b].e_b(a);
    }
    if(dfs(1,0)){
        cout<<(c_0*(n-c_0))-m<<endl;
    }else{
        cout<<n*(n-1)/2-m<<endl;
    }
    return 0;
}

Measured memory_bytes: 9956
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;

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

/////////////////////////////////////////////////////////////////////////////////////////

int main(){
    int n,k;
    cin >> n >> k;
    int cnt = 1;
    while(n / k > 0){
        n /= k;
        cnt++;
    }

    cout << cnt << endl;
}   

Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int n, p;
        while((n = scn.nextInt()) > 0) {
            p = scn.nextInt();
            int i = n - 1, now = p;
            int[] ary = new int[n];
            while(ary[i] != p) {
                i = (i + 1) % n;
                if(now > 0) {
                    now--;
                    ary[i]++;
                } else {
                    now += ary[i];
                    ary[i] = 0;
                }
            }
            System.out.println(i);
        }
    }
}

Measured memory_bytes: 26560
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long



#if 0
const int MOD = ;

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1) ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
}

inline void add(int &x, int y) {
    x += y;
    mod(x);
}

inline void sub(int &x, int y) {
    x += MOD - y;
    mod(x);
}

inline void mul(int &x, int y) {
    x = (1LL * x * y) % MOD;
}

inline int inv(int x) {
    return lgput(x, MOD - 2);
}
#endif

#if 0
int fact[], invfact[];

inline void prec(int n) {
    fact[0] = 1;
    for(int i = 1; i <= n; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    }
    invfact[n] = lgput(fact[n], MOD - 2);
    for(int i = n - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % MOD;
    }
}

inline int comb(int n, int k) {
    if(n < k) return 0;
    return (1LL * fact[n] * (1LL * invfact[k] * invfact[n - k] % MOD)) % MOD;
}
#endif

using namespace std;


struct DSU {
    vector <int> par;
    int n;
    inline void init(int _n) {
        n = _n;
        par.resize(n + 1);
    }
    int root(int x) {
        if(par[x] == 0)
            return x;
        return par[x] = root(par[x]);
    }
    inline void join(int x, int y) {
        x = root(x), y = root(y);
        if(x != y) {
            par[x] = y;
        }
    }
};

int main() {
#if 0
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    int i, n, m;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> m;
    vector < vector <int> > g(n + 1);
    for(i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    vector <int> deg(n + 1);
    for(i = 1; i <= n; i++) {
        deg[i] = g[i].size();
        if(deg[i] & 1) {
            cout << "No";
            return 0;
        }
    }

    vector <int> nodes;
    for(i = 1; i <= n; i++) {
        if(deg[i] >= 6) {
            cout << "Yes";
            return 0;
        }
        if(deg[i] == 4) {
            nodes.push_back(i);
        }
    }

    if(nodes.size() >= 3) {
        cout << "Yes";
        return 0;
    }

    if(nodes.size() <= 1) {
        cout << "No";
        return 0;
    }


    int cnt = 0;
    for(auto it : g[nodes[0]]) {
        int cur = it, last = nodes[0];
        while(cur != nodes[1] && cur != nodes[0]) {
            for(auto itr : g[cur]) {
                if(itr != last) {
                    last = cur;
                    cur = itr;
                    break;
                }
            }
        }
        cnt += (cur == nodes[1]);
    }

    if(cnt == 2) {
        cout << "Yes";
        return 0;
    }


    cout << "No";

    return 0;
}



Measured memory_bytes: 6144
y=0
z=1
x=list(map(int,input().split()))
#print(x)

a=x[0]
b=x[1]
c=x[2]

while True:
    if y>=c:
        break
    elif z%7==0:
        z+=1
        y+=a+b
        #print(z)
    else :
        y+=a
        z+=1
        #print(y)
print(z-1)
    


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dl;
#define pb push_back
#define F first
#define S second
#define inf LLONG_MAX
#define mod 1000000007
#define PI 3.1415926536
#define vll vector <ll>
#define pll pair <ll,ll>
#define dbg(n) cout<<n<<' '
#define cu continue
#define br break
#define N 1000005
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 

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


    ll a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll k;
    cin>>k;
    k--;
    cout<<a[k]<<'\n';
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using static System.Math;
using System.Linq;
using static System.Array;

namespace ConsoleApp2
{
    class Program
    {
        //static int N;
        //static long mod = 1000000007;
        //static char[] az = Enumerable.Range('a', 'z' - 'a' + 1).Select(i => (Char)i).ToArray();
        static void Main(string[] args)
        {
            //var N = long.Parse(Console.ReadLine());
            //var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();

            var S = Console.ReadLine().ToCharArray();
            long ans = 0;
            var sumA = 0;
            for (int i = 0; i < S.Length; i++)
            {
                
                if(S[i] == 'A')
                {
                        sumA++;
                     
                }
                else if (i < S.Length - 1 && S[i] == 'B' && S[i + 1] == 'C')
                {
                    ans += sumA;
                    i++;
                }
                else
                {
                    sumA = 0;
                }
            }

            Console.WriteLine(ans);
            //R = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            //var S = Console.ReadLine();

        }
    }
}


Measured memory_bytes: 27016
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal


def main():
    n = int(input())
    a = list(map(int, input().split()))
    q = int(input())
    bc = []
    for _ in range(q):
        bc.append(list(map(int, input().split())))

    a_i = [0]*(10**5 + 10)
    for num in a:
        a_i[num] += 1

    amount = 0
    for i, num in enumerate(a_i):
        amount += num * i

    for element in bc:
        amount = amount - a_i[element[0]] * \
            element[0] + a_i[element[0]] * element[1]
        a_i[element[1]] += a_i[element[0]]
        a_i[element[0]] = 0

        print(amount)


if __name__ == '__main__':
    main()


Measured memory_bytes: 102144
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd				double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll				vector<long long>
#define vpii			vector<pair<int,int>>
#define vpll			vector<pair<long long,long long>>
#define vvi				vector<vector<int>>
#define vvl				vector<vector<long long>>
#define mii             map<int,int>
#define mll  			map<long long,long long>
#define umii			unordered_map<int,int>
#define umll			unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)		for(int i=0;i<n;i++)
#define rep2(i,a,b)		for(int i=a;i<b;i++)
#define rev(i,n)		for(int i=n;i>=0;i--)
#define rev2(i,a,b)		for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define fio				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl			'\n'
#define all(x)			x.begin(),x.end()
#define d0(x)			cout <<x<<" "
#define d1(x)			cout <<x<<endl
#define d2(x,y)			cout <<x<<" "<<y<<endl
#define d3(x,y,z)		cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)		cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
const ll mod=1e9+7;
const dd pi=M_PI;
const ll MOD=998244353;
void i_o()
{
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
} 
int main()
{
	fio
   	i_o();
   	int n;
   	cin>>n;
   	set<string> s;
   	rep(i,n){
   		string s1;
   		cin>>s1;
   		s.insert(s1);
   	}
   	cout <<s.size();



    
	return 0;
}



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

int main() {
string s; cin >> s;
for (int i = 0; i < s.size() - 1; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2 << endl;
return 0;
}
}

for (int i = 0; i < s.size() - 2; i++) {
if (s[i] == s[i + 2]) {
cout << i + 1 << " " << i + 3 << endl;
return 0;
}
}
cout << -1 << " " << -1 << endl;

return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;


public class Main {
	public static int partition(String[][] arr, int p, int r) {
		int x = toInt(arr, r);
		int i = p - 1;
		for (int j = p; j < r; j++) {
			if (toInt(arr, j) <= x) {
				change(arr, ++i, j);
			}
		}
		change(arr, ++i, r);
		return i;
	}
	public static void quickSort(String[][] arr, int p, int r) {
		if (p < r) {
			int q = partition(arr, p, r);
			quickSort(arr, p, q - 1);
			quickSort(arr, q + 1, r);
		}
	}
	public static void change(String[][] str, int a, int b) {
		String[] c = str[a];
		str[a] = str[b];
		str[b] = c;
	}
	public static int toInt(String[][] arr, int n) {
		return Integer.parseInt(arr[n][1]);
	}
	public static void merge(String[][] arr, int left, int mid, int right) {
		int n1 = mid - left;
		int n2 = right - mid;
		String[][] l = new String[n1 + 1][2];
		String[][] r = new String[n2 + 1][2];
		for (int i = 0; i < n1; i++) {
			l[i] = arr[left + i];
		}
		for (int i = 0; i < n2; i++) {
			r[i] = arr[mid + i];
		}
		l[n1][1] = Integer.toString(Integer.MAX_VALUE);
		r[n2][1] = Integer.toString(Integer.MAX_VALUE);
		int i = 0, j = 0;
		for (int k = left; k < right; k++) {
			if (toInt(l, i) <= toInt(r, j)) {
				arr[k] = l[i++];
			} else {
				arr[k] = r[j++];
			}
		}
	}
	public static void mergeSort(String[][] arr, int left, int right) {
		if (left + 1 < right) {
			int mid = (left + right) / 2;
			mergeSort(arr, left, mid);
			mergeSort(arr, mid, right);
			merge(arr, left, mid, right);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[][] arr = new String[n][2];
		String[][] stableSort = new String[n][2];
		for (int i = 0; i < n; i++) {
			arr[i] = stableSort[i] = sc.nextLine().split(" ");
		}
		mergeSort(stableSort, 0, n);
		quickSort(arr, 0, n - 1);
		boolean isStable = true;
		for (int i = 0; i < n; i++) {
			if (!arr[i][0].equals(stableSort[i][0])) {
				isStable = false;
				break;
			}
		}
		if (isStable) {
			System.out.println("Stable");
		} else {
			System.out.println("Not stable");
		}
		for (int i = 0; i < n; i++) {
			System.out.println(arr[i][0] + " " + arr[i][1]);
		}
	}
}


Measured memory_bytes: 197940
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
from collections import Counter
#w=input()
i=0
j=0
s=0#価値の計算に使う何もしないときが0
eq=''
diff= 0
N=int(input())
#red_list =  (list(input())for i in range(N))
red_list =[[input() for i in range(1)for j in range(N)]]
red_simple_list=red_list[0]
#print(red_simple_list)
#Nori=N
#D, N=input().split()
#S=input()
M=int(input())
blue_list =[[input() for i in range(1)for j in range(M)]]
blue_simple_list=blue_list[0]
#print(red_list)
#print(blue_list)
for j in range(N-1):#二次元配列注意
 #print(red_list[0][0])
 #print(j)
 #print(red_list.count(red_list[0][j]))
 eq=red_simple_list[j]
 #print(type(eq))
 #print(eq)
 
 diff=red_simple_list.count(eq)-blue_simple_list.count(eq)
 #diff=red_list.count(red_list[j])-blue_list.count(red_list[j])
 if diff > s:
     s= diff
print(s)

# def flatten_2dim(array):
#     return [item for sublist in array for item in sublist]

# counter = Counter(flatten_2dim(red_list[i]))
# print(counter)
# for word, cntr in counter.most_common():
#     print(word, cntr)
#S_list=list(S)

#M=int(input())
#drink_list = [list(map(int, input().split(" ")))for i in range(M)]
#print(T_list[1])
#D=int(D)
#N=int(N)
#不本意だが内包表記で二次元の空のリストを作成する
     
#dp=[['' for i in range(2)] for j in range(N)]
#absTH=[''for i in range(N)]
#K=int(K)
#S_list=[]
#sentence_list=[]
#total=0
#mojiretu=""
#センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい！
#for i in range(K):
# ID_list.append(i+1)
#print(ID_list)
#for i in range(H)
#この下の行が二次元リストの読み込
#intを消して記号を読み込めるようにしたしかしこれでは文字列から読み込んでいるのと同じ
#weight_value_list =  [list(input())for i in range(N)]#一文字づつばらして入れてしまう
#s = [input() for i in range(N)]
#複数行に複数の入力値を取得し、出力する
#sentence_list =  (list(input())for i in range(N))
#for i in range(H):
#  ppixel_list=list(input())
    
#print(pixel_list)
#high_pixel_list =[['' for i in range(W)]for j in range(2*H)]
#print(high_pixel_list)
#print(pixel_list[0][1])#行　列の順番にかっこが並んでいる
#print(a_list)
first_term=0
second_term=0
#整数二次元配列を読み込む時のやり方
#a_b_c_list =  [list(map(int, input().split(" ")))for i in range(N)]
     
#センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい！
  
     
#x, y = [0]*N, [0]*N#N個の空のリストを作成
#l = list(range(N))#範囲がNのリストを作成する
     
#for i in range(N):
#  x[i], y[i] = map(int, input().split())
#分けて入力する形式を設定することで可読性が高く仕上がっている
#素晴らしいことだ
     
     

#comb = list(itertools.permutations(l))
#prmutation:英語の意味としては順列である
'''p[, r]で
長さrのタプル列、重複なしのあらゆる並びを表す
今回はリストlの重複なしの並び替え順序を新たなリストに収納している
並び方を計算しリストに収納しているイメージ
l[0,1,2]
l[0,2,1]これにもリスト番号が0,1,2と割り振られている
これが全通り入っている
これ作った人はすごい
自分も早く理解したい
'''
#for i in range(0, len(comb)):#i番目のパターンの時を考える。
#  for j in range(0, N-1):#lのリスト番号を読み込み
#    distance += math.sqrt((x[comb[i][j]]-x[comb[i][j+1]])**2 + (y[comb[i][j]]-y[comb[i][j+1]])**2)
'''
各経路の距離を足していき全距離分を経路数
で割れば平均距離が出るので各経路ごとの距離は
不必要と判断されている。
'''
#print(distance/len(comb))
# dp[i+1][j]=max(dp[i][j]+a_b_c_list[i],dp[i][j],dp[i][j])
#リストを一周するようにすればいいのか


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

namespace ABC170C
{
    class Class1
    {
        static void Main(string[] args)
        {
            string[] XN = Console.ReadLine().Split(' ');
            int X = int.Parse(XN[0]);
            int N = int.Parse(XN[1]);
            string[] pinput = Console.ReadLine().Split(' ');
            int[] p = new int[N];
            for(int i = 0; i < N; i++)
            {
                p[i] = int.Parse(pinput[i]);
            }
            Array.Sort(p);
            int ans = 0;
            int j = 0;
            for(int i = 0; i <= 101; i++)
            {
                if (j < p.Length && i == p[j])
                {
                    j += 1;
                }
                else
                {
                    if (Math.Abs(X - ans) > Math.Abs(X - i))
                    {
                        ans = i;
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27404
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val s = sc.next().toCharArray
    
    val l = s.length
    
    for (i <- 1 to l) {
      val ss = s.take(l - i)
      val ll = ss.length
      if (ss.take(ll / 2) sameElements ss.drop(ll / 2)) {
        println(ll)
        sys.exit(0)
      }
    }
  }
}

Measured memory_bytes: 25928
#include<bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()
 
int GCD(int a,int b){ return b ? GCD(b,a%b) : a ;}
int LCM(int a,int b){ return a*b / GCD(a,b) ;}
 
typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;


int n,a,b,c;
int ans = INF;
vector<int> l(10);

int calc(vector<int> v){
   int anst = INF;
   int ta=0,tb=0,tc=0;
   int ca=0,cb=0,cc=0;
   for(int i=0;i<n;i++){
      if(v[i] == 0){ta+=l[i];ca++;}
      else if(v[i] == 1){tb+=l[i];cb++;}
      else if(v[i] == 2){tc+=l[i];cc++;}
   }
   if(ca==0)ca++;
   else if(cb==0)cb++;
   else if(cc==0)cc++;
   if(ta==0||tb==0||tc==0)return 0;
   anst = abs(ta-a)+abs(tb-b)+abs(tc-c) + (ca-1)*10+(cb-1)*10+(cc-1)*10;
   ans = min(ans,anst);
   return 0;
}


int main(){
   cin >> n >> a >> b >> c;
   rep(i,n)cin >> l[i];


   for(int bit=0;bit<(1<<2*n);bit++){
      vector<int> v(n);
      for(int i=0;i<n;i++){
         v[i] = (bit>>i*2) & 3;
      }
      calc(v);
   }
   cout << ans << endl;
   return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};

int h,w;
int dist[10][10];
vector<int> v;
ll res = 0;
int main(){

  cin >> h >> w;
  FILL(dist,10,INF);
  REP(i,10){
    REP(j,10){
      int x;cin >> x;
      dist[i][j] = x;
    }
  }
  REP(i,10)dist[i][i] = 0;
  REP(i,h*w){
    int x;cin >> x;
    v.push_back(x);
  }
  REP(k,10){
    REP(i,10){
      REP(j,10){
        if(dist[i][k] == INF || dist[k][j] == INF)continue;
        dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j]);
      }
    }
  }
  REP(i,h*w){
    if(v[i] == -1)continue;
    res += dist[v[i]][1];
  }
  cout << res << endl;
  


  return 0;
}


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

signed main() {
	int n;
	cin >> n;
	vector<int> t(n);
	rep(i, n) cin>>t[i];
	int m; cin >> m;
	vector<int> p(m);
	vector<int> x(m);
	rep(i, m) cin >> p[i] >> x[i];
	
	int max = 0;
	rep(i, n) max += t[i];
	rep(i, m) {
		int ans = max - t[p[i]-1] + x[i];
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <set>

using namespace std;

int main()
{
    string A, B, C;
    cin >> A >> B >> C;
    set<string> s;
    s.insert(A);
    s.insert(B);
    s.insert(C);

    string ans = (s.size() == 2) ? "Yes" : "No";
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
x, y = [int(i) for i in input().split()]

tmp = []
for tmp_x, tmp_y, inversion in [[x, y, 0], [-x, y, 1], [x, -y, 1], [-x, -y, 2]]:
    if tmp_x <= tmp_y:
        tmp.append(inversion + (tmp_y - tmp_x))
ans = min(tmp)
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main()
{
	int n;
	char a[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	char b[10000];
	scanf("%d", &n);
	scanf("%s", b);
	for (int i = 0; i < strlen(b); i++) {
		for (int j = 0; j < 26; j++) {
			if (b[i] == a[j]) {
				printf("%c", a[(j + n) % 26]);
			}
		}
	}
}

Measured memory_bytes: 128
#include<stdio.h>
  int main(){
    int N,num[101]={0},i,j,count=0,min,temp;
    scanf("%d",&N);
    for(i=0;i<N;i++){
      scanf("%d",&num[i]);
    }

    for(i=0;i<N;i++){
      min=i;
      for(j=i;j<N;j++){
        if(num[j]<num[min]){
          min=j;
        }
      }
      if(num[i]>num[min]){
        temp=num[i];
        num[i]=num[min];
        num[min]=temp;
        count++;
      }
    }

    for(i=0;i<N;i++){
      printf("%d",num[i]);
      if(i!=N-1)printf(" ");
    }

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



Measured memory_bytes: 2068
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define maxn 1000005
#define maxm 205
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
 
int n, m, k,sum;
ll ans;
int a[200005];
int main(){
	int i, j, x;
	n =read();
	for(i = 1;i <=n;i++) a[i]=read();
	for(i=2;i<=n;i++){
		if(a[i] < a[i-1]) ans+=a[i-1]-a[i],a[i] = a[i-1];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4528