akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class BCraneAndTurtle {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        int X, Y;
        in>>X>>Y;
        REP(i, X+1){
            if(2*i+4*(X-i)==Y){
                out<<"Yes\n";
                return;
            }
        }
        out<<"No\n";
    }
};


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


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 300006
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 998244353
#define PI acos(-1.0)
#define eps 1e-9

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    ll a, b, k;
    cin>>a>>b>>k;
    ll t = min(a, k);
    a = max(0LL, a - t);
    k = max(0LL, k - t);
    b = max(0LL, b-k);
    cout<<a<<" "<<b<<endl;

    //End();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
        #define ll  long long
        #define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
        #define rep(i,a,b)  for(ll i=a;i<b;i++)
        #define pb push_back
        #define Max(x,y,z) max(x,max(y,z))
        #define f first
        #define s second
        #define lbd lower_bound
        #define sz(x)       (ll)x.size()
        #define pi 3.1415926536
        #define mod 1000000007
        #define MOD 998244353
        using namespace std;
        const int N=100000;
        void solve()
        {
            ll n,m,k,res=0,l=0,r=0,z,sum1=0,cnt1=0,h,res1,a,b,c,d,x,y;
            ll W;
            cin>>n>>W;
            vector<pair<ll,ll>> v(n);
            rep(i,0,n)
                cin>>v[i].f>>v[i].s;
            ll cnt[2][W+1];
            rep(i,0,n+1)
            {
                rep(w,0,W+1)
                {
                    if(i==0 || w==0) cnt[i%2][w]=0;
                    else if(v[i-1].f<=w)
                        cnt[i%2][w]=max((cnt[(i+1)%2][w-v[i-1].f]+v[i-1].s),cnt[(i+1)%2][w]);
                    else
                        cnt[i%2][w]=cnt[(i+1)%2][w];
                    //cout<<cnt[i][w]<<" ";
                }
                //cout<<"\n";
            }
            if(n%2==0) cout<<cnt[0][W];
            else cout<<cnt[1][W];     
            
        
     
    }
        int main()
        {   
           /* #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
            #endif*/
     
            speed_up
            ll t;
            //cin>>t;
            t=1;
            while(t--)
                solve();
        }

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<string>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int a;
	while (cin >> a, a) {
		for (int k = 0; k < a; k++) {
			int b[4], c[4]; cin >> b[0] >> b[1] >> b[2] >> b[3] >> c[0] >> c[1] >> c[2] >> c[3];
			printf("%d %d %d %d\n", b[0] * c[0] - b[1] * c[1] - b[2] * c[2] - b[3] * c[3],b[0]*c[1]+b[1]*c[0]+b[2]*c[3]-b[3]*c[2],b[0]*c[2]+b[2]*c[0]+b[3]*c[1]-b[1]*c[3],b[0]*c[3]+b[1]*c[2]+b[3]*c[0]-b[2]*c[1]);
		}
	}
}

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

  //mp.reserve(1024);
  //mp.max_load_factor(0.25);
int main() 
{ 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll a,b;
	cin>>a>>b;
	if(a>b){
			while(a--)
				cout<<b;
	}
	else
		while(b--)
		cout<<a;
		cout<<endl;
    return 0; 
} 


Measured memory_bytes: 256
# -*- coding: utf-8 -*-


from sys import stdin



############################################
def Combination(n,r):
    tmp_list = []
    for cmb in cmb_list:
        tmp_list.append(cmb)
    for first_data in data_list:
        for second_data in tmp_list:
            split_tmp_list = second_data.split(",")
            obj_list = []
            for split_data in split_tmp_list:
                obj_list.append(split_data)
            if obj_list.count(first_data) == 0:
                obj_list.append(first_data)
                join_data = ",".join(sorted(obj_list))
                if join_data not in cmb_list:
                    cmb_list.append(join_data)
    if r > 2:
        Combination(n,r-1)
    return(cmb_list)

def cal_time(cmb):
    time = 0
    for num,i in enumerate(cmb):
        time += i
#        print(time)
        if time%10!=0 and num!=4:
            time += 10 - time % 10
#        print(time)
    return time
    
# read data for n sequences.
input=[]
for _ in range(5):
    input.append(int(stdin.readline().split()[0]))

cmb_list = []

import itertools
cmb = list(itertools.permutations(input))


prev = 10e6
for x in cmb:
    t = cal_time(x)
#    print(x)
    prev = min(t, prev)
print(prev)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define For(i, a) for (int i=0; i<(a); i++)
#define FORR(i,a,b) for (int i = (b)-1; i >= a; i--)
#define Forr(i,a) for (int i = (a)-1; i >= 0; i--)

#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__) 
void DBG() { cerr << "]\n";}
template<typename T, typename ...Args> void DBG(T first, Args... args){
cerr << first; if(sizeof...(args))cerr<<", "; DBG(args...); }

#define int ll
#define pb(x) push_back(x)
#define INF (int)1e17
#define PI 3.14159265358979323846
 
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};


void solve(){
	int n; cin >> n;
	int a[n];
	For(i,n)cin >> a[i];
	int cnt=0;
	FOR(i,1,n){
		if(a[i]<a[i-1]){
			cnt += a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout << cnt <<"\n";
}

int32_t main(){ 
	#ifndef ONLINE_JUDGE
		clock_t tStart = clock();
		//freopen("in.txt", "r", stdin);
	#endif
	ios_base:: sync_with_stdio(false); 
	cin.tie(0); 
	int t=1;
	//cin >> t;
	for(int tt=1;tt<=t;tt++){
		//cout << "Case #"<<tt<<": ";
		solve();
	}
	#ifndef ONLINE_JUDGE
    cerr << "\nRun Time -> "<<(double)(clock()-tStart)/CLOCKS_PER_SEC <<" sec\n";
  #endif
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}


int main(){

    string sa, sb, sc; cin >> sa >> sb >> sc;

    ll ai=0, bi=0, ci=0;
    char c = sa[ai];
    ai++;

    char ans;
    while(1){
        if(c=='a'){
            if(ai>=sa.size()){
                ans = 'A';
                break;
            }
            c = sa[ai];
            ai++;
        }
        else if(c=='b'){
            if(bi>=sb.size()){
                ans = 'B';
                break;
            }
            c = sb[bi];
            bi++;
        }
        else if(c=='c'){
            if(ci>=sc.size()){
                ans = 'C';
                break;
            }
            c = sc[ci];
            ci++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <string>

using namespace std;

string board[60];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main(void)
{
    int X, Y;
    cin >> X >> Y;
    for (int i = 0; i < X; i++)
        cin >> board[i];

    for (int i = 0; i < X; i++)
    {
        for (int j = 0; j < Y; j++)
        {
            if (board[i][j] == '#')
            {
                bool paint = false;
                for (int k = 0; k < 4; k++)
                {
                    int x = i + dx[k];
                    int y = j + dy[k];
                    if (x >= 0 && x < X && y >= 0 && y < Y && board[x][y] == '#')
                    {
                        paint = true;
                    }
                }
                if (!paint)
                {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}

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

char s;
int a = 0;
int b = 0;

int main(void) {
	for (int i = 0; i < 3; i++) {
		cin >> s;
		if (s == 'A') a++;
		else if (s == 'B') b++;
	}

	if (a != 0 && b != 0)
		cout << "Yes";
	else
		cout << "No";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
int a[10005];
int32_t main() {
	int i,n,k;
	cin>>n>>k;
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	int c=0;
	for(i=0;i<n-1;i++)
	{
		if(k>=a[i])
		{
			c++;k-=a[i];
		}
		else break;
	}
	if(i==n-1 && a[n-1]==k)
		c++;
	cout<<c;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{
    public static void Main()
    {
        String[] input = Console.ReadLine().Split();
        long N = long.Parse(input[0]);
        long M = long.Parse(input[1]);
        long X = long.Parse(input[2]);
        long[] C = new long[N];
        long[,] A = new long[N, M];
        for(int i = 0; i < N; i++)
        {
            input = Console.ReadLine().Split();
            C[i] = long.Parse(input[0]);
            for(int j = 0; j < M; j++)
            {
                A[i, j] = long.Parse(input[j + 1]);
            }
        }
        long[] temp = new long[N+1];
        for(int i = 0; i < N; i++) { temp[i] = 0; }
        temp[0] = 1;
        long ans = long.MaxValue;
        for (int x = 0; x < Math.Pow(2, N); x++)
        {
            long money = 0;
            long[] score = new long[M];
            for (int i = 0; i < N; i++)
            {
                if (temp[i] == 1) { money += C[i];
                    for(int j = 0; j < M; j++)
                    {
                        score[j] += A[i, j];
                    }
                }
            }
            bool flag = true;
            for(int j = 0; j < M; j++)
            {
                if (score[j] < X) flag = false;
            }
            if (flag) { ans = Math.Min(ans, money); }
            for (int i = 0; i < N; i++)
            {
                if (i == 0)
                {
                    if (temp[i] == 0) { temp[i] = 1; }
                    else if (temp[i] == 1) { temp[0] = 0; temp[1] += 1; }
                }
                else
                {
                    if (temp[i] == 0) { temp[i] = 0; }
                    else if (temp[i] == 1) { temp[i] = 1; }
                    else if (temp[i] == 2) { temp[i] = 0; temp[i + 1] += 1; }
                }
            }
        }
        if (ans != long.MaxValue) { Console.WriteLine(ans); }
        else { Console.WriteLine(-1); }
    }
}

Measured memory_bytes: 28176
N = int(input())
a = []
visited = []
place = 1
for i in range(N):
    a.append(int(input()))
for i in range(N):
    visited.append(place)
    place = a[place - 1]
if 2 in visited:
    print(visited.index(2))
else:
    print(-1)

Measured memory_bytes: 7864
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N, K; cin >> N >> K;
  vector<int> snuke(N, 0);
  for(int i = 0; i < K; i++) {
    int d; cin >> d;
    for(int j = 0; j < d; j++) {
      int A; cin >> A;
      A--; snuke.at(A)++;
    }
  }
  int cnt = 0;
  for(int i = 0; i < N; i++) {
    if(snuke.at(i) == 0) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const int N = 17;
int n, a[N][N];
long long f[1<<N],dp[1<<N];
int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)scanf("%d",&a[i][j]);
	for(int i=1;i<1<<n;i++){
		for(int j=0;j<n;j++){
			if(i>>j&1){
				f[i]=f[i^(1<<j)];
				for(int k=0;k<n;k++) if(i>>k&1) f[i]+=a[j][k];
			}
		}
	}
	for(int i=1;i<1<<n;i++){
		for(int j=i;j;j=(j-1)&i){
			dp[i]=max(dp[i],dp[i^j]+f[j]);
		}
	}
	cout<<dp[(1<<n)-1]<<endl;
}

Measured memory_bytes: 1280
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int n, a;
	cin >> n >> a;
	cout << n * n - a << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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();
        System.out.println(Math.min(a+c,Math.min(a+b, b+c)));
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("atcoder-problems/abc051_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  rep(i, tx - sx) printf("R");
  rep(i, ty - sy) printf("U");
  rep(i, tx - sx) printf("L");
  rep(i, ty - sy) printf("D");
  printf("D");
  rep(i, tx - sx + 1) printf("R");
  rep(i, ty - sy + 1) printf("U");
  printf("L");
  printf("U");
  rep(i, tx - sx + 1) printf("L");
  rep(i, ty - sy + 1) printf("D");
  printf("R");
}

Measured memory_bytes: 892
#include<iostream>
#include<math.h>
#include<iomanip>
#define Pi 3.14159265358979
using namespace std;
int main(){
    double a,b,c,alpha;
    cin >> a >> b >> alpha;
    double val=Pi*alpha/180;
    c = sqrt(a*a + b*b -2*a *b *cos(val));  
    double s=  a* b* sin(val)/2,h=2*s/a,l=a+b+c;
    cout << fixed;
    cout << setprecision(8) << s << endl << l << endl << h << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <cstdint>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a > b) swap(a, b);
	// a-k = k-b
	// a+b = 2*k
	if ((a + b) % 2 == 0) {
		cout << (a + b) / 2 << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;



signed main()
{
    string X;
    cin >> X;

    stack<char> sta;
    REP(i,X.length()) {
        char c = X[i];
        if (c == 'S') {
            sta.push(c);
        } else if (c == 'T') {
            if (!sta.empty() && sta.top() == 'S') {
                sta.pop();
            } else {
                sta.push(c);
            }
        }
    }

    cout << sta.size() << endl;
}


Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    vector<string> s(n);
    map<string, int> d; 
    for(int i=0; i<n; ++i){cin >> s[i]; d[s[i]]++;}
    int cnt = 0;
    for(auto i=d.begin(); i!=d.end(); ++i){
        cnt = max((i->second), cnt);
    }
    for(auto i=d.begin(); i!=d.end(); ++i){
        if((i->second!=cnt)){continue;}
        cout << i->first << endl;
    }
    return 0;
}

Measured memory_bytes: 25104
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;

const int N = 100 * 1000 + 5;

vector <int> graph[N];
int vertices[N];
int dist[N];
int color[N];
int dp[N][12];

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) 
	{
		int u, v;
		cin >> u >> v;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	int q;
	cin >> q;
	for (int i = 1; i <= q; i++) 
	{
		cin >> vertices[i] >> dist[i] >> color[i];
		dp[vertices[i]][dist[i]] = max(dp[vertices[i]][dist[i]], i);
	}
	for (int j = 9; j >= 0; j--) 
	{
		for (int i = 1; i <= n; i++) 
		{
			dp[i][j] = max(dp[i][j + 1], dp[i][j]);
			for (int k = 0; k < graph[i].size(); k++) 
			{
				int u = graph[i][k];
				dp[i][j] = max(dp[i][j], dp[u][j + 1]);
			}
		}
	}
	for (int i = 1; i <= n; i++) 
	{
		cout << color[dp[i][0]] << endl;
	}
}


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


int main (){
    int a, b, c;
    string s, t;
    cin>>s>>t;
    a=0;
    for(int i=0; i<3; i++){
        if(s.at(i)==t.at(i)){
            a ++;
        }
    }
    cout<<a<<endl;
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
X=int(input())

s=0

for i in range(0,min(X//500,A)+1):
  Xi=X-i*500
  for j in range(0,min(Xi//100,B)+1):
    Xj=Xi-j*100
    if Xj<= C*50:
      s=s+1

print(s)

Measured memory_bytes: 3060
n , l = list(map(int, input().split()))

apple_tastes = list()

for num in range(n):
    apple_taste = l + num
    apple_tastes.append(apple_taste)

max_taste = max(apple_tastes)
min_taste = min(apple_tastes)

if max_taste > 0 and min_taste < 0:
    apple_tastes.remove(0)
elif max_taste > 0 and min_taste > 0:
    apple_tastes.remove(min_taste)
elif max_taste < 0 and min_taste < 0:
    apple_tastes.remove(max_taste)
    
ans = sum(apple_tastes)
print(ans)

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

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  int mn=a[0];
  int cnt=0;
  rep(i,n){
    mn=min(mn,a[i]);
    if(mn==a[i])cnt++;
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 1024
x,n=map(int,input().split())
l=list(map(int,input().split()))
loop = True
j = 0
while loop:
    if x-j not in l:
        loop = False
        print(x-j)
        break
    elif x+j not in l:
        loop = False
        print(x+j)
    j+=1

Measured memory_bytes: 61880
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef pair<int, int> pii;
typedef pair<string, int> P;
typedef long long ll;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};
ll com[100][100];

void initcom(){
    com[0][0]=1;
    for(int i=1;i<100;++i){
        for(int j=0;j<=i;++j){
            if(j==0||j==i) com[i][j]=1;
            else com[i][j]=com[i-1][j-1]+com[i-1][j];
        }
    }
}

int main(){
    initcom();
    int n,a,b;cin>>n>>a>>b;
    vector<ll> v(n);
    for(int i=0;i<n;++i) cin>>v[i];
    sort(v.begin(),v.end(),greater<ll>());
    double avg=0;
    map<ll,int> cntv,cntavg;
    for(int i=0;i<n;++i){
        if(i<a){
            avg+=v[i];
            cntavg[v[i]]++;
        }
        cntv[v[i]]++;
    }
    avg/=(double)a;
    printf("%.14f\n",avg);
    if((int)cntavg.size()==1){
        b=min(b,cntv[v[0]]);
        ll ans=0;
        for(int i=a;i<=b;++i){
            ans+=com[cntv[v[0]]][i];
        }
        cout<<ans<<endl;
        return 0;
    }
    ll ans=1;
    for(auto it:cntavg){
        ans*=com[cntv[it.first]][it.second];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};

int gcm(int a, int b) { return b ? gcm(b, a % b) : a;}

int main() {
    int k, a, b;
    cin >> k;
    int ans = 0;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            a = gcm(i,j);
            for(int s = 1; s <= k; s++) {
                b = gcm(a,s);
                ans += b;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    ll k, t; cin >> k >> t;
    ll a[110];
    ll ans = 0;
    rep(i,0,t) {
        cin >> a[i];
    }
    if(t == 1) {
        cout << a[0] - 1 << endl;
        return 0;
    }

    ll ss = (k - 1) / 2 + 1;
    rep(i,0,t) {
        if(a[i] > ss) ans = max((ll)0, a[i] - (k - a[i] + 1));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 128
char s[N][N];
int a[N][N] = {};

int main(){
	int h, w; scanf("%d%d", &h, &w);
	REP(i, N) REP(j, N) a[i][j] = INT_MAX;
	REP(i, h) scanf("%s", s[i]);
	a[0][0] = s[0][0] == '#' ? 1 : 0;
	REP(i, h){
		REP(j, w){
			if(i){
				int tmp = a[i-1][j];
				if(s[i-1][j] != s[i][j]) tmp++;
				SML(a[i][j], tmp);
			}
			if(j){
				int tmp = a[i][j-1];
				if(s[i][j-1] != s[i][j]) tmp++;
				SML(a[i][j], tmp);
			}
			DEBUG("%d ", a[i][j]);
		}
		DEBUG("\n");
	}
	int ans = a[h-1][w-1];
	if(s[h-1][w-1] == '#') ans++;
	printf("%d\n", ans/2);
}


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

bool search (int a[],int l,int n){
    for(int i=0;i<l;i++){
        if(a[i]==n){
            // cout<<a[i];
            return true;
        }
    }
    return false;
}
int main() {
	// your code goes here
	int x,y;
	int m=1;
	cin>>x>>y;
	int a[y];
	for(int i=0;i<y;i++){
	    cin>>a[i];
	}
	if(y==0){
	    cout<<x;
	}
	else if(!search(a,y,x)){
	    cout<<x;
	}
	else{
	    bool q=search(a,y,x-m);
    	bool r=search(a,y,x+m);
	    while(q && r){
	        m++;
	        q=search(a,y,x-m);
    	    r=search(a,y,x+m);
	    }
	    if(!q){
	        cout<<x-m;
	    }else{
	        cout<<x+m;
	    }
	}
	return 0;
}


Measured memory_bytes: 3620
n = int(input())
ar = [int(x) for x in input().split()]
n_odd = 0
n_even = 0

for a in ar:
  if a % 2 == 1:
    n_odd += 1
  else:
    n_even += 1

if n_odd > 1:
  n_even += n_odd // 2
  n_odd %= 2

if n_even > 1:
  n_even = 1

if n_even + n_odd == 1:
  print("YES")
else:
  print("NO")


Measured memory_bytes: 14108
s = input()
s = list(s)

ans = []

for i in range(len(s)):
  tmp = s[0:len(s)-(i+1)]
  #print(tmp[0:int(len(tmp)/2)],tmp[int(len(tmp)/2):len(tmp)])
  if tmp[0:int(len(tmp)/2)] == tmp[int(len(tmp)/2):len(tmp)] and len(tmp)%2 == 0:
    ans.append(len(tmp))
    
print(max(ans))

Measured memory_bytes: 61804
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 2147483647;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[2000005], finv[2000005], inv[2000005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

double len(int a, int b, int c, int d) {
	return (double)sqrt((a - c) * (a - c) + (b - d) * (b - d));
}


void COMinit() {
	fac[0] = 1, fac[1] = 1, finv[0] = 1, finv[1] = 1, inv[1] = 1;
	for (int i = 2; i < 2000005; ++i) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

//calc
long long COM(long long n, long long k) {
	if (n < k) { return 0; }
	if (n < 0 || k < 0) { return 0; }
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	ll a, b;
	cin >> a >> b;
	if ((a + b) % 3 != 0) { cout << 0 << endl; return 0; }
	COMinit();
	cout << COM((2 * a - b) / 3 + (2 * b - a) / 3, (2 * b - a) / 3) % MOD << endl;
}

Measured memory_bytes: 47104
//suhan lee,saitama university

#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <complex>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define repn(i,n) for(int i=0;i<n;i++)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
#define pb push_back 
#define pf push_front

int main(){

  ll k,a,b;
  ll l,n;
  ll i;
  int ans;

  char tmp[120];
  while(1){ 
    cin>>n>>k; 
    if(n==0&&k==0) 
      return 0;
    l=n;
    for(i=1;l>0;i++){
      l-=9*((ll)pow(10,i-1))*i;
      //      cout <<"i"<<i<<endl;
    }
    i--;
    l+=9*((ll)pow(10,i-1))*i;
    //i++;
    a=l/i;
    b=l%i;
    string ansc;
    ans=(int)pow(10,i-1)+a;
    tmp[0]=(ans-1)%10+'0';
    tmp[1]=0;
    //cout<<"a,b"<<a<< " "<<b<<endl;
    for(int j=0;j<100;j++){    
      ansc+=tmp;
      //      cout<<"ans:"<<ans<<endl;
      sprintf(tmp,"%d",ans++);
    }
    for(int j=b;j<k+b;j++){
      cout<<ansc[j];

    }
    cout <<endl;
  }
  return 0;
}

Measured memory_bytes: 1276
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        int ret = 0;
        for(int i=1; i<n; ++i){
            int sum = 0;
            for(int j=i; ; ++j){
                sum += j;
                if(sum == n)
                    ++ ret;
                if(sum >= n)
                    break;
            }
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <cfloat>
#define zero(x) (((x)>0?(x):-(x))<eps)

#define pause cout << " press ansy key to continue...",  cin >> chh
#define file_r(x) freopen(x,  "r",  stdin)
#define file_w(x) freopen(x,  "w",  stdout)
#define lowbit(x) ((x) & (-x))
#define repit(i, c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, u) for (int i = head[u]; i != -1; i = nxt[i])
#define repd(i, n) for (int i = (n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = (n); i <= (m); i++)
#define FORD(i, n, m) for (int i = (n); i >= (m); i--)
#define pb push_back
#define X first
#define Y second
#define ins insert
#define rb rbegin
#define be begin
#define er erase
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(c) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define sqr(r) ((r) * (r))
#define dis(x1, y1, x2, y2) (((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
#define FASTIO ios::sync_with_stdio(false);cin.tie(0)

#define sc(x) cout << #x" = " << x << endl, system("pause")
#define sc2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl, system("pause")
#define sc3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl, system("pause")
#define sc4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl, system("pause")

#define in(n) scanf("%d", &n)
#define in2(n, m) scanf("%d %d", &n, &m)
#define in3(x, y, z) scanf("%d %d %d", &x, &y, &z)

using namespace std;
int chh;

typedef vector<int> vi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<int, pii> pi3;
typedef vector< pair<int, int> > vpii;
typedef long long LL;

const int N = 200005;

int n;
int L[N], R[N];
string s;

int main() {
    int ans, l, r, p, t;
    while (cin >> s) {
        n = SZ(s), ans = n;
        L[0] = -1;
        FOR (i, 1, n - 1) L[i] = i - 1;
        R[n - 1] = -1;
        FOR (i, 0, n - 2) R[i] = i + 1;
        p = 0;
        while (R[p] != -1) {
            t = R[p];
            if (!(s[p] == 'S' && s[t] == 'T')) p = t;
            else {
                ans -= 2;
                if (L[p] == -1) p = t, t = R[t], L[p] = -1;
                else p = L[p], t = R[t], R[p] = t, L[t] = p;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}



Measured memory_bytes: 2180
#include <cstdio>

using namespace std;

int parse_int()
{
    int n = 0, c;
    while (1)
    {
        c = getchar_unlocked();
        if ('0' <= c && c <= '9')
            n = n * 10 + c - '0';
        else
            break;
    }
    return n;
}

template <size_t N>
struct Solver
{
    bool is_prime[N + 1];
    int ans[N + 1];
    constexpr Solver() : is_prime(), ans()
    {
        is_prime[0] = false;
        is_prime[1] = false;
        for (size_t i = 2; i <= N; i++)
        {
            is_prime[i] = true;
        }
        for (size_t prime = 2; prime <= N; prime++)
        {
            if (is_prime[prime])
            {
                for (size_t q = prime * 2; q <= N; q += prime)
                {
                    is_prime[q] = false;
                }
            }
        }
        for (size_t i = 1; i <= N; i++)
        {
            ans[i] += ans[i - 1];
            if (is_prime[i] && is_prime[(i + 1) / 2])
            {
                ans[i] += 1;
            }
        }
    }
};

int main()
{
    constexpr auto M = 100000;
    constexpr auto solver = Solver<M>();
    int Q = parse_int();
    for (size_t i = 0; i < Q; i++)
    {
        int l = parse_int();
        int r = parse_int();
        auto ans = solver.ans[r] - solver.ans[l - 1];
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 1024
#include <iostream>
 
using namespace std;
 
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int sum = 1;
  sum += (b!=a) ? 1 : 0;
  sum += (c!=a) && (c!=b) ? 1 : 0;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String... args) {
        int[][] house1 = new int[3][10];
        int[][] house2 = new int[3][10];
        int[][] house3 = new int[3][10];
        int[][] house4 = new int[3][10];
        Scanner scan = new Scanner(System.in);
        int times = scan.nextInt();
        StringBuilder build = new StringBuilder();
        for(int i = 0 ; i < times ; i++) {
            switch(scan.nextInt()) {
                case 1:
                    house1[scan.nextInt()-1][scan.nextInt()-1] += scan.nextInt();
                    break;
                case 2:
                    house2[scan.nextInt()-1][scan.nextInt()-1] += scan.nextInt();
                    break;
                case 3:
                    house3[scan.nextInt()-1][scan.nextInt()-1] += scan.nextInt();
                    break;
                case 4:
                    house4[scan.nextInt()-1][scan.nextInt()-1] += scan.nextInt();
                    break;
            }
        }
        for(int n = 0 ; n < 3 ; n++) {
            for(int j = 0 ; j < 10; j++) {
                build.append(" " + house1[n][j] );
            }
        build.append("\n");
        }
        build.append("####################\n");
        for(int n = 0 ; n < 3 ; n++) {
            for(int j = 0 ; j < 10; j++) {
                build.append(" " + house2[n][j] );
            }
        build.append("\n");
        }
        build.append("####################\n");
        for(int n = 0 ; n < 3 ; n++) {
            for(int j = 0 ; j < 10; j++) {
                build.append(" " + house3[n][j] );
            }
        build.append("\n");
        }
        build.append("####################\n");
        for(int n = 0 ; n < 3 ; n++) {
            for(int j = 0 ; j < 10; j++) {
                build.append(" " + house4[n][j] );
            }
        build.append("\n");
        }
        System.out.print(build.toString());
    }
}

                




Measured memory_bytes: 29192
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
using namespace std;
vector<pair<int, pair<string, int>>> rest;
int cmp(pair<int, pair<string, int>> A, pair<int, pair<string, int>> B){
	pair<string, int> a = A.second; 
    pair<string, int> b = B.second;
    if(a.first != b.first){
    	return lexicographical_compare(a.first.begin(), a.first.end(), b.first.begin(), b.first.end());
	}
    return a.second > b.second;
}

int main(){
  int n;
  cin >> n;
  for(int i = 1; i <= n; i++){
    string s;
    int k;
    cin >> s >> k;
  	rest.push_back(pair<int, pair<string, int>>{i, pair<string, int>{s, k}});
  }
  sort(rest.begin(), rest.end(), cmp);
  for(auto i:rest){
  	cout << i.first << endl;
  }
}

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

int main() {
  int a,b,c,d,e,x=10,ans=0;
  cin >> a >> b >> c >> d >> e;
  if(a%10!=0) x=min(x,a%10);
  if(b%10!=0) x=min(x,b%10);
  if(c%10!=0) x=min(x,c%10);
  if(d%10!=0) x=min(x,d%10);
  if(e%10!=0) x=min(x,e%10);
  x+=40;
  if(a%10!=0) ans+=a/10*10;
  else ans+=a-10;
  if(b%10!=0) ans+=b/10*10;
  else ans+=b-10;
  if(c%10!=0) ans+=c/10*10;
  else ans+=c-10;
  if(d%10!=0) ans+=d/10*10;
  else ans+=d-10;
  if(e%10!=0) ans+=e/10*10;
  else ans+=e-10;
  ans+=x;
  cout << ans << endl;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> P(N), Q(N);
	for (int i = 0; i < N; i++) {
		cin >> P.at(i);
	}
	for (int i = 0; i < N; i++) {
		cin >> Q.at(i);
	}

	int a = 1, b = 1, cnt = 1;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		v.at(i) = i + 1;
	}
	do {
		if (equal(P.begin(), P.end(), v.begin(), v.end())) {
			a = cnt;
		}
		if (equal(Q.begin(), Q.end(), v.begin(), v.end())) {
			b = cnt;
		}
		cnt++;
	} while (next_permutation(v.begin(), v.end()));
	
	cout << abs(a - b) << endl;
}

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

using namespace std;

int n, m, x[100005], v, p;
bool g[100005];

bool ok(int a) {
	int at = 0, tar = x[a] + m;
	while (x[at] <= tar)
		at++;
	if (n - at > p - 1)
		return 0;
	long long per = (v - 1) - (p - 1);
	if (per <= 0)
		return 1;
	long long need = m * per;
	for (int i = 0; i < n; i++)
		g[i] = 0;
	g[a] = 1;
	for (int i = 0, aat = n - 1; i < p - 1; i++) {
		if (aat == a)
			aat--;
		g[aat] = 1;
		aat--;
	}
	long long tot = 0;
	for (int i = 0; i < n; i++)
		if (!g[i])
			tot += min(m, tar - x[i]);
	return tot >= need;
}

int main() {
	scanf("%d%d%d%d", &n, &m, &v, &p);
	for (int i = 0; i < n; i++)
		scanf("%d", x + i);
	sort(x, x + n);
	// for (int i = 0; i < n; i++) printf("%d ", i); puts("");
	// for (int i = 0; i < n; i++) printf("%d ", x[i]); puts("");
	x[n] = INT_MAX;
	int lo = 0, hi = n;
	while (lo < hi) {
		int mi = (lo + hi) / 2;
		if (ok(mi))
			hi = mi;
		else
			lo = mi + 1;
	}
	printf("%d\n", n - lo);
}

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

using namespace std;

int main()
{   
    int i;
    string s , t;
    cin>>s>>t;
    for( i = 0 ; i<s.length() ;i++)
    {
        if(s[i]!=t[i])
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(t.length()==s.length()+1)
    {
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        int h=scanner.nextInt();
        int m=scanner.nextInt();
        double c=angle(h%12,m);
        c=Math.toRadians(c);
        double ss=Math.sqrt( (double)Math.pow(a,2)+ (double)Math.pow(b,2)- ((double)2*(double)a*(double)b*(double)Math.cos(c)) );
        System.out.println(ss);
    }
    public static double angle(int hour, int minute) {
        if (hour < 0 || minute < 0) {
            return -1;
        }
        if (hour == 12) {
            hour = 0;
        }
        if (minute == 60) {
            minute = 0;
            hour += 1;
        }
        double hourAngle = (hour * 60 + minute) * 0.5;
        double minAngle = minute * 6;
        double bwAngle = Math.abs(hourAngle - minAngle);
        return Math.min(360 - bwAngle, bwAngle);

    }

}


Measured memory_bytes: 27188
N,A,B= input().split()
if int(N)%(int(A)+int(B))>=int(A):
    ans=int(N)//(int(A)+int(B))*int(A)+int(A)
    print(ans)
else:
    ans=int(N)//(int(A)+int(B))*int(A)+int(N)%(int(A)+int(B))
    print(ans)



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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int h1,m1,h2,m2,k;
	cin >>h1 >>m1 >>h2 >>m2 >>k;
	
	if(h2<h1){ puts("0");return 0;}
	int dh = max(0, h2-h1);
	int dm = dh *60 + m2 - m1;
	
	cout << max(0, dm-k) <<"\n";
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    if(N%2 == 0) cout << N << endl;
    else cout << 2*N << endl;
}

Measured memory_bytes: 256
use std::collections::BinaryHeap;

use std::cmp::Ordering;

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

pub fn main() {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    
    let n: usize = iter.next().unwrap().parse::<usize>().unwrap();
    let a: Vec<u64> = iter.take(3*n).map(|x| x.parse().unwrap()).collect();
    
    use std::iter::FromIterator;
    let mut front_heap: BinaryHeap<Rev<u64>> = BinaryHeap::from_iter(a.iter().take(n).map(|x| Rev(*x)));
    let mut back_heap: BinaryHeap<u64> = BinaryHeap::from_iter(a.iter().skip(2*n).map(|x| *x));
    let mut front_sum = a.iter().take(n).fold(0, |acc,x| acc + x);
    let mut back_sum = a.iter().skip(2*n).fold(0, |acc,x| acc + x);
    let mut front = vec![0u64;n+1];
    let mut back = vec![0u64;n+1];
    for i in 0..n+1 {
        let p = i + n;
        let q = 2*n - 1 - i;
        front[i] = front_sum;
        back[n-i] = back_sum;
        if i != n {
            if front_heap.peek().unwrap().0 < a[p] {
                let min = front_heap.pop().unwrap().0;
                front_heap.push(Rev(a[p]));
                front_sum -= min;
                front_sum += a[p];
            }

            if *back_heap.peek().unwrap() > a[q] {
                let max = back_heap.pop().unwrap();
                back_heap.push(a[q]);
                back_sum -= max;
                back_sum += a[q];
            }
        }
    }

    // println!("{:?}", front);
    // println!("{:?}", back);
    println!("{}", front.iter().zip(back.iter()).map(|(&a, &b)| a as i64 - b as i64).max().unwrap());
}


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

int main(){

    long long H;
    cin >> H;

    int count = 0;

    while(1){
        if(H == 1){
            break;
        }
        else{
            H = H/2;
            count++;
        }

    }

    long long atack = 0;
    for(int i=0; i<=count; i++){
        atack += pow(2,i);
    }

    cout << atack << endl;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int y = sc.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	}
}


Measured memory_bytes: 39480