akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll ac(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
vector<int> ans, f;
set<int> k;
vector<vector<int>> G;
void dfs(int v) {
	ans.push_back(v);
	for (auto n : G[v]) {
		if (f[n] == 0) {
			f[n] = 1;
			k.insert(n);
		}
	}
	if (k.size()) {
		int nv = *k.begin();
		k.erase(*k.begin());
		dfs(nv);
	}
}
int main()
{
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	rep(i, 0, n)cin >> a[i];
	sort(all(a));
	rep(i, 0, n)b[i] = a[i];
	int k;
	auto it = lower_bound(all(a), 0);
	if (it == a.end()) {
		it = a.end() - 1;
	}
	k = it - a.begin();
	if (k == 0)k++;
	rep(i, k, n - 1) {
		b[0] -= b[i];
	}
	rep(i, 1, k) {
		b[n - 1] -= b[i];
	}
	printf("%d\n", b[n - 1] - b[0]);
	rep(i, k, n - 1){
		printf("%d %d\n", a[0], a[i]);
		a[0] -= a[i];
	}
	rep(i, 1, k) {
		printf("%d %d\n", a[n - 1], a[i]);
		a[n - 1] -= a[i];
	}
	printf("%d %d\n", a[n - 1], a[0]);
	return 0;
}


Measured memory_bytes: 4016
from itertools import accumulate

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

D=[0]*(N+1)
for i in range(N-1):
    D[i+1]=A[i+1]-A[i]
D[-1]=K-A[-1]+A[0]
D.extend(D[1:])
D=list(accumulate(D))

ans=float('inf')
for l in range(1,N+1):
    r=l+N-1
    ans=min(ans,abs(D[r]-D[l]))
print(ans)

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    double ans = 0.0;
    rep(i, N){
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY"){
            ans += x;
        } else {
            ans += 380000.0 * x;
        }
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3788
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

struct Era {
  string name;
  ll start;
  ll span;
  Era() {;}
  Era(string name, int start, int span) : name(name), start(start), span(span) {;}
  bool operator<(const Era &rhs) const {
    return start < rhs.start;
  }
};

int main() {
  int n, m;
  while (scanf("%d %d", &n, &m), n|m) {
    set<Era> eras;
    REP(i, n) {
      string str;
      int span, start;
      cin >> str >> span >> start;
      eras.insert(Era(str, -start + span - 1, span));
    }
    REP(i, m) {
      int t;
      cin >> t;
      set<Era>::iterator it = eras.lower_bound(Era("", -t, 0));
      if (it == eras.end()) {
        puts("Unknown");
      } else {
        int s = t - -it->start;
        if (s < it->span) {
          cout << it->name << " " << s + 1 << endl;
        } else {
          puts("Unknown");
        }
      }
    }
  }
}

Measured memory_bytes: 1044
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#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++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll MOD = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0} };
ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll max(ll a, ll b) { return (a > b) ? a : b; }

template<typename T>
struct edge {

	int src, to;
	T cost;

	edge(int to, T cost) : src(-1), to(to), cost(cost) {}

	edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

	bool operator<(const edge<T> e1) {
		return cost < e1.cost;
	}


	edge &operator=(const int &x) {
		to = x;
		return *this;
	}

	operator int() const { return to; }

};
template<typename T>
using Edge = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edge<T>>;


template<typename T>
vector<T> dijkstra(WeightedGraph<T> &g, int s) {
	const auto INF = numeric_limits<T>::max();
	vector<T> dist(g.size(), INF);

	using Pi = pair<T, int>;

	priority_queue<Pi, vector<Pi>, greater<Pi>> q;

	dist[s] = 0;

	q.emplace(dist[s], s);

	while (!q.empty()) {
		T cost;
		int idx;

		tie(cost, idx) = q.top();
		q.pop();
		if (dist[idx] < cost) continue;

		for (auto &e : g[idx]) {
			auto next_cost = cost + e.cost;
			if (dist[e.to] <= next_cost) continue;
			dist[e.to] = next_cost;
			q.emplace(dist[e.to], e.to);

		}
	}
	return dist;
}

ll minilist[100005];

int main() {
	ll n, m, s, t;



	cin >> n >> m >> s >> t;
	s--;
	t--;
	rep(i, n + 1) {
		minilist[i] = inf;
	}


	 WeightedGraph<ll> ee(n), es(n);
	
	rep(i, m) {
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		u--;
		v--;
		ee[u].emplace_back(v, a);
		ee[v].emplace_back(u, a);
		es[u].emplace_back(v, b);
		es[v].emplace_back(u, b);

	}

	vector<ll> dist_e, dist_s;

	dist_e = dijkstra(ee, s);
	dist_s = dijkstra(es, t);

	for (int i = n-1; i >= 0; i--) {

		minilist[i] = min(minilist[i + 1], dist_e[i] + dist_s[i]);

	}

	for (int i = 0; i <= n - 1; i++) {
		cout << (ll)pow(10.0, 15.0) - minilist[i] << endl;
	}

	return 0;

}

Measured memory_bytes: 19068
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}

ll power(ll a, ll n, int mo){
	a%=mo;ll res=1;
	while(n){
		if(n&1)res=res*a%mo;a=a*a%mo;n>>=1;
	}
	return res;
}
ll gcd(ll a, ll b){return !b?a:gcd(b,a%b);}
ll getphi(ll n){
	ll res=n;
	for(ll i=2;i*i<=n;i++)if(n%i==0){
		while(n%i==0)n/=i;res=res/i*(i-1);
	}
	if(n>1)res=res/n*(n-1);
	return res;
}
void exgcd(ll a, ll b, ll &x, ll &y){
	if(!b){x=1;y=0;return;}
	exgcd(b,a%b,y,x);y-=a/b*x;
}
ll solve(int a, int m){
	if(m==1)return 1e9+7;
	ll phi=getphi(m),g=gcd(m,phi);
	ll k=solve(a,g);
	ll f=(power(a,k,m)-k)/g,e,d;
	exgcd(phi/g,m/g,e,d);e=(e*f%(m/g)+m/g)%(m/g);
	return k+e*phi;
}
int main() {
	int T;read(T);while(T--){
		int a,m;read(a);read(m);
		ll res=solve(a,m);
		printf("%lld\n",res);
		assert((power(a,res,m)-res)%m==0);
	}
	return 0;
}


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

using namespace std;
using LL = long long;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

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

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

    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    REP(i, n) cin >> a[i] >> b[i] >> c[i];

    vector<vector<int>> dp(n+1, vector<int>(3, 0));
    REP(i, n){
        dp[i+1][0] = max(dp[i][1] + a[i], dp[i][2] + a[i]);
        dp[i+1][1] = max(dp[i][0] + b[i], dp[i][2] + b[i]);
        dp[i+1][2] = max(dp[i][0] + c[i], dp[i][1] + c[i]);
    }
    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

Measured memory_bytes: 6912
using System;

namespace Balance{
	class Balance{
		static void Main(String[] args){
			int N = int.Parse(Console.ReadLine());
			string[] sW_i = Console.ReadLine().Split(' ');
			int[] W = new int[N];
			for(int i = 0;i < N;i++){
				W[i] = int.Parse(sW_i[i]);
			}

			int Sum=0;
			foreach(int W_i in W){
				Sum += W_i;
			}

			int ParSum = 0;
			int abs = 100 * 200;
			foreach(int W_i in W){
				ParSum += W_i;
				int Sa = Math.Abs(Sum - 2 * ParSum);
				if(abs > Sa)abs = Sa;
			}

			Console.WriteLine(abs);
		}
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <random>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
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 ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	string s ; cin >> s ;
	if(s.at(s.size()-1)=='s') s += 'e' ;
	s += 's' ;
	cout << s << endl ;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  double w,h,x,y;
  cin >> w>>h>>x>>y;
  double ans;
  ans=w*h/2;
  if(x*2==w && y*2==h ){
    printf("%lf 1",ans);
  }else{
    printf("%lf 0",ans);
  }
}

    


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

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

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

    return arr

n = int(input())
F = factorization(n)
counter = 0
for a in range(len(F)):
    B = int((-1+(1+8*F[a][1])**0.5)/2)
    counter += B

if F[0][0] == 1:
    print(0)
else:
    print(counter)

Measured memory_bytes: 9316
#include<bits/stdc++.h>
using namespace std;
#define Elhabashy ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
const int N=23,mod=1e9+7;
typedef long long ll;
int n ,arr[N][N],dp[N][1<<N];
int solve(int i=0,int msk=0){
    if(i==n)return 1;
    int &ret=dp[i][msk];
    if(~ret)return ret;
    ret=0;
    for(int j=0;j<n;j++){
        if(arr[i][j]==1 && !((1<<j)&msk)){
            ret+=solve(i+1,msk|(1<<j));
            ret%=mod;
        }

    }
    return ret;
}
int main()
{
    Elhabashy
    input();
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)cin>>arr[i][j];
    }
    memset(dp,-1,sizeof dp);
    cout<<solve()%mod<<endl;
}


Measured memory_bytes: 757284
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int len = sc.nextInt();
		String s = sc.next();
		int count = 0;
		String s1 = s.replace("ABC", "");
		int diff = s.length()-s1.length();
		System.out.println(diff/3);
	}

}

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

#define lld long long
#define pi pair<int,int>
#define pl pair<lld,lld>
#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())

int main() {
    lld K;
    cin >> K;
    
    lld S=0;
    for (int i = 1; i <= 1000000; i++) {
        S = (S*10+7)%K;
        if(S == 0){
            cout << i << endl;
            exit(0);
        }
    }
    cout << "-1" << endl;
}

Measured memory_bytes: 3608
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d\n%d\n%d",&a,&b,&c);
  if(a==b+c){
    printf("Yes");
  }else if(b==a+c){
    printf("Yes");
  }else if(c==a+b){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 128
def main(n,x):
    res = 2**31-1
    for i in range(1,101):
        val = 0
        for j in range(len(x)):
            val += (x[j] - i)**2
        res = min(res, val)
    return res

n = int(input())
x = list(map(int, input().split()))
print(main(n,x))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
vector<LL> make_divisors(LL n){vector<LL> divisors;for(int i = 1; i <= sqrt(n); i++) {if(n%i == 0){divisors.push_back(i);if(i != n/i){divisors.push_back(n / i);}}}return divisors;}
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

//両端のバーの合計が等しくなる！
//M kg以上はダメ！ Mkg以下で一番大きい値を出力する
int main(void){
    int N;
    cin >> N;

    vector<int> A(N);
    rep(i, N) cin >> A[i];

    double ave = 0;
    ave = accumulate(ALL(A), 0.0)/N;

    int rewrite_num = ave-floor(ave) > ceil(ave)-ave?ceil(ave):floor(ave);

    int ans = 0;
    rep(i,N){
        ans += (A[i]-rewrite_num)*(A[i]-rewrite_num);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
map<int,int>vis;
int flag[200005];
int main()
{
  int n, m, a, ok=0, res=0, c=0;
 
  cin>>n>>m;
  string s;
  while(m--)
  {
    cin>>a>>s;
    if(s=="AC"&&flag[a]==0)
    {
        c++;
      flag[a]=1;
      res=res+vis[a];
      vis[a]=0;
    }
    else if(s=="WA"){
        vis[a]++;
     }
   }
   cout<<c<<" "<<res<<endl;
 
}

Measured memory_bytes: 5376
import javax.swing.event.InternalFrameListener;
import java.io.*;
import java.text.*;
import java.util.*;

public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000");
        long maxi = Integer.MAX_VALUE;
        long mod = (long) (1e9 + 7);
        int n;
        long a[];

        class pair {
            long a, b;

            pair(long a, long b) {
                this.a = a;
                this.b = b;
            }
        }

        void solve() {
            n = sc.ni();
            a = sc.nal(n);
            pair dp[][] = new pair[n][n];
            for (int i = 0; i < n; i++) {
                dp[i][i] = new pair(a[i], 0);
            }
            for (int l = 2; l <= n; l++) {
                for (int i = 0; i < n - l + 1; i++) {
                    int j = i + l - 1;
                    long c1, c2;
                    c1 = dp[i + 1][j].b + a[i];
                    c2 = dp[i][j - 1].b + a[j];
                    if (c1 > c2) {
                        dp[i][j] = new pair(c1, dp[i + 1][j].a);
                    } else
                        dp[i][j] = new pair(c2, dp[i][j - 1].a);
                }
            }
            out.println(dp[0][n - 1].a - dp[0][n - 1].b);
        }
    }
}


Measured memory_bytes: 227796
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
    int n,ans=0;
    scanf("%d",&n);
    for(int i=1;i<=2*n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+2*n);
    for(int i=1;i<=2*n;i+=2) ans+=min(a[i],a[i+1]);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int d,t,s;
	cin >> d >> t >> s;
	isYes(t * s >= d);
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
		public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			int A1 = sc.nextInt();
			int A2 = sc.nextInt();
			int A3 = sc.nextInt();
			
			int sum = A1 + A2+ A3;
			
			if(sum >= 22) {
				System.out.println("bust");
			}else {
				System.out.println("win");
			}
			
}
}

Measured memory_bytes: 22608
import java.util.*;
public class Main{
  static int[] dp;
  static ArrayList<Integer>[] graph;
  public static void dfs(int v){
    if(graph[v].size()==0)return;
    int a = 0;
    for(Integer e:graph[v]){
      if(dp[e]==0)dfs(e);
      a=Math.max(a,dp[e]);
    }
    dp[v] = a+1;
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    dp = new int[n+1];
    graph = new ArrayList[n+1];
    for(int i=1;i<=n;i++)graph[i] = new ArrayList<Integer>();
    boolean[] has = new boolean[n+1];
    Arrays.fill(has,false);
    for(int i=1;i<=m;i++){
      int x = sc.nextInt();
      int y = sc.nextInt();
      graph[x].add(y);
      has[y]=true;
    }
    for(int i=1;i<=n;i++){
      if(!has[i])dfs(i);
    }
    int ans = 0;
    for(int i=1;i<=n;i++)ans=Math.max(ans,dp[i]);
    System.out.println(ans);
  }
}

Measured memory_bytes: 111552
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

S=input()
N=len(S)
ans=0
i=0
a=0
while i<N:
    if S[i]=='A':
        a+=1
        i+=1
    elif i<N-1 and S[i]=='B' and S[i+1]=='C':
        ans+=a
        i+=2
    else:
        a=0
        i+=1
print(ans)

Measured memory_bytes: 74344
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;

int main()
{
    ifstream fin("date.in");
    int H, W, **drumuri;
    char **matrice;
    cin >> H >> W;
    matrice = new char*[H];
    drumuri = new int*[H];
    for(int i = 0 ; i < H ; i++){
      matrice[i] = new char[W]();
      drumuri[i] = new int[W]();
    }

    for(int i = 0 ; i < H ; i++)
      for(int j = 0 ; j < W ; j++)
         cin >> matrice[i][j];
   for(int i = 1 ; i < H ; i++){
      if(matrice[i][0] != '#')
         drumuri[i][0] = 1;
      else break;
   }
   for(int i = 1 ; i < W ; i++){
      if(matrice[0][i] != '#')
         drumuri[0][i] = 1;
      else break;

   }
    for(int i = 1 ; i < H ; i++)
      for(int j = 1 ; j < W ; j++)
         if(matrice[i][j] == '.'){
            if(matrice[i-1][j] == '.')
               drumuri[i][j] += drumuri[i-1][j];
            if(matrice[i][j-1] == '.')
               drumuri[i][j] += drumuri[i][j-1];
            drumuri[i][j] = drumuri[i][j] % (10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 + 7);
         }

   cout << drumuri[H-1][W-1];
    return 0;
}


Measured memory_bytes: 5120
#include<iostream>
using namespace std;
int main(){
	
	int a,b;
	cin>>a>>b;
	if(a==b){
		cout<<a+b;
	}
	else if(a<b){
		cout<<b+b-1;
	}
	else cout<<a+a-1;
	
	cout<<endl;
	
	
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IO std::ios::sync_with_stdio(false); cin.tie(0)
#define int long long
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define INF (int)1e18

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

signed main() {
  IO;
  int k;
  cin >> k;
  int tmp = 0;
  int ans = -1;
  for (int i = 1; i < 1000000; i++) {
    tmp = tmp * 10 % k + 7;
    tmp %= k;
    if (tmp == 0) {
      ans = i;
      break;
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}

int main(void){
	int n;
	cin>>n;
	int a;
	ll ansp=0,ansm=0;
	ll memop=0,memom=0;
	rep(i,n){
		cin>>a;
		memop+=a;
			memom+=a;
		if(i%2==0){
			if(memop>0){

			}else{
				ansp -= memop-1;
				memop = 1;
			}

			if(memom<0){

			}else{
				ansm += memom+1;
				memom = -1;
			}
		}else{
			if(memop<0){

			}else{
				ansp += memop+1;
				memop = -1;
			}

			if(memom>0){

			}else{
				ansm -= memom-1;
				memom = 1;
			}
		}
	}
	cout<<min(ansm,ansp)<<endl;
	return 0;
}

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

#include <bits/stdc++.h>


#define ll long long
#define ull unsigned long long
//#define int ll
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

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

const int N = 1e6 + 1 , LOG = 18;
int n ;
int a[N];

main(){
//	cin >> n;
	scanf("%d" , &n);
	multiset < int > st , qu;
	for(int i = 1; i <= (1 << n); i++){
		int x;
		scanf("%d" , &x);
		st.insert(-x);
	}
	qu.insert(*st.begin());
	st.erase(st.find(*st.begin()));		
	for(int i = 1 ; i <= n; i++){
		vector < int > dq;
		for(auto to : qu){
			auto it = st.upper_bound(to);

			if(it == st.end())
				ret("No");
			dq.pb(*it);
			st.erase(it);
		}
		for(auto to : dq)
			qu.insert(to);
	}
	ret("Yes");
}

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

const int mod = 1e9 + 7;
const long long inf = 1e18;

int qn, tot;
long long n, m, fib[100];
vector<pair<long long, long long> > a[100];

int main() {
	fib[0] = fib[1] = 1;
	tot = 1;
	while (1) {
		fib[tot + 1] = fib[tot] + fib[tot - 1];
		if (fib[tot + 1] > inf) break;
		++tot;
	}
	a[1].push_back(make_pair(1, 2));
	a[1].push_back(make_pair(1, 3));
	a[1].push_back(make_pair(1, 4));
	for (int i = 1; i < tot - 2; ++i) {
		vector<pair<long long, long long> >::iterator it;
		for (it = a[i].begin(); it != a[i].end(); ++it) {
			long long x = it->first, y = it->second;
			x += y;
			while (x <= fib[i + 3] + fib[i]) {
				a[i + 1].push_back(make_pair(y, x));
				x += y;
			}
		}
	}
	for (scanf("%d", &qn); qn; --qn) {
		scanf("%lld%lld", &n, &m);
		if (n > m) swap(n, m);
		int ans_max = 1;
		while (fib[ans_max + 1] <= n && fib[ans_max + 2] <= m) ++ans_max;
		printf("%d ", ans_max);
		if (ans_max == 1)
			printf("%d\n", static_cast<int>(n * m % mod));
		else {
			long long cnt = 0;
			vector<pair<long long, long long> >::iterator it;
			for (it = a[ans_max - 1].begin(); it != a[ans_max - 1].end(); ++it) {
				long long x = it->first, y = it->second;
				if (y <= n) (cnt += (m - x) / y) %= mod;
				if (y <= m) (cnt += (n - x) / y) %= mod;
			}
			printf("%d\n", static_cast<int>(cnt % mod));
		}
	}
}

Measured memory_bytes: 4096
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>


using namespace std;
using ll = long long;

int main()
{
	int N = 0;
	vector <ll> vec(200000);
	vector <ll> vec1(200000);
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> vec[i];
		vec1[i] = vec[i];
	}
	sort(vec.begin(), vec.end(), greater<ll>());
	for (int i = 0; i < N; i++)
	{
		if (vec1[i] == vec[0]) cout << vec[1] << endl;
		else cout << vec[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 4736
/* -> Written by <-
   -----------
  |K_A_Z_A_M_A|
  |___________|
  |    _    |
  |   (^_^)   |
  |  /( | )\  |
  |____|_|____|
    H O A N G
*/

#define Task ""
#define F first
#define S second
#define push_back pb
#define bit(x, i) (x >> i) & 1
#define inf 1e9
#define INF 1e18
#define fr(i, a, b) for (int i = (a); i <= (b); i ++)
#define FR(i, a, b) for (int i = (a); i < (b); i ++)


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <string>
#include <sstream>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;
const int maxn = 2e5 + 5;

int n;
int a[maxn], b[maxn];

void Solve(int test_case)
{
    cin >> n;
    for (int i = 1, x, y; i <= n; i ++)
    {
        cin >> x >> y;
        a[i] = x - y;
        b[i] = x + y;
    }
    sort(a + 1, a + 1 + n);
    sort(b + 1, b + 1 + n);
    cout << max(a[n] - a[1], b[n] - b[1]);
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    if(fopen(Task".inp", "r"))
    {
        freopen(Task".inp","r",stdin);
        freopen(Task".out","w",stdout);
    }
    int test_case = 1;
//    cin >> test_case;
    for (int i = 1; i <= test_case; i ++)
        Solve(i);
    return 0;
}


Measured memory_bytes: 5196
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;
 
ll gcd(ll a, ll b)
{
  	if(a>b) swap(a, b);
	if(a==0) return b;
  	else return gcd(b%a, a);
}
 
ll lcm(ll a, ll b)
{
	return (a/(gcd(a, b)))*b;
}
 
int main()
{
	int n;
  	ll ans=1;
  	ll a[110];
  	cin >> n;
  	rep(i, n)
    {
      cin >> a[i];
      ans=lcm(a[i], ans);
    }
  	cout << ans << endl;
	return 0;
}

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

int main(){
  double X=0.0, Y=0.0, Z=0.0;
  double i=1.0;

  cin >> X >> Y >> Z;
  i = (X-Z)/(Z+Y);

  cout << (int)i << endl;
  return 0;
}


Measured memory_bytes: 256
s=input()
t=input()
S,T=[0]*(len(s)+1),[0]*(len(t)+1)
for i in range(len(s)):
  if s[i]=="A":
    S[i+1]=S[i]+1
  else:
    S[i+1]=S[i]-1
for i in range(len(t)):
  if t[i]=="A":
    T[i+1]=T[i]+1
  else:
    T[i+1]=T[i]-1
q=int(input())
for i in range(q):
  a,b,c,d=map(int,input().split())
  ss=S[b]-S[a-1]
  tt=T[d]-T[c-1]
  if (ss-tt)%3==0:
    print("YES")
  else:
    print("NO")


Measured memory_bytes: 11540
#include<bits/stdc++.h>
using namespace std;
#define Rep(i,n,m) for(int i = (int)(n);i < (int)(m);i++)
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl 

int main()
{
    string s,t;
    cin >> s >> t;
    bool is = false;
    int N = s.size();
    char a = 'a';
    Rep(i,0,N)
    {
        a = s[N - 1];
        s = a + s;
        s.erase(N);
        if(s == t)
            is = true;
    }
    Yes(is);
}

Measured memory_bytes: 256
from sys import stdin
input = stdin.readline


def main():
  N = int(input())

  if N % 2:
    print(0)
    return

  nz = 0
  i = 1
  while True:
    if N//(5**i)//2 > 0:
      nz += (N//(5**i)//2)
      i += 1
    else:
      break

  print(nz)


if(__name__ == '__main__'):
  main()


Measured memory_bytes: 61972
#include <iostream>

using namespace std;

int n, x, ok=1;
int main()
{
    cin>>n;
    for (int i=1; i<=n; i++)
    {
        cin>>x;
        if (x%2==0 && x%3!=0 && x%5!=0) ok=0;
    }
    if (ok) cout<<"APPROVED";
    else cout<<"DENIED";
}


Measured memory_bytes: 256
import itertools

s1 = input()

N = int(s1.split()[0])
M = int(s1.split()[1])
Q = int(s1.split()[2])

a = []
b = []
c = []
d = []

s = [input() for i in range(Q)]

for k in range(Q):
  a.append(int(s[k].split()[0]))
  b.append(int(s[k].split()[1]))
  c.append(int(s[k].split()[2]))
  d.append(int(s[k].split()[3]))
  
result = 0
  
suretu = []
for i in range(M):
  suretu.append(i+1)
  
for A in list(itertools.combinations_with_replacement(suretu, N)):
  A = list(A)
  subresult = 0
  for i in range(Q):
    if A[b[i]-1] - A[a[i]-1] == c[i]:
      subresult += d[i]
  if result < subresult:
    result = subresult
    
print(result)

Measured memory_bytes: 21496
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
 
signed main(){
 
	lli n,x;
	cin>>n>>x;
	vector<lli> l(n);
	REP(i,0,n)cin>>l[i];
 
	vector<lli> d;
	d.push_back(0);
	lli ans = 0;
	REP(i,0,n){
		lli now = d[i];
		lli next = now+l[i];
		if(next > x){
			ans = i+1;
			cout<<ans<<endl;
			return 0;
		}
		d.push_back(now+l[i]);
	}
	cout<<n+1<<endl;
 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main() {
  string S; cin >>S;
  for (int i='a';i<='z';i++) {
    bool flag=false;
    for (int j=0;j<S.size();j++) {
      if (S[j]==char(i)) {
        flag=true;
        break;
      }
    }
    if (!flag) {
      cout <<char(i) <<endl;
      return 0;
    }
  }
  cout <<"None" <<endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main tr = new Main();
		tr.test(sc);
		sc.close();
	}

	void test(Scanner sc){
		char[] S = sc.nextLine().toCharArray();
		char[] T = sc.nextLine().toCharArray();
		if(S.length==1){
			System.out.println("Yes");return;
		}

		Arrays.sort(S);
		Arrays.sort(T);
		int[] fS = new int[26];
		char p = S[0];
		int c=1;
		int sidx = 0;
		for (int i = 1; i < S.length; i++) {
			if(p==S[i]){
				c++;
			}else{
				fS[sidx++] = c;
				c=1;
			}
			p=S[i];
		}
		fS[sidx++] = c;

		int[] fT = new int[26];
		p = T[0];
		c=1;
		int tidx = 0;
		for (int i = 1; i < T.length; i++) {
			if(p==T[i]){
				c++;
			}else{
				fT[tidx++] = c;
				c=1;
			}
			p=T[i];
		}
		fT[tidx++] = c;

		if(tidx != sidx){
			System.out.println("No");
			return;		
		}
		Arrays.sort(fS, 0, sidx);
		Arrays.sort(fT, 0, tidx);
		for (int i = 0; i < sidx; i++) {
			if(fS[i]!= fT[i]){
				System.out.println("No");
				return;
			}
		}


		System.out.println("Yes");


	}
}


Measured memory_bytes: 32160
#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>;

vector<ll> enumDivisor(ll n) {
  vector<ll> res;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i != 0) continue;
    res.push_back(i);
    if (i * i != n) res.push_back(n / i);
  }
  return res;
}

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

  // n の約数について条件を調べる
  int ans = 0;
  for (ll x : enumDivisor(n)) {
    if (x == 1) continue;
    ll tmp = n;
    while (tmp % x == 0) tmp /= x;
    if (tmp % x == 1) ans++;
  }

  // n - 1 の約数はすべて条件を満たすので足す。ただし 1 は除く
  ans += enumDivisor(n - 1).size() - 1;

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3716
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	vector<int> a(3), b(2);
	rep(i, 3) cin >> a[i];
	rep(i, 2) cin >> b[i];

	int ans = INF;
	rep(i, 3) {
		rep(j, 2) {
			ans = min(ans, a[i] + b[j] - 50);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1192
#include "bits/stdc++.h"
 
using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;
typedef pair<pair<double, double >, double > pdd;
typedef pair<double, double > pd;  
vector<ll > vec;
vector<vector<ll > > vec2;
vector<vector<ll > > G;
ll MOD = 1000000007;
ll INF = 1145141919454519;
ll N, M, S, T;
 
int main(){
    
    cin >> N >> M;
    //初期化
    G.assign(N, vector<ll >());
    vector<vector<ll > > conf(N, vector<ll >(3, INF));
 
    //グラフ入力
    for(ll i = 0; i < M; i++){
        ll u, v;
        cin >> u >> v;
        u--; v--;
        //有向グラフです
        G[u].push_back(v);
    }
    
    //スタートとゴールの入力
    cin >> S >> T;
    S--; T--;
 
    //BFS
    conf[S][0] = 0;
    queue<pi > que;
    que.push(make_pair(S, 0));
 
    while(!que.empty()){
        //現在地
        ll from = que.front().first;
        //歩数
        ll step = que.front().second;
        que.pop();

        //けん, けん, ぱの「ぱ」のタイミングでゴールにたどりつきたい
        if(from == T && step % 3 == 0){
            cout << step / 3 << endl;
            return 0;
        }
 
        for(ll i = 0; i < G[from].size(); i++){
            //すでに探査済み
            //次の地点に向かうとけん, けん, ぱのどのフェーズになるか
            ll to = G[from][i];
            ll phase = (step + 1) % 3;
            //
            if(conf[to][phase] != INF) continue;
 
            conf[to][phase] = conf[from][step % 3] + 1;
            que.push(make_pair(to, conf[to][phase]));
        }
    }

    cout << -1 << endl;
 
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main(){ 
	int MOD=1000000007;
	long long n,k,cnt=0;
	cin>>n>>k;
	for(long long i=k;i<=n+1;i++){
		cnt+=(i*(n-i+1)+1)%MOD;
		cnt=cnt%MOD;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
 
    vvl c(3, vl(3));
    rep(i, 3) {
        rep(j, 3) {
            cin >> c[i][j];
        }
    }
 
    ll b0 = c[0][0];
    ll b1 = c[0][1];
    ll b2 = c[0][2];
    ll a1 = c[1][0] - b0;
    ll a2 = c[2][0] - b0;
 
    if(a1+b1 == c[1][1] && a1+b2 == c[1][2] && a2+b1 == c[2][1] && a2+b2 == c[2][2]) {
        out("Yes");
    }
    else {
        out("No");
    }
 
    re0;
}

Measured memory_bytes: 256
array_to_str = lambda A: ' '.join([str(a) for a in A])
input_number = lambda: int(input())
input_num_array = lambda: [int(a) for a in input().split()]

def bubble_sort(A, N):
  flag = 1
  exchange_num = 0
  while flag:
    flag = 0
    for j in range(N)[:0:-1]:
      if A[j] < A[j-1]:
        exchange_num += 1
        A[j],A[j-1] = A[j-1], A[j]
        flag = 1
  print(array_to_str(A))
  print(exchange_num)
  
N = input_number()
A = input_num_array()
bubble_sort(A, N)


Measured memory_bytes: 5604
#include<iostream>
using namespace std;
int main(){
	int m,n,x,y;
	cin>>n>>m>>x>>y;
	int a[111],b[111];
	int x1=100,y1=-100,x2=100,y2=-100;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]<x1)
			x1=a[i];
		if(a[i]>y1)
			y1=a[i];	
	}
	for(int i=1;i<=m;i++){
		cin>>b[i];
		if(b[i]<x2)
			x2=b[i];
		if(b[i]>y2)
			y2=b[i];
	}
	bool f=false;
	for(int i=x+1;i<=y;i++){
		if(i>y1&&i<=x2)
			f=true;
	}
	
	
	if(f==true)
		cout<<"No War"<<endl;
	else 
		cout<<"War"<<endl;
		
	
	
	
} 

Measured memory_bytes: 256
// 2020 04 26 ABC 164
// B Battle
#include <algorithm>
#include <complex>
#include <string>
#include <deque>
#include <iostream>
#include <set>
#include <stack>
#include <string>
#include <queue>
#include <utility>
#include <vector>
#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 A, B, C, D;
    cin >> A >> B >> C >> D;
    // HP, ATK, HP, ATK
    int cnt_t, cnt_a;
    
    while (1) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            break;
        }

    }
    


    return 0;
}

Measured memory_bytes: 3636
N    = int(input())
T, A = map(int, input().split())
H    = list(map(int, input().split()))

D = 99999999
R = 0

for i, h in enumerate(H):
    d = abs(A - (T - h * 0.006))
    if D > d:
        D = d
        R = i + 1

print(R)


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

typedef long long ll;
ll N,maximtypeone=-1e9,minimtypeone=1e9,maximtypetwo=-1e9,minimtypetwo=1e9;

void Input(){
	cin>>N;
	ll a,b;
	for(int i=0; i<N; i++){
		cin>>a>>b;
		ll typeone=a+b,typetwo=a-b;
		maximtypeone=max(maximtypeone,typeone);
		maximtypetwo=max(maximtypetwo,typetwo);
		minimtypeone=min(minimtypeone,typeone);
		minimtypetwo=min(minimtypetwo,typetwo);
	}
	cout<<max(maximtypetwo-minimtypetwo,maximtypeone-minimtypeone)<<'\n';
}

int main(){
	Input();
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { int n;
  cin >> n;
  if(n/10==9||n%10==9){
    puts("Yes");
  }else{
    puts("No");
  }
}

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

int cnt[100001] = {0};

int main() {
	int n, x;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		cnt[x]++;
	}

	for (int i = 0; i <= 1e5; i++) {
		if (cnt[i]) {
			if (cnt[i] % 2 == 0)
				cnt[i] = 2;
			else cnt[i] = 1;
		}
	}

	int ans = 0, two = 0;
	for (int i = 0; i <= 1e5; i++) {
		if (cnt[i]) {
			ans++;
			if (cnt[i] == 2)
				two++;
		}
	}

	if (two % 2 == 1)
		ans--;
	printf("%d\n", ans); 
    return 0;
}

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

#define MAX_INT 0x3f3f3f3f 
#define acc(x) setprecision(x)
#define boost ios_base::sync_with_stdio(false); 	cin.tie(NULL);

int main()
{
	boost;
	long long int n;
	cin >> n;
	vector<long long int> v;
	for(int i=0;i<n;i++)
	{
	    long long int k;
	    cin >> k;
	    v.push_back(k);
	}
	long long int curr_max = 0,ans = 0;
	for(int i=0;i<n;i++)
	{
	    if(v[i]<curr_max)
	    {
	        ans+=curr_max-v[i];
	    }
	    curr_max = max(curr_max,v[i]);
	}
	cout << ans << "\n";
}

Measured memory_bytes: 5276
#include "bits/stdc++.h"
#pragma optimize("unroll-loops");
#pragma optimize("Ofast");
//#include "pch.h"    
using namespace std;

#ifdef DEBUG_BUILD
#  define DEBUG(x) cerr << x
#else
#  define DEBUG(x) do {} while (1)
#endif

#define imie(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)

using ll = long long;
const int nax = 1e6 + 10;

vector<int> primes;
ll lcm(ll a, ll b) {
    return (a*b)/__gcd(a, b);
}

vector<bool> prime(nax, true);

int main() {
    ll answer = 0;
    ll k; cin >> k;
    
    for(ll a = 1; a <= k; ++a) {
        for(ll b = 1; b <= k; ++b) {
            for(ll c = 1; c <= k; ++c) {
                answer += __gcd(a, __gcd(b, c));
            }
        }
    }
    cout << answer << "\n";
}


Measured memory_bytes: 3756
s = int(input())
 
memo = {}
memo[s] = 1

for i in range(10000000):
  if s%2==0:
    s = s//2
    if s in memo:
      print(i+2)
      break
    memo[s] = 1
  else:
    s = 3*s+1
    if s in memo:
      print(i+2)
      break
    memo[s] = 1

Measured memory_bytes: 3060
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n, a, b = rli()
    print(min(a*n, b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <vector>
using namespace std; 
#define ll long long
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define rep2(i,a,b) for(ll i=a;i>=b;i--)
int main(int argc, char** argv) {
	ll n,m;
	cin>>n>>m;
	if((n*m)%2==0&&n!=1&&m!=1)
	{
		cout<<(n*m)/2;
	}
	else if(n!=1&&m!=1)
	{
		cout<<(n*m)/2+1;
	}
	else printf("1");
	return 0;
}

Measured memory_bytes: 256