akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        int H = NextInt();
        int W = NextInt();
        int h = NextInt();
        int w = NextInt();
        Console.WriteLine((W-w)*(H-h));
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

Measured memory_bytes: 13268
x, n = map(int, input().split())
if n == 0:
    p = input()
    print(x)
    exit()

p = list(map(int, input().split()))

p = set(p)
now = 0
diff = 101
indx = 0

while True:
    if now not in p:
        now_diff = abs(now - x)
        if diff > now_diff:
            diff = now_diff
            indx = now
        else:
            break
    now += 1

print(indx)


Measured memory_bytes: 9220
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int sum = 0;
        for(int i=0;i<m;i++){
            int an = sc.nextInt();
            sum = sum + an;
        }
        if(sum>n){
            System.out.println(-1);
        }else{
            System.out.println(n-sum);
        }
        sc.close();
    }
}

Measured memory_bytes: 38820
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Hashtable;


public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());

		//ArrayList<String> dict = new ArrayList<String>();
		Hashtable<String, Integer> hashDict = new Hashtable<String, Integer>();
		//String[] dict = new String[1000000];
		int words = 0;
		for(int i = 0; i < n; i++){
			String[] tmpArray = br.readLine().split(" ");
			String inst = tmpArray[0];
			String str = tmpArray[1];

			if(inst.equals("insert")){
				//insert(dict, str);
				hashDict.put(str, words);
				//dict[words] = new String(str);
				words++;
			}
			else if(inst.equals("find")){
				/*
			}
				boolean contains = false;

				for(int j = 0; j < words ; j++){
					if(dict.get(i).equals(str)){
						contains = true;
						break;
					}
				}*/


				//if(dict.contains(str)){
				if(hashDict.get(str) != null){
					System.out.println("yes");
				}
				else{
					System.out.println("no");
				}
			}
		}

	}

	private static void insert(ArrayList<String> dict, String str) {
		// TODO ?????????????????????????????????????????????
		if(dict.size() == 0){
			dict.add(str);
			return;
		}
		else {
			//Iterator<String> it = dict.iterator();
			for(int i = 0; i < dict.size() - 1 ; i++){
				if(dict.get(i).compareTo(str) < 0 && (dict.get(i + 1) == null || dict.get(i+1).compareTo(str) > 0)){
					dict.add(i + 1, str);
					return;
				}
			}
		}

		dict.add(str);

	}
}

Measured memory_bytes: 193728
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl

using namespace std;

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

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll combination(ll n,ll r){
    ll sum=1;
    rrep(i,min(r,n-r)) (sum*=(n-i+1))%=mod;
    return sum;
}

//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b;
    cin>>a>>b;
    if(a<=0 && b>=0) cout<<"Zero"<<endl;
    else if(b<0){
        if((abs(b-a)+1)%2==0) cout<<"Positive"<<endl;
        else cout<<"Negative"<<endl;
    }else if(a>0) cout<<"Positive"<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
ai = list(map(int, input().split()))

# n=3
# ai = np.array([1, 2, 3])

# ai = ai[np.newaxis, :]
# 
# ai2 = ai.T.dot(ai)
# ai2u = np.triu(ai2, k=1)
# 
# s = ai2u.sum()


l = len(ai)

integ = [ai[0]] * len(ai)
for i in range(1, len(ai)):
    integ[i] = integ[i-1] + ai[i]

s = 0
for j in range(l):
    this_s = integ[-1] - integ[j]
    s += ai[j] * this_s

ans = s % (1000000000 + 7)

print(ans)


Measured memory_bytes: 31420
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    Int n; cin >> n;
    vector<Int> A(n);
    bool ok = true;
    for(int i = 0; i < n; i++)
    {
        cin >> A[i];
        if(A[i] == 0)
        {
            ok = false;
        }
    }
    Int ans = 1;
    if(ok == false)
    {
        cout << 0 << endl;
        return;
    }
    for(int i = 0; i < n; i++)
    {
        if(A[i] == 0)
        {
            cout << 0 << endl;
            return;
        }
        if(ans > (Int)1e18 / A[i])
        {
            cout << -1 << endl;
            return;
        }
        ans *= A[i];
    }
    cout << ans << endl;
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 3920
#include <iostream>
#include <cstdio>
#include <cmath>
#define N 1005
using namespace std;

int n, v[N];
double mn, x[N], y[N], r[N], d[N]={0, 1e18};
int main() {
	int i, j, k;
	cin >> x[0] >> y[0] >> x[1] >> y[1] >> n;
	n += 2;
	for(i=2; i<n; i++) {
		cin >> x[i] >> y[i] >> r[i];
		d[i] = 1e18;
	}
	for(i=k=0; i<n; i++) {
		v[k] = 1;
		for(j=0; j<n; j++) {
			d[j] = min(d[j], d[k] + max(0.0, sqrt((x[j]-x[k])*(x[j]-x[k]) + (y[j]-y[k])*(y[j]-y[k])) - r[j] - r[k]));
		}
		mn = 1e18;
		for(j=0; j<n; j++) {
			if(!v[j] && d[j]<mn) mn = d[j], k = j;
		}
	}
	printf("%.12f", d[1]);
	return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    from math import gcd

    #inf = 10**17
    mod = 10**9 + 7

    n = int(input())
    posi = {}
    nega = {}
    ab_zero = 0
    a_zero = 0
    b_zero = 0

    for _ in range(n):
        a,b = map(int, input().split())
        if a==0 and b==0:
            ab_zero += 1
        elif a==0:
            a_zero += 1
        elif b==0:
            b_zero += 1
        elif a*b > 0:
            a = abs(a)
            b = abs(b)
            g = gcd(a, b)
            po = (a//g, b//g)
            if po in posi:
                posi[po] += 1
            else:
                posi[po] = 1
        else:
            a = abs(a)
            b = abs(b)
            g = gcd(a, b)
            ne = (b//g, a//g)
            if ne in nega:
                nega[ne] += 1
            else:
                nega[ne] = 1
    
    res = pow(2, a_zero, mod) + pow(2, b_zero, mod) - 1
    for k, v in posi.items():
        if k in nega:
            res *= pow(2, v, mod) + pow(2, nega[k], mod) - 1
            res %= mod
            nega.pop(k)
        else:
            res *= pow(2, v, mod)
            res %= mod

    for v in nega.values():
        res *= pow(2, v, mod)
        res %= mod

    res += ab_zero - 1
    print(res%mod)

if __name__ == '__main__':
    main()

Measured memory_bytes: 110200
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
using llong = long long;
const int MOD=1000000007;


int calc_sum(int a){
    int ret = 0;
    while (a != 0){
        ret += a % 10;
        a /= 10;
    }

    return ret;
}


int main(int argc, char**argv){
    int n;
    cin >> n;
    int min = 9999999;

    for (int a = 1; a <= 100000;  a++){
        int b = n - a;
        if (b <= 0) continue;
        if (calc_sum(a) + calc_sum(b) < min) min = calc_sum(a) + calc_sum(b);
    }
    cout << min << endl;

    return 0;
}







Measured memory_bytes: 256
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]
BC = sorted(BC,key = lambda x:x[1],reverse=True)


heapq.heapify(A)
for i in range(M):
    for j in range(BC[i][0]):
        tmp = heapq.heappop(A)
        if tmp >= BC[i][1]:
            heapq.heappush(A,tmp)
            break
        heapq.heappush(A,BC[i][1])
print(sum(A))

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

string s;
int cnt = 0;

int main() {
  cin >> s;
  for(int i = 1; i < s.size(); ++i)
    if(s[i] != s[i - 1]) ++cnt;
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD 998244353
typedef long long int lli;

int main(){
    int n;
    cin >> n;
    for(int x = 1; x * 108 / 100 <= n; ++x){
        // cout << x << endl;
        if(x * 108 / 100 == n){
            cout << x << endl;
            return 0;
        }
    }
    cout << ":(\n";
    return 0;
}

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

using namespace std;


int main()
{
        int n;
        cin>>n;
        
        vector<ll>piles(n);
        for(int i=0;i<n;i++) cin>>piles[i];
        if(n==1) {cout<<piles[0]; return 0;}
        vector<vector<ll> >dp(n,vector<ll>(n));
        
        for(int len=2;len<=n;len++)
        {
            for(int i=0;i<n;i++)
            {
                int j=i+len-1;
                if(j>=n) continue;
                if(len==2)
                    dp[i][j]=abs(piles[i]-piles[j]);
                else
                {
                    dp[i][j]=max(piles[j]-dp[i][j-1],piles[i]-dp[i+1][j]);
                }
                
            }
        }
        cout<< dp[0][n-1];
        
        return 0;
}

Measured memory_bytes: 70656
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int x;
int main(){
    //freopen("data.in","r",stdin);
    cin>>x;
    int ans=0;
    ans+=(x/500)*1000;
    x%=500;
    ans+=(x/5)*5;
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
const int mx=2e6+5;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	double r;cin >> r;
	cout << M_PI*2*r << endl;

}
	


Measured memory_bytes: 3792
#include<stdio.h>
int main()
{
  int n,i,k,j,st,ex=0,ss=1;;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    int minj=i;
    for(j=i;j<n;j++){      
      if(a[j]<a[minj]){
	minj=j;
	if(ss==1){
	  ex++;
	  ss=0;
	}
      }
    }
      ss=1;
      st=a[minj];
      a[minj]=a[i];
      a[i]=st;
  }
    for(i=0;i<n;i++){
      printf("%d",a[i]);
      if(i!=n-1)printf(" ");
    }
    printf("\n");
    printf("%d\n",ex);
  return 0;
}


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

#define pb push_back
#define ll long long int
#define mpi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define si set<int>
#define pii pair<int, int>
#define vpi vector<pii>
#define vs vector<string>
#define pri priority_queue<int>
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define For(i, n) for (int i = 0; i < n; i++)
#define Ford(i, a, b) for (int i = a; i >= b; i--)
#define Rep(i, x, y) for (int i = x; i <= y; i++)
#define mem(a, b) memset(a, b, sizeof(a))
#define fastio                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

double tick()
{
    static clock_t oldt, newt = clock();
    double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
    oldt = newt;
    return diff;
}

ll fastExpo(ll a, ll n)
{
    ll res = 1;
    while (n)
    {
        if (n % 2)
            res = res * a;
        n /= 2;
        a = a * a;
    }
    return res;
}

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

int main()
{
    vi v;
    int a;
    For(i, 5)
    {
        cin >> a;
        v.pb(a);
    }
    For(i, 5) if (!v[i]) cout << i + 1 << endl;
    cerr << "execution time is: " << tick() << "\n";
}


Measured memory_bytes: 3832
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var s = cin.ReadLine;
            int count = 0;
            int ans = 0;

            for(int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
                {
                    count++;
                }else
                {
                    if (count > ans) ans = count;
                    count = 0;
                }
            }

            if (count > ans) ans = count;

            WriteLine(ans);

            

        }

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

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
ll n,a[20][20],dp[1<<17];
int main(){
	n=read();
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			a[i][j]=read();
	for(int k=0;k<1<<n;k++)
		for(int i=0;i<n;i++)
			for(int j=i+1;j<n;j++)
				if(k>>i&1 and k>>j&1)
					dp[k]+=a[i][j];
	for(int i=0;i<1<<n;i++)
		for(int j=i;j;j=(j-1)&i)
			dp[i]=max(dp[i],dp[j]+dp[i^j]);
	cout << dp[(1<<n)-1];
	return 0;
}

Measured memory_bytes: 768
package main

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

var sc = bufio.NewScanner(os.Stdin)

func stringLineScan() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)
	s := stringLineScan()
	q, _ := strconv.Atoi(stringLineScan())
	r := true
	x := make([]string, 0)
	y := make([]string, 0)
	for i := 0; i < q; i++ {
		n, _ := strconv.Atoi(stringLineScan())
		if n == 1 {
			if r {
				r = false
			} else {
				r = true
			}
		} else {
			f, _ := strconv.Atoi(stringLineScan())
			c := stringLineScan()
			if f == 1 && r {
				x = append(x, c)
			} else if f == 1 {
				y = append(y, c)
			} else if r {
				y = append(y, c)
			} else {
				x = append(x, c)
			}
		}
	}
	w := reverse(strings.Join(x, ""))
	z := strings.Join(y, "")
	s = w + s + z
	if !r {
		s = reverse(s)
	}
	fmt.Println(s)
}
func reverse(s string) string {
	rs := []rune(s)
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		rs[i], rs[j] = rs[j], rs[i]
	}
	return string(rs)
}


Measured memory_bytes: 16640
#include <iostream>
#include <stdlib.h>
#include <stack>
using namespace std;

int main()
{
	stack<long> a;
	char s[10];
	long t;

	while (cin >> s) {
		if (s[0] == '+') {
			t = a.top();
			a.pop();
			a.top() += t;
		}
		else if (s[0] == '-') {
			t = a.top();
			a.pop();
			a.top() -= t;
		}
		else if (s[0] == '*') {
			t = a.top();
			a.pop();
			a.top() *= t;
		}
		else
			a.push(atol(s));
	}

	cout << a.top() << endl;

	return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
struct UnionFind{
  vector<int>par;
  vector<int>rank;
  UnionFind(int n):par(n),rank(n){
    for(int i=0;i<n;i++){
      par[i]=i;
      rank[i]=0;
    }
  }
  int root(int x){
    return par[x]==x?x:par[x]=root(par[x]);
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  void unit(int x,int y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(rank[x]<rank[y]){
      par[x]=y;
    }else{
      par[y]=x;
      if(rank[x]==rank[y]){
        rank[x]++;
      }
    }
  }
};
int main(){
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>> edge(m);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--,b--;
    edge[i].first=a;
    edge[i].second=b;
  }

  int cnt=0;
  int u1,u2,v1,v2;
  for(int i=0;i<m;i++){
     u1=edge[i].first;
     v1=edge[i].second;
    UnionFind uf(n);
    for(int j=0;j<m;j++){
      if(i!=j){
         u2=edge[j].first;
         v2=edge[j].second;
        uf.unit(u2,v2);
      }
    }
    if(!(uf.same(u1,v1)))cnt++;
  }
  cout<<cnt<<endl;
}

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

static const int NMAX = 100;
static const int AMAX = 1000;

int main (void) {

    int N;
    int A[NMAX];

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

    for (int i=0; i < N; i++) {
        int v = A[i];
        int j = i - 1;
        while ((j >=0) && (A[j] > v)) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        for (int k=0; k < N-1; k++) cout << A[k] << " ";
        cout << A[N-1] << endl;
    }
}


Measured memory_bytes: 3076
use std::io::*;
use std::str::FromStr;

pub enum SortOrder {
    Ascending,   // 昇順
    Descending,  // 降順
}

// 成功時はOK(())を、失敗時はErr(文字列)を返す
pub fn sort<T: Ord>(x: &mut [T], order: &SortOrder){
    if x.len().is_power_of_two() {
        match *order {
            SortOrder::Ascending  => do_sort(x, true),
            SortOrder::Descending => do_sort(x, false),
        };

    }
}

fn do_sort<T: Ord>(x: &mut [T], up: bool) {
    if x.len() > 1 {
        let mid_point = x.len() / 2;
        do_sort(&mut x[..mid_point], true);
        do_sort(&mut x[mid_point..], false);
        sub_sort(x, up);
    }
}

fn sub_sort<T: Ord>(x: &mut [T], up: bool) {
    if x.len() > 1 {
        compare_and_swap(x, up);
        let mid_point = x.len() / 2;
        sub_sort(&mut x[..mid_point], up);
        sub_sort(&mut x[mid_point..], up);
    }
}

fn compare_and_swap<T: Ord>(x: &mut [T], up: bool) {
    let mid_point = x.len() / 2;
    for i in 0..mid_point {
        if (x[i] > x[mid_point + i]) == up {
            x.swap(i, mid_point + i);
        }
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut s: Vec<String> = (0..n).map(|_| read()).collect();
    let mut now = "".to_string();
    let mut ans: Vec<String> = Vec::new();
    let mut count: u32 = 0;
    let mut max_count: u32 = 0;
    

    s.sort();
    for i in s.iter() {
        if *i == now {
            count += 1;
        }else{
            if count == max_count{
                ans.push(now);
            }else if count > max_count{
                max_count = count;
                ans.clear();
                ans.push(now);
            }
            now = i.to_string();
            count = 1;
        }
    }
    if count == max_count{
        ans.push(now);
    }else if count > max_count{
        ans.clear();
        ans.push(now);
    }
    for i in ans.iter() {
        println!("{}", i);
    }
}


Measured memory_bytes: 22392
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod= 1e9+7;

int main(){
  string S;
  cin>>S;
  for (int i(0);i<S.size();i++) if(i%2==0) cout << S[i];
  cout << endl;
  return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////


ll N;
pair<pll,ll> LR[101010],RL[101010];
deque<pll> mdq;
ll A[505050];
ll i, j, k,ans;

ll calc1(ll a){
    ll lri = N - 1, rli = 0;
    if(N-1==a)
        lri--;
    while(RL[rli].second==LR[a].second)
        rli++;
    pll lr = LR[lri].first;
    pll rl = RL[rli].first;
    pll lra = LR[a].first;
    return lra.second - lra.first+1
     + (lr.first <= rl.first ? rl.first-lr.first +1:0);
}

int main(){
    scanf("%lld",&N);
    fornum(i,0,N){
        ll a, b;
        scanf("%lld%lld", &a, &b);
        LR[i] = {{a, b},i};
        RL[i] = {{b, a},i};
    }
    if(N==2){
        printf("%lld", LR[0].first.second - LR[0].first.first + 1 + LR[1].first.second - LR[1].first.first + 1);
        return 0;
    }
    sort(RL, RL + N);
    sort(LR, LR + N);
    ans = 0;
    fornum(i,0,N){
        ans = max(ans, calc1(i));
        //printf("%lld,%lld\n", i, ans);
    }
    
    fornum (i,0,N)
    {
        pll lr=LR[i].first;
        while(mdq.size()&&mdq.back().first>=lr.second){
            mdq.pop_back();
        }
        mdq.push_back({lr.second,i});
    }
    k = 1e15;
    fornum(i,0,N-1){
        
        pll lr=LR[i].first;
        k = min(k,lr.second);
        if(mdq.front().second==i){
            mdq.pop_front();
        }
        ll k2 = mdq.front().first;
        pll llr = LR[N - 1].first;
        ll a = (k >= lr.first ? k - lr.first + 1 : 0) + (k2 >= llr.first ? k2 - llr.first + 1 : 0);
        ans = max(ans, a);
        //printf("%lld,%lld %lld %lld\n", i, ans,k,k2);
    }
    
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 8576
#include <iostream>
#include <string.h>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
int main()
{
	int n,a[100000],b[100000]={0},i;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	b[1]=abs(a[1]-a[0]);
	for(i=2;i<n;i++)
		b[i]=min(b[i-1]+abs(a[i]-a[i-1]),b[i-2]+abs(a[i]-a[i-2]));
	cout<<b[n-1]<<endl;
		
	
}


Measured memory_bytes: 1024
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// #define ll long long 
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=2*1e5+2;

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

	int a,b,k;
	cin>>a>>b>>k;
	if(a>k)
	{
		cout<<a-k<<" "<<b;
	}
	else{
		// cout<<"*";
		k-=a;
		a=0;
		int o=min(b,k);
		b-=o;
		cout<<a<<" "<<b;
	}
}  
// I never lose. I either win or I learn

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


///////////////////////////////////////////////////

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

    vi L(N);
    for (int i = 0; i < N; i++)
        io >> L[i];

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            for (int k = j + 1; k < N; k++)
            {
                if (L[i] != L[j] && 
                    L[j] != L[k] && 
                    L[i] != L[k] &&
                    L[i] + L[j] > L[k] &&
                    L[j] + L[k] > L[i] &&
                    L[i] + L[k] > L[j])
                    ans++;
            }
        }
    }
    
    io << ans << BR;
}

Measured memory_bytes: 3792
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    A=list(map(int,input().split()))
    even=[False]*3
    for i in range(3):
        if A[i]%2==0:
            even[i]=True
    cnt=0
    if even.count(True)==2:
        for i in range(3):
            if A[i] % 2 == 0:
                A[i]+=1
        cnt+=1
    elif even.count(True)==1:
        for i in range(3):
            if A[i] % 2 == 1:
                A[i]+=1
        cnt+=1
    ma=max(A)
    for i in range(3):
        cnt+=(ma-A[i])// 2

    print(cnt)
#
resolve()

Measured memory_bytes: 38740
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = a * b;
    
    if(c % 2 == 0){
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
  }
}

Measured memory_bytes: 35356
fn main(){
 let s=r();
 let s=s.trim();
 let s=s.to_string()+&s;
 let x=r();
 let x=x.trim();
 println!("{}",if s.find(&x).is_some(){"Yes"}else{"No"})
}
fn r()->String{
 let mut b=String::new();
 std::io::stdin().read_line(&mut b).ok();
 b
}


Measured memory_bytes: 5036
# Try AtCoder
# author: Leonardone @ NEETSDKASU

A, B = gets.strip.split.map &:to_i
S = gets.chomp

if S.size != A + B + 1 || S[A] != '-'
	puts 'No'
  	exit
end

if S =~ /^\d+-\d+$/
	puts 'Yes'
else
	puts 'No'
end
  



Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a) memset(a,0,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main()
{
    string s,t;
    cin>>s>>t;
    if(s==t.substr(0,s.size()))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

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

namespace Algorithm
{
    class Program
    {
        static int N = 0;
        static int[] A;

        static void Main(string[] args)
        {
            N = int.Parse(Console.ReadLine());
            A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(Math.Min(Calc(0), Calc(1)));
        }

        static long Calc(int flag)
        {
            var acum = 0;
            var ope = 0L;

            for (var i = 0; i < N; i++)
            {
                var diff = acum + A[i];
                if (i % 2 == flag)
                {
                    if (diff <= 0)
                    {
                        ope += -diff + 1;
                        acum = 1;
                    }
                    else acum += A[i];
                }
                else
                {
                    if (diff >= 0)
                    {
                        ope += diff + 1;
                        acum = -1;
                    }
                    else acum += A[i];
                }
            }

            return ope;
        }
    }
}


Measured memory_bytes: 25948
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define mp  make_pair
ll arr[6];
ll li(ll N,ll t){
	if(N%t==0)
		return N/t;
	else
		return N/t+1;
}
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ll N;
	cin>>N;
	for(ll i=0;i<5;++i){
		ll t;
		cin>>t;
		arr[i]=li(N,t);
	}
	for(ll i=1;i<5;++i){
		arr[i]=max(arr[i-1],arr[i]);
	}
	cout<<arr[4]+4<<endl;
}

Measured memory_bytes: 256
using System.Text;
using System.Linq;
using System;
using System.IO;

class Program
{
  static void Main(string[] args)
  {
    var buf = new StringBuilder();
    for (int i = 0; i < 3; i++)
    {
      buf.Append(Console.ReadLine()[i]);
    }
    Console.WriteLine(buf);
  }
}

Measured memory_bytes: 11092
<?php
    $data = fgets(STDIN);
    if(strpos($data, '5') === false || strpos($data, '7') === false) {
        echo "NO";
        return;
    }
    
    $data = count_chars($data, 1);
    
    if($data['53'] == 2 && $data['55'] == 1)
        echo "YES";
    else
        echo "NO";
?>

Measured memory_bytes: 16244
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>
#include <queue>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

class Map
{
    public:
    Map(int H, int W){
        height = H;
        width  = W;
        data.resize(H);
        for(int i = 0; i < H; i++) data[i].resize(W);
    }

    bool isIn(int h, int w){
        if(h < 0 || h >= height) return false;
        if(w < 0 || w >= width)  return false;
        return true;
    }

    ll get(int h, int w){
        if( isIn(h, w) ) return data[h][w];
        else return -1; 
    }

    void set(int h, int w, ll val){
        if( isIn(h, w) ){
            data[h][w] = val;
        }
    }

    vector < vector<ll> > data;
    int height;
    int width;

};


class Point
{
    public:
    Point(int px, int py, int pdepth){
        x = px;
        y = py;
        depth = pdepth;
    }
    int x;
    int y;
    int depth;
};


int main(){

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

    int H, W;
    cin >> H >> W;

    Map m(H, W);
    int cnt = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            //cout << i << j << endl;
            char c;
            cin >> c;
            if(c == '#'){
                m.set(i, j, -1);
                cnt ++;
            } 
        }
    }

    queue <Point> points;
    points.push (Point(0,0,1));

    while(!points.empty() ) {
        Point p = points.front();
        points.pop();
        for(int i = 0; i < 4; i++){
            int nx = p.x + dx[i];
            int ny = p.y + dy[i];
            int ndepth = p.depth + 1;
            if( m.isIn(nx, ny) ){
                if(m.get(nx, ny) == 0 ){
                    points.push( Point (nx, ny, ndepth) );
                    m.set(nx, ny, ndepth);
                }
                if(nx == H - 1 && ny == W - 1){
                    cout << H * W - ndepth - cnt << endl;
                    return 0;
                }
            }
        }
    }

    cout << -1 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

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

const int oo = 1e9 + 7;
const int mod = 1e9 + 7, maxn = 100100;
const long double PI = acos(-1);

ll count_digits(ll n){
    int ans = 0;
    while (n) n/=10, ans++;
    return ans;
}

int main (){
    int nb, ns, ans = 0, aux, k, cnt;
    bool on;
    bitset<11> b;
    cin >> ns >> nb;

    vector<int> v[11];
    vector<int> resto(nb);

    for (int i=0; i<nb; i++){
        cin >> k;
        for (int j=0; j<k; j++){
            cin >>aux;
            v[i].push_back(--aux);
        }
    }
    for (auto&x : resto) cin >> x;

    for (int i=0; i<(1 << ns); i++){
        b = i;
        on = true;
        for (int j=0; j<nb; j++){
            
            cnt = 0;
            for (auto x : v[j]) cnt += b[x];

            if (cnt % 2 != resto[j]){
                on = false;
                break;
            }
        }
        if (on) ans++;
    }

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

Measured memory_bytes: 256
using System;

class Program
{
    static void Main()
    {
        string[] i = Console.ReadLine().Split(' ');
        int w = int.Parse(i[0]);
        int h = int.Parse(i[1]);
        int x = int.Parse(i[2]);
        int y = int.Parse(i[3]);
        int r = int.Parse(i[4]);
        
        if (x + r > w | y + r > h | x - r < 0 | y - r < 0)
        {
            Console.WriteLine("No");
        }
        else
        {
            Console.WriteLine("Yes");
        }
    }
}


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

int main() {

    int N;
    cin >> N;
    vector<int> sticks(N);
    // ある数字以下の数の合計を保存する
    vector<int> sums = vector<int>(1010);
    for (int i=0;i<N;i++){
        cin >> sticks.at(i);
        sums.at(sticks.at(i)) += 1;
    }
    for (int i=0;i<1010-1;i++){
        sums.at(i+1) += sums.at(i);
    }
    sort(sticks.begin(), sticks.end());

//    for (int i=0;i<N;i++){
//        cout << sticks.at(i) << " ";
//    }
//    cout << endl;
//    for (int i=0;i<1000;i++){
//        cout << sums.at(i);
//    }
//    cout << endl;


    // 小さいほうから2つずつ選択して，かうんとする
    int count = 0;
    int i_length;
    for (int i=0;i<N-2;i++){
        i_length = sticks.at(i);
//        cout << "i" << i << endl;
        for (int j=i+1;j<N-1;j++){
//            cout << "j" << j << endl;
//            cout << i_length << " " << sticks.at(j) << " ";
            if(i_length + sticks.at(j) > 1010-3){
                count += N - (1 + j);
            }else{
                count += sums.at(i_length + sticks.at(j)-1) - (1 + j);
//                cout << count << endl;
            }
//            cout << sums.at(i_length + sticks.at(j)-1); //<< sums.at(i_length + sticks.at(j)-1) - (1 + j) << endl;

        }
    }
    cout << count;
}

Measured memory_bytes: 256
def solve(X, Y, Z, V, E, A):
    dp = [[0.0] * 6001 for _ in range(Y + 11)]
    dp[0][0] = 1.0
    for i in range(Y):
        for j in range(5001):
            if dp[i][j] <= 0.0:
                continue
            for k in V:
                t = i + k
                if t > Y:
                    dp[Y][j] += dp[i][j]/X
                elif E[t] == 1:
                    dp[min(Y, t+A[t])][j] += dp[i][j]/X
                else:
                    dp[t][max(0, j+A[t])] += dp[i][j]/X

    s = 0
    for i in range(5001):
        s += i * dp[Y][i]
    print(int(s))

if __name__ == "__main__":
    import sys

    while True:
        X, Y, Z = map(int, input().split())
        if X | Y | Z == 0:
            sys.exit()
        V = list(map(int, input().split()))
        E = [0] * 100
        A = [0] * 100
        for _ in range(Z):
            n, e, a = map(int, input().split())
            E[n] = e
            if e == 3:
                A[n] = -a
            else:
                A[n] = a
        solve(X, Y, Z, V, E, A)

Measured memory_bytes: 10944
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
	"unicode"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func solve(s string) bool {
	b := []byte(s)
	if b[0] != 'A' {
		return false
	}
	if unicode.IsUpper(rune(b[1])) {
		return false
	}
	s = string(b[2:])
	i := strings.Index(s, "C")
	if i == -1 {
		return false
	}
	if i == len(s)-1 {
		return false
	}
	s = s[:i] + s[i+1:]
	for _, r := range s {
		if unicode.IsUpper(r) {
			return false
		}
	}
	return true
}

func main() {
	defer stdout.Flush()
	s := readString()

	if solve(s) {
		println("AC")
	} else {
		println("WA")
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef long long ll;
typedef std::pair<ll,ll> P;

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

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

constexpr ll mod = 1e9 + 7;

struct UnionFind {
public:
	vector <ll> par; // 
	vector <ll> siz; // 

	UnionFind() {}

	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}

	ll root(ll x) {
		while (par[x] != x) {
			x = par[x] = par[par[x]];
		}
		return x;
	}

	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool issame(ll x, ll y) {
		return root(x) == root(y);
	}

	ll size(ll x) {
		return siz[root(x)];
	}
};

int main() {
	ll n;
	cin >> n;
	vector<int> ans;
	for (int i = 0; i < 60; i++) {
		ll m = n % (1LL << (i+1));
		if (m) {
			ans.push_back(1);
			ll sub = 1LL << i;
			if (i % 2 == 1) {
				sub *= -1;
			}
			n -= sub;
		}
		else ans.push_back(0);
		if (n == 0) break;
	}
	reverse(ans.begin(), ans.end());
	for (auto a : ans) {
		cout << a;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();

        System.out.printf("%d %d %.5f", a/b, a%b, (double)a/b);
        System.exit(0);
    }
}



Measured memory_bytes: 26624
def search(ps, id):
    if ps[id] == -1:
        return 0
    else:
        return 1 + search(ps, ps[id])


def search_part2(tree, id):
    if tree[id][0] == -1:
        left = -1
    else:
        left = search_part2(tree, tree[id][0])

    if tree[id][1] == -1:
        right = -1
    else:
        right = search_part2(tree, tree[id][1])

    return 1 + max(left, right)


n = int(input())
tree = [[] for _ in range(n)]
ps = [-1 for _ in range(n)]
ss = [-1 for _ in range(n)]

for _ in range(n):
    s = input().split()
    id = int(s[0])
    left = int(s[1])
    right = int(s[2])
    tree[id] = [left, right]
    if left >= 0:
        ps[left] = id
        ss[left] = right
    if right >= 0:
        ps[right] = id
        ss[right] = left

for id in range(n):
    p = ps[id]
    s = ss[id]
    deg = int(tree[id][0] >= 0) + int(tree[id][1] >= 0)
    d = search(ps, id)
    h = search_part2(tree, id)

    if p == -1:
        type = "root"
    elif tree[id][0] == -1 and tree[id][1] == -1:
        type = "leaf"
    else:
        type = "internal node"

    print("node " + str(id) + ": parent = " + str(p) + ", sibling = " + str(s) + ", degree = " + str(
        deg) + ", depth = " + str(d) + ", height = " + str(h) + ", " + type)



Measured memory_bytes: 5612
import java.util.*;

public class Main {
	static int count=0;
	
	static boolean check(long k) {
		String s=String.valueOf(k);
		int len=s.length();
		boolean three=false,five=false,seven=false;
		for(int i=0;i<len;++i) {
			if (s.charAt(i)=='3') {
				three=true;
			}else if(s.charAt(i)=='5') {
				five=true;
			}else if (s.charAt(i)=='7') {
				seven=true;
			}
			
		}
		if (three&&five&&seven) {
			return true;
		}else {
			return false;
		}
	}
	
	static void dfs(long k,int n) {				
		if (k<=n) {
			if (check(k))++count;
			dfs(k*10+3,n);
			dfs(k*10+5,n);
			dfs(k*10+7,n);
		}
		
		
		
	}
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		dfs(0,n);
		System.out.print(count);

	}
}
//end


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

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = in.nextInt(), loop = in.nextInt();

		ArrayList<ArrayList<Integer>> vector2 = new ArrayList<ArrayList<Integer>>();
		for(int i = 0; i < n; i++) {
			ArrayList<Integer> arr = new ArrayList<>();
			vector2.add(arr);
		}

		for(int i = 0; i < loop; i++) {
			int odr = Integer.parseInt(in.next()), index = Integer.parseInt(in.next());

			switch(odr) {
				case 0:
					vector2.get(index).add(Integer.parseInt(in.next()));
					break;

				case 1:
					int length = vector2.get(index).size();
					for(int j = 0; j < length; j++) {
						out.printf("%d%s", vector2.get(index).get(j), (j < length - 1) ? " " : "");
					}
					out.println();
					break;

				case 2:
					vector2.get(index).clear();
					break;
			}
		}
		out.flush();
		in.close();
	}

}



Measured memory_bytes: 312844
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double c = sc.nextDouble();
        double cr = c*Math.PI/180;

        System.out.println(0.5*a*b*Math.sin(cr));
        System.out.println(a+b+Math.sqrt(a*a+b*b-2*a*b*Math.cos(cr)));
        System.out.println(b*Math.sin(cr));
    }
}


Measured memory_bytes: 28132
#include <stdio.h>

#define WHITE 1
#define BLACK 0
#define GRAY -1
#define N 250

void dfs(void);
void visit(int);

int d[N];
int f[N];
int color[N];
int str[N][N];
int count = 0;
int n;

int main(){

 int i;
 int j;
 int k;
 int num;
 int point;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
  scanf("%d%d",&num,&k);
  for(j=1;j<=k;j++){
  scanf("%d",&point);
  str[i][point] = 1;
    }
   }

   dfs();
  
  for(i=1;i<=n;i++){
  printf("%d %d %d\n",i,d[i],f[i]);
   }   

  return 0;
}

void dfs(void){

  int u;
  
  for(u=1;u<=n;u++){
    color[u] = WHITE;
  }

  for(u=1;u<=n;u++){
    if(color[u]==WHITE){
      visit(u);
    }
  }
}

void visit(int u){

  int v;

  color[u] = GRAY;
  d[u] = ++count;

  for(v=1;v<=n;v++){
    if(color[v]==WHITE && str[u][v]==1){
      visit(v);
    }
  }

  color[u] = BLACK;
  f[u] = ++count;

}
  

Measured memory_bytes: 696
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int A,B,C;
    cin >> A >> B >> C;
    vector<vector<int>>cnt(3,vector<int>(3));
    cnt[0][0] = A;
    cnt[0][1] = B;
    cnt[1][1] = C;
    cnt[2][1] = A-C;
    cnt[2][2] = cnt[2][1]-(A-B);
    int res = cnt[0][2]+cnt[1][1]-cnt[2][2]-cnt[2][1];
    int retu = A+B+res;
    cout << A << " " << B << " " << res << endl;
    cnt[2][1]+=res;cnt[2][2]+=res;
    cnt[1][2] = retu-res-cnt[2][2];
    cnt[2][0] = retu-cnt[2][1]-cnt[2][2];
    cnt[1][0] = retu-A-cnt[2][0];
    cout << cnt[1][0] << " " << cnt[1][1] << " " << cnt[1][2] << endl;
    cout << cnt[2][0] << " " << cnt[2][1] << " " << cnt[2][2] << endl;
}


Measured memory_bytes: 3628