akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9+1;
const ll LINF = 1e18+1;
const long double PI = acos(-1.0);

#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SORT(v) sort(ALL(v));
#define RSORT(v) sort(RALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;
 
#define HOGE COUT("HOGE")
 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}
 
template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
template<typename T> T gcd(T a,T b){if(b==0){return a;}else{return gcd(b, a%b);}}
template<typename T> T lcm(T a,T b){return a*b/gcd(a, b);}


const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main() {
    IN(int, n);
    VIN(int, a, n);
    a.push_back(-1);
    ll k = 1000;
    REP(i, n){
        if (a[i]<a[i+1]) {
            k += (a[i+1]-a[i])*(k/a[i]);
        }
    }
    COUT(k);
}


Measured memory_bytes: 3640
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

lst = inputs[1]

# body
if $debugFlag
end

ans = []

lst.size.times do |i|
  ans[lst[i]] = i+1
end

pd ans

(ans.size-1).times do |i|
  if i == ans.size - 2
    print "#{ans[i+1]}\n"
  else
    print "#{ans[i+1]} "
  end
end


Measured memory_bytes: 12564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second

ll h, w, k, a, b, m, n;

int main() {
	cin>>h>>w>>k;
	cin>>a>>b>>m>>n;
	char c[h+1][w+1];
	for (int i=1; i<=h; i++) {
		for (int j=1; j<=w; j++) {
			cin>>c[i][j];
		}
	}
	queue < pair<ll, ll> > q;
	ll vis[h+1][w+1];
	memset(vis, -1, sizeof(vis));
	vis[a][b]=0;
	q.push(make_pair(a, b));
	while (!q.empty()) {
		ll x=q.front().fi, y=q.front().se;
		//cout<<"x:"<<x<<" y:"<<y<<endl;
		q.pop();
		for (int i=1; i<=k; i++) {
			if (y+i<=w) {
				if (c[x][y+i]=='.'&&(vis[x][y+i]==-1||vis[x][y+i]==vis[x][y]+1)) {
					if (vis[x][y+i]==-1) {
						vis[x][y+i]=vis[x][y]+1;
						q.push(make_pair(x, y+i));
					}
				}
				else break;
			}
		}
		for (int i=1; i<=k; i++) {
			if (y-i>0) {
				if (c[x][y-i]=='.'&&(vis[x][y-i]==-1||vis[x][y-i]==vis[x][y]+1)) {
					if (vis[x][y-i]==-1) {
						vis[x][y-i]=vis[x][y]+1;
						q.push(make_pair(x, y-i));
					}
				}
				else break;
			}
		}
		for (int i=1; i<=k; i++) {
			if (x+i<=h) {
				if (c[x+i][y]=='.'&&(vis[x+i][y]==-1||vis[x+i][y]==vis[x][y]+1)) {
					if (vis[x+i][y]==-1) {
						vis[x+i][y]=vis[x][y]+1;
						q.push(make_pair(x+i, y));
					}
				}
				else break;
			}
		}
		for (int i=1; i<=k; i++) {
			if (x-i>0) {
				if (c[x-i][y]=='.'&&(vis[x-i][y]==-1||vis[x-i][y]==vis[x][y]+1)) {
					if (vis[x-i][y]==-1) {
						vis[x-i][y]=vis[x][y]+1;
						q.push(make_pair(x-i, y));
					}
				}
				else break;
			}
		}
		//for (int i=1; i<=h; i++) {
		//	for (int j=1; j<=w; j++) {
		//		cout<<i<<" "<<j<<" = "<<vis[i][j]<<endl;
		//	}
		//}
	}
	cout<<vis[m][n]<<endl;
}



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

int main(void){
    int n;
    std::cin >> n;
    std::vector<int> a = {1, 1, 0, 2, 0, 0, 1, 0, 1, 0};
    std::string b;
    int one = n % 10;

    
    if(a[one] == 0) b = "hon";
    else if(a[one] == 1) b = "pon";
    else b = "bon";
    std::cout << b << std::endl;

    // for(int i = 0; i < n; i++){
    //     if(a[i] == 0) b = "hon";
    //     else if(a[i] == 1) b = "pon";
    //     else b = "bon";
    //     std::cout << i << b << std::endl;
    // }
    return 0;
}


Measured memory_bytes: 3588
using System;

namespace Sorting3Num
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int[] data = getInputdata (" ");
			int tmp;

			if (data [0] > data [1]) {
				tmp = data [0];
				data [0] = data [1];
				data [1] = tmp;
			}
			if (data [1] > data [2]) {
				tmp = data [1];
				data [1] = data [2];
				data [2] = tmp;
			}
			if (data [0] > data [1]) {
				tmp = data [0];
				data [0] = data [1];
				data [1] = tmp;
			}
	
			Console.WriteLine ("{0} {1} {2}", data[0], data[1], data[2]);
		}

		public static int[] getInputdata (string token)
		{
			string[] data = Console.ReadLine ().Split (token.ToCharArray ());
			int[] idata = new int[data.Length];

			for (int i = 0; i < data.Length; i++) {
				idata [i] = int.Parse (data [i]);
			}
			return idata;
		}

	}
}

Measured memory_bytes: 5620
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define l(i,a,b) for(auto i=a;i<b;i++)
#define lr(i,a,b) for(auto i=a;i>=b;i--)
#define ll long long
#define lli long long int
#define ld long double
#define vec vector<int>
#define mii map<ll,ll>
#define vl vector<long long>
#define se set <long long int>
#define pi pair<long long,long long>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define in(x) cin>>x
#define o(x) cout<<x
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.14159265359
using namespace std;


ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

//const string k = "enterstringtobechecked";



int main()
{
    SYNC
    //clock_t tStart = clock();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n; in(n);
    vector<string>v = {"AC", "WA", "TLE", "RE"};
    vector<ll> count = {0,0,0,0};
    l(i,0,n)
    {
        string s; in(s);
        l(j,0,4)
        {
            if(s==v[j])
            {
                count[j]++;
                break;
            }
        }
    }
    o("AC x ")<<count[0]<<endl;
    o("WA x ")<<count[1]<<endl;
    o("TLE x ")<<count[2]<<endl;
    o("RE x ")<<count[3]<<endl;








    //printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);   
}


Measured memory_bytes: 3584
from itertools import accumulate

N = int(input())
A1 = [0] + list(accumulate(int(i) for i in input().split()))
A2 = [0] + list(accumulate(int(i) for i in input().split()))

ma = 0
for i in range(N):
    ma = max(ma, A1[i + 1] - A1[0] + A2[N] - A2[i])
print(ma)


Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<math.h>
#define N 100010
int main()
{
    long long x[N];
    long long n;
    long long m,a;
    long long sum=0;
    scanf("%lld %lld",&n,&m);
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&x[i]);
    }
    x[n]=0;
    for(int i=0;i<n;i++)
    {
        if(x[i]+x[i+1]>m)
        {
            a=x[i+1]+x[i]-m;
            sum=sum+a;
            x[i+1]=x[i+1]-a;
        }
    }
    printf("%lld",sum);
    return 0;
}


Measured memory_bytes: 896
#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-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    vector<int> A(N);
    for (auto &i : A) cin >> i;

    vector<P> v(N);
    rep(i, N) v[i] = P(A[i], i);

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

    vector<vector<ll>> dp(N+1, vector<ll>(N+1));
    rep(i, N) {
        rep(j, N) {
            if (i < j) continue;
            int x = j, y = i - j;
            int a = v[i].first, b = v[i].second;
            chmax(dp[x+1][y], dp[x][y] + (ll)a * (b - x));
            chmax(dp[x][y+1], dp[x][y] + (ll)a * (N-1-y - b));
        }
    }

    ll ans = 0;
    rep(i, N+1) {
        chmax(ans, dp[i][N-i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 34684
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;
 
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  rep(i,m) cin >> a[i];

  ll sum = 0;
  rep(i,m) sum += a[i];

  if (sum > n) cout << "-1" << endl;
  else cout << n - sum << endl;

  return 0;
}


Measured memory_bytes: 3632
x1, y1, x2, y2 = map(int, input().split())

vec = (x2 - x1, y2 - y1)

vec2 = (-vec[1], vec[0])
vec3 = (-vec2[1], vec2[0])

x3, y3 = (x2 + vec2[0], y2 + vec2[1])
x4, y4 = (x3 + vec3[0], y3 + vec3[1])

print(x3, y3, x4, y4)

Measured memory_bytes: 9132
#include<bits/stdc++.h>
using namespace std;
char s[100005];
int main(void){
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=a+b+1;i++) cin>>s[i];
    for(int i=1;i<=a+b+1;i++)
    {
        if(s[i]<48&&i!=a+1||s[i]>58&&i!=a+1)
        {
            cout<<"No"<<endl;
            exit(0);
        }
        if(i==a+1&&s[i]!='-')
        {
            cout<<"No\r\n";
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <complex>
#include <map>
#include <set>


#define forin(i, f, t) for(ll i = f; i < t; i++)

using namespace std;
using ll = long long;
using ULL = unsigned long long;
using Pair = pair<ll, ll>;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (auto &v : a)
        cin >> v;
    
    ll minv = 2;
    ll maxv = 2;
    for (int i = a.size() - 1; i >= 0; i--) {
        cerr << minv << " " << maxv << endl;
        ll to = ceil(double(minv) / a[i]) * a[i];
        if (to > maxv) {
            cout << -1 << endl;
            return 0;
        }
        minv = to;
        maxv = floor(double(maxv) / a[i]) * a[i] + a[i] - 1;
    }
    
    cout << minv << " " << maxv << endl;
    
}



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


int main(){
    ll n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<int> s;            //訪れた頂点のメモ
    vector<int> ord(n+1, -1); //sの中のindex,　まだ訪れてなければ-1

    int c = 1, l = 0;
    {
        int v = 1;
        while(ord[v] == -1){
            ord[v] = s.size(); 
            s.push_back(v); //訪れた頂点
            v = a[v-1];     //遷移
        }
        c = s.size()- ord[v];
        l = ord[v];
    }
    if(k < l) cout << s[k] << endl;
    else {
        k -= l ;
        k %= c;
        cout << s[l+k] << endl;

    }

}

Measured memory_bytes: 5812
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4;
const int INF =0x3f3f3f;
int a[maxn];
int n,z,w,all;
void solve()
{
    if(n==1)
    {
        all=abs(a[1]-w);
        return;
    }
    else
    {
        int x=abs(a[n]-w);
        int y=abs(a[n-1]-a[n]);
        if(x>y)
        {
            all=x;
            return ;
        }
        else
        {
            all=y;
            return ;
        }
    }
}
int main()
{
    cin>>n>>z>>w;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    /*int pos=0;
    int cnt=1;
    while(pos<n)
    {
        int maxx=0;
        int minn=INF;
        for(int i=pos+1;i<=n;i++)
        {
            if(cnt%2==1&&abs(a[i]-w)>maxx)
            {
                maxx=abs(a[i]-w);
                pos=i;
                z=a[i];
                //cout << 1 << " " << pos << endl;
            }
            if(cnt%2==0&&abs(a[i]-z)<minn)
d                minn=abs(a[i]-z);
                pos=i;
                w=a[i];
                //cout << 2 << " " << pos << endl;
            }
        }
        cnt++;
    }*/
    solve();
    cout << all << endl;
    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n, i;
int main() {
    cin>>n>>i;
    cout<<n-i+1<<endl;
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
using namespace std;
int main(void){
    int a, b, c;
    cin>>a>>b>>c;
    c-=a-b;
    if(c<0) c=0;
    cout<<c<<endl;
}


Measured memory_bytes: 256
X,K,D = (abs(int(T)) for T in input().split())
if K<=(X//D):
    print(X-K*D)
else:
    Count = K-(X//D)
    if Count%2==0:
        print(X-(X//D)*D)
    else:
        print((X//D+1)*D-X)

Measured memory_bytes: 9188
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define int long long
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	cin >> N >> T;
	vector< pii > A(N);
	rep(i, N) cin >> A[i].first >> A[i].second;
	sort(A.begin(), A.end());
	vector< int > dp(10000, -1);
	dp[0] = 0;
	rep(i, N) {
		for (int j = dp.size() - 1; j >= 0; j--) {
			if (dp[j] != -1 && j < T && dp[j + A[i].first] < dp[j] + A[i].second) {
				dp[j + A[i].first] = dp[j] + A[i].second;
			}
		}
	}
	int ans = 0;
	rep(i, dp.size()) chmax(ans, dp[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#abc132b

n=int(raw_input())
p=map(int,raw_input().split())
cnt=0
for i in range(1,n-1):
 p1=p[i-1]
 p2=p[i]
 p3=p[i+1]
 if p1<p2<p3 or p1>p2>p3:
  cnt+=1
print cnt


Measured memory_bytes: 2568
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <sstream>
#include <iostream>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
using namespace std;
struct A{
    int a,b;
}a[100050];
bool cmp(A a, A b){
    if(a.b > b.b){
       return true;
    }else if(a.b == b.b && a.a > b.a){
        return true;
    }
    return false;
}
bool is[100050];
int bing[100050];
int main(){
    int n;
    int m;
    for(int i = 0; i < 100005; i ++){
        bing[i] = i;
    }
    s(n) s(m)
    for(int i = 0; i < n; i ++){
        s(a[i].a) s(a[i].b)
    }
    sort(a,a+n,cmp);
    re(is,false);
    ll sum = 0ll;
    for(int i = 0; i < n; i ++){
        for(int j = a[i].a; j <= m; j ++){
            if(is[j] == false){
                is[j] = true;
                sum += a[i].b;
                bing[a[i].a] = bing[j+1];
                break;
            }else{
                bing[j] = bing[j+1];
                j = bing[j];
                j --;
            }
        }
    }
    pld(sum) pn
    return 0;
}


Measured memory_bytes: 1536
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize, k: usize,
        mut p: [i32; n],  // Vec<(i32, i32, i32)>
    }
    p.sort();
    let mut itr = p.iter();
    let mut ans: i32 = 0;
    for _ in 0..k {
        ans += itr.next().unwrap();
    }
    println!("{}", ans);
}


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

using namespace std;

typedef pair<int, int> ii;

int main()
{
    int n;
    scanf("%d", &n);

    set<int> has;

    for (int i = 0; i < n; i++) {
        int num;
        scanf("%d", &num);

        if (has.find(num) != has.end())
            has.erase(num);
        else
            has.insert(num);
    }

    printf("%d\n", (int)has.size());

    return 0;
}

Measured memory_bytes: 4864
#!/usr/bin/env python3

# input
n, k = map(int, input().split())
d = [-1 for _ in range(k)]
A = [[] for _ in range(k)]
for i in range(k):
    d[i] = int(input())
    A[i] = list(map(int, input().split()))

# calc
okashi = [0 for _ in range(n)]
for i in range(k):
    for j in range(d[i]):
        okashi[A[i][j]-1] += 1
ans = 0 
for i in range(len(okashi)):
    if okashi[i] == 0:
        ans += 1
print(ans)


Measured memory_bytes: 9236
#include <cstdio>

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	int ans = (a + b) > (a * b) ? (a + b) : (a * b);
	ans = (ans > a - b) ? ans : a - b;
	printf("%d\n", ans);
	return 0;
}

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

#define pb push_back

vector <int> asd;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int z,x;
	cin>>z>>x;
	asd.pb(x);
	int a;
	for(int q=1;q<=z;q++)
	{
		cin>>a;
		asd.pb(a);
		
	}
	
	sort(asd.begin(),asd.end());
	int d;
	for(int q=1;q<asd.size();q++)
	{
		if(q==1)d=abs(asd[q]-asd[q-1]);
		else
		{
			int temp=abs(asd[q]-asd[q-1]);
			d=__gcd(d,temp);
		}
	}
	cout<<d<<endl;
}

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

cnt = [0] * (a[-1] + 1)
for i in range(n):
    cnt[a[i]] += 1

ans = 0
for i in range(1, a[-1] + 1):
    if cnt[i] > 0:
        if cnt[i] == 1:
            ans += 1
        for j in range(2, a[-1] + 1):
            na = i * j
            if na <= a[-1]:
                cnt[na] = 0
            else:
                break

print(ans)


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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  
  int count = 0;
  
  if (K <= A) {
    for (int i = 0; i < K; i++) {
      count += 1;
    }
    cout << count << endl;
  } else {
    for (int i = 0; i < A; i++) {
      count += 1;
      K -= 1;
    }
    if (K <= B) {
      cout << count << endl;
    } else {
      K -= B;
      if (K <= C) {
        count -= K;
        cout << count << endl;
      } else {
        for (int i = 0; i < K; i++) {
          count -= 1;
        }
        cout << count << endl;
      }       
    }
  }
}

Measured memory_bytes: 3624
#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define SORT(x) sort(ALL(x))
#define REVE(x) reverse(ALL(x))
#define MP make_pair
#define PB push_back
#define INF INT_MAX

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<bool>> VVB;
typedef pair<int, int> PII;
typedef queue<int> QI;
typedef long long LL;

int R, C, sy, sx, gy, gx, ans;
char maze[51][51];
QI qx, qy, qk;
bool visited[51][51];
int bx[] = { 1,0,-1,0 };
int by[] = { 0,1,0,-1 };

int main() {
	LL n, y, ans1 = -1, ans2 = -1, ans3 = -1;
	cin >> n >> y;
	for(LL i=0; i<n+1; i++){
		for(LL j=0; j<n+1; j++){
			if (i + j > n)break;
			LL k = n - i - j;
			if (10000 * i + 5000 * j + 1000 * k == y && i + j + k == n) {
				ans1 = i; ans2 = j; ans3 = k;
				break;
			}
		}
	}
	cout << ans1 << " " << ans2 << " " << ans3 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    stack<char> st;
    rep(i, n) {
        if (s[i] == '0' || s[i] == '1') st.push(s[i]);
        else if (st.empty())            continue;
        else                            st.pop();
    }
    vector<char> ans;
    while(!st.empty()) {
        ans.push_back(st.top());
        st.pop();
    }
    reverse(ans.begin(), ans.end());
    rep(i, (int)(ans.size())) {
        cout << ans[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;

int main(){
    int m,d;
    cin>>m>>d;
    int count = 0;
    for(int i=2;i<=9;++i){
        for(int j=2;j<=9;++j){
            if(i*10 + j <= d and i*j <= m)count++;
        }
    }
    cout << count << endl;
    return 0;
}



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

int main(){
  int A , B , C ,D ;
  cin >> A >> B >> C >> D ;
  
  if( A + B > C + D )
    cout << "Left" << endl;
  else if( A + B < C + D )
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

Measured memory_bytes: 256
N=int(input())
def fact(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
ans=0  
if N==1:
  print(0)
else:
  for i in range(len(fact(N))):
    j=1
    while fact(N)[i][1]>=j*(j+1)/2:
      j+=1
    ans+=(j-1)
  print(ans)

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

int main()
{
    int n,a,b;
    cin>>n>>a>>b;
    if(n*a<=b)
    {
		cout<<n*a;
		return 0;
    }
    else
    {
		cout<<b;
	    return 0;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
const ll mod = 1e9+7;
#define rep(i,a,b) for(ll i=a;i<b;i++)

void swap(ll &a , ll &b){
    ll t = a;
    a = b;
    b = t;
}

ll min(ll a, ll b){
    if(a<b)return a;
    return b;
}

ll max(ll a, ll b){
    if(a>b)return a;
    return b;
}

 ll pow(ll a, ll b) {
    a %= mod;
    ll ans = 1;
    while (b > 0) {
        if (b & 1)
            ans = ans * a % mod;
        a = a * a % mod;
        b /= 2;
    }
    return ans;
}


int main(){

  
   ios_base :: sync_with_stdio(0);
   cin.tie(0);
   ll n,k;
   cin>>n>>k;
   ll a[n];
   rep(i ,0 , n){
    cin>>a[i];
   }
    ll dp[k+1][2];
    memset(dp , 0 , sizeof(dp));
    for(int i = 1 ; i<=k;i++){
        for(int j = 1 ; j <= n;j++){
            if(a[j-1]<=i){
                if( dp[i-a[j-1]][1] == 0 ){
                    dp[i][0] = 1;
                }
                if( dp[i-a[j-1]][0] == 0 ){
                    dp[i][1] = 1;
                }

            }
        }
    }
    if(dp[k][0])cout<<"First";
    else
        cout<<"Second";

}


Measured memory_bytes: 1792
N, T = map(int, input().split())
i = 0
min_cost = 1000
fg = False
while i < N:
    i += 1
    c, t = map(int, input().split())
    if t <= T:
        if c <= min_cost:
            fg = True
            min_cost = c

if fg:
    print(min_cost)
else:
    print('TLE')

Measured memory_bytes: 3060
//============================================================================
// Name        : TopCoderCompetition.cpp
// Author      : taguchi
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <bitset>
#include <algorithm>
#include <map>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <numeric>
#include <list>
using namespace std;
//#define P pair<int,int>
#define rep(i,n) for(int i = 0;i<n;i++)
#define pb(n) push_back(n)
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
struct edge{int cost,to;};

vector<string> split(string &in,char delimiter){
	vector<string> re; uint cur = 0,next;
	while((next = in.find_first_of(delimiter,cur)) != string::npos){
		re.pb(string(in,cur,next-cur));
		cur = next + 1;
	}
	re.pb(string(in,cur,in.size()-cur));
	return re;
}
vector<int> split_int(string &in, char delimiter){
	vector<string> str = split(in,delimiter);
	vector<int> re;
	rep(i,str.size()){
		re.pb(strtol(str[i].c_str(),NULL,10));
	}
	return re;
}

class Range{
public:
	int a,b;
	Range(int an,int bn) : a(an),b(bn){}

	bool operator()(int n){
		return a<=n&&n<=b;
	}
	bool isCross(Range x){
		return x(a) || x(b);
	}
	bool contains(Range x){
		return this->a <= x.a && x.b <= this->b;
	}
};

class RangeHandler{
public:
	list<Range> Ranges;

	bool insert(Range x){
		if(Ranges.empty()){
			Ranges.push_back(x);
			return true;
		}

		if(x.b <= Ranges.front().a){
			Ranges.push_front(x);
			return true;
		}
		if(Ranges.back().b <= x.a){
			Ranges.push_back(x);
			return true;
		}
		for(list<Range>::iterator i = Ranges.begin();i != Ranges.end();i++){
			list<Range>::iterator l = i;
			l++;
			//cout << "dbg" << i->b << " " << i->a << endl;
			if(Range(i->b,l->a).contains(x)){
				Ranges.insert(l,x);
				return true;
			}
		}
		return false;
	}
};
int N,P;
int main(){
	while(true){
		int result = 0;
		cin >> N;
		if(N == 0)break;
		vector<pair<int,string> > Programs,Table;
		vector<pair<int,string> >::iterator ip;
		rep(i,N){
			string name;
			cin >> name;
			int weekday,start;
			cin >> weekday >> start;
			start -=600;
			int time = 1440 * weekday + (start / 100) * 60 + (start % 100);
			Programs.pb(make_pair(time,name));
		}
		cin >> P;
		rep(i,P){
			string name;
			cin >> name;
			for(ip = Programs.begin();ip!=Programs.end();ip++){
				if(ip->second == name){
					Table.pb(*ip);
					Programs.erase(ip);
					break;
				}
			}
		}
		sort(Programs.begin(),Programs.end());
		rep(i,Programs.size()){
			Table.pb(Programs[i]);
		}
		RangeHandler rg;
		bool ans = true;
		rep(i,Table.size()){
			if(rg.insert(Range(Table[i].first,Table[i].first+30))){
				ans &= true;
				result++;
			}
			else ans = false;
			if(i < P && !ans) {
				result = -1;
				break;
			}
		}
		cout << result << endl;
	}
	return 0;
}

Measured memory_bytes: 976
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define max 100005
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    char s[3];
    cin>>s;
    rep(i,3){
        if(s[i]=='7'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3516
n, m = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i).sort
arr = []
m.times do
    arr << gets.chomp.split(" ").map(&:to_i)
end
arr = arr.sort_by(&:last).reverse
x = 0
a.each_with_index do |e, i|
    if e <= arr[x][1]
        a[i] = arr[x][1]
        arr[x][0] -= 1
        x += 1 if arr[x][0] == 0
        break if x >= m
    end
end
puts a.inject(:+)

Measured memory_bytes: 20984
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int n,p;
    cin >> n >> p;
    string str;
    cin >> str;
    reverse(str.begin(), str.end());
    vector<int> a(n), s(n+1);
    ll ans = 0;
    if(p==2 || p==5) {
        rep(i,n) {
            if((str[i]-'0')%p == 0) ans+=n-i;
        }
    } else {
        int pow_10_mod = 1;
        s[0] = 0;
        rep(i, n) {
            a[i] = ((str[i]-'0')*pow_10_mod)%p;
            s[i+1] = (s[i] + a[i])%p;
            pow_10_mod = (pow_10_mod*10)%p;
        }
        vector<ll> cnt(p);
        rep(i,n+1) {
            ans += cnt[s[i]];
            cnt[s[i]]++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2196
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sn = new Scanner(System.in);
		String HW = sn.nextLine();
		long H = Integer.valueOf(HW.split(" ")[0]);
		long W = Integer.valueOf(HW.split(" ")[1]);
		sn.close();
		long D = 0;


		if((H == 1) || (W == 1)){
			D = 1;
		}else {
			if((H % 2 == 1) && (W % 2 == 1)) {
				D = H * W / 2 + 1;
			}else {
				D = H * W / 2;
			}
		}

		System.out.println(D);

	}

}

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


int main(){
  int N;
  cin >> N;
  vector<vector<int>> A(N, vector<int>(2));
  for(auto& a : A){
    cin >> a[0] >> a[1];
  }

  sort(A.begin(), A.end(), [](const vector<int>& a, const vector<int>& b){
    return a[1] < b[1];
  });

  long long int total = 0;
  for(auto& a : A){
    total += a[0];
    if(a[1] < total){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)

using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n + 1];
    rep (i, n) {
        int v;
        cin >> v;
        a[v] = i;
    }
    int ans = n;
    int cnt = 0;
    REP (i, 1, n + 1) {
        if (cnt == 0) cnt++;
        else {
            if (a[i - 1] > a[i]) {
                ans = min(ans, n - cnt);
                cnt = 0;
                i--;
            } else {
                cnt++;
            }
        }
    }
    ans = min(ans, n - cnt);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import fractions

tmp = list(map(int, input().split()))
a = tmp[0]
b = tmp[1]
c = tmp[2]
d = tmp[3]

divc = b // c - (a-1) // c
divd = b // d - (a-1) // d

lcmcd = c * d // fractions.gcd(c,d)
divcd = b // lcmcd - (a-1) // lcmcd

print(b - a + 1 - divc - divd + divcd)

Measured memory_bytes: 65004
import sys
from collections import deque
def m():
 s=sys.stdin.readlines()
 q=int(s[0].split()[1])
 f=lambda x,y:(x,int(y))
 d=deque(f(*e.split())for e in s[1:])
 t,a=0,[]
 while d:
  k,v=d.popleft()
  if v>q:v-=q;t+=q;d.append([k,v])
  else:t+=v;a+=[f'{k} {t}']
 print('\n'.join(a))
if'__main__'==__name__:m()


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

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	int h, w;
	string t[105];
	cin >> h >> w;
	rep(i, h) cin >> t[i];

	int a[105] ={0}, b[105]={0};
	rep(i, h){
		rep(j,w){
			if(t[i][j] == '#') continue;
			a[i]++;
		}
	}

	rep(i, w){
		rep(j, h){
			if(t[j][i] == '#') continue;
			b[i]++;
		}
	}

	rep(i, h){
		if(a[i] == w) continue;
		rep(j, w){
			if(b[j] == h) continue;
			cout << t[i][j];
		}
		cout << endl;
	}
}

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

using lint = long long;

int main() {
    int n;
    cin >> n;
    vector<lint> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    lint x = 0;
    int pos = 0;
    vector<lint> b(n + 1, -1);
    int i = 0;
    while (i < n) {
        if ((x^a[i + 1]) == x + a[i + 1]) {
            x += a[i + 1];
            i++;
        } else {
            while ((x^a[i + 1]) != x + a[i + 1]) {
                x ^= a[pos];
                b[pos] = i;
                pos++;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        if (b[i] == -1) {
            b[i] = n;
        }
    }
    lint ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += b[i] - i + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
const string YES = "Yes";
const string NO = "No";

bool isPalindrome(string s) {
	int n = s.length();
	for (int i=0; i<n/2; i++) {
		if (s[i] != s[n - 1 - i]) {
			return false;
		}
	}
	for (int i=0; i<n/4; i++) {
		if (s[i] != s[n/2 - 1 - i]) {
			return false;
		}
	}
	return true;
}

int main() {
	string s;
	cin >> s;
	cout << (isPalindrome(s) ? YES : NO) << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main(){
   string S,O;
   cin>>S>>O;
   for(int i=0;i<S.size();i++){
       if(S.size()>O.size()&&i==S.size()-1)
       cout<<S[i];
       else{
           cout<<S[i];
           cout<<O[i];       
       }
       
   }
    cout<<endl;
 }

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        r: u32,
        g: u32,
        b: u32,
    }
    if (100*r + 10*g + b) % 4 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int modulo(int x,int N){
    return (x % N + N) %N;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s; int ans=0;
    cin>>s;
    for(int i=0;i<s.size()-1;++i)
    {
        if(s[i]==s[i+1])
        {
            s[i+1] = s[i+1]=='0'? '1' : '0';
            ans++;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 512
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    s = list(_ for _ in input())
    cnt =0
    for s_i in s:
        if s_i == '+':
            cnt+=1
        else:
            cnt+=-1
    print(cnt)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define INF 1000000000000000000
#define all(x) x.begin(), x.end()

int main() {
    string N;
    cin >> N;
    if (N[0] == '7' || N[1] == '7' || N[2] == '7')
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repA(a,i,n) for(int i=a;i<n;i++)
#define trav(a,x)for(auto &a: x)
#define fll(a) memset(a,-1,sizeof(a));
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define itr(it,x) for(auto it=x.begin();it!=x.end();it++)
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
typedef vector<int>vi;
typedef map<int,int>ma;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
void fopen()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);   
}
int main()
{

 //   fopen();
    fastio;
    int a,b,c;
    cin>>a>>b>>c;
    vi v;
    v.pb(a);
    v.pb(b);
    v.pb(c);
    sort(v.begin(),v.end());
    if((v[0]==v[1] && v[1]!=v[2]) || (v[0]!=v[1]&& v[1]==v[2])) 
    {cout<<"Yes";return 0;}
    cout<<"No";
    return 0;   
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main()
{
  long long a, b, c;
  long long max_value;
  long long result;
  int k;

  scanf("%lld%lld%lld", &a, &b, &c);
  scanf("%d", &k);
  max_value = max(max(a, b), c);
  result = a + b + c - max_value;
  for(int i = 0; i < k; i++) {
    max_value = 2 * max_value;
  }
  result += max_value;
  printf("%lld\n", result);
  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> cnt(n,0);
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        cnt[a-1]++;
        cnt[b-1]++;
    }
    for(int i=0;i<n;i++){
        cout << cnt[i] << endl;
    }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();

        int max = -1;
        for (int i = 1; i <= s.length() - 1; i++) {
            String x = s.substring(0, i);
            String y = s.substring(i, s.length());

            int xs[] = new int[26];
            int ys[] = new int[26];
            Arrays.fill(xs, 0);
            Arrays.fill(ys, 0);
            for (int j = 0; j < x.length(); j++) {
                xs[x.charAt(j) - 'a'] = 1;
            }
            for (int j = 0; j < y.length(); j++) {
                ys[y.charAt(j) - 'a'] = 1;
            }

            int total = 0;
            for (int j = 0; j < 26; j++) {
                if (xs[j] == 1 & ys[j] == 1) {
                    total++;
                }
            }

            max = Math.max(total, max);
        }

        System.out.println(max);
    }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#define local
#ifdef local
    #include "dbg-macro/dbg.h"
#endif
//#define hacks
#ifdef hacks
    #include <boost/multiprecision/cpp_int.hpp>
#endif
#define p std::pair
#define ll long long
#define ld long double
#define ull unsigned long long
#define pi std::pair<int, int>
#define stdabs std::abs
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
#define vec std::vector
#define oreq |=
#define npm next_permutation
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
ll extgcd(ll a, ll b, ll& x, ll& y);
ll nCr(ll n, ll r);
void stat();
template <typename T> T fact(T num);
constexpr ll mod = 1000000000 + 7;
int main()
{
    stat();
    ll n, k;
    cin >> n >> k;
    vec<ll> v(n);
    rep(i, n) { cin >> v[i]; }
    vec< double> kitai(n);
    rep(i, n) { kitai[i] = (double)((v[i]+1.0) / 2.0); }
#ifdef local
dbg(kitai);
#endif
    double ans = 0.0, t=0.0;
    rep(i, k) { t += kitai[i]; }
    ans=t;
#ifdef local 
    dbg(ans);

#endif
    rep(i, n - k + 1)
    {
        if (i == 0) { continue; }
        t = (double)(t+ kitai[i + k-1] - kitai[i - 1]);
#ifdef local 
	dbg(t);
	dbg(i,kitai[i+k-1],kitai[i-1]);

#endif
        ans = max(ans, t);
    }
    cout <<std::fixed<<std::setprecision(10)<< ans << endl;
    return 0;
}
ll extgcd(ll a, ll b, ll& x, ll& y)
{
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) {
        is_prime[i] = true;
    }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++) {
        if (is_prime[i]) {
            for (unsigned ll j = 2 * i; j <= N; j += i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

void stat(){
#ifdef local
    rep(i, 2){std::cout << "local enable" << std::endl;
}
#endif
#ifdef hacks
rep(i, 2) { std::cout << "boost enable" << std::endl; }
#endif
}

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

template <typename T> T fact(T num)
{
    if (num == 1) { return 1; }
    return num * fact(num - 1);
}


Measured memory_bytes: 6292
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int k,n,a[200005],ans;
int main()
{
	scanf("%d%d",&k,&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	ans=a[1]+k-a[n];
	for(int i=1;i<n;i++)ans=max(ans,a[i+1]-a[i]);
	printf("%d\n",k-ans);
	return 0;
}

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

int main(){
  int A,B; cin>>A>>B;
  if(A>=13){
    cout<<B<<endl;
  }else if(A>=6){
    cout<<B/2<<endl;
  }else cout<<0<<endl;

  return 0;
}


Measured memory_bytes: 256
function Main(input) {
	input = input.split(" ");
        var len1=input[0].length, len2=input[1].length;
	if(input[0][len1-1] == input[1][0] && input[1][len2-1] == input[2][0])
          console.log('YES');
        else
          console.log('NO');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	int A,B,X;
	cin>>A>>B>>X;
	if(A<=X&&X<=A+B)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
reachnum = [0 for _ in range(n)]
u = 0
while 2**u < k:
    u += 1
reachnum[0] = u
sum = 1/(2**u)
for i in range(1,n):
    if (i+1) * (2 ** (reachnum[i-1] - 1)) >= k and reachnum[i-1] > 0:
        reachnum[i] = reachnum[i-1] -1
    else:
        reachnum[i] = reachnum[i-1]
    sum += 1/(2 ** reachnum[i])
print(sum/n)

Measured memory_bytes: 45552