akhauriyash/Code-Regression huggingface dataset:
//fold
#ifndef KHALIL
#include <bits/stdc++.h>
#else
#include "header.h"
#endif
#define endl '\n'
#define mp make_pair
#define tostr(x) static_cast<ostringstream&>((ostringstream()<<dec<<x)).str()
#define rep(i,begin,end) for(auto i = begin;i < end;i++)
#define repr(i,begin,end) for(auto i = begin-1;i >= end;i--)
#define pb push_back
#define sz(a) ((int)(a).size())
#define fi first
#define se second
#define abs(a) ((a) < (0) ? (-1)*(a) : (a))
#define SQ(a) ((a)*(a))
#define eqd(a,b) (abs(a-b)<1e-9)
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename t> t in(t q){cin >> q;return q;}
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v){os << "[";for (int i = 0; i < sz(v); ++i) { os << v[i]; if (i != sz(v) - 1) os << ",";}os << "]";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const map<T, S>& v){for (auto it : v)os << "(" << it.first << ":" << it.second << ")";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const pair<T, S>& v){os << "(" << v.first << "," << v.second << ")";return os;}
const long double PI = acosl(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);}
inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);}
//endfold
#define  N  (200005)
#define MOD (1000000000ll + 7ll)
#define OO (1050000000)
#define OOL (1100000000000000000)

//global
ll a[N];
map<ll,int> act;
map<ll,int> ful;

vector<int> s;
bitset<100005> prim;

void fill(){
	int sqr = 47;
	s.push_back(2);
	for (int i = 3; i <= 2200; i += 2){
		if(!prim[i]){
			if(i <= sqr)
				for (int j = i*i; j <= 2200; j += i)
					prim[j] = true;
			s.push_back(i);
		}
	}
}

ll sqr(ll x){
	ll l = 1,r = x/10;
	while(l <= r){
		ll mid = (l+r)/2;
		ll ans = mid*mid;
		if(ans < x) l = mid+1;
		if(ans > x) r = mid-1;
		if(ans == x) return mid;
	}
	return 0;
}

int main(){
	//fold
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << setprecision(10);
	//endfold
	fill();
	int n;
	cin >> n;	
	rep(i,0,n){
		cin >> a[i];
	}
	rep(i,0,n){
		vector<pair<int,int>> bs;
		for (int j = 0; j < sz(s) && s[j]*s[j] <= a[i]; ++j){
			int k = 0;
			while(a[i]%s[j] == 0){
				k++;
				a[i] /= s[j];
				if(k == 3) k = 0;
			}
			if(k) bs.push_back({s[j],k});
		}
		if(a[i] > 1){
			ll q = sqr(a[i]);
			if(q*q == a[i]) bs.push_back({q,2});
			else bs.push_back({a[i],1});
		}
		ll bsn = 1;
		ll rsn = 1;
		for(pair<int,int> w:bs){
			if(w.second == 1){
				bsn *= w.first;
				rsn *= w.first;
				rsn *= w.first;
			}
			if(w.second == 2){
				bsn *= w.first;
				bsn *= w.first;
				rsn *= w.first;
			}
		}
		if(bsn <= rsn) act[bsn]++;
		ful[min(bsn,rsn)]++;
	}
	int ans = 0;
	for(auto el:ful){
		if(el.first == 1) continue;
		ans += max(act[el.first],el.second-act[el.first]);
	}
	cout << ans+(act[1]>0);
	return 0;
}

Measured memory_bytes: 13568
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,t,a[200005],b[200005];
signed main() {
	cin>>n>>m>>t;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]+=a[i-1];
	}
	for(int i=1;i<=m;i++){
		cin>>b[i];
		b[i]+=b[i-1];
	}
	int qwq=0,sum=0;
		for(int i=0;i<=n;i++){
			int r=0,f=m;
			qwq=t-a[i];
			if(qwq<0){
				break;
			}
			while(r<f-1){
				int mid=(r+f)/2;
				if(qwq>=b[mid]){
					r=mid;
				}
				else{
					f=mid;
				}
			}
			if(qwq>=b[f]){
				sum=max(sum,f+i);
			}
			else{
				sum=max(sum,r+i);
			}
		}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 6776
def main():
    N = int(input())
    ABC = [[int(i) for i in input().split()] for j in range(N)]
    dp = [[0]*3 for _ in range(N+1)]

    for i in range(N):
        for j in range(3):
            dp[i+1][j] = max(dp[i][(j+1) % 3], dp[i][(j+2) % 3]) + ABC[i][j]

    print(max(dp[N]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 104948
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin >> n;
  ll a[n],b[n];
  rep(i,n)cin >> a[i] >> b[i];
  ll temp=0;
  for(int i=n-1;i>=0;i--){
    if((a[i]+temp)%b[i]==0)continue;
    temp+=b[i]-(a[i]+temp)%b[i];
  }
  cout << temp << endl;
return 0;}

Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Sagor
 */

#include <fstream>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

#define gap                        ' '
#define EPS                        1e-9
#define P_INF                      2e9+17
#define N_INF                     -2e9-17
#define MOD                        1000000007
#define PI                         2*acos(0.0)
#define All(x)                     x.begin(),x.end()
#define Mem(Name, type)            memset(Name, type, sizeof(Name))

template<typename T>
T GCD(T a, T b) { return a ? GCD(b % a, a) : b; }

template<typename T>
T LCM(T a, T b) { return (a * b) / GCD(a, b); }

template<typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) {
    for (auto ob : v) os << ob << " ";
    return os;
}

template<typename T, typename S>
std::ostream &operator<<(std::ostream &os, const std::map<T, S> &v) {
    for (auto ob : v) os << ob.first << " : " << ob.second << std::endl;
    return os;
}

using ld = double;
using ll = long long int;
using ul = unsigned long long int;
using namespace std;

class CAXBC {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        ll ans = 0;
        for (int i = 1; i < n; ++i) {
            int num = (int) ceil((double) n / i);
            num--;
            ans += num;
        }
        out << ans << endl;
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    CAXBC solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;

ll A,B;

// G(x) := F(0,x)
// 0からxまでの XOR (x+1個の数がある)
ll G(ll x)
{
  ll res = 0;
  // 2つずつペアにして計算
  ll q = (x+1) / 2;
  res += q % 2;
  // 最後の1つ(x)が余る場合
  if ((x+1) % 2 == 1) res ^= x;
  return res;
}

int main()
{
  cin >> A >> B;

  // ll res = 0;
  // for (ll i = A; i <= B; ++i) {
  //   res = res ^ i;
  // }
  // cout << res << endl;

  ll res = G(A-1) ^ G(B);
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int g, b;
  scanf("%*d%d%d", &g, &b);
  puts((g * 10 + b) % 4 == 0 ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 128
uses math;
var a,b,c,d,e:longint;
begin
  read(a,b);
  for a:=2 to a do
  begin
    read(c);
    if c>b then
    begin
      e:=max(e,d);
      d:=0;
    end
    else
      inc(d);
    b:=c;
  end;
  writeln(max(e,d));
end.

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <map>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <utility>
#include <cassert>
#include <bitset>
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define per(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,a,b) for (int i=(a);i<=(b);i++)
#define PER(i,a,b) for (int i=(b);i>=(a);i--)
#define de(x) cout<<">> "<<#x<<" = "<<x<<endl;
using namespace std;
typedef long long LL;
typedef pair<LL, int> P;
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;}
LL gcd(LL a, LL b) {if (b==0)return a;else return gcd(b,a%b);}
const int INF = 0x3f3f3f3f;
const int MAXN = 1000005; // 1e6;
int u[MAXN],v[MAXN],c[MAXN];
int mark[MAXN];
int bridge[MAXN];
vector<P> G[MAXN];
vector<P> RG[MAXN];
vector<P> NG[MAXN];
LL d[MAXN],rd[MAXN];
int ans[MAXN];
int n,m;
void dij(vector<P> GG[], LL dis[], int s)
{
	dis[s]=0;
	priority_queue<P, vector<P>, greater<P> > que;
	que.push(mkp(0, s));
	while(!que.empty()){
		int x=que.top().se;
		LL d=que.top().fi;
		que.pop();
		if (d>dis[x]) continue;
		rep(i,0,SZ(GG[x]))
		{
			int v=GG[x][i].fi, e = GG[x][i].se;
			if (dis[v]>dis[x]+e){
				dis[v]=dis[x]+e;
				que.push(mkp(dis[v],v));
			}
		}
	}
}
int dfn[MAXN],low[MAXN],idx;
void Tarjan(int i, int fa)
{
        low[i]=dfn[i]=idx++;
        rep(j,0,NG[i].size())
        {
                int v = NG[i][j].fi;
                if (v==fa) continue;
                if (!dfn[v])
                {
                        Tarjan(v,i);
                        low[i] = min(low[i],low[v]);
                        if (low[v] > dfn[i]) bridge[NG[i][j].se]=true;
                }
                else if (dfn[v] < dfn[i])
                {
                        low[i]=min(low[i],dfn[v]);
                }
        }
}
int main()
{
	// freopen("in.txt","r",stdin);
	scanf("%d%d",&n,&m);
	// de(m)
	rep(i, 1, m+1){
		scanf("%d%d%d",u+i,v+i,c+i);
		G[u[i]].pb(mkp(v[i],c[i]));
		RG[v[i]].pb(mkp(u[i],c[i]));
	}
	// de(m)
	memset(d,INF,sizeof d);
	memset(rd,INF,sizeof rd);
	dij(G,d,1);
	dij(RG,rd,2);
	// de(m)
	rep(i, 1, m+1){
		if (d[u[i]] + rd[v[i]] + c[i] == d[2]) 
		{
			mark[i]=true;
			NG[u[i]].pb(mkp(v[i], i));
			NG[v[i]].pb(mkp(u[i], i));
		}
	}
	// de(m)
	Tarjan(1,-1);
	// de(m)
	rep(i, 1, m+1)
	{
		// de(1)
		if (mark[i] && bridge[i]) puts("SAD");
		else if (mark[i] && !bridge[i]) puts("SOSO");
		else if (!mark[i] && d[v[i]] + rd[u[i]] + c[i] < d[2]) puts("HAPPY");
		else if (!mark[i] && d[v[i]] + rd[u[i]] + c[i] >= d[2]) puts("SOSO");
	}
	return 0;
}




Measured memory_bytes: 111120
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);



	int n, k;
	cin >> n >> k;
	vector<int64_t> a(n),kake(n,1);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for(int i =0;i<n-k; ++i) {
		if(a[i]<a[i+k])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}//*/
}

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

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main() {
	int A, B, C, K, S=0;
	int i = 0;
	cin >> A >> B >> C >> K;

	while (K > 0) {
		switch (i)
		{
		case 0:
			if ((A - K) <= 0) {
				K -= A;
				S += A;
			}
			else
			{
				S += K;
				K -= A;
			}
			break;
		case 1:
			if ((B - K) <= 0) {
				K -= B;				
			}
			else
			{
				K -= B;
			}
			break;
		case 2:
			if ((C - K) <= 0) {
				K -= C;
				S -= C;
			}
			else
			{
				S -= K;
				K -= C;
			}
			break;
		default:
			break;
		}
		
		i++;
	}

	cout << S << endl;
	

	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main() {
	string S;
	cin >> S;
	
	for (int i = 0; i < S.size()-1; i++) {
		for (int j = i + 1; j < S.size(); j++) {
			if (S[i] == S[j]) {
				cout << "no" << endl;
				return 0;
			}
		 }
	}
	cout << "yes" << endl;
	return 0;

}

Measured memory_bytes: 256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import defaultdict

n = ni()
s = ns()

dic = defaultdict(lambda: 1)
for i in range(n):
    dic[s[i]] += 1

ans = 1
for k, v in dic.items():
    ans *= v
    ans %= mod

print((ans + mod - 1) % mod)

Measured memory_bytes: 3508
#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,s,e) for(int i=s;i<=e;i++)
#define endl '\n'
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define pb push_back
#define FILE freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);


using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;
int mod;
const int MAXN = 10001;

int dp[MAXN][101][2];


ll f(int idx, int curr_mod, int tight, string &s){
    if(idx == s.length()){
        return (curr_mod == 0);
    }

    if(dp[idx][curr_mod][tight] != -1)return dp[idx][curr_mod][tight];

    int limit = 9;

    if(tight)limit = s[idx]-'0';

    ll ret = 0;

    for(int curr_dig = 0; curr_dig <= limit; ++curr_dig){
        int newTight = tight;
        if(curr_dig < s[idx]-'0')newTight  = 0;

        int newMod = (curr_mod + curr_dig)%mod;

        ret = (ret + f(idx+1, newMod, newTight, s))%MOD;
    }

    return dp[idx][curr_mod][tight] = ret;

}

int main(){
    inp_out_work

    fr(i,MAXN)fr(j,101)fr(k,2)dp[i][j][k] = -1;

    string k;
    cin>>k>>mod;

    ll ans =  f(0, 0, 1, k) - 1;

    if(ans < 0)ans += MOD;

    cout<< ans << endl;

}


Measured memory_bytes: 9216
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		
		if(x < 1200) {
			System.out.println("ABC");
		}else {
			System.out.println("ARC");
		}
	}

}


Measured memory_bytes: 21844
import sys
from heapq import heapify, heappop, heappush
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
N = len(s)

if s[0] == s[-1]: #odd
  if N%2 != 0:
    print("Second")
  else:
    print("First")
else:
  if N%2 == 0:
    print("Second")
  else:
    print("First")

Measured memory_bytes: 39152
#include <iostream>
#include <algorithm>
using namespace std;
int H;
void maxheapify(int A[],int i){
    int largest;
    int l=2*i;
    int r=(2*i)+1;
    if(l<=H && A[l]>A[i]){
        largest=l;
    }
    else{
        largest=i;
    }
    if(r<=H && A[r]>A[largest]){
        largest=r;
    }
    if(largest!=i){
        swap(A[i],A[largest]);
        maxheapify(A,largest);
    }
}
void build(int A[]){
    for(int i=H/2;i>0;i--){
        maxheapify(A,i);
    }
}
int main(){
    int A[10000000];
    cin>>H;
    for(int i=1;i<=H;i++){
        cin>>A[i];
    }
    build(A);
    for(int i=1;i<=H;i++){
        cout<<" "<<A[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 5000
# Graph
import sys
input = sys.stdin.readline
n = int(input())
A = [tuple(map(int, input().split())) for _ in range(n)]

G = [[0]*(n) for _ in [0]*(n)]

for i, k, *V in A:
    for v in V:
        G[i-1][v-1] = 1

for g in G:
    print(*g)
    


Measured memory_bytes: 6392
S=input()
e = True
o = True
for i in range(0, len(S), 2):
  if S[i] == 'L':
    o = False
for i in range(1, len(S), 2):
  if S[i] == 'R':
    e = False
if e and o:
  print("Yes")
else:
  print("No")
  
  

Measured memory_bytes: 2940
// Problem : C - : (Colon)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

const double PI = acos(-1);

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    
    double angle = abs(m * PI / 30 - (h + m / 60.0) * PI / 6);
    if (angle > PI)
        angle = 2 * PI - angle;
    
    cout << fixed << setprecision(10) << sqrt(a * a + b * b - 2 * a * b * cos(angle)) << "\n";

    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(ll A, ll B) {
  int ans = max(0ll,A - 2*B);
  cout << ans << endl;
}

int main() {
  ll A;
  cin >> A;
  ll B;
  cin >> B;
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#define mp make_pair
using namespace std;
int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> t;
    int i;
    for(i=0; i<n; i++){
        int x;
        cin >> x;
        t.push_back(x);
    }
    int m;
    cin >> m;
    //vector<pair<int, int>> drinks;
    for(i=1; i<=m; i++){
        int p, x;
        cin >> p >> x;
        int tim = x;
        for(int j=0; j<n; j++){
            if(j==(p-1)) continue;
            else tim += t[j];
        }
        cout << tim << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
n, l = [int(v) for v in input().split()]

pre_t = (n * (n-1) // 2) + (n * l)
if l >= 0:
    fix = -l
elif l + n - 1 < 0:
    fix = -(l + n -1)
else:
    fix = 0
print(pre_t + fix)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int retu[8][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}};

int main(){
    lint A, B, K;
    cin >> A >> B >> K;
    lint taka = min(A, K);
    A -= taka;
    K -= taka;
    taka = min(B, K);
    B -= taka;
    K -= taka;
    cout << A << " " << B << endl;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    char c;
    cin >> c;
    if (isupper(c)) cout << 'A';
    else cout << 'a';
    cout << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	vll t(1e5 + 1, 0), p(1e5 + 1, 0);
	repeq(i, 2, 1e5) {
		if (IsPrimeNumber(i)) {
			p[i] = 1;
		}
		if (i & 1 && p[i] == 1 && p[(i + 1) / 2] == 1) {
			t[i] = t[i - 1] + 1;
		}
		else {
			t[i] = t[i - 1];
		}
	}

	ll Q, l, r;
	cin >> Q;
	rep(i, 0, Q) {
		cin >> l >> r;
		cout << t[r] - t[l - 1] << endl;
	}


	return 0;
}


Measured memory_bytes: 2304
#include<iostream>
#include<vector>
#include<cstdlib>
#include <cmath>
#define INF 100000000
template<class T> inline bool chmax(T& a, T b)
{ if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b)
{ if (a > b) { a = b; return 1; } return 0; }

using namespace std;

int main(){
  int i,j,k,n,d,a[300000],max1=0,max2=0,x;

  cin >>n;
  for(i=0;i<n;i++)cin>>a[i];

  for(i=0;i<n;i++){
    if(max1<a[i]){
      max1=a[i];
      x=i;
    }
  }
  for(i=0;i<n;i++){
    if(i==x)continue;
    if(max2<a[i]){
      max2=a[i];
    }
  }

  for(i=0;i<n;i++){
    if(i==x)cout <<max2<<endl;
    else cout << max1<<endl;
  }

  return 0;
}

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

int main(){
  int n;
  cin >> n;
  int array[n];
  for (int i = 0; i < n; i++)
  {
    cin >> array[i];
  }
  int min = 100000000;
  // 各座標についてのloop
  for (int i = i; i < 101; i++)
  {
    int sum = 0;
    // 体力消費の総和を求める
    for (int j = 0; j < n; j++)
    {
      sum += pow((array[j] - i), 2.0);
    }
    if (sum < min)
    {
      min = sum;
    }
  }
  cout << min << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int t = 0;
    while (a > 0 and c > 0) {
        if (t == 1) a -= d; else c -= b;
        t = (t + 1) % 2;
    }
    cout << (a <= 0 ? "No" : "Yes") << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
 
#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
 
using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
 
int main() {
  ull a, b, c;
  cin >> a >>  b >> c;

  cout << (a * b) / 2 << endl;
 
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a<=9)
	{
		if(b<=9) cout<<a*b;
		else cout<<-1;
	}
	else cout<<-1;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const double PI = 3.14159265358979;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

int main() {
	ll n; cin >> n;
	ll o = 0;
	ll e = 0;
	rep(i, 0, n) {
		ll a; cin >> a;

		if (1 & a) o++;
		else  e++;
	}
	cout << ((o >= 1) ? "first" : "second") << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        int[] c = new int[26];
        for(char x : s.toCharArray()) {
            c[x-97] += 1;
        }
        boolean found = false;
        for(int i = 0; i < 26; i++) {
            if (1 < c[i]) {
                found = true;
            }
        }
        System.out.println(!found ? "yes" : "no");
    }
}


Measured memory_bytes: 23124
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.*;
/**
 * Created by Aksenov239 on 24.09.2016.
 */
public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    public String nextToken() throws IOException{
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws IOException{
        return Integer.parseInt(nextToken());
    }

    public void solve() throws IOException {
        int n = nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt() - 1;
        }
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (a[a[i]] == i) {
                cnt++;
            }
        }
        out.println(cnt / 2);
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);

            solve();

            out.close();
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 22708
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define all(vec) vec.begin(),vec.end()
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
#define pb push_back
#define fi first
#define se second
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1LL<<60;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
int main(){
    int n;
    cin>>n;
    int ma=0;
    int ans=0;
    REP(i,n){
        int t;
        cin>>t;
        ans+=t;
        chmax(ma,t);
    }
    cout<<ans-ma/2<<endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    string s; getline(cin, s);

    s += ".";
    int l = s.size(), cnt = 0;
    bool sec = false;
    REP(l)
    {
        if(s[i] == ' ' || s[i] == '.' || s[i] == ',')
        {
            if(cnt>=3 && cnt <=6)
            {
                if(sec) cout << " " ;
                cout << s.substr(i - cnt, cnt); 
                sec = true;
            }
            cnt = 0;
        }
        else cnt++;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
    }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<long double> vld;
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846
#define sqr(a) ((a) * (a))
#define len(V) (int)V.size()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define fix(a) fixed << setprecision(a)
#define readv(x) for(auto &_ : (x)) {cin >> _;}
#define printv(x) for(auto &_ : (x)) {cout << _ << ' ';} cout << endl
#define EPS 1e-6
#define MAXN 100047

int n; 
vi a; 

bool check(){
	for (auto el : a){
		if (el % 2 == 1) return false;
	}	
	return true;
}

void solve(){
	cin >> n;
	FOR(i, 0, n) {
		int x; cin >> x;
		a.pb(x);
	}
	
	int res = 0;
	while(check()){
		FOR(i, 0, n){
			a[i] /= 2;
		}
		res++;
	}
	
	cout << res << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	solve();
	
	return 0;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 30001
using namespace std;

int read_p,read_ca;
inline int read(){
	read_p=0;read_ca=getchar();
	while(read_ca<'0'||read_ca>'9') read_ca=getchar();
	while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
	return read_p;
}
const int MOD=1e9+7;
int n,a[11000],w;
int main(){
	int i,j,k;
	n=read();
	a[0]=1;
	while(n--){
		w=read();
		for (i=10000;i>=0;i--) a[i+w]|=a[i];
	}
	for (i=10000;i>=0;i--) if (a[i]&&i%10) return printf("%d\n",i),0;
	puts("0");
}

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

using namespace std;
using ll = long long;

//cout << std::fixed << std::setprecision(15) << y << endl;

int main() {
    ll a,b,c,x,y = 0;
    cin >> a >> b >> c >> x >> y;

    ll MIN = 1001001001;
    for(ll i = 0;i <= max(x,y);i++){
        ll aCnt,bCnt,abCnt = 0;
        if(x >= y){
            aCnt = i;
            if(x >= i){
                abCnt = (x - i) * 2;
            }
            if(y >= abCnt / 2){
                bCnt = y - abCnt / 2;
            }
            //cout << aCnt << " " << bCnt << " " << abCnt << endl;
            MIN = min(MIN,aCnt * a + bCnt * b + abCnt * c);
        }else{
            bCnt = i;
            if(y >= i){
                abCnt = (y - i) * 2;
            }
            if(x >= abCnt / 2){
                aCnt = x - abCnt / 2;
            }
            //cout << aCnt << " " << bCnt << " " << abCnt << endl;
            MIN = min(MIN,aCnt * a + bCnt * b + abCnt * c);
        }
        
    }
    cout << MIN << endl;
    return 0;
}

Measured memory_bytes: 3624
{-# LANGUAGE MultiWayIf #-}

import Data.Array.IO
import Control.Monad

main :: IO ()
main = do
  [n, m] <- (map read . words) <$> getLine :: IO [Int]
  a1 <- newArray (1, n) False :: IO (IOArray Int Bool)
  an <- newArray (1, n) False :: IO (IOArray Int Bool)
  replicateM_ m $ do
    [a, b] <- (map read . words) <$> getLine :: IO [Int]
    if
      | a == 1 -> writeArray a1 b True
      | b == 1 -> writeArray a1 a True
      | a == n -> writeArray an b True
      | b == n -> writeArray an a True
      | otherwise -> return ()

  check <- forM [1..n] $ \i -> do
        p1 <- readArray a1 i
        pn <- readArray an i
        return $ p1 && pn

  putStrLn $ if or check then "POSSIBLE" else "IMPOSSIBLE"


Measured memory_bytes: 17788
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#include <climits>
#include <memory>
#include <numeric>
#include <utility>


#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
#define PI 3.14159265358979323846264338327950L;
const int INF2 = 1001001001;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
const ll LINF = 1e18;
using namespace std;
using Graph = vector<vector<int>>;



int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
	if (n == 0)return 0;
	if (memo[n] != -1)return memo[n];

	int res = n;

	for (int pow6 = 1; pow6 <= n; pow6 *= 6)res = min(res, rec(n - pow6) + 1);

	for (int pow9 = 1; pow9 <= n; pow9 *= 9)res = min(res, rec(n - pow9) + 1);

	return memo[n] = res;
}

int calc(int x) {
	int ret = 0;
	while (x % 2 == 0) {
		x /= 2;
		ret++;
	}

	return ret;
}

int a[12][12];
int D;
ll G;
vector<ll> P, C;

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

	vector<int> data(3);

	cin >> data[0] >> data[1] >> data[2];

	sort(data.begin(), data.end(), greater<int>());

	cout << data[0] * 10 + data[1] + data[2] << endl;

	

}
	

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

int t, A[1000];

void push(int);
int pop();
int main(){
  int a,b;
  int t=0;
  char s[100];

  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'){
      a=pop();
      b=pop();
      push(a+b);
    }
    else if(s[0]=='-'){
      b=pop();
      a=pop();
      push(a-b);
  }
    else if(s[0]=='*'){
      a=pop();
      b=pop();
      push(a*b);
}
    
    else{
      push(atoi(s));
    }
  }
  printf("%d\n",pop());
  return 0;}

void push(int a){
  A[++t]=a;
}
int pop(){
  t--;
  return A[t+1];

}



Measured memory_bytes: 2736
s = input()
ans = 0
total = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        total += 1
        if total > ans:
            ans = total
    else:
        total = 0
print(ans)

Measured memory_bytes: 9096
import math
import sys
import os

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")


a,b,c,d = LI()
ans = -INF
ans = max(ans,a*c)
ans = max(ans,b*d)
ans = max(ans,b*c)
ans = max(ans,a*d)

print(ans)

Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<(ll)n;i++)
#define repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a-1;i>=(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 1000;
const char END = '\n';

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

	ll Ans = 0, N;
	cin >> N;
	vector<ll> H(N);
	rep(i, N)
		cin >> H[i];

	ll sub = 0;
	rep1(i, N) {
		if (H[i] <= H[i - 1])
			sub++;
		else {
			if (sub > Ans)
				Ans = sub;
			sub = 0;
		}
	}
	if (sub > Ans)
		Ans = sub;
	cout << Ans;
	cout << END;
	return 0;
}

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


int main() {
    int N; cin>>N;
    int a1[N];
    vector<int>a2(N);
    rep(i,N)cin>>a1[i];
    rep(i,N)cin>>a2[i];
    reverse(a2.begin(),a2.end());
    int suma1[N],suma2[N];
    suma1[0]=a1[0];
    suma2[0]=a2[0];
        for(int i=1;i<N;i++){
        suma1[i]=suma1[i-1]+a1[i];
        suma2[i]=suma2[i-1]+a2[i];
    }
    int ans[N];

    int mx =0;
    rep(i,N){
        ans[i]=suma1[i]+suma2[N-1-i];
        mx=max(mx,ans[i]);
    }
cout<<mx<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll k; cin>>k;
    ll a,b; cin>>a>>b;
    for(ll i=k; i<=1005; i+=k){
        if(i>=a && i<=b){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
}

Measured memory_bytes: 3636
//
//AtCoder Beginner Contest 109
//C
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#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 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 ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    vector<ll> x(n);
    REP(i, n) cin >> x[i];

    if (n==1) {
        cout << abs(X-x[0]) << endl;
        return 0;
    }

    ll ans = gcd(abs(X-x[0]), abs(X-x[1]));
    REP(i,n){
        ans = gcd(ans, abs(X-x[i]));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3892
N=int(input())
S=list(input())
a1=[i for i in range(0,(N//2))]
a2=[i for i in range((N//2),N)]
a3=[S[i] for i in a1]
a4=[S[i] for i in a2]
print('Yes' if a3==a4 else 'No')

Measured memory_bytes: 9156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var p = Console.ReadLine().Split().Select(y=>long.Parse(y)).ToArray();
		var q = Console.ReadLine().Split().Select(y=>long.Parse(y)).ToArray();
		var t = Console.ReadLine().ToLong();
		var a = p[0];
		var v = p[1];
		var b = q[0];
		var w = q[1];
		
		var k = Math.Abs(b-a)/(double)(v-w);
		
		if(k >= 0 && Math.Abs(k) <= t)
		{
			Console.WriteLine("YES");
			return;
		}
		Console.WriteLine("NO");
		
	}
	
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 28256
import scala.io.StdIn._
import scala.util.control.Breaks

object Main extends App {
  val blk = new Breaks

  blk.breakable {
    while (true) {
      val Seq(h, w) = readLine.split(' ').map(_.toInt).toList
      if (h == 0 && w == 0) blk.break()

      val arr = new Array[Array[Char]](h)

      for (i <- 0 until h) {
        arr(i) = readLine.toCharArray
      }

      var x = 0
      var y = 0

      while (arr(y)(x) != '.' && arr(y)(x) != 'X') {
        val tile = arr(y)(x)
        arr(y)(x) = 'X'

        tile match {
          case '>' => x += 1
          case 'v' => y += 1
          case '<' => x -= 1
          case '^' => y -= 1
        }
      }
      if (arr(y)(x) == '.') println("%d %d".format(x, y)) else println("LOOP")
    }
  }
}


Measured memory_bytes: 44220
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
int main() {
  int a;
  cin>>a;
  rep(i,9){
    if(a%(i+1)==0 && a/(i+1)<10){
      cout<<"Yes";
      return 0;
    }
  }
  cout<<"No";
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    int sub = b - a;

    int sum = 0;
    for (int i = 1; i < sub; i++)
    {
        sum += i;
    }
    //sum *= 2;

    cout << sum - a << endl;

    return 0;
}

Measured memory_bytes: 256