akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

auto bit_bruteforce(int n) {
    vector<vector<int>> p(1 << n);
    for (auto i = 0; i < (1 << n); ++i) {
        for (auto bit = 0; bit < n; ++bit) {
            if (i & (1 << bit)) {
                p[i].push_back(1);
            } else {
                p[i].push_back(0);
            }
        }
    }
    return p;
}

int main(void) {
    int n;
    cin >> n;
    vector<int>c(n);
    vector<int>v(n);
    for(auto & x : v){
        cin >> x;
    }
    for(auto & x : c){
        cin >> x;
    }

    auto p = bit_bruteforce(n);
    auto val = 0;
    for (const auto& sp : p) {
        auto cval = 0;
        for(auto i = 0; i < n; ++i){
            cval += sp[i]*(v[i] - c[i]);
        }
        val = max(val, cval);
    }
    cout << val;
    return 0;
}

Measured memory_bytes: 172288
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MAX_N 200000

using namespace std;
typedef pair<int, int> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

int N;
ipair tasks[MAX_N]; //(B, A)
int main(int argc, char **argv) {
    cin >> N;
    for(int i = 0; i < N; ++i) {
        cin >> tasks[i].second >> tasks[i].first;
    }

    sort(tasks, tasks + N);

    bool res = true;
    int sum = 0;
    for(int i = 0; i < N; ++i) {
        sum += tasks[i].second;
        if(sum > tasks[i].first) {
            res = false;
            break;
        }
    }

    cout << (res ? "Yes" : "No") << endl;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    unsigned long cnt{0};
    for(unsigned long i{0}, d1, d2; i < N; ++i){
        cin >> d1 >> d2;
        if(d1 == d2){
            if(++cnt == 3)return 0 & puts("Yes");
        }else cnt = 0;
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 3672
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

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

	Int N;
	cin >> N;

	vector<Int> t(N);
	vector<Int> a(N);
	for (Int i = 0; i < N; i++) {
		cin >> t[i] >> a[i];
	}

	Int temp;
	Int b, c;
	for (Int i = 0; i < N-1; i++) {
		if (t[i + 1] < t[i] || a[i + 1] < a[i]) {
			//temp = max((t[i] + (t[i + 1] - 1)) / t[i + 1], (a[i] + (a[i + 1] - 1)) / a[i + 1]);
			b = (t[i] + (t[i + 1] - 1)) / t[i + 1];
			c = (a[i] + (a[i + 1] - 1)) / a[i + 1];
			temp = max(b, c);

			t[i + 1] *= temp;
			a[i + 1] *= temp;
		}
	}

	cout << t[N - 1]+ a[N - 1] << "\n";

}

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

ll a,b,c,d,n,m,k;
ll ans=100000000000;

string s;

int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  
 long double bb;
 cin>>a>>bb;
 cout<<ll(a*bb);

  return 0;
}



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

#define forn(i,x,y) for(int i = int(x); i<int(y); i++)
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(V) V.begin(), V.end()
#define on(x, b) (x & (1LL << b))
#define trav(x, v) for(auto &x : v)

#define f first
#define s second

const int N = 1e5 + 10;

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL);
    ll A, B, C;
    cin >> A >> B >> C;
    ll x = min(B - 1, C);
    cout << (A * x) / B - A * (x / B) << "\n";

    return 0;
}

/* don't forget to check:
   int overflow
   min/max cases (n = 1)
   printing index of sorted array
   limits for ans (start with inf)
   s = 'x' + s is linear! dont use it!
 */


Measured memory_bytes: 3648
#include <iostream>

int main(){
  int a,b;
  std::cin >> a >> b;
  int flag = 0;
  for(int i=1;i<=3;i++){
    if((a*b*i)%2){
      std::cout << "Yes" << std::endl;
      flag++;
      break;
    }
  }
  if(!flag) std::cout << "No" << std::endl;
  return 0;
}


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

using namespace std;

int main() {
    int N, K, min, ans = 0;
    cin >> N >> K;
    int tmp;
    for(int i = 1; i < N; i++){
        cin >> tmp;
        if(tmp == 1)
            min = i;
    }

    for(tmp = min - K, ans++; 0 < tmp; tmp -= K - 1, ans++);
    for(tmp = N - min + tmp; 0 < tmp; tmp -= K - 1, ans++);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

ll gcd(ll a, ll b) {
    if(b == 0) return a;
    return gcd(b, a%b);
}

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N, M;
    cin >> N >> M;

    int s[N+1];
    memset(s, 0, sizeof(s));

    REP(i, M) {
        int l, r;
        cin >> l >> r;

        s[--l] += 1;
        s[r] -= 1;
    }

    int ans = s[0] == M ? 1 : 0;
    REP(i, N - 1) {
        s[i+1] += s[i];
        if (s[i+1] == M) ++ans;
    }
    
    cout << fixed << setprecision(20);
    cout << ans << endl;

}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int w[n];
    for(int i=0;i<n;i++) cin >> w[i];
    int sum = 0;
    for(int i=1;i<n;i++) w[i] += w[i-1];
    int ans = 1e9;
    for(int i=0;i<n;i++) ans = min(ans,abs(w[n-1]-w[i]-w[i]));
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b) a^=b^=a^=b;
	if(a>c)	a^=c^=a^=c;
	if(b>c)	b^=c^=b^=c;
	if((a==b)+(b==c)==1)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
int a, b;
int main() {
	cin >> a >> b;
	if (a <= 9 && b <= 9) cout << a * b;
	else cout << -1;
	return 0;
}

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

int main(){
  int m,f,r;
  int count=0;
  char data[50];
  while(1){
   cin >> m >> f >> r;
   if( m==-1 && f==-1 && r==-1 ){
     break;
   }

   if( m==-1 || f==-1 || m+f<30 ){
     data[count] = 'F';
   }
   if( m+f>=80 ){
     data[count] = 'A';
   }
   if( m+f>=65 && m+f<80 ){
     data[count] = 'B';
   }
   if( m!=-1 && f!=-1 && m+f>=50 && m+f<65 ){
     data[count] = 'C';
   }
   if( m!=-1 && f!=-1 && m+f>=30 && m+f<50 ){
     if( r>=50 ){
       data[count] = 'C';
     }else{
       data[count] = 'D';
     }
   }

   count++;
  }

  for( int i=0; i<count; i++ ){
    cout << data[i] << endl;
  }

  return 0;
}


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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll n;
  cin >> n;
  vll a(n), b(n), c(n-1);
  ll ans = 0;
  REP(i, n) {
    cin >> a[i];
    a[i]--;
  }
  REP(i, n) {
    cin >> b[i];
    ans += b[i];
  }
  REP(i, n - 1) {
    cin >> c[i];
  }

  ll before = -1;
  REP(i, n - 1) {
    if (a[i] == a[i + 1] - 1) {
      ans += c[a[i]];   
    }

  }

  COUT(ans);


}

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

/*

3 2
*/


Measured memory_bytes: 3596
import sys

max_profit = -1 * (10 ** 9)

n = int(input())
rt = [int(input()) for i in range(n)]
min_r = rt[0]

for r in rt[1:]:
    profit = r - min_r
    min_r = min(min_r, r)
    max_profit = max(max_profit, profit)

print(max_profit)


Measured memory_bytes: 15100
#include <stdio.h>

int main(void)
{
	int r, c;
	int graph[100][100] = { 0 }, row_sum[100] = { 0 }, column_sum[100] = { 0 };
	int i, j;
	int whole_sum = 0;

	scanf("%d %d", &r, &c);

	for (i = 0; i < r; i++)
	{
		for (j = 0; j < c; j++)
		{
			scanf("%d", &graph[i][j]);
		}
	}

	for (i = 0; i < r; i++)
	{
		for (j = 0; j < c; j++)
		{
			printf("%d ", graph[i][j]);

			row_sum[i] += graph[i][j];

			whole_sum += graph[i][j];
		}

		printf("%d\n", row_sum[i]);
	}

	for (j = 0; j < c; j++)
	{
		for (i = 0; i < r; i++)
		{
			column_sum[j] += graph[i][j];
		}

		printf("%d ", column_sum[j]);
	}

	printf("%d\n", whole_sum);

	return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,i,x=0,y=0,z=0,k=0;
    cin>>N;
    string S;

    for(i=0;i<N;i++)
    {
      cin>>S;
        if(S=="AC")
        {
            x=x+1;
        }
        else if(S=="WA")
        {
            y=y+1;
        }
        else if(S=="TLE")
        {
            z=z+1;
        }
        else if(S=="RE")
        {
            k=k+1;
        }
    }
    cout<<"AC"<<" "<<"x"<<" "<<x<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<y<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<z<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<k<<endl;
    return 0;


}


Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int main(void)
{
	int h,w,i,j;
	while(1){
		cin>>h>>w;
		if(h==0 && w==0) break;
		for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				cout<<"#";
			}
			cout<<"\n";
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3048
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


class UnionFind
{
public:
  UnionFind(int n)
  {
    parent=vector<int>(n,-1);
  }
  int root(int a)
  {
    if(parent[a]<0)return a;
    return parent[a]=root(parent[a]);
  }
  int size(int a)
  {
    return -parent[root(a)];
  }
  bool connect(int a,int b)
  {
    int A=root(a);
    int B=root(b);
    if(A==B)return false;
    if(size(A)>size(B))swap(A,B);
    parent[B]+=parent[A];
    parent[A]=B;
    return true;
  }
private:
  vector<int> parent;

};
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k,l;
  cin>>n>>k>>l;
  UnionFind uf1(n),uf2(n);
  rep(i,k)
  {
    int a,b;
    cin>>a>>b;
    a--;b--;
    uf1.connect(a, b);
  }
  rep(i,l)
  {
    int a,b;
    cin>>a>>b;
    a--;b--;
    uf2.connect(a, b);
  }
  unordered_map<ll,int>ma;
  vector<ll>mem(n);
  rep(i,n)
  {
    ma[mem[i]=((ll)uf1.root(i)<<20)+uf2.root(i)]++;
  }
  rep(i,n)
  {
    cout<<ma[mem[i]]<<" ";
  }
  cout<<flush;
  return 0;

}


Measured memory_bytes: 11464
n = int(input())
L = []
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split())) + [0]

out = 0
for i in range(1, n+2):
  if A[i]- B[i-1] <= 0:
    out += A[i]
    A[i] = 0
  else:
    if A[i]- B[i-1] - B[i] <= 0:
      out += A[i]
      B[i] = B[i] - (A[i] - B[i-1])
      A[i] = 0
    else:
      out += B[i] + B[i-1]
      A[i] = (A[i] - B[i-1]) - B[i]
      B[i] = 0

print(out)

Measured memory_bytes: 18624
N, M = gets.split.map(&:to_i)
e = Array.new(N+1) { Array.new }
M.times do
  a, b = gets.split.map(&:to_i)
  e[a] << b
  e[b] << a
end

ans = 0
while n = e.index { |i| i.count == 1 }
  ans += 1
  e.each { |i| i.delete(n) }
  e[n] = []
end

p ans


Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;


int main(){
  int n[3];
  for(int i=0; i<3; i++){
    cin>>n[i];
  }
  sort(n,n+3);
  int k;
  cin>>k;
  for(int i=0; i<k; i++){
    n[2]=n[2]*2;
  }
  cout<<n[0]+n[1]+n[2]<<en
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

    /* チェックリスト
     * SNSに結果を書き込むときはACかWAかのみ(半分だけACとかは書かないこと)
     * 結果はintの範囲を超えていませんか？(必要な時以外はlongを使いましょう)
     * TLEしそうな処理はありませんか？
     */
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        //int n = Integer.parseInt(s.nextLine());
        String[] in = s.nextLine().split(" ");
        int a = Integer.parseInt(in[0]);
        int b = Integer.parseInt(in[1]);
        int c = Integer.parseInt(in[2]);
        int r = a-b;
        if(r >= c){
            System.out.println(0);
        }else {
            System.out.println(c - (a - b));
        }
    }
}

Measured memory_bytes: 22228
n,q=map(int,input().split())
graph=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
cnt=[0]*(n+1)
for i in range(q):
  p,x=map(int,input().split())
  cnt[p]+=x
flag=[1]*(n+1)
stack=[1]
while stack:
  v=stack.pop()
  flag[v]=0
  for k in graph[v]:
    if flag[k]:
      cnt[k]+=cnt[v]
      stack.append(k)
print(*cnt[1:])

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

int main() {
	int n,k;cin>>n>>k;
	vector<int> x(n);
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>x[i];
		ans+=min(2*x[i],2*(k-x[i]));
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
  	int l = a + b, r = c + d; 
    if(l > r) {
        cout << "Left" << endl;
    }else if(l == r){
        cout << "Balanced" << endl;
    }else{
      	cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
n,p=map(int,input().split())
if n==1:
    print(p)
    quit()
a=[i for i in range(int(p**(1/n))+1)]
a[1]=0
b=int(p**0.5)
for j in a:
    if j>b:
        break
    elif j==0:
        continue
    for k in range(2*j,len(a),j):
        a[k]=0
c=[l for l in a if l!=0]
for m in range(len(c)):
    d=0
    while p%c[m]==0:
        p//=c[m]
        d+=1
    c[m]=[c[m],d]
e=1
for v in c:
    e*=v[0]**(v[1]//n)
print(e)

Measured memory_bytes: 44952
/* ****GT_18**** */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        998244353
#define INF			1000000000000000
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
using namespace __gnu_pbds;

#define N  200005

ll n,k;
vector<pii> segs;
ll pre[N];




int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
			cin>>n>>k;
			rep(i,0,k){
				ll l,r;
				cin>>l>>r;
				segs.pb({l,r});
			}

			pre[1]=1;
			rep(i,2,n+1){
				pre[i]=0;
				rep(j,0,k){
					ll r = i-segs[j].F;
					ll l = i-segs[j].S;
					if(r<=0)continue;
					l=max(l,1LL);
					pre[i]=(pre[i]+pre[r]-pre[l-1]+hell)%hell;
				}
				pre[i]=(pre[i]+pre[i-1])%hell;
			}
			cout<<(pre[n]-pre[n-1]+hell)%hell<<endl;
	}
	return 0;
}

Measured memory_bytes: 5196
import sys
import numpy as np


def solve(N, K, xs):
    "void()"
    town_to_time = np.zeros(N, np.uint32)
    time_to_town = np.zeros(N, np.uint32)
    cur = 1
    for i in range(K):
        cur = xs[cur - 1]
        # print(town_to_time, time_to_town, cur)
        if town_to_time[cur - 1]:
            # visited before
            period = i + 1 - town_to_time[cur - 1]
            rest = K - i - 1
            rest %= period
            # print(rest, town_to_time[cur - 1], town_to_time[cur - 1] + rest)
            print(time_to_town[town_to_time[cur - 1] + rest - 1])
            return

        town_to_time[cur - 1] = i + 1
        time_to_town[i] = cur
    print(cur)


IN1 = """
4 5
3 2 4 1
"""

IN2 = """
6 727202214173249351
6 5 2 5 3 2
"""

IN3 = """
6 100
2 3 4 5 6 1
"""


def main():
    """
    >>> as_input(IN1)
    >>> main()
    4
    >>> as_input(IN2)
    >>> main()
    2
    >>> as_input(IN3)
    >>> main()
    5
    """
    N, K = map(int, input().split())
    xs = np.array(list(map(int, input().split())))
    solve(N, K, xs)


def _test():
    import doctest
    as_input(IN1)
    main()
    doctest.testmod()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())
    input = f.readline
    read = f.read


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', solve.__doc__.strip().split()[0])(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        # -p: pure python mode
        # if not -p, import compiled module
        from my_module import solve  # pylint: disable=all
    elif sys.argv[-1] == "-t":
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        # input given as file
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    main()


Measured memory_bytes: 46392
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define drep(i,l,r) for(int (i)=(l);(i)>=(r);(i)--)
using namespace std;
int main(){
    ll x;
    cin>>x;
    if(x==2){
        cout<<"2"<<endl;
        return 0;
    }
    if(x%2==0)x++;
    for(ll num=x;;num+=2){
        ll k=0;
		for(ll j=3;j<=sqrt(num);j+=2){
			if(num%j==0){
				k=1;
				break;
			}
		}

		if(!k){
            cout<<num<<endl;
            return 0;
        }
    }
}


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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int k, a, b;
	cin >> k >> a >> b;
	for(int i = a; i <= b; i++) {
		if((i%k) == 0) {
			cout << "OK\n";
			return 0;
		}
	}
	cout << "NG\n";
}

Measured memory_bytes: 3564
import sys
import math

import heapq

def input():
    return sys.stdin.readline().rstrip()


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



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

    dp = [0]*(N+1)
    rt = int(N **0.5) +2
    for i in range(1,rt):
        for j in range(1,rt):
            if int( i**2 + j **2 + 1 + i*j + i*1 + j*1 ) >N:
                break
            for k in range(1,rt):
                case =int( i**2 + j **2 + k **2 + i*j + i*k + j*k )
                if case <=N:
                    dp[case] +=1
                else:
                    break

    for l in range(1,N+1):
        print(dp[l])










if __name__ == "__main__":
    main()


Measured memory_bytes: 68808
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>

using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	VI A(N);
	REP(i, N) {
		cin >> A[i];
		if (A[i] % 2 == 1) {
			cout << 0 << endl;
			return 0;
		}
	}
	int c = 1;
	while (1) {
		REP(i, N) {
			A[i] /= 2;
			if (A[i] % 2 == 1) {
				cout << c << endl;
				return 0;
			}
		}
		c++;
	}
		
	return 0;
}

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

typedef long long readtype;
typedef long long var;
typedef long double let;

readtype read() {
  readtype a = 0, c = getchar(), s = 0;
  while (!isdigit(c)) s |= c == '-', c = getchar();
  while (isdigit(c)) a = a * 10 + c - 48, c = getchar();
  return s ? -a : a;
}

#ifdef LOCAL_LOGGER
#define logger(...) fprintf(stderr, __VA_ARGS__)
#define abortif(v, ...) if (v) {logger("Error in Line %d, Function '%s()'.\nInfo: ", __LINE__, __FUNCTION__); logger(__VA_ARGS__); exit(0);}
#else
#define logger(...);
#define abortif(v, ...);
#endif
/* }}} */

const int N = 1e5 + 1;
const let eps = 1e-8;
const let Pi = acos(-1.0);

int sign(let x) { return (x < -eps) ? -1 : (x > eps) ? 1 : 0; }

struct Point {
  let x, y;
  friend Point operator - (Point a, Point b) {
    return (Point) {a.x - b.x, a.y - b.y};
  }
  friend bool operator < (Point a, Point b) {
    if (sign(a.x - b.x) == 0) return sign(a.y - b.y) < 0;
    return sign(a.x - b.x) < 0;
  }
  Point Rotate(let sink, let cosk) {
    return (Point) {
      x * cosk - y * sink, x * sink + y * cosk
    };
  }
  let dist() {
    return sqrt(x * x + y * y);
  }
  friend let Dist(Point a, Point b) { 
    return (a - b).dist();
  }
};

Point ReadPoint() {
  Point p;
  scanf("%Lf%Lf", &p.x, &p.y);
  return p;
}

int n;
Point point[N];
int rnk[N];

int main() {
// #ifndef ONLINE_JUDGE
//   freopen("CGL_5_A.in", "r", stdin);
//   freopen("CGL_5_A.out", "w", stdout);
// #endif
// #ifdef LOCAL_LOGGER
//   freopen("CGL_5_A.log", "w", stderr);
// #endif
  srand(time(0));
  n = read();
  for (int i = 1; i <= n; ++i) point[i] = ReadPoint();
  let res = 0;
  bool have = false;
  int RD_TIME = 50;
  for (int rd = 1; rd <= RD_TIME; ++rd) {
    sort(point + 1, point + n + 1);
    for (int i = 1; i < n; ++i) {
      let tdist = Dist(point[i], point[i + 1]);
      if (!have) res = tdist, have = true;
      if (sign(res - tdist) > 0) res = tdist;
    }
    let angle = ((let) rand() / RAND_MAX) * Pi;
    let sink = sin(angle), cosk = cos(angle);
    for (int i = 1; i <= n; ++i)
      point[i] = point[i].Rotate(sink, cosk);
  }
  printf("%.8Lf\n", res);
  return 0;
}

/* ==== Makefile ==== {{{
CompileAndRun:
	make Compile
	make Run

Compile:
	g++ -o CGL_5_A CGL_5_A.cpp -g -Wall -DLOCAL_LOGGER

CompileUF:
	g++ -o CGL_5_A CGL_5_A.cpp -g -Wall -DLOCAL_LOGGER -fsanitize=undefined

Run:
	./CGL_5_A < CGL_5_A.in > CGL_5_A.out
==================
}}} */



Measured memory_bytes: 6756
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <random>
using namespace std;
typedef long long ll;
const int MAX_N = 1e3 + 2, INF = 987654321;
int N, M, board[MAX_N][MAX_N];
int goY[4] = { -1,1,0,0 }, goX[4] = { 0,0,1,-1 };
int dist[MAX_N][MAX_N];

bool is_possible(int y, int x) {
	if (y<1 || y>N || x<1 || x>M)return false;
	return true;
}

int dijkstra(pair<int, int>start, pair<int, int>fin)
{
	for (int i = 0; i < MAX_N; i++)
		for (int j = 0; j < MAX_N; j++)dist[i][j] = INF;
	priority_queue<pair<int, pair<int,int>>>pq;
	pq.push({ 0,start });
	dist[start.first][start.second] = 0;
	while (!pq.empty())
	{
		pair<int, int> now = pq.top().second;
		int cost = -pq.top().first;
		pq.pop();
		//cout << now.first << " " << now.second << " " << cost << endl;
		if (cost > dist[now.first][now.second])continue;

		for (int i = 0; i < 4; i++)
		{
			pair<int, int>next = now;
			next.first += goY[i], next.second += goX[i];
			if (!is_possible(next.first, next.second) || board[next.first][next.second] == 1)continue;
			int nextDist = cost;
			if (dist[next.first][next.second] > nextDist) {
				dist[next.first][next.second] = nextDist;
				pq.push({ -nextDist,next });
			}
		}

		for (int y = now.first - 2; y <= now.first + 2; y++)
			for (int x = now.second - 2; x <= now.second + 2; x++)
			{
				if (y == now.first&&x == now.second)continue;
				if (!is_possible(y, x) || board[y][x] == 1) continue;
				int nextDist = cost + 1;
				if (dist[y][x] > nextDist) {
					dist[y][x] = nextDist;
					pq.push({ -nextDist,{y,x} });
				}
			}
	}
	return (dist[fin.first][fin.second] == INF ? -1 : dist[fin.first][fin.second]);
}

int main()
{
	cin >> N >> M;
	pair<int, int>start, fin;
	cin >> start.first >> start.second >> fin.first >> fin.second;
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= M; j++) {
			char c;
			cin >> c;
			board[i][j] = (c == '.' ? 0 : 1);
		}
	cout << dijkstra(start, fin);
}


Measured memory_bytes: 11460
#include <bits/stdc++.h>
#define int             long long
#define ld              long double
#define rep0(i,n)       for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rep(i,x,y)      for(int i=x;i<=y;i++)
#define reprev1(i,n)    for(int i=n;i>0;i--)
#define reprev0(i,n)    for(int i=n-1;i>=0;i--)
#define reprev(i,x,y)   for(int i=x;i>=y;i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x,y)         fixed<<setprecision(y)<<x
#define setbits(x)      __builtin_popcount(x)
#define zerobits(x)     __builtin_ctz(x)
#define in(a,n)         vi a(n);rep0(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define endl            '\n'
#define mod             1000000007
#define Max             (int)1e6+6
#define inf             1e18
using namespace std;

int n,m,k,x,y,z,a1,b,c,d,i,j;



void sol()
{   
    cin>>n;
    int a[n+1],b[n+1],c[n+1];
    rep1(i,n) cin>>a[i]>>b[i]>>c[i];
    int dp[n+1][2][2][2]={};
    
    for(int i=1;i<=n;i++)
    {
      dp[i][1][0][0]=a[i]+max(dp[i-1][0][1][0],dp[i-1][0][0][1]);
      dp[i][0][1][0]=b[i]+max(dp[i-1][1][0][0],dp[i-1][0][0][1]);
      dp[i][0][0][1]=c[i]+max(dp[i-1][0][1][0],dp[i-1][1][0][0]);


    }
    
    
    cout<< max({dp[n][1][0][0],dp[n][0][1][0],dp[n][0][0][1]}) <<endl;
}





int32_t main(){

    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // w(t)
    sol();
    return 0;
}



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

s = list(range(10))
for i in range(1, 100):
    t = str(i)
    s.append(t+t[::-1])
    for j in range(10):
        s.append(t+str(j)+t[::-1])

s = list(map(int, s))
s.sort()
if n in s:
    print(n)
else:
    if n < s[0]:
        print(s[0])
    elif n > s[-1]:
        print(s[-1])
    else:
        res = 0
        diff = 1e9
        for d in s:
            if diff > abs(d-n):
                diff = abs(d-n)
                res = d

        print(res)



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

int a[20000],b[20000];
signed main(){
	int n;scanf("%lld",&n);
	rep(i,n)scanf("%lld",&a[i]);
	rep(i,n)scanf("%lld",&b[i]);
	int d=0,cnt=0;
	rep(i,n){
		if(a[i]>b[i]){
			d+=a[i]-b[i];
		}
		else if(a[i]<b[i]){
			cnt+=(b[i]-a[i])/2;
		}
	}
	if(d>cnt){
		puts("No");
	}
	else puts("Yes");
}

Measured memory_bytes: 384
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s=input()
n=len(s)
if n==2:
    print(s)
else:
    print(s[::-1])

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int s[] = new int[10];
        int a=0;
        s[0] = scanner.nextInt();
        s[1] = scanner.nextInt();
        s[2] = scanner.nextInt();
        s[3] = scanner.nextInt();
        s[4] = scanner.nextInt();
        s[5] = scanner.nextInt();
        s[6] = scanner.nextInt();
        s[7] = scanner.nextInt();
        s[8] = scanner.nextInt();
        s[9] = scanner.nextInt();
        a=s[0]+s[1]+s[2]+s[3]+s[4]+s[5]+s[6]+s[7]+s[8]+s[9];
        System.out.println(a);

    }
}



Measured memory_bytes: 26344
N = int(input())
A_list = list(map(int, input().split()))

def check():
	for A in A_list:
		if A % 2 == 0 and (A % 3 != 0 and A % 5 != 0):
			return False
	return True

if check():
	print("APPROVED")
else:
	print("DENIED")


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

int n;
int PRE[100];
int MID[100];
int POS[100];
int idx = 0;

void solve(int pre_start, int pre_end, int mid_start, int mid_end) {
  if (pre_start == pre_end) {
    return;
  }
  if (pre_start + 1 == pre_end) {
    POS[idx++] = PRE[pre_start];
    return;
  }

  int i = 0;
  while(1) {
    if(PRE[pre_start] == MID[mid_start+i]) {
      break;
    } else {
      i++;
    }
  }

  solve(pre_start+1, pre_start+i+1, mid_start, mid_start+i);
  solve(pre_start+i+1, pre_end, mid_start+i+1, mid_end);

  POS[idx++] = PRE[pre_start];
}


int main() {
  cin >> n;
  for(int i = 0; i < n; i++) cin >> PRE[i];
  for(int i = 0; i < n; i++) cin >> MID[i];

  solve(0, n, 0, n);

  cout << POS[0];
  for (int i = 1; i < n; i++) cout << " " << POS[i];
  cout << endl;
}



Measured memory_bytes: 3116
#include <iostream>
using namespace std;
int main(void){
   int a,b,c;
   int count = 0;
   cin >> a >> b >> c;
   for(int i = a; i <=b; i++){
    if(c % i == 0) count ++;
   }
   cout << count << endl;
   return 0;
}


Measured memory_bytes: 3108
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { 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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// head

int t;

int main()
{
    ios::sync_with_stdio(false);
#ifdef RG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
#endif
    int n,r;
    cin>>n>>r;
    if(n>=10) cout<<r<<endl;
    else cout<<r+100*(10-n)<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

ans = "Possible"
large_pair = -1
for i in range(N-1):
    if A[i]+A[i+1] >= L:
        large_pair = i
        break
if large_pair == -1:
    ans = "Impossible"
    print(ans)
else:
    order = [large_pair]
    start = large_pair
    left = start-1
    right = start+1

    while left >= 0:
        order.append(left)
        left -= 1

    while right < N-1:
        order.append(right)
        right += 1

    print(ans)
    print("\n".join(map(lambda x: str(x+1), reversed(order))))


Measured memory_bytes: 69352
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define OJ \
        freopen("input.txt","r",stdin); \
        freopen("output.txt","w",stdout);
using namespace std;

int main()
{
//	OJ;
	 ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin>>n;
   map<string,int> x;
   while(n--)
   {
           string s;
           cin>>s;
           x[s]++;
           
   }
   cout<<"AC x "<<x["AC"]<<endl;
   cout<<"WA x "<<x["WA"]<<endl;
   cout<<"TLE x "<<x["TLE"]<<endl;
   cout<<"RE x "<<x["RE"]<<endl;

}

Measured memory_bytes: 3668
// ABC168C - 

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

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	int A, B, H, M;
	cin >> A >> B >> H >> M;

	double Ax, Ay, Bx, By;
	double PI = acos(-1);

	Ax = A * cos((H*30.0+M/2.0)/180.0 * PI); 
	Ay = A * sin((H*30.0+M/2.0)/180.0 * PI); 
	Bx = B * cos((M*6.0)/180.0 * PI);
	By = B * sin((M*6.0)/180.0 * PI);

	printf("%.15lf\n", sqrt((Ax-Bx)*(Ax-Bx) + (Ay-By)*(Ay-By)));

	return 0;
}


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (size_t i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static int MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > I(m);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        I[i] = make_pair(b, a);
    }

    sort(all(I));
    int pre_bri = -1, ans = 0;
    for (size_t i = 0; i < m; ++i) {
        if (I[i].second <= pre_bri) continue;
        else ++ans; pre_bri = I[i].first - 1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
package main

import(
    "fmt"
)



func main() {
    var a,b,c int
    fmt.Scan(&a,&b,&c)
    n := a * b * c
    if n == 5*5*7 {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}





func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}


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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  if( abs(a-c)  <= d){
   cout << "Yes" << endl;
  }
  else if(abs(a-b) <=d && abs(b-c) <= d){
   cout << "Yes" << endl;
  }
  
  else{
  cout << "No" << endl;
  }
}

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

const int INF = 1e9;
const int  kx[] = {0,1,1,-1}, ky[] = {1,0,1,1};

inline pair<int,int> line_cp(int d1, int x1, int y1, int d2, int x2, int y2){
  int X=INF, Y=INF;
  if(d1==d2)return make_pair(X,Y);

  if(kx[d1] == 0){
    Y = y1;
    X = ky[d2]*(Y-y2)/kx[d2] + x2;
    return make_pair(X,Y);
  }
  if(ky[d1] == 0){
    X = x1;
    Y = kx[d2]*(X-x2)/ky[d2] + y2;
    return make_pair(X,Y);
  }
  if(kx[d2] == 0){
    Y = y2;
    X = ky[d1]*(Y-y1)/kx[d1] + x1;
    return make_pair(X,Y);
  }
  if(ky[d2] == 0){
    X = x2;
    Y = kx[d1]*(X-x1)/ky[d1] + y1;
    return make_pair(X,Y);
  }

  int dy1 = ky[d1]*kx[d2], dy2 = ky[d2]*kx[d1];
  Y = (dy1*y1 - dy2*y2 - kx[d1]*kx[d2]*(x1-x2) );
  if(dy1-dy2==0 || abs(Y) % abs(dy1-dy2) != 0)return make_pair(INF,INF);
  Y /= dy1-dy2;
  X = ky[d1]*(Y-y1)/kx[d1] + x1;
  return make_pair(X,Y);
}

inline int check(int x1,int y1,int x2,int y2){
  int difx = abs(x1-x2), dify = abs(y1-y2);
  if( difx == dify || difx==0 || dify==0 )return 1;
  return 0;
}

inline int solve(int k){
  int x1,y1,x2,y2,X,Y;
  cin >> x1 >> y1 >> x2 >> y2 >> X >> Y;
  if( (x1==X && y1==Y) || (x2==X && y2==Y) )return 0;
  int cnt = check(x1,y1,X,Y) + check(x2,y2,X,Y);
  if(cnt)return 3-cnt;

  if(check(x1,y1,x2,y2))return 3;
  for(int d1=0;d1<4;d1++){
    for(int d2=0;d2<4;d2++){
      pair<int,int> p = line_cp(d1,x1,y1,d2,x2,y2);
      if(p.first!=INF && check(p.first, p.second, X,Y))return 3;
    }
  }
  return 4;
}

int main(){
  int n; cin >> n;
  for(int i=1;i<=n;i++){
    cout << solve(i) << endl;
  }
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int a, b, c;
	int cont=0;
	scanf("%i %i %i", &a, &b, &c);
	for (int i = a; i <= b; i++) 
    {
		if (c % i == 0)
		{
            cont++;
        }
	}
	printf("%i\n", cont);
	
	return 0;
}


Measured memory_bytes: 2120
def prime(n):
    a = [1]*(n+1)
    a[0],a[1] = 0,0
    for i in range(2,int(n**(0.5))+1):
        j = 2
        while i*j <= 10**5:
            a[i*j] = 0
            j += 1
    return a

def like2017(a):
    c = [0]*(10**5+1)
    for i in range(3,10**5+1):
        if a[i]*a[(i+1)//2]:
            c[i] = 1
    return c

def ssum(c):
    s = [0]*(10**5+1)
    for i in range(2,10**5+1):
        s[i] = s[i-1]+c[i]
    return s

def s(lst,l,r):
    return lst[r]-lst[l-1]


q = int(input())
a = prime(10**5)
c = like2017(a)

ss = ssum(c)
for i in range(q):
    l,r = map(int,input().split())
    print(s(ss,l,r))

Measured memory_bytes: 9844
import java.util.Scanner;

/**
 * B - Count Balls
 * 高橋君は青と赤の 2 色のボールを持っており、これらを一列に並べようとしています。
 * 初め、列にボールはありません。
 * 根気のある高橋君は、次の操作を10の100乗 回繰り返します。
 * 列の末尾に、A 個の青いボールを加える。
 * その後、列の末尾に B 個の赤いボールを加える。
 * こうしてできる列の先頭からN 個のボールのうち、青いボールの個数はいくつでしょうか。
 */
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner( System.in );
        // 先頭から確認するボールの数
        long n = sc.nextLong();
        // 青いボールの数
        long a = sc.nextLong();
        // 赤いボールの数
        long b = sc.nextLong();

        long ballCnt = 0;

        // 繰り返す数を求める
        long divisionAns = n / ( a + b );
        // 繰り返す数を算出した割り算の余りを求める
        long remainderOfDivision = n % ( a + b );

        ballCnt += divisionAns * a;
        ballCnt += remainderOfDivision < a ? remainderOfDivision : a;

        System.out.println( ballCnt );

        sc.close();
    }
}

Measured memory_bytes: 23124
class Tree
  attr_accessor :id, :parent, :left, :right, :depth, :children, :type
end

N = gets.chomp.to_i
@trees = []

def calc_depth(tree)
  if tree.parent.nil?
    tree.depth = 0
  else
    if @trees[tree.parent].depth.nil?
      calc_depth(@trees[tree.parent])
    end
    tree.depth = @trees[tree.parent].depth + 1
  end
end

def decide_type(tree)
  if tree.parent.nil?
    "root"
  elsif tree.children.size == 0
    "leaf"
  else
    "internal node"
  end
end

def out_format(tree)
  tree.type = decide_type(tree)
  tree.parent = -1 if tree.parent.nil?
  str_children = "[#{tree.children * ", "}]"
  "node #{tree.id}: parent = #{tree.parent}, depth = #{tree.depth}, #{tree.type}, #{str_children}"
end

N.times do
  @trees << Tree.new
end

N.times do
  tmp = gets.chomp.split(" ").map(&:to_i)
  id = tmp.shift
  @trees[id].id = id
  child_num = tmp.shift
  @trees[id].children = tmp

  l = nil
  child_num.times do |j|
    if j == 0
      @trees[id].left = tmp[j]
    else
      @trees[l].right = tmp[j]
    end
    l = tmp[j]
    @trees[tmp[j]].parent = id
  end
end

@trees.each { |e| calc_depth(e) }
@trees.sort!{ |x, y| x.id <=> y.id }
@trees.each { |e| puts out_format(e) }



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

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  
  sort(v.begin(),v.end());
  
  double ans = v[0];
  
  for(int i=1;i<n;i++){
    ans = (ans+v[i])/2;
  }
  printf("%.10f\n",ans);
}


Measured memory_bytes: 256
import Foundation

struct Mojiretu: Equatable {
    var characters: [Int]
    
    init(characters: [Int]) {
        
        self.characters = characters
    }
    init(_ slice: ArraySlice<Int>) {
        
        self.characters = Array(slice)
    }
}

extension Mojiretu {
    struct KeyCode {
        static let space = 0x20
        static let lf = 0x0A
    }
    
    static func readLine() -> Mojiretu {
        .init(characters:
            (0...)
                .lazy
                .map { _ in Int(getchar()) }
                .prefix { $0 != KeyCode.lf }
        )
    }
    
    static func readToken() -> Mojiretu {
        .init(characters:
            (0...)
                .lazy
                .map { _ in Int(getchar()) }
                .prefix { $0 != KeyCode.lf && $0 != KeyCode.space }
        )
    }
    
    var tokens: [Mojiretu] {
        characters
            .split { $0 == KeyCode.lf || $0 == KeyCode.space }
            .map(Mojiretu.init)
    }
}

struct MojiretuCharacterIterator: IteratorProtocol {
    private var iter: IndexingIterator<Array<Int>>
    
    init(_ Mojiretu: Mojiretu) {
        iter = Mojiretu.characters.makeIterator()
    }
    
    mutating func next() -> Character? {
        guard let i = iter.next() else { return nil }
        
        return Unicode.Scalar(i).map(Character.init)
    }
}

extension Mojiretu: Sequence {
    
    func makeIterator() -> MojiretuCharacterIterator {
        MojiretuCharacterIterator(self)
    }
}


extension Mojiretu {
    var integer: Int {
        characters
            .lazy
            .map { $0 - Int("0".utf8.first!) }
            .prefix { (0...9) ~= $0 }
            .reduce(0) { r, i in r * 10 + i }
    }
}


let n = Mojiretu
  .readLine()
  .integer

print(
  (1...)
    .lazy
    .map { $0 * 1000 - n }
    .prefix { $0 < 1000 }
    .last!
)


Measured memory_bytes: 12772