akhauriyash/Code-Regression huggingface dataset:
N, M = map(int, input().split())

dp =[[float("inf") for _ in range(2 ** N)] for _ in range(M + 1)]
dp[0][0] = 0

for i in range(M):
    A, B = map(int, input().split())
    C = list(map(int, input().split()))
    x = sum([2 ** (c - 1) for c in C])
    for j in range(2 ** N):
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])
        dp[i + 1][x|j] = min(dp[i][j] + A, dp[i + 1][x|j])

ans = dp[M][2 ** N - 1]
if ans != float("inf"):
    print(ans)
else:
    print(-1)

Measured memory_bytes: 138504
#include <bits/stdc++.h>
using namespace std;
int main(){
	int nVacationDays, nAssignments;
	cin >> nVacationDays >> nAssignments;
	int totalAssignmentDays(0);
	
	for(int i = 0; i < nAssignments; i++){
		int curADay;
		cin >> curADay;
		totalAssignmentDays += curADay;
	}
	
	int nDaysLeft = nVacationDays - totalAssignmentDays;
	if(nDaysLeft <= -1){
		nDaysLeft = -1;
	}
	cout << nDaysLeft;
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
using namespace std;
int main(){
	unsigned long long int a,b,x,ans=0;
	cin>>a>>b>>x;
	if(a!=0){
		cout<<b/x-((a-1)/x)<<endl;
	}
	else{
		cout<<b/x+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N, W = [int(i) for i in input().split()]
weight, value = [0] * (N), [0] * (N)
for i in range(N):
    weight[i], value[i] = [int(i) for i in input().split()]

#%%

sum_value = sum(value)
dp = [[float("inf")] * (sum_value + 1) for _ in range(N + 1)]
dp[0][0] = 0

#%%

for i in range(N):
    for j in range(sum_value + 1):
        if j >= value[i]:
            dp[i + 1][j] = min(weight[i] + dp[i][j - value[i]], dp[i + 1][j])
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

#%%

ans = 0
for i in range(sum_value + 1):
    if dp[N][i] <= W:
        ans = i
        
print(ans)


Measured memory_bytes: 311888
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		@SuppressWarnings("unused")
		int c = Integer.parseInt(sc.next());
		sc.close();
		System.out.println(a*b/2);
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 5e5+7;
const int mod=1e9+7;
ll qpow(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ans;
}
 
ll fac[M],inv[M];
ll f[M],dp[M];//错排 
ll A(int n,int m){
	return fac[m]*inv[m-n]%mod;
}
ll C(int n,int m){
	return fac[m]*inv[n]%mod*inv[m-n]%mod;
}
int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	int n,m,N=5e5;
  	cin>>n>>m;fac[0]=inv[0]=1;
	for(int i=1;i<=m;i++)fac[i]=fac[i-1]*i%mod,inv[i]=qpow(fac[i],mod-2);
	f[2]=1;for(int i=3;i<=m;i++)f[i]=(f[i-1]+f[i-2])*(i-1)%mod;
	ll ans=0;
	//n个位置不同 
	for(int i=0;i<=n;i++)//至少几个位置相同
	{
	//	cout<< ans<<"  "<<i<<"  - "<<C(i,n)<<"  "<<A(n-i,m-i)<<endl;
		ll tp=C(i,n)*A(n-i,m-i)%mod;
		
		if(i&1)ans=(ans-tp+mod)%mod;
		else ans=(ans+tp)%mod;
	}
	cout<<ans*A(n,m)%mod<<endl;
	return 0;
}

Measured memory_bytes: 15336
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner  scan=new Scanner(System.in);
         int x=-1;
         int y=-1;
          while(!(x==0&&y==0)){
          x=scan.nextInt();
          y=scan.nextInt();
        	  if(x==0&&y==0)
        		  break;
    	  if(x<=y)
    		  System.out.println(x+" "+y);
          else
             System.out.println(y+" "+x);
    	   
          }
          
        
         
    }
 
}


Measured memory_bytes: 35880
def main():
    N = int(input())
    LR = [tuple(map(int, input().split())) for _ in range(N)]
    LR.sort(key=lambda x: x[1])
    l1, r1 = LR[0]
    l2, r2 = LR[1]
    def ss(a, b, c, d):
        l, r = max(a, c), min(b, d)
        return r - l + 1 if l <= r else 0

    for l, r in LR[2:]:
        t1 = ss(l1, r1, l, r) + (r2 - l2)
        t2 = ss(l2, r2, l, r) + (r1 - l1)
        t3 = ss(l1, r1, l2, r2) + (r - l)
        if t3 == max(t1, t2, t3):
            l1, r1 = max(l1, l2), min(r1, r2)
            if l1 > r1:
                l1 = r1 + 1
            l2, r2 = l, r
        elif t1 > t2:
            l1, r1 = max(l1, l), min(r1, r)
            if l1 > r1:
                l1 = r1 + 1
        else:
            l2, r2 = max(l2, l), min(r2, r)
            if l2 > r2:
                l2 = r2 + 1
    return r1 - l1 + r2 - l2 + 2


print(main())


Measured memory_bytes: 18196
k, a, b = map(int, input().strip().split())
if a+2 >= b:
  print(k + 1)
elif (k + 1) < (a+2):
  print(k + 1)
else:
  # k のあまり
  _k = k - (a - 1 + 2)
  # b への回数
  a2b = _k // 2
  print(b + a2b*(b-a) + _k%2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

bool E[110][110] = {};
int n, k;

void output() {
    vector<pii> ans;

    REP(i, 1, n + 1) REP(j, i + 1, n + 1) {
        if (E[i][j]) ans.push_back(MP(i, j));
    }

    cout << ans.size() << endl;
    for (auto p : ans) {
        cout << p.first << " " << p.second << endl;
    }
    exit(0);
}

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

    cin >> n >> k;
    if (k > (n - 1) * (n - 2) / 2) finish();

    REP(i, 1, n + 1) REP(j, i + 1, n + 1) E[i][j] = true;

    int cnt = 0;
    if (k == 0) output();

    REP(i, 2, n + 1) REP(j, i + 1, n + 1) {
        E[i][j] = false;
        cnt++;
        if (cnt == k) output();
    }

    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <limits>
#include <cstdlib>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

static constexpr ll mod = 1000000007LL;

ll add(ll a, ll b){
    return (a + b) % mod;
}

ll sub(ll a, ll b){
    return (a + mod - b) % mod;
}

ll mul(ll a, ll b){
    return ((a % mod) * (b % mod)) % mod;
}

ll power(ll a, ll b){
    if (b == 0) return 1;
    else if (b == 1) return a % mod;
    else if (b % 2 == 0){
        ll p = power(a, b / 2);
        return p * p % mod;
    }
    else return a * power(a, b-1) % mod;
}

ll div(ll a, ll b){
    return mul(a, power(b, mod-2));
}

int main() {
    ll N, M;
    cin >> N >> M;

    if (N < M) swap(N, M);
    if (N - M > 1 ) cout << 0 << endl;
    else {
        ll n_factorial{1};
        for (auto &&i: irange(1LL, N+1)){
            n_factorial = mul(n_factorial, i);
        }
        ll m_factorial{1};
        for (auto &&i: irange(1LL, M+1)){
            m_factorial = mul(m_factorial, i);
        }
        ll ret{mul(n_factorial, m_factorial)};
        if (N==M) ret = mul(ret, 2LL);
        cout << ret << endl;
    }

    return 0;
}

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


#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

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

    if (n / 100 == n % 10) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N, K;
  cin >> N >> K;
  long ans = 0;
  REP1(b, N) // b = 1 ~ N
  {
    // a = 0 ~ Nとして考える
    int p = (N + 1) / b;
    int r = (N + 1) % b;
    ans += p * max(0, b - K);
    ans += max(0, r - K);
    if (K == 0)
      ans--;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int N, n1, n2, n3, n4;
  
  cin >> N;
  
  n4 = N / 1000;
  n3 = (N - (n4 * 1000)) / 100;
  n2 = (N - (n4 * 1000) - (n3 * 100)) / 10;
  n1 = N - (n4 * 1000) - (n3 * 100) - (n2 * 10);
  
  if (n3 == n2) {
    if (n4 == n3) {
      cout << "Yes" << endl;
    }
    else if (n1 == n3) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
/*
Wai u read my code xD
*/
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


void solve()
{
    ll h, n; cin >> h >> n;
    ll s = 0, a;
    for (ll i = 0; i < n; i++)
    {
        cin >> a;
        s += a;
    }
    if (s>=h) nout("Yes");
    else nout("No");
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

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

int main(void) {
  int H, A, cnt=0;
  cin >> H >> A;
  
  for(int i=0; i<100000; i++){
    H -= A;
    cnt++;
    if(H <= 0) break;
  }
  
  cout << cnt << endl;
  
  return 0;
}

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

typedef long long ll;

int a, b;

void solve(string s, int ac, int bc) {
  if(ac == a && bc == b) {
    cout << s << endl;
    return;
  }
  if(ac == 5 && bc == 5) return;
  if(ac <= 3 && bc >= 5) return;
  if(bc <= 3 && ac >= 5) return;
  if(ac < a) {
    solve(s + 'A', ac + 1, bc);
  }
  if(bc < b) {
    solve(s + 'B', ac, bc + 1);
  }
}

int main() {
  cin >> a >> b;

  solve("", 0, 0);
}

Measured memory_bytes: 3136
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


int C[20], A[20][20];

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

	int N, M, X;
	cin >> N >> M >> X;
	for (int i = 0; i < N; i++) {
		cin >> C[i];
		for (int j = 0; j < M; j++)cin >> A[i][j];
	}


	int cost = 1e9 + 10;
	for (int i = 0; i < (1 << N); i++) {
		vector<int>v(M);
		int tmp = 0;
		for (int j = 0; j < N; j++) {
			if (i & (1 << j)){
				for (int k = 0; k < M; k++)v[k] += A[j][k];
				tmp += C[j];
			}
		}

		int ok = 1;
		for (int j = 0; j < M; j++) { if (v[j] < X)ok = 0; }
		if (!ok)continue;
		cost = min(cost, tmp);
	}
	if (cost > 1e9)puts(-1);
	else puts(cost);
	return 0;
}

Measured memory_bytes: 3616
n = int(input())

x = 0
d = {}
for i in range(n):
  s = "".join(sorted(list(input())))
  
  if s in d:
    d[s] = d[s] + 1
    x += d[s]
  else:
    d[s] = 0

print(x)
    
#同じsが複数回出るとだめ
#s = ["".join(sorted(list(input()))) for i in range(n)]
#u = list(set(s))
#print(n - len(u))

Measured memory_bytes: 17936
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();

		if (s[0] != 'A') {
			pr.println("WA");
		} else {
			int cnt = 0;
			for (int i = 2; i < s.length - 1; i++) {
				if (s[i] == 'C') {
					cnt++;
				}
			}

			if (cnt != 1) {
				pr.println("WA");
			} else {
				int cp = 0;
				for (char c : s) {
					if (c >= 'A' && c <= 'Z') {
						cp++;
					}
				}
				
				if (cp != 2) {
					pr.println("WA");
				} else {
					pr.println("AC");
				}
			}
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


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

#define LL long long
#define Dl double
#define Pb push_back
#define Mp make_pair

using namespace std;

typedef vector<LL> Vl;
typedef pair<LL, LL> Pll;
typedef vector<Pll> Vpl;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
#define X first
#define Y second

LL l;
typedef struct
{
    string s;
} str;

bool cmp(str A, str B)
{
    for(LL i = 0; i < l; i++){
        if(A.s[i] != B.s[i])
            return A.s[i] < B.s[i];
    }
    return 0;
}

int main()
{
    LL n;
    cin >> n >> l;

    str xx[110];
    for(LL i = 0; i < n; i++)
        cin >> xx[i].s;

    sort(xx, xx + n, cmp);
    for(LL i = 0; i < n; i++)
        cout << xx[i].s;

    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

Mii p;
int x[4] = {500,100,50,10};
int rx[4] = {10,50,100,500};

int main()
{
	bool f = false;
	while(1) {
		int n;
		cin >> n;
		if (!n) break;
		if (!f) f = true;
		else cout << endl;
		cin >> p[10] >> p[50] >> p[100] >> p[500];
		int a = p[10] + p[50] + p[100] + p[500];

		int ans = inf;
		int anss[4] = {};
		int used = inf;
		rep(i,0,p[10]+1) rep(j,0,p[50]+1) rep(k,0,p[100]+1) rep(l,0,p[500]+1) {
			int sum = i*10 + j*50 + k*100 + l*500;
			if (sum < n) continue;

			int b = 0;
			int y[4] = {};
			rep(m,0,4)  if (sum - n >= x[m]) {
				int c = (sum-n) / x[m];
				sum -= c * x[m];
				y[m] = c;
			}
			int use_cnt = i+j+k+l;
			int ret_cnt = y[0]+y[1]+y[2]+y[3];
			int have = a - use_cnt + ret_cnt;
			
			if (have <= ans) {
				if (have == ans && use_cnt >= used) continue;
				ans = have;
				used = use_cnt;
				//printf("i=%d j=%d k=%d l=%d y[0]=%d y[1]=%d y[2]=%d y[3]=%d\n",i,j,k,l,y[0],y[1],y[2],y[3]);
				anss[0] = i;
				anss[1] = j;
				anss[2] = k;
				anss[3] = l;
			}

		}
		rep(m,0,4) {
			if (anss[m]) cout << rx[m] << " " << anss[m] << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1196
n = input()
if len(n)%2==1:
  print('No')
  exit()
for i in range(len(n)):
  if i%2==0:
    if n[i]!='h':
      print('No')
      exit()
  else:
    if n[i]!='i':
      print('No')
      exit()
print('Yes')

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

struct Point{ double x, y; };

void koch(int n, Point a, Point b){
    if(n==0) return;

    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) +s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) +s.y;

    koch(n-1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n-1, t, b);
}

int main(){
    Point a, b;
    int n;

    scanf("%d", &n);

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}


Measured memory_bytes: 2732
#include <iostream>
#include <algorithm>
#include <string>

#define maxN 100001

typedef long maxn;
typedef std::string str;

str s;
maxn n, le[maxN], ri[maxN], res[maxN];


void Prepare() {
	std::cin >> s;
	n = s.size();

	ri[0] = 0;
	for (maxn i = 1; i < n; i++) ri[i] = std::max(ri[i - 1], i * (s[i] == 'R'));

	le[n - 1] = n - 1;
	for (maxn i = n - 2; i >= 0; i--) le[i] = std::min(le[i + 1], i + n * (s[i] != 'L'));
}


void Process() {
	for (maxn i = 0; i < n; i++) {
		if (s[i] == 'R') ++res[le[i] - ((le[i] - i) & 1)];
		else ++res[ri[i] + ((i - ri[i]) & 1)];
		--res[i];
	}

	for (maxn i = 0; i < n; i++) std::cout << res[i] + 1 << ' ';
}


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

	Prepare();
	Process();
}

Measured memory_bytes: 3024
#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for (llong i = 0; i < times; i++)
#define rloop(i, times) for (llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif


int main(void)
{
//	ABC123B abc123b;
//	abc123b.Run();

	llong k;
	llong a[5];
	loop(i, 5)
		cin >> a[i];
	cin >> k;

	rloop(i, 5)
	{
		if (a[i] - a[0] > k)
		{
			cout << ":(";
			return 0;
		}
	}

	cout << "Yay!";
	
	return 0;
}

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

int main(int argc, char const *argv[])
{
	int n, id;
	double m, a;
	std::vector<int> arr;

	for (;;)
	{
		cin >> n; if(n == 0) break;
		arr.clear(); m = 0; a = 0;

		for (int i = 0; i < n; ++i)
		{
			cin >> id;
			arr.push_back(id);
			m += id;
		}
		m /= n;

		for (int i = 0; i < n; ++i)		
			a += (arr[i] - m)*(arr[i] - m);
		a /= n;

		cout << setprecision(10) << sqrt(a) << endl;
	}
	return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SC second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll cnt = 0;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}


int main()
{
  vector<int> mas(9) ;
  REP(i,9){
    cin >> mas.at(i) ;
  }
  if(mas.at(6)-mas.at(0)==mas.at(7)-mas.at(1) && mas.at(7)-mas.at(1)==mas.at(8)-mas.at(2)){
    if(mas.at(3)-mas.at(0)==mas.at(4)-mas.at(1) && mas.at(4)-mas.at(1)==mas.at(5)-mas.at(2)){
      cout <<"Yes" <<endl ;
      return 0 ;
    }
  }
  
  cout <<"No" <<endl ;


  return 0 ;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
int mpow(int k,int n,const int MOD){
    int res = 1;
    for(int i=0;i<n;i++) res=res*k%MOD;
    return res;
  }
using namespace std;

signed main() {
  int N;
  int ans;
  cin>>N;
  int out=0;
  int k;
  std::vector<int> v(N,0);
  for(int i=0;i<N;i++){
    cin>>k;
    v[k]++;
  }
  if(N%2){
    for(int i=0;i<N;i++){
      if(i==0)if(v[i]!=1)out++;
      if(i%2)if(v[i]!=0)out++;
      if(i%2==0&&i!=0)if(v[i]!=2)out++;
    }
    if(out)cout<<0<<endl;
    else{
      ans=mpow(2,N/2,1e9+7);
      while(ans>=1000000007)ans-=1000000007;
      cout<<ans<<endl;
    }
  }
  else{
    for(int i=0;i<N;i++){
      if(i%2)if(v[i]!=2)out++;
      if(i%2==0)if(v[i]!=0)out++;
    }
    if(out)cout<<0<<endl;
    else{
      ans=mpow(2,N/2,1e9+7);
      while(ans>=1000000007)ans-=1000000007;
      cout<<ans<<endl;
    }
  }
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
long long Max = LONG_MAX;
int n, ar[100050] = {};
long long dp[100005] = {};
void findSolution(int pos, int pre, int k)
{
    if(dp[pos] != Max)
    {
        long long d = abs(ar[pre]-ar[pos]);
        d += dp[pos];
        dp[pre] = min(dp[pre], d);
        return;
    }
    if(pos == n)
    {
        long long d = abs(ar[pos]-ar[pre]);
        d += dp[pos];
        dp[pre] = min(dp[pre], d);
        return;
    }
    for(int i = 1; i <= k; i++)
    {
        if(pos+i <= n)
        {
            findSolution(pos+i, pos, k);
        }
    }
    dp[pre] = min(dp[pre], abs(ar[pre]-ar[pos])+dp[pos]);
}
void solve()
{
    scanf("%d", &n); int k; scanf("%d", &k);
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &ar[i]);
    }
    for(int i = 0; i <= n+2; i++)
    {
        dp[i] = Max;
    }
    dp[n] = 0;
    findSolution(1, 0, k);
    cout << dp[1] << endl;
}
int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 12740
def InsertionSort(A, N):
    for i in range(N):
        v = A[i]       # A[i]は未ソート部分の先頭
        j = i - 1
        while j >= 0 and A[j] > v: 
            A[j+1] = A[j]  # vよりも大きい要素を一つ右に移動させる
            j -= 1     # 比較する位置を移動
        A[j+1] = v     # 空いた部分にvを入れる
        print(*A)

N = int(input())
A = list(map(int, input().split()))

InsertionSort(A, N)


Measured memory_bytes: 5976
#include<cstdio>
#include<algorithm>
using namespace std;
long long minb=10000000000,a,b,n;
bool flag;
long long ans;
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d%d",&a,&b);
		ans+=b;
		if(a>b) {
			minb=min(b,minb);
			flag=1;
		}
		if(a!=b)
			flag=1;
	}
	if(flag)
		printf("%lld",ans-minb);
	else
		puts("0");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

const int mod = 1000000007;
const int kcomb_max = 510000;

long long fact[kcomb_max], fact_inv[kcomb_max], inv[kcomb_max];

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;

    for (int i = 2; i < kcomb_max; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int k)
{
    if (n < k) {
        return 0;
    }
    if (n < 0 || k < 0) {
        return 0;
    }
    return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

int main()
{
    init_comb();

    int n, m, k;
    std::cin >> n >> m >> k;

    long long ans = 0;
    long long comb_value = comb(m * n - 2, k - 2);
    for (int x_distance = 1; x_distance < m; x_distance++) {
        ans += ((x_distance * n * n) % mod * ((m - x_distance) * comb_value) % mod) % mod;
        ans %= mod;
    }

    for (int y_distance = 1; y_distance < n; y_distance++) {
        ans += ((y_distance * m * m) % mod * ((n - y_distance) * comb_value) % mod) % mod;
        ans %= mod;
    }

    std::cout << ans << std::endl;
}


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

int main(void) {
    u_int N;
    std::vector<std::vector<u_long>> dp;
    std::vector<u_int> seq;

    /*
     * 入力と初期化
     */
    std::cin >> N;
    seq.reserve(N);
    dp.resize(N);
    for (u_int i = 0; i < N; ++i) {
        u_int tmp;
        std::cin >> tmp;
        seq.push_back(std::move(tmp));
        dp[i].resize(21, 0);  // 見割り当てを0とする
    }

    /*
     * DPで解く
     */
    dp[0][seq[0]] = 1;  // 初期値
    for (u_int i = 1; i < N - 1; ++i) {
        for (u_int j = 0; j < 21; ++j) {
            if (dp[i - 1][j] > 0) {
                if (j + seq[i] <= 20) {
                    dp[i][j + seq[i]] += dp[i - 1][j];
                }
                if (j >= seq[i]) {
                    dp[i][j - seq[i]] += dp[i  -1][j];
                }
            }
        }
    }
    std::cout << dp[N - 2][seq[N - 1]] << std::endl;

    return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
int k;
long long a[100000];
long long left(long long x,long long y){
    long long l=0;
    long long r=1e18/x;
    while(l<r){
        long long m=(l+r)/2;
        if(x*m<y)l=m+1;
        else r=m;
    }
    return x*l;
}
long long right(long long x,long long y){
    long long l=0;
    long long r=1e18/x;
    while(l<r){
        long long m=(l+r)/2;
        if(x*m<=y)l=m+1;
        else r=m;
    }
    return x*(l-1);
}
int main(){
    scanf("%d",&k);
    for(int i=0;i<k;i++)scanf("%lld",&a[i]);
    if(a[k-1]!=2)return 0*puts("-1");
    long long l=2;
    long long r=3;
    for(int i=k-2;i>=0;i--){
        long long x=left(a[i],l);
        long long y=right(a[i],r);
        if(x>y)return 0*puts("-1");
        l=x;
        r=y+a[i]-1;
    }
    printf("%lld %lld\n",l,r);
    return 0;
}

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

using namespace std;

#define FOR(i, a, b) for (int(i) = a; (i) <= (b); ++(i))
#define rep(i, n) FOR(i, 0, n-1 )
#define all(c) (c).begin(), (c).end()
#define mod 1000000007LL
#define INF 123456789012345
#define int long long

bool ok[205];
int sosu[6] = {3,5,7,11,13,17};

signed main() {
  int n;cin>>n;
  rep(i,n+1) ok[i] = false;
  ok[135] = true;
  ok[189] = true;

  rep(i,(1<<6))
  {
    int cnt = 0;
    int ans = 1;
    rep(j,6)
    {
      if((i>>j)&1) 
      {
        cnt++;
        ans *= sosu[j];
      }
      
    }
    if(cnt != 3) continue;
    if(ans > 200) continue;

    ok[ans]= true;
  }

  int kotae = 0;

  rep(i,n) if(ok[i+1])kotae++;
  
  cout << kotae << endl; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int R, G, B, n;
  cin >> R >> G >> B >> n;
  int ans = 0;
  rep(r, 0, 3001) {
    rep(g, 0, 3001) {
      int t = r * R + g * G;
      if (t > n)
        break;
      if ((n - t) % B)
        continue;
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
/*************************************************************************
  > File Name: a.cpp
  > Author: Samuel
  > Mail: enminghuang21119@gmail.com
  > Created Time: Sat Apr  4 19:53:16 2020
*************************************************************************/

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a,b ,c;
    cin >> a >> b >> c;
    cout << c << ' ' << a << ' '<< b;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>
#include <stack>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator<< (ostream &out, const vector<int> &b) {
    for (auto k : b) out << k << " ";
    return out;
}

istream& operator>> (istream& in, pii& b) {
    in >> b.first >> b.second;
    return in;
}

ostream& operator<< (ostream& out, const pii& b) {
    out << "{" << b.first << ", " << b.second << "}";
    return out;
}

template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1;} return 0;}


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 10;
#else
    #define dbg(x) 57
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
#endif

const ld PI = acos(-1);

#define time clock() / (double) CLOCKS_PER_SEC

// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")  
// #pragma GCC optimize("section-anchors")
// #pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
// #pragma GCC optimize("vpt")
// #pragma GCC optimize("rename-registers")
// #pragma GCC optimize("move-loop-invariants")
// #pragma GCC optimize("unswitch-loops")
// #pragma GCC optimize("function-sections")
// #pragma GCC optimize("data-sections")

mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

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

    int n, x, m;
    cin >> n >> x >> m;
    vector<int> a;
    int val = x;
    set<int> used;
    while (val != 0 && !used.count(val)) {
        used.insert(val);
        a.pb(val);
        val = val * val % m;
    }
    if (val == 0 || (int)a.size() > n) {
        int ans = 0;
        for (int i = 0; i < min((int)a.size(), n); i++) {
            ans += a[i];
        }
        cout << ans << "\n";
        return 0;
    }
    reverse(all(a));
    int ans = 0;
    while (a.back() != val) {
        ans += a.back();
        a.pop_back();
        n--;
    }
    reverse(all(a));
    int sum = 0;
    for (auto k : a) {
        sum += k;
    }
    assert((int)a.size() > 0);
    ans += sum * (n / (int)a.size());
    for (int i = 0; i < n % (int)a.size(); i++) {
        ans += a[i];
    }
    cout << ans << "\n";
}
/*

*/

Measured memory_bytes: 5912
#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;
    map<int, int> x;
    int wild = 0;
    rep(i, n) {
        int a; cin >> a;
        if(a<3200) x[a/400]++;
        else wild++;
    }
    int sz = x.size();
    printf("%d %d\n", max(sz, 1), sz+wild);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const ll INF = ll(2e18);
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll x; cin>>x;
	cout<<((x-1)/11)*2LL + 1 + (((x-1)%11)>5)<<'\n';
}


Measured memory_bytes: 384
import sys
from heapq import *
def input(): return sys.stdin.readline().strip()


def func(left):
    ll = len(left)
    """
    前から順番に詰めていく方式だと次の反例が存在する：
    ll = 2, left = [(1, 1), (2, 2), (3, 100)]
    (3, 100)をなるべく先頭に置くべきだが、前のコードだと３番目が車で保留。
    ll < 3なのでその時は訪れない。

    なのでやはり後ろから攻めるしかない模様。
    """
    L = [[] for _ in range(ll + 1)]
    for k, v in left:
        if k > ll: k = ll
        L[k].append(v)
    ans = 0
    q = []
    for i in range(ll, 0, -1):
        for v in L[i]: heappush(q, -v)
        if q: ans -= heappop(q)
    return ans


def main():
    T = int(input())
    for _ in range(T):
        n = int(input())
        ans = 0
        left = []
        right = []
        for _ in range(n):
            k, l, r = map(int, input().split())
            if l > r:
                ans += r
                left.append((k, l - r))
            else:
                ans += l
                right.append((n - k, r - l))
        #print("left={}".format(left))
        #print("right={}".format(right))
        ans += func(left)
        ans += func(right)
        print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 113844
import java.util.*;

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

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

int main(){
        int n;
        cin >> n;
        for(int i = 1; i <= n; i++){
                if(i % 3 == 0)
                        cout << " " << i;
                else{
                        int x = i;
                        while(x){
                                if(x % 10 == 3){
                                        cout << " " << i;
                                        break;
                                }
                                x /= 10;
                        }
                }
        }
        cout << endl;
}


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

int S(int64_t n)
{
    int result = 0;
    while (n) {
        result += n % 10;
        n /= 10;
    }
    return result;
}


int main()
{
    vector<int64_t> ten(15 + 1);
    ten[0] = 1;
    for (int i = 1; i <= 15; ++i) {
        ten[i] = ten[i - 1] * 10;
    }

    vector<int64_t> nums;
    for (int nines = 0; nines <= 15; ++nines) {
        for (int i = 1; i < 10000; ++i) {
            int64_t num = i * ten[nines] + ten[nines] - 1;
            if (num <= 1e15) {
                nums.push_back(num);
            }
        }
    }
    sort(nums.begin(), nums.end());
    nums.erase(unique(nums.begin(), nums.end()), nums.end());

    vector<int64_t> result;
    double curmin = 1e15;
    for (int i = nums.size() - 1; i >= 0; --i) {
        int64_t num = nums[i];
        double nsn = double(num) / S(num);
        if (nsn <= curmin) {
            result.push_back(num);
            curmin = nsn;
        }
    }
    
    reverse(result.begin(), result.end());
    int k;
    cin >> k;
    for (int i = 0; i < k; ++i) {
        cout << result[i] << endl;
    }
}


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

int main() {
  int n, k;
  cin >> n >> k;
  
  int dist = 0;
  REP(i, n) {
    int tmp;
    cin >> tmp;
    dist += min(tmp * 2, (k - tmp) * 2);
  }
  
  cout << dist << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] l = new int[n];
		long count = 0;
		for(int i = 0; i < n; i++)
			l[i] = sc.nextInt();
		Arrays.parallelSort(l);
		for(int i = n-1; i >= 2; i--) {
			for(int a = i-1; a >= 1; a--) {
				for(int b = a-1; b >= 0; b--) {
					if(l[i] < l[a]+l[b]) {
						count++;
					}else {
						break;
					}
				}
			}
		}
		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 30048
fun main(args: Array<String>) {
    val n = readLong()
    val set = setOf('7', '5', '3')
    var count = 0

    fun dfs(x: Long) {
        if (x > n) return
        if (x.toString().toSet() == set) count++
        for (c in set) {
            dfs(x * 10 + Character.getNumericValue(c))
        }
    }
    
    dfs(0L)
    println(count)
}

private fun read() = readLine()!!

private fun readInt() = read().toInt()

private fun readLong() = read().toLong()

private fun readDouble() = read().toDouble()

private fun readStringList(): MutableList<String> = read().split(" ").toMutableList()

private fun readIntList(): MutableList<Int> = readStringList().map { it.toInt() }.toMutableList()

private fun readLongList(): MutableList<Long> = readStringList().map { it.toLong() }.toMutableList()

private fun readDoubleList(): MutableList<Double> = readStringList().map { it.toDouble() }.toMutableList()

private fun readStringMatrix(n: Int): MutableList<MutableList<String>> {
    val matrix = mutableListOf<MutableList<String>>()
    for (i in 0 until n) {
        val list = readStringList()
        matrix.add(list)
    }
    return matrix
}

private fun readIntMatrix(n: Int): MutableList<MutableList<Int>> {
    val matrix = mutableListOf<MutableList<Int>>()
    for (i in 0 until n) {
        val list = readIntList()
        matrix.add(list)
    }
    return matrix
}

private fun readDoubleMatrix(n: Int): MutableList<MutableList<Double>> {
    val matrix = mutableListOf<MutableList<Double>>()
    for (i in 0 until n) {
        val list = readDoubleList()
        matrix.add(list)
    }
    return matrix
}

private fun readLongMatrix(n: Int): MutableList<MutableList<Long>> {
    val matrix = mutableListOf<MutableList<Long>>()
    for (i in 0 until n) {
        val list = readLongList()
        matrix.add(list)
    }
    return matrix
}



Measured memory_bytes: 54652
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on

int a, b, c;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b >> c;
  vector<int> A = {a, b, c};
  sort(A.begin(), A.end());

  cout << A[0] + A[1] << endl;

  return 0;
}


Measured memory_bytes: 256
/* This Code Is Nude */
#include <bits/stdc++.h>
     
#define pb push_back
#define ll long long
#define int long long
 
using namespace std;
     
const ll inf = 1e12 + 10;
const int maxn = 2e5 + 10;
const int MOD = 998244353;
 
int a[maxn];
 
int32_t main(){
	string s;
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Clue = Tuple!(long, "x", long, "y", long, "h");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto c = new Clue[](n);
    foreach (i; iota(n))
    {
        long x, y, h;
        scan(x, y, h);
        c[i] = Clue(x, y, h);
    }
    foreach (i; 0 .. 101)
    {
        outer: foreach (j; 0 .. 101)
        {
            long h;
            bool flag = true;
            foreach (e; c)
            {
                if (e.h > 0)
                {
                    auto tmp_h = e.h + abs(e.x - i) + abs(e.y - j);
                    if (h)
                        flag &= (tmp_h == h);
                    else
                        h = tmp_h;
                }
                if (!flag)
                    break;
            }
            if (flag)
            {
                // 本当に合ってる?
                foreach (e; c)
                {
                    if (max(h - abs(e.x - i) - abs(e.y - j), 0) != e.h)
                        continue outer;
                }
                writefln("%s %s %s", i, j, h);
                return;
            }
        }
    }
    assert(0);
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#define ll long long
#define maxn 5010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static int buf[20],len; len=0;
	if(x<0)x=-x,putchar('-');
	for(;x;x/=10)buf[len++]=x%10;
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]+'0');
}
inline void writeln(ll x){write(x); putchar('\n');}
inline void writesp(ll x){write(x); putchar(' ');}
int f[maxn];
ll sum[maxn];
int n,mod;
int main()
{
	n=read(); mod=read();
	f[n]=1;
	for(int i=1;i<n;i++){
		int val=std::min(i,n-i+1);
		for(int i=n;i;i--){
			sum[i]=f[i];
			if(i+val<=n)sum[i]+=sum[i+val];
		}
		for(int i=1;i<=n;i++)
			f[i]=sum[i]%mod;
	}
	ll ans=0;
	for(int i=1;i<=n;i++)
		ans=(ans+(ll)i*f[i])%mod;
	writeln(ans);
	return 0;
}

Measured memory_bytes: 384
from fractions import gcd
def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x
  
n=int(input())

t = [int(input()) for i in range(n)] 

print(lcm(t))

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

int main(){
    string s;
    int m=1000000;
    cin>>s;
    for(int i=0; i<s.size()-2; i++){
        int a = (s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0')*1;
        m = min(m, abs(753-a));
    }
    
    cout<<m<<endl;
    return 0;
}

Measured memory_bytes: 256
I=lambda:map(int,input().split());F=1e21;r=range;n,m=I();f=[-F,F];X=[0]+f;Y=X[:];R=[(f,F),(f,-F)];H=[(F,f),(-F,f)]
for i in r(n):a,b,c=I();R+=[((a,b),c)];Y+=[c];X+=[a,b]
for i in r(m):a,b,c=I();H+=[(a,(b,c))];X+=[a];Y+=[b,c]
def g(X):
 s=dict(enumerate(sorted(set(X))));K=len(s);h={s[i]:i for i in s}
 return s,K,h
s,K,h=g(X);t,L,w=g(Y);V=[[0]*-~K for i in r(L+1)];U=[i[:]for i in V];v=[i[:]for i in V]
for(a,b),c in R:U[w[c]][h[a]]+=1;U[w[c]][h[b]]+=-1
for i in r(L):
 for j in r(K):U[i][j+1]+=U[i][j]
for d,(e,f)in H:V[w[e]][h[d]]+=1;V[w[f]][h[d]]+=-1
for j in r(K):
 for i in r(L):V[i+1][j]+=V[i][j]
q=[(h[0],w[0])];v[w[0]][h[0]]=1;a=0
while q:
 x,y=q.pop();a+=(s[x]-s[x+1])*(t[y]-t[y+1])
 for e,f in[(-1,0),(1,0),(0,1),(0,-1)]:
  c=x+e;d=y+f
  if(K>c>=0<=d<L)*v[d][c]==0:
   if U[(f>0)+y][x]|e==0 or V[y][(e>0)+x]|f==0:q+=[(c,d)];v[d][c]=1
if a>F:a='INF'
print(a)

Measured memory_bytes: 551348
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N,m;
	cin >> N;
	vector<int> S(N);
	for (size_t i = 0; i < N; i++)
	{
		cin >> S.at(i);
	}
	sort(S.begin(), S.end());
	for (size_t i = 0; i < N-1; i++)
	{
		if (S.at(i)==S.at(i+1))
		{
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
	
}

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

int main() {
    double r;
    cin >> r;
    double pi = 3.141592653589793238;
    cout << setprecision(30) << pi * r * 2 << endl;
    return 0;
}

Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)
#define ALL(x) (x).begin(),(x).end()
template<class T>bool umax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool umin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

template<typename A,size_t N,typename T> void FILL(A (&array)[N],const T &val){fill((T*)array,(T*)(array+N),val);}
template<typename T> void FILL(vector<T> &v, const T &x) {fill(v.begin(), v.end(), x);}
template<typename T> void FILL(vector<vector<T>> &v, const T &x) {for(auto &i:v)fill(i.begin(), i.end(), x);}

int main() {
  int n,k; cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  int mx = 0, g = a[0];
  rep(i,n) {
    umax(mx, a[i]);
    g = gcd(g, a[i]); 
  }

  if(mx < k || k % g) puts("IMPOSSIBLE");
  else puts("POSSIBLE");
}


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

int main(){
  int n,b,f,r,v;
  cin >> n;
  int F1[5][11]={0};
  int F2[5][11]={0};
  int F3[5][11]={0};
  int F4[5][11]={0};

  for(int i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    if(b==1) F1[f][r]+=v;
    if(b==2) F2[f][r]+=v;
    if(b==3) F3[f][r]+=v;
    if(b==4) F4[f][r]+=v;
  }

  for(int k=1;k<=4;k++){
    for(int i=1;i<=3;i++){
      for(int j=1;j<=10;j++){
	if(k==1) cout << " " << F1[i][j];
	if(k==2) cout << " " << F2[i][j];  
	if(k==3) cout << " " << F3[i][j];
	if(k==4) cout << " " << F4[i][j]; 
      }
      cout << endl;
    }
    if(k!=4)cout << "####################" << endl;
  }
}
 



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

ll digit(ll n){
  ll num = 0;
  while(n != 0){
    n /= 10;
    num++;
  }
  return num;
}

double snuke(ll n){
  ll N = n;
  ll sum = 0;
  while(n != 0){
    sum += n % 10;
    n /= 10;
  }
  return (double)N / (double)sum;
}

ll f(ll N){
  ll d = digit(N) + 2;
  ll m = N;
  for(int i = 0; i <= d; i++){
    ll c = pow(10,i+1)*(N/pow(10,i+1) + 1) - 1;
    if(snuke(c) < snuke(m)) m = c;
  }
  return m;
}

int main(){
  ll K;
  cin >> K;
  ll N = 1;
  cout << 1 << endl;
  for(int i = 1; i < K; i++){
    cout << f(N+1) << endl;
    N = f(N+1);
  }
  return 0;
}


Measured memory_bytes: 256