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

int main(){
    int N;
    cin >> N;
    int d[N];
    cins(d, d + N);
    sort(d, d + N);
    cout << d[N / 2] - d[N / 2 - 1] << endl;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n,l=map(int,input().split())
s=[input() for i in range(n)]
s.sort()
print(*s,sep='')

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

using namespace std;

#define rep(i, n) for(int i=0; i<(int)(n); i++)

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

    vector<int> inputs(N);
    rep(i, N){
        cin >> inputs.at(i);
    }
    int min_n = inputs.at(0);
    int max_n = inputs.at(0);
    rep(i, N){
        int x = inputs.at(i);
        if(x < min_n) min_n = x;
        if(x > max_n) max_n = x;
    }
    cout << max_n - min_n << endl;
}

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

int A,B;

int main () {
	cin >> A >> B; 
	if (A==B) {
		cout  << "Draw" << endl;
	} else if (A==1) {
		cout << "Alice" << endl;
	} else if (B==1) {
		cout << "Bob" << endl;
	} else if (A>B) {
		cout << "Alice" << endl;
	} else if (A<B) {
		cout << "Bob" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	for (int x, y;;) {
		std::cin >> x >> y;
		if (x==0 && y==0) break;
		if (x < y) std::cout << x << ' ' << y << '\n';
		else std::cout << y << ' ' << x << '\n';
	}
}

Measured memory_bytes: 3008
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define INF 1145141919810364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n;
pair<int, P> a[200010];
vector<int> dat;
int m;

void init(int n_) {
	m = 1;
	while (m < n_)m *= 2;
	dat.resize(m * 2 - 1, 0);
}

void update(int i, int x) {
	i += m - 2;
	dat[i] = x;
	while (0 < i) {
		i = (i - 1) / 2;
		dat[i] = max(dat[2 * i + 1], dat[2 * i + 2]);
	}
}

int query(int a, int b, int k = 0, int l = 0, int r = -1) {
	if (r < 0)r = m;
	if (r <= a || b <= l)return 0;
	if (a <= l && r <= b)return dat[k];
	int vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
	int vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
	return max(vl, vr);
}

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i].first;
	for (int i = 0; i < n; i++) {
		cin >> a[i].second.first;
		a[i].second.second = i + 1;
	}
	sort(a, a + n);
	init(n);
	for (int i = 0; i < n; i++) {
		int x = query(0, a[i].second.second) + a[i].second.first;
		update(a[i].second.second, x);
	}
	cout << query(0, n) << endl;
}

Measured memory_bytes: 9088
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

vector<vector<pair<int,int> > > g;
vector<int> edge_colors;

void dfs(int u, int p, int c) {
  int color = 0;
  for (auto e : g[u]) {
    int v = e.first;  int edge_id = e.second;
    if (v == p) continue;
    if (color == c) ++color;
    edge_colors[edge_id] = color;
    dfs(v, u, color);
    ++color;
  }
}

int main() {
  int N;
  cin >> N;
  
  g = vector<vector<pair<int, int> > > (N);
  edge_colors = vector<int>(N - 1, -1);
  
  for (int i = 0; i < N - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back(make_pair(b, i));
    g[b].push_back(make_pair(a, i));
  }

  int mx_deg = 0;
  for (int u = 0; u < N; ++u) {
    int deg = g[u].size();
    mx_deg = max(mx_deg, deg);
  }
  int K = mx_deg;

  dfs(0, -1, -1);

  cout << K << endl;
  for (int i = 0; i < N - 1; ++i) {
    cout << edge_colors[i] + 1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 8320
#include <stdio.h>

int count;

void han(int x, int s, int n, int sum, int y)
{
	if (y == n || x == 10) {
		if (sum == s && y == n) {
			count++;
		}
		return ;
	}
	han(x + 1, s, n, sum + x, y + 1);
	han(x + 1, s, n, sum, y);
}
		
int main(void)
{
	int s, n, x, y;
	
	while (1) {
		scanf("%d %d", &n, &s);
		if (n == 0 && s == 0) {
			break;
		}
		han(0, s, n, 0, 0);
		printf("%d\n", count);
		count = 0;
	}
	
	return (0);
}

Measured memory_bytes: 600
#include <iostream>

int main()
{
    std::ios_base::sync_with_stdio(0);
    int n,k,r=0;
    std::cin >> n >> k;
    for (int i=0;i<n;++i)
    {
        int h;
        std::cin >> h;
        if (h >= k) ++r;
    }
    std::cout << r;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a;
  string s, t, u;
in2(s, t);
  rep(i, s.size()){
    a = 0;
    s = s[s.size() - 1] + s.substr(0, s.size() - 1);
    rep(j, s.size()){
      if(s[j] != t[j])
        a++;
    }
    if(a == 0){
      out("Yes");
      memi;
      return 0;
    }
  }
  out("No");
  memi;
}

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

int main(){
  int n;
  cin >> n;
  if(n<10) cout << n << endl;
  else if(n<100) cout << 9 << endl;
  else if(n<1000) cout << 9+(n-99) << endl;
  else if(n<10000) cout << 909 << endl;
  else if(n<100000) cout << 909+(n-9999) << endl;
  else if(n==100000) cout << 90909 << endl;
  return 0;
}

Measured memory_bytes: 256
s = input() + '0'
det = 'ACGT'
maxc = 0
for i in range(len(s)):
    for p in range(i, len(s)):
        cnt = 0
        for o in range(i, p + 1):
            if s[o] in det:
                cnt += 1
            else:
                if cnt > maxc:
                    maxc = cnt
                    break
                else:
                    break
            if o == p:
                if cnt > maxc:
                    maxc = cnt
print(maxc)

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

using namespace std;

int main() {

	int a, b;

	scanf("%d %d", &a, &b);

	if(a+b == 15) {
		printf("+\n");
	} else if(a*b == 15) {
		printf("*\n");
	} else {
		printf("x\n");
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
int x[10],y[10];
double dist(int i, int j){
    double dx = x[i]-x[j];
    double dy = y[i]-y[j];
    return pow(dx*dx + dy*dy, 0.5);
}
int main() {
    cin >> N;
    for (int i=0;i<N;i++) cin >> x[i] >> y[i];
    double sum = 0;
    vector<int> v(N);
    for (int i=0;i<N;i++) v[i] = i;
    do{
        for (int i=0;i<N-1;i++) sum += dist(v[i],v[i+1]);
    }while(next_permutation(v.begin(),v.end()));
    int Factorial = 1;
    for (int i=2;i<=N;i++) Factorial *= i;
    cout << fixed << setprecision(10) << sum / Factorial << endl;

    return 0;
}

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int,int>;
using ppa = pair<pa,int>;
#define SORT(v, n) sort(v, v+n);
#define ALL(v) v.begin(),v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v),greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)),v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i = (b-1); i >= a; i--)
#define rrep(i,n) RFOR(i,0,n)
#define INF 999999999
#define mins(a,b) a = min(a,b)
#define maxs(a,b) a = max(a,b)

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

//8近傍
int dy[]={0,0,1,-1,1,1,-1,-1};
int dx[]={1,-1,0,0,1,-1,1,-1};

ll mod = 1000000007;

void solve() {
    string sa,sb,sc; cin >> sa >> sb >> sc;
    int a = 0,b = 0,c = 0;
    char cc = 'a';
    while(1){
        if(cc == 'a'){
            if(a == sa.size()) break;
            cc = sa[a];
            a++;
        }else if(cc == 'b') {
            if (b == sb.size()) break;
            cc = sb[b];
            b++;
        }else{
            if(c == sc.size()) break;
            cc = sc[c];
            c++;
        }
    }
    cc -= 32;
    cout << cc << endl;
}

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

    solve();

    return 0;
}

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

int main(){
  int X,A,B;
  cin>>X>>A>>B;
  if(A-B>=0){
    cout<<"delicious"<<endl;
    return 0;
  }
  if(A-B+X>=0){
    cout<<"safe"<<endl;
    return 0;
  }
  cout<<"dangerous"<<endl;
  return 0;
}

      
    



Measured memory_bytes: 256
import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop, heapify
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

N, X, T = inpl()
if N % X == 0:
    print(N//X * T)
else:
    print(N//X * T + T)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)



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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    string s;
    cin >> s;
    cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No");
}


Measured memory_bytes: 3612
n, h = map(int, input().split())
A = []
B = []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)        
    B.append(b)        

maxa = max(A)
B = [b for b in B if b > maxa]
B.sort(reverse=True)

c = 0
for b in B:
    h -= b
    c += 1
    if h <= 0:
        break

if h > 0:
    c += h//maxa + (h%maxa > 0)
print(c)


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



int main(){
    int n,max=0,min=100000,i,a;
    scanf("%d",&n);

    for(i=1;i<=n;i++){
        scanf("%d",&a);
        if(a>max)
            max=a;
        if(a<min)
            min=a;
    }

    printf("%d\n",max-min);






    return 0;
}



Measured memory_bytes: 128
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define sz(a) int((a).size())

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int ans=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!=t[i])
		{
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

typedef long long ll;

#define F first 
#define S second 
#define PB push_back
#define MP make_pair 
#define rep(i,a,b) for (ll i=a;i<b;i++)

typedef vector<int> vi;
typedef pair<int,int> pi;


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

    if(m>=n) cout<< "Yes"<<endl;
    else cout<<"No"<<endl;

    return 0; 
}



Measured memory_bytes: 256
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

def main():
    s = SI().strip()

    if len(s) <= 2:
        print(0)
        return
    
    prepre = s[0]
    previous = s[1]
    if previous == 'A' and prepre == 'A': A_counter = 2
    elif previous == 'A' or (prepre == 'A' and previous == 'B'): A_counter = 1
    else: A_counter = 0
    jumps = 0
    for char in s[2:]:
        if char == 'A':
            if previous == 'A':
                A_counter += 1
                prepre = previous
            elif previous == 'B':
                prepre = previous
                A_counter = 1
                previous = 'A'
            elif previous == 'C':
                prepre = previous
                A_counter += 1
                previous = 'A'
        elif char == 'B':
            if previous == 'A':
                prepre = previous
                previous = 'B'
            elif previous == 'B':
                prepre = previous
                A_counter = 0
            elif previous == 'C':
                # BCB のときはまだリセットしない。
                if prepre != 'B':
                    A_counter = 0
                prepre = previous
                previous = 'B'
        elif char == 'C':
            if previous == 'A':
                A_counter = 0
                prepre = previous
                previous = 'C'
            elif previous == 'B':
                jumps += A_counter
                prepre = previous
                previous = 'C'
            elif previous == 'C':
                A_counter = 0
                prepre = previous
    print(jumps)

main()

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;

namespace Rally
{
    class Program
    {
        static void Main(string[] args)
        {
            int inputCoordinate = int.Parse(Console.ReadLine());
            string[] inputStamina = Console.ReadLine().Split(' ');
            

            if (inputStamina.Count() != inputCoordinate)
            {
                Console.WriteLine("Wrong input");
            }

            List<int> minStamina = new List<int>();

            for(int i = 0; i < 100; i++)
            {
                int countedStamina = 0;
                foreach (string inp in inputStamina)
                {
                    countedStamina += (i - int.Parse(inp)) * (i - int.Parse(inp));
                }

                minStamina.Add(countedStamina);
            }           

            Console.WriteLine(minStamina.Min());

        }
    }
}

Measured memory_bytes: 13268
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

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

  string s, t;
  cin >> s >> t;

  string ans = (t.substr(0,t.size()-1) == s) ? "Yes" : "No";

  cout << ans << endl;
  return 0;
}


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

int main(void) {
  int N;
  cin >> N;
  ll ans = 0;
  rep(i, N) {
    ll a;
    cin >> a;
    ans += a - 1;
  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << endl;
#else
	#define DBG(X)
	#define endl '\n'
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

void solve()
{
	ll a, b, c;
	cin >> a >> b >> c;

	cout << max(0LL, c - (a - b)) << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;
vvi E(222222);
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  for(int i=0;i<m;i++){
    ll a,b;cin>>a>>b;
    E[--a].pb(--b);
    E[b].pb(a);
  }
  queue<pair<ll,ll>>que;
  que.push(mp(0,0));
  vi dist(222222,llINF);
  vi ans(222222);
  dist[0] = 0;
  while(!que.empty()){
    ll now = que.front().F;
    ll cost = que.front().S;
    que.pop();
    for(auto &e:E[now]){
      if(dist[e] == llINF){
	dist[e] = cost+1;
	ans[e] = now+1;
	que.push(mp(e,cost));
      }
    }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<n;i++){
    cout<<ans[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 19440
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int w = x % 100;
        int ans = 1;
        int check = w / 5;
        if (w % 5 != 0)
            check++;
        if (check > x / 100)
            ans = 0;
        System.out.println(ans);
    }
}

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

typedef long long ll;

int main(){
    ll x;
    cin>>x;
    ll ans=0;
    ans+=(x/11)*2;
    x%=11;
    if(x>6)ans+=2;
    else if(x>0)ans+=1;
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    vector<bool>used(1000000+10,true);
    int n,m;cin>>n>>m;
    vector<int>tiya; for(int i=n;i>=1;i--)tiya.push_back(i);
    rep(i,m){
        int gotiusa; cin>>gotiusa;
        tiya.push_back(gotiusa);
    }
    for(int i=(int)tiya.size()-1;i>=0;i--){
        if(used[tiya[i]]){used[tiya[i]]=false;cout<<tiya[i]<<endl;}
    }
}

Measured memory_bytes: 5092
#include<stdio.h>
int main(){
  int K,S;
  int counter = 0;
  scanf("%d %d",&K,&S);
  for(int x = 0;x <= K;x++){
    for (int y = 0; y <= K; y++){
      int z = S - x - y;
      if (x + y + z == S && z <= K && 0 <= z) {
        counter += 1;
      }
  }
  }
  printf("%d\n",counter);
}


Measured memory_bytes: 128
//#pragma GCC target ("avx2")
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long

using namespace std;
using namespace __gnu_pbds;

template <class T> using ordered_set =
tree<T, null_type, less<T>,
rb_tree_tag, tree_order_statistics_node_update>;

const int N = (int)(1e6 + 5);
const int M = (int)(1e9 + 7);
const int INF = (int)(1e18 + 9);
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};

int a[N];

signed main() {
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    cin >> a[i];
  int ret = 0;
  for (int i = 2; i <= n - 1; ++i) {
    if (a[i] > a[i - 1] && a[i] < a[i + 1])
      ++ret;
    if (a[i] < a[i - 1] && a[i] > a[i + 1])
      ++ret;
  }
  cout << ret;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include<math.h>
#include <functional>
using namespace std;

int main(void) {
	int N, M;
	cin >> N >> M;
	if (N%M == 0)
		cout << "0" << endl;
	else
		cout << "1" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
typedef long long ll;
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int n;

int main() {
    cin >> n;
    vector<int> kuku;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            kuku.emplace_back(i*j);
        }
    }
    for (auto x: kuku) {
        if (x == n) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  
    int n = Integer.parseInt(br.readLine());
    Map<String, Map<Integer, Integer>> m = new HashMap<>();
    String[] data;
    String city;
    int point;
    for (int i=0; i<n; i++){
      data = br.readLine().split(" ");
      city = data[0];
      point = Integer.parseInt(data[1]);
      if (!m.containsKey(city)){
        m.put(city, new HashMap<>());
      }
      m.get(city).put(point, i+1);
    }
    Object[] name = m.keySet().toArray();
    Arrays.sort(name);
    for (Object s : name){
      Object[] o = m.get(s).keySet().toArray();
      Arrays.sort(o, Collections.reverseOrder());
      for (Object i : o){
        System.out.println(m.get(s).get(i));
      }
    }
  }
}


Measured memory_bytes: 20564
import java.util.*;
import java.io.*;

public class Main {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer stok;

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

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

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) (br.read());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    void solve() throws IOException {
char[][] c = new char[2][3];
        for (int i = 0; i < 2; i++) {
            c[i] = nextToken().toCharArray();
        }
        
        if (c[0][0] == c[1][2] && c[0][1] == c[1][1] && c[0][2] == c[1][0]) {
            out.println("YES");
        } else {
            out.println("NO");
        }
    }

    void run() throws IOException {
        // br = new BufferedReader(new FileReader("dragons.in"));
        //out = new PrintWriter("dragons.out");
        // br = new BufferedReader(new FileReader("input.txt"));
        // out = new PrintWriter("output.txt");
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        br.close();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        // Locale.setDefault(Locale.US);
        new Main().run();
    }
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a;
  cin >> n >> a;
  if (n%500 <= a){
      cout << "Yes" << endl;
  }else{
      cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

vector<int> adj[10000];

int32_t main(){
	int n, x, y;
	cin >> n >> x >> y;
	
	for(int i = 1; i < n; i++){
		adj[i].push_back(i+1);
		adj[i+1].push_back(i);
	}
	adj[x].push_back(y);
	adj[y].push_back(x);
	
	map<int,int> m;
	
	for(int i = 1; i <= n; i++){
		queue<int> q;
		q.push(i);
		int dis[n+1];
		for(int j = 1; j <= n; j++)
			dis[j] = 1e9;
		dis[i] = 0;
		while(!q.empty()){
			auto p = q.front();
			q.pop();
			for(auto x : adj[p]){
				if(dis[x] == 1e9){
					dis[x] = dis[p] + 1;
					q.push(x);
				}
			}
		}
		for(int j = i+1; j <= n; j++){
			if(dis[j] != 1e9){
				m[dis[j]]++;
			}
		}
	}
	for(int i = 1; i <= n-1; i++)
		cout << m[i] << endl;

	return 0;
}



Measured memory_bytes: 640
#include<stdio.h>
int main(){
  int n, d, ans, i, j;
  scanf("%d %d %d", &n, &d, &ans);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d", &a[i]);
  }
  for(j=0;j<n;j++){
    for(i=1;i<=d;i+=a[j]){
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

int main()
{
  int64_t N, ans = 0;
  cin >> N;
  vector<int64_t> A(2 * N);
  for (int i = 0; i < 2 * N; i++)
  {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  for (int i = 0; i < 2 * N; i += 2)
  {
    ans += A.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import math
import statistics
a=int(input())
# b=input()
# c=[]
# for i in b:
#     c.append(i)
e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#j = [input() for _ in range(3)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
a1=[]
b1=[]
c1=[]
for i in range(a):
    if f[i]<=e1:
        a1.append(f[i])
    if e1<f[i]<=e2:
        b1.append(f[i])
    if e2<f[i]:
        c1.append(f[i])

lis = [len(a1),len(b1),len(c1)]
print(min(lis))

Measured memory_bytes: 10876
wrds = input().split()
a = int(wrds[0])
b = int(wrds[2])
while wrds[1]!="?":
    if wrds[1]=="+":
        print(a+b)
    elif wrds[1]=="-":
        print(a-b)
    elif wrds[1]=="*":
        print(a*b)
    elif wrds[1]=="/":
        print(int(a/b))
    wrds = input().split()
    a = int(wrds[0])
    b = int(wrds[2])



Measured memory_bytes: 5592
import std.stdio, std.conv, std.string, std.algorithm;

void main(){
	while(true){
		int n, w;
		readf("%d %d", &n, &w);readln();
		if(n == 0 || w == 0) break;
		int[int] histgram;
		foreach(i; 0..n){
				int v = readln.chomp.to!int;
				histgram[v/w]++;
		}
		int keyMax = reduce!max(histgram.keys);
		int valMax = reduce!max(histgram.values);
		real result = 0.01;
		foreach(i; 0..keyMax){
			int* v = i in histgram;
			if(v == null) continue;
			result += cast(real)(keyMax-i)/keyMax**v/valMax;
		}
		writeln(result);
	}
}

Measured memory_bytes: 1104
#include<bits/stdc++.h>
using namespace std;
main()
{
    float a,b[1006],c,d,e,r,f,t,g,k=1000;
    int i,j;
    cin>>a>>t>>c;
    for(i=0;i<a;i++)
        cin>>b[i];
    for(i=0;i<a;i++)
    {
        d=t-(b[i]*(.006));
        f=abs(d-c);
        if(k>f)
        {
            k=f;
            r=i+1;

        }}
        cout<<r<<endl;
        return 0;

}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int a,b,sum;
    scanf("%d%d",&a,&b);
    sum=a+b;
    if(sum%3==0 || (a%3==0) || (b%3==0))
    {
        printf("Possible\n");
    }
    else
    {
        printf("Impossible\n");
    }
    return 0;
}


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

#include <atcoder/segtree>
using namespace atcoder;

int op(int a, int b) {
    return max(a, b);
}

int e() {
    return -1;
}

int target;
bool f(int x) {
    return x < target;
}

int main(){
    int N, Q;
    cin >> N >> Q;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    segtree<int, op, e> seg(A);
    for (int i = 0; i < Q; i++) {
        int t, a, b;
        cin >> t >> a >> b;
        if (t == 1) {
            a--;
            seg.set(a, b);
        } else if (t == 2) {
            a--;
            cout << seg.prod(a, b) << endl;
        } else {
            a--;
            target = b;
            // auto f = [&](int x) { return x < b; };
            cout << seg.max_right<f>(a) + 1 << endl;
        }
    }
}


Measured memory_bytes: 6004
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        function<bool(int)> check = [&](int x){
            int res = 0;
            while(x > 0){
                res += x % 10;
                x /= 10;
            }
            if(res >= a && res <= b) return 1;
            return 0;
        };
        ans += (check(i) ? i : 0);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main (void)
{
int seisuu[3];

int x;

scanf("%d %d %d",&seisuu[0],&seisuu[1],&seisuu[2]);
 
 if(seisuu[0]>seisuu[1])
{x=seisuu[0];seisuu[0]=seisuu[1];seisuu[1]=x;}

if(seisuu[0]>seisuu[2])
{x=seisuu[0];seisuu[0]=seisuu[2];seisuu[2]=x;}

if(seisuu[1]>seisuu[2])
{x=seisuu[1];seisuu[1]=seisuu[2];seisuu[2]=x;}

printf("%d %d %d\n",seisuu[0],seisuu[1],seisuu[2]);

return 0;
}


Measured memory_bytes: 2700
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	static char[][] map;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int h = sc.nextInt();
		int w = sc.nextInt();
		int d = sc.nextInt();
		HashMap<Integer, Position> hm = new HashMap<>();
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				hm.put(sc.nextInt(), new Position(i, j));
			}
		}
		int q = sc.nextInt();
		int l, r, sum;
		int[] ans = new int[h * w + 1];

		for (int i = 1; i <= h * w; i++) {
			if (i <= d) {
				ans[i] = 0;
			} else {
				Position pos1 = hm.get(i);
				Position pos2 = hm.get(i - d);
				ans[i] = ans[i - d] + Math.abs(pos1.geth() - pos2.geth())
						+ Math.abs(pos1.getw() - pos2.getw());
			}
		}
		for (int i = 0; i < q; i++) {
			l = sc.nextInt();
			r = sc.nextInt();
			sb.append(ans[r] - ans[l] + "\n");
		}

		System.out.print(sb);
	}
}

class Position {
	private int h;
	private int w;

	public Position(int h, int w) {
		this.h = h;
		this.w = w;
	}

	public Position(Position pos) {
		this.h = pos.geth();
		this.w = pos.getw();
	}

	public int geth() {
		return h;
	}

	public int getw() {
		return w;
	}
}

Measured memory_bytes: 99756
R,G,B,N = map(int,input().split())

li = [R,G,B]
li.sort()
R = li[0]
G = li[1]
B = li[2]
#print(R,G,B)

ans = 0
for b in range(N//B+1):
    for g in range((N-B*b)//G+1):
        if N-B*b-G*g >= 0 and (N-B*b-G*g)%R == 0:
            ans += 1
print(ans)



Measured memory_bytes: 40812
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int dp[11][331];
void rec(int bit,int d,int s)
{
	dp[d][s]++;
	for(int i=0;i<10;i++)
	{
		if(bit&(1<<i))rec(bit&~(1<<i),d+1,s+i*(d+1));
	}
}
int main()
{
	int n,s;
	rec((1<<10)-1,0,0);
	while(cin >> n >> s)
	{
		if(s>330)cout << 0 << endl;
		else cout << dp[n][s] << endl;
	}
	return 0;
}

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


int main(){

    // x ... 動物の総数
    // y ... 足の総数
    int x, y;
    cin >> x >> y;

    const int turtle = 4;
    const int crane = 2;
    bool judge = false;

    rep(i, x) {
        int turtle_count = turtle * i;
        int crane_count = crane * (x - i);

        int count = turtle_count + crane_count;
        if(count == y) {
            cout << "Yes" << endl;
            return 0;
        }

    }

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

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
# define ll int
#define M 998244353
#define pb push_back                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
 
							
 
 int main(){
   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
   ll n,mm,i,p,pp,pe = 0;
   string s;
   cin>>n>>mm;
   map<ll,ll> m,mmm;
   for(i=0;i<mm;i++){
   	cin>>p>>s;
   	if(m[p] == 1){
   		continue;
	   }
	   else{
	   	if(s == "AC"){
	   		m[p] = 1;
		   }else{
		   	mmm[p]++;
		   }
	   }
   }
   
   pp = 0;
   for(i=0;i<=n;i++){
   	if(m[i]){
   	    	pp++;
   	    	pe+=mmm[i];
   	}
   
   }
   
   cout<<pp<<" "<<pe;
   
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int x1, x2, x3, x4, x5;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;
  int ans = 0;
  if (x1 == 0) ans = 1;
  if (x2 == 0) ans = 2;
  if (x3 == 0) ans = 3;
  if (x4 == 0) ans = 4;
  if (x5 == 0) ans = 5;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
# indeednow_A_b
import sys
from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
L = [0 for i in range(M)]
R = [0 for i in range(M)]
for i in range(M):
    L[i], R[i] = [int(x) for x in stdin.readline().rstrip().split()]
# print(L, R)
ans = set()
ans1 = 0
ans2 = 10**6
for k in range(M):
    if ans2 < L[k]:
        print("0")
        sys.exit()
    if ans1 < L[k]:
        ans1 = L[k]
    if ans2 > R[k]:
        ans2 = R[k]

    # temp = set()
    # for l in range(L[k], R[k]+1):
    #     temp.add(l)
    # if len(ans) != 0:
    #     ans = temp & ans
    # else:
    #     ans = temp
print(ans2+1-ans1)


Measured memory_bytes: 11064
#include <string>
#include <cmath>
#include <iostream>
using namespace std;

int main(){
	double a;
	double b;
	double C;
	cin >> a;
	cin >> b;
	cin >> C;
	double d;
	d = C * 3.1415926535 / 180;
	cout << fixed << a * b * sin(d) / 2 << endl;
	cout << fixed << a + b + sqrt( a*a+b*b-a*b*cos(d)*2 ) << endl;
	cout << fixed << b * sin(d) << endl;
	return 0;
}

Measured memory_bytes: 1284
#include <iostream>
#include <vector>
#include <string>

using namespace std;

void reverse(vector<char>& vec){
	vector<char> tmp;
	for(int i = 0;i < vec.size();i++){
		tmp.push_back(vec[vec.size() - 1 - i]);
	}
	vec.clear();
	vec = tmp;
}


int main(void){
	int n;
	vector<char> ans;
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		while(n != 0){
			ans.push_back((char)('0' + (n % 8)));
			n /= 8;
		}
		reverse(ans);
		for(int i = 0;i < ans.size();i++){
			if('4' <= ans[i]){
				ans[i]++;
			}
			if('6' <= ans[i]){
				ans[i]++;
			}
		}
		for(int i = 0;i < ans.size();i++){
			cout << ans[i];
		}
		cout << endl;
		ans.clear();
	}


	return 0;
}

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

int main()
{
	int N, M;
	cin >> N >> M;
	priority_queue<int> pq;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		pq.push(A);
	}
	while (M--) {
		auto v = pq.top(); pq.pop();
		pq.push(v / 2);
	}
	ll res = 0;
	while (!pq.empty()) {
		res += pq.top(); pq.pop();
	}
	cout << res << endl;
	return 0;
}


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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

#define MAX_NUM (1000000000 + 7)

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

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

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

u64 My_Combination(u64 n, u64 k, i64 m) {
  if (n < k) return 0;
  if (k == 0 || n == k) return 1;
  u64 res = 1;
  for (u64 i = 1; i <= k; ++i)
    res = (((res * (n + 1 - i)) % m) * modinv(i, m)) % m;
  return res;
}
u64 c[10][10];

int main() {
  cout << setprecision(18);
  u32 N;
  cin >> N;
  for (u32 i = 1; i <= N; ++i) {
    u32 tmp = i;
    while (tmp > 9) {
      tmp /= 10;
    }
    c[tmp][i % 10]++;
  }
  u64 res = 0;
  for (u32 i = 0; i < 10; ++i) {
    for (u32 j = 0; j < 10; ++j) {
      res += c[i][j] * c[j][i];
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

t = ns()
n = len(t)
s = [t[i] for i in range(n)]

a, b = 0, 0

for i in range(n):
    if s[i] == '0':
        a += 1
    elif s[i] == '1':
        b += 1

print(2 * min(a, b))

Measured memory_bytes: 3964
import java.util.*;

public class Main{
    public static void main(String[]args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	if(N%1000!=0){
	    System.out.println(1000-N%1000);
	}else{
	    System.out.println(0);
	}
    }
}


Measured memory_bytes: 35716
#include <stdio.h>
#include <algorithm>

using ll = long long;
int main() {
	ll n, m;
	scanf("%lld %lld", &n, &m);

	ll res;
	if (n == 1 && m == 1) {
		res = 1;
	} else if (n == 1 || m == 1) {
		res = n * m - 2;
	} else {
		res = (n - 2) * (m - 2);
	}
	printf("%lld\n", res);
}

Measured memory_bytes: 128
N = int(input())
n = [int(i) for i in str(N)]

flg = 0
if n[0] == n[1] == n[2]:
    flg = 1
elif n[1] == n[2] == n[3]:
    flg = 1
else:
    flg = 0
print("Yes" if flg == 1 else "No")

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

using namespace std;

int main () {

  int X;
  cin >> X;

  bool ans;

  if (X == 3 || X == 5 || X == 7) {
    ans = true;
  } else {
    ans = false;
  }

  if (ans) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }


  return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
	char mp[15][15] = {0};
	int pi, pj;
	int cnt;
	while (scanf("%s", mp[1]) != EOF){
		cnt = 0;
		
		for (int i = 2; i <= 12; i++) scanf("%s", mp[i]);
		
		for (int i = 1; i <= 12; i++){
			for (int j = 0; j < 12; j++){
				if (mp[i][j] == '1'){
					if(mp[i-1][j] != '2') {
						cnt++;
					}
					while(mp[i][j] != '0' && j < 12){
						mp[i][j] = '2';
						pi = i;
						while (mp[++pi][j] == '1'){
							pj = j;
							while(mp[pi][pj] == '1'){
								mp[pi][pj] = '2';
								pj--;
							}
							pj = j;
							while(mp[pi][++pj] == '1'){
								mp[pi][pj] = '2';
							}
						}
						j++;
					}
				}
			}
		}
		
		printf("%d\n", cnt);
	}
}

Measured memory_bytes: 968