akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = Integer.parseInt(sc.nextLine()); //人数
    float sum = 0.0f;
    for (int i = 0; i < num; i++) {
      String[] str = sc.nextLine().split(" ");
      float price = Float.parseFloat(str[0]);
      String tanni = str[1];
      
      sum += (tanni.equals("JPY")) ? price : 380000.0 * price;
    }
    
    System.out.println(sum);
  }
}

Measured memory_bytes: 22868
#include <cstdio>
using namespace std;

int W,H;
int dx[]={-1,0,1,0,-1,-1,1,1};
int dy[]={0,-1,0,1,-1,1,-1,1};
int f[50][50];

void dfs(int x, int y)
{
	f[x][y]=0;
	for(int i=0; i<8; i++)
	{
		int tx=x+dx[i], ty=y+dy[i];
		if(tx<0||ty<0||tx>=W||ty>=H) continue;
		if(f[tx][ty]==0) continue;
		
		dfs(tx,ty);
	}
}

int main()
{
	while(scanf("%d%d", &W,&H), (W||H))
	{
		for(int i=0; i<H; i++)
		for(int j=0; j<W; j++)
			scanf("%d", &f[j][i]);
			
		int ans=0;
		for(int i=0; i<H; i++)
		for(int j=0; j<W; j++)
		{
			if(f[j][i])
			{
				ans++;
				dfs(j,i);
			}
		}
		
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 0
n = input()
elems = []
for _ in range(n):
    elems.append(input())

inds = range(n)
inds.sort(key=lambda x: elems[x])

resp = 0
for i in range(n):
    if (inds[i] + i) % 2:
        resp += 1

print(resp / 2)

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

#define LL long long int
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int N = 2e5 + 5;
const int oo = 1e9 + 5;
const LL ooll = 1e18 + 5;
const int MOD = 1e9 + 7;

LL powermod(LL a, LL b) {
	if (b == 0) return 1;
	LL res = powermod(a, b/2);
	res = (res * res)%MOD;
	if (b & 1) res = (res * a)%MOD;
	return res;
}

int ncr(int n, int r) {
	int ans = 1;
	for (int i=n;i>n-r;--i) {
		ans = (ans * 1LL * i)%MOD;
	}
	for (int i=1;i<=r;++i) {
		ans = (ans * 1LL * powermod(i, MOD-2))%MOD;
	}
	return ans;
}

void solve() {
	int n;
	cin >> n;
	if (n < 5) {
		cout << "0\n";
		return;
	}
	int ans = 0;
	for (int i=0;i<=11;++i) {
		if ((n - 5 - i) & 1) continue;
		ans += (ncr(11, i) * 1LL * ncr(15 + (n - 5 - i)/2, 15)) % MOD;
		if (ans >= MOD) ans -= MOD;
	}
	cout << ans << '\n';
}

int main() {
	FASTIO;
	int T;
	cin >> T;
	while(T--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define LONGMAX 1e18
#define MOD 1000000007
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define fr(a,n) for(int i=a;i<n;i++)

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

	int n;
	cin>>n;

	vector<int> a(n,0);
	vector<int> b(n,0);
	vector<int> c(n,0);

	for( int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
	}

	int dp[n][3];
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];

	for(int i=1;i<n;i++)
	{
		for(int j=0;j<3;j++)
		{
			dp[i][0]=a[i] + max(dp[i-1][1],dp[i-1][2]);
			dp[i][1]=b[i] + max(dp[i-1][0],dp[i-1][2]);
			dp[i][2]=c[i] + max(dp[i-1][1],dp[i-1][0]);
		}
	}

	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string st;
    cin >> st;

    int n = st.size()+1;
    
    vi ans(n, 0);
    int p = 0;
    Rep(i, n) {
        if (st[i-1] == '<') {
            p++;
            ans[i] = p;
        } else {
            p = 0;
        }
    }

    p = 0;
    for (int i = st.size()-1; i >= 0; i--) {
        if (st[i] == '>') {
            p++;
            ans[i] = max(ans[i], p);
        } else {
            p = 0;
        }
    }


    int ret = 0;
    rep(i, ans.size()) {
        //cout << ans[i] << " ";
        ret += ans[i];
    }
    //cout << endl;
    cout << ret << endl;


    return 0;
}


Measured memory_bytes: 4764
#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() {
    string N;
    cin >> N;
    ll sum = 0;
    for(int i = 0; i < N.size(); i++) {
        sum += N[i] - '0';
    }
    if (sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3712
#include <vector>
#include <string>
#include <set>
#include <iterator>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <limits>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <unordered_set>
#include <fstream>

#define Fill(a, b) memset(a, b, sizeof(a))
typedef long long LL;
const LL inf = 1LL << 61;
const LL mod = 1000000007;

#ifndef DEBUG
#define DEBUG
#endif

#ifdef DEBUG
#define Debug(x) cout << #x << "=" << (x) << endl;
#else
#define Debug(x) ;
#endif

using namespace std;


int main() {
    
    std::ios::sync_with_stdio(false);
    
    LL n, m, k;
    cin >> n >> m >> k;
    bool ok =false;
    for (LL i = 0; i <= n; i++) {
        for (LL j = 0; j <= m; j++) {
            LL c = 2*i*j+k;
            if (i*m + j*n == c) {
                ok = true;
            }
        }
    }
    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(int argc, char *argv[])
{
	int i,n,a[10000],s=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%d",&a[i]);
	s=s+a[i]-1;
	}
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
  int n,y;
  cin >> n >> y;
  y /= 1000;

  int a,b;

  int flag  =0;

  for(a = 0; a < n+1; a++){
    if(10 * a > y || flag == 1){
      break;
    } else{
      for(b = 0; b < n+1; b++){
        if(10 * a + 5 * b > y || flag == 1){
          break;
        } else if(y == 10 * a + 5 * b + (n-a-b)){
            cout << a << " "<< b <<" " << (n-a-b)<< endl;
            flag = 1;
        }
      }
    }
  }
  if(flag == 0){
    cout << -1 << " " << -1 <<" "<< -1 << endl;
  }


  return 0;
}

Measured memory_bytes: 504
using System;

namespace StudyScheduling
{
    class Program
    {
        static void Main(string[] args)
        {
            int H1, M1, H2, M2, K;
            string inD0 = Console.ReadLine();
            string[] cngD0 = inD0.Split(' ');

            H1 = int.Parse(cngD0[0]);
            M1 = int.Parse(cngD0[1]);
            H2 = int.Parse(cngD0[2]);
            M2 = int.Parse(cngD0[3]);
            K = int.Parse(cngD0[4]);

            int HM1 = (H2 - H1) * 60;

            int HM2 = HM1 + M2 - M1;

            int ans = HM2 - K;

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27524
from collections import Counter

while True:
    input_item = input()

    if input_item == "0":
        break

    input_list = []
    input_list.append(input_item)
    input_list.append(input())
    input_list.append(input())

    for item in input_list:
        count = Counter(item)
        count[item[0]] -= 1

        if count["A"] > count["B"]:
            count["A"] += 1
        else:
            count["B"] += 1

        print(count["A"], count["B"])



Measured memory_bytes: 5956
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    v=list(map(int,readline().split()))

    d0=dict()
    d1=dict()
    for i in range(0,n-1,2):
        if v[i] not in d0:
            d0[v[i]]=1
        else:
            d0[v[i]]+=1
    for i in range(1,n,2):
        if v[i] not in d1:
            d1[v[i]]=1
        else:
            d1[v[i]]+=1

    d0=sorted(d0.items(),key=lambda x:x[1],reverse=True)
    d1=sorted(d1.items(),key=lambda x:x[1],reverse=True)

    if d0[0][0]!=d1[0][0]:
        print(n-d0[0][1]-d1[0][1])
    else:
        if len(d0)!=1 and len(d1)!=1:
            m0=n-d0[0][1]-d1[1][1]
            m1=n-d0[1][1]-d1[0][1]
            print(min(m0,m1))
        elif len(d0)==1 and len(d1)==1:
            print(n//2)
        elif len(d0)==1:
            print(n-d0[0][1]-d1[1][1])
        else:
            print(n-d0[1][1]-d1[0][1])

if __name__=="__main__":
    main()

Measured memory_bytes: 19616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Xcubic
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            int input = int.Parse(line);
            Console.WriteLine("{0}", input * input * input);

        }
    }
}

Measured memory_bytes: 5604
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split(' ');
            var n = r[0].ToInt();
            var a = r[1].ToInt();
            var b = r[2].ToInt();
            var ans = CMath.ModPow(2, n) - 1;
            ans -= CMath.Combination(n, a);
            ans -= CMath.Combination(n, b);
            while (ans < 0)
            {
                ans += 1000000007;
            }
            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }
}

public class CMath
{
    private static long mod = 1000000007;

    public static long ModPow(long x, long n)
    {
        x = x % mod;
        if (n == 0)
        {
            return 1;
        }
        else if (n % 2 == 1)
        {
            return (x * ModPow(x, n - 1)) % mod;
        }
        else
        {
            return ModPow((x * x) % mod, n / 2) % mod;
        }
    }

    public static long Combination(long n, long k)
    {
        long x = 1;
        for (long i = n - k + 1; i <= n; i++)
        {
            x = x * i % mod;
        }
        long y = 1;
        for (int i = 1; i <= k; i++)
        {
            y = y * i % mod;
        }
        y = ModPow(y, mod - 2);
        return x * y % mod;
    }
}

public static class Extentions
{
    public static int ToInt(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static decimal ToDecimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double ToDouble(this object obj)
    {
        return double.Parse(obj.ToString());
    }
}



Measured memory_bytes: 11220
n = int(input())

count = [[[0]*10 for _ in range(3)] for _ in range(4)]

for _ in range(n):
    b,f,r,v = map(int,input().split())
    count[b-1][f-1][r-1] += v

b_cnt = 0
for floor in count:
    if b_cnt != 0:
        print("#" * 20)
    b_cnt += 1
    
    for room in floor:
        print("", *room)


Measured memory_bytes: 5624
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main()
{
	string a;
	int l;
	cin>>a;
	l=a.size();
	cout<<a[0]<<l-2<<a[l-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    long double n, m, d;
    cin >> n >> m >> d;
    if (fabs(d) <= 0.01)
    {
        putout((m - 1) / n);
    }
    else
    {
        putout(((2 * n - 2 * d) * (m - 1.0)) / (n * n));
    }
    return 0;
}


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

int main() {
  char C;
  cin >> C;
  string str ="abcdefghijklmnopqrstuvwxyz";
  for(int i = 0; i < 25; i++){
    if(C == str.at(i)){
      cout << str.at(i+1) << endl;
    }
  }
}
      
  



Measured memory_bytes: 256
n = int(input())
nums = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

li = []
for i in range(2**n):
    an = format(i, 'b').zfill(n)
    li.append(an)

ans = []
for lis in li:
    num = 0
    for i in range(n):
        if lis[i] == '1':
            num += nums[i]
    ans.append(num)

for j in m:
    if j in ans:
        print('yes')
    else:
        print('no')


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

const int H = 30;
const int W = 30;
const int INF = 1000000000;
const int dy[4] = {-1, 0, 1, 0};
const int dx[4] = {0, 1, 0, -1};

class State{
public:
  int x, y, cnt, cube[3], step;
};

int h, w;
char data[H][W];
map<char, int> ntoi;
//map<int, char> iton;

int ntor(int x){
  if(x%2==0) return x+1;
  else return x-1;
}

int bfs(int sy, int sx, string str){
  bool vis[6][6][6][H][W][7];
  State u, v;
  u.y = sy;
  u.x = sx;
  u.cnt = 0;
  u.cube[0] = ntoi['r'];
  u.cube[1] = ntoi['y'];
  u.cube[2] = ntoi['m'];
  u.step = 0;
  fill(vis[0][0][0][0][0], vis[6][0][0][0][0], false);
  vis[u.cube[0]][u.cube[1]][u.cube[2]][u.y][u.x][0] = true;
  queue<State> Q;
  Q.push(u);

  while(!Q.empty()){
    u = Q.front(); Q.pop();
    if(data[u.y][u.x] != 'w'){
      if(data[u.y][u.x] == str[u.step] && u.cube[0] == ntoi[str[u.step]]){
	u.step++;
	if(u.step==6)
	  return u.cnt;
      }else continue;
    }
    for(int i=0;i<4;i++){
      int ty = u.y + dy[i];
      int tx = u.x + dx[i];
      int tcube[3];
      if(ty<0 || ty>=h) continue;
      if(tx<0 || tx>=w) continue;
      if(data[ty][tx] == 'k') continue;
      switch(i){
      case 0:
	tcube[0] = u.cube[2];
	tcube[1] = u.cube[1];
	tcube[2] = ntor(u.cube[0]);
	break;
      case 1:
	tcube[0] = u.cube[1];
	tcube[1] = ntor(u.cube[0]);
	tcube[2] = u.cube[2];
	break;
      case 2:
	tcube[0] = ntor(u.cube[2]);
	tcube[1] = u.cube[1];
	tcube[2] = u.cube[0];
	break;
      case 3:
	tcube[0] = ntor(u.cube[1]);
	tcube[1] = u.cube[0];
	tcube[2] = u.cube[2];
	break;
      }
      if(vis[tcube[0]][tcube[1]][tcube[2]][ty][tx][u.step]) continue;
      vis[tcube[0]][tcube[1]][tcube[2]][ty][tx][u.step] = true;
      v.y = ty;
      v.x = tx;
      v.cnt = u.cnt + 1;
      v.cube[0] = tcube[0];
      v.cube[1] = tcube[1];
      v.cube[2] = tcube[2];
      v.step = u.step;
      Q.push(v);
    }
  }
  return -1;
}

main(){
  ntoi['r'] = 0;
  ntoi['c'] = 1;
  ntoi['g'] = 2;
  ntoi['m'] = 3;
  ntoi['b'] = 4;
  ntoi['y'] = 5;
  while(cin >> w >> h){
    if(w == 0 && h == 0) break;
    int sy, sx;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin >> data[i][j];
	if(data[i][j] == '#'){
	  sy = i;
	  sx = j;
	  data[i][j] = 'w';
	}
      }
    }
    string in;
    cin >> in;
    int ans = bfs(sy, sx, in);
    if(ans == -1){
      cout << "unreachable" << endl;
    }else{
      cout << ans << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2288
n = gets.to_i
  room = Array.new(4){Array.new(30, 0)}

  while line = gets do
    b, f, r, v = line.split.map(&:to_i)
    room[b - 1][10 * (f - 1) + (r - 1)] += v
  end

  4.times do |i|
    3.times do |j|
      10.times do |k|
          print(" #{room[i][10 * j + k]}")
      end
      puts
    end
    if i != 3 then puts "####################" end
  end

Measured memory_bytes: 8808
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
int main() {
    int N; cin>>N;
    vi v(N);
    for (int i = 0; i < N; i++)cin>>v[i];
    sort(v.begin(),v.end());
    double ans=v[0];
    for (int i = 0; i < N-1; i++){
        ans=(ans+v[i+1])/2.0;
    }
    printf("%.6f\n",ans);
}

Measured memory_bytes: 3784
from collections import defaultdict
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n = inp()
nums = inlt()
num_dict = defaultdict(int)
for i in range(n - 1):
    num_dict[nums[i]] += 1

for i in range(1,n + 1):
    print(num_dict[i])
    
#print(n - s if s <= n else -1)
#print('No')
#print()



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

using namespace std;

int main(){
        int N;
        cin>>N;
        vector <int> a;
        for(int i=0;i<N;i++){
                int aa;
                cin>>aa;
                a.push_back(aa);
        }
        int res;
        int now=0;
        for(res=0;res<N;res++){
                now=a[now]-1;
                if(now==1)
                        break;
        }
        if(now==1)
                cout<<res+1<<endl;
        else
                cout<<-1<<endl;
        return 0;
}


Measured memory_bytes: 892
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		var A = GetLong();
		var B = GetLong();
		var C = GetLong();
		var K = GetLong();

		long sum = 0;
		sum += Min(A, K);
		K -= Min(A, K);
		K -= Min(B, K);
		sum -= Min(C, K);
		WriteLine(sum);
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 27496
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll H,W; cin >> H >> W;
  vector<string> s(H);
  REP(i,H) cin >> s[i];

  vector<vector<bool>> visited(H, vector<bool>(W,false));
  ll ans = 0;
  vector<ll> d = {-1,0,1,0};
  REP(i,H) REP(j,W) if(!visited[i][j]){
    ll black = 0, white = 0;
    //(i,j)スタートで幅優先探索
    queue<pair<ll,ll>> q;
    q.push({i,j});
    visited[i][j] = true;
    while(!q.empty()){
      pair<ll,ll> p = q.front();
      q.pop();
      ll cx = p.first, cy = p.second;
      if(s[cx][cy]=='#') black++;
      else white++;
      REP(i,4){
        ll nx = cx + d[i], ny = cy + d[i^1];
        if(nx<0 || nx > H-1 || ny<0 || ny>W-1) continue;
        if(visited[nx][ny]) continue;
        if(s[nx][ny] == s[cx][cy]) continue;
        q.push({nx,ny});
        visited[nx][ny] = true;
      }
    }
    //カウント
    ans += black * white;
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 256;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
char s[MAXN];
bool vis[MAXN];
int main() {
	scanf("%s", s + 1);
	int len = strlen(s + 1);
	if (len != 26) {
		for (int i = 1; i <= len; i++)
			vis[s[i]]++;
		for (int i = 'a'; i <= 'z'; i++)
			if (!vis[i]) {
				printf("%s%c\n", s + 1, i);
				return 0;
			}
	} else {
		for (int i = len; i >= 1; i--) {
			for (int j = s[i]; j <= 'z'; j++)
				if (vis[j]) {
					s[i] = j;
					printf("%s\n", s + 1);
					return 0;
				}
			vis[s[i]] = true, s[i] = 0;
		}
		puts("-1");
	}
	return 0;
}

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

int main(){
  int a[26]={};
  char s;
  for(;cin>>s;){
    if(a[s-'a']>0){
      cout<<"no"<<endl;
      return 0;
    }
    a[s-'a']++;
  }
  cout<<"yes"<<endl;
}

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

typedef long long ll;

int main() {
    vector<char> box = {'a','b','c','d','e','f',
    'g','h','i','j','k','l','m','n','o','p','q','r',
    's','t','u','v','w','x','y','z'};
    ll N;
    ll k;
    ll x;
    ll q,r;
    ll cnt = 0;
    cin >> N;
    int j = 1;
    while(N>0) {
        N = N - pow(26,j);
        j++;
    }
    j = j - 2; // j + 1 桁の数値になる
    vector<char> bufbox(j+1);
    k = N + pow(26,j+1);
    x = k - 1;
    //cout << j << endl;
    for(int i=0;i<j+1;i++) {
        bufbox.at(i) = 'a';
    }
    while(true) {
        q = x / 26;
        r = x % 26;
        x = q;
        //cout << r << endl; //0,1,...,r番目のアルファベット
        bufbox.at(j-cnt) = box.at(r);
        cnt++;
        if (x == 0) {
            break;
        }
    }
    for(int i=0;i<j+1;i++) {
        cout << bufbox.at(i);
    }
    cout << endl;
}

Measured memory_bytes: 3884
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;++x)
#define Red(x,y,z) for(int x=y;x>=z;--x)
using namespace std;
const int MAXN=3e5+5;
char buf[1<<12],*p1=buf,*p2=buf,nc;int ny;
inline char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;if(nc<0)return nc;
	x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48);return x*ny;
}int n,L,x[MAXN],t[MAXN],l[MAXN],r[MAXN],ans,top[MAXN],del[MAXN];
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read(),L=read(),ans=n+1;
	Rep(i,1,n)x[i]=read();
	Rep(i,1,n){
		t[i]=read(),ans+=t[i]/(L*2),t[i]%=L*2;
		if(!t[i]){del[i]=1,ans--;continue;}
		l[i]=(2*(L-x[i])>=t[i]),r[i]=(2*x[i]>=t[i]);
		if(!l[i]&&!r[i])del[i]=1;
	}ans-=l[n];int o=n,sum=0,top=0;
	Rep(i,1,n-1)if(!del[i]){
		if(!l[i]){o=i;break;}
		r[i]?top++:top?top--,ans--:0;
	}sum+=top,top=0;
	Red(i,n-1,o)if(!del[i]){
		if(!r[i])break;
		l[i]?top++:top?top--,ans--:0;
	}sum+=top,ans-=sum>>1,cout<<1ll*ans*(L*2)<<'\n';
	return 0;
}




Measured memory_bytes: 6400
while 1:
    n = input()
    if n == 0: break
    f = [[] for i in range(n)]
    for i in range(input()):
        a, b = map(int,  raw_input().split())
        a -= 1; b -= 1
        f[a].append(b)
        f[b].append(a)
    ans = set(f[0])
    for i in f[0]:
        ans |= set(f[i])
    if 0 in ans: ans.remove(0)
    print len(ans)

Measured memory_bytes: 6756
#include<stdio.h>
int main()
{
	int N,T,E,i,t,X,r=-1;
	scanf("%d%d%d",&N,&T,&E);
	for(i=0;i<N;i++)
	{
		scanf("%d",&X);
		for(t=X;t<20000;t+=X)
			if(T-E<=t&&t<=T+E)
				r=i+1;
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 596
n,m,q=map(int,input().split())
def dfs(seq):
    u=0
    if len(seq)==n:
        ans=0
        for a,b,c,d in data:
            if seq[b-1]-seq[a-1]==c:
                ans+=d
        return ans
    else:
        for i in range(seq[-1],m+1):
            seq_next=seq+[i]
            u=max(u,dfs(seq_next))
        return u

data=[]
for _ in range(q):
    A=list(map(int,input().split()))
    data.append(A)
print(dfs([1]))


Measured memory_bytes: 9124
import fractions
from collections import deque
import numbers as np


def main():
    S = input()
    s1 = S[0]
    S = S[1:]
    s2 = ''
    s1_cnt = 1
    s2_cnt = 0
    for i in range(len(S)):
        if s1 != S[i]:
            if s2 == S[i]:
                s2_cnt += 1
            else:
                s2 = S[i]
                s2_cnt = 1

        else:
            s1_cnt += 1
    print('Yes' if s1_cnt == 2 and s2_cnt == 2 else 'No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 5560
//
// Create by 神舟 on 2015-02-20
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <cctype>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <set>
#include <vector>
using namespace std;

#define CLR(x) memset(x,0,sizeof x)
#define ll long long
#define inf 0x3f3f3f3f
const int maxn=1e1+5;
const int MOD=5e5+5;
int num[maxn],n;
bool dfs( int deep, int A, int B)
{
    if(deep==11) return true;
    if(num[deep]>A&&dfs(deep+1,num[deep],B)) return true;
    if(num[deep]>B&&dfs(deep+1,A,num[deep])) return true;
    return false;

}
int main()
{
#ifdef LOCAL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	ios_base::sync_with_stdio(0);

	scanf("%d",&n);
	while(n--){
        CLR(num);
        for(int i=1;i<11;scanf("%d",num+i++));
        if(dfs(1,-inf,-inf)) printf("YES\n");
        else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1188
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mat vector<vector<int>>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
#define INF (int)1e18


auto max(auto a){auto ans=a[0];for(auto i:a)if(i>ans)ans=i;return ans;}
auto min(auto a){auto ans=a[0];for(auto i:a)if(i<ans)ans=i;return ans;}
void print(auto a){for(auto i:a)cerr<<i<<' ';cerr<<'\n';}

int fat[3000001];

int fact(int n)
{
	return fat[n];
}

int modpow(int a,int n)
{
	int ans=1;
	while(n)
	{
		if(n%2)
			ans=(ans*a)%mod;
		n/=2;
		a=(a*a)%mod;
	}
	return ans;
}
int inv(int a)
{
	return modpow(a,mod-2);
}

signed main()
{
	fat[0]=1;
	for(int i=1;i<=3000000;i++)
		fat[i]=(fat[i-1]*i)%mod;
	fio
	inp(x) inp(y)
	if(max(x,y)>2*min(x,y))
	{
		cout<<0<<'\n';
		return 0;
	}
	int t=x+y;
	if(t%3)
	{
		cout<<0<<'\n';
		return 0;
	}
	t/=3;
	int l=x-t;
	int r=t-l;
	int ans=fact(l+r)*inv((fact(l)*fact(r))%mod);
	cout<<ans%mod<<'\n';
	printclock;
}

Measured memory_bytes: 23808
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#define ll long long
#define INF 1e+7
#define MOD 1000000007
using namespace std;

int main(){
    int N;
    cin >> N;
    ll A[N];
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    
    sort(A,A+N);
    
    ll ans=0;
    
    if(N%2 == 1){
        ll ans1=0;
        int i=0;
        for(i=0; i<N/2; i++){
            ans1-=A[i]*2;
        }
        ans1+=A[i];
        i++;
        ans1+=A[i];
        i++;
        for(; i<N; i++){
            ans1+=A[i]*2;
        }
        
        
        ll ans2=0;
        i=0;
        for(; i<N/2-1; i++){
            ans2-=A[i]*2;
        }
        ans2-=A[i];
        i++;
        ans2-=A[i];
        i++;
        for(; i<N; i++){
            ans2+=A[i]*2;
        }
        
        
        ans=max(ans1,ans2);
    }
    
    
    
    if(N%2 == 0){
        int i=0;
        for(; i<N/2-1; i++){
            ans-=A[i]*2;
        }
        ans-=A[i];
        i++;
        
        ans+=A[i];
        i++;
        
        for(; i<N; i++){
            ans+=A[i]*2;
        }
        
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
inf=10**15
n,k=map(int,input().split())
a=list(map(int,input().split()))
num=[inf]*n
num[0]=0
now=0
for i in range(n):
	now=a[now]-1
	if num[now]==inf:
		num[now]=i+1
	else:
		loop=i+1-num[now]
e=-1
for i in range(n):
	if num[i]!=inf:
		if e<num[i]:
			e=num[i]
if e>=k:
	for i in range(n):
		if num[i]==k:
			print(i+1)
			break
else:
	k-=e
	k%=loop
	for i in range(n):
		if num[i]==e:
			now=i
			break
	for i in range(k):
		now=a[now]-1
	print(now+1)




Measured memory_bytes: 32384
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define all(x) begin((x)), end((x))
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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;
}

map<ll,ll> prime_fact(ll num) {
    ll now = 2;
    map<ll,ll> divisors; 
    if (num<2) {
        return map<ll,ll>();
    }
    while(now*now<=num) {
        while(num%now==0) {
            divisors[now]++;
            num /= now;
        }
        now++;
    }
    if (num != 1) {
        divisors[num]++;
    }
    return divisors;
}


vector<ll> divisors(ll num) {
    ll now = 1;
    vector<ll> divs;
    while(now*now<=num) {
        if (num % now==0) {
            divs.push_back(now);
            if (now*now!=num){
                divs.push_back(num/now);
            }
        }
        now++;
    }
    return divs;
}

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    map<ll,ll> d = prime_fact(n);
    ll res = 0;
    vector<ll> csum(100,0);
    rep(i,100) {
        csum[i+1] = csum[i]+i;
    }
    for(auto x:d) {
        auto ptr = upper_bound(all(csum), x.second);
        res += ll(ptr-csum.begin())-2;
    }
    cout << res << endl;
    return 0;
}


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

    // 具体的なイメー図を持てれば問題は解けるの典型例だなぁと

int main(){
    long long X, Y;
    cin >> X >> Y;

    long long ans;

    ans = abs(X - Y);

    if(ans <= 1){
        cout << "Brown" << endl;
    }else{
        cout << "Alice" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
def findmin(arr,n):
  dp = [0]*n
  dp[1] = abs(arr[0]-arr[1])
  for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(arr[i-1]-arr[i]), dp[i-2]+abs(arr[i-2]-arr[i]))
  return dp[-1]

n = int(input())
arr = list(map(int,input().split()))
print(findmin(arr,n))

Measured memory_bytes: 20428
#include<iostream>
using namespace std;
int main(){
  int n;
  string s;
  cin>>n>>s;
  int ans=0;
  for(int i=0;i<=n-3;i++){
    if(s[i]=='A' & s[i+1]=='B' & s[i+2]=='C'){
      ans+=1;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){
  int ans=15, x[5];
  rep(i,5) cin >> x[i];
  rep(i,5)ans-=x[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
import sys
sys.setrecursionlimit(50000)

def findSet(x,element,weight):
    if(x != element[x]):
        element[x],s = findSet(element[x],element,weight)
        weight[x] += s

    return element[x],weight[x]

def union(x,y,element,weight,w):
    x,wx = findSet(x, element, weight)
    y,wy = findSet(y, element, weight)

    link(x,wx,y,wy,w,element)
    
def link(x,wx,y,wy,z,element):
    z = z + wy - wx

    element[x] = y
    weight[x] = z

n,q = map(int, input().split());

element = [i for i in range(n)]
weight = [0 for i in range(n)]

for i in range(q):
    inp = map(int, input().split());
    inp = list(inp)    

    if(inp[0] == 0):
        x,y,w = inp[1],inp[2],inp[3]
        union(x,y,element,weight,w)
    else:
        x,y = inp[1],inp[2]
        x,wx = findSet(x,element,weight)
        y,wy = findSet(y,element,weight)

        if(x == y):
            print(wx - wy)
        else:
            print('?')



Measured memory_bytes: 49232
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
struct unionfind{
  int par[100010]; // 親ノード  必要に応じて要素数を変えよう
  int rank[100010]; // ランク　必要に応じて要素数を変えよう
  unionfind(int n){
    init(n);
  }
  void init(int n){
    for(int i=0;i<=n;i++){
      par[i]=i;
      rank[i]=1;
    }
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    }
    else {
      return par[x] = root(par[x]);
    }
  }
  int size(int x){
    return rank[root(x)];
  }
  bool same(int x,int y) {
    return root(x) == root(y);
  }
  void unite(int x,int y) {
    x=root(x);
    y=root(y);
    if(x==y){
      return;
    }
    if(rank[x]<rank[y]){
      swap(x,y);
    }
    rank[x]=rank[x]+rank[y];
    par[y]=x;
  }
};
int main(){
  vector<vector<int> > g(100010);
  int i,n,m,k,a,b,c,d,x[100010];
  scanf("%d %d %d\n",&n,&m,&k);
  unionfind tree(n);
  for(i=0;i<m;i++){
    scanf("%d %d\n",&a,&b);
    a--,b--;
    g[a].push_back(b);
    g[b].push_back(a);
    tree.unite(a,b);
  }
  for(i=0;i<k;i++){
    scanf("%d %d\n",&c,&d);
    c--,d--;
    if(tree.same(c,d)==0){
      continue;
    }
    g[c].push_back(d);
    g[d].push_back(c);
  }
  int ans=0;
  for(i=0;i<n;i++){
    ans=tree.size(i)-1-g[i].size();
    if(ans<0){
      ans=0;
    }
    if(i==0){
      printf("%d",ans);
    }
    else{
      printf(" %d",ans);
    }
  }
  printf("\n");
  return 0;
} 

Measured memory_bytes: 8320
#include<iostream>
#include<cstdio>
#define re register
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
namespace io
{
	template<typename T>void read(T &x)
	{
		x=0;char str=getchar();int ng=1;
		while(!isdigit(str)){if (str=='-')ng=-1;str=getchar();}
		while(isdigit(str)){x=(x<<3)+(x<<1);x+=str-48;str=getchar();}
		x*=ng;
	}
	int buf[100],top;
	template<typename T>void print(T x)
	{
		if (!x)putchar('0');
		if (x<0)putchar('-'),x=-x;
		while(x)buf[++top]=x%10,x/=10;
		while(top)putchar(buf[top--]+48);
	}
}
using io::read;
using io::print;
int n,h,w;
int main()
{
	read(h);read(w);read(n);
	if (h>w)
	{
		if (n%h)print(n/h+1);
		else print(n/h);
	}
	else
	{
		if (n%w)print(n/w+1);
		else print(n/w);
	}
	puts("");
	return 0;
}

Measured memory_bytes: 384
open System

let n, m, x, a, c =
    let n, m, x =
        let l = Console.ReadLine().Split(' ') |> Array.map int
        l.[0], l.[1], l.[2]

    let a, c =
        let ls =
            [ for i in 0 .. n - 1 do
                yield Console.ReadLine().Split(' ') |> Array.map int ]

        let a = Array2D.init n m (fun i j -> ls.[i].[j + 1])
        let c = Array.init n (fun i -> ls.[i].[0])
        a, c

    n, m, x, a, c

let ans =
    let rec dfs is rest =
        match rest with
        | i :: rest ->
            let a, b = dfs is rest, dfs (i :: is) rest
            match a, b with
            | a, -1 -> a
            | -1, b -> b
            | _ -> min a b
        | [] ->
            let ok =
                [ for j in 0 .. m - 1 ->
                    [ for i in is -> a.[i, j] ] ]
                |> List.map (fun l -> l |> List.sum)
                |> List.forall (fun sum -> sum >= x)

            if ok then
                is
                |> List.map (fun i -> c.[i])
                |> List.sum
            else
                -1
    dfs [] [ 0 .. n - 1 ]

ans |> Console.WriteLine


Measured memory_bytes: 42648
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();
                int y1length = y2-y1;
                int x1length = x2-x1;
                int x3 = x2 - y1length;
                int y3 = y2 + x1length;
                int x2length = x3 - x2;
                int y2length = y3 - y2;
                int x4 = x3 - y2length;
                int y4 = y3 + x2length;
		System.out.println(x3 +" "+y3+" "+x4 +" "+y4+" ");
		}
}

Measured memory_bytes: 21844
#!/usr/bin/env python
import math

a, b, C = input().split()
a = float(a)
b = float(b)
C = float(C)

c = math.sqrt(((a*a) + (b*b) - 2*a*b*math.cos(math.radians(C))))
L = a + b + c
S = a*b*math.sin(math.radians(C))/2
h = 2*S/a
print("%.5f\n%.5f\n%.5f" % (S, L, h))

Measured memory_bytes: 7696
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#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 int;

int main(void) {
    string s; cin >> s;
    REP(i, (int)s.size()) cout << "x";
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
#define MAX 100005
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    stringstream geek(x);
    geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}
int main()
{

    int a,b,c,d,e,k;
    int arr[5];
    bool f =false;
    cin>>arr[0]>>arr[1]>>arr[2]>>arr[3]>>arr[4]>>k;
    for(int i=0;i<5;i++)
    {

        for(int j=i+1;j<5;j++)
        {
            if(arr[j]-arr[i]>k) f=true;
        }
    }
    if(f)
    {
        cout<<":("<<endl;


    }
    else
    {
        cout<<"Yay!"<<endl;
    }



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int  //comment for large arrays
#define pll pair<int,int>
#define dbl long double
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define eps 0.00000001
#define INF 10000000000000001
#define all(x) (x).begin(),(x).end()
#define LB(v,x) (lower_bound(all(v),x) - v.begin()) 
#define UB(v,x) (upper_bound(all(v),x) - v.begin())
#define size(x) (int)(x).size()
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define popb() pop_back()
#define popf() pop_front()
#define mp(x,y) make_pair((x),(y))
#define vec(dt) vector<dt>
#define vv(dt) vector<vector<dt>>
#define fastio(x) ios_base::sync_with_stdio(x); cin.tie(NULL)
#define init(v,s) memset(v,s,sizeof(v)) 
#define bug(x) cerr<<"LINE: "<<__LINE__<<" || click to see test details "<<#x<<" = "<<x<<endl
#define loop(i,s,n) for(int i=s;i<n;i++)
#define print(v) for(auto it:v) cout<<it<<" "; cout<<endl 
using namespace std;

int n,a[21][21];

int f(int mask,int i,vec(vec(int)) &dp)
{
	if(i<0) return 1;
	// if(mask==0) return 0;
	if(dp[mask][i]!=-1) return dp[mask][i];
	dp[mask][i] = 0;
	loop(j,0,n) 
		if(a[i][j]==1 && (mask & (1<<j))>0) 
			dp[mask][i] = (dp[mask][i] + f(mask - (1<<j),i-1,dp))%mod;
	return dp[mask][i]%mod;
}

signed main()
{
	fastio(0);
	cin>>n;
	vec(vec(int)) dp(1<<n, vec(int) (n,-1));
	loop(i,0,n) loop(j,0,n) cin>>a[i][j];
	cout<<f((1<<n)-1,n-1,dp)<<endl;
	// loop(i,0,1<<n)
	// {
	// 	print(dp[i]);
	// 	cout<<endl;
	// }
	return 0;		
}

Measured memory_bytes: 411904
A,B,C,X,Y = map(int,input().split())
arr = []
for c in range(0,max(X+1,Y+1)*2,2): 
    a = max(X-c/2,0)
    b = max(Y-c/2,0)
    arr.append(a*A+b*B+c*C)
print(int(min(arr)))

Measured memory_bytes: 6296
n=int(input())
ini=5000
dic={
    "a":ini,
    "b":ini,
    "c":ini,
    "d":ini,
    "e":ini,
    "f":ini,
    "g":ini,
    "h":ini,
    "i":ini,
    "j":ini,
    "k":ini,
    "l":ini,
    "m":ini,
    "n":ini,
    "o":ini,
    "p":ini,
    "q":ini,
    "r":ini,
    "s":ini,
    "t":ini,
    "u":ini,
    "v":ini,
    "w":ini,
    "x":ini,
    "y":ini,
    "z":ini,
}

for _ in range(n):
    s=input()
    for i,v in dic.items():
        dic[i]=min(s.count(i), v)
ans=""
for i,v in sorted(dic.items()):
    ans+=i*v
print(ans)

Measured memory_bytes: 3064
fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    
    val ps = mutableListOf<Int>()
    
    for (i in 1..N) {
        ps.add(readInputLine().toInt())
    }
    
    ps.sortDescending()
    
    println(ps.first() / 2 + ps.drop(1).sum())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 31900
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,a[N];
int main() {
    n=gi();
    int mx=-1e9,mn=1e9;
    for(int i=1;i<=n;i++) a[i]=gi(),mx=max(mx,a[i]),mn=min(mn,a[i]);
    if(mx==n-1&&mn==n-1) return puts("Yes"),0;
    if(mn!=mx&&mn!=mx-1) return puts("No"),0;
    int cnt=0,x=0;
    for(int i=1;i<=n;i++)
        if(a[i]==mx) ++x;
        else ++cnt;
    mx-=cnt;
    if(mx<=0) return puts("No"),0;
    if(x%mx!=0) return puts("No"),0;
    puts("Yes");
    return 0;
}


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

using namespace std;

class Dice {
public:
	int F[6];
	void roleE() {
		int a = F[0]; F[0] = F[3]; F[3] = F[5]; F[5] = F[2]; F[2] = a;
	}
	void roleS() {
		int a = F[0]; F[0] = F[4]; F[4] = F[5]; F[5] = F[1]; F[1] = a;
	}
};

int main() {
	int q, n, f1, f2;
	Dice dice;
	for (int i = 0; i < 6; i++) {
		cin >> dice.F[i];
	}
	cin >> q;
	for (int j = 0; j < q; j++) {
		cin >> f1 >> f2;
		while (true) {
			if (f1 == dice.F[0]) break;
			else if (f1 == dice.F[2] || f1 == dice.F[3]) dice.roleE();
			else dice.roleS();
		}
		int f[4] = { 1, 2, 4, 3 };
		for (int k = 0; k < 4; k++) {
			if (f2 == dice.F[f[k]]) {
				cout << dice.F[f[(k + 1) % 4]] << endl;
				break;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3068
#include <stdio.h>

int main(void){
 int i,n;
 scanf("%d",&n);
 int a[n];
 for(i=0;i<n;i++){
  scanf("%d",&a[i]);
 }
 for(i=0;i<n;i++){
  printf("%d",a[n-i-1]);
  if(i==(n-1)){
   printf("\n");
  }else{
   printf(" ");
  }
 }
 return 0;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int a[100100],b[100100],c[100100],ufp[100100],ufr[100100];

void ufinit(int n){
	int i;
	for(i=0; i<n; ++i){
		ufp[i] = i;
		ufr[i] = 1;
	}
}

int ufind(int x){
	if(x==ufp[x]){
		return x;
	}
	return ufp[x] = ufind(ufp[x]);
}

void unionf(int x, int y){
	x = ufind(x);
	y = ufind(y);
	if(x==y){
		return;
	}
	if(ufr[x] < ufr[y]){
		swap(x,y);
	}
	ufr[x] += ufr[y];
	ufp[y] = x;
}

int main(void){
	int n,q,i;
	ll m,k=0ll;
	cin >> n >> m >> q;
	ufinit(n);
	for(i=0; i<q; ++i){
		cin >> a[i] >> b[i] >> c[i];
		if(!c[i]){
			unionf(a[i],b[i]);
		}
		if(n>m && c[i]){
			cout << "No" << endl;
			return 0;
		}
	}
	if(n>m){
		cout << "Yes" << endl;
		return 0;
	}
	for(i=0; i<q; ++i){
		if(c[i] && ufind(a[i])==ufind(b[i])){
			cout << "No" << endl;
			return 0;
		}
	}
	for(i=0; i<n; ++i){
		if(ufind(i)==i){
			++k;
		}
	}
	cout << ((n<=m && m<=(n+k*(k-3)/2))?"Yes":"No") << endl;
	return 0;
}


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

int main() {
	long int n,i,count1=0,x,y;
	cin>>n;
	long int arr[n];
	for(i=0;i<n;i++)
	   cin>>arr[i];
	sort(arr,arr+n);   
	 for(i=0;i<n;)
	    {
	    	x=lower_bound(arr,arr+n,arr[i])-arr;
	    	y=upper_bound(arr,arr+n,arr[i])-arr;
	    	//cout<<x<<y;
	    	count1+=(y-x)%2;
	    	i=y;
	    }
	   cout<<count1<<'\n'; 
	// your code goes here
	return 0;
}

Measured memory_bytes: 1024