akhauriyash/Code-Regression huggingface dataset:
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#define ll long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000//10^12

int main(void)
{
	//変数の宣言
	int a,b,c;
	
	//データの読み込み
	
	scanf("%d %d %d",&a,&b,&c);
	
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	
//	printf("計算部分終了\n");
	
	//出力
	if(b-a==c-b){
		printf("YES");
	}else{
		printf("NO");
	}
	
	
	//('・ω・'）
	
//	printf("結果の出力終了\n");
	
	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for(int i=a;i<b;i++)
#define repds(i,a,b) for(int i=a+1;i<=b;i++)
#define rep(i,N) repd(i,0,N)
#define reps(i,N) repds(i,0,N)
#define debug(x) cout<<#x<<"="<<x<<endl
#define debugarr(arr,N,M){rep(i,N+1){rep(j,M+1){if(arr[i][j]==INF)printf(" INF");\
	else printf(" %3d",arr[i][j]);} cout<<endl;}}
#define pb push_back
#define pob pop_back
#define cint(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long ll;
typedef pair<int,int> P;
const int INF=100000000;
const int dx[4]={ 0, 1, 0,-1};
const int dy[4]={ 1, 0,-1, 0};
//--------------------------------------//
int n,k;
int p;
int main(){
	cin>>n>>k;
	rep(i,n) cin>>p;
	if(n==k){
		cout<<"1"<<endl;
		return 0;
	}
	int c=1;
	while(1){
		if(c*k-c+1>=n) {cout<<c<<endl;break;}
		c++;
	}
		
	return 0;
}


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

using namespace std;

int main (){
	
	//freopen("t.txt","r",stdin);
	int n;
	double s, v[100];
	cin>>n;
	for (int i=1;i<=n;i++) cin>>v[i];
	
	sort (v+1,v+1+n);
	s=v[1];
	for (int i=2;i<=n;i++){
		s= (s+v[i])/2;
	}
	
	printf("%.5lf",s);
}

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

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

const int MAXN = 2e5;

int N;
ll ans, cnt[60][50];

int main()
{
	scanf("%d", &N);
	for(int i=1; i<=N; i++)
	{
		double x;
		cin>>x;
		ll t=llround(x*1000000000);
		int p=0, q=0;
		for(ll k=2; t%k==0; k*=2, p++);
		for(ll k=5; t%k==0; k*=5, q++);

		assert(p<=50 && q<=20);
		for(int j=0; j<=50; j++) for(int k=0; k<=20; k++) if(j+p>=18 && k+q>=18) ans+=cnt[j][k];
		cnt[p][q]++;
	}

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

Measured memory_bytes: 3868
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

/*************** using variables ***************/

/**********************************************/
template <typename T>
struct Edge {
    int from, to;
    T cost;
    Edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    Edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};

template <typename T>
using Edges = vector<Edge<T>>;
template <typename T>
using AdjList = vector<Edges<T>>;

template <typename T>
class BellmanFord {
    private:
        T INF = numeric_limits<T>::max() / 10;
        int V;
        int nodeNum;
        AdjList<T> adj;  // adj[始点][動的配列で始点から伸びる枝]
        vector<bool> negative;  // negative[n] := nに到達するまでに負閉路があるか

    public:
        explicit BellmanFord(int n);
        vector<T> dist;  // 最短経路
        void AddEdge(int f, int t, T c);
        void Run(int f);
        bool HasNegativeCycle(int n);
};

template <typename T>
BellmanFord<T>::BellmanFord(int n) : 
    V(n + 1),
    nodeNum(n),
    adj(V),
    negative(V, false),
    dist(V, INF) 
    {}

template <typename T>
void BellmanFord<T>::AddEdge(int f, int t, T c) { adj[f].push_back(Edge<T>(t, c)); }

template <typename T>
void BellmanFord<T>::Run(int firstNode) {
    dist[firstNode] = 0;
    for (int loop = 0; loop < nodeNum - 1; loop++) {
        for (int i = 0; i < nodeNum; i++) {
            for (const Edge<T>& e : adj[i]) {
                if (dist[i] == INF) continue;
                if (dist[e.to] > dist[i] + e.cost) {
                    dist[e.to] = dist[i] + e.cost;
                }
            }
        }
    }

    for (int loop = 0; loop < nodeNum; loop++) {
        for (int i = 0; i < nodeNum; i++) {
            for (const Edge<T>& e : adj[i]) {
                if (dist[i] == INF) continue;
                if (dist[e.to] > dist[i] + e.cost) {
                    dist[e.to] = dist[i] + e.cost;
                    negative[e.to] = true;
                }
                if (negative[i] == true) {
                    negative[e.to] = true;
                }
            }
        }
    }
}

template <typename T>
bool BellmanFord<T>::HasNegativeCycle(int n) { return negative[n]; }

/*************** using variables ***************/
int n, m;
vector<LL> a, b, c;
/**********************************************/
 
signed main(){
    cin >> n >> m;
    a.resize(m);
    b.resize(m);
    c.resize(m);
    
    BellmanFord<LL> bel(n);
    REP(i, m){
        cin >> a[i] >> b[i] >> c[i];
        bel.AddEdge(a[i]-1, b[i]-1, -c[i]);
    }
 
    bel.Run(0);
    if(bel.HasNegativeCycle(n-1)){
        cout << "inf" << endl;    
    }
    else cout << -bel.dist[n-1] << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

i64 x,a,b;

int main()
{
    cin >> x >> a >> b;
    i64 now = -a + b;
    if(now <= 0)
    {
        cout << "delicious" << endl;
    }
    else if(now <= x)
    {
        cout << "safe" << endl;
    }
    else
    {
        cout << "dangerous" << endl;
    }
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#include <tuple>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (n); i < (m); i++)
#define MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#pragma endregion

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int H, W; cin >> H >> W;
    vector<vector<char>> a(H, vector<char>(W));
    vector<vector<ll>> ans(H, vector<ll>(W,0));
    ans[0][0] = 1;
    REP(i, H) {
        REP(j, W) {
            cin >> a[i][j];
            if (a[i][j] == '.') {
                if (i != 0) {
                    ans[i][j] += ans[i - 1][j];
                }
                if (j != 0) {
                    ans[i][j] += ans[i][j - 1];
                }
                ans[i][j] %= MOD;
            }
        }
    }
    cout << ans[H-1][W-1] << endl;
    getchar(); getchar();
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, tl;
    cin >> n >> tl;
    vector<P> list(n);
    rep(i, n) {
        int c, t;
        cin >> c >> t;
        list[i] = make_pair(c, t);
    }

    sort(all(list));

    int res = INF;

    rep(i, n) {
        if (list[i].second <= tl) {
            res = min(res, list[i].first);
        }
    }

    if (res == INF) cout << "TLE" << endl;
    else cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
from itertools import product

n = int(input())
s = input()

cnt = 0
for i, j, k in product(range(10), repeat=3):
    try:
        x = s.index(str(i))
        y = s.index(str(j), x+1)
        z = s.index(str(k), y+1)
        cnt += 1
    except:
        continue

print(cnt)

Measured memory_bytes: 3060
B,M,S = 13,9,5
dx = [ 0, 0, 1, 0,-1, 1, 1,-1,-1, 0, 2, 0,-2]
dy = [ 0,-1, 0, 1, 0,-1, 1, 1,-1, 2, 0,-2, 0]
def isOnCloth(x,y):
    return 0<=x<10 and 0<=y<10
def soak(cloth,x,y,ink):
    for i in xrange(ink):
        cloth[y+dy[i]][x+dx[i]] -= 1
def drop(cloth,x,y,ink):
    for i in xrange(ink):
        cloth[y+dy[i]][x+dx[i]] += 1
def canSoak(cloth,x,y,ink):
    return all([isOnCloth(x+dx[i],y+dy[i]) and cloth[y+dy[i]][x+dx[i]]>0 for i in xrange(ink)])
def DFS(cloth,ink_set,cur):
    if len(ink_set)==0:
        return []
    for i in xrange(cur,100):
        if not cloth[i/10][i%10] == 0:
            break
        cur += 1
    for ink in set(ink_set):
        for i in xrange(ink):
            cx,cy = cur%10+dx[i],cur/10+dy[i]
            if isOnCloth(cx,cy) and cloth[cy][cx]>0:
                if canSoak(cloth,cx,cy,ink):
                    soak(cloth,cx,cy,ink)
                    ink_set.remove(ink)
                    result = DFS(cloth,ink_set,cur)
                    if not result == False:
                        result.append([cx,cy,ink])
                        return result
                    ink_set.append(ink)
                    drop(cloth,cx,cy,ink)
    return False
ink_set = [B,S]
clothA = [[0,0,0,0,0,0,0,0,0,0],
         [0,0,1,0,0,0,0,0,0,0],
         [0,1,1,1,0,0,0,0,0,0],
         [1,1,1,1,1,0,0,0,0,0],
         [0,1,1,1,0,0,0,0,0,0],
         [0,0,1,0,0,0,0,0,0,0],
         [0,0,0,0,0,0,0,0,0,0],
         [0,0,0,0,0,0,1,0,0,0],
         [0,0,0,0,0,1,1,1,0,0],
         [0,0,0,0,0,0,1,0,0,0],
         [0,0,0,0,0,0,0,0,0,0],]
clothB = [[0,0,0,0,0,0,0,0,0,0],
          [0,0,0,0,0,0,0,0,0,0],
          [0,0,1,0,0,0,0,0,0,0],
          [0,1,1,1,0,0,0,0,0,0],
          [0,0,1,0,0,0,0,0,0,0],
          [0,0,0,0,0,0,0,0,0,0],
          [0,0,0,0,0,0,0,0,0,0],
          [0,0,0,0,0,0,0,0,0,0],
          [0,0,0,0,0,0,0,0,0,0],
          [0,0,0,0,0,0,0,0,0,0],]
import itertools
n = input()
cloth = []
for u in xrange(10):
    cloth.append(map(int,raw_input().split(" ")))
su = sum([sum(cloth[i]) for i in xrange(10)])
ink_sets = [list(a) for a in itertools.combinations_with_replacement([0,13,9,5],n) if sum(a) == su]
for ink_set in ink_sets:
    pass
    result = DFS(cloth,ink_set,0)
    if not result == False:
        break
dic = {B:3,M:2,S:1}
for r in result:
    print "{} {} {}".format(r[0],r[1],dic[r[2]])

Measured memory_bytes: 4576
import java.util.Scanner;

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

        int n = nextInt(scanner);
        int m = Math.abs((n % 1000) - 1000);
        if (m == 1000) {
            System.out.println(0);
        }else {
            System.out.println(m);
        }
    }


    private static int nextInt(Scanner scanner) {
        return Integer.parseInt(scanner.next());
    }

    private static long nextLong(Scanner scanner) {
        return Long.parseLong(scanner.next());
    }

    private static float nextFloat(Scanner scanner) {
        return Float.parseFloat(scanner.next());
    }

    private static double nextDouble(Scanner scanner) {
        return Double.parseDouble(scanner.next());
    }


}





Measured memory_bytes: 35576
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;

int main()
{
	ll a=0;
	int b;
	scanf("%d",&b);
	for(int i=1;i<=b;i++)
	{
		if(i%3&&i%5)a+=i;
	}
	printf("%lld\n",a);
}

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

int maxi,mini;

void swap(char a[],int i,int j){
	char temp;
	temp=a[i];
	a[i]=a[j];
	a[j]=temp;
	return;
}


void bubblesort(char str[],int com){/*com=0昇順com=1降順*/
	int i,j;
	int n=strlen(str);

	for(i=0;i<n;i++){
		for(j=0;j<n-i-1;j++){
			if(com==0){
				if(str[j] > str[j+1])swap(str,j,j+1);
			}
			else {
				if(str[j] < str[j+1])swap(str,j,j+1);
			}
		}
	}
	
	if(com==0)mini=atoi(str);
	else maxi=atoi(str);
	
	return;
	
}


int main(){
	int n,i;
	int a[10];
	char str[10];
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%s",str);
		bubblesort(str,0);
		bubblesort(str,1);
		printf("%d\n",maxi-mini);
	}
	
	return 0;
}


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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define ALL(a) (a.begin(), a.end())
#define FOR(x,to) for(x=0;x<(to);x++)

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

void solve() {
	int n;
	int a[100];
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	int mx = 0;
	for (int i = 0; i < n-1; ++i) {
		for (int j = i+1; j < n; ++j) {
			mx = max(mx,abs(a[i]-a[j]));
		}
	}

	cout << mx << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

	//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#else
template<class...T>void dprint(T&&...t){_print(cerr,t...);}
#endif
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<<(ostream&o,const multiset<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int a,b;
    cin>>a>>b;
    cout<<max({a+b,a-b,a*b})<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
typedef long long ll;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++)  cin >> a[i];
    sort(a.begin(), a.end());
    vector<pair<int,int>> vp;
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        vp.push_back({y, x});
    }
    sort(vp.rbegin(), vp.rend());
    int ind = 0, pos = 0;
    ll sum = 0;
    while(pos < n && ind < m){
        for(int k = 0; k < vp[ind].second && pos < n; k++){
            a[pos] = max(a[pos], vp[ind].first);
            pos++;
        }
        ind++;
    }
    cout << accumulate(a.begin(), a.end(), 0ll) << endl;
    return 0;
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll twoCount = 0;
    for (int i = 0; i < N; i++)
    {
        ll a;
        cin >> a;
        while (a % 2 == 0)
        {
            twoCount++;
            a /= 2;
        }
    }
    cout << twoCount << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    double x1, x2, x3, y1, y2, y3, xp, yp;
    while (cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
        double v1, v2, v3;
        v1 = (x1-x2)*(y1-yp) - (y1-y2)*(x1-xp);
        v2 = (x2-x3)*(y2-yp) - (y2-y3)*(x2-xp);
        v3 = (x3-x1)*(y3-yp) - (y3-y1)*(x3-xp);
        //printf("%f %f %f\n", v1, v2, v3);
        if ( (v1 < 0 && v2 < 0 && v3 < 0) || (v1 > 0 && v2 > 0 && v3 > 0) ) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}


Measured memory_bytes: 3012
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define add(x) accumulate(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end() 
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                ll n,k;
                ll oper(vpll &vec,ll mid){
                        ll cnt=0;
                        rep(i,0,n){
                                if(vec[i].ff*vec[i].ss<=mid)
                                        continue;
                                cnt+=(vec[i].ff-mid/vec[i].ss);
                        }
                        if(cnt<=k)
                                return 1;
                        return 0;
                }
                void solve(){
                        // ll n,k;
                        cin>>n>>k;
                        vll men(n),dish(n);
                        rep(i,0,n)
                                cin>>men[i];
                        rep(i,0,n)
                                cin>>dish[i];
                        sort(all(men));
                        sort(all(dish));
                        reverse(all(dish));
                        vpll vec(n);
                        rep(i,0,n)
                                vec[i]=mp(men[i],dish[i]);
                        ll lo=0,hi=INF;
                        while(lo<hi){
                                ll mid=(lo+hi)>>1;
                                if(oper(vec,mid))
                                        hi=mid;
                                else
                                        lo=mid+1;
                        }
                        // cout<<oper(vec,n,12);
                        cout<<lo;
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //printf("Case #%d: ", i);
                                solve();
                         }
        return 0; 
}         
 

Measured memory_bytes: 6528
import java.util.Scanner;
import java.lang.Math;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String str_scan = scan.nextLine();
    double ans = Double.parseDouble(str_scan);
    double ans_double;

    ans_double = ans + Math.pow(ans,2) + Math.pow(ans,3);

    System.out.println((int)ans_double);
    scan.close();
  }
}

Measured memory_bytes: 35776
x = int(input())
k = 2*(x//(5+6))
r,tmp = x%(5+6),x%(5+6)
count = 0
while True:
    r -= 6-(count%2)
    if r <= 0:
        break
    count += 1
if x <= 6:
    print(1)
elif tmp == 0:
    print(k)
else:
    print(count+k+1)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
vector<lli> price;
vector<vector<lli>> v;
lli n, m, x;
lli infi = 1000000000000000;
lli mincost = infi;
void recurse(vector<lli> arr, lli index)
{
    // for1(i, 0, index)
    // {
    //     cout << arr[i] << " ";
    // }
    // cout << endl;
    if (index == m)
    {
        lli f = 0;
        lli cost = 0;
        for1(i, 0, n)
        {
            lli y = 0;
            for1(j, 0, m)
            {
                if (arr[j] == 1)
                {
                    y += v[j][i];
                }
            }
            if (y < x)
            {
                f = 1;
                break;
            }
        }
        if (f == 0)
        {
            for1(j, 0, m)
            {
                if (arr[j] == 1)
                {
                    cost += price[j];
                }
            }
            mincost = min(mincost, cost);
        }

        // mincost = min(mincost, cost);
    }
    else
    {
        vector<lli> p, q;
        for1(i, 0, index)
        {
            p.pb(arr[i]);
            q.pb(arr[i]);
        }
        p.pb(0);
        q.pb(1);
        // index += 1;
        recurse(p, index + 1);
        recurse(q, index + 1);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> m >> n >> x;

    v.resize(25);
    for1(i, 0, m)
    {
        lli a;
        cin >> a;
        price.pb(a);
        for1(j, 0, n)
        {
            lli k;
            cin >> k;
            v[i].pb(k);
        }
    }

    vector<lli> arr1;
    recurse(arr1, 0);
    if (mincost == infi)
    {
        cout << "-1" << endl;
        rt;
    }
    cout << mincost << endl;
    rt;
}

Measured memory_bytes: 3656
n = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

prev = -1
ret = 0

for item in a_list:
    de = b_list[item-1]
    if item == prev+1:
        de += c_list[item-2]
    prev = item
    ret += de

print(ret)



Measured memory_bytes: 38384
#include <iostream>

using namespace std;

int main()
{
    int arr[100];
    int n;
    cin >> n;

    for(int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    int max = 0;
    for(int i = 0; i < n; i++) {
        for(int k = i; k < n; k++) {
            if(abs(arr[k]-arr[i]) > max ) {
                max = abs(arr[k] - arr[i]);
            }
        }
    }

    cout << max;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		new Main().main();
	}

	void main() {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			if(n==0) break;
			char[][] c = new char[n][n];
			for(int i=0;i<n;i++) {
				String s = sc.next();
				c[i] = s.toCharArray();
			}
//			for(int i=0;i<n;i++) {
//				for(int j=0;j<n;j++) {
//					System.out.print(c[i][j] + " ");
//				}
//				System.out.println();
//			}
			int[][] dp = new int[n][n];
			for(int j=0;j<n;j++) {
				dp[0][j] = (c[0][j] == '.'?1:0);
			}
			for(int i=0;i<n;i++) {
				dp[i][0] = (c[i][0] == '.'?1:0);
			}
			for(int i=1;i<n;i++) {
				for(int j=1;j<n;j++) {
					if(c[i][j] == '.') {
						dp[i][j] = Math.min(dp[i-1][j-1], Math.min(dp[i-1][j], dp[i][j-1]))+1;
					}else {
						dp[i][j] = 0;
					}
				}
			}
			int ans = 0;
			for(int i=0;i<n;i++) {
				for(int j=0;j<n;j++) {
					ans = Math.max(ans , dp[i][j]);
				}
			}
			System.out.println(ans);
		}
	}
}


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


def func(x):
    if x % 2 == 0:
        return 0

    cnt = 0
    for i in range(1, x + 1):
        if x % i == 0:
            cnt += 1
    if cnt == 8:
        return 1
    else:
        return 0


ans = 0
for i in range(1, N + 1):
    ans += func(i)

print(ans)


Measured memory_bytes: 2940
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#define ll long long
using namespace std;



int main(){
  string S,S_reverse,S_small,S_small_reverse;
  cin>>S;

  S_reverse=S;

  reverse(S_reverse.begin(),S_reverse.end());

  S_small=S.substr(0,S.size()/2);



  S_small_reverse=S_small;

  reverse(S_small_reverse.begin(),S_small_reverse.end());



  if(S==S_reverse&&S_small==S_small_reverse){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    vector<int> b(n-1);
    vector<int> a(n);
    rep(i,n-1)  cin >> b.at(i);
    for(int i=1;i<n-1;i++){
        a.at(i)=min(b.at(i-1),b.at(i));
    }
    a.at(0)=b.at(0);
    a.at(n-1)=b.at(n-2);
    int sum=0;
    rep(i,n) sum+=a.at(i);
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define len(v) (int)(v.size())
#define ll long long
#define fi first
#define se second

using namespace std;

using psl = pair<string,ll>;

typedef tuple<string,int,int> tup;

struct edge{
	int to,cost;
    string buf;
};

vector<map<int, string> > mp;
bool flag;
vector<vector<edge> > G;

void dijkstra(int n,int s,int val)
{
	priority_queue<tup,vector<tup>,greater<tup> > que;
	mp[s][0] = "";
	que.push(tup("",0,s));
	while(!que.empty()){
		tup t = que.top();
		que.pop();
		string ss = get<0>(t);
		int l = get<1>(t);
		int v = get<2>(t);
		if(mp[v][l] < ss) continue;
		for(auto w : G[v]){
			int nagasa = l+w.cost;
			string hoge = ss+w.buf;
			if(nagasa <= val*(n-1) && (mp[w.to].find(nagasa) == mp[w.to].end() || mp[w.to][nagasa] > hoge)){
				mp[w.to][nagasa] = hoge;
				que.push(tup(hoge,nagasa,w.to));
			}
		}
	}
}

//
// void shortest_path(int n,int m,int s,int val,int hoge)
// {
//     if(!flag){
//         flag = true;
//         mp[s][0] = "";
//     }
// 	int cnt = 0;
// 	while(cnt < hoge){
//         bool update=false;
// 		rep(i,m){
// 			edge& e = es[i];
// 			for(auto& it : mp[e.from]){
//                 if(it.fi+e.leng <= val*(n-1)){
//                     string t = it.se+e.buf;
//                     if((mp[e.to].find(len(t)) == mp[e.to].end()) || (t < mp[e.to][len(t)])){
//                         update = true;
//                         mp[e.to][len(t)] = t;
//                     }
//                 }
//             }
// 		}
//         if(!update) break;
//         cnt++;
// 	}
// }

int main()
{
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    while(1){
        int n,a,s,g;
        cin >> n >> a >> s >> g;
        if(n + a + s + g == 0){
            break;
        }
        flag = false;
        G.resize(n),mp.resize(n);
        rep(i,n){
            G[i].clear();
        }
        rep(i,n){
            mp[i].clear();
        }
        rep(i,a){
            int u,v;
            string ss;
            cin >> u >> v >> ss;
            G[u].push_back((edge){v,len(ss),ss});
        }
        dijkstra(n,s,30);
        if(len(mp[g]) == 0){
            cout << "NO\n";
            continue;
        }
        vector<string> vec;
        for(auto&it : mp[g]){
            vec.push_back(it.se);
        }
        // for(auto&it : mp[1]){
        //     cout << it.fi << " " << it.se << "\n";
        // }
        sort(vec.begin(),vec.end());
        string r1 = vec[0];
        // cout << r1 << "\n";
        // dijkstra(n,s,20);
        // for(auto&it : mp[2]){
        //     cout << it.fi << " " << it.se << "\n";
        // }
        // vec.clear();
        // for(auto&it : mp[g]){
        //     vec.push_back(it.se);
        // }
        // sort(vec.begin(),vec.end());
        // string r2 = vec[0];
        if(len(r1) <= 6*(n-1)){
            cout << r1 << "\n";
        }else{
            cout << "NO\n";
        }
    }
}

Measured memory_bytes: 47936
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

ll mod = 1000000007;
ll modsize;

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

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

int mobius(int n) {
	int ans = 0;
	int m = n;
	for (int i = 2; i*i <= m; i++) {
		int check = 0;
		while (n%i == 0) {
			n /= i;
			ans++;
			check++;
			if (check >= 2) {
				return 0;
			}
		}
	}
	if (n != 1) ans++;
	if (ans % 2 == 0) return 1;
	else return -1;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n, k;
	cin >> n >> k;
	bool flag = true;
	if (n % 2 == 0) {
		n /= 2;
		flag = false;
	}
	int ans = 0;
	map<int, int> mp;
	for (int i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			if (!flag) {
				mp[i] = modpow(k, i);
				mp[n / i] = modpow(k, n / i);
			}
			else {
				mp[i] = modpow(k, (i + 1) / 2);
				mp[n / i] = modpow(k, (n / i + 1) / 2);
			}
		}
	}
	for (auto i : mp) {
		//cout << i.first << ' ' << i.second << endl;
		int cnt = i.second;
		for (auto j : mp) {
			if (i == j) continue;
			if (i.first%j.first == 0) {
				cnt += mobius(i.first/j.first)*j.second;
				cnt = (cnt + mod) % mod;
			}
		}
		cnt *= i.first;
		cnt %= mod;
		ans += cnt;
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pll pair<ll, ll>
#pragma GCC optimize ("O3")
using namespace std;
ll power (ll a) {
    ll prod=1;
    for (ll i=0;i<a;++i) prod*=10;
    return prod;
}
int main () {
    #ifdef LOCAL
        freopen ("input.txt", "r", stdin);
        freopen ("output.txt", "w", stdout);
        freopen ("error.txt", "w", stderr);
    #else
        ios::sync_with_stdio(false);
        cin.tie (NULL);
    #endif
    ll n; cin>>n;
    vector <ll> a (n);
    for (auto &i : a) cin>>i;
    ll now=a[n-1];
    for (ll i=n-2;i>=0;--i) {
        if (a[i]-now<=1) now=min(now, a[i]);
        else {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 1024
I=input().split()
D=int(I[0])
G=int(I[1])
P=[]
C=[]
sumS=[]
ans=10**4
for i in range(0,D):
    T=input().split()
    P.append(int(T[0]))
    C.append(int(T[1]))
    sumS.append((i+1)*100*P[i]+C[i])
for i in range(0,2**D):
    t=i
    point=0
    cost=0
    used=[]
    for j in range(0,D):
        if(t%2==1):
            point+=sumS[j]
            cost+=P[j]
            used.append(True)
        else:
            used.append(False)
        t//=2
    if(point<G):
        t=i
        f=False
        for j in range(0,D)[::-1]:
            if(not used[j]):
                f=True
                for k in range(1,P[j]):
                    point+=(j+1)*100
                    cost+=1
                    if (point>=G):
                        break
            if f:
                break
    if(point>=G):
        if(ans>cost):
            ans=cost
print(ans)

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const ll inf = 1e9;

const string YES = "YES";
const string NO = "NO";

void solve()
{
  string a,b;
  cin>>a>>b;
  if (a[0]==b.back()&&a[1]==b[1]&&a.back()==b[0]) cout << YES << endl;
  else cout << NO << endl;
}

int main()
{
  solve();
  return 0;
}


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

int main() {
  int k, x;
  std::cin >> k >> x;
  std::vector<int> answer;
  for (int i = std::max(-1000000, x - k + 1); i <= std::min(1000000, x + k - 1); ++ i) {
    answer.push_back(i);
  }
  for (int i = 0; i < answer.size(); ++ i) {
    printf("%d%c", answer[i], i + 1 == answer.size() ? '\n' : ' ');
  }
  return 0;
}


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

long long five (int n) {
  long long N = n;
  N *= N*N*N*N;
  return N;
}

int main() {
  int X;
  cin >> X;
  int ansA, ansB;
  for (int A = -200; A <= 200; A++) {
    for (int B = -200; B <= 200; B++) {
      if (five(A) - five(B) == X) {
        ansA = A; ansB = B;
      }
    }
  }
  cout << ansA << " " << ansB << endl;
}

Measured memory_bytes: 3640
from collections import defaultdict
from itertools import combinations
N = int(input())
cnt = defaultdict(int)

for _ in range(N):
    S = input()
    if S[0] in ["M","A","R","C","H"]:
        cnt[S[0]] += 1

if len(cnt) < 3:
    print(0)
    exit()

ans = 0
comb = list(combinations(["M","A","R","C","H"], 3))
for i in range(10):
    tmp = 1
    for c in comb[i]:
        tmp *= cnt[c]
    ans += tmp

print(ans)

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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const long double EPS = 0.0000000001;

int n,k,s;
int main(){
	cin >> n >> k >> s;
	for(int i = 0; i < k; i++)cout << s << " ";
	if(s != (int)1e9)for(int i = 0; i < n-k; i++)cout << (int)1e9 << " ";
	else for(int i = 0; i < n-k; i++)cout << 1 << " ";
	
	cout << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

int main(){
  int64_t h,w;
  cin >> h >> w;
  if(h != 1 && w != 1) cout << (h*w+1)/2 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define ll long long
#define sz size()
#define all(x) x.begin(), x.end()
#define forn(x) for(int i=1;i<=x;i++) 
#define sforn(x, y) for(int i=1;i<=x;i++)for(int j=1;j<=y;j++)
#define pii pair<int, int>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){ speed;
    int a, b;
    cin >> a >> b;
    int c = 1, d=0;
    while(c<b){
        c-=1;
        c+=a;
        ++d;
    }
    cout << d << endl;
    return 0;
}

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


int main() {
  int H1,H2,M1,M2,K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int s,f,wake;
  s = H1*60 + M1;
  f = H2*60 + M2;
  wake = f - s;
  int ans;
  ans = wake - K;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
import collections
a=int(input())
b=list(map(str,input().split()))
n=[]
for i in b:
    x=i.replace(' ',',')
    n.append(x)
c=collections.Counter(n)
n,values=zip(*c.most_common())
d=list(values)

if d.count(1)==a:
    print('YES')
else:
    print('NO')

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

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	int index1 = 0;
	for (int i = 0; i < n; ++i) {
		cin >> v[i];
		if (v[i] == 1) {
			index1 = i;
		}
	}

	int ret = 0;
	ret += (n - 1) / (k - 1);
	if ((n - 1) % (k - 1) != 0) {
		ret++;
	}

	//ret += index1 / (k - 1);
	//if (index1 % (k - 1) != 0) {
	//	ret++;
	//}

	//ret += (n - index1 - 1) / (k - 1);
	//if ((n - index1 - 1) % (k - 1) != 0) {
	//	ret++;
	//}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int X, A;
    cin >> X >> A;
    if (X < A) cout << 0 << endl;
    else cout << 10 << endl;
    return 0;
}


Measured memory_bytes: 256
A,B,m=map(int,input().split())
ans=[]
a=list(map(int,input().split()))
b=list(map(int,input().split()))
for i in range(m):
    x,y,z=map(int,input().split())
    ans.append(a[x-1]+b[y-1]-z)
ans.append(min(a)+min(b))
print(min(ans))

Measured memory_bytes: 18608
#include <bits/stdc++.h>
using namespace std;
#define ll            long long
#define all(v)      (v).begin() , (v).end()
#define vi          vector <ll>
#define vii         vector <pair<ll,ll>>
#define ii          pair<int,int>
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb          push_back
#define pf          push_front
#define F           first
#define S           second
const ll MOD=1e9+7,MAX=1e5+1;
int n,m;
vector<int>adj[MAX],vis(MAX),ans(MAX);
void bfs(){
    queue<int>q;
    q.push(1);
    while(!q.empty()){
        int node=q.front();
        q.pop();
        for(int i:adj[node])
            if(!vis[i])
                vis[i]++,q.push(i),ans[i]=node;
    }
}

void fast();
int main()
{
    fast();
    cin>>n>>m;
    lp(i,0,m){
        int a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    bfs();
    bool flag=1;
    lp(i,2,n+1)
        if(!ans[i])
            flag=0;
    if(flag){
        cout<<"Yes\n";
        lp(i,2,n+1)
            cout<<ans[i]<<"\n";
    }
    else
        cout<<"No";

}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*
*/


Measured memory_bytes: 10640
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int s;
	cin>>s;
	int dp[s+1]={0};
	dp[0]=1;
	for(int i=1;i<=s;i++){
		for(int j=3;j<=s;j++){
			if(j>i)
				continue;
			(dp[i]+=dp[i-j])%=mod;
		}
	}
	cout<<dp[s]<<endl;
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define 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 MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a,b,c;
    cin >> a >> b >> c; 
    cout << a+b+c-max(max(a,b),c) << endl;
    return 0;
}

Measured memory_bytes: 384
import sys
from bisect import bisect_left
from itertools import accumulate
from operator import itemgetter

n, x = list(map(int, input().split()))
exams = []
norma = 0
for i, line in enumerate(sys.stdin):
    b, l, u = map(int, line.split())
    exams.append((u * x - b * (u - l), b, l, u, i))
    norma += b * l
exams_sorted = sorted(exams, reverse=True)
exams_acc = list(accumulate(map(itemgetter(0), exams_sorted)))
exams_loc = {i: loc for loc, i in enumerate(map(itemgetter(4), exams_sorted))}
# print(norma)
# print(exams_sorted)
# print(exams_acc)

ans = 10 ** 10
base_loc = bisect_left(exams_acc, norma)
base_ans = base_loc * x
base_remain_norma = norma - exams_acc[base_loc - 1] if base_loc > 0 else norma
# print(f'base_remain_norma:{base_remain_norma}')
for d, b, l, u, i in exams:
    exam_loc = exams_loc[i]
    if base_loc <= exam_loc:
        curr_ans = base_ans
        curr_remain_norma = base_remain_norma
    else:
        tmp_norma = norma + d
        tmp_loc = bisect_left(exams_acc, tmp_norma)
        curr_ans = (tmp_loc - 1) * x
        curr_remain_norma = tmp_norma - exams_acc[tmp_loc - 1]
    if curr_remain_norma <= b * l:
        extra = (curr_remain_norma - 1) // l + 1
    else:
        extra = (curr_remain_norma + b * (u - l) - 1) // u + 1
    # print(d, b, l, u, i)
    # print(f'exl:{exam_loc}  {int(base_loc <= exam_loc)}  norma:{curr_remain_norma}  curans:{curr_ans}  '
    #       f'extra:{extra}')
    if extra > x:
        continue
    ans = min(ans, curr_ans + extra)

print(ans)


Measured memory_bytes: 46064
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main() {
	int a[26] = {};
	char ch;
	while (cin >> ch) {
		if (isalpha(ch)) {
			if (isupper(ch))ch = tolower(ch);
			int num;
			num = ch - 'a';
			a[num]++;
		}
	}
	for (int i = 0;i < 26;i++) {
		printf("%c : %d\n", 'a' + i, a[i]);
	}
}


Measured memory_bytes: 3120
#include <iostream>
#define formula(i,X,Y) ((x[(i+1)%3]-x[(i+2)%3])*(Y-y[(i+1)%3])-(y[(i+1)%3]-y[(i+2)%3])*(X-x[(i+1)%3]))
#define check(i) formula(i,xp,yp)*formula(i,x[i],y[i])

using namespace std;

int main(void){
	float x[3],y[3],xp,yp;

	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp)
		cout << (check(0)>0&&check(1)>0&&check(2)>0 ? "YES" : "NO") << endl;

	return 0;
}

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

int main(void){
  int n, m, sum;
  cin >> n >>m;
  int a[m];
  sum =0;
  for (int i = 0; i < m; i++){
    cin >>a[i];
    sum +=a[i];
  }
  if(sum > n){
    cout <<-1;
  }else{
    cout << n - sum;
  }

  cout <<endl;
}

Measured memory_bytes: 3644
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
using static Func;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var s = GL;
		var max = 0L;
		for (var d = 1; d < N; d++)
		{
			int l = 0, r = N - 1;
			var used = new HashSet<int> { l, r };
			var sum = 0L;
			while (true)
			{
				l += d;
				r -= d;
				if (used.Contains(l) || used.Contains(r) || l == r || l >= N || r < 0 || r <= d) break;
				used.Add(l);
				used.Add(r);
				sum += s[l] + s[r];
				max = Max(max, sum);
			}
		}
		WriteLine(max);
	}
}
static class Func
{
	public const long InfL = 4011686018427387913L;
	public static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	public static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	public static T[] Recurse<T>(int n, T a0, Func<int, T, T> f) { var a = new T[n]; a[0] = a0; for (var i = 1; i < n; i++) a[i] = f(i, a[i - 1]); return a; }
	public static T[] Accumulate<T>(IList<T> a, T zero, Func<T, T, T> f) { var s = new T[a.Count + 1]; s[0] = zero; for (var i = 0; i < a.Count; i++) s[i + 1] = f(s[i], a[i]); return s; }
}


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

using namespace std;

typedef long long ll;

#define MAX (ll)1e7+1    //nCrのnの最大値+1

ll fac[MAX], inv[MAX], finv[MAX];

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

ll COM(ll n, ll k, ll mod) {
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * finv[k] % mod * finv[n-k] % mod;
}

int main() {
    ll n, k, mod = 1e9+7;    cin >> n >> k;
    ll *a = new ll[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];

    sort(a, a+n);
    COMinit(mod);

    ll ans = 0;
    for (int i = 0; i < n-k+1; i++) {
        ans -= a[i] * COM(n-i-1, k-1, mod) % mod;
        ans %= mod;
    }
    for (ll i = k-1; i <= n-1; i++) {
        ans += a[i] * COM(i, k-1, mod) % mod;
        ans %= mod;
    }

    ans = (mod + ans) % mod;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 238680
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        int u = scan.nextInt();
        int n = t + 1;
        int m = u + 1;
        int[][] a = new int[n][m];
       
        int i,r;
        for(i = 0; i < n - 1; ++i){
            for(r = 0; r < m - 1; ++r){
                a[i][r] = scan.nextInt();
                a[i][m - 1] += a[i][r];
                a[n - 1][r] += a[i][r];
                a[n - 1][m - 1] += a[i][r];
            }
        }
        for(i = 0; i < n; ++i){
            for(r = 0; r < m; ++r){
                if(r == m - 1){
                    System.out.println(a[i][r]);
                }
                else
                System.out.print(a[i][r]+" ");
                 
            }
        }
    }
}
        
 
 

Measured memory_bytes: 42204