akhauriyash/Code-Regression huggingface dataset:
import sys
from decimal import *

def main():

	smx=10**18
	mx=10**9

	input = sys.stdin.readline
	s = int(input())

	x1=int(Decimal(s).sqrt())
	y1=0;x2=0;y2=0
	if s==x1*x1:
		y1=0;x2=0;y2=x1;
	elif (s%2==0 and x1%2==0):
		y1=2;x2=int((x1*(x1+2)-s)/2);y2=x1+2
	elif (s%2==0 and x1%2==1) or (s%2==1 and x1%2==0):
		x1=x1+1;y1=2;x2=int((x1**2-s)/2);y2=x1
	elif s%2==1 and x1%2==1:
		if x1<mx-1:
			y1=2;x2=int((x1*(x1+2)-s)/2);y2=x1+2
		else:
			a=(x1+1)*(x1+1)-s
			if a<=x1+1:
				x1=x1+1;y1=1;x2=a;y2=x1
			else:
				y1=1;x2=x1*(x1+1)-s;y2=x1+1
	print(0,0,x1,y1,x2,y2)
main()


Measured memory_bytes: 5204
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<cstdio>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int main() {
	int N, W;
	int v[110], w[110];
	ll dp[110][100010] = {};
	cin >> N >> W;
	for (int i = 0; i < N; ++i) {
		cin >> w[i] >> v[i];
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j <= W; ++j) {
			if (j >= w[i])dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
			else dp[i + 1][j] = dp[i][j];
		}
	}
	cout << dp[N][W] << endl;
	return 0;
}

Measured memory_bytes: 86144
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sumA, sumB;
		sumA = sumB = 0;
		for(int i = 0; i < 4; i++){
			sumA += sc.nextInt();
		}
		
		for(int i = 0; i < 4; i++){
			sumB += sc.nextInt();
		}
		System.out.println(Math.max(sumA, sumB));
	
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
int dis(int a,int b)
{
	return a+b;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int t,x,y,d;
		scanf("%d %d %d",&t,&x,&y);
		d=dis(x,y);
		if((t<d)||(t&1)!=(d&1))
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll A, B, C, K;
	cin >> A >> B >> C >> K;
	ll S = 0;
	if (A >= K) {
		cout << K << endl;
	} else {
		S += A;
		K -= A;
		if (B >= K) {
			cout << S << endl;
		} else {
			K -= B;
			if (C >= K) {
				S -= K;
				cout << S << endl;
			} else {
				S -= K;
				cout << S << endl;
			}
		}
	}
}



Measured memory_bytes: 3656
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	long long int x,a,b;
	cin >> x;
	a = x / 500; x = x % 500;
	b = x / 5;
	cout << a * 1000 + b * 5 << endl;
	return 0;
}


Measured memory_bytes: 384
local s = io.read()
-- s = "ABCABC"
-- s = "ABCACCBABCBCAABCB"
-- s = "A"
local c = {}
for i = 1, #s do
	c[i] = string.sub(s, i, i)
end
-- print_r(c)

local num = 0
local i = 1
local lastA = 0
while i <= #c - 2 do
	if c[i] == "A" then
		local an = lastA + 1
		local x = i
		for j = i + 1, #c - 2 do
			if c[j] ~= "A" then
				break
			end
			an = an + 1
			x = j
		end
		local bcn = 0
		local k = x + 1
		while k < #c do
			if c[k] == "B" and c[k+1] == "C" then
				bcn = bcn + 1
				k = k + 2
			else
				break
			end
		end
		-- print(222, i, x, k, an, bcn, c[i], c[i+1], c[i+2])
		num = num + an * bcn
		if bcn >= 1 then
			i = k - 1
			c[i] = "A"
			lastA = an - 1
		else
			i = k
			lastA = 0
		end
		-- print_r(c)
		-- print(i)
	else
		i = i + 1
		lastA = 0
	end
end
print(num)

Measured memory_bytes: 6724
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
count = Counter(A)
A = sorted(list(set(A)),reverse = True)
a,b = 0,0
for i in A:
    if a == 0:
        if count[i] >= 4:
            a,b = i,i
            break
        elif count[i] >= 2:
            a = i
    else:
        if count[i] >= 2:
            b = i
            break
print(a*b)

Measured memory_bytes: 20772
N = int(input())
A = list(map(int,input().split()))
P = [2**i for i in range(len(A))]
import sys
sys.setrecursionlimit(10**9)
# A = A[::-1]
# P = P[::-1]

# ans = 0
# node = 0
# for i in range(len(A)-1):
#     node = node + A[i]
#     node = min(node,2 * (P[i+1] - A[i+1]))
#     ans += node
#     if node <= 0:
#         print (-1)
#         exit()
#     print (node)
    
# ans += 1
# print (ans)

if N==0 and A[0]==1:
    print(1)
    exit()
if A[0] > 0:
    print(-1)
    exit()
# if A[-1] > 2**N:
#     print (-1)
#     exit()

# for a,p in zip(A[::-1],P[::-1]):
#     if a > p:
#         print (-1)
#         exit()

ans = [0]
node = [0]
def rec(i):
    if i==0:
        ans[0]+=1
        return 1
    node[0] = node[0] + A[i]
    node[0] = min(node[0], 2*rec(i-1))
    ans[0] += node[0]
    #print (node[0],node[0]-A[i])

    if (i!=N and node[0] - A[i] <= 0) or (node[0] - A[i] < 0):
        print(-1)
        exit()
    return node[0] - A[i]
rec(N)
print (ans[0])

Measured memory_bytes: 800544
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<string>

using namespace std;

string sed(string &s,const string &a,const string &b)
{
	string ret;
	for(unsigned int i = 0; i < s.length(); ++i){
		if( i == s.find(a,i) ){
			ret += b;
			i += a.length() - 1;
		}else{
			ret += s[i];
		}
	}
	return ret;
}

bool operator==(const string &a, const string &b){
	return a.compare(b) == 0;
}
bool operator<(const string &a, const string &b){
	return a.compare(b) < 0;
}

int BFS(string &g, string &d, vector< pair<string, string> > &vrep){
	map< string, int > inqueue;
	queue< pair<string, int> > q;

	q.push( make_pair(g, 0) );
	inqueue.clear();
	inqueue[ g ] = 1;
	while( !q.empty() )
	{
		int sed_num = 0;
		pair<string, int> p = q.front();
		q.pop();
		inqueue[ p.first ] = 0;

		//cout << p.first << endl;
		if( p.first.compare(d) == 0 )
			return p.second;
		if( p.second >= 11 )
			return -1;

		for(unsigned int i = 0; i < vrep.size(); ++i){
			string tt = sed( p.first, vrep[i].first, vrep[i].second );
			if( inqueue[ tt ] == 1 )
				continue;
			else
				inqueue[ tt ] = 1;
			q.push( make_pair( tt, p.second + 1 ) );
		}
	}
	return -1;
}

int main()
{
	while( true ){
		int n;
		vector< pair<string, string> > v;
		string g, d;
		
		cin >> n;
		if( n == 0 )
			break;

		for(int i = 0; i < n; ++i){
			string a, b;
		
			cin >> a >> b;
			v.push_back( make_pair(a, b) );
		}

		cin >> g >> d;
		cout << BFS( g, d, v ) << '\n';
	}
}

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

int main()
{
	int N;
	unordered_map<int64_t, bool> m;

	cin >> N;
	for (int i = 0; i < N; ++i)
	{
		int64_t A;
		cin >> A;

		if (m.find(A) == m.end() || m[A] == false)
		{
			m[A] = true;
		}
		else
		{
			m[A] = false;
		}
	}

	int count = 0;
	for (auto e : m)
	{
		if (e.second)
		{
			++count;
		}
	}

	cout << count << endl;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
int N;
int fact[10];
bool used[10];
int check() {
	memset(used, 0, sizeof(used));
	int pos = 0;
	int arr[10];
	for (int i = 0; i < N; i++) cin >> arr[i];
	for (int i = 0; i < N; i++) {
		//i번째 위치
		int cnt = 0;
		for (int j = 1; j < arr[i]; j++) {
			if (used[j] == false) cnt++;
		}
		pos += cnt * fact[N - i - 1];
		used[arr[i]] = true;
	}
	return pos;
}
int main() {
	fact[0] = fact[1] = 1;
	for (int i = 2; i < 9; i++) {
		fact[i] = fact[i - 1] * i;
	}
	
	cin >> N;
	int a, b;
	a = check();
	b = check();
	cout << abs(a - b) << endl;
}

Measured memory_bytes: 256
import copy

N, K = map(int,input().split(' '))
V = list(map(int,input().split(' ')))

# 左からのリスト
Vl=[0]
Dl=[[]]
for l in range(N):
    tmpV = sum(V[0:l+1])
    Vl.append(tmpV)
    tmpD =[]
    for i in range(l+1):
        if V[i] <= 0:
            tmpD.append(V[i])
    Dl.append(tmpD)

#print(Vl)
#print(Dl)

# 右からのリスト
Vr=[0]
Dr=[[]]
for r in range(N-1,-1,-1):
    tmpV = sum(V[r:])
    Vr.append(tmpV)
    tmpD =[]
    for i in range(N-1,r-1,-1):
        if V[i] <= 0:
            tmpD.append(V[i])
    Dr.append(tmpD)

#print(Vr)
#print(Dr)

max=0
# ここで比べる
for l in range(N+1):
    for r in range(N+1):
        if l+r > N:
            continue
        for d in range(len(Dl[l])+len(Dr[r])+1 ):
            #print(l,r,d)
            if l + r +d > K:
                continue
            else:
                tmpD=copy.copy(Dl[l])
                tmpD.extend(Dr[r])
                tmpD.sort()
                
                tmpDsum=-1*sum(tmpD[0:d])
                
                if Vl[l]+Vr[r]+tmpDsum > max:
                    max = Vl[l]+Vr[r]+tmpDsum
                #print(l,r,d,max)
print(max)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

ll a[105];
bool dp[100005];

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n,k;
  cin>>n>>k;
  forn(i,0,n)
    cin>>a[i];
  forn(i,1,k+1){
    forn(j,0,n){
      if(i-a[j]>=0 && (!dp[i-a[j]]))
        dp[i]=true;
    }
  }
  if(dp[k])
    cout<<"First\n";
  else
    cout<<"Second\n";
  return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,k;
int main()
{
	scanf("%lld%lld",&n,&k);
	long long p=n/k;
	long long ans=p*p*p;
	if(k%2==0)
	{
		k/=2;
		p=n/k-p;
		ans+=p*p*p;
	}
	printf("%lld",ans);
}

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

typedef  long long ll;
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//
//
#define int long long

using namespace std;

int ctoi(char c) {
 switch (c) {
 case '0': return 0;
 case '1': return 1;
 case '2': return 2;
 case '3': return 3;
 case '4': return 4;
 case '5': return 5;
 case '6': return 6;
 case '7': return 7;
 case '8': return 8;
 case '9': return 9;
 default: return 0;
 }
}


 ll  a,b,c,i,j,k,x,y,z;
 ll A,B,C,X,Y,Z;
 ll count;
signed main(){
  cin>>x;
  ll po[x];
  z=0;
  REP(con,x) cin>>po[con];
  sort(po,po+x,greater<int>());
  REP(con,x){
  	if(con%2==0) z=z+po[con];
  	if(con%2==1) z=z-po[con];
    }
  cout<<z;

 return 0;
}


Measured memory_bytes: 3620
require 'pp'
n, m = gets.split.map(&:to_i)

nodes = Array.new(n){ {e: [], u: false} }

m.times do
  a, b = gets.split.map(&:to_i).map{|x|x-1}
  nodes[a][:e] << b
  nodes[b][:e] << a
end

routes = (0..(n-1)).to_a.permutation.to_a.select{|x| x[0] == 0}
cnt = 0
routes.each do |r|
  f = true
  r.each_cons(2) do |a,b|
    f = false if !nodes[a][:e].any?{|x|x==b}
  end
  cnt += 1 if f
end
p cnt


Measured memory_bytes: 7548
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main() {
	vector<double>l;
	double x, h;
	while (cin >> x >> h){
		if (x == 0 && h == 0)break;
		double a, b;
		a = x / 2 * sqrt(x*x/4 + h*h);
		b = x*x;
		l.push_back(a * 4 + b);
	}
	for (double i:l) {
		printf("%.6f\n",i);
	}
	char c;
	cin >> c;
}

Measured memory_bytes: 3244
#include <cstdio>
#include <set>
using namespace std;
#define lb lower_bound
int N,ans; multiset<int> s;
int main() {
    scanf("%d",&N);
    for (int i = 0,A;i < N;i++) {
        scanf("%d",&A); set<int>::iterator it = s.lb(A);
        if (it == s.begin()) ans++;
        else it--,s.erase(it);
        s.insert(A);
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 4992
function Main(s){
  s = s.split("\n");
  var a = s[1].split(" ").map(a=>+a);
  var n = +s[0];
  if(n === 1){console.log(1);return;}
  var b = Array(n).fill(1e6);
  b[0] = 1;
  for(var j = 0; j < 20; j++){
    var x = 1 << j;
    var f = 0, g = 0;
    if(a[0] & x)f = 1;
    for(var i = 1; i < n; i++){
      if(a[i] & x){
        b[i] = Math.min(b[i], i-f+1);
        g = f; f = i+1;
      }else b[i] = Math.min(b[i], i-g+1);
    }
  }
  console.log(b.reduce((a,b)=>a+b));
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));


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

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

            // 空白で分割してaとbを定義

            int a = scanner.nextInt();

            int b = scanner.nextInt();

            if (a < b) {
            	System.out.println("a < b");
            } else if (a > b) {
            	System.out.println("a > b");
            } else if (a ==b) {
            	System.out.println("a == b");
            }
	}
}


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

struct ten {
  int m, f, r;
};

int main() {
  vector<ten> s;

  while(1) {
    ten item;
    cin >> item.m >> item.f >> item.r;
    
    if(item.m == -1 && item.f == -1 && item.r == -1) break;
    s.push_back(item);
  }

  rep(i, s.size()) {
    ten item = s[i];
    string judge;

    int mf = item.m + item.f;

    if(item.m == -1 || item.f == -1 || mf < 30) judge = "F";
    else if(mf >= 80) judge = "A";
    else if(mf >= 65) judge = "B";
    else if(mf >= 50) judge = "C";
    else if(mf >= 30) {
      if(item.r >= 50) judge = "C";
      else judge = "D";
    }

    cout << judge << endl;
  }
  return 0;
}



Measured memory_bytes: 3220
module Main where

import Data.Maybe (fromJust)
import Data.List
import Control.Monad
import qualified Data.ByteString.Char8 as BS

import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

bytestr2Int = fst . fromJust . BS.readInt
getInt = bytestr2Int <$> BS.getLine
getIntL_H = map bytestr2Int. BS.words <$> BS.getLine
getIntL_V n = replicate n $ getInt
getInt2D n = replicate n $ getIntL_H

main :: IO ()
main = do
    _ <- getInt
    ns <- getLine
    print $ length . combine $ ns

combine [x] = [x]
combine (x:y:xs) = if x == y
                      then combine $ x:xs
                      else x:(combine (y:xs))



Measured memory_bytes: 4988
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

int a,b;
cin >> a >> b;
if(a == 1) a = 14;
if(b == 1) b = 14;

if(a > b) cout << "Alice" << endl;
else if(a < b) cout << "Bob" << endl;
else cout << "Draw" << endl;

return 0;
}

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

int main() {
  int N; int A;
  cin >> N >> A;
  while (N >= 500){
    N -= 500;
  }
   if (N <= A){
  cout << "Yes" << endl;
   }
   else{
  cout << "No" << endl;
   }
}

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int N, K;
    cin >> N >> K;

    bool used[N];
    FILL0(used);
    rep(i,  K)
    {
        int d;
        cin >> d;
        rep(j, d)
        {
            int a;
            cin >> a;
            a--;
            used[a]=true;
        }
    }
 
    int ans=0;
    rep(i, N)
    {
        if(!used[i])
        {
            ans++;
        }
    }
 
    cout << ans << endl;

 

    return 0;
}



Measured memory_bytes: 3644
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>
#include <limits>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i, n) for(int i = n - 1; i >= 0; i--)

using namespace std;
//エイリアス
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

//定数
const int intmax = numeric_limits<int>::max();
const ll llmax = numeric_limits<ll>::max();
const ll mod = 1e9 + 7;
const double pi = M_PI;

vl dc(ll n) {
  vl result;
  for(ll i = 2; i * i <= n; i++) {
    while( n % i == 0 ) {
      result.push_back(i);
      n = n / i;
    }
  }
  if(n > 1) {
    result.push_back(n);
  }
  return result;
}

ll calc(ll n) {
  ll start = 1;
  ll sum = 0;
  int count = 0;
  while(sum < n) {
    sum += start;
    if(sum > n) break;
    start++;
    count++;
  }
  return count;
}

int main()
{
  ll n;
  cin >> n;
  vl cand = dc(n);
  cand.push_back(0);
  int count = 1;
  int total = 0;
  for(int i = 0; i < cand.size() - 1; i++) {
    if(cand[i] == cand[i + 1]) {
      count++;
    }else{
      total += calc(count);
      count = 1;
    }
  }
  cout << total << endl;
}


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

int main(){
  int n,a;
  cin >> n >> a;
  int su=0,b; 
  for(int i=0;i<a;i++){
    cin >> b;
    su+=b;
  }
  cout << (n<su?-1:n-su) << endl;
  return 0;
}

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

class MainClass
{
    static void Main()
    {
        var AB = ReadLine().Split().Select(int.Parse).ToArray();
        int A = AB[0], B = AB[1];
        if ((A <= 8 && B <= 8))
        {
            WriteLine("Yay!");
        }
        else
        {
            WriteLine(":(");
        }
    }
}


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

int main(void)
{
  int a, b, c;
  double rad, s, l, h;
  scanf("%d %d %d", &a, &b, &c);
  
  rad = c * M_PI / 180.0; 
  s = 1 / 2.0 * a * b * sin(rad);
  l = a + b + sqrt(a * a + b * b - 2 * a * b * cos(rad));
  h = s * 2.0 / a;
  
  printf("%lf\n%lf\n%lf\n", s, l, h);
  return (0);
}

Measured memory_bytes: 2928
N = int(input())
Hs = list(map(int, input().split()))
 
prev = Hs[0]
flag = True
for i in range(1,len(Hs)):
    if Hs[i] <prev:
      flag = False
      break
    elif Hs[i] == prev:
      prev = Hs[i]
    else:
      prev = Hs[i]-1
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 15020
def gcd(x,y):
    while y:
        x,y = y,x%y
    return x

n,m = map(int,input().split())
nl = list(input())
ml = list(input())
lcm = n * m // gcd(n,m)
if gcd(n,m) == 1:
    if nl[0] == ml[0]:
        print(lcm)
    else:
        print(-1)
else:
    if nl[::n//gcd(n,m)] == ml[::m//gcd(n,m)]:
        print(lcm)
    else:
        print(-1)

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


def solve(n: int, m: int):
    ret = (n - 1) * (m - 1)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    m = int(next(tokens))  # type: int
    solve(n, m)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (ll (i) = (s); (i) < (e); ++(i))
#define per(i, s, e) for (ll (i) = (s); (i) >= (e); --(i))
#define all(x) x.begin(),x.end()
 
int main(void) {
    ll n; cin >> n;
    ll ans = 0;
    vector<vector<ll>> c(10, vector<ll>(10, 0));
    ll a, as, ae;
    string s, s_tmp;
    rep(i, 1, n+1) {
        s = to_string(i);
        // 先頭取得
        s_tmp = s[0];
        as = stoi(s_tmp);
        // 末尾取得
        s_tmp = s[s.size()-1];
        ae = stoi(s_tmp);
        c[as][ae]++;
    }

    rep(i, 0, 10) {
        rep(j, 0, 10) {
            ans += c[i][j] * c[j][i];
        }
    }
    cout << ans << endl;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

//! [iまでの中で][1つ前がj][2-k][3-l]=組み合わせ
ll dp[105][5][5][5];
char C[4] = {'A', 'C', 'G', 'T'};

//ll dp[105][5];

int main()
{
    ll N;
    cin >> N;
    memset(dp, 0, sizeof(dp));
    dp[0][0][0][0] = 1;
    REP(i, N)
    {
        REP(j, 4)
        {
            if (j == 1)
            {
                //! Cをおきたい
                REP(x, 4)
                {
                    REP(y, 4)
                    {
                        REP(z, 4)
                        {
                            if ((i > 1 && ((x == 2 && y == 0) || (x == 0 && y == 2))) || (i > 2 && ((x == 2 && z == 0) || (y == 2 && z == 0))))
                                continue;
                            dp[i + 1][j][x][y] += dp[i][x][y][z];
                            dp[i + 1][j][x][y] %= MOD;
                        }
                    }
                }
            }
            else if (j == 2)
            {
                REP(x, 4)
                {
                    REP(y, 4)
                    {
                        REP(z, 4)
                        {
                            if (i > 1 && x == 1 && y == 0)
                                continue;
                            dp[i + 1][j][x][y] += dp[i][x][y][z];
                            dp[i + 1][j][x][y] %= MOD;
                        }
                    }
                }
            }
            else
            {
                REP(x, 4)
                {
                    REP(y, 4)
                    {
                        REP(z, 4)
                        {
                            dp[i + 1][j][x][y] += dp[i][x][y][z];
                            dp[i + 1][j][x][y] %= MOD;
                        }
                    }
                }
            }
            ll s = 0;
            REP(x, 4)
            {

                REP(y, 4)
                {
                    s += dp[i + 1][j][x][y];
                }
            }
            //cout << i << ":" << C[j] << ":" << s << endl;
        }
    }
    ll sum = 0;
    REP(x, 4)
    {
        REP(y, 4)
        {
            REP(z, 4)
            {
                sum += dp[N][x][y][z];
                sum %= MOD;
            }
        }
    }
    cout << sum % MOD << endl;
    return 0;
}

Measured memory_bytes: 384
//code by parshuram_84
#include<bits/stdc++.h>
#define mod 1000000007
#define pii pair<int,int>
#define pll pair<long long,long long>
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define vp vector<pair<long long,long long>>
#define vpp vector<pair<pair<long long,long long>,long long>>
using namespace std;

int main() {
	int n,a,b,c,d,x=0,j,i;
	cin>>n;
	set<string> s;
	string p;
	for(j=0;j<n;j++)
	{
		cin>>p;
		s.insert(p);
	}
	cout<<s.size();
	return 0;
}

Measured memory_bytes: 19228
import math


def func():
    n = int(input())
    if n == 2:
        print(4)
        exit(0)
    if n == 1:
        print(4)
        exit(0)
    count = 0
    while n > 1:
        if n % 2 == 0:
            n /= 2
        else:
            n = (3 * n) + 1
        count += 1

    print(count + 2)


if __name__ == "__main__":
    func()


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main()
{
    int n, m, k; cin >> n >> m >> k;
    UnionFind uf(n);
    vector<int> bl[n];
    vector<int> fl(n,0);

    rep(i,m) {
        int a, b; cin >> a >> b; a--; b--;
        uf.unite(a, b);
        fl[a]++;
        fl[b]++;
    }

    rep(i,k) {
        int c, d; cin >> c >> d; c--; d--;
        bl[c].push_back(d);
        bl[d].push_back(c);
    }

    rep(i,n) {
        int ans = uf.size(i) - 1 - fl[i];
        for (int u : bl[i]) {
            if (uf.same(u, i)) ans--;
        }
        cout << ans << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 8992
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static long Mod = 998244353;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            (long N, long L) = Slice<long,long>();
            var Si = new String[N];
            for (var i = 0; i < N; ++i)
                Si[i] = ReadLine();
            Array.Sort(Si);
            WriteLine(String.Join("", Si));

        }
    }
}

Measured memory_bytes: 27436
#include <bits/stdc++.h>
//#include <boost/array.hpp>
//#include <boost/range/numeric.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/multiprecision/cpp_int.hpp>

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
//using namespace boost::multiprecision;

const long long INF = LLONG_MAX;
const long long MOD = 1000000007;
const long double PI = M_PI;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define CALL(x) x.cbegin(),x.cend()
#define RALL(x) x.rbegin(),x.rend()
#define CRALL(x) x.crbegin(),x.crend()

#define cout cout << fixed << setprecision(12)
#define dbglf cerr << '\n'

#define ACCM(arr) accumulate(ALL(arr),0LL)
#define Yes(ex) cout << ((ex) ? "Yes" : "No") << endl
#define YES(ex) cout << ((ex) ? "YES" : "NO") << endl

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void veccin(vector<T>& v) {
    for (auto && e : v) { cin >> e; }
}

template < typename T >
inline void dbg(T a) { cerr << a << ' '; }

ll n, m, k;
ll ans = 0, sum = 0, cnt = 0;
//long double d;
string s/*1, s2, s3*/;
char c/*1, c2, c3*/;
bool flag = false;

/*--------------------template--------------------*/

int main() {
    cin >> s;
  Yes(s[2]==s[3]&&s[4]==s[5]);
    //cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define	pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigint        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

template <typename T>
T ceil(T a, T b){ return (a+b-1)/b; }

template<typename T>
T binpow(T a, T b) {
    T res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void solve(){
    int n, k;
    cin>>n>>k;
    int a[n];
    FOR(i, 0, n) cin>>a[i];
    int lo = 1, hi = 1e9;
    while(lo<hi) {
        int m = lo+(hi-lo)/2;
        int cnt=0;
        FOR(i, 0, n) {
            cnt+=(ceil(a[i], m)-1);
        }
        if(cnt>k) {
            lo = m+1;
        } else {
            hi = m;
        }
    }
    cout<<lo<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);     
    int t=1;
    //cin>>t;
    FOR(i, 1, t+1){ 
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
 
}



Measured memory_bytes: 5132
N, K = map(int, input().split())
cnt = []
minimum = sum([i for i in range(K-1)])
maximum = sum([i for i in range(N-(K-2), N+1)])

for n in range(K-1, N+1):
    minimum += n
    maximum += (N-n)
    diff = maximum - minimum +1
    cnt.append(diff)
ans = sum(cnt) % (10**9+7)
print(ans)

Measured memory_bytes: 19996
n = int(input())
l = []
dp = [[0]*3 for i in range(n)]
for i in range(n):
	l.append(list(map(int,input().split())))
dp[0] = l[0]
for i in range(1,n):
	for j in range(3):
		if j == 0:
			dp[i][j] = max(dp[i-1][j+1]+l[i][j],dp[i-1][j+2]+l[i][j])
		if j == 1:
			dp[i][j] = max(dp[i-1][j-1]+l[i][j],dp[i-1][j+1]+l[i][j])
		if j == 2:
			dp[i][j] = max(dp[i-1][j-2]+l[i][j],dp[i-1][j-1]+l[i][j])

print(max(dp[-1]))

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

using namespace std;

int main()
{
    int N; cin>>N;
    int AC=0; int WA=0; int TLE=0; int RE=0;
    while(N--){
        string s; cin>>s;
        if(s[0]=='A'){
            AC++;
        }
        else if(s[0]=='W'){
            WA++;
        }
        else if(s[0]=='T'){
            TLE++;
        }
        else {
            RE++;
        }
    }
    cout<<"AC x "<<AC<<"\n";
    cout<<"WA x "<<WA<<"\n";
    cout<<"TLE x "<<TLE<<"\n";
    cout<<"RE x "<<RE<<"\n";
}


Measured memory_bytes: 3592
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    sc.close();
    long sum_N = 1;
    long sum_M = 1;
    long ans = 0;
    int l = (int)Math.pow(10, 9) + 7;
    
    if(Math.abs(N-M) < 2){
      for(int i = 1;i <= N;i++){
        sum_N = sum_N * i % l;
      }
      for(int j = 1;j <= M;j++){
        sum_M = sum_M * j % l;
      }
      if(N==M){
        ans = (sum_N * sum_M * 2) % l;
      }else{
        ans = (sum_N * sum_M) % l;
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 23764
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] count) {

		Scanner scan = new Scanner(System.in);

		int n = Integer.parseInt(scan.next());

		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(scan.next());
		}

		scan.close();

		// start
		Arrays.sort(a);

		List<Integer> alice = new ArrayList<Integer>();
		List<Integer> bob = new ArrayList<Integer>();

		for (int i = a.length - 1; i >= 0; i--) {
			alice.add(a[i]);
			if (i >= 1) {
				bob.add(a[i - 1]);
				i--;
			}
		}

		long sum1 = alice.stream().reduce(Integer::sum).orElse(0);
		long sum2 = bob.stream().reduce(Integer::sum).orElse(0);

		System.out.println(sum1 - sum2);

	}

}


Measured memory_bytes: 28500
N, X, *XS = $stdin.read.split.map(&:to_i)
diffs = (XS + [X]).sort.each_cons(2).map{|a, b| b - a}
p diffs.sort.reverse.inject{|a, b|
  until b == 0
    a, b = b, a % b
  end
  a
}

Measured memory_bytes: 15192
#include<stdio.h>
void bubbleSort(int *,int);
int cnt=0;
int main(){
  int N;
  int A[101];
  int i;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  bubbleSort(A,N);
  printf("%d\n",cnt);
  return 0;
}
void bubbleSort(int A[],int N){
  int flag=1;
  int j,tmp;
  while(flag){
    flag=0;
    for(j=N-1;j>0;j--){
      if(A[j]<A[j-1]){
	tmp=A[j];
	A[j]=A[j-1];
	A[j-1]=tmp;
	flag=1;
	cnt++;
      }
    }
  }
  for(j=0;j<N;j++){
    printf("%d",A[j]);
    if(j!=N-1) printf(" ");
  }
  printf("\n");
}
      



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

int main(){
    int n;
    cin >> n;
    int a,b,c;
    while(cin >> a >> b >> c){
        if(a*a==b*b+c*c || b*b==a*a+c*c || c*c==a*a+b*b ){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

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

int main(){
	string str;
	int count[26]={};
	while(getline(cin,str)){
	for(int i=0;i<str.size();i++){
	if(str[i]>='a'&&str[i]<='z') count[str[i]-'a']++;
	else if(str[i]>='A'&&str[i]<='Z') count[str[i]-'A']++;
	}
	}
	for(int i=0;i<26;i++){
		printf("%c : %d\n",i+'a',count[i]);
	}
}


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

class Cmondai
{
    static void Main()
    {
        var xy = Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray();
        var X = xy[0];
        var Y = xy[1];
        var ans = 0;
        while (X<=Y)
        {
            ans++;
            X *= 2;
        }
        Console.WriteLine(ans);
    }
}

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

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define deb(x)     cout << #x << " = "<<x<<endl

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)

int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;


ll gcd(ll  a , ll b) {
	return (b == 0) ? a : gcd(b, a % b);
}
ll binpow(ll a, ll b) {
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a;
		a = a * a;
		b >>= 1;
	}
	return res;
}
ll powmod(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinv(ll n, ll p)
{
	return powmod(n, MOD - 2, MOD);
}
void max_self(ll &a, ll b) {
	a = max(a, b);
}
bool is_ap(vl v, int n) {
	ll d = v[1] - v[0];
	F0R(i, n) {
		if (v[i] != v[0] + i * d)
			return false;
	}
	return true;
}


int main(int argc, char const *argv[])
{
	// two magical lines to speed up IO
	cin.tie(0);
	ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	string S;
	cin >> S;
	if (S[2] == S[3] && S[4] == S[5])
		cout << "Yes\n";
	else 
		cout << "No\n";
	
}




Measured memory_bytes: 3556
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-10;
const double PI = acos(-1);

struct Vector2{
	double x, y;
	Vector2(){};
	Vector2(double x, double y) : x(x), y(y){};

	double cross(const Vector2& p){
		return x*p.y - y*p.x;
	}

	double dot(const Vector2& p) const{
		return x*p.x + y*p.y;
	}

	const Vector2 medPoint(const Vector2& v){
		return {(x + v.x) / 2.0, (y + v.y) / 2.0};
	}

	const bool operator == (const Vector2& v) const{
		return abs(x - v.x) < EPS && abs(y - v.y) < EPS;
	}
	const bool operator != (const Vector2& v) const{
		return !(*this==(v));
	}

	const Vector2 operator - (const Vector2& p) const{
		return {x-p.x, y-p.y};
	}

	const Vector2& operator += (const Vector2& p) {
		x += p.x;
		y += p.y;
		return *this;
	}

	double dist2(const Vector2& p) const{
		return ((*this) - p).dot((*this) - p);
		//return (x-p.x)*(x-p.x) + (y-p.y)*(y-p.y);
	}

	Vector2 spin(double arg){
		double si = sin(arg);
		double co = cos(arg);
		return {x*co - y*si, x*si + y*co};
	}
};

struct Circle{
	Vector2 p;
	double r;
	Circle(){};
	Circle(const Vector2 &p, double r) : p(p), r(r){};
	Circle(double x, double y, double r) : p({x, y}), r(r){};

	bool isPointIn(const Vector2& v) const{
		return p.dist2(v) < r * r + EPS;
	}
};

vector<Circle> getCircles(const Vector2 &p1, const Vector2 &p2){
	if(p1.dist2(p2) > 4.0 + EPS) return {};
	vector<Circle> ret;
	Vector2 p = p1 - p2;
	// double arg = atan2(p.y, p.x);
	// p = p.spin(-arg);

	// ret.pb({1.0, p.y/2.0, 1.0});
	// ret.pb({-1.0, p.y/2.0, 1.0});

	double arg = atan2(p.y, p.x);
	p = p.spin(-arg);

	double x = p.x/2.0, y = sqrt(1.0-x * x);
	ret.pb({{x, y}, 1.0});
	ret.pb({{x, -y}, 1.0});

	rep(i, 2){
		ret[i].p = ret[i].p.spin(arg);
		ret[i].p += p2;
	}
	return ret;
}

int main(){
	int n;
	while(cin>>n && n){
		vector<Vector2> v;
		rep(i, n){
			double x, y;
			cin>>x>>y;
			v.pb({x, y});
		}
		int ans = 1;
		for(int i = 1; i < n; i++){
			for(int j = 0; j < i; j++){
				vector<Circle> c = getCircles(v[j], v[i]);
				for(int k = 0; k < c.size(); k++){
					int tmp = 0;
					for(int l = 0; l < n; l++){
						if(c[k].isPointIn(v[l])) tmp++;
					}
					ans = max(ans, tmp);
				}
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3684
#include <iostream>
#include <string>
 
int main(int argc, char* argv[]) {
  std::string str("abcde");
  int countACGTLength = 0;
  int maxACGTLength = 0;
  int str_i = 0; 

  std::cin >> str;

  for(str_i = 0; str_i < (int)str.length();  str_i++)
  {
    if( (str[str_i]=='A') ||
        (str[str_i]=='C') ||
        (str[str_i]=='G') ||
        (str[str_i]=='T') )
    {
      countACGTLength++;
      maxACGTLength = std::max(countACGTLength, maxACGTLength);
    }
    else
    {
      countACGTLength = 0;
    }
  }
  std::cout << maxACGTLength << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<malloc.h>
#include<x86intrin.h>

int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

int main(){
    char a,b;
    
    scanf("%c %c",&a,&b);
    printf("%c\n",(a==b)?'H':'D');

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
 
//typedef  long long ll;
using ll = long long;
using ld = long double;
using uint = unsigned int ;
using ull = unsigned long long;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define endl "\n"
#define ioss ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
//#define all(x) x.begin(),x.end();
//#define fi first
//#define se second
 
double startTime;
double getCurrentTime()
{
    return ((double)clock()-startTime)/CLOCKS_PER_SEC;
}
 
void solve()
{
	int n;cin>>n;int flag=0;
  while(n>0)
  {
    int rem=n%10;
    if(rem==7){cout<<"Yes"<<endl;flag=1;break;}
    n=n/10;
  }
  if(flag==0)cout<<"No"<<endl;
}
 
 
int main()
{
    startTime=(double)clock();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt,"w",stdout);
 
    ioss
    //int t;scanf("%d",&t);
   // while(t--) 
            solve();
 
    return 0;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i,3) if(s[i] == t[i]) ++ans;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
  long long n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  vector<int> s;
  vector<int> route(n+1, -1);
  int pos = 1;
  while(route.at(pos) == -1){
 
    route.at(pos) = s.size();
    s.push_back(pos);
    pos = a.at(pos-1);
 
  }
  int c = s.size() - route.at(pos);
  int start = route.at(pos);
  if(k < start) cout << s.at(k) << endl;
  else{
    k -= start;
    k %= c;
    cout << s.at(start+k) << endl;
  }
}

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

using namespace std;
int n;
vector<int> r[100];
bool ud[100];
int func(int a){
  int l=1;
  ud[a]=true;
  for(int j=0;j<r[a].size();++j){
    if(!ud[r[a][j]]){
      l=max(l,func(r[a][j])+1);
    }
  }
  ud[a]=false;
  return l;
}
int main(){
  int f,t;
  while(cin>>n,n){
    int a=0;
    for(int i=0;i<100;++i){
      ud[i]=false;r[i].clear();
    }
    for(int i=0;i<n;++i){
      cin>>f>>t;
      r[f-1].push_back(t-1);r[t-1].push_back(f-1);
    }
    for(int i=0;i<100;++i) a=max(a,func(i));
    cout<<a<<endl;
  }   
  return 0;
}

Measured memory_bytes: 1220
import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    int age = 0;
    int change = 0;
    int result = 0;
    Scanner sc = new Scanner(System.in);
    
    age = sc.nextInt();
    change = sc.nextInt();
    
    if(age <= 5) {
      result = 0;
    }else if((6 <= age) && (age <= 12)) {
      result = change / 2;
    }else {
      result = change;
    }
    
    System.out.println(result);
  }
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

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

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;


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

    string s,t; cin >> s >> t;
    int a,b; cin >> a >> b;
    string u; cin >> u;

    if(u==s) cout << a-1 << " " << b << endl;
    else if (u==t) cout << a << " " << b-1 << endl;
    else cout << a << " " << b << endl;


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N 1000

int main(void){
	char mzr[N],mei[10],cpy[N],p[N];
	int q,a,b,k,i,j=0;
	char pri[]="print";
	char rev[]="reverse";
	char rep[]="replace";
	
	scanf("%s %d",mzr,&q);
	for(k=0;k<q;k++){
		scanf("%s %d %d",mei,&a,&b);
		if(strcmp(mei,pri)==0){
			for(i=a;i<=b;i++){
				printf("%c",mzr[i]);
			}
			printf("\n");
		}
		else if(strcmp(mei,rev)==0){
			strcpy(cpy,mzr);
			for(i=a,j=b;i<=b;i++,j--){
				mzr[i]=cpy[j];
			}
		}
		else if(strcmp(mei,rep)==0){
			scanf("%s",p);
			for(i=a,j=0;i<=b;i++,j++){
				mzr[i]=p[j];
			}
		}
	}
	return 0;
}


Measured memory_bytes: 2124
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   char[] a = sc.next().toCharArray();
   char[] alp = {'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'};
   
   boolean flg = false;
   int tmp = 0;
   for(int i=0;i<26;i++) 
   {
     for(int k=0;k<a.length;k++)
     {
       if(a[k]==alp[i])
       {
         break;
       }
       
       if(k==a.length-1&&a[k]!=alp[i]) flg = true;
     }
     if(flg)
     {
       tmp = i;
       break;
     }
   }
   if(flg) System.out.println(alp[tmp]);
   else System.out.println("None");
 }
}

Measured memory_bytes: 25688