akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define F first
#define S second


typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int n; cin >> n;
	VI a(n); rep(i, n)cin >> a[i];
	int q; cin >> q;
	VI k(q); rep(i, q)cin >> k[i];

	rep(i, q) {
		decltype(a)::iterator it = lower_bound(all(a), k[i]);
		size_t pos = distance(a.begin(), it);
		decltype(a)::iterator it2 = upper_bound(all(a), k[i]);
		size_t pos2 = distance(a.begin(), it2);
		cout << pos << " " << pos2 << endl;
	}
}


Measured memory_bytes: 3828
#define errOut(s) \
  { std::cerr << __LINE__ << ":" << #s << ":" << (s) << std::endl; }

#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

static std::string const YES = "Yes";
static std::string const NO = "No";

bool solve(int64_t x) { return x >= 30; }

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t x;
  std::cin >> x;
  auto const res = solve(x);
  std::cout << (res ? YES : NO) << std::endl;
  return 0;
}


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

const int maxN=110;
int N,K;
vector<int> v[maxN];
bool S[maxN];

void input(){
    cin >> N >> K;
    for(int i=0;i<K;i++){
        int d=0;
        cin >> d;
        for(int j=0;j<d;j++){
            v[i].resize(d);
            cin >> v[i][j];
        }
    }
}

int main(){
    input();
    fill(S,S+N,false);
    for(int i=0;i<K;i++){
        for(int j=0;j<v[i].size();j++){
            S[v[i][j]-1]=true;
        }
    }
    int count =0;
    for(int i=0;i<N;i++){
        if(S[i]==false) count++;
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3208
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<set>
#include<fstream>
#include<map>
#include<string>
#include <stdio.h>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<stack>
#include<climits>
#include<functional>
#include<iterator>
#include<cctype>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll>vl;
typedef vector<int>vi;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef vector<char>vc;
typedef vector<string>vs;
#define MP make_pair
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define EPS 1e-9
#define PI 3.14159265359
const ll mod = 1000000007;
const ll OO = (ll)1e18;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
ll gcd(ll a, ll b){ if (b == 0){ return a; }return gcd(b, a % b); }
int arr[101][2];
int main(){

//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int n;
	cin >> n;
	if (n % 2 == 0)
	{
		int x = n / 2;
		x = x * x;
		cout << x;
	}
	else
	{
		int x = n / 2 + 1;
		x = x * (x - 1);
		cout << x;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define eb emplace_back
#define MP make_pair
#define pb push_back
#define pf push_front
#define ins insert
#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define tr(c,it) for(auto it=c.begin();it!=c.end();it++)
#define fr(i,n) for(lli i=0;i<(n);i++)
#define inc(i,a,b) for(lli i=a;i<=b;i++)
#define dec(i,a,b) for(lli i=a;i>=b;i--)
#define fr2(i,n) for(int i=0;i<(n);i++)
#define inc2(i,a,b) for(int i=a;i<=b;i++)
#define dec2(i,a,b) for(int i=a;i>=b;i--)
#define ymin(a,b)  (a=min((a),(b)))
#define ymax(a,b)  (a=max((a),(b)))
#define sz(x) (lli)(x).size()
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr<< *it << " = " << a << endl;
	err(++it, args...);
}

typedef long long int lli;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<lli,lli> plli;
typedef vector<lli> vlli;
typedef vector<int> vi;
//typedef  vector<vector<lli> >ncr(1001,vector<lli>(1001,0))
typedef vector<plli> vplli;
long long MOD=998244353;
int main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    int n;
    lli w;
    lli maxv=0;
    cin>>n>>w;
    vector<lli>wei(n,0);
    vector<lli>val(n,0);
    for(int i=0;i<n;i++)
    {
    	cin>>wei[i]>>val[i];
    	maxv+=val[i];
    }
    vector<lli>dp(maxv+1,1e18);
    dp[0]=0;
   // vector<vector<lli>dp(maxv+1,vector<lli>(n+1,1e18));
    // for(lli i=maxv;i>=0;i--)
    // {
    // 	for(int j=1;j<n;j++)
    // 	{
    // 		// if(dp[i][j]>=w)
    // 		// {
    // 		// 	f=1;
    // 		// 	cout<<i<<endl;
    // 		// 	break;
    // 		// }
    // 		//else
    		
    // 			dp[i][j]=min(dp[i][j-1],dp[i-val[i]][j-1]+wei[i]);
    		


    // 	}
    // }
    for(int i=0;i<n;i++)
    {
    	for(lli rem=maxv-val[i];rem>=0;rem--)
    		dp[rem+val[i]]=min(dp[rem+val[i]],dp[rem]+wei[i]);
    }
    
    lli ans=0;
    for(lli i=0;i<=maxv;i++)
    {
    	if(dp[i]<=w)
    		ans=max(ans,i);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int n,max_num = -1000001,min_num = 1000001,tmp;
    long long int sum = 0;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d",&tmp);
        sum += tmp;
        max_num = max(max_num,tmp);
        min_num = min(min_num,tmp);
    }
    printf("%d %d %lld\n",min_num,max_num,sum);
}


Measured memory_bytes: 2740
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int R;
  cin >> R;
  if (R < 1200) {
    cout << "ABC\n";
  } else if (R < 2800) {
    cout << "ARC\n";
  } else {
    cout << "AGC\n";
  }
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R

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

	cin >> N;

	vector<int>dp(N + 1, MOD);
	dp[0] = 0;
	for (int i = 0; i < N; i++) {
		int cnt = 1;
		for (int j = 1; j + i <= N; j *= 6) {
			cnt = j;
			//dp[i + j] = min(dp[i] + 1, dp[i + j]);
		}
		dp[i + cnt] = min(dp[i + cnt], dp[i] + 1);
		for (int j = 1; j + i <= N; j *= 9) {
			cnt = j;
			//dp[i + j] = min(dp[i] + 1, dp[i + j]);
		}
		dp[i + cnt] = min(dp[i + cnt], dp[i] + 1);
	}
	cout << dp[N] << endl;
}

Measured memory_bytes: 640
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define BigInt      __int128
#define endl        '\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define sim         template < class c
#define ris         return * this
#define dor         > debug & operator <<
#define eni(x)      sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {

using namespace std;

sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug 
{
	~debug() 
	{ 
		cerr<<endl; 
	}
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) 
	{
		ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) 
	{
	  	*this << "[";
	  	for (auto it = d.b; it != d.e; ++it)
	    	*this << ", " + 2 * (it == d.b) << *it;
	  	ris << "]";
	}
};
#define fuck(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n;
		cin >> n;
		ll int arr[n + 1];
		mii ma;
		ll int sm = 0;
		for(ll int i = 1; i <= n; i++)
		{
			cin >> arr[i];
			ma[arr[i]]++;
			sm += arr[i];
		}
		ll int q;
		cin >> q;
		while(q--)
		{
			ll int bi, ci;
			cin >> bi >> ci;
			sm -= bi * ma[bi];
			sm += ci * ma[bi];
			ma[ci] += ma[bi];
			ma[bi] = 0;
			cout << sm << endl;
		}
	}
	return 0;
}

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

#define ll long long 

int main() {
    ios::sync_with_stdio(0); 

    int a[6] = {0};
    for (int i = 0; i < 5; i++) {
        int x; cin >> x;
        a[x] = 1;
    }
        
    for (int i = 0; i < 6; i++) {
        if (a[i] == 0) cout << i  << endl;
    }


    return 0; 
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int N, M, Q;
vector<int> a, b, c, d;
vector<int> A;
int ans = 0;

void dfs(int i) {
  if (i == N) {
    int temp = 0;
    rep(q, Q) {
      if (A[b[q]] - A[a[q]] == c[q])
        temp += d[q];
    }
    chmax(ans, temp);
    return;
  }

  int mx = (i == 0 ? 1 : A[i - 1]);
  repp(j, mx, M) {
    A[i] = j;
    dfs(i + 1);
  }
}


signed main() {
  cin >> N >> M >> Q;
  a.assign(Q, 0);
  b.assign(Q, 0);
  c.assign(Q, 0);
  d.assign(Q, 0);
  rep(i, Q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--, b[i]--;
  }

  A.assign(N, 0);

  dfs(0);

  cout << ans << endl;
}

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

using namespace std;

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& e : a)
    cin >> e;
  sort(a.begin(), a.end());
  int max_c = a[a.size() - 1];
  int ans = max(max_c - a[0] + 1, a[0]);
  int idx = 0;
  for (int i = 1; i < n - 1; ++i) {
    int diff = max(max_c - a[i] + 1, a[i]);
    if (diff < ans) {
      idx = i;
      ans = diff;
    }
  }
  cout << max_c << " " << a[idx] << "\n";
}


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

using namespace std;

int main()
{
	int n, seq;
	int num[10];
	
	cin >> n;
	for (; n > 0; n--){
		cin >> seq;
		for (int i = 0; i < 8; i++){
			num[i] = seq % 10;
			seq /= 10;
		}
		sort(num, num + 8);
		int res = 0;
		for (int i = 0; i < 8; i++){
			res *= 10;
			res += (num[7 - i] - num[i]);
		}
		cout << res << endl;
	}
	return (0);
}

Measured memory_bytes: 1176
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll a,b ;
	cin >> a >> b ;
	if(a>0) cout << "Positive" << endl ;
	else if(a<=0&&b>=0) cout << "Zero" << endl ;
	else{
		if((b-a)&1) cout << "Positive" << endl ;
		else cout << "Negative" << endl ;
	}
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static final int INF = 114514;

    public void main(Scanner sc) {
        int d = sc.nextInt();
        int g = sc.nextInt() / 100;
        int p[] = new int[d];
        int c[] = new int[d];
        int pef[] = new int[d];
        for (int i = 0; i < d; i++) {
            p[i] = sc.nextInt();
            c[i] = sc.nextInt() / 100;
            pef[i] = p[i] * (i + 1) + c[i];
        }
        sc.close();

        int ans[][] = new int[d][105501];
        for (int i = 0; i < d; i++) {
            Arrays.fill(ans[i], INF);
        }

        for (int i = 0; i < d; i++) {
            ans[i][0] = 0;
        }
        for (int i = 1; i < p[0]; i++) {
            ans[0][i] = i;
        }
        ans[0][pef[0]] = p[0];

        for (int i = 2; i <= d; i++) {
            for (int j = 0; j < p[i - 1]; j++) {
                for (int k = 0; k <= 105500; k++) {
                    if (ans[i - 2][k] != INF) {
                        ans[i - 1][k + j * i] = Math.min(ans[i - 2][k + j * i], ans[i - 2][k] + j);
                    }
                }
            }
            for (int k = 0; k <= 105500; k++) {
                if (ans[i - 2][k] != INF) {
                    ans[i - 1][k + pef[i - 1]] = Math.min(ans[i - 2][k + pef[i - 1]], ans[i - 2][k]
                            + p[i - 1]);
                }
            }
        }

        int min = INF;
        for (int i = g; i <= 105500; i++) {
            min = Math.min(min, ans[d - 1][i]);
        }
        System.out.println(min);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
    }
}


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

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll r, d, a;
	cin >> r >> d >> a;
	ll temp = (r * a) - d;
	for(int i = 1; i <= 10; i++) {
		cout << temp << "\n";
		a = temp;
		temp = (r * a) - d;
	}
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        int w = sc.nextInt();
        if(w>=n)
        	System.out.println("unsafe");
        else
        	System.out.println("safe");
    }
}
   

Measured memory_bytes: 35784
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func mode(nums map[int]int) (int, int) {
	m := 0
	s := 0
	for k, v := range nums {
		if v > nums[m] {
			m = k
		} else if v > nums[s] {
			s = k
		}
	}
	return m, s
}

func min(n, m int) int {
	if n < m {
		return n
	}
	return m
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	l := make([]int, n)
	for i := 0; sc.Scan(); i++ {
		m, _ := strconv.Atoi(sc.Text())
		l[i] = m
	}

	odds := make(map[int]int)
	evens := make(map[int]int)
	for i := 0; i < n; i++ {
		if i%2 == 1 {
			evens[l[i]]++
		} else {
			odds[l[i]]++
		}
	}

	em, es := mode(evens)
	om, os := mode(odds)

	if em == om {
		fmt.Println(min(n-evens[es]-odds[om], n-odds[os]-evens[em]))
	} else {
		fmt.Println(n - evens[em] - odds[om])
	}

}


Measured memory_bytes: 7296
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>


int main(){
  long long K;
  scanf("%lld", &K);
  int N = 50;
  printf("%d\n", N);
  std::vector<long long > a(N);
  long long max = N - 1 + K/(long long)N;
  a[0]=max;
  for (int i=1; i<N; i++){
    a[i]=a[i-1]-1;
  }
  int amari = K%(long long)N;
  int minindex = N-1;
  while(amari>0){
    a[minindex]+=N;
    for (int j=0; j<N; j++){
      if (j==minindex) continue;
      a[j]--;
    }
    minindex--;
    if (minindex<0) minindex = N-1;
    amari--;
  }
  for (int i=0; i<N; i++){
    printf("%lld%c", a[i], (i==N-1)?'\n':' ');
  }
  return 0;
}

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

int main() {
  int a, b; cin >> a >> b;
  char ca = '0' + a, cb = '0' + b;
  string sa, sb;
  for (int i = 0; i < b; i++) sa += ca;
  for (int i = 0; i < a; i++) sb += cb;
  cout << (sa < sb ? sa : sb) << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int[] arr = new int[1000];
		int a = sc.nextInt(), b= sc.nextInt(), c = sc.nextInt(), d = sc.nextInt();
		arr[a]++;
		arr[b]--;
		arr[c]++;
		arr[d]--;
		Arrays.parallelPrefix(arr, Integer::sum);
		long ans = Arrays.stream(arr).filter(i -> i==2).count();
		System.out.println(ans);
	}
}

Measured memory_bytes: 29268
from math import factorial

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

M = 10 ** 9 + 7

if abs(n - m) > 1:
    print(0)
else:
    ans = factorial(m) * factorial(n) % M
    if (m + n) % 2 == 0:
        ans = ans * 2 % M
    print(ans)


Measured memory_bytes: 5184
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int a[100010];
int main()
{
	int n,sumj=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]%2==1) sumj++;
	}
	if(sumj%2==0) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
int max(int a,int b){if(a>b) return a;return b;}
int min(int a,int b){if(a<b) return a;return b;}
int main(){
    int a,b;
    char s[11],t[11],u[11];
    scanf("%s%s%d%d%s",s,t,&a,&b,u);
    int counts=0,countt=0;
    for(int i=0;i<strlen(s);i++){
        if(s[i]==u[i])
        counts++;
    }
    for(int i=0;i<strlen(t);i++){
        if(t[i]==u[i])
            countt++;
    }
    if(counts==strlen(s)){
        printf("%d %d\n",a-1,b);
    }
    else{
        printf("%d %d\n",a,b-1);
    }
    return 0;
}

Measured memory_bytes: 128
using Atcoder;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var N = (double)inputs[0];
            var D = (double)inputs[1];

            double ret = N / (2 * D + 1);
            Console.WriteLine(Math.Ceiling(ret));
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;

    return 0;
}


Measured memory_bytes: 3652
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


N = ii()

X = li()

import numpy as np

X = np.sort(X)

x_st = X[0]
x_ed = X[-1]

all_min = np.inf

for i in range(x_st,x_ed+1):
    itr_min = np.sum(np.abs(X-i)**2)
    # print(i,itr_min)


    if(all_min > itr_min):
        all_min = itr_min


print(all_min)

Measured memory_bytes: 12484
#include<bits/stdc++.h>
#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
using namespace std;

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

// 点
struct Point {
    double x,y;
    Point(){}
    Point(double x, double y) : x(x),y(y){}
    Point operator+(Point p) {return Point(x+p.x, y+p.y);}
    Point operator-(Point p) {return Point(x-p.x, y-p.y);}
    Point operator*(double k){return Point(x*k,y*k);}
    Point operator/(double k){return Point(x/k,y/k);}
    double norm(){return x*x+y*y;}
    double abs(){sqrt(norm());}
    bool operator == (const Point &p) const {return equals(x,p.x)&&equals(y,p.y);}
};

typedef Point P;
typedef vector<Point> Polygon;

double cross(Point a, Point b) {return a.x*b.y-a.y*b.x;}

double area(Polygon s){
    double res=0;
    for(int i=0;i<(int)s.size();i++){
        res+=cross(s[i],s[(i+1)%s.size()])/2.0;
    }
    return res;
}

int main() {
    int n; cin>>n;
    Polygon pl;
    rep(i,n) {
        double x,y; cin>>x>>y;
        pl.push_back(Point(x,y));
    }
    double ans = area(pl);
    cout << fixed << setprecision(1);
    cout << ans << endl;
}


Measured memory_bytes: 3300
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

trait Monoid {
   fn id() -> Self;
   fn f(a: Self, b: Self) -> Self;
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
enum MinInt {
   Val(i64),
   Maximal,
}
impl std::ops::MulAssign for MinInt {
   fn mul_assign(&mut self, other: Self) {
      if other < *self {
         *self = other
      };
   }
}
impl std::ops::Mul for MinInt {
   type Output = Self;
   fn mul(self, other: Self) -> Self {
      if self < other {
         self
      } else {
         other
      }
   }
}
impl Monoid for MinInt {
   fn id() -> Self { MinInt::Maximal }
   fn f(a: Self, b: Self) -> Self { a * b }
}
use MinInt::*;

fn dfs(
   lr: usize,
   cost: i64,
   zan: &Vec<u8>,
   ss: &Vec<Vec<u8>>,
   cs: &Vec<i64>,
   yet: &mut BTreeMap<Vec<u8>, i64>,
) -> MinInt {
   if let Some(x) = yet.get_mut(zan) {
      if *x <= cost {
         return Maximal;
      }
      *x = cost;
   } else {
      yet.insert(zan.to_vec(), cost);
   }
   let n = zan.len();
   {
      let mut fin = true;
      for i in 0..n / 2 {
         if zan[i] != zan[n - 1 - i] {
            fin = false;
            break;
         }
      }
      if fin {
         return Val(cost);
      }
   }
   let mut res = Maximal;
   if lr == 0 {
      for (s, &c) in ss.iter().zip(cs.iter()) {
         let m = s.len();
         let mut i = 0;
         while i < min(m, n) {
            if zan[i] != s[m - 1 - i] {
               break;
            }
            i += 1;
         }
         if i == min(m, n) {
            let mut z = vec![];
            if i == m {
               for i in m..n {
                  z.push(zan[i]);
               }
               res *= dfs(0, cost + c, &z, ss, cs, yet);
            } else {
               for i in 0..m - n {
                  z.push(s[i]);
               }
               res *= dfs(1, cost + c, &z, ss, cs, yet);
            }
         }
      }
   } else {
      for (s, &c) in ss.iter().zip(cs.iter()) {
         let m = s.len();
         let mut i = 0;
         while i < min(m, n) {
            if zan[n - 1 - i] != s[i] {
               break;
            }
            i += 1;
         }
         if i == min(m, n) {
            let mut z = vec![];
            if i == m {
               for i in 0..n - m {
                  z.push(zan[i]);
               }
               res *= dfs(1, cost + c, &z, ss, cs, yet);
            } else {
               for i in n..m {
                  z.push(s[i]);
               }
               res *= dfs(0, cost + c, &z, ss, cs, yet);
            }
         }
      }
   }
   res
}

#[fastout]
fn main() {
   input! {
      n: usize,
      sc: [(Bytes, i64); n]
   }

   let mut s = vec![];
   let mut c = vec![];
   for (a, b) in sc.iter().clone() {
      s.push(a.clone());
      c.push(*b);
   }

   let mut ans = Maximal;
   let mut yet = BTreeMap::new();
   for i in 0..n {
      ans *= dfs(0, c[i], &s[i], &s, &c, &mut yet);
   }
   if let Val(x) = ans {
      println!("{}", x);
   } else {
      println!("{}", -1);
   }
}


Measured memory_bytes: 2168
// ABC105B - Cakes and Donuts

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

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

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

	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args){
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		String s,t,u;
		int a,b,hako;
		hako=0;
		String[] abc=new String[2];
		int[] xyz=new int[2];
		try{
				s=reader.readLine();
				t=reader.readLine();
				a=Integer.parseInt(s);
				b=Integer.parseInt(t);
				int[] x=new int[a+1];
				x[0]=0;
				for(int j=1;j<(a+1);j++){
					x[j]=j;
				}
				for(int i=0;i<b;i++){
					u=reader.readLine();
					abc=u.split(",");
					for(int k=0;k<2;k++){
						xyz[k]=Integer.parseInt(abc[k]);
					}
					hako=x[xyz[0]];;
					x[xyz[0]]=x[xyz[1]];
					x[xyz[1]]=hako;
				}
				for(int l=1;l<(a+1);l++){
					System.out.println(x[l]);
				}
		}catch(IOException e){
			System.out.println(e);
		}
	}
}

Measured memory_bytes: 16920
#include <iostream>

using namespace std;

int x[5], y[5];

int main(void) {

	cin >> x[1];
	cin >> y[1];
	cin >> x[2];
	cin >> y[2];

	int a, b;
	a = x[1] - x[2];
	b = y[2] - y[1];

	x[3] = x[2] - b;
	y[3] = y[2] - a;
	x[4] = x[3] + a;
	y[4] = y[3] - b;

	cout << x[3] << " " << y[3] << " " << x[4] << " " << y[4] << endl;

	//system("pause");
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> ii;

const int N = 201;
bool a[N];
int x, n, t;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> x >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    a[t] = true;
  }

  int d = INT_MAX;
  int res = INT_MAX;
  for (int i = 0; i < N; ++i) {
    if (!a[i]) {
      if (abs(i - x) < d) {
        d = abs(i - x);
        res = i;
      }
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3648
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

int n, nq;

void run() {
	scanf("%d%d", &n, &nq);
	REP(qi, nq) {
		int a, b; scanf("%d%d", &a, &b);
		if (n == 1) a = b = min(a, b);
		while (a != b) {
			if (a < b) swap(a, b);
			a = (a - 2) / n + 1;
		}
		printf("%d\n", a);
	}
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(char b) { return "'" + string(1, b) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) {
	string res = "{";
	for (const auto& x : v) res += (res == "{" ? "" : ", ") + to_string(x);
	return res + "}";
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug(T...);
}
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define db(...) 42
#endif
typedef long long ll;
typedef long double ld;
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	dsu d(n);
	while (q--) {
		int t, u, v;
		scanf("%d%d%d", &t, &u, &v);
		if (t == 0) d.merge(u, v);
		else printf("%d\n", (int)d.same(u, v));
	}
}


Measured memory_bytes: 4052
#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
string s;
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	cin>>s;
	ll tot=0,ans=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='W')
		{
			ans+=tot;
		}
		else
		{
			tot++;
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 640
N = int(input())
B = list(map(int, input().split()))
A = [None]*N

A[N-1] = B[N-2]
for i in range(N-2, 0, -1):
    if B[i] >= B[i-1]:
        A[i] = B[i-1]
    else:
        A[i] = B[i]
A[0] = B[0]

print(sum(A))

Measured memory_bytes: 3064
from collections import Counter

s = list(input())
k = int(input())

ans = 0
s_d = s*2
for i in range(1,len(s_d)):
    if s_d[i-1]==s_d[i]:
        s_d[i] = '_'
        if i>=len(s_d)//2:
            ans+=k-1
        else:
            ans+=1
s_s = set(s)
if len(s_s)==1 and len(s)%2!=0:
    ans = len(s)*(k//2)+(k%2==1)*(len(s)//2)
print(ans) 

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		
		if((x-r)>=0 && (x+r)<=W && (y-r)>=0 && (y+r)<=H) {
			System.out.printf("Yes\n");
		}else {
			System.out.printf("No\n");
		}
	}

}



Measured memory_bytes: 26380
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

const long long max_val = 1000000000000000000;


int main()
{
    int i = 0;
    long long A = 0, result = 1, old_res = 1;
    int N = 0;    
    bool zero_mult = false;
    bool too_big = false;

    cin >> N;

    for (i = 0; i < N; i++)
    {
        cin >> A;
        result *= A;

        if (A == 0 || zero_mult)
        {
            zero_mult = true;
            too_big = false;
        }
        else if (result == 0)
        {
            too_big = true;
        }
        else if (result / old_res != A || result > max_val)
        {
            too_big = true;
        }
        
        old_res = result;
    }

    if (zero_mult)
    {
        cout << "0";
    }
    else if (too_big)
    {
        cout << "-1";
    }
    else
    {
        cout << result;
    }
}



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

string s;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>s;
    sort(s.begin(),s.end());
    if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

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

int main(){
	int N, x, a, i, d;
	long long int ans = 0;
	scanf("%d%d", &N, &x);
	int *sum = (int *)malloc(sizeof(int) * (N + 1));
	for(i = 0; i <= N; i++){
		sum[i] = 0;
	}
	for(i = 0; i < N; i++){
		scanf("%d", &a);
		sum[i] += a;
		sum[i + 1] += a;
	}
	for(i = 0; i < N; i++){
		if(sum[i] > x){
			d = sum[i] - x;
			sum[i + 1] -= d;
			ans += d;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
int main()
{
	int i,n,j,c=0;
	char s[3],t[3];
	scanf("%s",s);
	scanf("%s",t);
	for(i=0;i<3;i++)
	{
		if(s[i]==t[i])
		{
			c++;
		}
	}printf("%d\n",c);
}

Measured memory_bytes: 1728
import itertools
N, M = map(int, input().split())
S = list()
for i in range(M):
  s = list(map(int, input().split()))
  S.append(s[1:])
    
P = list(map(int, input().split()))
 
A = [0, 1]
ans = 0
for i in itertools.product(A, repeat = N):
  flag = 0
  for j in range(M):
    cnt = 0
    for s in S[j]:
      if i[s - 1] == 1:
        cnt += 1
    if cnt % 2 != P[j]:
      flag = 1
  if flag == 0:
    ans += 1
    
print(ans)

Measured memory_bytes: 41456
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n; cin >> n;
	int cnt = 0;
	rep(i, n){
		int a; cin >> a;
		if(a % 2) cnt++;
	}
	cout << (cnt % 2 ? "NO" : "YES") << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
    int w,h,x,y;

    cin >> w >> h >> x >> y;

    cout << (double)w * (double)h / 2 << " ";

    if(x*2 == w && y*2 == h)cout << "1";
    else cout << "0";

    return 0;
}


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

using namespace std;
typedef long long ll;

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

	if (2 * b < a) cout << a - 2 * b << endl;
	else cout << 0 << endl;


	return 0;
}

Measured memory_bytes: 888
import sys
import math


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


def main():
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())

    time =0

    m =min(A,B,C,D,E)
    time +=math.ceil(N/m) +4
    print(time)







if __name__ == "__main__":
    main()


Measured memory_bytes: 62300
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, K;
	cin >> N >> K;
	int b[N];
	for(int i=0;i<N;i++){
		b[i] = 0;
	}
	for(int i=0;i<K;i++){
		int d;
		cin >> d;
		for(int j=0;j<d;j++){
			int A;
			cin >> A;
			b[A - 1]++;
		}
	}
	int ans = 0;
	for(int i=0;i<N;i++){
		if(b[i] == 0) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<string.h>
int main(){
	int r=0,a[4],b[2],i,s=100,nf;
	scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1]);
	for(i=0;i<4;i++){
		if(s>=a[i]){
			s=a[i];
			nf=i;
		}
	}
	for(i=0;i<4;i++){
		if(i!=nf){
			r+=a[i];
		}
	}
	if(b[0]>b[1]){
		r+=b[0];
	}else{
		r+=b[1];
	}

	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Math;

namespace CsharpSpiral {
    partial class Program {
        static void Main(string[] args) {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = true };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }
        public void Solve(ConsoleInput cin) {
            var X = cin.ReadIntArray(3);
            var a = X[0];
            var b = X[1];
            var th = X[2] * PI / 180;
            var S = a * b * Sin(th) / 2;
            var c = Sqrt(a * a + b * b - 2 * a * b * Cos(th));
            var L = a + b + c;
            var h = S / a * 2;
            Console.WriteLine(S);
            Console.WriteLine(L);
            Console.WriteLine(h);
        }
        
    }

    static class ExtendClass {
        public static void Swap<T>(this T[] X, int i, int j) {
            T tmp = X[i];
            X[i] = X[j];
            X[j] = tmp;
        }
        public static string Join<T>(this T[] X, string separator = " ") => string.Join(separator, X);
        public static S[] Clone<S>(this S[] src) where S : struct {
            var res = new S[src.Length];
            Array.Copy(src, res, src.Length);
            return res;
        }
    }

    class ConsoleInput {
        private readonly TextReader _stream;
        private readonly char _separator = ' ';
        private readonly Queue<string> inputStream;
        public ConsoleInput(TextReader stream, char separator = ' ') {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read {
            get {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) {
            var ret = new string[N];
            for(long i = 0; i < N; ++i)
                ret[i] = Read;
            return ret;
        }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
    }
}



Measured memory_bytes: 16396
n =int(input())
csfs = []
for i in range(0,n-1):
    csfs.append(list(map(int,input().split())))

res = []
for i in range(0,n-1):
    c = csfs[i][0]
    s =csfs[i][1]
    f = csfs[i][2]
    syuppatu = s
    toutyaku = s+c
    for j in range(i+1,n-1):
        if toutyaku < csfs[j][1]:
            syuppatu = csfs[j][1]
            toutyaku = syuppatu+csfs[j][0]
        else:
            syuppatu = ((toutyaku+csfs[j][2]-1) // csfs[j][2]) * csfs[j][2]
            toutyaku = syuppatu + csfs[j][0]
    res.append(toutyaku)
res.append(0)
for re in res:
    print(re)

Measured memory_bytes: 3188
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

int n;
LL a[202], k[202];

LL calc(LL a, LL k) {
	if (a < k)return 0;
	if (a%k == 0)return a / k;


	LL dif = ((a / k) + 1);
	return calc(a-max((a%k)/dif,1LL)*dif, k);
}

int main() {
	cin >> n;
	LL g = 0;
	REP(i, n) {
		cin >> a[i] >> k[i];
		g ^= calc(a[i], k[i]);
	}
	cout << (g > 0 ? "Takahashi" : "Aoki") << endl;
}

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

int main()
{
    int n;
    string s, t;

    cin >> n >> s >> t;

    string result;
    for (int i = 0; i < n; ++i)
    {
        result = result + s[i] + t[i];
    }

    cout << result << endl;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nk = readln.split.to!(long[]);
    auto N = nk[0];
    auto K = nk[1];
    long[] ps, ms;
    long zc;
    foreach (a; readln.split.to!(long[])) {
        if (a < 0) {
            ms ~= -a;
        } else if (a > 0) {
            ps ~= a;
        } else {
            ++zc;
        }
    }
    sort!"a < b"(ps);
    sort!"a < b"(ms);

    auto m_len = (ps.length * ms.length).to!long;
    auto z_len = zc * (N-zc) + zc * (zc-1) / 2;
    if (K <= m_len) {
        long l = -10L^^18-1, r = 0;
        ms.reverse();
        while (l+1 < r) {
            auto m = (r+l)/2;
            long k;
            foreach (p; ps) {
                size_t ll = 0, rr = ms.length;
                if (p * -ms[0] > m) continue;
                while (ll+1 < rr) {
                    auto mm = (ll+rr)/2;
                    if (p * -ms[mm] <= m) {
                        ll = mm;
                    } else {
                        rr = mm;
                    }
                }
                k += rr.to!long;
            }
            if (k < K) {
                l = m;
            } else {
                r = m;
            }
        }
        writeln(r);
    } else if (K <= m_len + z_len) {
        writeln(0);
    } else {
        K -= m_len + z_len;
        long l = 0, r = 10L^^18+1;
        while (l+1 < r) {
            auto m = (l+r)/2;
            long k;
            if (!ps.empty) foreach (i, p; ps[0..$-1]) {
                size_t ll = i+1, rr = ps.length;
                if (p * ps[i+1] > m) continue;
                while (ll+1 < rr) {
                    auto mm = (ll+rr)/2;
                    if (p * ps[mm] <= m) {
                        ll = mm;
                    } else {
                        rr = mm;
                    }
                }
                k += (ll-i).to!long;
            }
            if (!ms.empty) foreach (i, p; ms[0..$-1]) {
                size_t ll = i+1, rr = ms.length;
                if (p * ms[i+1] > m) continue;
                while (ll+1 < rr) {
                    auto mm = (ll+rr)/2;
                    if (p * ms[mm] <= m) {
                        ll = mm;
                    } else {
                        rr = mm;
                    }
                }
                k += (ll-i).to!long;
            }
            if (k < K) {
                l = m;
            } else {
                r = m;
            }
        }
        writeln(r);
    }
}

Measured memory_bytes: 11736
#include <iostream>
#include <string>
#include <cassert>
using namespace std;

int main()
{
  int N;  // 3桁の整数
  cin >> N;
  assert(100 <= N <= 999);

  string integer = to_string(N);

  // string integer;
  // cin >> integer;

  for (int i = 0; i < integer.size(); i++) { // 入力では必ずサイズ3
    if (integer[i] != integer[2-i]) {
      cout << "No" << endl;
      break;
    }
    if (i == 2) cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 256