akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <atcoder/dsu>

#define amax(a, b) a = max(a, b)
#define amin(a, b) a = min(a, b)

using ll = long long;

int main() {
    int n;
    std::cin >> n;
    int ys[n], invy[n];
    for (int i=0, x, y; i<n; i++) {
        std::cin >> x >> y;
        x--; y--;
        ys[x] = y;
        invy[y] = i;
    }
    atcoder::dsu d(n);
    std::set<int> st;
    for (int x=0; x<n; x++) {
        auto itr = st.begin();
        auto end = st.upper_bound(ys[x]);
        if (itr == end) {
            st.insert(ys[x]);
            continue;
        }
        int first = *itr;
        for (itr; itr != end; itr = st.erase(itr)) {
            d.merge(invy[*itr], invy[ys[x]]);
        }
        st.insert(first);
    }

    for (int i=0; i<n; i++) std::cout << d.size(i) << '\n';
    return 0;
}

Measured memory_bytes: 10464
array=gets.chomp.split(" ")
A =array[0]
B =array[1]
C =array[2]
if A[-1]==B[0] then
  x = 0

else
  x = 1

end
if B[-1]==C[0] then
  y = 0

else
  y = 1

end

if x + y == 0 then
  puts ("YES")

else
  puts ("NO")
end


Measured memory_bytes: 1788
/**
    AUTHOR:JUNSH
    TIME:19/5/19
**/
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rev(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
typedef long long ll;
inline int read(){
    int f=1,x=0;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return f*x;
}
const int inf=0x3f3f3f3f;
double cal(int n,int x){
    double ans=1.0;
    while(n<x){
        n*=2;
        ans*=0.5;
    }
    return ans;
}
int main(){
    int n,k;
    cin>>n>>k;
    double ans=0.0;
    for(int i=1;i<=(int)n;++i){
        ans+=cal(i,k);
    }
    printf("%.12lf",ans/n);
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{

    lli x;
    cin>>x;
    lli cur = 100;
    lli ans = 0;
    while(cur < x) {
        cur += (cur / 100) ;
        ans ++;
    }
    cout<<ans;
    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cassert>

using namespace std;

string add(string & added, int top){
    string a = added;
    string t = to_string(top);
    string total = t + a;
    return total;
}

string mymax(string a, string b){
    if(a.length() > b.length()){
        return a;
    }else if(a.length() < b.length()){
        return b;
    }else{
        if(a > b){
            return a;
        }else{
            return b;
        }
    }

}

int main(){
    // printf("%d\n", add(123, 4));
    // return 0;
    int N, M;
    int As[10];
    scanf("%d %d", &N, &M);
    for(int i=0; i < M; i++){
        scanf("%d", As + i);
    }
    sort(As, As+M);

    int nums[10] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    string table[10][11234];
    for(int i=0; i < M; i++){
        for(int j=0; j <= N; j++){
            table[i][j] = string("");
        }
    }

    for(int i=1; i < M + 1; i++){
        int num_row = As[i-1];
        int num_matches = nums[num_row];
        for(int j=0; j <= N; j++){
            string res = string("");
            // if leftside is none (-1 or negative), copy from the top
            if(j - num_matches < 0 || table[i][j - num_matches].length() == 0){
                res = table[i-1][j];
            }else{
            // if leftside is, compare left and top
                // printf("adding");
                string fromleft = add(table[i][j - num_matches], num_row);
                string fromtop = table[i-1][j];
                res = mymax(fromleft, fromtop);
            }
            // only when N[Ai]s row, compare N[Ai]
            if(j == num_matches){
                res = mymax(res, to_string(num_row));
            }
            table[i][j] = res;
            // printf("%d(%d) %d %d\n", i, num_row, j, res);
        }
    }

    printf("%s\n", table[M][N].c_str());


    return 0;
}

Measured memory_bytes: 80128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int tmp;

		while((tmp = x%y)!= 0) {
			x =y;
			y = tmp;
		}
		System.out.println(y);
	}
}


Measured memory_bytes: 26272
#include <iostream>
using namespace std;
int main() {
  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k=0;
  cin>>k;
  cout<<a[k-1]<<endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
nai = [list(map(int, input().split())) for _ in range(n)]

nai = sorted(nai, key=lambda x: -x[1])

ans = 0
aru = []
spe = set()
m = 0
for i in range(k):
    anstmp = nai.pop(0)
    if(anstmp[0] not in spe):
        ans+=anstmp[1]
        spe.add(anstmp[0])
    else:
        aru.append(anstmp[1])
sumaru = sum(aru)
m = ans + sumaru + len(spe)**2

for i in range(len(nai)):
    if(len(aru) == 0): break
    if(nai[i][0] not in spe):
        sumaru-=aru.pop()
        ans+=nai[i][1]
        spe.add(nai[i][0])
    m = max(m, ans + sumaru + len(spe)**2)
print(m)


Measured memory_bytes: 33024
N = int(input())
aa = list(map(int, input().split()))
abs_sum = sum(map(abs, aa))
if 0 in aa:
    print(abs_sum)
    exit()
now = aa[-1]
for i in range(1, N):
    now = -aa[N-1-i] if now < 0 else aa[N-1-i]
if now < 0:
    print(abs_sum - 2 * min(map(abs, aa)))
else:
    print(abs_sum)

Measured memory_bytes: 14412
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;

int main() {
	ll a, b, c; cin >> a >> b >> c;
	if (a + b >= c - 1) {
		cout << b + c << endl;
	}
	else {
		cout << b + a + b + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
//const ll mod = 1000000007;
ll N;

ll dp[2005][2005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    vector<l_l> v(N);
    for(int i = 0; i < N; i++) {
        cin >> v[i].first;
        v[i].second = i;
    }
    sort(v.begin(), v.end());
    for(int l = 0; l <= N; l++) {
        for(int r = N; r >= l; r--) {
            ll idx = r - l;
            if(l > 0) {
                ll tmp = dp[l-1][r];
                tmp += abs((l-1) - v[idx].second) * v[idx].first;
                chmax(dp[l][r], tmp);
            }
            if(r < N) {
                ll tmp = dp[l][r+1];
                tmp += abs(r - v[idx].second) * v[idx].first;
                chmax(dp[l][r], tmp);
            }
            //cerr << l << " " << r << " " << idx << " " << dp[l][r] << endl;
        }
    }
    ll ans = 0;
    for(int i = 0; i <= N; i++) {
        chmax(ans, dp[i][i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 26284
#include <stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	a+=b+c+d;
	b=a/60;
	a-=b*60;
	printf("%d\n%d\n",b,a);
	return 0;
}



Measured memory_bytes: 2104
#!/usr/bin/env python3
import sys


def solve(L: int):
    x = L / 3
    print(x**3)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using psi=pair<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD ((ll)1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
template<class T>void geti(T&a){for(auto&_:a)cin>>_;}
template<class T>void getii(T&a){for(auto&_:a)geti(_);}
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)
template<class F,class S>void add(map<F,S>&mp,F f,S s){if(mp.find(f)==mp.end())mp[f]=F();mp[f]+=s;}

int main(){
    string s,cs;
    cin>>s;
    
    int ans=1000;
    for(auto c:"qwertyuiopasdfghjklzxcvbnm"s){
        cs=s;
        int m=0;
        while(cs.size() && count(all(cs),c)!=cs.length()){
            m++;
            rep(i,cs.size()-1){
                if(cs[i]==c || cs[i+1]==c){
                    cs[i]=c;
                }
            }
            cs=cs.substr(0,cs.size()-1);
            // cout<<cs<<endl;
            // cout<<count(all(cs),c)<<","<<cs.length()<<endl;
        }
        ans=min(ans,m);
    }
    cout<<ans<<endl;
}


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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

signed main() {
    string s;
    cin >> s;
    int n = s.size();
    map<int, int> m;
    for(int i = 0; i < n-1; i+=2){
        int a = (s[i] - '0') * 2 + (s[i+1] - '0');
        ++m[a];
    }
    auto a = m[2]*2 + m[0] + m[3];
    auto b = m[1]*2 + m[0] + m[3];
    if (n%2 != 0) {
        if (s[n-1] == '1')
            ++a;
        else
            ++b;
    }
    cout << min(a, b) << nl;
}


Measured memory_bytes: 512
n = int(input())
p = [int(x) for x in input().split()]
sp = sorted(p)

flg = False
if sp == p:
    print("YES")
else:
    for i in range(n):
        for j in range(i+1, n):
            cp = p.copy()
            cp[i], cp[j] = cp[j], cp[i]
            if cp == sp:
                print("YES")
                flg = True
                break
        if flg:
            break
    if not flg:
        print("NO")


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

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

	string str;
	cin >> str;

	int cnt = 0;
	for (int i = 0; i < a-2; i++) {
		if (str[i] == 'A') {
			if (str[i+1] == 'B') {
				if (str[i+2] == 'C') {
					cnt++;
				}
			}
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
const int maxn = 100005;

int main() {
    //freopen("in.cpp","r",stdin);
    int n;
    cin>>n;
    int cnt1=0,cnt2=0,cnt4=0;
    for(int i=0;i<n;i++){
      int x;
      cin>>x;
      if(x%4==0)cnt4++;
      else if(x%2==0)cnt2++;
      else cnt1++;
    }
    if(cnt2)cnt1++;
    if(cnt1>cnt4+1)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long MOD = 1000000007;

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

	int m1, d1, m2, d2;
	cin >> m1 >> d1 >> m2 >> d2;

	if (m1 != m2) {
		cout << 1 << "\n";
	}
	else {
		cout << 0 << "\n";
	}


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

static const int MAX = 51;
char color[MAX][MAX] = {};
int d[MAX][MAX] = {};
int n;
int NIL = (1 << 15);

struct Point{
    int hei, wid;
};

int h,w;

void bfs(Point s) {
    queue<Point> q;
    q.push(s);
    d[s.hei][s.wid] = 0;
    Point u;
    while (!q.empty()) {
        u = q.front();
        q.pop();
        for (int i = -1; i <= 1; i++) {
            for (int j = -1; j <= 1; j++) {
                if (i==j or i*j != 0) {
                    continue;
                } else {
                    if(u.hei + i <= 0 or u.hei + i > h){
                        continue;
                    }
                    if(u.wid + j <= 0 or u.wid + j > w){
                        continue;
                    }
                    if (color[u.hei + i][u.wid + j] == '#') {
                        continue;
                    } else {
                        if (d[u.hei + i][u.wid + j] == NIL) {
                            d[u.hei + i][u.wid + j] = d[u.hei][u.wid] + 1;
                            Point x;
                            x.hei = u.hei + i;
                            x.wid = u.wid + j;
                            q.push(x);
                        }
                    }
                }
            }
        }

    }
}
int main() {
    
    int num_dot = 0;
    cin >> h >> w;
    for (int i = 1;i<=h;i++){
        string s;
        cin >> s;
        for (int j= 1;j<=w;j++){
             color[i][j] = s[j-1];
             if(s[j-1] == '.'){
                 num_dot += 1;
             }
             d[i][j] = NIL;
        }
    }
    Point s;
    s.hei = 1;
    s.wid = 1;
    bfs(s);





    if(d[h][w] == NIL){
        cout << -1 << endl;
    }else{
        cout << num_dot - d[h][w] - 1 << endl;
    }

}



Measured memory_bytes: 256
from sys import stdin

n = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())
x = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0
for i in range(n):
    if x[i] < abs(x[i] - k):
        ans += x[i] * 2
    else:
        ans += abs(x[i] - k) * 2
print(ans)


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


int main()
{
    int n,m,c;
    cin >> n >> m >> c;

    int count=0;
    vector<int> b(m,0);
    for(int j=0;j<m;j++)cin >> b[j];

    for(int i=0;i<n;i++){
        vector<int> a(m,0);
        for(int j=0;j<m;j++)cin >> a[j];

        int sum=c;
        for(int j=0;j<m;j++){
            sum+=a[j]*b[j];

        }
        if(sum>0)count++;
    }
    cout << count << endl;


    
    return 0;
}






Measured memory_bytes: 256
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my ($n, $m) = split / /, <STDIN>);
chomp (my $s = <STDIN>);
chomp (my $t = <STDIN>);
my $gcd = sub {
  my ($x, $y) = @_;
  while ($y) {
    my $r = $x % $y;
    $r += $y if $r < 0;
    $x = $y;
    $y = $r;
  }
  return $x;
};
my $lcm = sub {
  my ($x, $y) = @_;
  $x / $gcd->($x, $y) * $y;
};
my $g = $gcd->($n, $m);
my $l = $lcm->($n, $m);
my ($xn, $xm);
for (my $i=0; $i<$n; $i+=$n/$g) {
  $xn .= substr($s, $i, 1);
}
for (my $i=0; $i<$m; $i+=$m/$g) {
  $xm .= substr($t, $i, 1);
}
say $l if $xn eq $xm;
say -1 unless $xn eq $xm;

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n]={0};
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int sum=0;
    for(int k=n-1;k>=0;k--){
        if((n-1-k)%2==0){
            sum=sum+a[k];
        }else{
            sum=sum-a[k];
        }
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
typedef pair<int, int> P;

int main(){
  int M, N;
  while(cin>>M){
    map<string, P> val;
    REP(i, M){
      string s; int a, b;
      cin>>s>>a>>b;
      val[s] = P(a, b);
    }
    cin>>N;
    stack< set<int> > stk;
    bool correct = true;
    REP(iter, N){
      string s;
      cin>>s;
      if(val.count(s)){
        set<int> st;
        int a = val[s].first, b = val[s].second;
        for(int i = a; i <= b; i++){
          st.insert(i);
        }
        stk.push(st);
      }else if(s == "+"){
        set<int> b = stk.top(); stk.pop();
        set<int> a = stk.top(); stk.pop();
        set<int> res;
        FORIT(ai, a)FORIT(bi, b){
          int r = (*ai + *bi) % 256;
          res.insert(r);
        }
        stk.push(res);
      }else if(s == "-"){
        set<int> b = stk.top(); stk.pop();
        set<int> a = stk.top(); stk.pop();
        set<int> res;
        FORIT(ai, a)FORIT(bi, b){
          int r = (*ai - *bi + 256) % 256;
          res.insert(r);
        }
        stk.push(res);
      }else if(s == "*"){
        set<int> b = stk.top(); stk.pop();
        set<int> a = stk.top(); stk.pop();
        set<int> res;
        FORIT(ai, a)FORIT(bi, b){
          int r = (*ai * *bi) % 256;
          res.insert(r);
        }
        stk.push(res);
      }else if(s == "/"){
        set<int> b = stk.top(); stk.pop();
        set<int> a = stk.top(); stk.pop();
        set<int> res;
        FORIT(ai, a)FORIT(bi, b){
          if(*bi != 0){
            int r = (*ai / *bi) % 256;
            res.insert(r);
          }else{
            correct = false;
          }
        }
        stk.push(res);
      }else{
        int n = atoi(s.c_str());
        set<int> st;
        st.insert(n);
        stk.push(st);
      }
    }
    if(correct) cout<<"correct"<<endl;
    else cout<<"error"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1304
n = int(input())
mod = 10 ** 9 + 7

dp = [0] * 2001
dp[3] = 1
dp[4] = 1
dp[5] = 1
if n >= 6:
    for i in range(6,n+1):
        dp[i] = (dp[i-1] + dp[i-3]) % mod
print(dp[n])

Measured memory_bytes: 63220
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, multiset<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifndef ONLINE_JUDGE
#define debug(a) cout<<#a<<" --> "<<(a)<<"\n";
#define debug2(a) cout<<#a<<" --> "<<(a)<<" ";
#define HERE cout<<"here - "<<__LINE__<<"\n";
#else
#define debug(a)
#define debug2(a)
#define HERE
#endif
const ll mod = 100000007;
const int N = 15;
typedef pair<int,int> pii;

void TEST_CASES(int cas)
{
    int x;
    cin>>x;
    for(int i=360;;i+=360)
    {
        if(i%x==0)
        {
            printf("%d\n",i/x);
            return;
        }
    }

}


/*

*/

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1,cas=0;
    //scanf("%d",&t);
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



//os.order_of_key(v): returns how many elements strictly less than v
//os.find_by_order()

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

template <class T>
ostream &operator <<(ostream &os, multiset<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}


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

using namespace std;

double rect_area(double a,double b){
  return a*b*b;
}


int main(){
  int d;vector<int> ans;
  while(cin >> d){
    int l=int(600/d);
    double c=0;
    for(int i=0;i<l;i++){
      c+=rect_area(d,i*d);
    }
    ans.push_back(int(c));
  }
  for(auto& e: ans){
    cout << e << endl;
  }

}



Measured memory_bytes: 3056
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int count = 0;
		String findWord = s.nextLine();
		List<String> result = new ArrayList<>();
		while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		}
		for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 26136
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
const long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s;
	ll k;
	cin >> s >> k;
	rep(i, k) {
		if (s[i] == '1')continue;
		else return cout << s[i] << endl,0;
	}
	cout << '1' << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
signed main(void){

    char str[3000];
    char *tok;
    int m,n;
    int i1,i2,i3,i4,i44;
    int flag=0;
    int a[100][100];
    int b[30];
    int k[30];
    
    for(i1=0;i1<m;i1++){
        b[i1]=0;
    }
    
    fgets(str, sizeof(str), stdin);
    tok=strtok(str," ");
    n=strtol(tok,NULL,10);
    tok=strtok(NULL," ");
    m=strtol(tok,NULL,10);
    for(i1=0;i1<n;i1++){
        fgets(str, sizeof(str), stdin);
        tok=strtok(str," ");
        k[i1]=strtol(tok,NULL,10);
        for(i2=0;i2<k[i1];i2++){
            tok=strtok(NULL," ");
            b[strtol(tok,NULL,10)-1]+=1;
        }
    }
    
    
    for(i1=0;i1<m;i1++){
        if(b[i1]==n){
            flag+=1;
        }
    }
    
    printf("%d",flag);

    
    
}

Measured memory_bytes: 128
from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
# mod = 10**9+7
    
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,m,v,p = inpm()
    a = inpl()
    a.sort(reverse=True)
    ok = 0
    ng = n
    while ng-ok >1:
        mid = (ok+ng)//2
        if mid+1 <= p:
            ok = mid
        elif a[p-1] > a[mid]+m:
            ng = mid
        else:
            key = 0
            cnt = (p)*m + (n-mid-1)*m
            for i in range(mid-1,p-2,-1):
                if a[i] > a[mid]+m:
                    ng = mid
                    key = 1
                    break
                cnt += min(a[mid]-a[i]+m,m)
            if key:
                break
            if cnt >= m*v:
                ok = mid
            else:
                ng = mid
    print(ok+1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 62576
#include<bits/stdc++.h>
using namespace std;
int main(void){
	
	while(1){
		string n;
		cin>>n;
		int sum=0;
		for(int i=0;i<n.size();i++){
			sum+=n[i]-'0';
		}
		if(sum==0) break;
		cout<<sum<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll x, y;
    cin >> x >> y;
    vi m(206, 0);
    m[1] = 300000;
    m[2] = 200000;
    m[3] = 100000;
    cout << m[x] + m[y] + (x == 1 && y == 1 ? 400000 : 0) << endl;
}

Measured memory_bytes: 3652
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t N;
    std::cin >> N;

    for (int i = 0; i <= N/4 + 1; ++i) {
        for (int j = 0; j <= N/7 + 1; ++j) {
            if (4 * i + j * 7 == N) {
                std::cout << "Yes" << std::endl;
                return 0;
            }
        }
    }

    std::cout << "No" << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a,b;
    cin>>a>>b;
    
    if(b%a==0){
        cout1(a+b)
    }else{
        cout1(b-a)
    }
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = 100001;
		boolean[] isPrime = new boolean[N];
                isPrime[2] = true;
		for(int i=3;i<N;++i) isPrime[i] = i%2==0? false : true;
		for(int i=2;i<=(int)Math.sqrt((double)N);++i){
			if(isPrime[i]){
				for(int j=i*i;j<N;j+=2*i) isPrime[j] = false;
			}
		}		
		int[] ruiseki = new int[N];
		ruiseki[1] = 0;
		for(int i=3;i<N;i+=2){
			if(isPrime[i]&&isPrime[(i+1)/2]) ruiseki[i]++;
			ruiseki[i] += ruiseki[i-2];
		}
		
		int Q = sc.nextInt();
		for(int i=0;i<Q;++i){
			int l = sc.nextInt()-2;
			if(l<0) l=1;
			int r = sc.nextInt();
			System.out.println(ruiseki[r]-ruiseki[l]);
		}
		return;
	}
}

Measured memory_bytes: 65968
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint n;
llint a, b, c;

const int FACT_MAX = 20005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

int main(void)
{
	cin >> n >> a >> b >> c;
	make_fact();
	if(b % 2){
		cout << 0 << endl;
		return 0;
	}
	
	llint ans = 0;
	for(int i = 0; i <= a; i++){
		for(int j = 0; 3*j <= c; j++){
			if(i+3*j > c) continue;
			if(b == 0 && c-(i+3*j)) continue;
			llint tmp = comb(a, i);
			if(b > 0) tmp *= comb(c-(i+3*j)+b/2-1, b/2-1), tmp %= mod;
			tmp *= fact[b/2+j+a] % mod, tmp %= mod;
			tmp *= fact_inv[b/2] * fact_inv[j] % mod * fact_inv[a] % mod, tmp %= mod;
			ans += tmp, ans %= mod;
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
 
int main(){
  int N,X,Y;
  cin>>N>>X>>Y;
  int cnt[2020] = {0};
  for(int i=1; i<=N-1; i++){
    for(int j=i+1; j<=N; j++){
      cnt[min(j-i,abs(X-i)+1+abs(Y-j))]++;
    }
  }
  for(int k=1;k<N;k++)cout<<cnt[k]<<endl;
}

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

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

int main(){
  int k,sum=0;
  cin >> k;
  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      int x=gcd(i,j);
      for(int l=1;l<=k;l++){
        sum+=gcd(x,l);
      }
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  long long d;
  cin>>n>>d;
  long long x[n], y[n];
  REP(i, n) cin>>x[i]>>y[i];
  long long ans = 0;
  REP(i, n){
    long long temp = x[i] * x[i] + y[i] * y[i];
    if(temp <= d * d) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
const int MAXN=1e5+10;
int n,m,x,y,cnt[MAXN],ok[MAXN],res;

int main()
{
	scanf("%d%d",&n,&m);
	ok[1]=1;
	for(int i=1;i<=n;i++) cnt[i]=1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		cnt[x]--;cnt[y]++;
		if(ok[x]) ok[y]=true;
		if(ok[x]&&!cnt[x]) ok[x]=false;
	}
	
	for(int i=1;i<=n;i++) res+=ok[i];
	printf("%d",res);
	return 0;
}

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

#define watch(x) cout << (#x) << " is " << (x) << endl
#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
#define repn(i, st, en) for(int i=st; i>=en; i--)
#define sq(a) (a*a)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll mod = 1e9+7;


void solve(){
    int n;
    cin>>n;
    vector<double> dp(n+1, 0);
    /// dp[i] = prob that i heads has been tossed so far
    dp[0] = 1;
    for(int coin = 0; coin < n; coin++){
        double ph;
        cin>>ph;
        for(int i = coin; i>=0; --i){
            dp[i+1] += dp[i]*ph;
            dp[i] = dp[i]*(1 - ph); /// coin being tossed is taken as tail
        }
    }
    double ans = 0.0;
    for(int heads=0; heads<=n; heads++){
        int tails = n - heads;
        if(heads > tails) ans += dp[heads];
    }

    cout<<setprecision(11)<<ans;
}

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

    ll t = 1;
    //  cin>>t;
    while(t--){
        solve();
    }

    return 0;
}



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

using point = pair<int, int>;

constexpr int inf = 1e8;
const vector<int> dxh = { 1, 0, -1, 0 }, dxw = { 0, 1, 0, -1 };

int main() {
  int h, w, ch, cw, dh, dw;
  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--; cw--; dh--; dw--;
  vector<string> s(h);
  for (int i = 0; i < h; i++) {
    cin >> s.at(i);
  }
  
  vector d(h, vector(w, inf));
  deque<pair<int, point>> q;
  q.emplace_back(0, make_pair(ch, cw));
  while (!q.empty()) {
    auto x = q.front();
    q.pop_front();
    point p = x.second;
    int dx = x.first, ph = p.first, pw = p.second;
    if (s.at(ph).at(pw) == '#') continue;
    if (d.at(ph).at(pw) < inf) continue;
    d.at(ph).at(pw) = dx;
    for (int i = 0; i < 4; i++) {
      int newh = ph + dxh.at(i), neww = pw + dxw.at(i);
      if (newh < 0 or h <= newh or neww < 0 or w <= neww) continue;
      if (d.at(newh).at(neww) < inf) continue;
      q.emplace_front(dx, make_pair(newh, neww));
    }
    for (int i = -2; i <= 2; i++) {
      for (int j = -2; j <= 2; j++) {
        int newh = ph + i, neww = pw + j;
        if (newh < 0 or h <= newh or neww < 0 or w <= neww) continue;
        if (d.at(newh).at(neww) < inf) continue;
        q.emplace_back(dx + 1, make_pair(newh, neww));
      }
    }
  }
  
/*  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cerr << " " << d.at(i).at(j);
    }
    cerr << endl;
  }*/
  
  if (d.at(dh).at(dw) == inf) {
    cout << -1 << endl;
  } else {
    cout << d.at(dh).at(dw) << endl;
  }
}


Measured memory_bytes: 11400
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        
        int max = 0;
        if (Math.max(a, b) == a && Math.max(a, c) == a) {
        	max = a;
        	a = 0;
        } else if (Math.max(a, b) == b && Math.max(b, c) == b) {
        	max = b;
        	b = 0;
        } else {
        	max = c;
        	c = 0;
        }
        
        long newK = (long) Math.pow(2,k);
        
        
        System.out.println(a + b + c + (max * newK));
    }
    
}

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

int main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  int L[200009], R[200009], X[509][509], C[509][509];
  for (int i = 1; i <= M; i ++) {
    cin >> L[i] >> R[i];
    X[L[i]][R[i]] ++;
  }

  for (int i = 1; i <= N; i ++) {
    for (int j = 1; j <= N; j ++) {
      C[i][j] = C[i][j - 1] + X[i][j];
    }
  }

  for (int i = 1; i <= Q; i ++) {
    int p, q;
    cin >> p >> q;
    int sum = 0;
    for (int j = p; j <= q; j ++) sum += C[j][q] - C[j][p - 1];
    cout << sum << endl;
  }
}


Measured memory_bytes: 4480
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
  double a, b, deg;
  cin >> a >> b >> deg;

  double rad, PI = 3.1415926589793;
  rad = deg * PI / 180;
  cout << fixed ;
  cout << setprecision(8) << a * b * sin(rad) / 2 << endl;
  cout << setprecision(8) << a + b + sqrt( pow(b, 2) + pow(a, 2) - 2 * a * b * cos(rad) ) << endl;
  cout << setprecision(8) << b * sin(rad) << endl;

  return 0;
}


Measured memory_bytes: 3464
# https://atcoder.jp/contests/m-solutions2019/submissions/5741430
from functools import reduce
from operator import mul
import sys

input = sys.stdin.readline

MOD = 10 ** 6 + 3


def inv(n):
    return pow(n, MOD - 2, MOD)


def mod_mul(x, y):
    return mul(x, y) % MOD


fact = [1]
for n in range(1, MOD):
    fact.append((fact[-1] * n) % MOD)
    # d>1 の数列を d=1 となる数列に変換する
    # MODの倍数を含む数列の積は0になるので,
    # MODの倍数を含まない区間の積が計算できればよい
    # そのような区間の右端はMOD-1であり,fact[MOD-1]が計算できればよい

inv_fact = [-1] * MOD
inv_fact[MOD - 1] = inv(fact[-1])
for n in range(MOD - 2, -1, -1):
    inv_fact[n] = ((inv_fact[n + 1] * (n + 1)) % MOD)
    # inv_factは,inv(n!)にn,n-1,...を掛けるイメージ
    
Q = int(input())
for _ in range(Q):
    x, d, n = map(int, input().split())

    if x == 0:
        print(0)
        continue

    if d == 0:
        print(pow(x, n, MOD))
        continue

    xd = (x * inv(d)) % MOD
    if MOD - xd < n:
        print(0)
        continue

    dn = pow(d, n, MOD)
    print(reduce(mod_mul, (fact[xd + n - 1], inv_fact[xd - 1], dn)))


Measured memory_bytes: 93804
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a; cin >> a;
	int arr[a + 50], tmp = 0;
	for(int i=0; i<a; i++)
	{
		cin >> arr[i];
		tmp ^= arr[i];
	}
	for(int i=0; i<a; i++)
		cout << (tmp ^ arr[i]) << ' ';
}

Measured memory_bytes: 4396
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int w = scanner.nextInt();
    int n = scanner.nextInt();
    int[] values = new int[w];
    for(int i = 0; i <values.length; i++){
      values[i] = i + 1;
    }
    for(int i = 0; i < n; i++){
      String str = scanner.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int temp = values[a];
      values[a] = values[b];
      values[b] = temp;
    }
    for(int i = 0; i < values.length; i ++){
      System.out.println(values[i]);
    }
  }
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a.at(i);

	vector<int> s = a;
	sort(s.rbegin(), s.rend());

	rep(i, n){
		int ans = s.at(0);
		if(s.at(0) == a.at(i)) ans = s.at(1);
		cout << ans << endl;
	}

	return 0;
	
}


Measured memory_bytes: 3200
def up(mtx, i, j, val):
    h = i - 1
    if h < 0:
        return
    elif mtx[h][j] != 0:
        return
    else:
        mtx[h][j] = val
        up(mtx, h, j, val)


def down(mtx, i, j, val):
    h = i + 1
    if h >= len(mtx):
        return
    elif mtx[h][j] != 0:
        return
    else:
        mtx[h][j] = val
        down(mtx, h, j, val)


h, w, k = map(int, input().split())

mtx = []

for i in range(h):
    s = input()
    s_list = []
    for j in range(len(s)):
        if s[j] == "#":
            s_list.append(1)
        else:
            s_list.append(0)
    mtx.append(s_list)

ret = [[0] * w for i in range(h)]

ptr = 1

for i in range(h):
    cnt = mtx[i].count(1)
    if cnt == 0:
        continue
    else:
        is_first = True
        for j in range(w):
            if mtx[i][j] == 0:
                ret[i][j] = ptr
            else:
                if is_first:
                    ret[i][j] = ptr
                    is_first = False
                else:
                    ptr += 1
                    ret[i][j] = ptr
        ptr += 1

for i in range(h):
    for j in range(w):
        if ret[i][j] != 0:
            up(ret, i, j, ret[i][j])
            down(ret, i, j, ret[i][j])

for i in range(h):
    print(" ".join(list(map(str, ret[i]))))


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

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n), b(n), c(n-1);
    rep(i,n) {
        ll t;
        cin >> t;
        t--;
        a[i] = t;
    }
    rep(i,n) cin >> b[i];
    rep(i,n-1) cin >> c[i];
    ll ans = 0;
    rep(i,n-1) {
        ans += b[i];
        if (a[i+1]-a[i] == 1) ans += c[a[i]];
    }
    ans += b[n-1];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println(Math.min(n * a, b));
		}
	}
}

Measured memory_bytes: 23636
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
inline bool chmin(T &a, const T b) { return a > b && (a = b, true); }

int main() {

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

	int N;
	cin >> N;

	vector<int> P(N);
	for (int i = 0; i < N; i++) cin >> P[i];

	int M = INF, ans = 0;
	for (int i = 0; i < N; i++) {
		if (M > P[i]) ans++;
		chmin(M, P[i]);
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>

const int INF = 1001001001;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;


int main(){
    int n; cin >> n;
    bool ans = false;
    for(int i=0; i<=n/4; i++){
        for(int j=0; j<=n-4*i/7;j++){
            if((4*i+7*j)==n){
                ans = true;
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    
    cout <<"No"<< endl;

}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            string input;
            while((input = Console.ReadLine()) != null){
                double weight = double.Parse(input);
                Console.WriteLine(weight <= 48.0 ? "light fly" : weight <= 51.0 ? "fly"
                                                               : weight <= 54.0 ? "bantam"
                                                               : weight <= 57.0 ? "feather"
                                                               : weight <= 60.0 ? "light"
                                                               : weight <= 64.0 ? "light welter"
                                                               : weight <= 69.0 ? "welter"
                                                               : weight <= 75.0 ? "light middle"
                                                               : weight <= 81.0 ? "middle"
                                                               : weight <= 91.0 ? "light heavy"
                                                               : "heavy");
            }
        }
    }
}

Measured memory_bytes: 5680