akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <stack>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <set>
#include <functional>
#include <cstring>

using namespace std;

template<typename T> bool chmax( T &a, const T b ) { if ( a <= b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, const T b ) { if ( a >= b ) { a = b; return ( true ); } else { return ( false ); } }

using ll = long long;
using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;

#define eb emplace_back
#define pb push_back
#define mp make_pair

#define F first
#define S second

#define popcnt __builtin_popcountll

#define rep( i, n ) for ( ll i = 0; i < (ll)( n ); ++i )
#define reps( i, n ) for ( ll i = 1; i <= (ll)( n ); ++i )
#define rrep( i, n ) for ( ll i = (ll)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( ll i = (ll)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

template<typename T = ll> constexpr T MAX = numeric_limits<T>::max();
template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }
template<typename T> T lcm( const T a, const T b ) { return ( a / gcd( a, b ) * b ); }


int main()
{
	ll n; cin >> n;
	vector<Pll> d( n );
	rep( i, n ) cin >> d[i].F >> d[i].S;

	bool ok = false;
	ll cnt = 0;
	rep( i, n )
	{
		if ( d[i].F == d[i].S )
			++cnt;
		else
			cnt = 0;
		if ( cnt >= 3 )
		{
			ok = true;
			break;
		}
	}

	if ( ok ) cout << "Yes" << endl;
	else cout << "No" << endl;

	return ( 0 );
}


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

class Program
{
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        string[] fs = Console.ReadLine().Split(' ');

        int[] F = new int[N];

        for (int i = 0; i < N; i++)
            F[i] = int.Parse(fs[i]);
        int s = 0;
        while (F.Max() != 0)
        {
            int b = 0;
            while (b < N - 1 && (F[b] < F[b + 1] || F[b] == 0))
                b++;
            int e = b;
            while (e < N && F[b] <= F[e])
                e++;
            s++;
            for (int i = b; i < e; i++)
                F[i]--;
        }
        Console.WriteLine(s);
    }
}

Measured memory_bytes: 13268
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 3*10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

r1,c1,r2,c2 = map(int, input().split())
ans = cmb(r2+c2+2,c2+1,mod)-cmb(r2+c1+1,c1,mod)-cmb(r1+c2+1,c2+1,mod)+cmb(r1+c1,c1,mod)
print(ans%mod)


Measured memory_bytes: 171956
n = int(input())
alp = []
for i in range(5):
    alp.append(int(input()))
b_neck = min(alp)
if b_neck >= n:
    print(5)
else:
    if n % b_neck == 0:
        print(int(n//b_neck)+4)
    else:
        print(int(n//b_neck)+5)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
long long minim(long long a, long long b) { return a < b ? a : b; }
int main(){
    long long i,x,k,d,modd2,ans,modk2;
    scanf("%lld %lld %lld",&x,&k,&d);
    modk2=k%2;
    x=llabs(x);
    if(x/d>=k-1){
        ans=llabs(x-k*d);
        printf("%lld",ans);
        return 0;
    }
    
    modd2=(x/d)%2;
    if(modk2==modd2)ans=x%d;
    else ans=llabs(x%d-d);
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1736
def gcd(a, b):
    a, b  = max(a, b), min(a, b)
    while a%b != 0:
        a, b = b, a%b
    return b

T = int(input())
set = []
for i in range(T):
    set.append([int(j) for j in input().split()])
 
for i in range(T):
    if set[i][0] < set[i][1] or set[i][1] > set[i][3]:
        print("No")
    elif set[i][2] >= set[i][1]:
        print("Yes")
    else:
        g = gcd(set[i][1], set[i][3])
        amodg = set[i][0]%g
        if set[i][1] - g + amodg <= set[i][2]:
            print("Yes")
        else:
            print("No")

Measured memory_bytes: 3064
#16 C - Bugged
N = int(input())
s = [int(input()) for _ in range(N)]
s = sorted(s,reverse = False)

score = sum(s)
if score%10 == 0:
    for i in s:
        score -= i
        if score%10 != 0:
            break
        score += i
    else:
        score = 0
print(score)

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

typedef long long  LL;
typedef vector <int>  VI;
int n;
LL ans,s;
map <VI,int> M;
VI c[405],x,y,z[4];

void getmin(VI &a)
{
	VI b=a;
	for (int i=1,t; i<4; i++)
		{
			t=b[0],b[0]=b[1],b[1]=b[2],b[2]=b[3],b[3]=t;
			if (b<a)  a=b;
		}
}

int cnt(VI a)
{
	int cnt=1;  VI b=a;
	for (int i=1,t; i<4; i++)
		{
			t=b[0],b[0]=b[1],b[1]=b[2],b[2]=b[3],b[3]=t;
			if (a==b)  cnt++;
		}
	return cnt;
}

void work()
{
	scanf("%d",&n);
	for (int i=1; i<=n; i++)
		{
			c[i].resize(4);
			for (int j=0; j<4; j++)  scanf("%d",&c[i][j]);
			getmin(c[i]),M[c[i]]++;
		}
	for (int i=0; i<4; i++)  z[i].resize(4);
	for (int i=1; i<=n; i++)
		for (int j=1; j<i; j++)
			{
				M[x=c[i]]--,M[y=c[j]]--,reverse(x.begin(),x.end());
				for (int k=0,t; k<4; k++)
					{
						z[0][0]=x[0],z[0][1]=x[1],z[0][2]=y[1],z[0][3]=y[0];
						z[1][0]=x[1],z[1][1]=x[2],z[1][2]=y[2],z[1][3]=y[1];
						z[2][0]=x[2],z[2][1]=x[3],z[2][2]=y[3],z[2][3]=y[2];
						z[3][0]=x[3],z[3][1]=x[0],z[3][2]=y[0],z[3][3]=y[3];
						s=1;
						for (int l=0; l<4; l++)  getmin(z[l]),s*=cnt(z[l])*(M[z[l]]--);
						ans+=s;
						for (int l=0; l<4; l++)  M[z[l]]++;
						t=y[0],y[0]=y[1],y[1]=y[2],y[2]=y[3],y[3]=t;
					}
				M[c[i]]++,M[c[j]]++;
			}
	printf("%lld",ans/3);
}

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


Measured memory_bytes: 139904
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

int main() {
  ll n, m, d;
  cin >> n >> m;
  bool flag = true;
  vector<string> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  d = n - m + 1;

  rep(i, d) {
    rep(j, d) {
      flag = true;
      rep(k, m) {
        rep(l, m) {
          if (b[k][l] != a[k + i][l + j]) flag = false;
        }
      }
      if (flag) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var s = ReadLine();
        var k = ToInt64(ReadLine());
        for (var i = 0; i < s.Length; i++)
            if (s[i] != '1')
            {
                WriteLine(s.Substring(i, 1));
                break;
            }else if (i+1 == k)
            {
                WriteLine("1");
                break;
            }
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 11220
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>

struct MyValue {
	int value, order;

	MyValue(int value, int order) {
		this->value = value;
		this->order = order;
	}
	bool operator<(const MyValue& rhs) {
		return order < rhs.order;
	}
	bool operator>(const MyValue& rhs) {
		return order > rhs.order;
	}
};

int main() {
	int n, m;
	std::vector<int> e;
	std::cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a; std::cin >> a;
		e.push_back(a);
	}

	std::vector<MyValue> v; // 値, 順番
	v.reserve(n + 1);
	v.push_back(MyValue(0, -99999999));
	for (int i = 0; i < n; i++) {
		v.push_back(MyValue(i + 1, i + 1));
	}

	for (int i = 0; i < m; i++) {
		v[e[i]].order = -i;
	}

	std::sort(v.begin(), v.end());

	for (int i = 1; i < v.size(); i++) {
		std::cout << v[i].value << std::endl;
	}

	return 0;
}


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

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            string s = ReadString();

            int i = 0, j = s.Length - 1;
            int answer = 0;
            while (i < j)
            {
                if (s[i] != s[j])
                {
                    answer++;
                }

                i++;
                j--;
            }

            Console.WriteLine(answer);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

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

int N, P, Q, cnt = 1, x, y;

void printVector(const vector<int>& vec) {
  string T;
  for (int value : vec) {
    T += to_string(value + 1);
  }
  int I = stoi(T);
  if (I == P) x = cnt;
  if (I == Q) y = cnt;
  cnt++;
}


int main() {
  cin >> N;
  string p;
  for (int i = 0; i < N; i++) {
    char c;
    cin >> c;
    p += c;
  }
  P = stoi(p);
  string q;
  for (int i = 0; i < N; i++) {
    char c;
    cin >> c;
    q += c;
  }
  Q = stoi(q);

  vector<int> nums(N);
  iota(nums.begin(), nums.end(), 0);

  do {
    printVector(nums);
  } while (next_permutation(nums.begin(), nums.end()));

  cout << abs(x - y) << "\n";
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, k) = readIntList()
    val p = readIntList().sorted()
    var ans = 0
    for (i in 0 until k) {
        ans += p[i]
    }
    println(ans)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 40656
#coding:UTF-8
s = input().split()
a=int(s[0])
b=int(s[1])
c=int(s[2])
for i in range(2):
    if(a>b):
        temp=a
        a=b
        b=temp
    if(b>c):
        temp=b
        b=c
        c=temp
print (a,b,c)

Measured memory_bytes: 7548
#include<bits/stdc++.h>
using namespace std;
set<int> p;
int n,x,num; 
int main()
{
	cin>>x>>n;
	for(int i=0;i<n;i++)
	{
		cin>>num;
		p.insert(num);
	}
	for(int i=0;;i++)
	{
		if(p.count(x-i)==0)
		{
			cout<<x-i;
			break;
		}
		if(p.count(x+i)==0)
		{
			cout<<x+i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3624
import java.util.*


@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = Array(n) { read() }
fun readLines(n: Int) = Array(n) { readLn() }
fun readInts(n: Int) = Array(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = Array(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = Array(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }


fun dfs(u: Int, p: Int, lvl: Int, adj: Array<ArrayList<Int>>, V1: ArrayList<Int>, V2: ArrayList<Int>) {
    if (lvl % 2 == 0) {
        V1.add(u)
    } else {
        V2.add(u)
    }
    for (v in adj[u]) {
        if (v == p) continue
        dfs(v, u, lvl + 1, adj, V1, V2)
    }
}

fun main(args: Array<String>) {

    val N = readInt()
    val adj = Array(N) { ArrayList<Int>() }
    for ((u, v) in (0 until N - 1).map { readInts(2).map { it - 1 } }) {
        adj[u].add(v)
        adj[v].add(u)
    }
    val V1 = ArrayList<Int>()
    val V2 = ArrayList<Int>()
    dfs(0, -1, 0, adj, V1, V2)

    val (I0, I1, I2) = listOf(ArrayList<Int>(),ArrayList<Int>(),ArrayList<Int>())
    for (i in 1..N) {
        if (i % 3 == 1) I1.add(i)
        if (i % 3 == 2) I2.add(i)
        if (i % 3 == 0) I0.add(i)
    }

    val ans = Array(N) { 0 }
    if (Math.min(V1.size, V2.size) < I2.size) {
        val n = if (V1.size < V2.size) V1 else V2
        while (n.size > 0) {
            val t = I0
            ans[n.last()] = t.last()
            t.removeAt(t.size - 1)
            n.removeAt(n.size - 1)
        }
        val m = if (V1.size < V2.size) V2 else V1
        while (m.size > 0) {
            val t = if (I0.isNotEmpty()) I0 else if (I1.isNotEmpty()) I1 else I2
            ans[m.last()] = t.last()
            t.removeAt(t.size - 1)
            m.removeAt(m.size - 1)
        }
    } else {
        val n = if (V1.size < V2.size) V1 else V2
        while (n.size > 0) {
            val t = if (I2.isNotEmpty()) I2 else I0
            ans[n.last()] = t.last()
            t.removeAt(t.size - 1)
            n.removeAt(n.size - 1)
        }
        val m = if (V1.size < V2.size) V2 else V1
        while (m.size > 0) {
            val t = if (I0.isNotEmpty()) I0 else if (I1.isNotEmpty()) I1 else I2
            ans[m.last()] = t.last()
            t.removeAt(t.size - 1)
            m.removeAt(m.size - 1)
        }
    }
    println(ans.joinToString(" "))



}

/*
1 1 5 -> 3
1 5 1 -> 2
5 1 1 -> 1
 */


Measured memory_bytes: 127384
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
int isprime(int x){
  if(x<=1) return 0;
  for(int i=2;i*i<=x;i++)
    if(x%i==0) return 0;
  return 1;
}
//END CUT HERE
signed main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    ans+=isprime(x);
  }
  cout<<ans<<endl;
  return 0;
}
/*
  verified on 2017/12/30
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C&lang=jp
 */

Measured memory_bytes: 3080
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;
typedef vector<long long int> vll;

int main() {
	int n;
	cin >> n;
	vi dp(n + 1, 0);
	rep2(i, 1, n) {
		dp[i] = dp[i - 1] + 1;
		int six = 6;
		while (six <= i) {
			dp[i] = min(dp[i], dp[i - six] + 1);
			six *= 6;
		}
		int nine = 9;
		while (nine <= i) {
			dp[i] = min(dp[i], dp[i - nine] + 1);
			nine *= 9;
		}
	}
	cout << dp[n] << endl;
}


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

int h, w;

int dp[51][51];
int map[51][51];

int main(){
	std::cin >> h >> w;
	for(int i = 0; i < h; ++i){
		for(int j = 0; j < w; ++j){
			char c;
			std::cin >> c;
			map[i][j] = c - '0';
		}
	}

	dp[0][0] = map[0][0];
	for(int i = 1; i < w; ++i)dp[0][i] = dp[0][i - 1] + map[0][i];
	for(int i = 1; i < h; ++i)dp[i][0] = dp[i - 1][0] + map[i][0];


	for(int i = 1; i < h; ++i){
		for(int j = 1; j < w; ++j){
			dp[i][j] = map[i][j] + std::min(dp[i][j - 1], dp[i - 1][j]);
		}
	}

	std::cout << dp[h - 1][w - 1] << std::endl;
	return 0;
}

Measured memory_bytes: 1184
#include "bits/stdc++.h"

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()


using namespace std;

int main()
{
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int x3 = (y1 - y2) + x2;
	int y3 = y2 + (x2 - x1);
	int x4 = -(x2 - x1) + x3;
	int y4 = y3 + (y1 - y2);

	cout << x3 << " " << y3 << " " << x4 << " " << y4;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int w,h;
int xs,ys;
int xg,yg;
int n;
int ib[100][100];
bool used[100][100];
int i,j;
int dx[4]={-1,0,0,1};
int dy[4]={0,1,-1,0};

bool search(int a,int b,int c){
	bool ok=false;
	for(int k=0;k<4;k++){
		if(a+dx[k]>=0&&a+dx[k]<w&&b+dy[k]>=0&&b+dy[k]<h){
			if(!used[a+dx[k]][b+dy[k]]&&ib[a+dx[k]][b+dy[k]]==c){
				used[a+dx[k]][b+dy[k]]=true;
				if(a+dx[k]==xg-1&&b+dy[k]==yg-1)return true;
				if(search(a+dx[k],b+dy[k],c))ok=true;
			}
		}
	}
	return ok;
}

int main(){
	while(1){
		scanf("%d %d",&w,&h);
		if(w==0&&h==0)return 0;
		scanf("%d %d",&xs,&ys);
		scanf("%d %d",&xg,&yg);
		scanf("%d",&n);
		for(i=0;i<w;i++)for(j=0;j<h;j++){
			ib[i][j]=0;
			used[i][j]=false;
		}
		for(i=0;i<n;i++){
			int c,d,x,y;
			scanf("%d %d %d %d",&c,&d,&x,&y);
			if(d==0)for(j=0;j<4;j++)for(int k=0;k<2;k++)ib[x+j-1][y+k-1]=c;
			if(d==1)for(j=0;j<2;j++)for(int k=0;k<4;k++)ib[x+j-1][y+k-1]=c;
		}
		if(search(xs-1,ys-1,ib[xs-1][ys-1]))printf("OK\n");
		else printf("NG\n");
	}
}

Measured memory_bytes: 1076
def solve():
    N,M = map(int,input().split())
    hostile = []
    for _ in range(M):
        a, b = map(int,input().split())
        hostile.append((a,b))
    
    hostile.sort(key=lambda x:x[1])
    ans = 0
    last_cut = -1
    for a,b in hostile:
        if last_cut < a:
            last_cut = b-1
            ans += 1
    
    print(ans)
        
if __name__ == '__main__':
    solve()

Measured memory_bytes: 87016
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	public void run() {
		Scanner sc = new Scanner();
		int A = sc.nextInt();
		int B = sc.nextInt();
		if (A <= 8 && B <= 8) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

	class Scanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[ptr++];
			else
				return -1;
		}

		private boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		private void skipUnprintable() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
		}

		public boolean hasNext() {
			skipUnprintable();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		int nextInt() {
			return (int) nextLong();
		}
	}

}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define se second
#define fi first
#define pb push_back
#define cn cout<<"\n"
#define rep(i,a,b) for(int i = a; i < b; i++)
#define repr(i,a,b) for(int i = a; i >= b; i--)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

#define _ ios::sync_with_stdio(0); cin.tie(0);

#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>
#define flush fflush(stdout)

const int INF = 1e8;
const ll MOD = 1e9 + 7;

using namespace std;


int n;
string s;
map<int, string> id; 
map<string, int> idr; 
map<string, int> no; 
bool is[105][5][5][5];
ll memo[105][5][5][5];


ll dp(int i, int p1, int p2, int p3){
	if(i == n + 1) return 1;
	if(is[i][p1][p2][p3]) return memo[i][p1][p2][p3];

	ll ans = 0;
	rep(r, 0, 4){
		string aux = id[p2] + id[p1] + id[p3];
		string aux1 = id[p1] + id[p3] + id[r];
		string aux2 = id[p1] + id[p3] + id[p2];

		string aux3 = id[p3] + id[p2] + id[r];
		string aux4 = id[p1] + id[p2] + id[r];
		string aux5 = id[p2] + id[r] + id[p3];

		string aux6 = id[p1] + id[p2] + id[p3];
		string aux7 = id[p2] + id[p3] + id[r];

		if(!no.count(aux) && !no.count(aux1) && !no.count(aux2) && !no.count(aux3) && !no.count(aux4) && !no.count(aux5) && !no.count(aux6) && !no.count(aux7))
				ans += dp(i + 1, p2, p3, idr[id[r]])%MOD; 
	}

	is[i][p1][p2][p3] = 1;
	return memo[i][p1][p2][p3] = ans%MOD;
}



int main(){
	_

	cin>>n;

	id[0] = "A";
	id[1] = "G";
	id[2] = "C";
	id[3] = "T";
	id[4] = "X";

	idr["A"] = 0;
	idr["G"] = 1;
	idr["C"] = 2;
	idr["T"] = 3;

	no["AGC"] = 1;

	cout<<dp(1, 4, 4, 4); cn;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define sz(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()

using namespace std;

string s;
int n, k;
vector <pair<int, int>> v;

int main() {	
	cin >> s >> k;
	n = ss(s);
	for (int i = 0; i < n;) {
		int j = i;
		while (j < n && s[i] == s[j]) j++;
		v.pb({s[i] - 'a', j - i});
		i = j;
	}
	if (ss(v) == 1) {
		printf ("%lld\n", (ll) n * k / 2);
		return 0;
	}
	if (v[0].fi != v.back().fi) {
		int sum = 0;
		for (auto it : v)
			sum += it.se / 2;
		printf ("%lld\n", (ll) sum * k);
		return 0;
	}
	ll res = 0;
	rep(i, 1, ss(v) - 2)
		res += (ll) k * (v[i].se / 2);
	int a = v[0].se; int b = v.back().se;
	res += (ll) (k - 1) * ((a + b) / 2);
	res += a / 2 + b / 2;
	printf ("%lld", res);
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)

int main(){
  int n, r;
  while(cin >>n >>r && n){
    vector<int> v;
    for(int i = n; i > 0; i--) v.push_back(i);

    REP(j, r){
      int p, c;
      cin >>p >>c;
      vector<int> next;
      for(int i = 0; i < c; i++) next.push_back(v[p - 1 + i]);
      for(int i = 0; i < p - 1; i++) next.push_back(v[i]);
      for(int i = p + c - 1; i < v.size(); i++) next.push_back(v[i]);
      v = next;
    }
    cout <<v[0] <<endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

double dp[3000][3000]; // [i][j] i枚目のコインを投げたときに表がj枚になる確率

int main() {
  int n; cin >> n;
  double p[n];
  REP(i,n) cin >> p[i];

  dp[0][0] = 1.0;

  REP(i,n) {
    for (int j = 0; j <= i; j++) {
      dp[i+1][j+1] += dp[i][j] * p[i];
      dp[i+1][j] += dp[i][j] * (1.0 - p[i]);
    }
  }

  double res = 0.0;
  for (int i = (n+1)/2; i <= n; i++) res += dp[n][i];
  cout << fixed << setprecision(10) << res << endl;
  return 0;
}

Measured memory_bytes: 68864
#include <stdio.h>
#include "string.h"
#define MAX 100

int main(){
    char hug[MAX];
    int i;
    int count=0;
    if(scanf("%s",hug)==0) return -1;
    for(i=0;i<strlen(hug);i++){
        if(hug[i]!=hug[strlen(hug)-1-i]) count++;
    }
    printf("%d\n",count/2);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <functional>
typedef long long ll;

using namespace std;

class Edge
{
	public:
	ll cost;
	int next;

	Edge(int n,ll c)
	{
		next=n;
		cost=c;
	}
};

vector<Edge> g[1000];
bool used[1000];
ll d[1000];
ll inf = 1e15+7;

int main()
{
	int n,m;
	bool f=false;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		ll c;
		cin>>a>>b>>c;
		a--;
		b--;
		c*=-1;
		g[a].push_back(Edge(b,c));
	}
	fill(used,used+1000,false);
	fill(d,d+1000,inf);
	d[0]=0;
	for(int i=0;i<n+2;i++)
	{
		for(int j=0;j<n;j++)
		{
			for(int k=0;k<g[j].size();k++)
			{
                f = false;
				Edge e =g[j][k];
				if(d[j]!=inf && d[e.next]>d[j]+e.cost)
				{
					d[e.next]=d[j]+e.cost;
					f = true;
				}
			}
		}
	}
	if(f)
		cout<<"inf"<<endl;
	else
		cout<<-1*d[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 384
fun main(args : Array<String>) {
    val (a, b, x) = readLine()!!.split(" ").map { it.toDouble() }
    val h = x / (a*a)

    if (h > b/2.0) {
        val r = Math.atan(2*(a*a*b-x)/(a*a*a))
        println(Math.toDegrees(r))
    } else {
        val r = Math.atan(a*b*b/(2*x))
        println(Math.toDegrees(r))
    }
}

Measured memory_bytes: 36528
#include <bits/stdc++.h>
#define ll long long
#define eps 1e-9
#define PI 2 * acos (0.0)
using namespace std;

vector<int>Road[2 * 100005];
vector<int>Rail[2 * 100005];

int v[2 * 100005];
int comp[2 * 100005];
int ans[2 * 100005];
int ccnt[2 * 100005];
int cnt;
int in;

bool bi[2 * 100005];
int N, L, K;

queue<int>Q;

void dfs(int i)
{
    //cout<<i<<" ";
    while(!Q.empty())
    {
        Q.pop();
    }

    Q.push(i);
    comp[i] = cnt;

    while(!Q.empty())
    {
        i = Q.front();
        Q.pop();

        for(int a = 0; a < Road[i].size(); a++)
        {
            if(!comp[ Road[i][a] ])
            {
                Q.push(Road[i][a]);
                comp[ Road[i][a] ] = cnt;
            }
        }
    }
}

void do_dfs(int i)
{
    while(!Q.empty())
    {
        Q.pop();
    }

    Q.push(i);
    bi[i] = true;
    v[in++] = i;

    while(!Q.empty())
    {
        i = Q.front();
        Q.pop();
        for(int a = 0; a < Rail[i].size(); a++)
        {
            if(bi[ Rail[i][a] ])
            {
                continue;
            }
            Q.push(Rail[i][a]);
            bi[ Rail[i][a] ] = true;
            v[in++] = Rail[i][a];
        }
    }
}

int main()
{

    scanf("%d %d %d", &N, &K, &L);

    int a,b,c,d,e,x,y,z;

    for(a = 0; a < K; a++)
    {
        scanf("%d %d", &x, &y);
        Road[x].push_back(y);
        Road[y].push_back(x);
    }

    for(a = 0; a < L; a++)
    {
        scanf("%d %d", &x, &y);
        Rail[x].push_back(y);
        Rail[y].push_back(x);
    }

    cnt = 0;

    for(a = 1; a <= N; a++)
    {
        if(!comp[a])
        {
            cnt++;
            //cout<<"\nComponent "<<cnt<<endl;
            dfs(a);
        }
    }

    for(a = 1; a <= N; a++)
    {
        if(!bi[a])
        {
            in = 0;
            do_dfs(a);
            for(b = 0; b < in; b++)
            {
                //cout<<v[b]<<" ";
                ccnt[ comp[ v[b] ] ]++;
            }
            for(b = 0; b < in; b++)
            {
                ans[ v[b] ] = ccnt[ comp[ v[b] ] ];
            }
            for(b = 0; b < in; b++)
            {
                ccnt[ comp[ v[b] ] ] = 0;
            }
        }
    }

    for(a = 1; a <= N; a++)
    {
        if(a != 1) printf(" ");
        printf("%d", ans[a]);
    }printf("\n");


    return 0;
}


Measured memory_bytes: 18816
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma") 
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
template <class Q>
void clearQueue(Q & q) {
    q=Q();
}
int dp[1000002][2][2];
int func(int idx,int av0,int av9){
	if(idx==0) return 1;
	if(dp[idx][av0][av9]!=-1) return dp[idx][av0][av9];
	int ans=0;
	if(idx==1&&av0==1&&av9==1) return dp[idx][av0][av9]=0;
	else if(idx==2&&av0==1&&av9==1){
		ans=ans+func(1,0,1)+func(1,1,0);
	}
	else if((idx==1&&av0==1)||(idx==1&&av9==1)){
		ans=ans+func(0,0,0);
	}
	else{
		for(int i=0;i<=9;i++){
			if(i==0)
			ans=ans+func(idx-1,0,av9);
			else if(i==9) ans=ans+func(idx-1,av0,0);
			else
			{
				ans=ans+func(idx-1,av0,av9);	
			}
		}
	}
	ans=ans%MOD;
	return dp[idx][av0][av9]=ans;
}
void solve(){
	memset(dp,-1,sizeof dp);
	int n;cin>>n;
	cout<<func(n,1,1);
}	
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
}

Measured memory_bytes: 113016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    ll n,k;cin>>n>>k;
    ll a[n+1];rep(i,1,n)cin>>a[i];
    if(k<=n*2){
        ll now=1;
        rep(i,0,k-1){
            now=a[now];
        }
        cout<<now<<endl;
        return 0;
    }
    
    ll b[n+1];rep(i,1,n)b[i]=-1;
    b[1]=0;
    ll now=1;
    ll c=0;
    ll to,w;
    ll flag;
    while(true){
        now=a[now];
        c++;
        if(b[now]!=-1){
            to=b[now];
            w=c-b[now];
            flag=((k-to)%w)+to;
            break;
        }else{
            b[now]=c;
        }
    }
    rep(i,1,n){
        if(b[i]==flag){
            cout<<i<<endl;
            return 0;
        }
    }
    
    return 0;
}




Measured memory_bytes: 6780
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int sum = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = n;
		int i = 100000000;
		
		while(true) {
			if(i <= m) {
				m = m - i;
				sum++;
			}else{
				if(m == 0)break;
				i = i / 10;
			}
		}
		
		if(n % sum == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		sc.close();
	}

}


Measured memory_bytes: 21716
import java.util.*;
public class Main  {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      String a = sc.next();
      
      char[] aa = a.toCharArray();
      
      if (Character.isUpperCase(aa[0])) {
         System.out.println("A");
      } else {
         System.out.println("a");
      }
   }
}

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

int main() {
  string S;
  cin>>S;
  int x=0;
  for(int i=0;i<3;i++){
    if(S[i]=='A') x++;
  }
  if(x==0 || x==3) cout<<"No";
  else cout<<"Yes";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rep2(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rev(i, n) for (int (i) = (n)-1; (i) >= 0; (i)--)
#define rev2(i, a, b) for (int (i) = (a)-1; (i) >= (b); (i)--)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pll = pair<long long, long long>;
template<class T> using Vec = vector<T>;
template<class T> using VVec = vector<vector<T>>;
long long TEN(int i) {return !i ? 1 : TEN(i-1)*10LL;}
template<class T, class U> 
bool chmin(T& a, const U& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T, class U> 
bool chmax(T& a, const U& b) {if (a < b) {a = b; return 1;} return 0;}
 
struct IoSetup {
  	IoSetup() {
    	cin.tie(nullptr);
    	ios::sync_with_stdio(false);
    	cout << fixed << setprecision(10);
  	}
} iosetup;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//


int main() {
	string S, T;
	cin >> S >> T;

	int szS = S.size();
	int szT = T.size();

	int ans = TEN(9);
	rep (i, szS - szT + 1) {
		int cnt = 0;
		string tmp = S.substr(i, szT);
		rep (j, szT) if (tmp[j] != T[j]) cnt++;
		chmin(ans, cnt);
	}

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


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


int main() {
  int y, m, d;
  char c1, c2;
  cin >> y >> c1 >> m >> c2 >>d;
  if (m <= 4) cout << "Heisei" << endl;
  else cout << "TBD" << endl;
  
  return 0;
}

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

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> x(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}
	int res = 1e9;
	for (int i = 0; i + K <= N; i++) {
		if (x[i] <= 0 && 0 <= x[i + K - 1]) {
			res = min(res, x[i + K - 1] - x[i] + min(abs(x[i]), x[i + K - 1]));
		}
		else {
			res = min(res, max(abs(x[i]), abs(x[i + K - 1])));
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;

class TEST
{
    public static void Main()
    {
        int num = int.Parse(Console.ReadLine());
        string str = Console.ReadLine();

        string x, y;
        int best = 0;
        for (int i = 1; i < num; i++)
        {
            x = str.Substring(0, i);
            y = str.Substring(i, num  - i);
            //Console.WriteLine(x);
            //Console.WriteLine(y);
            //Console.WriteLine("---");
            int count = GetSameStr(x, y);
            if (best < count)
                best = count;
        }

        Console.WriteLine(best);
      //  Console.ReadLine();
    }

    static int GetSameStr(string xs, string ys)
    {
        List<char> list = new List<char>();
        string x, y;
        int count = 0;

        if (xs.Length > ys.Length)
        {
            x = xs;
            y = ys;
        }
        else
        {
            y = xs;
            x = ys;
        }

        foreach (char value in y)
        {
            if (x.Contains(value) && !list.Contains(value))
            {
                list.Add(value);
                count++;
            }
        }

        return count;
    }
}

Measured memory_bytes: 27688
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, cnt = 0;
    scanf("%d", &n);
    //for (int i = 0; i < n; i++)
    //    scanf("%d", &a[i]);
    while (n > 0){
        if (n % 10 == 2)
            cnt++;
        n /= 10;
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N, K;
  cin >> N >> K;
  vpll ab(N);
  rep(i, N) cin >> ab[i].first >> ab[i].second;

  stable_sort(ab.begin(), ab.end());

  ll cnt = 0;

  rep(i, N){
    cnt += ab[i].second;

    if(cnt >= K){
      cout << ab[i].first << endl;
      return 0;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3328
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  string s;
  char acgt[4];
  int max = 0,cur=0,ii;

  cin >> s;

  for(ii=0;ii<s.length();ii++){

    if(s[ii] == 'A'||
       s[ii] == 'C'||
       s[ii] == 'G'||
       s[ii] == 'T'){
      cur++;
    }
    else{
      cur =0;
    }
    if(cur >= max){
      max = cur;
    }
  }
  cout << max << endl;
  return 0;
}


Measured memory_bytes: 256
import itertools

N = int(input())
A = [input() for _ in range(N)]

C = [0, 0, 0, 0, 0]

for i in range(N):
    a = A[i]
    if a.startswith('M'):
        C[0] += 1
    elif a.startswith('A'):
        C[1] += 1
    elif a.startswith('R'):
        C[2] += 1
    elif a.startswith('C'):
        C[3] += 1
    elif a.startswith('H'):
        C[4] += 1

total = 0
for c in itertools.combinations(C, 3):
    total += c[0] * c[1] * c[2]

print(total)

Measured memory_bytes: 9776
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		
		String str = br.readLine();
//		int n = Integer.parseInt(br.readLine());
		
		String[] tmpArray = str.split(" ");
		
		Point2D.Double p1 = new Point2D.Double(Double.parseDouble(tmpArray[0]), Double.parseDouble(tmpArray[1]));
		Point2D.Double p2 = new Point2D.Double(Double.parseDouble(tmpArray[2]), Double.parseDouble(tmpArray[3]));
		
		System.out.println(p1.distance(p2));
		

//		System.out.println(count);

//
//			if(Character.isLowerCase(c)){
//				System.out.print(Character.toUpperCase(c));
//			}
//
//			else if(Character.isUpperCase(c)){
//				System.out.print(Character.toLowerCase(c));
//			}
//			else {
//				System.out.print(c);
//			}
//		}
//		System.out.println();

//		String[] tmpArray = br.readLine().split(" ");
//		int n = Integer.parseInt(tmpArray[0]);
//		int m = Integer.parseInt(tmpArray[1]);
//		int l = Integer.parseInt(tmpArray[2]);
//
//		long[][] a = new long[n][m];
//		long[][] b = new long[m][l];
//		long[][] c = new long[n][l];
//
//		for(int i = 0; i < n; i ++){
//			tmpArray = br.readLine().split(" ");
//			for(int j = 0; j < m; j++){
//				a[i][j] = Long.parseLong(tmpArray[j]);
//			}
//		}
//
//		for(int i = 0; i < m; i ++){
//			tmpArray = br.readLine().split(" ");
//			for(int j = 0; j < l; j++){
//				b[i][j] = Integer.parseInt(tmpArray[j]);
//			}
//		}
//
//		for(int i = 0; i < n; i++){
//			for(int j = 0; j < l; j++){
//				for(int k = 0; k < m; k++){
//					c[i][j] += a[i][k]*b[k][j];
//				}
//
//				if(j != 0 ){
//					System.out.print(" ");
//				}
//				System.out.print(c[i][j]);
//			}
//			System.out.println();
//		}


	}

}

Measured memory_bytes: 24608
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    int a,b,c;
    String str;
    Scanner scr = new Scanner(System.in);
    a = scr.nextInt();
    b = scr.nextInt();
    c = scr.nextInt();
    if(a==7) {
    	if(b==5 && c==5) {
    		str="YES";
    	}else{
    		str="NO";
    	}
    }else if(a==5) {
    	if(b==5 && c==7) {
    		str="YES";
    	}else if(b==7 && c==5) {
    		str="YES";
    	}else {
    		str="NO";
    	}
    }else{
    	str="NO";
    }
    System.out.println(str);
  }
}

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

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  
  ll sum = 0, num = 0;
  int x, ans = 0;
  string s;
  vector<int> a, b;
  for(int i=0; i<n; i++) {
    cin >> x;
    a.push_back(x);
    sum += x;
    if(sum>k) {
      ans = i;
      num = sum-x;
      a.pop_back();
      getline(cin, s);
      break;
    }
    if(i==n-1) {
      ans = i+1;
      num = sum;
    }
  }
  
  sum = 0;
  for(int i=0; i<m; i++) {
    cin >> x;
    b.push_back(x);
    sum += x;
    if(sum>k) {
      if(ans<i) {
        ans = i;
        num = sum-x;
      }
      b.pop_back();
      getline(cin, s);
      break;
    }
    if(i==m-1 && ans<i+1) {
      ans = i+1;
      num = sum;
    }
  }
  
  int c = 0;
  ll d = 0;
  bool check = false;
  if(a.size()>=b.size()) {
    for(int i=a.size(); i>=0; i--) {
      if(i!=a.size()) num -= a[i];
      ll t = num;
      for(int j=c; j<b.size(); j++) {
        if(j==c) t += d;
        t += b[j];
        if(t>k) {
          ans = max(ans, i+j);
          c = j;
          d = t-b[j]-num;
          break;
        }
        if(j==b.size()-1) {
          ans = max(ans, i+j+1);
          check = true;
        }
      }
      if(check) break;
    }
  }
  
  else {
    for(int i=b.size(); i>=0; i--) {
      if(i!=b.size()) num -= b[i];
      ll t = num;
      for(int j=c; j<a.size(); j++) {
        if(j==c) t += d;
        t += a[j];
        if(t>k) {
          ans = max(ans, i+j);
          c = j;
          d = t-a[j]-num;
          break;
        }
        if(j==a.size()-1) {
          ans = max(ans, i+j+1);
          check = true;
        }
      }
      if(check) break;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6968
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<deque>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000






int main(){
	vector<int>a;
	int n, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	s = 0;
	ans = 0;
	scanf("%d %d", &n,&k);
	f(i, n){
		scanf("%d", &x);
		a.push_back(x);
	}
	sort(a.begin(), a.end());
	f(i, n){
		if (a[i] <= k){
			ans++;
			k -= a[i];
		}
	}
	if (k != 0 && ans == n)ans = n - 1;
	printf("%d\n", ans);


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    string S;
    cin >> S;
    int N = S.size();
    // "A"と"BC"の塊で考える
    // "BC"の前にある"A"の数を"BC"の数だけ足す
    // "BC"にならない"B"や"C"があれば"A"の数をリセット
    ll cnt=0;
    ll ans=0;
    for(int i=0;i<N-1;i++){
        if(S[i]=='A'){
            cnt++;
        }else{
            if(S[i]=='B'&&S[i+1]=='C'){
                ans += cnt;
                i++;
            }else{
                cnt = 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
 
int main()
{
  int i;
  int x;
  for(i=1;i<=5;i++)
  {
    cin>>x;
    if(x==0)
    {
      cout<<i<<"\n";
      break;
    }
  }
  return(0);
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<double>a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a.begin(),a.end());
    double sum=(a[0]+a[1])/2;
    for(int i=2;i<n;i++){
        sum=(sum+a[i])/2;
    }
    cout<<sum;
}


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

int main()
{int n;
		cin>>n;
		int s[n];
		for(int i=0;i<n;i++)cin>>s[i];
		int a[n];
		a[n-1]=0;
		a[n-2]=s[n-1]>s[n-2]?(s[n-1]-s[n-2]):(s[n-2]-s[n-1]);
		for(int i=n-3;i>=0;i--){
		    int m1=a[i+2]+((s[i+2]>s[i])?(s[i+2]-s[i]):(s[i]-s[i+2]));
		    int m2=a[i+1]+((s[i+1]>s[i])?(s[i+1]-s[i]):(s[i]-s[i+1]));
		    a[i]=m1>m2?m2:m1;
		}
		cout<<a[0];
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

void ch_line(char ch, int num);

int main()
{
	int n;
	char str[105];
	int op, ed;
	op = ed = 0;

	scanf("%d", &n);
	scanf("%s", str);

	for (int i = 0; i < n; i++){
		if(str[i] == '(') {
			op++;
		}

		if (str[i] == ')') {
			if (op > 0) {
				op--;
			} else {
				ed++;
			}
		}
	}

	ch_line('(', ed);
	printf("%s", str);
	ch_line(')', op);

	putchar('\n');

	return 0;
}

void ch_line(char ch, int num)
{
	while(num--) {
		putchar(ch);
	}

	return;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;


int main()
{
    long long n,x;
    long long a[120];
    cin>>n>>x;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int res=0;
    for(int i=0;i<n;i++){

        if(x>= a[i]){
            if(i==n-1 && x> a[i])
            break;
            res++;
            x-=a[i];
        }
    }
    cout<<res<<endl;

	return 0;
}



























Measured memory_bytes: 256
def main():
    import math
    from collections import Counter

    N,M = map(int,input().split())
    a = []
    def prime_factorize(n):
        while n % 2 == 0:
            a.append(2)
            n //= 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                a.append(f)
                n //= f
            else:
                f += 2
        if n != 1:
            a.append(n)
        return a
    prime_factorize(M)
    def combinations_count(n, r):
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    divisors = Counter(a)
    count = 1
    for k,v in divisors.items():
        count *= combinations_count(v+N-1,v)

    print(count%(10**9+7))
main()

Measured memory_bytes: 114524
#include<iostream>
#include<cstdint>
#include<algorithm>
#include<cstddef>

using u32 = std::uint_fast32_t;
using usize = std::size_t;

#include <utility>

template <class T> T gcd(T m, T n) {
	while (m %= n)
		::std::swap(m, n);
	return n;
}


int main() {
	u32 a, b;
	usize k;
	std::cin >> a >> b >> k;

	const u32 c = gcd(a, b);
	u32 i = c + 1;
	while (k != static_cast<usize>(0)) {
		--i;
		if (c%i == static_cast<u32>(0)) {
			--k;
		}
	}
	std::cout << i << std::endl;
	return 0;
}


Measured memory_bytes: 256