akhauriyash/Code-Regression huggingface dataset:
S = input()
first_half = int(S[:2])
second_half = int(S[2:])
is_month = lambda x: 1 <= x and x <= 12

if is_month(first_half) and is_month(second_half):
    print('AMBIGUOUS')
elif is_month(first_half) and not is_month(second_half):
    print('MMYY')
elif not is_month(first_half) and is_month(second_half):
    print('YYMM')
else:
    print('NA')

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

#define ff              first
#define ss              second
#define int             long long
// #define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             998244353
#define endl            "\n"
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
int max(int a, int b) {if (a > b) return a; else return b;}
int min(int a, int b) {if (a < b) return a; else return b;}
// #DEBUG
void __print(int x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
// ###################################################################
int pow(int a, int b, int m) {
  int r = 1, e = a;
  while (b) {
    if (b & 1) r = (r * e) % m;
    e = (e * e) % m;
    b >>= 1;
  }
  return r;
}
void fast()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
// First write recursive with no ristrictions;
// Then apply ristrictions; (What can we do? and Can we do it?)
// We are adding mod because sometimes ans could be negeative (So always add mod when substracting 2 mod answers)
int32_t main() {
  fast();
  int k;
  string s;
  cin >> k;
  cin >> s;
  if (s.length() <= k) {
    cout << s << endl;
  }
  else {
    string a(s.begin(), s.begin() + k);
    cout << a << "..." << endl;
  }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x,y;	cin>>x>>y;
	FOR(i,0,x+1){
		if(2*i+4*(x-i)==y){
			Yes();
			return 0;
	}
    }
	No();

    return 0;
}




Measured memory_bytes: 3688
from collections import deque

icase=0
if icase==0:
    h,w=map(int,input().split())
    a=[[0]*w for i in range(h)]
    for i in range(h):
        a[i]=list(map(int,input().split()))        
elif icase==1: 
    h,w=2,3
    a=[[1, 2, 3], [0, 1, 1]]
elif icase==2: 
    h,w=3,2
    a=[[1, 0], [2, 1], [1, 0]]
elif icase==3: 
    h,w=1,5
    a=[[9, 9, 9, 9, 9]]


astat=0
im=-1
jm=-1
q=deque()

for i in range(h):
    if i%2==0:
        wst=0
        wed=w
        wpt=1
    else:
        wst=w-1
        wed=-1
        wpt=-1
    for j in range(wst,wed,wpt):
#        print("i,j:",i,j)
        if a[i][j]%2==1 and astat==0:
            astat=1
#            print("A:",im,jm,i,j)
        elif a[i][j]%2==1 and astat==1:
            q.append((im,jm,i,j))
#            print("B:",im,jm,i,j)
            astat=0
        elif a[i][j]%2==0 and astat==0:
            astat=0
#            print("C:",im,jm,i,j)
        elif a[i][j]%2==0 and astat==1:
            astat=1
            q.append((im,jm,i,j))
#            print("D:",im,jm,i,j)
        im=i
        jm=j
        
print(len(q))
for i in range(len(q)):
    yf,xf,yt,xt=q.popleft()
    stra=str(yf+1)+" "+str(xf+1)+" "+str(yt+1)+" "+str(xt+1)
    print(stra)    
    

Measured memory_bytes: 26136
#include <iostream>

using namespace std;
int main()
{
    int n, a, b, c, d, x, y;
    cin >> n >> a >> b >> c >> d;
    if (n % a == 0)
    {
        x = n / a * b;
    }
    else
    {
        x = (n / a + 1) * b;
    }
    if (n % c == 0)
    {
        y = n / c * d;
    }
    else
    {
        y = (n / c + 1) * d;
    }

    if (x > y)
    {
        cout << y << endl;
    }
    else
    {
        cout << x << endl;
    }
    return 0;
}


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

int nth_bit(int64_t num, int n){
    return (num >> n) & 1;
}

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    B ^= A;
    int total = 1<<N;
    
    int sz = 0;
    vector<int> perm(N, -1);
    int pt1 = N-1, pt0 = 0;
    for(int i=0; i<N; i++){
        if(nth_bit(B, i)){
            sz++;
            perm[pt1] = i;
            pt1--;
        }else{
            perm[pt0] = i;
            pt0++;
        }
    }
    if(sz%2 == 0){
        cout << "NO" << endl;
        return 0;
    }

    vector<int> path[17];
    path[0] = {0};
    for(int i=1; i<N; i++){
        int prv = 1<<(i-1);
        for(int j=0; j<prv; j++) path[i].push_back(path[i-1][j]*2);
        for(int j=prv-1; j>=0; j--) path[i].push_back(1 + path[i-1][j]*2);
    }

    vector<int> ans;
    int offset = 0;
    int bitlen = N-1;
    bool rvs = false, fin = false;
    for(int i=0; ; i++){
        if(!rvs){
            for(int j=0; j<path[bitlen].size(); j++){
                ans.push_back(offset + path[bitlen][j]);
            }
        }else{
            for(int j=path[bitlen].size()-1; j>=0; j--){
                ans.push_back(offset + path[bitlen][j]);
            }
        }
        if(fin) break;
        offset += 1<<bitlen;
        rvs = !rvs;
        if(i == sz-1){
            fin = true;
        }else{
            bitlen--;
        }
    }

    int Ans[1<<17];
    for(int i=0; i<total; i++){
        int a = 0;
        for(int k=0; k<N; k++) if(nth_bit(ans[i], k)) a += 1<<(perm[k]);
        Ans[i] = a^A;
    }

    cout << "YES" << endl;
    for(int i=0; i<total; i++) cout << Ans[i] << " \n"[i==total-1];
    return 0;
}


Measured memory_bytes: 2744
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int h, w;
  cin >> h >> w;
  vector<vector<char> > S(h,vector<char>(w));
  int numwall = 0;
  rep(i,h)rep(j,w) {
    cin >> S[i][j];
    if (S[i][j] == '#') numwall++;
  }
  queue<P> que;
  que.push(P(0,0));
  vector<vector<int> > dist(h,vector<int>(w, -1));
  dist[0][0] = 0;
  while(!que.empty()) {
    P p = que.front(); que.pop();
    rep(i,4) {
      int y = p.first + dy[i];
      int x = p.second + dx[i];
      if (y<0||x<0||x>=w||y>=h) continue;
      if (S[y][x] == '#') continue;
      if (dist[y][x] != -1) continue;
      dist[y][x] = dist[p.first][p.second]+1;
      que.push(P(y,x));
    }
  }
  int ans = h*w - (dist[h-1][w-1]+1) - numwall;
  if (dist[h-1][w-1] != -1) cout << ans << endl;
  else cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
num=input()
if 1<=int(num)<=10000:
    if int(num)<=1000:
        change=1000-int(num)
    else:
        array_1=list(num)
        array_1=array_1[-4:]
        a=''.join(array_1)
        b=int(array_1[-4])+1
        pay=b*1000
        change=pay-int(a)
        if array_1[-1]=="0" and array_1[-2]=="0" and array_1[-3]=="0":
            change=0
    print(change)

Measured memory_bytes: 9116
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main(){
  string a,b,c;
  cin>>a>>b>>c;
  reverse(all(a));
  reverse(all(b));
  reverse(all(c));
  char state='a';
  while(true){
    if(state=='a'){
      if(sz(a)==0) break;
      state=a[sz(a)-1];
      a.pop_back();
    }
    if(state=='b'){
      if(sz(b)==0) break;
      state=b[sz(b)-1];
      b.pop_back();
    }
    if(state=='c'){
      if(sz(c)==0) break;
      state=c[sz(c)-1];
      c.pop_back();
    }
  }
  if(state=='a'){
    cout<<"A"<<endl;
    return 0;
  }
  if(state=='b'){
    cout<<"B"<<endl;
    return 0;
  }
  if(state=='c'){
    cout<<"C"<<endl;
    return 0;
  }
}


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

using namespace std;

const int md = 1e9 + 7;

long long solve(vector<int> &va, int n, vector<long long> &memo, int cur = 0) {
  if (cur == n) {
    return 1;
  } else if (cur > n) {
    return 0;
  }

  if (memo[cur] < 0) {
    if (binary_search(va.begin(), va.end(), cur)) {
      memo[cur] = 0;
    } else {
      memo[cur] =
          (solve(va, n, memo, cur + 1) + solve(va, n, memo, cur + 2)) % md;
    }
  }

  return memo[cur];
}

int main(int argc, const char *argv[]) {
  int n, m;
  cin >> n >> m;

  vector<int> va(m);
  for (int i = 0; i < m; ++i) {
    cin >> va[i];
  }

  sort(va.begin(), va.end());

  vector<long long> memo(n, -1);
  cout << solve(va, n, memo) << '\n';
  return 0;
}

Measured memory_bytes: 8832
N = int(input())
ans = 0
da =0
db = 0
dba = 0
for i in range(N):
    s = input()
    k = s.count('AB')
    ans += k
    if s[0] == 'B' and s[-1] == 'A':
        dba +=1
        continue
    if s[0] == 'B':
        db +=1
    if s[-1] == 'A':
        da +=1
if dba != 0:
    ans += dba -1
    if da >= 1:
        ans +=1
        da -=1
    if db >=1:
        ans +=1
        db -=1
    ans += min(da,db)
    print(ans)
    exit()
if dba == 0:
    ans += min(da,db)
    print(ans)
    exit()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
using lint = int64_t;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> a(H, vector<char>(W));
    rep(i, H) rep(j, W) cin >> a[i][j];
    
    vector<vector<char>> b, c;
    b = c = vector<vector<char>>(H, vector<char>(W, '.'));
    int bx = 0, by = 0, cx = W - 1, cy = H - 1;
    vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
    int bt = 0, ct = 2;
    rep(i, H * W / 2) {
        b[by][bx] = '#';
        c[cy][cx] = '#';
        if (bx + dx[bt] < 0 || bx + dx[bt] >= W || by + dy[bt] < 0 || by + dy[bt] >= H) bt = (bt + 1) % 4;
        else if (c[by + dy[bt]][bx + dx[bt]] == '#') bt = (bt + 1) % 4;
        if (cx + dx[ct] < 0 || cx + dx[ct] >= W || cy + dy[ct] < 0 || cy + dy[ct] >= H) ct = (ct + 1) % 4;
        else if (b[cy + dy[ct]][cx + dx[ct]] == '#') ct = (ct + 1) % 4;
        bx += dx[bt];
        by += dy[bt];
        cx += dx[ct];
        cy += dy[ct];
    }
    rep(i, H) rep(j, W) {
        if (a[i][j] == '#') {
            b[i][j] = '#';
            c[i][j] = '#';
        }
    }
    rep(i, H) {
        rep(j, W) cout << b[i][j];
        cout << "\n";
    }
    cout << "\n";
    rep(i, H) {
        rep(j, W) cout << c[i][j];
        cout << "\n";
    }
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int a, b, c;
  cin >> a >> b >> c;
  priority_queue<int, vint, greater<int> > que;
  int ans = 0;
  que.push(a);
  que.push(b);
  que.push(c);
  while(!que.empty()) {
    int u, v, w;
    u = que.top(); que.pop();
    v = que.top(); que.pop();
    w = que.top(); que.pop();
    if(u == v && u == w) break;
    if(u < w && v < w) {
      ++ans;
      ++u, ++v;
    } else {
      ++ans;
      u += 2;
    }
    que.push(u);
    que.push(v);
    que.push(w);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

typedef complex<double> P;
typedef pair<P,double> C;

double d[1010][1010];


double func(C &a, C &b){
	if(abs(a.F-b.F) <= a.S+b.S){
		return 0;
	}
	return abs(a.F-b.F)-a.S-b.S;
}


void mainmain(){
	P s,g;
	double aa,bb;
	scanf("%lf%lf", &aa, &bb);
	s=P(aa,bb);
	scanf("%lf%lf", &aa, &bb);
	g=P(aa,bb);
	int n;
	scanf("%d", &n);
	vector<C> v(n);
	rep(i,n){
		double a,b,c;
		scanf("%lf%lf%lf", &a, &b, &c);
		v[i] = mkp(P(a,b), c);
	}
	n += 2;
	v.PB(mkp(s,0));
	v.PB(mkp(g,0));
	rep(i,n){
		rep(j,i){
			double dis = func(v[i],v[j]);
			d[i][j] = dis;
			d[j][i] = dis;
		}
	}
	rep(i,n) d[i][i] = 0;
	rep(k,n){
		rep(i,n){
			rep(j,n){
				mins(d[i][j], d[i][k]+d[k][j]);
			}
		}
	}
	printf("%.10lf\n", d[n-2][n-1]);
}


signed main() {
    mainmain();
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string ans = "No";
  for(int i = 1; i <= 9; i++){
    for(int j = 1; j <= 9; j++){
      if(i*j == n) ans = "Yes";
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
struct fastio{fastio(){std::ios::sync_with_stdio(false);std::cin.tie(nullptr);}}_fast_io_;
template<class T> bool chmin (T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> bool chmax (T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }

int main() {
	int n;
	long long d;
	std::cin >> n >> d;
	int ans = 0;
	d *= d;
	for (int i = 0; i < n; i++) {
		long long x, y;
		std::cin >> x >> y;
		long long s = x * x + y * y;
		if (s <= d) ans++;
	}
	
	std::cout << ans << '\n';
	
	return 0;
}

Measured memory_bytes: 3640
# しゃくとり

mod = 10**9 + 7

n,k = map(int,input().split())

cnt = 0
sum_ = sum(range(n + 1))
#print("sum", sum_)
#print(list(range(n + 1)))
max_ = sum(range(n - k + 1, n + 1))
min_ = sum(range(k))
for i in range(k, n+2):
    #print(max_, min_, cnt)
    cnt += max_ - min_ + 1
    cnt %= mod
    #print(cnt)
    
    if n > i + 1:
        max_ +=  n - i
    else:
        max_ = sum_
    min_ += i
print(cnt)

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

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

  int x = 7 % k, cnt = 1;

  while(x != 0 && cnt <= 1e7){
    //cout << x << endl;
    x = ((x * 10) + 7) % k;
    cnt++;
  }
  if(cnt == 1e7 + 1) cout << -1 << endl;
  else cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;char st;
    cin>>n;
    string str;
    for(int i=0;i<=n;i++){
        getline(cin,str);
        bool kawa=0;
        for(int j=1;j<50;j++){
            for(int k=1;k<50;k++){
                string strin=str;
                for(int l=0;strin[l]!='\0';l++)if(strin[l]-'a'>=0&&strin[l]-'z'<=0)strin[l]=(j*(strin[l]-'a')+k)%26+'a';
                for(int l=0;strin[l]!='\0';l++){
                    if(strin[l]=='t'&&strin[l+1]=='h'&&(strin[l+2]=='a'&&strin[l+3]=='t'||strin[l+2]=='i'&&strin[l+3]=='s')){
                        cout<<strin<<endl;
                        kawa=1;
                        break;
                    }
                }
                if(kawa)break;
            }
            if(kawa)break;
        }
    }
}

Measured memory_bytes: 1208
import math

a, b, c = map(int, input().split())

S = 0.5 * a * b * math.sin(math.radians(c))
x = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(c)))
L = a + b + x
H = S / (0.5 * a)

print(S)
print(L)
print(H)



Measured memory_bytes: 5708
# -*- coding: utf-8 -*-

#----------
N_list = [int(input().strip()) for _ in range(5)]
#----------

diff=0
sum=0
for i,v in enumerate(N_list):
    d = (10 - (v % 10)) % 10
    if diff < d:
        diff = d
    
    sum += -(-v // 10)*10

sum -= diff
print(sum)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b >= c) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, n;
    cin >> h >> w >> n;
    vector<P> ij(n);
    rep(i, n) cin >> ij[i];
    sort(all(ij));
    ij.emplace_back(h+1, 0);
    n++;

    int k = 0, now = 1;
    rep(i, h+1) {
        bool x = true;
        while(k < n and ij[k].first == i+1) {
            if(ij[k].second < now) {
                cout << i << endl;
                return 0;
            }
            if(ij[k].second == now and x) {
                now--;
                x = false;
            }
            k++;
        }
        now++;
    }
}

Measured memory_bytes: 6380
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;

int n, m; 
vector<int> tree[2005];
int dist[2005][2005];
int parent[2005][2005]; ///parent[root of tree][node]
bool collinear(int a, int b, int c){
	int X = dist[a][b];
	int Y = dist[b][c];
	int Z = dist[a][c];
	if(max(max(X,Y),Z) * 2 == X+Y+Z) return true;
	else return false;
}
void dfs1(int u, int p, int root){
	parent[root][u] = p;
	for(int v : tree[u]){
		if(v == p) continue;
		dist[root][v] = dist[root][u] + 1;
		dfs1(v, u, root);
	}
}

bool G[2005][2005]; ///shortened graph
vector<int> adj[2005]; ///shortened graph but adjList

///let c be trigger[a][b]. if a-b is added, a-c shortens to b-c.
///i.e. if the tree is rooted at a, b is in the subtree of c
int trigger[2005][2005]; 
void add(int a, int b){
	
	if(trigger[a][b] == b || trigger[b][a] == a) return; ///edge alrd exists
	else if(trigger[a][b]) add(trigger[a][b], b); ///shorten a-b to b-c
	else if(trigger[b][a]) add(trigger[b][a], a); ///shorten a-b to a-c
	else{
		///this is to settle the case where a-b shortens some other edge
		trigger[a][b] = b;
		trigger[b][a] = a;
		G[a][b] = 1; G[b][a] = 1; ///add the edge
		
		vector<ii> toadd;
		queue<int> bfs;
		
		bfs.push(b);
		while(!bfs.empty()){ ///explore the subtree of b (where a is root)
			int u = bfs.front(); bfs.pop();
			for(int v : tree[u]){
				if(v == parent[a][u]) continue; ///subtree only
				
				if(trigger[a][v] == 0){
					trigger[a][v] = b;
					bfs.push(v);
				}
				else{
					G[a][v] = 0; G[v][a] = 0; ///break the old edge
					toadd.push_back(ii(b, v)); 
				}
			}
		}
		
		bfs.push(a);
		while(!bfs.empty()){ ///explore the subtree of a (where b is root)
			int u = bfs.front(); bfs.pop();
			for(int v : tree[u]){
				if(v == parent[b][u]) continue; ///subtree only
				
				if(trigger[b][v] == 0){
					trigger[b][v] = a;
					bfs.push(v);
				}
				else{
					G[b][v] = 0; G[v][b] = 0; ///break the old edge
					toadd.push_back(ii(a, v)); 
				}
			}
		}
		
		for(ii e : toadd) add(e.first, e.second);
	}
}


int ans = 0;
void dfs2(int u, int p){
	for(int v : adj[u]){
		if(v == p) continue;
		if(p != -1 && !collinear(u,v,p)) continue;
		
		ans++;
		dfs2(v,u);
	}
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	
	for(int i = 1;i < n;i++){
		int a, b; cin >> a >> b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	for(int i = 1;i <= n;i++) dfs1(i, -1, i);
	
	for(int i = 1;i <= m;i++){
		int a, b; cin >> a >> b;
		add(a,b); ///add the edges one by one
	}
	
	for(int u = 1;u <= n;u++){
		for(int v = 1;v <= n;v++){
			if(G[u][v]) adj[u].push_back(v); ///convert adjmat to adjlist
		}
	}
	
	for(int i = 1;i <= n;i++) dfs2(i,-1);
	cout << ans/2;
}


Measured memory_bytes: 55236
#include<stdio.h>
#include<vector>
using namespace std;
struct my
{
    vector<int>high,p;
    void make(int x)
    {
        high.resize(x,0);
        p.resize(x,0);
        for (int i=0;i<x;i++)
        {
            high[i]=0;
            p[i]=i;
        }
    }
    void unite(int x,int y)
    {
        link(findside(x),findside(y));
    }
    bool same(int x,int y)
    {
        return findside(x)==findside(y);
    }
    void link(int x,int y)
    {
        if(high[x]>high[y])
        {
            p[y]=x;
        }
        else {
           p[x]=y;
           if(high[x]==high[y])
                high[y]++;
        }
    }
    int findside(int x)
    {
        if(x!=p[x])
        {
            p[x]=findside(p[x]);
        }
        return p[x];
    }
};
int main()
{
    int n,q;
    scanf("%d%d",&n,&q);
    my ds;
    ds.make(n);
    int s,biao,c;
    for(int i=1;i<=q;i++)
    {
        scanf("%d%d%d",&biao,&s,&c);
        if(biao==0) ds.unite(s,c);
        else {
            if(ds.same(s,c)) printf("1\n");
            else printf("0\n");
        }
    }
    return 0;
}

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

int main(){
  int A,B;
  
  cin >> A >> B;
  
  if(A <= 5)cout << "0" << endl;
  else if(A >= 6 && A <= 12)cout << B/2 << endl;
  else cout << B << endl;
  
  return 0;
  
}

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

int main() {
    int sum = 0;
    int N;
    cin >> N;

    int M = N;

    while (M > 0) {
        sum += M % 10;
        M = M / 10;
    }

    if (N % sum == 0) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define BIT(n) (1LL << (n))
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector< int > d(N);
  REP(i, N) { cin >> d[i]; }
  sort(ALL(d));
  cout << d[N / 2] - d[N / 2 - 1] << "\n";
}

Measured memory_bytes: 640
#! /usr/bin/env python3
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

limit = pow(10, 18)
N, *A = map(int, read().split())
A = sorted(A)

ans = 1
for a in A:
    ans *= a
    if ans > limit:
        print(-1)
        sys.exit()

print(ans) 


Measured memory_bytes: 38100
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;
int main(){
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> a(n+1),b(m+1);
    ll sum = 0;
    vector<ll> tmp(m);
    a[0] = 0;
    b[0] = 0;
    map<ll,ll> bm;
    for(ll i = 1; i < n+1; i++){
        cin >> a[i];
    }
    for(ll i = 1; i < m+1; i++){
        cin >> b[i];
        sum += b[i];
        bm[sum] = i;
        tmp[i-1] = sum;
    }
    sum = 0;
    ll ans = 0;
    for(ll i = 0; i < m; i++) tmp[i] = -tmp[i];
    sort(tmp.begin(),tmp.end());
    for(ll i = 0; i < n+1; i++){
        sum += a[i];
        if(sum > k) break;
        ll can = i;
        auto itr = lower_bound(tmp.begin(),tmp.end(),sum-k);
        if(itr != b.end()){
            if(-*itr+sum > k) continue;
            can += bm[-*itr];
            //cout << -*itr << endl;
        }
        //cout << can << " " << i << endl;
        ans = max(ans,can);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 20412
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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

//const int MAX = 700000;
static const ll MOD = 1000000007;
//static const ll INF = 100000000;

int main() {
    ll T1, T2, A1, A2, B1, B2, ans = 0;

    // input
    cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;

    // process
    ll A_distance = T1 * A1 + T2 * A2;
    ll B_distance = T1 * B1 + T2 * B2;

    if (A_distance == B_distance) {
        cout << "infinity" << endl;
        return 0;
    }

    if ((A1 > B1 && A2 > B2) || (A1 < B1 && A2 < B2)) {
        cout << 0 << endl;
        return 0;
    }

    if (A_distance > B_distance) {
        if (A1 > B1) {
            cout << 0 << endl;
            return 0;
        } else {
            ll dis1 = A_distance - B_distance;
            ll dis2 = (B1 - A1) * T1;
            ans = dis2 / dis1 * 2;
            ll T = dis2 % dis1;
            if (T != 0) {
                ans++;
            }
        }
    } else {
        if (B1 > A1) {
            cout << 0 << endl;
            return 0;
        } else {
            ll dis1 = B_distance - A_distance;
            ll dis2 = (A1 - B1) * T1;
            ans = dis2 / dis1 * 2;
            ll T = dis2 % dis1;
            if (T != 0) {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func solve() {
	var N string
	fmt.Scan(&N)

	if N[0] == N[1] && N[1] == N[2] {
		fmt.Println("Yes")
		return

	}
	if N[1] == N[2] && N[2] == N[3] {
		fmt.Println("Yes")
		return

	}
	fmt.Println("No")
}

func main() {
	solve()
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <numeric>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> ps(m);
    vector<string> ss(m);
    for (int i = 0; i < m ; i++)
    {
        cin >> ps[i] >> ss[i];
    }

    vector<int> penalties(n);
    vector<int> true_penalties(n);
    vector<bool> is_AC(n);
    for (auto &&i : is_AC)
    {
        i = false;
    }
    for (int i = 0; i < m; i++)
    {
        if (ss[i] == "WA")
        {
            penalties[ps[i] - 1]++;
        }
        else
        {
            if (!is_AC[ps[i] - 1])
            {
                true_penalties[ps[i] - 1] = penalties[ps[i] - 1];
                is_AC[ps[i] - 1] = true;
            }
        }
    }

    int acs = 0;
    for (auto &&i : is_AC)
    {
        if (i)
        {
            acs++;
        }
    }

    int penalty = accumulate(true_penalties.begin(), true_penalties.end(), 0);

    printf("%d", acs);
    printf(" ");
    printf("%d", penalty);

    return 0;
}

Measured memory_bytes: 6912
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <functional>
#include <algorithm>
#include <climits>

using namespace std;

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

struct Edge
{
	int to;
	int cost;
};

struct Node
{
	int city_index;
	int total_cost;
	int current_life;

	bool operator >(const Node &a) const
	{
		return total_cost > a.total_cost;
	}
};

int main()
{
	int city_count, initial_life, cooler_count, road_count, start_index, goal_index;
	while (cin >> city_count >> initial_life >> cooler_count >> road_count >> start_index >> goal_index,
		city_count)
	{
		// input
		vector<int> is_cooler(city_count, false);
		REP(i, cooler_count)
		{
			int cooler_index;
			cin >> cooler_index;
			is_cooler[cooler_index] = true;
		}
		vector<vector<Edge>> roads(city_count);
		REP(i, road_count)
		{
			int from, to, cost;
			cin >> from >> to >> cost;
			roads[from].push_back({ to, cost });
			roads[to].push_back({ from, cost });
		}

		// dijkstra
		vector<vector<int>> d(city_count, vector<int>(initial_life + 1, INT_MAX)); // [city_index][current_life] => total_cost
		d[start_index][initial_life] = 0;
		priority_queue<Node, vector<Node>, greater<Node> > pq;
		pq.push({ start_index, 0, initial_life });
		while (!pq.empty())
		{
			auto current_node = pq.top(); pq.pop();
			for (auto &road : roads[current_node.city_index])
			{
				if (is_cooler[current_node.city_index])
				{
					REP(i, initial_life - current_node.current_life + 1)
					{
						int life = current_node.current_life + i - road.cost;
						if (life < 0)
						{
							continue;
						}
						int cost = current_node.total_cost + road.cost + i;
						if (cost < d[road.to][life])
						{
							d[road.to][life] = cost;
							pq.push({ road.to, cost, life });
						}
					}
				}
				else
				{
					int life = current_node.current_life - road.cost;
					if (life < 0)
					{
						continue;
					}
					int cost = current_node.total_cost + road.cost;
					if (cost < d[road.to][life])
					{
						d[road.to][life] = cost;
						pq.push({ road.to, cost, life });
					}
				}
			}
		}
		auto res = min_element(d[goal_index].begin(), d[goal_index].end());
		if (*res == INT_MAX)
		{
			cout << "Help!" << endl;
		}
		else
		{
			cout << *res << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1600
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int x,a;
    cin >> x >> a;
    if(x<a){
        put(0);
    }else{
        put(10);
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#define f(a,b,c,d) for(a=b; a<=c; a+=d)
#define fd(a,b,c,d) for(a=b; a>=c; a-=d)
#define readD(n) scanf("%d", &n)
#define readC(n) scanf("%c", &c)
#define readLLD(n) scanf("I64t", &n)
#define NMAX 100050
#define INF 999999999

using namespace std;

int n, i, minVal[NMAX], val[NMAX], k, j;

int main(){
   readD(n);
   readD(k);
   f(i,1,n,1){
        readD(val[i]);
        }
   minVal[1] = 0;
   f(i,2,n,1){
        minVal[i] = INF;
        f(j, 1, k, 1)
            if(i-j >=1)
                minVal[i] = min(minVal[i], minVal[i-j]+abs(val[i]-val[i-j]));
                else
                break;
        }
   printf("%d", minVal[n]);
   return 0;
   }


Measured memory_bytes: 896
def allocate(n,w,k,p):
	t=0
	c=1
	for i in range(n):
		if t + w[i] > p:
			t=0
			c+=1
			if c > k:
				return -1
		t+=w[i]
	return 0

n,k=map(int,input().split())
w=[0]*n
m=(1<<30)*-1
s=0
for i in range(n):
	w[i]=int(input())
	m=max(m,w[i])
	s+=w[i]

i=m
j=s
while (i<=j):
	guess = int(i+(j-i)/2)
	if allocate(n,w,k,guess) < 0:
		i = guess + 1
	else:
		j = guess - 1
print(i)



Measured memory_bytes: 9408
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

struct Sweets{
	Sweets(){id = protein = lipid = carbo = 0;}
	Sweets(int arg_id,int arg_protein,int arg_lipid,int arg_carbo){
		id = arg_id;
		protein = arg_protein;
		lipid = arg_lipid;
		carbo = arg_carbo;
	}

	int id,protein,lipid,carbo;
};

int main(){

	int n,P,Q,R,C,count;
	Sweets sweets[1000];

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		for(int i = 0; i < n; i++){
			scanf("%d %d %d %d",&sweets[i].id,&sweets[i].protein,&sweets[i].lipid,&sweets[i].carbo);
		}
		scanf("%d %d %d %d",&P,&Q,&R,&C);

		count = 0;

		for(int i = 0; i < n; i++){
			if(sweets[i].protein <= P && sweets[i].lipid <= Q && sweets[i].carbo <= R &&
					4*(sweets[i].protein+sweets[i].carbo)+9*sweets[i].lipid <= C){
				printf("%d\n",sweets[i].id);
				count++;
			}
		}
		if(count == 0)printf("NA\n");

	}
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define ZERO(a) memset(a,0,sizeof(a))

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

bool visited[410][410];
ll dp[410][410];
ll a[410];
ll cum[410];
ll n;

ll rec(ll l, ll r){
  if(l>r){
    cout<<"fuck"<<endl;
    return 0;
  }
  if(l==r)
    return dp[l][r]=0;
  if(visited[l][r])
    return dp[l][r];

  visited[l][r]=true;
  for(ll i=l; i<r; i++)
    dp[l][r]=min(dp[l][r], rec(l,i)+rec(i+1,r)+cum[r+1]-cum[l]);

  return dp[l][r];
}


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  cin>>n;
  REP(i,n)cin>>a[i];
  REP(i,n)cum[i+1]=cum[i]+a[i];
  REP(i,n)REP(j,n)visited[i][j]=false;
  REP(i,n)REP(j,n)dp[i][j]=LLINF;

  ll ans = rec(0,n-1);
  cout<<ans<<endl;



}


Measured memory_bytes: 1792
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
      int N = nextInt();
      myout((N + 1) / 2);
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 32808
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    N = II()
    A = LI()
    A.sort()
    ans = 1
    th = pow(10, 18)
    for a in A:
        ans = ans * a
        if ans > th:
            print(-1)
            return
    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 21556
#include<bits/stdc++.h>
  using namespace std;
#define rep(i,j,k) for (int i=j;i<=k;i++)
int sum,a[2010]={0},n;
inline void into(){
  scanf("%d",&n);
  n=n<<1;
  rep(i,1,n)
    scanf("%d",&a[i]);
}
inline void work(){
  sort(a+1,a+1+n);
  rep(i,1,n)
    if (i&1) sum+=a[i];
}
inline void outo(){
  printf("%d\n",sum);
}
int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 256
def GCD(a, b):
    return GCD(b, a % b) if b else a
    
def LCM(a, b):
    return a // GCD(a, b) * b

n = int(input())
a = list(map(int, input().split()))

al = 1
for i in range(n):
    al = LCM(al, a[i])

ans = 0
for i in range(n):
    ans += al // a[i]

print(ans%1000000007)

Measured memory_bytes: 4208
#include <iostream>
#include <string>
#include <algorithm>
#define llint long long
#define mod 1000000007
#define inf 1e18

using namespace std;

llint n;
llint p[45], t[45];
llint dp[45][4];

int main(void)
{
  while(1){
    cin >> n;
    if(n==0) break;
    for(int i = 1; i <= n; i++){
      cin >> p[i] >> t[i];
    }
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= 3; j++){
        dp[i][j] = inf;
      }
    }
    dp[0][0] = 0;

    for(int i = 0; i < n; i++){
      for(int j = 0; j <= 3; j++){
        llint d=abs(p[i]-p[i+1]);
        if(t[i] + d*(j+1) <= t[i+1] && j < 3){
          //cout << i << " " << j << " " << t[i] << " " << t[i+1] << " " << d << endl;
          dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + d);
        }
        if(t[i] + p[i]*(j+1) + p[i+1] <= t[i+1]){
          dp[i+1][1] = min(dp[i+1][1], dp[i][j] + p[i]+p[i+1]);
        }
      }
    }

    /*for(int i = 0; i <= n; i++){
      for(int j = 0; j <= 3; j++){
        cout << dp[i][j] <<" ";
      }
      cout << endl;
    }*/

    llint ans = inf;
    for(int j = 0; j <= 3; j++) ans = min(ans,dp[n][j]+p[n]);
    if(ans < inf/2){
      cout << "OK" << " " << ans << endl;
    }
    else{
      for(int i = 0; i <= n; i++){
        bool flag = false;
        for(int j = 0; j <= 3; j++){
          if(dp[i][j] < inf/2) flag = true;
        }
        if(!flag){
          cout << "NG" << " " << i << endl;
          break;
        }
      }
    }


  }
  return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;

const int mod = 1e9+7;
const ll INF = 1e18;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    ll n = s.length();
    vector<ll> v(n);
    ll counter = 0;
    v[0]++;
    ll pot = 10;
    ll value = 0;
    for(ll i = n-1 ; i >= 0 ; i--){
        int digit =  s[i] - '0';
        value = (value + digit * pot )% 2019;
        pot = pot * 10 % 2019;
        counter += v[value];
        v[value]++;
    }
    cout << counter;
}


Measured memory_bytes: 5136
#include<bits/stdc++.h>
using namespace std;
     
     
//#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)
     
     
int main(){
            
	int n, k;
	sd(n); sd(k);

	int point = n;

	double   ans = (double ) 0 , temp = ( double ) 1;

	while( point--){
		int num = point + 1;
		temp = 1.0 /n;
		
		
		while(num < k){
			num = 2*num;
			temp = (temp/2);
		}
		
		ans =  (ans + temp);

	

	}           


    printf("%0.12lf\n",ans); 
     
        
    return 0;
}


Measured memory_bytes: 256
n = int(input())
d = list(map(int, input().split()))
max_d = max(d)
mod = 998244353

if d[0] != 0:
    print(0)
    exit()
count = [0 for _ in range(max_d+1)]
for i in range(n):
    count[d[i]] += 1
if count[0] != 1:
    print(0)
    exit()
ans = 1
for i in range(max_d):
    n = count[i]
    m = count[i+1]
    ans *= n**m%mod
print(ans%mod)


Measured memory_bytes: 14396